@theokit/sdk 4.2.2 → 4.2.3

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Wraps `OpenAIClient` with the Vertex baseUrl + lazy OAuth token from
8
8
  * `google-auth-library` (D288). Limitation: Vertex silently drops
9
- * unsupported OpenAI params (D264-style trade-off, documented in docs.md).
9
+ * unsupported OpenAI params (D264-style trade-off).
10
10
  *
11
11
  * @internal
12
12
  */
@@ -14,7 +14,7 @@
14
14
  * The `StreamToCompletionResult` is the generator's RETURN value, read via a
15
15
  * manual `gen.next()` loop (`while (!res.done) res = await gen.next()` → `res.value`).
16
16
  * A plain `for await...of` consumes the yielded messages but discards the return
17
- * value (EC-1) — see docs.md.
17
+ * value (EC-1).
18
18
  *
19
19
  * @internal
20
20
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/messages.ts"],"names":[],"mappings":";;;AAmBO,SAAS,cAAc,GAAA,EAAyB;AACrD,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,OAAA,CAChB,MAAA,CAAO,CAAC,UAA4D,KAAA,CAAM,IAAA,KAAS,MAAM,CAAA,CACzF,IAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA,CACzB,KAAK,EAAE,CAAA;AACZ;AASO,SAAS,gBAAgB,GAAA,EAAiC;AAC/D,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,OAAO,GAAA,CAAI,QAAQ,OAAA,CAAQ,MAAA,CAAO,CAAC,KAAA,KAAiC,KAAA,CAAM,SAAS,UAAU,CAAA;AAC/F;AAQO,SAAS,cAAc,IAAA,EAAqD;AACjF,EAAA,OAAO,IAAA,EAAM,SAAA;AACf","file":"messages.cjs","sourcesContent":["/**\n * Pure readers over the `SDKMessage` stream (M1-5).\n *\n * Promotes the proven first-party hand-roll (`../theocode/server/lib/sdk-mappers.ts`)\n * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.\n * Every reader is pure: no I/O, no mutation of its input, deterministic.\n *\n * Public from the `@theokit/sdk/messages` sub-path. See `docs.md → Message readers`.\n */\n\nimport type { SDKMessage, ToolUseBlock } from \"./types/messages.js\";\nimport type { CostBreakdown } from \"./types/usage.js\";\n\n/**\n * Concatenate the text of an assistant message's `TextBlock`s.\n *\n * Returns `\"\"` for any non-assistant message (or an assistant with no text\n * blocks). `tool_use` blocks are ignored — only `text` blocks contribute.\n */\nexport function assistantText(msg: SDKMessage): string {\n if (msg.type !== \"assistant\") {\n return \"\";\n }\n return msg.message.content\n .filter((block): block is Extract<typeof block, { type: \"text\" }> => block.type === \"text\")\n .map((block) => block.text)\n .join(\"\");\n}\n\n/**\n * Extract the `ToolUseBlock`s from an assistant message's content.\n *\n * Returns `[]` for any non-assistant message. This reads the assistant\n * message's content blocks — NOT the separate `SDKToolUseMessage`\n * (`type:\"tool_call\"`) lifecycle event, which is a different stream (ADR D2).\n */\nexport function extractToolUses(msg: SDKMessage): ToolUseBlock[] {\n if (msg.type !== \"assistant\") {\n return [];\n }\n return msg.message.content.filter((block): block is ToolUseBlock => block.type === \"tool_use\");\n}\n\n/**\n * Read the cost amount from a `CostBreakdown`, preserving the honesty contract\n * (repo ADR `D377-cost-status-closed-enum.md`): `amountUsd` is `number | undefined`\n * where `undefined` means \"cost unknown\" — distinct from a real `$0` (e.g. a\n * subscription-included route). NEVER coerced to 0.\n */\nexport function costAmountUsd(cost: CostBreakdown | undefined): number | undefined {\n return cost?.amountUsd;\n}\n"]}
1
+ {"version":3,"sources":["../src/messages.ts"],"names":[],"mappings":";;;AAmBO,SAAS,cAAc,GAAA,EAAyB;AACrD,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,OAAA,CAChB,MAAA,CAAO,CAAC,UAA4D,KAAA,CAAM,IAAA,KAAS,MAAM,CAAA,CACzF,IAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA,CACzB,KAAK,EAAE,CAAA;AACZ;AASO,SAAS,gBAAgB,GAAA,EAAiC;AAC/D,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,OAAO,GAAA,CAAI,QAAQ,OAAA,CAAQ,MAAA,CAAO,CAAC,KAAA,KAAiC,KAAA,CAAM,SAAS,UAAU,CAAA;AAC/F;AAQO,SAAS,cAAc,IAAA,EAAqD;AACjF,EAAA,OAAO,IAAA,EAAM,SAAA;AACf","file":"messages.cjs","sourcesContent":["/**\n * Pure readers over the `SDKMessage` stream (M1-5).\n *\n * Promotes the proven first-party hand-roll (`../theocode/server/lib/sdk-mappers.ts`)\n * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.\n * Every reader is pure: no I/O, no mutation of its input, deterministic.\n *\n * Public from the `@theokit/sdk/messages` sub-path.\n */\n\nimport type { SDKMessage, ToolUseBlock } from \"./types/messages.js\";\nimport type { CostBreakdown } from \"./types/usage.js\";\n\n/**\n * Concatenate the text of an assistant message's `TextBlock`s.\n *\n * Returns `\"\"` for any non-assistant message (or an assistant with no text\n * blocks). `tool_use` blocks are ignored — only `text` blocks contribute.\n */\nexport function assistantText(msg: SDKMessage): string {\n if (msg.type !== \"assistant\") {\n return \"\";\n }\n return msg.message.content\n .filter((block): block is Extract<typeof block, { type: \"text\" }> => block.type === \"text\")\n .map((block) => block.text)\n .join(\"\");\n}\n\n/**\n * Extract the `ToolUseBlock`s from an assistant message's content.\n *\n * Returns `[]` for any non-assistant message. This reads the assistant\n * message's content blocks — NOT the separate `SDKToolUseMessage`\n * (`type:\"tool_call\"`) lifecycle event, which is a different stream (ADR D2).\n */\nexport function extractToolUses(msg: SDKMessage): ToolUseBlock[] {\n if (msg.type !== \"assistant\") {\n return [];\n }\n return msg.message.content.filter((block): block is ToolUseBlock => block.type === \"tool_use\");\n}\n\n/**\n * Read the cost amount from a `CostBreakdown`, preserving the honesty contract\n * (repo ADR `D377-cost-status-closed-enum.md`): `amountUsd` is `number | undefined`\n * where `undefined` means \"cost unknown\" — distinct from a real `$0` (e.g. a\n * subscription-included route). NEVER coerced to 0.\n */\nexport function costAmountUsd(cost: CostBreakdown | undefined): number | undefined {\n return cost?.amountUsd;\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.
6
6
  * Every reader is pure: no I/O, no mutation of its input, deterministic.
7
7
  *
8
- * Public from the `@theokit/sdk/messages` sub-path. See `docs.md → Message readers`.
8
+ * Public from the `@theokit/sdk/messages` sub-path.
9
9
  */
10
10
  import type { SDKMessage, ToolUseBlock } from "./types/messages.js";
11
11
  import type { CostBreakdown } from "./types/usage.js";
@@ -5,7 +5,7 @@
5
5
  * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.
6
6
  * Every reader is pure: no I/O, no mutation of its input, deterministic.
7
7
  *
8
- * Public from the `@theokit/sdk/messages` sub-path. See `docs.md → Message readers`.
8
+ * Public from the `@theokit/sdk/messages` sub-path.
9
9
  */
10
10
  import type { SDKMessage, ToolUseBlock } from "./types/messages.js";
11
11
  import type { CostBreakdown } from "./types/usage.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/messages.ts"],"names":[],"mappings":";AAmBO,SAAS,cAAc,GAAA,EAAyB;AACrD,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,OAAA,CAChB,MAAA,CAAO,CAAC,UAA4D,KAAA,CAAM,IAAA,KAAS,MAAM,CAAA,CACzF,IAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA,CACzB,KAAK,EAAE,CAAA;AACZ;AASO,SAAS,gBAAgB,GAAA,EAAiC;AAC/D,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,OAAO,GAAA,CAAI,QAAQ,OAAA,CAAQ,MAAA,CAAO,CAAC,KAAA,KAAiC,KAAA,CAAM,SAAS,UAAU,CAAA;AAC/F;AAQO,SAAS,cAAc,IAAA,EAAqD;AACjF,EAAA,OAAO,IAAA,EAAM,SAAA;AACf","file":"messages.js","sourcesContent":["/**\n * Pure readers over the `SDKMessage` stream (M1-5).\n *\n * Promotes the proven first-party hand-roll (`../theocode/server/lib/sdk-mappers.ts`)\n * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.\n * Every reader is pure: no I/O, no mutation of its input, deterministic.\n *\n * Public from the `@theokit/sdk/messages` sub-path. See `docs.md → Message readers`.\n */\n\nimport type { SDKMessage, ToolUseBlock } from \"./types/messages.js\";\nimport type { CostBreakdown } from \"./types/usage.js\";\n\n/**\n * Concatenate the text of an assistant message's `TextBlock`s.\n *\n * Returns `\"\"` for any non-assistant message (or an assistant with no text\n * blocks). `tool_use` blocks are ignored — only `text` blocks contribute.\n */\nexport function assistantText(msg: SDKMessage): string {\n if (msg.type !== \"assistant\") {\n return \"\";\n }\n return msg.message.content\n .filter((block): block is Extract<typeof block, { type: \"text\" }> => block.type === \"text\")\n .map((block) => block.text)\n .join(\"\");\n}\n\n/**\n * Extract the `ToolUseBlock`s from an assistant message's content.\n *\n * Returns `[]` for any non-assistant message. This reads the assistant\n * message's content blocks — NOT the separate `SDKToolUseMessage`\n * (`type:\"tool_call\"`) lifecycle event, which is a different stream (ADR D2).\n */\nexport function extractToolUses(msg: SDKMessage): ToolUseBlock[] {\n if (msg.type !== \"assistant\") {\n return [];\n }\n return msg.message.content.filter((block): block is ToolUseBlock => block.type === \"tool_use\");\n}\n\n/**\n * Read the cost amount from a `CostBreakdown`, preserving the honesty contract\n * (repo ADR `D377-cost-status-closed-enum.md`): `amountUsd` is `number | undefined`\n * where `undefined` means \"cost unknown\" — distinct from a real `$0` (e.g. a\n * subscription-included route). NEVER coerced to 0.\n */\nexport function costAmountUsd(cost: CostBreakdown | undefined): number | undefined {\n return cost?.amountUsd;\n}\n"]}
