@theokit/sdk 2.19.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -0
- package/dist/a2a/index.cjs +611 -274
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +612 -275
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/types.d.cts +7 -0
- package/dist/a2a/types.d.ts +7 -0
- package/dist/agent-builder.d.ts +2 -1
- package/dist/agent-generate.d.ts +12 -0
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +5 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/theokit-client.d.cts +6 -0
- package/dist/client/theokit-client.d.ts +6 -0
- package/dist/client/types.d.cts +2 -0
- package/dist/client/types.d.ts +2 -0
- package/dist/create-skill.d.ts +29 -0
- package/dist/{cron-D_wK1S-0.d.cts → cron-YrmsszEN.d.cts} +110 -3
- package/dist/{cron-Cep07kTz.d.ts → cron-dpvtRoro.d.ts} +110 -3
- package/dist/cron.cjs +660 -370
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +3 -2
- package/dist/cron.d.ts +3 -2
- package/dist/cron.js +661 -371
- package/dist/cron.js.map +1 -1
- package/dist/{errors-5lj1EWgs.d.ts → errors-C4vZPqXf.d.ts} +2 -2
- package/dist/{errors-CE-lMBi2.d.cts → errors-DrcpYVfZ.d.cts} +2 -2
- package/dist/errors.d.cts +3 -2
- package/dist/eval.cjs +660 -370
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +660 -370
- package/dist/eval.js.map +1 -1
- package/dist/generate-object.d.ts +19 -4
- package/dist/index.cjs +867 -371
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +274 -16
- package/dist/index.d.ts +274 -16
- package/dist/index.js +863 -373
- package/dist/index.js.map +1 -1
- package/dist/internal/agent-loop/loop-types.d.ts +2 -0
- package/dist/internal/agent-loop/tool-result-guard.d.ts +1 -0
- package/dist/internal/llm/tool-result-content.d.ts +40 -0
- package/dist/internal/llm/types.d.ts +6 -1
- package/dist/internal/persistence/conversation-storage-fs.d.cts +3 -1
- package/dist/internal/persistence/conversation-storage-fs.d.ts +3 -1
- package/dist/internal/persistence/conversation-storage-memory.d.cts +3 -1
- package/dist/internal/persistence/conversation-storage-memory.d.ts +3 -1
- package/dist/internal/persistence/session-meta.d.cts +13 -0
- package/dist/internal/persistence/session-meta.d.ts +13 -0
- package/dist/internal/runtime/model-selection.d.ts +14 -0
- package/dist/internal/structured-output-helpers.d.ts +1 -1
- package/dist/permission-engine.d.ts +32 -1
- package/dist/{run-BgfBWX-z.d.cts → run-BMo8yRwK.d.cts} +262 -19
- package/dist/{run-BgfBWX-z.d.ts → run-BMo8yRwK.d.ts} +262 -19
- package/dist/stream-object.d.ts +2 -1
- package/dist/tool-error.d.ts +30 -0
- package/dist/types/agent-prims.d.ts +10 -8
- package/dist/types/agent.d.ts +22 -1
- package/dist/types/content-blocks.d.ts +47 -0
- package/dist/types/conversation-storage.d.ts +38 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messages.d.ts +2 -9
- package/dist/types/run-events.d.ts +84 -0
- package/dist/types/run.d.ts +115 -1
- package/dist/types/session.d.ts +99 -0
- package/dist/types/workflow.d.ts +7 -0
- package/dist/workflow.cjs +7 -2
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +2 -0
- package/dist/workflow.d.ts +2 -0
- package/dist/workflow.js +7 -2
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -23
- package/dist/internal/observability/context.d.cts +0 -23
- package/dist/internal/observability/context.d.ts +0 -23
- package/dist/internal/observability/index.cjs +0 -38
- package/dist/internal/observability/index.cjs.map +0 -1
- package/dist/internal/observability/index.d.cts +0 -8
- package/dist/internal/observability/index.d.ts +0 -8
- package/dist/internal/observability/index.js +0 -33
- package/dist/internal/observability/index.js.map +0 -1
- package/dist/internal/plugins/index.cjs +0 -363
- package/dist/internal/plugins/index.cjs.map +0 -1
- package/dist/internal/plugins/index.js +0 -357
- package/dist/internal/plugins/index.js.map +0 -1
- package/dist/internal/workflow/index.d.ts +0 -12
- package/dist/server/adapter/index.d.cts +0 -8
- package/dist/server/adapter/index.d.ts +0 -8
package/dist/a2a/types.d.cts
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
* A2A (Agent-to-Agent) communication types (T20.1, ADR D453).
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
+
import type { MessageOrigin } from "../types/run.js";
|
|
5
6
|
export interface A2AMessage<T = unknown> {
|
|
6
7
|
type: string;
|
|
7
8
|
payload: T;
|
|
8
9
|
from: string;
|
|
9
10
|
to: string;
|
|
10
11
|
timestamp: number;
|
|
12
|
+
/**
|
|
13
|
+
* SE3 — provenance projection of the sender address: `{ kind: "peer", from }`.
|
|
14
|
+
* A thin view over `from` (not a parallel system), so a receiver that turns an
|
|
15
|
+
* a2a message into a turn can forward it via `SendOptions.origin`.
|
|
16
|
+
*/
|
|
17
|
+
origin?: MessageOrigin;
|
|
11
18
|
}
|
|
12
19
|
export type MessageHandler<T = unknown> = (message: A2AMessage<T>) => undefined | unknown | Promise<undefined | unknown>;
|
package/dist/a2a/types.d.ts
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
* A2A (Agent-to-Agent) communication types (T20.1, ADR D453).
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
+
import type { MessageOrigin } from "../types/run.js";
|
|
5
6
|
export interface A2AMessage<T = unknown> {
|
|
6
7
|
type: string;
|
|
7
8
|
payload: T;
|
|
8
9
|
from: string;
|
|
9
10
|
to: string;
|
|
10
11
|
timestamp: number;
|
|
12
|
+
/**
|
|
13
|
+
* SE3 — provenance projection of the sender address: `{ kind: "peer", from }`.
|
|
14
|
+
* A thin view over `from` (not a parallel system), so a receiver that turns an
|
|
15
|
+
* a2a message into a turn can forward it via `SendOptions.origin`.
|
|
16
|
+
*/
|
|
17
|
+
origin?: MessageOrigin;
|
|
11
18
|
}
|
|
12
19
|
export type MessageHandler<T = unknown> = (message: A2AMessage<T>) => undefined | unknown | Promise<undefined | unknown>;
|
package/dist/agent-builder.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export declare class AgentBuilder {
|
|
|
18
18
|
private opts;
|
|
19
19
|
private readonly deps;
|
|
20
20
|
constructor(deps?: AgentBuilderDeps);
|
|
21
|
-
|
|
21
|
+
/** SE8 — accepts a bare-string id shorthand (`"openai/gpt-4o-mini"`) or a {@link ModelSelection}. */
|
|
22
|
+
model(m: string | ModelSelection): this;
|
|
22
23
|
apiKey(k: string): this;
|
|
23
24
|
name(n: string): this;
|
|
24
25
|
systemPrompt(p: string | SystemPromptResolver): this;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SE9 — integrated structured output: `agent.generate(input, { output })` runs the
|
|
3
|
+
* agent's NORMAL tool loop (the user's tools run first) and then coerces the final
|
|
4
|
+
* answer into a Zod schema, returning a validated, inferred-typed object.
|
|
5
|
+
*
|
|
6
|
+
* This is SUGAR over `generateObject` (ADR D33) — it does NOT fork the
|
|
7
|
+
* synthetic-forced-tool machinery. Phase 1 is the user's own `agent.send()` run;
|
|
8
|
+
* phase 2 reuses `generateObjectImpl` over the run's final answer.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type { GenerateOptions, GenerateRunResult } from "./types/run.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/theokit-client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/client/theokit-client.ts"],"names":[],"mappings":";;;AAkBO,IAAM,gBAAN,MAAoB;AAAA,EACR,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,IAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA,CAAK,OAAA,CA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dependencies. Uses native fetch + manual SSE parsing.\n * Consumes the same HTTP contract as server adapters (POST /send, GET /stream).\n *\n * @public\n * @deprecated since 2.x — consumes a legacy server-adapter HTTP contract\n * (`POST /agent/send`, `GET /agent/stream`) that the ecosystem no longer\n * produces. For in-process agent runs use the `Agent` façade (`@theokit/sdk`);\n * for HTTP, the framework (`theokit`) exposes agents at `POST /api/agents/<name>`\n * over a `UIMessageStream` with its own typed client. The `@theokit/sdk/client`\n * sub-path will be removed in the next major.\n */\n\nimport type { ClientOptions, SendResponse, StreamEvent } from \"./types.js\";\n\nexport class TheoKitClient {\n private readonly _baseUrl: string;\n private readonly _basePath: string;\n private readonly _headers: Record<string, string>;\n\n constructor(opts: ClientOptions) {\n this._baseUrl = opts.baseUrl.replace(/\\/$/, \"\");\n this._basePath = opts.basePath ?? \"/agent\";\n this._headers = opts.headers ?? {};\n }\n\n async send(input: string): Promise<SendResponse> {\n const url = `${this._baseUrl}${this._basePath}/send`;\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...this._headers,\n },\n body: JSON.stringify({ input }),\n });\n\n if (!response.ok) {\n throw new Error(`TheoKitClient: send failed with status ${response.status}`);\n }\n\n return (await response.json()) as SendResponse;\n }\n\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: SSE stream parsing with fetch + ReadableStream reader requires sequential control flow\n async *stream(input: string): AsyncGenerator<StreamEvent, void, void> {\n const url = `${this._baseUrl}${this._basePath}/stream?input=${encodeURIComponent(input)}`;\n const response = await fetch(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...this._headers,\n },\n });\n\n if (!response.ok) {\n throw new Error(`TheoKitClient: stream failed with status ${response.status}`);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error(\"TheoKitClient: response body is not readable\");\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n try {\n // jscpd:ignore-start — SSE stream buffer pattern (different protocol from NDJSON in ollama-native)\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n // jscpd:ignore-end\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"data: \")) {\n const data = trimmed.slice(6);\n if (data === \"[DONE]\") return;\n try {\n yield JSON.parse(data) as StreamEvent;\n } catch {\n // Skip malformed SSE data lines\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n}\n"]}
|
package/dist/client/index.d.cts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Client sub-path barrel (T20.2, ADR D454).
|
|
3
3
|
* Exported via `@theokit/sdk/client`.
|
|
4
4
|
* @public
|
|
5
|
+
* @deprecated since 2.x — the `@theokit/sdk/client` sub-path consumes a legacy
|
|
6
|
+
* server-adapter HTTP contract (`/agent/send`, `/agent/stream`) that the
|
|
7
|
+
* ecosystem no longer produces. Use the `Agent` façade (`@theokit/sdk`) for
|
|
8
|
+
* in-process runs, or the framework's `POST /api/agents/<name>` typed client for
|
|
9
|
+
* HTTP. This sub-path will be removed in the next major.
|
|
5
10
|
*/
|
|
6
11
|
export { TheoKitClient } from "./theokit-client.js";
|
|
7
12
|
export type { ClientOptions, SendResponse, StreamEvent } from "./types.js";
|
package/dist/client/index.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Client sub-path barrel (T20.2, ADR D454).
|
|
3
3
|
* Exported via `@theokit/sdk/client`.
|
|
4
4
|
* @public
|
|
5
|
+
* @deprecated since 2.x — the `@theokit/sdk/client` sub-path consumes a legacy
|
|
6
|
+
* server-adapter HTTP contract (`/agent/send`, `/agent/stream`) that the
|
|
7
|
+
* ecosystem no longer produces. Use the `Agent` façade (`@theokit/sdk`) for
|
|
8
|
+
* in-process runs, or the framework's `POST /api/agents/<name>` typed client for
|
|
9
|
+
* HTTP. This sub-path will be removed in the next major.
|
|
5
10
|
*/
|
|
6
11
|
export { TheoKitClient } from "./theokit-client.js";
|
|
7
12
|
export type { ClientOptions, SendResponse, StreamEvent } from "./types.js";
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/theokit-client.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/client/theokit-client.ts"],"names":[],"mappings":";AAkBO,IAAM,gBAAN,MAAoB;AAAA,EACR,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,IAAA,EAAqB;AAC/B,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,OAAO,EAAE,CAAA;AAC9C,IAAA,IAAA,CAAK,SAAA,GAAY,KAAK,QAAA,IAAY,QAAA;AAClC,IAAA,IAAA,CAAK,QAAA,GAAW,IAAA,CAAK,OAAA,IAAW,EAAC;AAAA,EACnC;AAAA,EAEA,MAAM,KAAK,KAAA,EAAsC;AAC/C,IAAA,MAAM,MAAM,CAAA,EAAG,IAAA,CAAK,QAAQ,CAAA,EAAG,KAAK,SAAS,CAAA,KAAA,CAAA;AAC7C,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,EAAK;AAAA,MAChC,MAAA,EAAQ,MAAA;AAAA,MACR,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAG,IAAA,CAAK;AAAA,OACV;AAAA,MACA,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,EAAE,OAAO;AAAA,KAC/B,CAAA;AAED,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uCAAA,EAA0C,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA;AAAA,IAC7E;AAEA,IAAA,OAAQ,MAAM,SAAS,IAAA,EAAK;AAAA,EAC9B;AAAA;AAAA,EAGA,OAAO,OAAO,KAAA,EAAwD;AACpE,IA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AAA,GAAO,OAAA,CAAQ,KAAA,CAAM,CAAC,CAAA;AAC5B,YAAA,IAAI,SAAS,QAAA,EAAU;AACvB,YAAA,IAAI;AACF,cAAA,MAAM,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,YACvB,CAAA,CAAA,MAAQ;AAAA,YAER;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAA,SAAE;AACA,MAAA,MAAA,CAAO,WAAA,EAAY;AAAA,IACrB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["/**\n * TheoKitClient — browser-safe client for consuming server adapter endpoints\n * (T20.2, ADR D454).\n *\n * Zero Node dependencies. Uses native fetch + manual SSE parsing.\n * Consumes the same HTTP contract as server adapters (POST /send, GET /stream).\n *\n * @public\n * @deprecated since 2.x — consumes a legacy server-adapter HTTP contract\n * (`POST /agent/send`, `GET /agent/stream`) that the ecosystem no longer\n * produces. For in-process agent runs use the `Agent` façade (`@theokit/sdk`);\n * for HTTP, the framework (`theokit`) exposes agents at `POST /api/agents/<name>`\n * over a `UIMessageStream` with its own typed client. The `@theokit/sdk/client`\n * sub-path will be removed in the next major.\n */\n\nimport type { ClientOptions, SendResponse, StreamEvent } from \"./types.js\";\n\nexport class TheoKitClient {\n private readonly _baseUrl: string;\n private readonly _basePath: string;\n private readonly _headers: Record<string, string>;\n\n constructor(opts: ClientOptions) {\n this._baseUrl = opts.baseUrl.replace(/\\/$/, \"\");\n this._basePath = opts.basePath ?? \"/agent\";\n this._headers = opts.headers ?? {};\n }\n\n async send(input: string): Promise<SendResponse> {\n const url = `${this._baseUrl}${this._basePath}/send`;\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...this._headers,\n },\n body: JSON.stringify({ input }),\n });\n\n if (!response.ok) {\n throw new Error(`TheoKitClient: send failed with status ${response.status}`);\n }\n\n return (await response.json()) as SendResponse;\n }\n\n // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: SSE stream parsing with fetch + ReadableStream reader requires sequential control flow\n async *stream(input: string): AsyncGenerator<StreamEvent, void, void> {\n const url = `${this._baseUrl}${this._basePath}/stream?input=${encodeURIComponent(input)}`;\n const response = await fetch(url, {\n headers: {\n Accept: \"text/event-stream\",\n ...this._headers,\n },\n });\n\n if (!response.ok) {\n throw new Error(`TheoKitClient: stream failed with status ${response.status}`);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error(\"TheoKitClient: response body is not readable\");\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n try {\n // jscpd:ignore-start — SSE stream buffer pattern (different protocol from NDJSON in ollama-native)\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n // jscpd:ignore-end\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"data: \")) {\n const data = trimmed.slice(6);\n if (data === \"[DONE]\") return;\n try {\n yield JSON.parse(data) as StreamEvent;\n } catch {\n // Skip malformed SSE data lines\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n}\n"]}
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* Consumes the same HTTP contract as server adapters (POST /send, GET /stream).
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated since 2.x — consumes a legacy server-adapter HTTP contract
|
|
10
|
+
* (`POST /agent/send`, `GET /agent/stream`) that the ecosystem no longer
|
|
11
|
+
* produces. For in-process agent runs use the `Agent` façade (`@theokit/sdk`);
|
|
12
|
+
* for HTTP, the framework (`theokit`) exposes agents at `POST /api/agents/<name>`
|
|
13
|
+
* over a `UIMessageStream` with its own typed client. The `@theokit/sdk/client`
|
|
14
|
+
* sub-path will be removed in the next major.
|
|
9
15
|
*/
|
|
10
16
|
import type { ClientOptions, SendResponse, StreamEvent } from "./types.js";
|
|
11
17
|
export declare class TheoKitClient {
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* Consumes the same HTTP contract as server adapters (POST /send, GET /stream).
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated since 2.x — consumes a legacy server-adapter HTTP contract
|
|
10
|
+
* (`POST /agent/send`, `GET /agent/stream`) that the ecosystem no longer
|
|
11
|
+
* produces. For in-process agent runs use the `Agent` façade (`@theokit/sdk`);
|
|
12
|
+
* for HTTP, the framework (`theokit`) exposes agents at `POST /api/agents/<name>`
|
|
13
|
+
* over a `UIMessageStream` with its own typed client. The `@theokit/sdk/client`
|
|
14
|
+
* sub-path will be removed in the next major.
|
|
9
15
|
*/
|
|
10
16
|
import type { ClientOptions, SendResponse, StreamEvent } from "./types.js";
|
|
11
17
|
export declare class TheoKitClient {
|
package/dist/client/types.d.cts
CHANGED
package/dist/client/types.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M22 — `createSkill`: define a skill in TypeScript, without a `SKILL.md` file on disk.
|
|
3
|
+
*
|
|
4
|
+
* An inline skill is usable ALONGSIDE filesystem skills (`AgentOptions.skills.inline`), and points
|
|
5
|
+
* an agent at code-defined capabilities without a `.theokit/skills/<name>/SKILL.md`. Like file
|
|
6
|
+
* skills, its `name` + `description` surface in the `<skills>` system-prompt block; its
|
|
7
|
+
* `instructions` (the body) travel on the object for the consumer (the SDK injects name+description,
|
|
8
|
+
* not bodies — inline and file skills are symmetric there). Inline skills override file skills on a
|
|
9
|
+
* name conflict (mirrors the subagents-loader precedent).
|
|
10
|
+
*/
|
|
11
|
+
import type { Skill } from "./internal/runtime/skills/discover-skills.js";
|
|
12
|
+
/** A code-defined skill (from {@link createSkill}) — a {@link Skill} plus its inline body. */
|
|
13
|
+
export interface InlineSkill extends Skill {
|
|
14
|
+
/** The skill body/instructions (inline skills carry it here instead of a SKILL.md file). */
|
|
15
|
+
instructions: string;
|
|
16
|
+
}
|
|
17
|
+
/** Spec accepted by {@link createSkill}. */
|
|
18
|
+
export interface CreateSkillSpec {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
instructions: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
dependencies?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build an {@link InlineSkill} from a code spec. Fails fast on an empty `name`/`description`
|
|
27
|
+
* (error-handling.md). The synthetic `source` (`inline://<name>`) marks it as file-less.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createSkill(spec: CreateSkillSpec): InlineSkill;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as CustomTool, M as ModelSelection,
|
|
1
|
+
import { C as CustomTool, M as ModelSelection, Z as SDKUserMessage, $ as SendOptions, b as Run, G as GenerateOptions, j as GenerateRunResult, F as RunToCompletionOptions, H as RunToCompletionResult, S as SDKMessage, a6 as StreamToCompletionResult, a as McpServerConfig } from './run-BMo8yRwK.cjs';
|
|
2
|
+
import * as zod from 'zod';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Fork primitive public type contracts (T1.2, ADRs D110-D114).
|
|
@@ -602,6 +603,31 @@ interface StoredMessage {
|
|
|
602
603
|
/** Optional epoch-ms timestamp. Implementations MAY default to `Date.now()` on append. */
|
|
603
604
|
at?: number;
|
|
604
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* SE4 — light, session-level metadata stored ALONGSIDE the transcript (title +
|
|
608
|
+
* tag). Distinct from {@link StoredMessage} (which is per-turn content): this is
|
|
609
|
+
* per-conversation display metadata a host sets to build a session UI.
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
interface SessionMeta {
|
|
614
|
+
/** Human-facing title set via `renameSession`. Absent = untitled. */
|
|
615
|
+
readonly title?: string;
|
|
616
|
+
/** Single free-form tag set via `tagSession`. Absent = untagged. */
|
|
617
|
+
readonly tag?: string;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* SE4 — a partial update to {@link SessionMeta}. An omitted field is left
|
|
621
|
+
* unchanged; `tag: null` explicitly CLEARS the tag (distinct from omitting it).
|
|
622
|
+
*
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
interface SessionMetaPatch {
|
|
626
|
+
/** Set the title; `null` explicitly CLEARS it (distinct from omitting it). */
|
|
627
|
+
readonly title?: string | null;
|
|
628
|
+
/** Set the tag; `null` explicitly CLEARS it (distinct from omitting it). */
|
|
629
|
+
readonly tag?: string | null;
|
|
630
|
+
}
|
|
605
631
|
/**
|
|
606
632
|
* Pluggable conversation persistence contract.
|
|
607
633
|
*
|
|
@@ -673,6 +699,19 @@ interface ConversationStorageAdapter {
|
|
|
673
699
|
* trims old turns past a soft cap; other backends typically no-op.
|
|
674
700
|
*/
|
|
675
701
|
compact?(conversationId: string, maxTurns: number): Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* SE4 — optional: read the session-level metadata (title/tag) for a
|
|
704
|
+
* conversation. MUST return `undefined` when none was set (NOT throw).
|
|
705
|
+
* Adapters that cannot store side metadata MAY omit this — the session
|
|
706
|
+
* manager then reports rename/tag as unsupported rather than throwing.
|
|
707
|
+
*/
|
|
708
|
+
getSessionMeta?(conversationId: string): Promise<SessionMeta | undefined>;
|
|
709
|
+
/**
|
|
710
|
+
* SE4 — optional: apply a {@link SessionMetaPatch} to a conversation's
|
|
711
|
+
* session metadata (set title, set/clear tag). MUST create the metadata
|
|
712
|
+
* lazily. Adapters that cannot store side metadata MAY omit this.
|
|
713
|
+
*/
|
|
714
|
+
setSessionMeta?(conversationId: string, patch: SessionMetaPatch): Promise<void>;
|
|
676
715
|
/**
|
|
677
716
|
* Optional: dispose underlying handles (close DB pool, etc.).
|
|
678
717
|
* MUST be safe to call multiple times.
|
|
@@ -680,6 +719,53 @@ interface ConversationStorageAdapter {
|
|
|
680
719
|
dispose?(): Promise<void>;
|
|
681
720
|
}
|
|
682
721
|
|
|
722
|
+
/**
|
|
723
|
+
* A discovered skill's metadata. The skill BODY is never included — only the
|
|
724
|
+
* strict frontmatter fields plus the resolved `source` path.
|
|
725
|
+
*
|
|
726
|
+
* Public via `@theokit/sdk/skills`.
|
|
727
|
+
*
|
|
728
|
+
* @public
|
|
729
|
+
*/
|
|
730
|
+
interface Skill {
|
|
731
|
+
name: string;
|
|
732
|
+
description: string;
|
|
733
|
+
/** Absolute path to the discovered `SKILL.md`. */
|
|
734
|
+
source: string;
|
|
735
|
+
category?: string;
|
|
736
|
+
dependencies?: string[];
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* M22 — `createSkill`: define a skill in TypeScript, without a `SKILL.md` file on disk.
|
|
741
|
+
*
|
|
742
|
+
* An inline skill is usable ALONGSIDE filesystem skills (`AgentOptions.skills.inline`), and points
|
|
743
|
+
* an agent at code-defined capabilities without a `.theokit/skills/<name>/SKILL.md`. Like file
|
|
744
|
+
* skills, its `name` + `description` surface in the `<skills>` system-prompt block; its
|
|
745
|
+
* `instructions` (the body) travel on the object for the consumer (the SDK injects name+description,
|
|
746
|
+
* not bodies — inline and file skills are symmetric there). Inline skills override file skills on a
|
|
747
|
+
* name conflict (mirrors the subagents-loader precedent).
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
/** A code-defined skill (from {@link createSkill}) — a {@link Skill} plus its inline body. */
|
|
751
|
+
interface InlineSkill extends Skill {
|
|
752
|
+
/** The skill body/instructions (inline skills carry it here instead of a SKILL.md file). */
|
|
753
|
+
instructions: string;
|
|
754
|
+
}
|
|
755
|
+
/** Spec accepted by {@link createSkill}. */
|
|
756
|
+
interface CreateSkillSpec {
|
|
757
|
+
name: string;
|
|
758
|
+
description: string;
|
|
759
|
+
instructions: string;
|
|
760
|
+
category?: string;
|
|
761
|
+
dependencies?: string[];
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Build an {@link InlineSkill} from a code spec. Fails fast on an empty `name`/`description`
|
|
765
|
+
* (error-handling.md). The synthetic `source` (`inline://<name>`) marks it as file-less.
|
|
766
|
+
*/
|
|
767
|
+
declare function createSkill(spec: CreateSkillSpec): InlineSkill;
|
|
768
|
+
|
|
683
769
|
/**
|
|
684
770
|
* Context manager backend.
|
|
685
771
|
*
|
|
@@ -1182,6 +1268,16 @@ interface SkillsSettings {
|
|
|
1182
1268
|
* skills itself.
|
|
1183
1269
|
*/
|
|
1184
1270
|
autoInject?: boolean;
|
|
1271
|
+
/**
|
|
1272
|
+
* M22 — discover skills from a CUSTOM directory (containing `<name>/SKILL.md`) instead of the
|
|
1273
|
+
* default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
|
|
1274
|
+
*/
|
|
1275
|
+
skillsDir?: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
|
|
1278
|
+
* overrides a discovered file skill of the same name.
|
|
1279
|
+
*/
|
|
1280
|
+
inline?: InlineSkill[];
|
|
1185
1281
|
}
|
|
1186
1282
|
/**
|
|
1187
1283
|
* Memory configuration accepted by `Agent.create()` via {@link AgentOptions.memory}.
|
|
@@ -1278,7 +1374,12 @@ interface TelemetrySettings {
|
|
|
1278
1374
|
* @public
|
|
1279
1375
|
*/
|
|
1280
1376
|
interface AgentOptions {
|
|
1281
|
-
|
|
1377
|
+
/**
|
|
1378
|
+
* The model to run. SE8 — accepts a bare-string id shorthand
|
|
1379
|
+
* (`"openai/gpt-4o-mini"`, normalized to `{ id }`) OR a {@link ModelSelection}
|
|
1380
|
+
* object (use the object form to pass `params`).
|
|
1381
|
+
*/
|
|
1382
|
+
model?: string | ModelSelection;
|
|
1282
1383
|
/** Falls back to `THEOKIT_API_KEY`. */
|
|
1283
1384
|
apiKey?: string;
|
|
1284
1385
|
name?: string;
|
|
@@ -1570,6 +1671,12 @@ interface SDKAgent {
|
|
|
1570
1671
|
*/
|
|
1571
1672
|
readonly plugins?: SDKAgentPlugins;
|
|
1572
1673
|
send(message: string | SDKUserMessage, options?: SendOptions): Promise<Run>;
|
|
1674
|
+
/**
|
|
1675
|
+
* SE9 — integrated structured output. Runs the normal tool loop (the tools run
|
|
1676
|
+
* first) then coerces the final answer into the `output` Zod schema, returning a
|
|
1677
|
+
* validated, inferred-typed object. Sugar over `Agent.generateObject` (ADR D33).
|
|
1678
|
+
*/
|
|
1679
|
+
generate<T extends zod.ZodType>(message: string | SDKUserMessage, options: GenerateOptions<T>): Promise<GenerateRunResult<zod.z.infer<T>>>;
|
|
1573
1680
|
/** Fire-and-forget disposal. */
|
|
1574
1681
|
close(): void;
|
|
1575
1682
|
/** Re-read filesystem config (context, hooks, project MCP, subagents) without disposing. */
|
|
@@ -2039,4 +2146,4 @@ declare class Cron {
|
|
|
2039
2146
|
static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
|
|
2040
2147
|
}
|
|
2041
2148
|
|
|
2042
|
-
export { type
|
|
2149
|
+
export { type CronStartOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type BudgetUsageEvent as D, type CloudEnv as E, type CloudRepo as F, type GetAgentOptions as G, type ContextBudget as H, type ContextManagerKind as I, type ContextSnapshot as J, type ContextSource as K, type LocalOptions as L, type MemorySettings as M, type ContextSourceStatus as N, type CreateSkillSpec as O, type ProviderRoutingSettings as P, Cron as Q, type CronCreateOptions as R, type SystemPromptResolver as S, type CronGetOptions as T, type CronJob as U, type CronJobStatus as V, type CronListOptions as W, type CronOperationOptions as X, type CronRunOptions as Y, type CronRuntime as Z, type CronSchedulerStatus as _, type AgentDefinition as a, type GoalEvent as a0, type GoalOptions as a1, type GoalResult as a2, type HookName as a3, type InlineSkill as a4, type InvalidateCacheOptions as a5, type MemoryAdapter as a6, type MemoryAdapterCapabilities as a7, type MemoryContext as a8, type MemoryFact as a9, type TelemetrySettings as aA, createSkill as aB, definePlugin as aC, type MemoryProviderHandle as aa, type MemoryProviderInitOptions as ab, type MemoryRevision as ac, type MemoryToolSchema as ad, type MemoryTurnMessage as ae, type PersonalityPreset as af, type PluginContext as ag, type PostAssistantReplyContext as ah, type PreToolCallContext as ai, type PreUserSendContext as aj, type PreUserSendResult as ak, type ProviderCapability as al, type ProviderRoute as am, type RecordSessionSummaryArgs as an, type ResolvedProviderRoute as ao, type RunUntilIterator as ap, type SDKAgentPlugins as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SettingSource as aw, type SystemPromptContext as ax, type SystemPromptMemoryFact as ay, type SystemPromptSkillRef as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type ProviderProfile as l, type Plugin as m, type ConversationStorageAdapter as n, type StoredMessage as o, type SessionMeta as p, type SessionMetaPatch as q, type MemoryProvider as r, type MemoryId as s, type PreToolCallDecision as t, type SDKProvider as u, type ActiveMemoryPassArgs as v, type ActiveMemoryPassResult as w, type AgentMemory as x, type BudgetCheck as y, type BudgetTotal as z };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as CustomTool, M as ModelSelection,
|
|
1
|
+
import { C as CustomTool, M as ModelSelection, Z as SDKUserMessage, $ as SendOptions, b as Run, G as GenerateOptions, j as GenerateRunResult, F as RunToCompletionOptions, H as RunToCompletionResult, S as SDKMessage, a6 as StreamToCompletionResult, a as McpServerConfig } from './run-BMo8yRwK.js';
|
|
2
|
+
import * as zod from 'zod';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Fork primitive public type contracts (T1.2, ADRs D110-D114).
|
|
@@ -602,6 +603,31 @@ interface StoredMessage {
|
|
|
602
603
|
/** Optional epoch-ms timestamp. Implementations MAY default to `Date.now()` on append. */
|
|
603
604
|
at?: number;
|
|
604
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* SE4 — light, session-level metadata stored ALONGSIDE the transcript (title +
|
|
608
|
+
* tag). Distinct from {@link StoredMessage} (which is per-turn content): this is
|
|
609
|
+
* per-conversation display metadata a host sets to build a session UI.
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
interface SessionMeta {
|
|
614
|
+
/** Human-facing title set via `renameSession`. Absent = untitled. */
|
|
615
|
+
readonly title?: string;
|
|
616
|
+
/** Single free-form tag set via `tagSession`. Absent = untagged. */
|
|
617
|
+
readonly tag?: string;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* SE4 — a partial update to {@link SessionMeta}. An omitted field is left
|
|
621
|
+
* unchanged; `tag: null` explicitly CLEARS the tag (distinct from omitting it).
|
|
622
|
+
*
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
interface SessionMetaPatch {
|
|
626
|
+
/** Set the title; `null` explicitly CLEARS it (distinct from omitting it). */
|
|
627
|
+
readonly title?: string | null;
|
|
628
|
+
/** Set the tag; `null` explicitly CLEARS it (distinct from omitting it). */
|
|
629
|
+
readonly tag?: string | null;
|
|
630
|
+
}
|
|
605
631
|
/**
|
|
606
632
|
* Pluggable conversation persistence contract.
|
|
607
633
|
*
|
|
@@ -673,6 +699,19 @@ interface ConversationStorageAdapter {
|
|
|
673
699
|
* trims old turns past a soft cap; other backends typically no-op.
|
|
674
700
|
*/
|
|
675
701
|
compact?(conversationId: string, maxTurns: number): Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* SE4 — optional: read the session-level metadata (title/tag) for a
|
|
704
|
+
* conversation. MUST return `undefined` when none was set (NOT throw).
|
|
705
|
+
* Adapters that cannot store side metadata MAY omit this — the session
|
|
706
|
+
* manager then reports rename/tag as unsupported rather than throwing.
|
|
707
|
+
*/
|
|
708
|
+
getSessionMeta?(conversationId: string): Promise<SessionMeta | undefined>;
|
|
709
|
+
/**
|
|
710
|
+
* SE4 — optional: apply a {@link SessionMetaPatch} to a conversation's
|
|
711
|
+
* session metadata (set title, set/clear tag). MUST create the metadata
|
|
712
|
+
* lazily. Adapters that cannot store side metadata MAY omit this.
|
|
713
|
+
*/
|
|
714
|
+
setSessionMeta?(conversationId: string, patch: SessionMetaPatch): Promise<void>;
|
|
676
715
|
/**
|
|
677
716
|
* Optional: dispose underlying handles (close DB pool, etc.).
|
|
678
717
|
* MUST be safe to call multiple times.
|
|
@@ -680,6 +719,53 @@ interface ConversationStorageAdapter {
|
|
|
680
719
|
dispose?(): Promise<void>;
|
|
681
720
|
}
|
|
682
721
|
|
|
722
|
+
/**
|
|
723
|
+
* A discovered skill's metadata. The skill BODY is never included — only the
|
|
724
|
+
* strict frontmatter fields plus the resolved `source` path.
|
|
725
|
+
*
|
|
726
|
+
* Public via `@theokit/sdk/skills`.
|
|
727
|
+
*
|
|
728
|
+
* @public
|
|
729
|
+
*/
|
|
730
|
+
interface Skill {
|
|
731
|
+
name: string;
|
|
732
|
+
description: string;
|
|
733
|
+
/** Absolute path to the discovered `SKILL.md`. */
|
|
734
|
+
source: string;
|
|
735
|
+
category?: string;
|
|
736
|
+
dependencies?: string[];
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* M22 — `createSkill`: define a skill in TypeScript, without a `SKILL.md` file on disk.
|
|
741
|
+
*
|
|
742
|
+
* An inline skill is usable ALONGSIDE filesystem skills (`AgentOptions.skills.inline`), and points
|
|
743
|
+
* an agent at code-defined capabilities without a `.theokit/skills/<name>/SKILL.md`. Like file
|
|
744
|
+
* skills, its `name` + `description` surface in the `<skills>` system-prompt block; its
|
|
745
|
+
* `instructions` (the body) travel on the object for the consumer (the SDK injects name+description,
|
|
746
|
+
* not bodies — inline and file skills are symmetric there). Inline skills override file skills on a
|
|
747
|
+
* name conflict (mirrors the subagents-loader precedent).
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
/** A code-defined skill (from {@link createSkill}) — a {@link Skill} plus its inline body. */
|
|
751
|
+
interface InlineSkill extends Skill {
|
|
752
|
+
/** The skill body/instructions (inline skills carry it here instead of a SKILL.md file). */
|
|
753
|
+
instructions: string;
|
|
754
|
+
}
|
|
755
|
+
/** Spec accepted by {@link createSkill}. */
|
|
756
|
+
interface CreateSkillSpec {
|
|
757
|
+
name: string;
|
|
758
|
+
description: string;
|
|
759
|
+
instructions: string;
|
|
760
|
+
category?: string;
|
|
761
|
+
dependencies?: string[];
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Build an {@link InlineSkill} from a code spec. Fails fast on an empty `name`/`description`
|
|
765
|
+
* (error-handling.md). The synthetic `source` (`inline://<name>`) marks it as file-less.
|
|
766
|
+
*/
|
|
767
|
+
declare function createSkill(spec: CreateSkillSpec): InlineSkill;
|
|
768
|
+
|
|
683
769
|
/**
|
|
684
770
|
* Context manager backend.
|
|
685
771
|
*
|
|
@@ -1182,6 +1268,16 @@ interface SkillsSettings {
|
|
|
1182
1268
|
* skills itself.
|
|
1183
1269
|
*/
|
|
1184
1270
|
autoInject?: boolean;
|
|
1271
|
+
/**
|
|
1272
|
+
* M22 — discover skills from a CUSTOM directory (containing `<name>/SKILL.md`) instead of the
|
|
1273
|
+
* default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
|
|
1274
|
+
*/
|
|
1275
|
+
skillsDir?: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
|
|
1278
|
+
* overrides a discovered file skill of the same name.
|
|
1279
|
+
*/
|
|
1280
|
+
inline?: InlineSkill[];
|
|
1185
1281
|
}
|
|
1186
1282
|
/**
|
|
1187
1283
|
* Memory configuration accepted by `Agent.create()` via {@link AgentOptions.memory}.
|
|
@@ -1278,7 +1374,12 @@ interface TelemetrySettings {
|
|
|
1278
1374
|
* @public
|
|
1279
1375
|
*/
|
|
1280
1376
|
interface AgentOptions {
|
|
1281
|
-
|
|
1377
|
+
/**
|
|
1378
|
+
* The model to run. SE8 — accepts a bare-string id shorthand
|
|
1379
|
+
* (`"openai/gpt-4o-mini"`, normalized to `{ id }`) OR a {@link ModelSelection}
|
|
1380
|
+
* object (use the object form to pass `params`).
|
|
1381
|
+
*/
|
|
1382
|
+
model?: string | ModelSelection;
|
|
1282
1383
|
/** Falls back to `THEOKIT_API_KEY`. */
|
|
1283
1384
|
apiKey?: string;
|
|
1284
1385
|
name?: string;
|
|
@@ -1570,6 +1671,12 @@ interface SDKAgent {
|
|
|
1570
1671
|
*/
|
|
1571
1672
|
readonly plugins?: SDKAgentPlugins;
|
|
1572
1673
|
send(message: string | SDKUserMessage, options?: SendOptions): Promise<Run>;
|
|
1674
|
+
/**
|
|
1675
|
+
* SE9 — integrated structured output. Runs the normal tool loop (the tools run
|
|
1676
|
+
* first) then coerces the final answer into the `output` Zod schema, returning a
|
|
1677
|
+
* validated, inferred-typed object. Sugar over `Agent.generateObject` (ADR D33).
|
|
1678
|
+
*/
|
|
1679
|
+
generate<T extends zod.ZodType>(message: string | SDKUserMessage, options: GenerateOptions<T>): Promise<GenerateRunResult<zod.z.infer<T>>>;
|
|
1573
1680
|
/** Fire-and-forget disposal. */
|
|
1574
1681
|
close(): void;
|
|
1575
1682
|
/** Re-read filesystem config (context, hooks, project MCP, subagents) without disposing. */
|
|
@@ -2039,4 +2146,4 @@ declare class Cron {
|
|
|
2039
2146
|
static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
|
|
2040
2147
|
}
|
|
2041
2148
|
|
|
2042
|
-
export { type
|
|
2149
|
+
export { type CronStartOptions as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type BudgetUsageEvent as D, type CloudEnv as E, type CloudRepo as F, type GetAgentOptions as G, type ContextBudget as H, type ContextManagerKind as I, type ContextSnapshot as J, type ContextSource as K, type LocalOptions as L, type MemorySettings as M, type ContextSourceStatus as N, type CreateSkillSpec as O, type ProviderRoutingSettings as P, Cron as Q, type CronCreateOptions as R, type SystemPromptResolver as S, type CronGetOptions as T, type CronJob as U, type CronJobStatus as V, type CronListOptions as W, type CronOperationOptions as X, type CronRunOptions as Y, type CronRuntime as Z, type CronSchedulerStatus as _, type AgentDefinition as a, type GoalEvent as a0, type GoalOptions as a1, type GoalResult as a2, type HookName as a3, type InlineSkill as a4, type InvalidateCacheOptions as a5, type MemoryAdapter as a6, type MemoryAdapterCapabilities as a7, type MemoryContext as a8, type MemoryFact as a9, type TelemetrySettings as aA, createSkill as aB, definePlugin as aC, type MemoryProviderHandle as aa, type MemoryProviderInitOptions as ab, type MemoryRevision as ac, type MemoryToolSchema as ad, type MemoryTurnMessage as ae, type PersonalityPreset as af, type PluginContext as ag, type PostAssistantReplyContext as ah, type PreToolCallContext as ai, type PreUserSendContext as aj, type PreUserSendResult as ak, type ProviderCapability as al, type ProviderRoute as am, type RecordSessionSummaryArgs as an, type ResolvedProviderRoute as ao, type RunUntilIterator as ap, type SDKAgentPlugins as aq, type SDKAgentSkills as ar, type SDKArtifact as as, type SDKContextManager as at, type SDKPluginMetadata as au, type SDKProvidersManager as av, type SettingSource as aw, type SystemPromptContext as ax, type SystemPromptMemoryFact as ay, type SystemPromptSkillRef as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type ProviderProfile as l, type Plugin as m, type ConversationStorageAdapter as n, type StoredMessage as o, type SessionMeta as p, type SessionMetaPatch as q, type MemoryProvider as r, type MemoryId as s, type PreToolCallDecision as t, type SDKProvider as u, type ActiveMemoryPassArgs as v, type ActiveMemoryPassResult as w, type AgentMemory as x, type BudgetCheck as y, type BudgetTotal as z };
|