@jean2/sdk 0.9.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/dist/client.d.ts +34 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +102 -0
- package/dist/client.js.map +1 -0
- package/dist/emitter.d.ts +12 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +59 -0
- package/dist/emitter.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +49 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/namespaces/chat.d.ts +12 -0
- package/dist/namespaces/chat.d.ts.map +1 -0
- package/dist/namespaces/chat.js +18 -0
- package/dist/namespaces/chat.js.map +1 -0
- package/dist/namespaces/permissions.d.ts +26 -0
- package/dist/namespaces/permissions.d.ts.map +1 -0
- package/dist/namespaces/permissions.js +33 -0
- package/dist/namespaces/permissions.js.map +1 -0
- package/dist/namespaces/providers.d.ts +8 -0
- package/dist/namespaces/providers.d.ts.map +1 -0
- package/dist/namespaces/providers.js +13 -0
- package/dist/namespaces/providers.js.map +1 -0
- package/dist/namespaces/queue.d.ts +11 -0
- package/dist/namespaces/queue.d.ts.map +1 -0
- package/dist/namespaces/queue.js +19 -0
- package/dist/namespaces/queue.js.map +1 -0
- package/dist/namespaces/sessions.d.ts +28 -0
- package/dist/namespaces/sessions.d.ts.map +1 -0
- package/dist/namespaces/sessions.js +43 -0
- package/dist/namespaces/sessions.js.map +1 -0
- package/dist/namespaces/terminal.d.ts +100 -0
- package/dist/namespaces/terminal.d.ts.map +1 -0
- package/dist/namespaces/terminal.js +495 -0
- package/dist/namespaces/terminal.js.map +1 -0
- package/dist/rest/attachments.d.ts +40 -0
- package/dist/rest/attachments.d.ts.map +1 -0
- package/dist/rest/attachments.js +40 -0
- package/dist/rest/attachments.js.map +1 -0
- package/dist/rest/config.d.ts +88 -0
- package/dist/rest/config.d.ts.map +1 -0
- package/dist/rest/config.js +83 -0
- package/dist/rest/config.js.map +1 -0
- package/dist/rest/files.d.ts +37 -0
- package/dist/rest/files.d.ts.map +1 -0
- package/dist/rest/files.js +59 -0
- package/dist/rest/files.js.map +1 -0
- package/dist/rest/http-namespace.d.ts +54 -0
- package/dist/rest/http-namespace.d.ts.map +1 -0
- package/dist/rest/http-namespace.js +67 -0
- package/dist/rest/http-namespace.js.map +1 -0
- package/dist/rest/mcp.d.ts +43 -0
- package/dist/rest/mcp.d.ts.map +1 -0
- package/dist/rest/mcp.js +41 -0
- package/dist/rest/mcp.js.map +1 -0
- package/dist/rest/models.d.ts +12 -0
- package/dist/rest/models.d.ts.map +1 -0
- package/dist/rest/models.js +10 -0
- package/dist/rest/models.js.map +1 -0
- package/dist/rest/preconfigs.d.ts +51 -0
- package/dist/rest/preconfigs.d.ts.map +1 -0
- package/dist/rest/preconfigs.js +29 -0
- package/dist/rest/preconfigs.js.map +1 -0
- package/dist/rest/prompts.d.ts +12 -0
- package/dist/rest/prompts.d.ts.map +1 -0
- package/dist/rest/prompts.js +10 -0
- package/dist/rest/prompts.js.map +1 -0
- package/dist/rest/providers.d.ts +56 -0
- package/dist/rest/providers.d.ts.map +1 -0
- package/dist/rest/providers.js +59 -0
- package/dist/rest/providers.js.map +1 -0
- package/dist/rest/sessions.d.ts +54 -0
- package/dist/rest/sessions.d.ts.map +1 -0
- package/dist/rest/sessions.js +47 -0
- package/dist/rest/sessions.js.map +1 -0
- package/dist/rest/terminals.d.ts +28 -0
- package/dist/rest/terminals.d.ts.map +1 -0
- package/dist/rest/terminals.js +22 -0
- package/dist/rest/terminals.js.map +1 -0
- package/dist/rest/tools.d.ts +34 -0
- package/dist/rest/tools.d.ts.map +1 -0
- package/dist/rest/tools.js +37 -0
- package/dist/rest/tools.js.map +1 -0
- package/dist/rest/workspaces.d.ts +28 -0
- package/dist/rest/workspaces.d.ts.map +1 -0
- package/dist/rest/workspaces.js +34 -0
- package/dist/rest/workspaces.js.map +1 -0
- package/dist/shared-protocol/client.d.ts +148 -0
- package/dist/shared-protocol/client.d.ts.map +1 -0
- package/dist/shared-protocol/client.js +4 -0
- package/dist/shared-protocol/client.js.map +1 -0
- package/dist/shared-protocol/index.d.ts +4 -0
- package/dist/shared-protocol/index.d.ts.map +1 -0
- package/dist/shared-protocol/index.js +4 -0
- package/dist/shared-protocol/index.js.map +1 -0
- package/dist/shared-protocol/server.d.ts +233 -0
- package/dist/shared-protocol/server.d.ts.map +1 -0
- package/dist/shared-protocol/server.js +2 -0
- package/dist/shared-protocol/server.js.map +1 -0
- package/dist/shared-protocol/terminal.d.ts +55 -0
- package/dist/shared-protocol/terminal.d.ts.map +1 -0
- package/dist/shared-protocol/terminal.js +2 -0
- package/dist/shared-protocol/terminal.js.map +1 -0
- package/dist/shared-types/configuration.d.ts +100 -0
- package/dist/shared-types/configuration.d.ts.map +1 -0
- package/dist/shared-types/configuration.js +2 -0
- package/dist/shared-types/configuration.js.map +1 -0
- package/dist/shared-types/file.d.ts +47 -0
- package/dist/shared-types/file.d.ts.map +1 -0
- package/dist/shared-types/file.js +2 -0
- package/dist/shared-types/file.js.map +1 -0
- package/dist/shared-types/index.d.ts +20 -0
- package/dist/shared-types/index.d.ts.map +1 -0
- package/dist/shared-types/index.js +20 -0
- package/dist/shared-types/index.js.map +1 -0
- package/dist/shared-types/interrupt.d.ts +25 -0
- package/dist/shared-types/interrupt.d.ts.map +1 -0
- package/dist/shared-types/interrupt.js +2 -0
- package/dist/shared-types/interrupt.js.map +1 -0
- package/dist/shared-types/mcp.d.ts +49 -0
- package/dist/shared-types/mcp.d.ts.map +1 -0
- package/dist/shared-types/mcp.js +6 -0
- package/dist/shared-types/mcp.js.map +1 -0
- package/dist/shared-types/message.d.ts +166 -0
- package/dist/shared-types/message.d.ts.map +1 -0
- package/dist/shared-types/message.js +34 -0
- package/dist/shared-types/message.js.map +1 -0
- package/dist/shared-types/model.d.ts +60 -0
- package/dist/shared-types/model.d.ts.map +1 -0
- package/dist/shared-types/model.js +2 -0
- package/dist/shared-types/model.js.map +1 -0
- package/dist/shared-types/permission.d.ts +209 -0
- package/dist/shared-types/permission.d.ts.map +1 -0
- package/dist/shared-types/permission.js +787 -0
- package/dist/shared-types/permission.js.map +1 -0
- package/dist/shared-types/preconfig.d.ts +31 -0
- package/dist/shared-types/preconfig.d.ts.map +1 -0
- package/dist/shared-types/preconfig.js +2 -0
- package/dist/shared-types/preconfig.js.map +1 -0
- package/dist/shared-types/prompt.d.ts +6 -0
- package/dist/shared-types/prompt.d.ts.map +1 -0
- package/dist/shared-types/prompt.js +2 -0
- package/dist/shared-types/prompt.js.map +1 -0
- package/dist/shared-types/provider.d.ts +31 -0
- package/dist/shared-types/provider.d.ts.map +1 -0
- package/dist/shared-types/provider.js +2 -0
- package/dist/shared-types/provider.js.map +1 -0
- package/dist/shared-types/runtime.d.ts +27 -0
- package/dist/shared-types/runtime.d.ts.map +1 -0
- package/dist/shared-types/runtime.js +2 -0
- package/dist/shared-types/runtime.js.map +1 -0
- package/dist/shared-types/server.d.ts +16 -0
- package/dist/shared-types/server.d.ts.map +1 -0
- package/dist/shared-types/server.js +2 -0
- package/dist/shared-types/server.js.map +1 -0
- package/dist/shared-types/session.d.ts +24 -0
- package/dist/shared-types/session.d.ts.map +1 -0
- package/dist/shared-types/session.js +2 -0
- package/dist/shared-types/session.js.map +1 -0
- package/dist/shared-types/skill.d.ts +24 -0
- package/dist/shared-types/skill.d.ts.map +1 -0
- package/dist/shared-types/skill.js +2 -0
- package/dist/shared-types/skill.js.map +1 -0
- package/dist/shared-types/task.d.ts +45 -0
- package/dist/shared-types/task.d.ts.map +1 -0
- package/dist/shared-types/task.js +2 -0
- package/dist/shared-types/task.js.map +1 -0
- package/dist/shared-types/tool.d.ts +250 -0
- package/dist/shared-types/tool.d.ts.map +1 -0
- package/dist/shared-types/tool.js +3 -0
- package/dist/shared-types/tool.js.map +1 -0
- package/dist/shared-types/ui.d.ts +35 -0
- package/dist/shared-types/ui.d.ts.map +1 -0
- package/dist/shared-types/ui.js +52 -0
- package/dist/shared-types/ui.js.map +1 -0
- package/dist/shared-types/visualization.d.ts +208 -0
- package/dist/shared-types/visualization.d.ts.map +1 -0
- package/dist/shared-types/visualization.js +2 -0
- package/dist/shared-types/visualization.js.map +1 -0
- package/dist/shared-types/workspace.d.ts +9 -0
- package/dist/shared-types/workspace.d.ts.map +1 -0
- package/dist/shared-types/workspace.js +2 -0
- package/dist/shared-types/workspace.js.map +1 -0
- package/dist/shared-utils/index.d.ts +2 -0
- package/dist/shared-utils/index.d.ts.map +1 -0
- package/dist/shared-utils/index.js +2 -0
- package/dist/shared-utils/index.js.map +1 -0
- package/dist/shared-utils/model-context.d.ts +15 -0
- package/dist/shared-utils/model-context.d.ts.map +1 -0
- package/dist/shared-utils/model-context.js +22 -0
- package/dist/shared-utils/model-context.js.map +1 -0
- package/dist/shared.d.ts +4 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +4 -0
- package/dist/shared.js.map +1 -0
- package/dist/transport/http.d.ts +37 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +75 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/transport/websocket.d.ts +33 -0
- package/dist/transport/websocket.d.ts.map +1 -0
- package/dist/transport/websocket.js +145 -0
- package/dist/transport/websocket.js.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/rest-responses.d.ts +389 -0
- package/dist/types/rest-responses.d.ts.map +1 -0
- package/dist/types/rest-responses.js +2 -0
- package/dist/types/rest-responses.js.map +1 -0
- package/dist/types/sdk-types.d.ts +32 -0
- package/dist/types/sdk-types.d.ts.map +1 -0
- package/dist/types/sdk-types.js +2 -0
- package/dist/types/sdk-types.js.map +1 -0
- package/dist/types/server-messages.d.ts +132 -0
- package/dist/types/server-messages.d.ts.map +1 -0
- package/dist/types/server-messages.js +135 -0
- package/dist/types/server-messages.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/shared-types/file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './message';
|
|
2
|
+
export * from './session';
|
|
3
|
+
export * from './preconfig';
|
|
4
|
+
export * from './tool';
|
|
5
|
+
export * from './model';
|
|
6
|
+
export * from './workspace';
|
|
7
|
+
export * from './permission';
|
|
8
|
+
export * from './task';
|
|
9
|
+
export * from './interrupt';
|
|
10
|
+
export * from './file';
|
|
11
|
+
export * from './visualization';
|
|
12
|
+
export * from './mcp';
|
|
13
|
+
export * from './skill';
|
|
14
|
+
export * from './server';
|
|
15
|
+
export * from './prompt';
|
|
16
|
+
export * from './configuration';
|
|
17
|
+
export * from './provider';
|
|
18
|
+
export * from './runtime';
|
|
19
|
+
export * from './ui';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './message.js';
|
|
2
|
+
export * from './session.js';
|
|
3
|
+
export * from './preconfig.js';
|
|
4
|
+
export * from './tool.js';
|
|
5
|
+
export * from './model.js';
|
|
6
|
+
export * from './workspace.js';
|
|
7
|
+
export * from './permission.js';
|
|
8
|
+
export * from './task.js';
|
|
9
|
+
export * from './interrupt.js';
|
|
10
|
+
export * from './file.js';
|
|
11
|
+
export * from './visualization.js';
|
|
12
|
+
export * from './mcp.js';
|
|
13
|
+
export * from './skill.js';
|
|
14
|
+
export * from './server.js';
|
|
15
|
+
export * from './prompt.js';
|
|
16
|
+
export * from './configuration.js';
|
|
17
|
+
export * from './provider.js';
|
|
18
|
+
export * from './runtime.js';
|
|
19
|
+
export * from './ui.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type InterruptReason = 'user_request' | 'timeout' | 'error' | 'cascade';
|
|
2
|
+
export interface InterruptState {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
interrupted: boolean;
|
|
5
|
+
reason?: InterruptReason;
|
|
6
|
+
interruptedAt?: number;
|
|
7
|
+
interruptedBy?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionInterruptResult {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
success: boolean;
|
|
12
|
+
cascadedTo: string[];
|
|
13
|
+
interruptedTools: string[];
|
|
14
|
+
rejectedAsks: string[];
|
|
15
|
+
partialResults?: {
|
|
16
|
+
toolCallId: string;
|
|
17
|
+
partialOutput: unknown;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
export interface ToolAbortContext {
|
|
21
|
+
toolCallId: string;
|
|
22
|
+
sessionId: string;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=interrupt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.d.ts","sourceRoot":"","sources":["../../src/shared-types/interrupt.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAG/E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,OAAO,CAAC;KACxB,EAAE,CAAC;CACL;AAGD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interrupt.js","sourceRoot":"","sources":["../../src/shared-types/interrupt.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server Configuration Types
|
|
3
|
+
* Used for configuring MCP servers in workspace .jean2/mcp.json
|
|
4
|
+
*/
|
|
5
|
+
export type McpServerType = 'local' | 'remote';
|
|
6
|
+
export interface McpOAuthConfig {
|
|
7
|
+
clientId?: string;
|
|
8
|
+
clientSecret?: string;
|
|
9
|
+
scope?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface McpLocalServerConfig {
|
|
12
|
+
type: 'local';
|
|
13
|
+
command: string[];
|
|
14
|
+
env?: Record<string, string>;
|
|
15
|
+
timeout?: number;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface McpRemoteServerConfig {
|
|
19
|
+
type: 'remote';
|
|
20
|
+
url: string;
|
|
21
|
+
oauth?: boolean | McpOAuthConfig;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type McpServerConfig = McpLocalServerConfig | McpRemoteServerConfig;
|
|
27
|
+
export interface McpConfig {
|
|
28
|
+
servers: Record<string, McpServerConfig>;
|
|
29
|
+
}
|
|
30
|
+
export type McpStatus = {
|
|
31
|
+
status: 'connected';
|
|
32
|
+
} | {
|
|
33
|
+
status: 'disabled';
|
|
34
|
+
} | {
|
|
35
|
+
status: 'failed';
|
|
36
|
+
error: string;
|
|
37
|
+
} | {
|
|
38
|
+
status: 'needs_auth';
|
|
39
|
+
} | {
|
|
40
|
+
status: 'needs_client_registration';
|
|
41
|
+
error: string;
|
|
42
|
+
};
|
|
43
|
+
export interface McpServerInfo {
|
|
44
|
+
name: string;
|
|
45
|
+
config: McpServerConfig;
|
|
46
|
+
status: McpStatus;
|
|
47
|
+
toolCount?: number;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/shared-types/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAE3E,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC1C;AAED,MAAM,MAAM,SAAS,GACjB;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GACtB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,2BAA2B,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/shared-types/mcp.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export type ToolStatus = 'pending' | 'running' | 'completed' | 'error' | 'interrupted';
|
|
2
|
+
interface ToolStateBase {
|
|
3
|
+
input: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
export interface ToolStatePending extends ToolStateBase {
|
|
6
|
+
status: 'pending';
|
|
7
|
+
}
|
|
8
|
+
export interface ToolStateRunning extends ToolStateBase {
|
|
9
|
+
status: 'running';
|
|
10
|
+
startedAt: number;
|
|
11
|
+
childSessionId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolStateCompleted extends ToolStateBase {
|
|
14
|
+
status: 'completed';
|
|
15
|
+
output: unknown;
|
|
16
|
+
startedAt: number;
|
|
17
|
+
completedAt: number;
|
|
18
|
+
compactedAt?: number;
|
|
19
|
+
childSessionId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolStateError extends ToolStateBase {
|
|
22
|
+
status: 'error';
|
|
23
|
+
error: string;
|
|
24
|
+
startedAt: number;
|
|
25
|
+
failedAt: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ToolStateInterrupted extends ToolStateBase {
|
|
28
|
+
status: 'interrupted';
|
|
29
|
+
input: Record<string, unknown>;
|
|
30
|
+
startedAt: number;
|
|
31
|
+
interruptedAt: number;
|
|
32
|
+
reason: 'user_request' | 'timeout' | 'error' | 'cascade';
|
|
33
|
+
partialOutput?: unknown;
|
|
34
|
+
childSessionId?: string;
|
|
35
|
+
}
|
|
36
|
+
export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError | ToolStateInterrupted;
|
|
37
|
+
interface PartBase {
|
|
38
|
+
id: string;
|
|
39
|
+
messageId: string;
|
|
40
|
+
createdAt: number;
|
|
41
|
+
}
|
|
42
|
+
export interface TextPart extends PartBase {
|
|
43
|
+
type: 'text';
|
|
44
|
+
text: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ReasoningPart extends PartBase {
|
|
47
|
+
type: 'reasoning';
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ToolPart extends PartBase {
|
|
51
|
+
type: 'tool';
|
|
52
|
+
callId: string;
|
|
53
|
+
name: string;
|
|
54
|
+
state: ToolState;
|
|
55
|
+
}
|
|
56
|
+
export interface FilePart extends PartBase {
|
|
57
|
+
type: 'file';
|
|
58
|
+
mimeType: string;
|
|
59
|
+
filename?: string;
|
|
60
|
+
url: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ImagePart extends PartBase {
|
|
63
|
+
type: 'image';
|
|
64
|
+
url: string;
|
|
65
|
+
mimeType?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface StepPart extends PartBase {
|
|
68
|
+
type: 'step';
|
|
69
|
+
number: number;
|
|
70
|
+
status: 'started' | 'finished';
|
|
71
|
+
finishReason?: 'stop' | 'tool-calls' | 'error' | 'length';
|
|
72
|
+
tokens?: {
|
|
73
|
+
prompt: number;
|
|
74
|
+
completion: number;
|
|
75
|
+
};
|
|
76
|
+
cost?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CompactionPart extends PartBase {
|
|
79
|
+
type: 'compaction';
|
|
80
|
+
auto: boolean;
|
|
81
|
+
overflow?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export type Part = TextPart | ReasoningPart | ToolPart | FilePart | ImagePart | StepPart | CompactionPart;
|
|
84
|
+
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
85
|
+
export type AssistantStatus = 'streaming' | 'completed' | 'error' | 'interrupted';
|
|
86
|
+
interface MessageBase {
|
|
87
|
+
id: string;
|
|
88
|
+
sessionId: string;
|
|
89
|
+
role: MessageRole;
|
|
90
|
+
createdAt: number;
|
|
91
|
+
}
|
|
92
|
+
export interface UserMessage extends MessageBase {
|
|
93
|
+
role: 'user';
|
|
94
|
+
}
|
|
95
|
+
export interface SystemMessage extends MessageBase {
|
|
96
|
+
role: 'system';
|
|
97
|
+
}
|
|
98
|
+
export interface AssistantMessage extends MessageBase {
|
|
99
|
+
role: 'assistant';
|
|
100
|
+
status: AssistantStatus;
|
|
101
|
+
modelId: string;
|
|
102
|
+
providerId: string;
|
|
103
|
+
agent?: string;
|
|
104
|
+
tokens: {
|
|
105
|
+
prompt: number;
|
|
106
|
+
completion: number;
|
|
107
|
+
};
|
|
108
|
+
cost: number;
|
|
109
|
+
completedAt?: number;
|
|
110
|
+
error?: string;
|
|
111
|
+
summary?: boolean;
|
|
112
|
+
mode?: 'chat' | 'compaction' | 'compact_failed';
|
|
113
|
+
parentId?: string;
|
|
114
|
+
}
|
|
115
|
+
export type Message = UserMessage | AssistantMessage | SystemMessage;
|
|
116
|
+
export interface MessageWithParts {
|
|
117
|
+
message: Message;
|
|
118
|
+
parts: Part[];
|
|
119
|
+
}
|
|
120
|
+
export interface QueuedMessage {
|
|
121
|
+
id: string;
|
|
122
|
+
sessionId: string;
|
|
123
|
+
content: string;
|
|
124
|
+
position: number;
|
|
125
|
+
createdAt: number;
|
|
126
|
+
attachments?: Array<{
|
|
127
|
+
id: string;
|
|
128
|
+
kind: string;
|
|
129
|
+
filename?: string;
|
|
130
|
+
mimeType?: string;
|
|
131
|
+
accessKey?: string;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
export type PartField = 'text' | 'reasoning';
|
|
135
|
+
export type MessageEvent = {
|
|
136
|
+
type: 'message.created';
|
|
137
|
+
message: Message;
|
|
138
|
+
} | {
|
|
139
|
+
type: 'message.updated';
|
|
140
|
+
message: Message;
|
|
141
|
+
} | {
|
|
142
|
+
type: 'part.created';
|
|
143
|
+
sessionId: string;
|
|
144
|
+
part: Part;
|
|
145
|
+
} | {
|
|
146
|
+
type: 'part.updated';
|
|
147
|
+
sessionId: string;
|
|
148
|
+
part: Part;
|
|
149
|
+
} | {
|
|
150
|
+
type: 'part.append';
|
|
151
|
+
sessionId: string;
|
|
152
|
+
partId: string;
|
|
153
|
+
field: PartField;
|
|
154
|
+
delta: string;
|
|
155
|
+
};
|
|
156
|
+
export declare function isTextPart(part: Part): part is TextPart;
|
|
157
|
+
export declare function isToolPart(part: Part): part is ToolPart;
|
|
158
|
+
export declare function isReasoningPart(part: Part): part is ReasoningPart;
|
|
159
|
+
export declare function isStepPart(part: Part): part is StepPart;
|
|
160
|
+
export declare function isImagePart(part: Part): part is ImagePart;
|
|
161
|
+
export declare function isFilePart(part: Part): part is FilePart;
|
|
162
|
+
export declare function isCompactionPart(part: Part): part is CompactionPart;
|
|
163
|
+
export declare function isAssistantMessage(message: Message): message is AssistantMessage;
|
|
164
|
+
export declare function isUserMessage(message: Message): message is UserMessage;
|
|
165
|
+
export {};
|
|
166
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/shared-types/message.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAAC;AAEvF,UAAU,aA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AAI,QAAQ,CAEvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,SAAS,CAEzD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,QAAQ,CAEvD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,cAAc,CAEnE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAEhF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,WAAW,CAEtE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// ===========================================
|
|
2
|
+
// Tool State Types
|
|
3
|
+
// ===========================================
|
|
4
|
+
// ===========================================
|
|
5
|
+
// Type Guards
|
|
6
|
+
// ===========================================
|
|
7
|
+
export function isTextPart(part) {
|
|
8
|
+
return part.type === 'text';
|
|
9
|
+
}
|
|
10
|
+
export function isToolPart(part) {
|
|
11
|
+
return part.type === 'tool';
|
|
12
|
+
}
|
|
13
|
+
export function isReasoningPart(part) {
|
|
14
|
+
return part.type === 'reasoning';
|
|
15
|
+
}
|
|
16
|
+
export function isStepPart(part) {
|
|
17
|
+
return part.type === 'step';
|
|
18
|
+
}
|
|
19
|
+
export function isImagePart(part) {
|
|
20
|
+
return part.type === 'image';
|
|
21
|
+
}
|
|
22
|
+
export function isFilePart(part) {
|
|
23
|
+
return part.type === 'file';
|
|
24
|
+
}
|
|
25
|
+
export function isCompactionPart(part) {
|
|
26
|
+
return part.type === 'compaction';
|
|
27
|
+
}
|
|
28
|
+
export function isAssistantMessage(message) {
|
|
29
|
+
return message.role === 'assistant';
|
|
30
|
+
}
|
|
31
|
+
export function isUserMessage(message) {
|
|
32
|
+
return message.role === 'user';
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/shared-types/message.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,mBAAmB;AACnB,8CAA8C;AAmM9C,8CAA8C;AAC9C,cAAc;AACd,8CAA8C;AAE9C,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAU;IACpC,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAU;IACzC,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type AttachmentKind = 'image' | 'video' | 'file';
|
|
2
|
+
export interface ModelCapabilities {
|
|
3
|
+
input?: {
|
|
4
|
+
text?: boolean;
|
|
5
|
+
image?: boolean;
|
|
6
|
+
video?: boolean;
|
|
7
|
+
file?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Model tier for pricing categorization
|
|
12
|
+
*/
|
|
13
|
+
export type ModelTier = 'budget' | 'standard' | 'premium';
|
|
14
|
+
export interface VariantOption {
|
|
15
|
+
providerOptions: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Definition of an LLM model
|
|
19
|
+
*/
|
|
20
|
+
export interface ModelDefinition {
|
|
21
|
+
/** Unique model identifier (e.g., "gpt-4o", "anthropic/claude-3.5-sonnet") */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Human-readable model name */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Maximum context window in tokens */
|
|
26
|
+
contextWindow: number;
|
|
27
|
+
/** Maximum output tokens */
|
|
28
|
+
maxOutputTokens?: number;
|
|
29
|
+
/** Pricing tier */
|
|
30
|
+
tier: ModelTier;
|
|
31
|
+
variants?: Record<string, VariantOption>;
|
|
32
|
+
capabilities?: ModelCapabilities;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Definition of an LLM provider
|
|
36
|
+
*/
|
|
37
|
+
export interface ProviderDefinition {
|
|
38
|
+
/** Provider identifier (e.g., "openai", "anthropic") */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Human-readable provider name */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Models available from this provider */
|
|
43
|
+
models: ModelDefinition[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Model with provider info attached
|
|
47
|
+
*/
|
|
48
|
+
export interface ModelWithProvider extends ModelDefinition {
|
|
49
|
+
providerId: string;
|
|
50
|
+
providerName: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Full models configuration
|
|
54
|
+
*/
|
|
55
|
+
export interface ModelsConfig {
|
|
56
|
+
providers: ProviderDefinition[];
|
|
57
|
+
defaultModel: string;
|
|
58
|
+
defaultProvider: string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=model.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AC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/shared-types/model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export type PermissionRiskLevel = 'none' | 'low' | 'medium' | 'high' | 'critical';
|
|
2
|
+
export type PermissionRisk = PermissionRiskLevel;
|
|
3
|
+
export type GrantScope = 'once' | 'session' | 'workspace';
|
|
4
|
+
export type PermissionScope = GrantScope;
|
|
5
|
+
export type GrantMatcher = 'exact' | 'prefix' | 'glob' | 'shell-command';
|
|
6
|
+
export type PermissionMatcher = GrantMatcher;
|
|
7
|
+
export type PermissionResource = 'file' | 'path' | 'directory' | 'shell-command' | 'network' | 'env' | 'clipboard' | string;
|
|
8
|
+
export type PermissionType = PermissionResource;
|
|
9
|
+
export type PermissionDecision = 'granted' | 'denied' | 'timeout' | 'skipped';
|
|
10
|
+
export interface PermissionScopeDefinition {
|
|
11
|
+
type: 'file' | 'path' | 'shell-command' | 'resource' | 'custom';
|
|
12
|
+
value?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PermissionAsk {
|
|
16
|
+
type: 'permission';
|
|
17
|
+
question: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
risk?: PermissionRiskLevel;
|
|
20
|
+
resource?: PermissionResource;
|
|
21
|
+
scope?: PermissionScopeDefinition | PermissionScopeDefinition[];
|
|
22
|
+
duration?: GrantScope;
|
|
23
|
+
patterns?: string[];
|
|
24
|
+
paths?: string[];
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
/** Structured intents from shell effect analysis (Phase 3) */
|
|
27
|
+
intents?: PermissionIntent[];
|
|
28
|
+
/** Allowed scopes derived from intent analysis policy */
|
|
29
|
+
allowedScopes?: GrantScope[];
|
|
30
|
+
/** Action on the resource (e.g. 'read', 'write', 'delete') */
|
|
31
|
+
action?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AskPermissionResponse {
|
|
34
|
+
type: 'permission';
|
|
35
|
+
grant: GrantScope | 'deny';
|
|
36
|
+
scope?: string;
|
|
37
|
+
duration?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface PermissionGrant {
|
|
40
|
+
id: string;
|
|
41
|
+
workspaceId: string;
|
|
42
|
+
toolName: string;
|
|
43
|
+
resource: PermissionResource;
|
|
44
|
+
action?: string;
|
|
45
|
+
scope: GrantScope;
|
|
46
|
+
matcher: GrantMatcher;
|
|
47
|
+
patterns: string[];
|
|
48
|
+
allowed: boolean;
|
|
49
|
+
grantedAt: string;
|
|
50
|
+
expiresAt: string | null;
|
|
51
|
+
grantedBy: string | null;
|
|
52
|
+
revokedAt: string | null;
|
|
53
|
+
revokedBy: string | null;
|
|
54
|
+
metadata: Record<string, unknown> | null;
|
|
55
|
+
/** For session-scoped grants: the root session ID this grant is bound to */
|
|
56
|
+
boundRootSessionId?: string | null;
|
|
57
|
+
}
|
|
58
|
+
export interface PermissionGrantOptions {
|
|
59
|
+
scope?: GrantScope;
|
|
60
|
+
matcher?: GrantMatcher;
|
|
61
|
+
action?: string;
|
|
62
|
+
patterns?: string[];
|
|
63
|
+
duration?: number;
|
|
64
|
+
description?: string;
|
|
65
|
+
/** For session-scoped grants: bind to this root session ID */
|
|
66
|
+
boundRootSessionId?: string;
|
|
67
|
+
}
|
|
68
|
+
export type PermissionAction = string;
|
|
69
|
+
export type PersistedPermissionGrant = PermissionGrant;
|
|
70
|
+
export interface SecurityCheckInput {
|
|
71
|
+
args: Record<string, unknown>;
|
|
72
|
+
workspacePath: string;
|
|
73
|
+
sessionId: string;
|
|
74
|
+
allowedPaths?: string[];
|
|
75
|
+
}
|
|
76
|
+
export interface SecurityCheckResult {
|
|
77
|
+
allowed: boolean;
|
|
78
|
+
requiresApproval: boolean;
|
|
79
|
+
permissionType: string;
|
|
80
|
+
permissionKey: string;
|
|
81
|
+
message: string;
|
|
82
|
+
details?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
export declare const SHELL_DANGEROUS_COMMANDS: readonly ["rm", "rmdir", "del", "erase", "sudo", "su", "doas", "chmod", "chown", "dd", "mkfs", "format", "shutdown", "reboot", "halt", "iptables", "ufw", "firewall-cmd", "curl", "wget", "nc", "netcat", "eval", "exec"];
|
|
85
|
+
export declare const SHELL_FILESYSTEM_COMMANDS: readonly ["mv", "cp", "mkdir", "touch", "ln", "git push", "git reset --hard"];
|
|
86
|
+
export declare const SHELL_SHELL_OPERATORS: readonly ["&&", "||", "|", ">", ">>", "`", "$(", ";"];
|
|
87
|
+
export interface ParsedShellSegment {
|
|
88
|
+
raw: string;
|
|
89
|
+
baseCommand: string;
|
|
90
|
+
args: string[];
|
|
91
|
+
flags: string[];
|
|
92
|
+
}
|
|
93
|
+
export declare function splitShellCommandSegments(command: string): ParsedShellSegment[];
|
|
94
|
+
export declare function getEffectiveShellCommandIdentity(command: string): string;
|
|
95
|
+
export declare const SENSITIVE_FILE_PATTERNS: readonly [".env", ".pem", ".key", ".ssh/", "id_rsa", "id_ed25519", ".gitconfig", ".npmrc", "credentials", "secrets", "password", ".htpasswd"];
|
|
96
|
+
export type PermissionIntentResource = 'file' | 'network' | 'shell-command';
|
|
97
|
+
export type PermissionIntentAction = 'read' | 'write' | 'delete' | 'request' | 'execute';
|
|
98
|
+
export type PermissionTargetMatcher = 'exact' | 'prefix';
|
|
99
|
+
export interface PermissionTarget {
|
|
100
|
+
/** Normalized absolute path, host, or other target identifier */
|
|
101
|
+
target: string;
|
|
102
|
+
/** How to match this target against future requests */
|
|
103
|
+
matcher: PermissionTargetMatcher;
|
|
104
|
+
}
|
|
105
|
+
export interface PermissionIntent {
|
|
106
|
+
/** The resource category this intent affects */
|
|
107
|
+
resource: PermissionIntentResource;
|
|
108
|
+
/** The action being performed on the resource */
|
|
109
|
+
action: PermissionIntentAction;
|
|
110
|
+
/** Normalized targets with match semantics */
|
|
111
|
+
targets: PermissionTarget[];
|
|
112
|
+
/** Whether this intent can produce reusable (non-once) grants */
|
|
113
|
+
persistable: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Reason the intent is not persistable (when persistable=false).
|
|
116
|
+
* E.g. "command contains shell operators" or "dynamic variable expansion"
|
|
117
|
+
*/
|
|
118
|
+
nonPersistableReason?: string;
|
|
119
|
+
/** Allowed scopes for this intent (computed from policy) */
|
|
120
|
+
allowedScopes: GrantScope[];
|
|
121
|
+
}
|
|
122
|
+
export interface ShellEffectAnalysis {
|
|
123
|
+
/** The original command string */
|
|
124
|
+
command: string;
|
|
125
|
+
/** Base command identity (e.g. "rm", "git push", "curl") */
|
|
126
|
+
baseCommand: string;
|
|
127
|
+
/** Shell risk category */
|
|
128
|
+
riskCategory: ShellRiskCategory;
|
|
129
|
+
/** Risk level */
|
|
130
|
+
risk: PermissionRiskLevel;
|
|
131
|
+
/** Whether the command has shell operators */
|
|
132
|
+
hasOperators: boolean;
|
|
133
|
+
/** Whether all referenced paths are within the workspace */
|
|
134
|
+
workspaceBound: boolean;
|
|
135
|
+
/** Resolved absolute paths from command arguments */
|
|
136
|
+
resolvedPaths: string[];
|
|
137
|
+
/** Human-readable reason for the permission ask */
|
|
138
|
+
reason: string;
|
|
139
|
+
/** Structured intents derived from command analysis */
|
|
140
|
+
intents: PermissionIntent[];
|
|
141
|
+
/** The effective command identity used for shell-command fallback */
|
|
142
|
+
effectiveIdentity: string;
|
|
143
|
+
}
|
|
144
|
+
export declare function getAllowedScopesForIntent(intent: PermissionIntent): GrantScope[];
|
|
145
|
+
/**
|
|
146
|
+
* Analyze a shell command into structured permission intents.
|
|
147
|
+
*
|
|
148
|
+
* This is the core of the target-based permission system.
|
|
149
|
+
* Instead of "allow cat", it produces "allow file read .env".
|
|
150
|
+
*/
|
|
151
|
+
export declare function analyzeShellCommandEffects(params: {
|
|
152
|
+
command: string;
|
|
153
|
+
baseCommand: string;
|
|
154
|
+
resolvedPaths: string[];
|
|
155
|
+
hasOperators: boolean;
|
|
156
|
+
workspaceBound: boolean;
|
|
157
|
+
riskCategory: ShellRiskCategory;
|
|
158
|
+
}): PermissionIntent[];
|
|
159
|
+
export type ShellRiskCategory = 'destructive' | 'side-effect' | 'workspace-modification' | 'network' | 'outside-workspace' | 'sensitive-files';
|
|
160
|
+
/**
|
|
161
|
+
* Create a shell permission ask with structured intent analysis.
|
|
162
|
+
*
|
|
163
|
+
* This function now runs the shell effect analyzer to produce target-based
|
|
164
|
+
* intents instead of command-identity patterns. For example:
|
|
165
|
+
* - "cat .env" → resource='file', action='read', target='/workspace/.env'
|
|
166
|
+
* - "rm -rf build" → resource='file', action='delete', target='build/' (prefix)
|
|
167
|
+
* - "curl https://api.example.com" → resource='network', action='request', target='api.example.com'
|
|
168
|
+
*
|
|
169
|
+
* Falls back to resource='shell-command' when analysis can't extract targets.
|
|
170
|
+
*/
|
|
171
|
+
export declare function createShellPermissionAskStructured(params: {
|
|
172
|
+
command: string;
|
|
173
|
+
baseCommand: string;
|
|
174
|
+
flags: string[];
|
|
175
|
+
risk: PermissionRiskLevel;
|
|
176
|
+
riskCategory: ShellRiskCategory;
|
|
177
|
+
reason: string;
|
|
178
|
+
resolvedPaths?: string[];
|
|
179
|
+
workspaceBound: boolean;
|
|
180
|
+
hasOperators: boolean;
|
|
181
|
+
}): PermissionAsk;
|
|
182
|
+
export declare function createOutsideWorkspaceAsk(params: {
|
|
183
|
+
command: string;
|
|
184
|
+
cwd: string;
|
|
185
|
+
resolvedPaths: string[];
|
|
186
|
+
hasOperators?: boolean;
|
|
187
|
+
}): PermissionAsk;
|
|
188
|
+
export declare function createWorkspaceModificationAsk(params: {
|
|
189
|
+
command: string;
|
|
190
|
+
baseCommand: string;
|
|
191
|
+
resolvedPaths: string[];
|
|
192
|
+
hasOperators?: boolean;
|
|
193
|
+
}): PermissionAsk;
|
|
194
|
+
export declare function createFilePermissionAsk(params: {
|
|
195
|
+
path: string;
|
|
196
|
+
operation: 'read' | 'write' | 'edit';
|
|
197
|
+
risk: PermissionRiskLevel;
|
|
198
|
+
reason?: string;
|
|
199
|
+
isOutsideWorkspace?: boolean;
|
|
200
|
+
isSensitiveFile?: boolean;
|
|
201
|
+
}): PermissionAsk;
|
|
202
|
+
export declare function createWebfetchPermissionAsk(params: {
|
|
203
|
+
url: string;
|
|
204
|
+
host: string;
|
|
205
|
+
risk: PermissionRiskLevel;
|
|
206
|
+
reason?: string;
|
|
207
|
+
isHttp?: boolean;
|
|
208
|
+
}): PermissionAsk;
|
|
209
|
+
//# sourceMappingURL=permission.d.ts.map
|