1
+ {"version":3,"sources":["../src/messages.ts"],"names":[],"mappings":";AAmBO,SAAS,cAAc,GAAA,EAAyB;AACrD,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,OAAA,CAChB,MAAA,CAAO,CAAC,UAA4D,KAAA,CAAM,IAAA,KAAS,MAAM,CAAA,CACzF,IAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA,CACzB,KAAK,EAAE,CAAA;AACZ;AASO,SAAS,gBAAgB,GAAA,EAAiC;AAC/D,EAAA,IAAI,GAAA,CAAI,SAAS,WAAA,EAAa;AAC5B,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,OAAO,GAAA,CAAI,QAAQ,OAAA,CAAQ,MAAA,CAAO,CAAC,KAAA,KAAiC,KAAA,CAAM,SAAS,UAAU,CAAA;AAC/F;AAQO,SAAS,cAAc,IAAA,EAAqD;AACjF,EAAA,OAAO,IAAA,EAAM,SAAA;AACf","file":"messages.js","sourcesContent":["/**\n * Pure readers over the `SDKMessage` stream (M1-5).\n *\n * Promotes the proven first-party hand-roll (`../theocode/server/lib/sdk-mappers.ts`)\n * onto the SDK's own types so consumers stop re-implementing a wire-event mapper.\n * Every reader is pure: no I/O, no mutation of its input, deterministic.\n *\n * Public from the `@theokit/sdk/messages` sub-path.\n */\n\nimport type { SDKMessage, ToolUseBlock } from \"./types/messages.js\";\nimport type { CostBreakdown } from \"./types/usage.js\";\n\n/**\n * Concatenate the text of an assistant message's `TextBlock`s.\n *\n * Returns `\"\"` for any non-assistant message (or an assistant with no text\n * blocks). `tool_use` blocks are ignored — only `text` blocks contribute.\n */\nexport function assistantText(msg: SDKMessage): string {\n if (msg.type !== \"assistant\") {\n return \"\";\n }\n return msg.message.content\n .filter((block): block is Extract<typeof block, { type: \"text\" }> => block.type === \"text\")\n .map((block) => block.text)\n .join(\"\");\n}\n\n/**\n * Extract the `ToolUseBlock`s from an assistant message's content.\n *\n * Returns `[]` for any non-assistant message. This reads the assistant\n * message's content blocks — NOT the separate `SDKToolUseMessage`\n * (`type:\"tool_call\"`) lifecycle event, which is a different stream (ADR D2).\n */\nexport function extractToolUses(msg: SDKMessage): ToolUseBlock[] {\n if (msg.type !== \"assistant\") {\n return [];\n }\n return msg.message.content.filter((block): block is ToolUseBlock => block.type === \"tool_use\");\n}\n\n/**\n * Read the cost amount from a `CostBreakdown`, preserving the honesty contract\n * (repo ADR `D377-cost-status-closed-enum.md`): `amountUsd` is `number | undefined`\n * where `undefined` means \"cost unknown\" — distinct from a real `$0` (e.g. a\n * subscription-included route). NEVER coerced to 0.\n */\nexport function costAmountUsd(cost: CostBreakdown | undefined): number | undefined {\n return cost?.amountUsd;\n}\n"]}
@@ -9,7 +9,6 @@
9
9
  * surface a known-spurious "ForkOptions not exported" error from
