@directivsys/core-sdk
v0.1.6
Published
Framework-agnostic TypeScript SDK for DirectivSys conversational orchestration, analytics, and reports.
Maintainers
Readme
@directivsys/core-sdk
@directivsys/core-sdk is the framework-agnostic TypeScript foundation for DirectivSys frontend integrations. It extracts the reusable orchestration, analytics, reporting, and browser-adapter logic out of the original React SDK so that multiple framework adapters can share the same runtime behavior and data contracts.
Scope
The package is intentionally focused on plain TypeScript concerns. It provides the DirectivSys transport clients, the conversation controller that manages orchestrator sessions and chained tool execution, shared analytics and report contracts, portable utilities, and browser voice adapters.
| Area | Included in the core package |
| --- | --- |
| Transport | DirectivSysAPI, AnalyticsAPI |
| Conversation runtime | DirectivSysConversationController |
| Shared domain contracts | Orchestrator, analytics, reports, voice, and runtime types |
| Utilities | Context diffing, request cache, and date-range helpers |
| Browser adapters | Web Speech STT and TTS providers |
Installation
npm install @directivsys/core-sdkBasic client usage
import { DirectivSysAPI } from "@directivsys/core-sdk";
const api = new DirectivSysAPI({
apiKey: process.env.DIRECTIVSYS_API_KEY!,
baseURL: "https://api.directivsys.com",
timeout: 30_000,
});
const response = await api.sendTextRequest(
"user-123",
"Summarize current inventory risk.",
{
interfaceState: {
currentPageName: "Inventory Dashboard",
currentPageUrl: "/inventory",
},
},
);Conversation controller usage
The conversation controller is the main extraction from the previous React-specific runtime. It owns request assembly, session continuity, assistant message sanitization, and sequential tool-call execution.
import {
DirectivSysAPI,
DirectivSysConversationController,
type ToolResult,
} from "@directivsys/core-sdk";
const api = new DirectivSysAPI({ apiKey: "your-api-key" });
const controller = new DirectivSysConversationController({
api,
currentContext: {
userId: "user-123",
interfaceState: {
currentPageName: "Operations Console",
},
},
onIntentDetected: async (toolCall): Promise<ToolResult> => {
return {
status: "success",
summary: `Executed ${toolCall.toolName}`,
};
},
});
controller.subscribe((state) => {
console.log(state.messages);
});
await controller.sendChatQuery("What should I do next?");Package boundaries
The package is designed to stay free of framework state-management concerns.
| Concern | Package |
| --- | --- |
| Plain TypeScript runtime and clients | @directivsys/core-sdk |
| React context, hooks, and UI | @directivsys/react-sdk |
| Future Angular integration | framework adapter package |
| Future Vue integration | framework adapter package |
Exports
The main public exports are the API clients, the conversation controller, browser voice providers, shared utilities, and the portable type contracts used by adapter packages.
