@deepagents/context 0.39.0 → 1.0.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/README.md +44 -11
- package/dist/browser.js +171 -15
- package/dist/browser.js.map +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2309 -1233
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +6 -0
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chain-summary.d.ts +18 -0
- package/dist/lib/chain-summary.d.ts.map +1 -0
- package/dist/lib/engine.d.ts +25 -6
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/message/user.d.ts +21 -2
- package/dist/lib/fragments/message/user.d.ts.map +1 -1
- package/dist/lib/fragments.d.ts +8 -3
- package/dist/lib/fragments.d.ts.map +1 -1
- package/dist/lib/resolvers/async-resolver.d.ts +8 -0
- package/dist/lib/resolvers/async-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/function-resolver.d.ts +8 -0
- package/dist/lib/resolvers/function-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/generator-resolver.d.ts +13 -0
- package/dist/lib/resolvers/generator-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/index.d.ts +10 -0
- package/dist/lib/resolvers/index.d.ts.map +1 -0
- package/dist/lib/resolvers/iterable-resolver.d.ts +12 -0
- package/dist/lib/resolvers/iterable-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/loader-resolver.d.ts +13 -0
- package/dist/lib/resolvers/loader-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/promise-resolver.d.ts +7 -0
- package/dist/lib/resolvers/promise-resolver.d.ts.map +1 -0
- package/dist/lib/resolvers/types.d.ts +45 -0
- package/dist/lib/resolvers/types.d.ts.map +1 -0
- package/dist/lib/sandbox/ast-utils.d.ts +5 -2
- package/dist/lib/sandbox/ast-utils.d.ts.map +1 -1
- package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/container-tool.d.ts +32 -8
- package/dist/lib/sandbox/container-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/docker-sandbox-errors.d.ts +58 -0
- package/dist/lib/sandbox/docker-sandbox-errors.d.ts.map +1 -0
- package/dist/lib/sandbox/docker-sandbox.d.ts +69 -357
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/index.d.ts +2 -7
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/installers/github-release.d.ts +46 -0
- package/dist/lib/sandbox/installers/github-release.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/index.d.ts +7 -0
- package/dist/lib/sandbox/installers/index.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/installer.d.ts +44 -0
- package/dist/lib/sandbox/installers/installer.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/npm.d.ts +32 -0
- package/dist/lib/sandbox/installers/npm.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/package-manager.d.ts +19 -0
- package/dist/lib/sandbox/installers/package-manager.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/pip.d.ts +37 -0
- package/dist/lib/sandbox/installers/pip.d.ts.map +1 -0
- package/dist/lib/sandbox/installers/url-binary.d.ts +41 -0
- package/dist/lib/sandbox/installers/url-binary.d.ts.map +1 -0
- package/dist/lib/sandbox/subcommand.d.ts +11 -11
- package/dist/lib/sandbox/subcommand.d.ts.map +1 -1
- package/dist/lib/sandbox/upload-skills.d.ts +6 -0
- package/dist/lib/sandbox/upload-skills.d.ts.map +1 -1
- package/dist/lib/sandbox/virtual-sandbox.d.ts +10 -0
- package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -0
- package/dist/lib/save/reminder-target-handler.d.ts +36 -0
- package/dist/lib/save/reminder-target-handler.d.ts.map +1 -0
- package/dist/lib/save/save-pipeline.d.ts +28 -0
- package/dist/lib/save/save-pipeline.d.ts.map +1 -0
- package/dist/lib/save/tool-output-target-handler.d.ts +7 -0
- package/dist/lib/save/tool-output-target-handler.d.ts.map +1 -0
- package/dist/lib/save/user-target-handler.d.ts +7 -0
- package/dist/lib/save/user-target-handler.d.ts.map +1 -0
- package/dist/lib/stream/change-source.d.ts +11 -0
- package/dist/lib/stream/change-source.d.ts.map +1 -0
- package/dist/lib/stream/ddl.stream.postgres-notify.d.ts +3 -0
- package/dist/lib/stream/ddl.stream.postgres-notify.d.ts.map +1 -0
- package/dist/lib/stream/ddl.stream.postgres.d.ts +2 -0
- package/dist/lib/stream/ddl.stream.postgres.d.ts.map +1 -0
- package/dist/lib/stream/polling-change-source.d.ts +27 -0
- package/dist/lib/stream/polling-change-source.d.ts.map +1 -0
- package/dist/lib/stream/polling-policy.d.ts +0 -1
- package/dist/lib/stream/polling-policy.d.ts.map +1 -1
- package/dist/lib/stream/postgres-notify-change-source.d.ts +15 -0
- package/dist/lib/stream/postgres-notify-change-source.d.ts.map +1 -0
- package/dist/lib/stream/postgres.stream-store.d.ts +29 -0
- package/dist/lib/stream/postgres.stream-store.d.ts.map +1 -0
- package/dist/lib/stream/stream-manager.d.ts +8 -27
- package/dist/lib/stream/stream-manager.d.ts.map +1 -1
- package/dist/lib/ui-message-guards.d.ts +10 -0
- package/dist/lib/ui-message-guards.d.ts.map +1 -0
- package/package.json +2 -7
- package/dist/lib/sandbox/extension.d.ts +0 -39
- package/dist/lib/sandbox/extension.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/demo.d.ts +0 -2
- package/dist/lib/sandbox/openapi/demo.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/extension.d.ts +0 -19
- package/dist/lib/sandbox/openapi/extension.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/format.d.ts +0 -11
- package/dist/lib/sandbox/openapi/format.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/schema.d.ts +0 -9
- package/dist/lib/sandbox/openapi/schema.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/skill/index.d.ts +0 -6
- package/dist/lib/sandbox/openapi/skill/index.d.ts.map +0 -1
- package/dist/lib/sandbox/openapi/skill/index.js +0 -14
- package/dist/lib/sandbox/openapi/skill/index.js.map +0 -7
- package/dist/lib/sandbox/openapi/skill/openapi-cli/SKILL.md +0 -109
- package/dist/lib/sandbox/openapi/validate.d.ts +0 -7
- package/dist/lib/sandbox/openapi/validate.d.ts.map +0 -1
- package/dist/lib/sandbox/routing-sandbox.d.ts +0 -28
- package/dist/lib/sandbox/routing-sandbox.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-manager.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/stream-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream-manager.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/stream-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAgB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EAEV,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,sBAAsB,EACtB,UAAU,GAAG,WAAW,CACzB;IACC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,yBAAyB,GACjC;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;CACjD,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEN,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,WAAW,CAAC;IACnB,YAAY,EAAE,kBAAkB,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CAC3D;AAID,qBAAa,aAAa;;gBAMZ,OAAO,EAAE,oBAAoB;IAOzC,IAAI,KAAK,IAAI,WAAW,CAEvB;IAEK,QAAQ,CACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAY9C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIhE,OAAO,CACX,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAuGhC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC;IA4G7C,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UIMessage } from 'ai';
|
|
2
|
+
export declare function isUIMessage(value: unknown): value is UIMessage;
|
|
3
|
+
export declare function isUserUIMessage(value: unknown): value is UIMessage & {
|
|
4
|
+
role: 'user';
|
|
5
|
+
};
|
|
6
|
+
export declare function requireUIMessage(value: unknown, source: string): UIMessage;
|
|
7
|
+
export declare function requireUserUIMessage(value: unknown, source: string): UIMessage & {
|
|
8
|
+
role: 'user';
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=ui-message-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-message-guards.d.ts","sourceRoot":"","sources":["../../src/lib/ui-message-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAMpC,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAS9D;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAEvC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAK1E;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,GACb,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAK9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepagents/context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,11 +31,6 @@
|
|
|
31
31
|
"types": "./dist/lib/tracing/index.d.ts",
|
|
32
32
|
"import": "./dist/lib/tracing/index.js",
|
|
33
33
|
"default": "./dist/lib/tracing/index.js"
|
|
34
|
-
},
|
|
35
|
-
"./openapi-skill": {
|
|
36
|
-
"types": "./dist/lib/sandbox/openapi/skill/index.d.ts",
|
|
37
|
-
"import": "./dist/lib/sandbox/openapi/skill/index.js",
|
|
38
|
-
"default": "./dist/lib/sandbox/openapi/skill/index.js"
|
|
39
34
|
}
|
|
40
35
|
},
|
|
41
36
|
"files": [
|
|
@@ -52,7 +47,7 @@
|
|
|
52
47
|
"@ai-sdk/openai-compatible": "^2.0.42",
|
|
53
48
|
"@ai-sdk/provider": "^3.0.10",
|
|
54
49
|
"@clack/prompts": "^1.3.0",
|
|
55
|
-
"@deepagents/agent": "0.
|
|
50
|
+
"@deepagents/agent": "1.0.0",
|
|
56
51
|
"@sdk-it/rpc": "^0.40.0",
|
|
57
52
|
"@sdk-it/spec": "^0.40.0",
|
|
58
53
|
"ai": "^6.0.174",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { CommandResult, Sandbox } from 'bash-tool';
|
|
2
|
-
import type { TransformPlugin } from 'just-bash';
|
|
3
|
-
export interface ExtensionCommandContext {
|
|
4
|
-
sandbox: Sandbox;
|
|
5
|
-
cwd: string;
|
|
6
|
-
env: Record<string, string>;
|
|
7
|
-
stdin: string;
|
|
8
|
-
signal?: AbortSignal;
|
|
9
|
-
}
|
|
10
|
-
export interface ExtensionCommand {
|
|
11
|
-
name: string;
|
|
12
|
-
handler: (args: string[], ctx: ExtensionCommandContext) => CommandResult | Promise<CommandResult>;
|
|
13
|
-
}
|
|
14
|
-
export type BashCallHook = (args: {
|
|
15
|
-
command: string;
|
|
16
|
-
}) => {
|
|
17
|
-
command: string;
|
|
18
|
-
} | Promise<{
|
|
19
|
-
command: string;
|
|
20
|
-
}>;
|
|
21
|
-
export interface SandboxExtension {
|
|
22
|
-
commands?: ExtensionCommand[];
|
|
23
|
-
plugins?: TransformPlugin[];
|
|
24
|
-
onBeforeBashCall?: BashCallHook;
|
|
25
|
-
env?: Record<string, string>;
|
|
26
|
-
}
|
|
27
|
-
export interface MergedSandboxExtension {
|
|
28
|
-
commands: ExtensionCommand[];
|
|
29
|
-
plugins: TransformPlugin[];
|
|
30
|
-
env: Record<string, string>;
|
|
31
|
-
onBeforeBashCall?: BashCallHook;
|
|
32
|
-
}
|
|
33
|
-
export declare class DuplicateCommandError extends Error {
|
|
34
|
-
readonly commandName: string;
|
|
35
|
-
constructor(commandName: string);
|
|
36
|
-
}
|
|
37
|
-
export declare function chainHooks<T>(...hooks: Array<(value: T) => T | Promise<T>>): (value: T) => Promise<T>;
|
|
38
|
-
export declare function mergeExtensions(...extensions: SandboxExtension[]): MergedSandboxExtension;
|
|
39
|
-
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,uBAAuB,KACzB,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB,KAAK;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,gBAAgB,CAAC,EAAE,YAAY,CAAC;CACjC;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,WAAW,EAAE,MAAM,CAAC;gBACxB,WAAW,EAAE,MAAM;CAKhC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAC5C,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAQ1B;AAED,wBAAgB,eAAe,CAC7B,GAAG,UAAU,EAAE,gBAAgB,EAAE,GAChC,sBAAsB,CAqBxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/openapi/demo.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
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.
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAMjB,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"}
|