@deepagents/context 0.36.0 → 0.37.1

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.
Files changed (92) hide show
  1. package/README.md +67 -2
  2. package/dist/browser.js +6 -130
  3. package/dist/browser.js.map +3 -3
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +3755 -2467
  7. package/dist/index.js.map +4 -4
  8. package/dist/lib/advisor.d.ts +26 -0
  9. package/dist/lib/advisor.d.ts.map +1 -0
  10. package/dist/lib/agent.d.ts +14 -2
  11. package/dist/lib/agent.d.ts.map +1 -1
  12. package/dist/lib/chat.d.ts +6 -2
  13. package/dist/lib/chat.d.ts.map +1 -1
  14. package/dist/lib/engine.d.ts +10 -0
  15. package/dist/lib/engine.d.ts.map +1 -1
  16. package/dist/lib/fragments/message/user.d.ts +0 -18
  17. package/dist/lib/fragments/message/user.d.ts.map +1 -1
  18. package/dist/lib/fragments/reminders/combinators.d.ts +6 -0
  19. package/dist/lib/fragments/reminders/combinators.d.ts.map +1 -0
  20. package/dist/lib/fragments/reminders/content-predicates.d.ts +2 -0
  21. package/dist/lib/fragments/reminders/content-predicates.d.ts.map +1 -1
  22. package/dist/lib/fragments/reminders/temporal/index.d.ts +3 -0
  23. package/dist/lib/fragments/reminders/temporal/index.d.ts.map +1 -0
  24. package/dist/lib/fragments/reminders/temporal/predicates.d.ts +22 -0
  25. package/dist/lib/fragments/reminders/temporal/predicates.d.ts.map +1 -0
  26. package/dist/lib/fragments/reminders/{temporal-reminder.d.ts → temporal/reminder.d.ts} +3 -5
  27. package/dist/lib/fragments/reminders/temporal/reminder.d.ts.map +1 -0
  28. package/dist/lib/fragments/reminders/turn-predicates.d.ts +6 -0
  29. package/dist/lib/fragments/reminders/turn-predicates.d.ts.map +1 -0
  30. package/dist/lib/guardrail.d.ts +1 -0
  31. package/dist/lib/guardrail.d.ts.map +1 -1
  32. package/dist/lib/guardrails/error-recovery.guardrail.d.ts.map +1 -1
  33. package/dist/lib/repair.d.ts +4 -0
  34. package/dist/lib/repair.d.ts.map +1 -0
  35. package/dist/lib/sandbox/ast-utils.d.ts +4 -0
  36. package/dist/lib/sandbox/ast-utils.d.ts.map +1 -0
  37. package/dist/lib/sandbox/bash-exception.d.ts +5 -0
  38. package/dist/lib/sandbox/bash-exception.d.ts.map +1 -0
  39. package/dist/lib/sandbox/bash-meta.d.ts +13 -0
  40. package/dist/lib/sandbox/bash-meta.d.ts.map +1 -0
  41. package/dist/lib/sandbox/bash-tool.d.ts +27 -0
  42. package/dist/lib/sandbox/bash-tool.d.ts.map +1 -0
  43. package/dist/lib/sandbox/container-tool.d.ts +39 -11
  44. package/dist/lib/sandbox/container-tool.d.ts.map +1 -1
  45. package/dist/lib/sandbox/extension.d.ts +39 -0
  46. package/dist/lib/sandbox/extension.d.ts.map +1 -0
  47. package/dist/lib/sandbox/file-events.d.ts +47 -0
  48. package/dist/lib/sandbox/file-events.d.ts.map +1 -0
  49. package/dist/lib/sandbox/index.d.ts +14 -0
  50. package/dist/lib/sandbox/index.d.ts.map +1 -1
  51. package/dist/lib/sandbox/openapi/demo.d.ts +2 -0
  52. package/dist/lib/sandbox/openapi/demo.d.ts.map +1 -0
  53. package/dist/lib/sandbox/openapi/extension.d.ts +19 -0
  54. package/dist/lib/sandbox/openapi/extension.d.ts.map +1 -0
  55. package/dist/lib/sandbox/openapi/format.d.ts +11 -0
  56. package/dist/lib/sandbox/openapi/format.d.ts.map +1 -0
  57. package/dist/lib/sandbox/openapi/schema.d.ts +9 -0
  58. package/dist/lib/sandbox/openapi/schema.d.ts.map +1 -0
  59. package/dist/lib/sandbox/openapi/skill/index.d.ts +6 -0
  60. package/dist/lib/sandbox/openapi/skill/index.d.ts.map +1 -0
  61. package/dist/lib/sandbox/openapi/skill/index.js +14 -0
  62. package/dist/lib/sandbox/openapi/skill/index.js.map +7 -0
  63. package/dist/lib/sandbox/openapi/skill/openapi-cli/SKILL.md +109 -0
  64. package/dist/lib/sandbox/openapi/validate.d.ts +7 -0
  65. package/dist/lib/sandbox/openapi/validate.d.ts.map +1 -0
  66. package/dist/lib/sandbox/routing-sandbox.d.ts +28 -0
  67. package/dist/lib/sandbox/routing-sandbox.d.ts.map +1 -0
  68. package/dist/lib/sandbox/subcommand.d.ts +49 -0
  69. package/dist/lib/sandbox/subcommand.d.ts.map +1 -0
  70. package/dist/lib/sandbox/types.d.ts +46 -0
  71. package/dist/lib/sandbox/types.d.ts.map +1 -0
  72. package/dist/lib/sandbox/upload-skills.d.ts +14 -0
  73. package/dist/lib/sandbox/upload-skills.d.ts.map +1 -0
  74. package/dist/lib/sandbox/walk.d.ts +17 -0
  75. package/dist/lib/sandbox/walk.d.ts.map +1 -0
  76. package/dist/lib/skills/fragments.d.ts +10 -15
  77. package/dist/lib/skills/fragments.d.ts.map +1 -1
  78. package/dist/lib/skills/types.d.ts +2 -27
  79. package/dist/lib/skills/types.d.ts.map +1 -1
  80. package/dist/lib/stream/stream-manager.d.ts +4 -0
  81. package/dist/lib/stream/stream-manager.d.ts.map +1 -1
  82. package/dist/lib/title.d.ts +1 -1
  83. package/dist/lib/title.d.ts.map +1 -1
  84. package/dist/lib/tracing/exporter.d.ts.map +1 -1
  85. package/dist/lib/tracing/index.js +59 -12
  86. package/dist/lib/tracing/index.js.map +2 -2
  87. package/dist/lib/tracing/openai-traces-integration.d.ts.map +1 -1
  88. package/dist/lib/tracing/serialization.d.ts.map +1 -1
  89. package/dist/lib/tracing/types.d.ts +0 -1
  90. package/dist/lib/tracing/types.d.ts.map +1 -1
  91. package/package.json +21 -9
  92. package/dist/lib/fragments/reminders/temporal-reminder.d.ts.map +0 -1