10
10
  * `types/agent.ts` (dynamic-import-type quirk in rollup-plugin-dts).
11
11
  *
12
- * See `docs.md → Security — path traversal + TOCTOU` for the full
13
- * primitive reference. Public from v1.x.
12
+ * Path-traversal + TOCTOU-safe primitives. Public from v1.x.
14
13
  */
15
14
  export { assertNoSymlinkEscape, ForbiddenPathError, isForbiddenPath, PathTraversalError, safeFilenameForId, safePathJoin, sanitizeIdentifier, } from "./internal/security/path-guard.js";
@@ -9,7 +9,6 @@
9
9
  * surface a known-spurious "ForkOptions not exported" error from
10
10
  * `types/agent.ts` (dynamic-import-type quirk in rollup-plugin-dts).
11
11
  *
12
- * See `docs.md → Security — path traversal + TOCTOU` for the full
13
- * primitive reference. Public from v1.x.
12
+ * Path-traversal + TOCTOU-safe primitives. Public from v1.x.
14
13
  */
15
14
  export { assertNoSymlinkEscape, ForbiddenPathError, isForbiddenPath, PathTraversalError, safeFilenameForId, safePathJoin, sanitizeIdentifier, } from "./internal/security/path-guard.js";
@@ -788,7 +788,7 @@ type McpHttpServerConfig = {
788
788
  requestTimeoutMs?: number;
789
789
  };