@@ -0,0 +1,47 @@
1
+ import type { BufferEncoding, CpOptions, FileContent, FsStat, IFileSystem, MkdirOptions, RmOptions } from 'just-bash';
2
+ interface ReadFileOptions {
3
+ encoding?: BufferEncoding | null;
4
+ }
5
+ interface WriteFileOptions {
6
+ encoding?: BufferEncoding;
7
+ }
8
+ interface DirentEntry {
9
+ name: string;
10
+ isFile: boolean;
11
+ isDirectory: boolean;
12
+ isSymbolicLink: boolean;
13
+ }
14
+ export type FileEventOp = 'read' | 'write' | 'delete' | 'modify';
15
+ export interface FileEvent {
16
+ path: string;
17
+ op: FileEventOp;
18
+ timestamp: number;
19
+ }
20
+ export declare class ObservedFs implements IFileSystem {
21
+ #private;
22
+ readdirWithFileTypes?: (path: string) => Promise<DirentEntry[]>;
23
+ constructor(base: IFileSystem);
24
+ drain(): FileEvent[];
25
+ readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
26
+ readFileBuffer(path: string): Promise<Uint8Array>;
27
+ writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
28
+ appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
29
+ rm(path: string, options?: RmOptions): Promise<void>;
30
+ cp(src: string, dest: string, options?: CpOptions): Promise<void>;
31
+ mv(src: string, dest: string): Promise<void>;
32
+ symlink(target: string, linkPath: string): Promise<void>;
33
+ link(existingPath: string, newPath: string): Promise<void>;
34
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
35
+ exists(path: string): Promise<boolean>;
36
+ stat(path: string): Promise<FsStat>;
37
+ lstat(path: string): Promise<FsStat>;
38
+ readdir(path: string): Promise<string[]>;
39
+ readlink(path: string): Promise<string>;
40
+ realpath(path: string): Promise<string>;
41
+ chmod(path: string, mode: number): Promise<void>;
42
+ utimes(path: string, atime: Date, mtime: Date): Promise<void>;
43
+ resolvePath(base: string, path: string): string;
44
+ getAllPaths(): string[];
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=file-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-events.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/file-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,WAAW,EACX,MAAM,EACN,WAAW,EACX,YAAY,EACZ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@@ -1,5 +1,19 @@
1
1
  export * from './agent-os-sandbox.ts';
2
+ export * from './ast-utils.ts';
3
+ export * from './bash-exception.ts';
4
+ export * from './bash-meta.ts';
5
+ export * from './bash-tool.ts';
6
+ export * from './extension.ts';
7
+ export * from './file-events.ts';
2
8
  export * from './binary-bridges.ts';
3
9
  export * from './container-tool.ts';
4
10
  export * from './docker-sandbox.ts';
11
+ export * from './routing-sandbox.ts';
12
+ export * from './openapi/extension.ts';
13
+ export * from './openapi/format.ts';
14
+ export * from './openapi/schema.ts';
15
+ export * from './openapi/validate.ts';
16
+ export * from './subcommand.ts';
17
+ export * from './types.ts';
18
+ export * from './upload-skills.ts';
5
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/demo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { type Client } from '@sdk-it/rpc';
2
+ import { type OperationEntry, type TunedOperationObject } from '@sdk-it/spec';
3
+ import type { BashCallHook, ExtensionCommand, SandboxExtension } from '../extension.ts';
4
+ export interface OpenAPIExtensionOptions {
5
+ name: string;
6
+ openapi: string;
7
+ baseUrl?: string;
8
+ token?: string | (() => string | Promise<string>);
9
+ headers?: Record<string, string>;
10
+ fetch?: (req: Request) => Promise<Response>;
11
+ includeOperation?: (entry: OperationEntry, operation: TunedOperationObject) => boolean;
12
+ }
13
+ export interface OpenAPIExtension extends SandboxExtension {
14
+ commands: ExtensionCommand[];
15
+ onBeforeBashCall: BashCallHook;
16
+ client: Client;
17
+ }
18
+ export declare function createOpenAPIExtension(options: OpenAPIExtensionOptions): Promise<OpenAPIExtension>;
19
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAO,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAI1B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAWzB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,oBAAoB,KAC5B,OAAO,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AA8BD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CA8J3B"}
@@ -0,0 +1,11 @@
1
+ import type { CommandResult } from 'bash-tool';
2
+ export declare function formatResponse(value: unknown): CommandResult;
3
+ export interface ErrorDetails {
4
+ group: string;
5
+ operation?: string;
6
+ code: string;
7
+ message: string;
8
+ extra?: Record<string, unknown>;
9
+ }
10
+ export declare function formatError(details: ErrorDetails): CommandResult;
11
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAU5D;AAcD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,aAAa,CAYhE"}
@@ -0,0 +1,9 @@
1
+ import type { Client } from '@sdk-it/rpc';
2
+ import type { SubcommandDefinition } from '../subcommand.ts';
3
+ export interface SchemaEntry {
4
+ endpoint: string;
5
+ operationId: string;
6
+ summary?: string;
7
+ }
8
+ export declare function buildSchemaSubcommand(group: string, client: Client, entries: SchemaEntry[]): SubcommandDefinition;
9
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,EAAE,GACrB,oBAAoB,CAoCtB"}
@@ -0,0 +1,6 @@
1
+ import type { SkillUploadInput } from '../../types.ts';
2
+ export interface OpenAPISkillOptions {
3
+ sandbox?: string;
4
+ }
5
+ export declare function openapiSkill(options?: OpenAPISkillOptions): SkillUploadInput;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/sandbox/openapi/skill/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,YAAY,CAC1B,OAAO,GAAE,mBAAwB,GAChC,gBAAgB,CAKlB"}
@@ -0,0 +1,14 @@
1
+ // packages/context/src/lib/sandbox/openapi/skill/index.ts
2
+ import { dirname } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ var here = dirname(fileURLToPath(import.meta.url));
5
+ function openapiSkill(options = {}) {
6
+ return {
7
+ host: here,
8
+ sandbox: options.sandbox ?? "/skills/openapi"
9
+ };
10
+ }
11
+ export {
12
+ openapiSkill
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/lib/sandbox/openapi/skill/index.ts"],
4
+ "sourcesContent": ["import { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { SkillUploadInput } from '../../types.ts';\n\nconst here = dirname(fileURLToPath(import.meta.url));\n\nexport interface OpenAPISkillOptions {\n sandbox?: string;\n}\n\nexport function openapiSkill(\n options: OpenAPISkillOptions = {},\n): SkillUploadInput {\n return {\n host: here,\n sandbox: options.sandbox ?? '/skills/openapi',\n };\n}\n"],
5
+ "mappings": ";AAAA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAI9B,IAAM,OAAO,QAAQ,cAAc,YAAY,GAAG,CAAC;AAM5C,SAAS,aACd,UAA+B,CAAC,GACd;AAClB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,QAAQ,WAAW;AAAA,EAC9B;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: openapi-cli
3
+ description: Use this skill any time the user asks to list, inspect, call, or use commands/operations of a bash-exposed API extension (e.g. datahub, github, stripe). These extensions are NOT standard CLIs — they do NOT support `--help` or `-h`. Each extension exposes one bash command (the "group") with a `schema` subcommand for discovery and operations invoked as `<group> <operation> '<json>'`. ALWAYS run `<group> schema` as the first action before doing anything else; never run `<group> --help` or `<group> -h` (they will fail).
4
+ ---
5
+
6
+ # Invoking OpenAPI extensions
7
+
8
+ Each `createOpenAPIExtension` registers one bash command (the **group**) under which every OpenAPI operation becomes a **subcommand**. You invoke operations through the bash tool. There is no separate API surface.
9
+
10
+ ## Always discover first
11
+
12
+ Before calling any operation, run the `schema` subcommand once per session to learn what's available:
13
+
14
+ ```
15
+ <group> schema
16
+ ```
17
+
18
+ The output is a single JSON document:
19
+
20
+ ```json
21
+ {
22
+ "group": "<group>",
23
+ "operations": [
24
+ {
25
+ "operationId": "...",
26
+ "method": "GET|POST|PUT|PATCH|DELETE",
27
+ "path": "/example/{id}",
28
+ "summary": "...",
29
+ "input": {
30
+ /* JSON Schema 7 */
31
+ }
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ Read `input` to learn the exact field names, types, required keys, and enums for that operation. Do not guess fields.
38
+
39
+ ## Invocation shape
40
+
41
+ ```
42
+ <group> <operationId> '<json>'
43
+ ```
44
+
45
+ - **One positional JSON argument.** Wrap it in single quotes so the shell parser treats it as one literal token.
46
+ - **Flat object.** Pass every field at the top level — path params, query params, body fields, headers all live as flat keys in one object. The extension partitions them automatically based on the spec.
47
+ - **No `--flags`.** There are no per-field flags. The whole payload is the JSON.
48
+
49
+ Example:
50
+
51
+ ```
52
+ github listIssues '{"owner":"acme","repo":"app","state":"open","per_page":10}'
53
+ ```
54
+
55
+ `owner` and `repo` are path params; `state` and `per_page` are query params. You don't manage that split — the extension does.
56
+
57
+ ## Output format
58
+
59
+ - **Object response** → one line of JSON on stdout.
60
+ - **Array response** → newline-delimited JSON (NDJSON), one item per line. Pipe to `head -n N` to cap before reading the whole list.
61
+ - **Errors** → JSON on stderr, exit code 1.
62
+
63
+ ```bash
64
+ <group> <operation> '<json>' | head -n 5 # cap arrays
65
+ ```
66
+
67
+ ## Reading errors
68
+
69
+ Stderr on failure is always JSON with this shape:
70
+
71
+ ```json
72
+ {
73
+ "ok": false,
74
+ "group": "...",
75
+ "operation": "...",
76
+ "code": "...",
77
+ "message": "..."
78
+ }
79
+ ```
80
+
81
+ Branch on `code`:
82
+
83
+ | Code | What it means | What to do |
84
+ | ------------------- | ------------------------------------------------- | --------------------------------------------------------------------------- |
85
+ | `missing_input` | No JSON arg passed | Add `'<json>'` |
86
+ | `invalid_json` | JSON didn't parse | Fix the JSON literal |
87
+ | `schema_validation` | Fields don't match the schema | Re-read `<group> schema` and fix shape; `issues` array lists each violation |
88
+ | `path_param_unsafe` | A path-param value contains a forbidden character | See "Path-param rules" below |
89
+ | `request_failed` | The upstream API errored or network failed | Read `message`; surface to the user |
90
+
91
+ ## Path-param rules
92
+
93
+ Path-param values must be **plain segment identifiers**. The extension rejects, _before_ sending the request:
94
+
95
+ - `/`, `\`, `?`, `#`, `&` (would change the route or query)
96
+ - `.` and `..` as full values (would normalize away)
97
+ - Control characters (`\x00`–`\x1f`, `\x7f`)
98
+ - Pre-encoded sequences (`%2e`, `%2f`, etc. — they get re-decoded)
99
+
100
+ If the user gives you something like `abc/def` for a single id, that's two segments — clarify with the user instead of forcing it through.
101
+
102
+ ## Workflow
103
+
104
+ 1. Run `<group> schema` once.
105
+ 2. Find the operation that matches the user's intent (`summary`, `path`, `method`).
106
+ 3. Build the JSON payload from the `input` schema.
107
+ 4. Invoke `<group> <operationId> '<json>'`.
108
+ 5. If `code: "schema_validation"`, read `issues[]` and fix exactly what it says.
109
+ 6. For list endpoints, prefer `| head -n N` over reading all rows.
@@ -0,0 +1,7 @@
1
+ export declare function extractPathParams(path: string): string[];
2
+ export interface UnsafePathParam {
3
+ field: string;
4
+ reason: string;
5
+ }
6
+ export declare function findUnsafePathParam(input: unknown, names: string[]): UnsafePathParam | null;
7
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/validate.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQxD;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EAAE,GACd,eAAe,GAAG,IAAI,CAsCxB"}
@@ -0,0 +1,28 @@
1
+ import type { Sandbox } from 'bash-tool';
2
+ import { type IFileSystem } from 'just-bash';
3
+ import { type MergedSandboxExtension, type SandboxExtension } from './extension.ts';
4
+ export interface InstallableSandbox extends Sandbox {
5
+ install(ext: MergedSandboxExtension): void | Promise<void>;
6
+ }
7
+ export declare function isInstallable(s: Sandbox): s is InstallableSandbox;
8
+ export interface CreateVirtualSandboxOptions {
9
+ fs: IFileSystem;
10
+ cwd?: string;
11
+ env?: Record<string, string>;
12
+ }
13
+ export declare function createVirtualSandbox(options: CreateVirtualSandboxOptions): Promise<InstallableSandbox>;
14
+ export interface CreateRoutingSandboxOptions {
15
+ /**
16
+ * Backend sandbox to wrap. Single-use — the same `InstallableSandbox`
17
+ * cannot be passed to two routing sandboxes (install() is install-once).
18
+ */
19
+ backend: Sandbox;
20
+ hostExtensions: SandboxExtension[];
21
+ /**
22
+ * Working directory surfaced to host handlers via `ctx.cwd` on shallow
23
+ * dispatch. Defaults to `/`. Deep dispatch uses the backend's own cwd.
24
+ */
25
+ cwd?: string;
26
+ }
27
+ export declare function createRoutingSandbox(opts: CreateRoutingSandboxOptions): Promise<Sandbox>;
28
+ //# sourceMappingURL=routing-sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/routing-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIL,KAAK,WAAW,EAGjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD,OAAO,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,kBAAkB,CAEjE;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,WAAW,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,kBAAkB,CAAC,CA6D7B;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,gBAAgB,EAAE,CAAC;IACnC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,OAAO,CAAC,CASlB"}
@@ -0,0 +1,49 @@
1
+ import type { CommandResult } from 'bash-tool';
2
+ import type { ExtensionCommand, ExtensionCommandContext } from './extension.ts';
3
+ /**
4
+ * Describes one subcommand inside a subcommand group (e.g. `sql run`,
5
+ * `sql validate`). Each subcommand has usage/description strings used to
6
+ * generate the group's usage message, an optional arg-repair function that
7
+ * fixes common LLM over-escaping, and the handler that implements it.
8
+ */
9
+ export interface SubcommandDefinition {
10
+ usage: string;
11
+ description: string;
12
+ /**
13
+ * Optional repair pass applied to the subcommand's raw arg string before
14
+ * the shell parser sees it. Return `null` to leave the raw args unchanged.
15
+ */
16
+ repair?: (rawArgs: string) => string | null;
17
+ handler: (args: string[], ctx: ExtensionCommandContext) => CommandResult | Promise<CommandResult>;
18
+ }
19
+ /**
20
+ * Creates an {@link ExtensionCommand} that dispatches to one of several
21
+ * subcommand handlers based on the first positional arg. Unknown or missing
22
+ * subcommands print an auto-generated usage message to stderr with exit
23
+ * code 1.
24
+ *
25
+ * @example
26
+ * const sqlCommand = defineSubcommandGroup('sql', {
27
+ * run: { usage: 'run "SELECT ..."', description: 'Execute query', handler: ... },
28
+ * validate: { usage: 'validate "SELECT ..."', description: 'Validate only', handler: ... },
29
+ * });
30
+ */
31
+ export declare function defineSubcommandGroup(name: string, subcommands: Record<string, SubcommandDefinition>): ExtensionCommand;
32
+ /**
33
+ * Strips a single layer of matching outer `"` or `'` quotes from a string,
34
+ * trimming surrounding whitespace. If the input is not wrapped in a matching
35
+ * pair, returns it trimmed but otherwise unchanged.
36
+ */
37
+ export declare function stripQuoteArtifacts(raw: string): string;
38
+ /**
39
+ * Pre-parse repair for a subcommand's raw arg string. Fires when the
40
+ * surrounding command fails to parse (via `buildSubcommandRepair`). Strips
41
+ * any leading/trailing quote, escapes inner single quotes with the POSIX
42
+ * `'\''` idiom, and wraps the result in single quotes so the shell parser
43
+ * will treat the payload as an opaque literal on the next pass.
44
+ *
45
+ * Returns `null` when the repaired arg string would be empty.
46
+ */
47
+ export declare function repairQuotedArg(rawArgs: string): string | null;
48
+ export declare function buildSubcommandRepair(name: string, subcommands: Record<string, SubcommandDefinition>): (raw: string) => string;
49
+ //# sourceMappingURL=subcommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subcommand.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/subcommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC5C,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,uBAAuB,KACzB,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAChD,gBAAgB,CAsBlB;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,IAO1B,KAAK,MAAM,KAAG,MAAM,CA2B5C"}
@@ -0,0 +1,46 @@
1
+ import type { Tool } from 'ai';
2
+ import type { BashToolkit, CommandResult } from 'bash-tool';
3
+ import type { SkillPathMapping } from '../skills/types.ts';
4
+ import type { FileEvent } from './file-events.ts';
5
+ /**
6
+ * Declarative skill upload: a host directory whose contents are copied into
7
+ * the sandbox at startup. The factory also parses each skill's frontmatter
8
+ * and exposes the result on `sandbox.skills`.
9
+ */
10
+ export interface SkillUploadInput {
11
+ /** Host directory containing skill subdirectories (each with a SKILL.md). */
12
+ host: string;
13
+ /** Destination inside the sandbox (e.g. `/workspace/skills`). */
14
+ sandbox: string;
15
+ }
16
+ /**
17
+ * Input schema exposed by the wrapped bash tool — adds a required `reasoning`
18
+ * field on top of the upstream `{ command }` shape.
19
+ */
20
+ export interface BashToolInput {
21
+ command: string;
22
+ reasoning: string;
23
+ }
24
+ /** The shared wrapper's bash tool type (widened from upstream). */
25
+ export type WrappedBashTool = Tool<BashToolInput, CommandResult>;
26
+ /**
27
+ * A sandbox that owns its skills. The factory uploads files + parses
28
+ * frontmatter once; `skills` is then the single source of truth for
29
+ * the `skills()` fragment. The `bash` tool is widened to require a
30
+ * `reasoning` input on every call.
31
+ */
32
+ export interface AgentSandbox extends Omit<BashToolkit, 'bash' | 'tools'> {
33
+ /** Discovered skills — empty array if none were configured. */
34
+ skills: SkillPathMapping[];
35
+ bash: WrappedBashTool;
36
+ tools: Omit<BashToolkit['tools'], 'bash'> & {
37
+ bash: WrappedBashTool;
38
+ };
39
+ /**
40
+ * Drain and return file events observed since the last call. Attached by
41
+ * callers who composed an `ObservedFs` into their backend; omitted
42
+ * otherwise. The chat pipeline reads this via optional chaining.
43
+ */
44
+ drainFileEvents?(): FileEvent[];
45
+ }
46
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IACvE,+DAA+D;IAC/D,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,eAAe,CAAC,IAAI,SAAS,EAAE,CAAC;CACjC"}
@@ -0,0 +1,14 @@
1
+ import type { Sandbox } from 'bash-tool';
2
+ import type { SkillPathMapping } from '../skills/types.ts';
3
+ import type { SkillUploadInput } from './types.ts';
4
+ /**
5
+ * Discover skills under each host directory, write all non-dotfile, non-symlink
6
+ * files into the sandbox under the mapped path, and return the discovered
7
+ * skill metadata with sandbox paths.
8
+ *
9
+ * Later inputs override earlier ones when the same skill name appears twice.
10
+ * Files with the same sandbox path are overwritten in order, so the last
11
+ * writer wins.
12
+ */
13
+ export declare function uploadSkills(sandbox: Sandbox, inputs: SkillUploadInput[]): Promise<SkillPathMapping[]>;
14
+ //# sourceMappingURL=upload-skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-skills.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/upload-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAenD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,EAAE,GACzB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAqC7B"}
@@ -0,0 +1,17 @@
1
+ export interface WalkedFile {
2
+ /** Absolute host path of the file. */
3
+ path: string;
4
+ /** Relative POSIX path from the walk root (suitable for sandbox targets). */
5
+ relativePath: string;
6
+ /** File contents (as Buffer to preserve binary assets). */
7
+ content: Buffer;
8
+ }
9
+ /**
10
+ * Recursively list every regular file under `root`. Skips symlinks (to avoid
11
+ * escaping `root`) and dotfiles / dot-directories (e.g. `.git`, `.DS_Store`,
12
+ * `.env`). Binary contents are preserved.
13
+ *
14
+ * Returns an empty array when `root` does not exist.
15
+ */
16
+ export declare function walkDirectory(root: string): Promise<WalkedFile[]>;
17
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/walk.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;CACjB;AAQD;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAiCvE"}
@@ -1,28 +1,23 @@
1
1
  import type { ContextFragment } from '../fragments.ts';
2
- import type { SkillsFragmentOptions } from './types.ts';
2
+ import type { AgentSandbox } from '../sandbox/types.ts';
3
3
  /**
4
- * Create a context fragment containing available skills metadata.
4
+ * Create a context fragment containing available skills metadata from a
5
+ * sandbox.
5
6
  *
6
7
  * Follows Anthropic's progressive disclosure pattern:
7
8
  * - At startup: only skill metadata (name, description, path) is injected
8
9
  * - At runtime: LLM reads full SKILL.md using file tools when relevant
9
10
  *
10
- * @param options - Configuration including paths to scan and optional filtering
11
+ * @param sandbox - An AgentSandbox whose `.skills` has been populated by the
12
+ * sandbox factory (`createBashTool` / `createContainerTool`).
11
13
  *
12
14
  * @example
13
15
  * ```ts
14
- * const context = new ContextEngine({ userId: 'demo-user', store, chatId: 'demo' })
15
- * .set(
16
- * role('You are a helpful assistant.'),
17
- * skills({
18
- * paths: [
19
- * { host: './skills', sandbox: '/skills/skills' }
20
- * ]
21
- * }),
22
- * );
23
- *
24
- * // LLM now sees skill metadata with sandbox paths and can read full SKILL.md
16
+ * const sandbox = await createBashTool({
17
+ * skills: [{ host: './skills', sandbox: '/skills/skills' }],
18
+ * });
19
+ * context.set(role('You are a helpful assistant.'), skills(sandbox));
25
20
  * ```
26
21
  */
27
- export declare function skills(options: SkillsFragmentOptions): ContextFragment;
22
+ export declare function skills(sandbox: AgentSandbox): ContextFragment;
28
23
  //# sourceMappingURL=fragments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAmFtE"}
1
+ {"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CAwB7D"}
@@ -14,8 +14,8 @@ export interface SkillMetadata {
14
14
  skillMdPath: string;
15
15
  }
16
16
  /**
17
- * Individual skill mount with name.
18
- * Output from getSkillMounts().
17
+ * Individual skill mount emitted by sandbox factories and consumed by the
18
+ * `skills()` fragment.
19
19
  */
20
20
  export interface SkillPathMapping {
21
21
  name: string;
@@ -25,31 +25,6 @@ export interface SkillPathMapping {
25
25
  /** Sandbox path to SKILL.md */
26
26
  sandbox: string;
27
27
  }
28
- /**
29
- * Options for the skills() fragment helper.
30
- */
31
- export interface SkillsFragmentOptions {
32
- /**
33
- * Skill directories to scan, with host-to-sandbox path mapping.
34
- *
35
- * @example
36
- * ```ts
37
- * skills({
38
- * paths: [
39
- * { host: 'apps/backend/dist/skills', sandbox: '/skills/skills' }
40
- * ]
41
- * })
42
- * ```
43
- */
44
- paths: {
45
- host: string;
46
- sandbox: string;
47
- }[];
48
- /** Skill names to exclude from the fragment */
49
- exclude?: string[];
50
- /** Skill names to include (if set, only these are included) */
51
- include?: string[];
52
- }
53
28
  /**
54
29
  * Result of parsing a SKILL.md file.
55
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;OAWG;IACH,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -31,6 +31,10 @@ export type StreamPollingTelemetryEvent = {
31
31
  type: 'watch:closed';
32
32
  streamId: string;
33
33
  reason: 'terminal' | 'missing';
34
+ } | {
35
+ type: 'watch:error-emitted';
36
+ streamId: string;
37
+ errorTextLength: number;
34
38
  } | {
35
39
  type: 'persist:cancel-poll';
36
40
  streamId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"stream-manager.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/stream-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,kBAAkB,EA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QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,cAAc,CAAC,UAAU,CAAC;IAmJvB,MAAM,CACV,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAK9C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAY/C"}
@@ -1,5 +1,5 @@
1
1
  import type { UIMessage } from 'ai';
2
- import type { AgentModel } from '@deepagents/agent';
2
+ import type { AgentModel } from './advisor.ts';
3
3
  export declare function staticChatTitle(message: UIMessage): string;
4
4
  export interface GenerateChatTitleOptions {
5
5
  message: UIMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/lib/title.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA6BpD,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAE1D;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
1
+ {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/lib/title.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA4B/C,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAE1D;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/lib/tracing/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAKzC;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,oBAAqB,YAAW,eAAe;;gBAS9C,OAAO,GAAE,2BAAgC;IAY/C,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAgEtE"}
1
+ {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/lib/tracing/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAA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