790
790
  /**
791
- * Union of MCP server configs. See `docs.md` for the full reference.
791
+ * Union of MCP server configs.
792
792
  *
793
793
  * @public
794
794
  */
@@ -788,7 +788,7 @@ type McpHttpServerConfig = {
788
788
  requestTimeoutMs?: number;
789
789
  };
790
790
  /**
791
- * Union of MCP server configs. See `docs.md` for the full reference.
791
+ * Union of MCP server configs.
792
792
  *
793
793
  * @public
794
794
  */
@@ -78,7 +78,7 @@ export type McpHttpServerConfig = {
78
78
  requestTimeoutMs?: number;
79
79
  };
80
80
  /**
81
- * Union of MCP server configs. See `docs.md` for the full reference.
81
+ * Union of MCP server configs.
82
82
  *
83
83
  * @public
84
84
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheo/theokit-sdk#readme",
@@ -373,7 +373,6 @@
373
373
  "test:contract": "vitest run --no-file-parallelism tests/theokit-consumer-contract.test.ts",
374
374
  "typecheck": "tsc --noEmit",
375
375
  "clean": "rm -rf dist",
376
- "docs:json": "typedoc --options typedoc.json",
377
- "docs:drift": "tsx scripts/check-docs-drift.ts"
376
+ "docs:json": "typedoc --options typedoc.json"
378
377
  }
379
378
  }