iosm-cli 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +18 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +16 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-profiles.d.ts.map +1 -1
- package/dist/core/agent-profiles.js +3 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +26 -10
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/agent-teams.d.ts.map +1 -1
- package/dist/core/agent-teams.js +12 -9
- package/dist/core/agent-teams.js.map +1 -1
- package/dist/core/checkpoint/fs-checkpoint.d.ts +14 -0
- package/dist/core/checkpoint/fs-checkpoint.d.ts.map +1 -0
- package/dist/core/checkpoint/fs-checkpoint.js +211 -0
- package/dist/core/checkpoint/fs-checkpoint.js.map +1 -0
- package/dist/core/command-dispatcher.d.ts +2 -0
- package/dist/core/command-dispatcher.d.ts.map +1 -1
- package/dist/core/command-dispatcher.js +78 -13
- package/dist/core/command-dispatcher.js.map +1 -1
- package/dist/core/mcp/cli.d.ts.map +1 -1
- package/dist/core/mcp/cli.js +26 -0
- package/dist/core/mcp/cli.js.map +1 -1
- package/dist/core/mcp/config.d.ts.map +1 -1
- package/dist/core/mcp/config.js +55 -0
- package/dist/core/mcp/config.js.map +1 -1
- package/dist/core/mcp/index.d.ts +1 -1
- package/dist/core/mcp/index.d.ts.map +1 -1
- package/dist/core/mcp/index.js.map +1 -1
- package/dist/core/mcp/runtime.d.ts +3 -1
- package/dist/core/mcp/runtime.d.ts.map +1 -1
- package/dist/core/mcp/runtime.js +21 -2
- package/dist/core/mcp/runtime.js.map +1 -1
- package/dist/core/mcp/types.d.ts +30 -2
- package/dist/core/mcp/types.d.ts.map +1 -1
- package/dist/core/mcp/types.js.map +1 -1
- package/dist/core/package-manager.d.ts +10 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +100 -2
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/policy/engine.d.ts +77 -0
- package/dist/core/policy/engine.d.ts.map +1 -0
- package/dist/core/policy/engine.js +614 -0
- package/dist/core/policy/engine.js.map +1 -0
- package/dist/core/policy/index.d.ts +2 -0
- package/dist/core/policy/index.d.ts.map +1 -0
- package/dist/core/policy/index.js +2 -0
- package/dist/core/policy/index.js.map +1 -0
- package/dist/core/sandbox/executor.d.ts +13 -0
- package/dist/core/sandbox/executor.d.ts.map +1 -0
- package/dist/core/sandbox/executor.js +64 -0
- package/dist/core/sandbox/executor.js.map +1 -0
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/security/index.d.ts +3 -0
- package/dist/core/security/index.d.ts.map +1 -0
- package/dist/core/security/index.js +3 -0
- package/dist/core/security/index.js.map +1 -0
- package/dist/core/security/source-security.d.ts +43 -0
- package/dist/core/security/source-security.d.ts.map +1 -0
- package/dist/core/security/source-security.js +94 -0
- package/dist/core/security/source-security.js.map +1 -0
- package/dist/core/security/trust-ledger.d.ts +24 -0
- package/dist/core/security/trust-ledger.d.ts.map +1 -0
- package/dist/core/security/trust-ledger.js +66 -0
- package/dist/core/security/trust-ledger.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +128 -15
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +22 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/task-plan.d.ts +1 -0
- package/dist/core/task-plan.d.ts.map +1 -1
- package/dist/core/task-plan.js +103 -0
- package/dist/core/task-plan.js.map +1 -1
- package/dist/core/tools/apply-patch.d.ts +29 -0
- package/dist/core/tools/apply-patch.d.ts.map +1 -0
- package/dist/core/tools/apply-patch.js +167 -0
- package/dist/core/tools/apply-patch.js.map +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +15 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/git-common.d.ts.map +1 -1
- package/dist/core/tools/git-common.js +15 -1
- package/dist/core/tools/git-common.js.map +1 -1
- package/dist/core/tools/index.d.ts +20 -2
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +85 -25
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/permissions.d.ts +16 -0
- package/dist/core/tools/permissions.d.ts.map +1 -1
- package/dist/core/tools/permissions.js +34 -1
- package/dist/core/tools/permissions.js.map +1 -1
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +68 -24
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/tool-search.d.ts +24 -0
- package/dist/core/tools/tool-search.d.ts.map +1 -0
- package/dist/core/tools/tool-search.js +85 -0
- package/dist/core/tools/tool-search.js.map +1 -0
- package/dist/core/tools/tool-suggest.d.ts +18 -0
- package/dist/core/tools/tool-suggest.d.ts.map +1 -0
- package/dist/core/tools/tool-suggest.js +94 -0
- package/dist/core/tools/tool-suggest.js.map +1 -0
- package/dist/core/tools/verification-runner.d.ts.map +1 -1
- package/dist/core/tools/verification-runner.js +15 -1
- package/dist/core/tools/verification-runner.js.map +1 -1
- package/dist/core/unified-exec.d.ts +39 -0
- package/dist/core/unified-exec.d.ts.map +1 -0
- package/dist/core/unified-exec.js +286 -0
- package/dist/core/unified-exec.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +93 -11
- package/dist/main.js.map +1 -1
- package/dist/modes/acp/acp-mode.d.ts +17 -0
- package/dist/modes/acp/acp-mode.d.ts.map +1 -0
- package/dist/modes/acp/acp-mode.js +352 -0
- package/dist/modes/acp/acp-mode.js.map +1 -0
- package/dist/modes/index.d.ts +2 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js +1 -0
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +217 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +8 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +159 -72
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +25 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +33 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +13 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +189 -28
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +54 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +96 -9
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/acp-rpc-mapping.md +38 -0
- package/docs/configuration.generated.md +81 -0
- package/docs/configuration.md +7 -0
- package/package.json +4 -1
|
@@ -10,7 +10,7 @@ import type { SessionStats } from "../../core/agent-session.js";
|
|
|
10
10
|
import type { BashResult } from "../../core/bash-executor.js";
|
|
11
11
|
import type { CompactionResult } from "../../core/compaction/index.js";
|
|
12
12
|
import type { BuiltinCommandResult } from "../../core/command-dispatcher.js";
|
|
13
|
-
import type { ToolPermissionRequest } from "../../core/tools/index.js";
|
|
13
|
+
import type { PermissionGrantScope, ToolPermissionRequest } from "../../core/tools/index.js";
|
|
14
14
|
export type RpcCommand = {
|
|
15
15
|
id?: string;
|
|
16
16
|
type: "prompt";
|
|
@@ -62,6 +62,11 @@ export type RpcCommand = {
|
|
|
62
62
|
} | {
|
|
63
63
|
id?: string;
|
|
64
64
|
type: "get_permission_mode";
|
|
65
|
+
} | {
|
|
66
|
+
id?: string;
|
|
67
|
+
type: "request_permissions";
|
|
68
|
+
request: ToolPermissionRequest;
|
|
69
|
+
scope?: PermissionGrantScope;
|
|
65
70
|
} | {
|
|
66
71
|
id?: string;
|
|
67
72
|
type: "set_steering_mode";
|
|
@@ -92,6 +97,23 @@ export type RpcCommand = {
|
|
|
92
97
|
} | {
|
|
93
98
|
id?: string;
|
|
94
99
|
type: "abort_bash";
|
|
100
|
+
} | {
|
|
101
|
+
id?: string;
|
|
102
|
+
type: "exec_command";
|
|
103
|
+
command: string;
|
|
104
|
+
cwd?: string;
|
|
105
|
+
tty?: boolean;
|
|
106
|
+
shell?: string;
|
|
107
|
+
login?: boolean;
|
|
108
|
+
yieldTimeMs?: number;
|
|
109
|
+
maxOutputChars?: number;
|
|
110
|
+
} | {
|
|
111
|
+
id?: string;
|
|
112
|
+
type: "write_stdin";
|
|
113
|
+
sessionId: number;
|
|
114
|
+
chars?: string;
|
|
115
|
+
yieldTimeMs?: number;
|
|
116
|
+
maxOutputChars?: number;
|
|
95
117
|
} | {
|
|
96
118
|
id?: string;
|
|
97
119
|
type: "get_session_stats";
|
|
@@ -166,6 +188,12 @@ export interface RpcSessionState {
|
|
|
166
188
|
messageCount: number;
|
|
167
189
|
pendingMessageCount: number;
|
|
168
190
|
}
|
|
191
|
+
export interface RpcExecSessionPollResult {
|
|
192
|
+
output: string;
|
|
193
|
+
running: boolean;
|
|
194
|
+
sessionId?: number;
|
|
195
|
+
exitCode?: number | null;
|
|
196
|
+
}
|
|
169
197
|
export type RpcResponse = {
|
|
170
198
|
id?: string;
|
|
171
199
|
type: "response";
|
|
@@ -253,6 +281,16 @@ export type RpcResponse = {
|
|
|
253
281
|
data: {
|
|
254
282
|
mode: "ask" | "auto" | "yolo";
|
|
255
283
|
};
|
|
284
|
+
} | {
|
|
285
|
+
id?: string;
|
|
286
|
+
type: "response";
|
|
287
|
+
command: "request_permissions";
|
|
288
|
+
success: true;
|
|
289
|
+
data: {
|
|
290
|
+
allowed: boolean;
|
|
291
|
+
scope: PermissionGrantScope;
|
|
292
|
+
reason?: string;
|
|
293
|
+
};
|
|
256
294
|
} | {
|
|
257
295
|
id?: string;
|
|
258
296
|
type: "response";
|
|
@@ -295,6 +333,18 @@ export type RpcResponse = {
|
|
|
295
333
|
type: "response";
|
|
296
334
|
command: "abort_bash";
|
|
297
335
|
success: true;
|
|
336
|
+
} | {
|
|
337
|
+
id?: string;
|
|
338
|
+
type: "response";
|
|
339
|
+
command: "exec_command";
|
|
340
|
+
success: true;
|
|
341
|
+
data: RpcExecSessionPollResult;
|
|
342
|
+
} | {
|
|
343
|
+
id?: string;
|
|
344
|
+
type: "response";
|
|
345
|
+
command: "write_stdin";
|
|
346
|
+
success: true;
|
|
347
|
+
data: RpcExecSessionPollResult;
|
|
298
348
|
} | {
|
|
299
349
|
id?: string;
|
|
300
350
|
type: "response";
|
|
@@ -462,6 +512,7 @@ export type RpcExtensionUIResponse = {
|
|
|
462
512
|
type: "extension_ui_response";
|
|
463
513
|
id: string;
|
|
464
514
|
confirmed: boolean;
|
|
515
|
+
scope?: PermissionGrantScope;
|
|
465
516
|
} | {
|
|
466
517
|
type: "extension_ui_response";
|
|
467
518
|
id: string;
|
|
@@ -473,6 +524,8 @@ export interface RpcRequiresConfirmationEvent {
|
|
|
473
524
|
message: string;
|
|
474
525
|
request: ToolPermissionRequest;
|
|
475
526
|
timeout?: number;
|
|
527
|
+
scopes?: PermissionGrantScope[];
|
|
528
|
+
defaultScope?: PermissionGrantScope;
|
|
476
529
|
}
|
|
477
530
|
export type RpcCommandType = RpcCommand["type"];
|
|
478
531
|
//# sourceMappingURL=rpc-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMvE,MAAM,MAAM,UAAU,GAEnB;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;CAAE,GACnH;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,GACxE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,GAC5E;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAA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A;CAAE,GAC/F;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,CAAC;AAMlE,MAAM,WAAW,4BAA4B;IAC5C,IAAI,EAAE,uBAAuB,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAMD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@mariozechner/pi-agent-core\";\nimport type { ImageContent, Model } from \"@mariozechner/pi-ai\";\nimport type { SessionStats } from \"../../core/agent-session.js\";\nimport type { BashResult } from \"../../core/bash-executor.js\";\nimport type { CompactionResult } from \"../../core/compaction/index.js\";\nimport type { BuiltinCommandResult } from \"../../core/command-dispatcher.js\";\nimport type { ToolPermissionRequest } from \"../../core/tools/index.js\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"set_permission_mode\"; mode: \"ask\" | \"auto\" | \"yolo\" }\n\t| { id?: string; type: \"get_permission_mode\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\"; customInstructions?: string }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string }\n\t| { id?: string; type: \"abort_bash\" }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands (available for invocation via prompt)\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_builtin_commands\" }\n\t| { id?: string; type: \"run_builtin_command\"; commandText: string };\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Where the command was loaded from (undefined for extensions) */\n\tlocation?: \"user\" | \"project\" | \"path\";\n\t/** File path to the command source */\n\tpath?: string;\n}\n\n/** A built-in slash command exposed by iosm-cli core runtime */\nexport interface RpcBuiltinSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription: string;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tpermissionMode: \"ask\" | \"auto\" | \"yolo\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<any>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<any>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: Model<any>[] };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_permission_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { mode: \"ask\" | \"auto\" | \"yolo\" };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_permission_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { mode: \"ask\" | \"auto\" | \"yolo\" };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: CompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_builtin_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcBuiltinSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"run_builtin_command\";\n\t\t\tsuccess: true;\n\t\t\tdata: BuiltinCommandResult;\n\t }\n\n\t// Error response (any command can fail)\n\t| { id?: string; type: \"response\"; command: string; success: false; error: string };\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"confirm_permission\";\n\t\t\ttitle: string;\n\t\t\tmessage: string;\n\t\t\trequest: ToolPermissionRequest;\n\t\t\ttimeout?: number;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string };\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Permission Confirmation Event (stdout)\n// ============================================================================\n\nexport interface RpcRequiresConfirmationEvent {\n\ttype: \"requires_confirmation\";\n\tid: string;\n\tmessage: string;\n\trequest: ToolPermissionRequest;\n\ttimeout?: number;\n}\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
|
|
1
|
+
{"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type { AgentMessage, ThinkingLevel } from \"@mariozechner/pi-agent-core\";\nimport type { ImageContent, Model } from \"@mariozechner/pi-ai\";\nimport type { SessionStats } from \"../../core/agent-session.js\";\nimport type { BashResult } from \"../../core/bash-executor.js\";\nimport type { CompactionResult } from \"../../core/compaction/index.js\";\nimport type { BuiltinCommandResult } from \"../../core/command-dispatcher.js\";\nimport type { PermissionGrantScope, ToolPermissionRequest } from \"../../core/tools/index.js\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"set_permission_mode\"; mode: \"ask\" | \"auto\" | \"yolo\" }\n\t| { id?: string; type: \"get_permission_mode\" }\n\t| { id?: string; type: \"request_permissions\"; request: ToolPermissionRequest; scope?: PermissionGrantScope }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\"; customInstructions?: string }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string }\n\t| { id?: string; type: \"abort_bash\" }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"exec_command\";\n\t\t\tcommand: string;\n\t\t\tcwd?: string;\n\t\t\ttty?: boolean;\n\t\t\tshell?: string;\n\t\t\tlogin?: boolean;\n\t\t\tyieldTimeMs?: number;\n\t\t\tmaxOutputChars?: number;\n\t }\n\t| { id?: string; type: \"write_stdin\"; sessionId: number; chars?: string; yieldTimeMs?: number; maxOutputChars?: number }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands (available for invocation via prompt)\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_builtin_commands\" }\n\t| { id?: string; type: \"run_builtin_command\"; commandText: string };\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Where the command was loaded from (undefined for extensions) */\n\tlocation?: \"user\" | \"project\" | \"path\";\n\t/** File path to the command source */\n\tpath?: string;\n}\n\n/** A built-in slash command exposed by iosm-cli core runtime */\nexport interface RpcBuiltinSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription: string;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: Model<any>;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tpermissionMode: \"ask\" | \"auto\" | \"yolo\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n}\n\nexport interface RpcExecSessionPollResult {\n\toutput: string;\n\trunning: boolean;\n\tsessionId?: number;\n\texitCode?: number | null;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<any>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<any>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: Model<any>[] };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_permission_mode\";\n\t\t\tsuccess: true;\n\t\t\tdata: { mode: \"ask\" | \"auto\" | \"yolo\" };\n\t }\n\t| {\n\t\t\t\tid?: string;\n\t\t\t\ttype: \"response\";\n\t\t\t\tcommand: \"get_permission_mode\";\n\t\t\t\tsuccess: true;\n\t\t\t\tdata: { mode: \"ask\" | \"auto\" | \"yolo\" };\n\t\t }\n\t| {\n\t\t\t\tid?: string;\n\t\t\t\ttype: \"response\";\n\t\t\t\tcommand: \"request_permissions\";\n\t\t\t\tsuccess: true;\n\t\t\t\tdata: { allowed: boolean; scope: PermissionGrantScope; reason?: string };\n\t\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: CompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"exec_command\"; success: true; data: RpcExecSessionPollResult }\n\t| { id?: string; type: \"response\"; command: \"write_stdin\"; success: true; data: RpcExecSessionPollResult }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_builtin_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcBuiltinSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"run_builtin_command\";\n\t\t\tsuccess: true;\n\t\t\tdata: BuiltinCommandResult;\n\t }\n\n\t// Error response (any command can fail)\n\t| { id?: string; type: \"response\"; command: string; success: false; error: string };\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"confirm_permission\";\n\t\t\ttitle: string;\n\t\t\tmessage: string;\n\t\t\trequest: ToolPermissionRequest;\n\t\t\ttimeout?: number;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string };\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean; scope?: PermissionGrantScope }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Permission Confirmation Event (stdout)\n// ============================================================================\n\nexport interface RpcRequiresConfirmationEvent {\n\ttype: \"requires_confirmation\";\n\tid: string;\n\tmessage: string;\n\trequest: ToolPermissionRequest;\n\ttimeout?: number;\n\tscopes?: PermissionGrantScope[];\n\tdefaultScope?: PermissionGrantScope;\n}\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-manager.d.ts","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools-manager.d.ts","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AA6HA,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAgB5D;AA2MD,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2CxG"}
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { createHash } from "crypto";
|
|
2
3
|
import { spawnSync } from "child_process";
|
|
3
4
|
import extractZip from "extract-zip";
|
|
4
|
-
import { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from "fs";
|
|
5
|
+
import { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from "fs";
|
|
5
6
|
import { arch, platform } from "os";
|
|
6
7
|
import { join } from "path";
|
|
8
|
+
import { createInterface } from "readline";
|
|
7
9
|
import { Readable } from "stream";
|
|
8
10
|
import { finished } from "stream/promises";
|
|
9
|
-
import { APP_NAME, ENV_OFFLINE, getBinDir } from "../config.js";
|
|
11
|
+
import { APP_NAME, ENV_OFFLINE, getAgentDir, getBinDir } from "../config.js";
|
|
12
|
+
import { SourceSecurityManager } from "../core/security/index.js";
|
|
10
13
|
const TOOLS_DIR = getBinDir();
|
|
11
14
|
const NETWORK_TIMEOUT_MS = 10000;
|
|
15
|
+
async function requestTrustConsentFromTerminal(question) {
|
|
16
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
17
|
+
return false;
|
|
18
|
+
const rl = createInterface({
|
|
19
|
+
input: process.stdin,
|
|
20
|
+
output: process.stdout,
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
const answer = await new Promise((resolve) => {
|
|
24
|
+
rl.question(`${question} [y/N] `, resolve);
|
|
25
|
+
});
|
|
26
|
+
const normalized = answer.trim().toLowerCase();
|
|
27
|
+
return normalized === "y" || normalized === "yes";
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
rl.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const TOOL_SECURITY = new SourceSecurityManager({
|
|
34
|
+
agentDir: getAgentDir(),
|
|
35
|
+
consentProvider: async (request) => {
|
|
36
|
+
const reasonLabel = request.reason === "fingerprint-change"
|
|
37
|
+
? `fingerprint changed (${request.previousFingerprint ?? "unknown"} -> ${request.fingerprint})`
|
|
38
|
+
: `new source fingerprint ${request.fingerprint}`;
|
|
39
|
+
return requestTrustConsentFromTerminal(`Trust tool download "${request.source}" (${reasonLabel})?`);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
12
42
|
function isOfflineModeEnabled() {
|
|
13
43
|
const value = process.env[ENV_OFFLINE] || process.env.PI_OFFLINE;
|
|
14
44
|
if (!value)
|
|
@@ -88,8 +118,8 @@ export function getToolPath(tool) {
|
|
|
88
118
|
}
|
|
89
119
|
return null;
|
|
90
120
|
}
|
|
91
|
-
// Fetch latest release
|
|
92
|
-
async function
|
|
121
|
+
// Fetch latest release info from GitHub
|
|
122
|
+
async function getLatestRelease(repo) {
|
|
93
123
|
const response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {
|
|
94
124
|
headers: { "User-Agent": `${APP_NAME}-coding-agent` },
|
|
95
125
|
signal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),
|
|
@@ -98,7 +128,10 @@ async function getLatestVersion(repo) {
|
|
|
98
128
|
throw new Error(`GitHub API error: ${response.status}`);
|
|
99
129
|
}
|
|
100
130
|
const data = (await response.json());
|
|
101
|
-
return
|
|
131
|
+
return {
|
|
132
|
+
version: data.tag_name.replace(/^v/, ""),
|
|
133
|
+
assets: Array.isArray(data.assets) ? data.assets : [],
|
|
134
|
+
};
|
|
102
135
|
}
|
|
103
136
|
// Download a file from URL
|
|
104
137
|
async function downloadFile(url, dest) {
|
|
@@ -114,6 +147,40 @@ async function downloadFile(url, dest) {
|
|
|
114
147
|
const fileStream = createWriteStream(dest);
|
|
115
148
|
await finished(Readable.fromWeb(response.body).pipe(fileStream));
|
|
116
149
|
}
|
|
150
|
+
function sha256File(path) {
|
|
151
|
+
const content = readFileSync(path);
|
|
152
|
+
return createHash("sha256").update(content).digest("hex");
|
|
153
|
+
}
|
|
154
|
+
async function resolveAssetChecksum(releaseAssets, assetName) {
|
|
155
|
+
const exactChecksumAsset = releaseAssets.find((asset) => asset.name === `${assetName}.sha256`);
|
|
156
|
+
if (exactChecksumAsset) {
|
|
157
|
+
const response = await fetch(exactChecksumAsset.browser_download_url, {
|
|
158
|
+
signal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),
|
|
159
|
+
});
|
|
160
|
+
if (!response.ok)
|
|
161
|
+
return undefined;
|
|
162
|
+
const raw = (await response.text()).trim();
|
|
163
|
+
const firstToken = raw.split(/\s+/)[0];
|
|
164
|
+
return firstToken.length >= 64 ? firstToken.toLowerCase() : undefined;
|
|
165
|
+
}
|
|
166
|
+
const checksumManifest = releaseAssets.find((asset) => /(sha256|checksums?)/i.test(asset.name));
|
|
167
|
+
if (!checksumManifest)
|
|
168
|
+
return undefined;
|
|
169
|
+
const response = await fetch(checksumManifest.browser_download_url, {
|
|
170
|
+
signal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),
|
|
171
|
+
});
|
|
172
|
+
if (!response.ok)
|
|
173
|
+
return undefined;
|
|
174
|
+
const raw = await response.text();
|
|
175
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
176
|
+
if (!line.includes(assetName))
|
|
177
|
+
continue;
|
|
178
|
+
const hashMatch = line.match(/[a-fA-F0-9]{64}/);
|
|
179
|
+
if (hashMatch)
|
|
180
|
+
return hashMatch[0].toLowerCase();
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
117
184
|
function findBinaryRecursively(rootDir, binaryFileName) {
|
|
118
185
|
const stack = [rootDir];
|
|
119
186
|
while (stack.length > 0) {
|
|
@@ -134,14 +201,15 @@ function findBinaryRecursively(rootDir, binaryFileName) {
|
|
|
134
201
|
return null;
|
|
135
202
|
}
|
|
136
203
|
// Download and install a tool
|
|
137
|
-
async function downloadTool(tool) {
|
|
204
|
+
async function downloadTool(tool, options = {}) {
|
|
138
205
|
const config = TOOLS[tool];
|
|
139
206
|
if (!config)
|
|
140
207
|
throw new Error(`Unknown tool: ${tool}`);
|
|
141
208
|
const plat = platform();
|
|
142
209
|
const architecture = arch();
|
|
143
|
-
// Get latest
|
|
144
|
-
const
|
|
210
|
+
// Get latest release
|
|
211
|
+
const release = await getLatestRelease(config.repo);
|
|
212
|
+
const version = release.version;
|
|
145
213
|
// Get asset name for this platform
|
|
146
214
|
const assetName = config.getAssetName(version, plat, architecture);
|
|
147
215
|
if (!assetName) {
|
|
@@ -153,8 +221,27 @@ async function downloadTool(tool) {
|
|
|
153
221
|
const archivePath = join(TOOLS_DIR, assetName);
|
|
154
222
|
const binaryExt = plat === "win32" ? ".exe" : "";
|
|
155
223
|
const binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);
|
|
224
|
+
const expectedChecksum = await resolveAssetChecksum(release.assets, assetName);
|
|
225
|
+
if (!expectedChecksum) {
|
|
226
|
+
throw new Error(`Missing checksum asset for ${assetName} in ${config.repo} release ${version}`);
|
|
227
|
+
}
|
|
228
|
+
await TOOL_SECURITY.verify({
|
|
229
|
+
action: "download",
|
|
230
|
+
sourceType: "tool-download",
|
|
231
|
+
source: downloadUrl,
|
|
232
|
+
identity: `${config.repo}/${assetName}`,
|
|
233
|
+
host: "github.com",
|
|
234
|
+
fingerprint: expectedChecksum,
|
|
235
|
+
allowOverride: false,
|
|
236
|
+
allowPrompt: options.silent !== true,
|
|
237
|
+
});
|
|
156
238
|
// Download
|
|
157
239
|
await downloadFile(downloadUrl, archivePath);
|
|
240
|
+
const actualChecksum = sha256File(archivePath);
|
|
241
|
+
if (actualChecksum.toLowerCase() !== expectedChecksum.toLowerCase()) {
|
|
242
|
+
rmSync(archivePath, { force: true });
|
|
243
|
+
throw new Error(`Checksum mismatch for ${assetName}`);
|
|
244
|
+
}
|
|
158
245
|
// Extract into a unique temp directory. fd and rg downloads can run concurrently
|
|
159
246
|
// during startup, so sharing a fixed directory causes races.
|
|
160
247
|
const extractDir = join(TOOLS_DIR, `extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`);
|
|
@@ -235,7 +322,7 @@ export async function ensureTool(tool, silent = false) {
|
|
|
235
322
|
console.log(chalk.dim(`${config.name} not found. Downloading...`));
|
|
236
323
|
}
|
|
237
324
|
try {
|
|
238
|
-
const path = await downloadTool(tool);
|
|
325
|
+
const path = await downloadTool(tool, { silent });
|
|
239
326
|
if (!silent) {
|
|
240
327
|
console.log(chalk.dim(`${config.name} installed to ${path}`));
|
|
241
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,Q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C;QACZ,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport { spawnSync } from \"child_process\";\nimport extractZip from \"extract-zip\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { Readable } from \"stream\";\nimport { finished } from \"stream/promises\";\nimport { APP_NAME, ENV_OFFLINE, getBinDir } from \"../config.js\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10000;\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env[ENV_OFFLINE] || process.env.PI_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\ninterface ToolConfig {\n\tname: string;\n\trepo: string; // GitHub repo (e.g., \"sharkdp/fd\")\n\tbinaryName: string; // Name of the binary inside the archive\n\ttagPrefix: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\tgetAssetName: (version: string, plat: string, architecture: string) => string | null;\n}\n\nconst TOOLS: Record<string, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tif (architecture === \"arm64\") {\n\t\t\t\t\treturn `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;\n\t\t\t\t}\n\t\t\t\treturn `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: \"fd\" | \"rg\"): string | null {\n\tconst config = TOOLS[tool];\n\tif (!config) return null;\n\n\t// Check our tools directory first\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\t// Check system PATH - if found, just return the command name (it's in PATH)\n\tif (commandExists(config.binaryName)) {\n\t\treturn config.binaryName;\n\t}\n\n\treturn null;\n}\n\n// Fetch latest release version from GitHub\nasync function getLatestVersion(repo: string): Promise<string> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as { tag_name: string };\n\treturn data.tag_name.replace(/^v/, \"\");\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait finished(Readable.fromWeb(response.body as any).pipe(fileStream));\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// Download and install a tool\nasync function downloadTool(tool: \"fd\" | \"rg\"): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (!config) throw new Error(`Unknown tool: ${tool}`);\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest version\n\tconst version = await getLatestVersion(config.repo);\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\tconst extractResult = spawnSync(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir], { stdio: \"pipe\" });\n\t\t\tif (extractResult.error || extractResult.status !== 0) {\n\t\t\t\tconst errMsg = extractResult.error?.message ?? extractResult.stderr?.toString().trim() ?? \"unknown error\";\n\t\t\t\tthrow new Error(`Failed to extract ${assetName}: ${errMsg}`);\n\t\t\t}\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\tawait extractZip(archivePath, { dir: extractDir });\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Record<string, string> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or null if unavailable\nexport async function ensureTool(tool: \"fd\" | \"rg\", silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\tif (!config) return undefined;\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool] ?? tool;\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool);\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tools-manager.js","sourceRoot":"","sources":["../../src/utils/tools-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACxH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,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AC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["import chalk from \"chalk\";\nimport { createHash } from \"crypto\";\nimport { spawnSync } from \"child_process\";\nimport extractZip from \"extract-zip\";\nimport { chmodSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from \"fs\";\nimport { arch, platform } from \"os\";\nimport { join } from \"path\";\nimport { createInterface } from \"readline\";\nimport { Readable } from \"stream\";\nimport { finished } from \"stream/promises\";\nimport { APP_NAME, ENV_OFFLINE, getAgentDir, getBinDir } from \"../config.js\";\nimport { SourceSecurityManager } from \"../core/security/index.js\";\n\nconst TOOLS_DIR = getBinDir();\nconst NETWORK_TIMEOUT_MS = 10000;\n\nasync function requestTrustConsentFromTerminal(question: string): Promise<boolean> {\n\tif (!process.stdin.isTTY || !process.stdout.isTTY) return false;\n\tconst rl = createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stdout,\n\t});\n\ttry {\n\t\tconst answer = await new Promise<string>((resolve) => {\n\t\t\trl.question(`${question} [y/N] `, resolve);\n\t\t});\n\t\tconst normalized = answer.trim().toLowerCase();\n\t\treturn normalized === \"y\" || normalized === \"yes\";\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nconst TOOL_SECURITY = new SourceSecurityManager({\n\tagentDir: getAgentDir(),\n\tconsentProvider: async (request) => {\n\t\tconst reasonLabel =\n\t\t\trequest.reason === \"fingerprint-change\"\n\t\t\t\t? `fingerprint changed (${request.previousFingerprint ?? \"unknown\"} -> ${request.fingerprint})`\n\t\t\t\t: `new source fingerprint ${request.fingerprint}`;\n\t\treturn requestTrustConsentFromTerminal(\n\t\t\t`Trust tool download \"${request.source}\" (${reasonLabel})?`,\n\t\t);\n\t},\n});\n\ninterface GithubReleaseAsset {\n\tname: string;\n\tbrowser_download_url: string;\n}\n\ninterface GithubReleaseResponse {\n\ttag_name: string;\n\tassets?: GithubReleaseAsset[];\n}\n\nfunction isOfflineModeEnabled(): boolean {\n\tconst value = process.env[ENV_OFFLINE] || process.env.PI_OFFLINE;\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\ninterface ToolConfig {\n\tname: string;\n\trepo: string; // GitHub repo (e.g., \"sharkdp/fd\")\n\tbinaryName: string; // Name of the binary inside the archive\n\ttagPrefix: string; // Prefix for tags (e.g., \"v\" for v1.0.0, \"\" for 1.0.0)\n\tgetAssetName: (version: string, plat: string, architecture: string) => string | null;\n}\n\nconst TOOLS: Record<string, ToolConfig> = {\n\tfd: {\n\t\tname: \"fd\",\n\t\trepo: \"sharkdp/fd\",\n\t\tbinaryName: \"fd\",\n\t\ttagPrefix: \"v\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-unknown-linux-gnu.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `fd-v${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n\trg: {\n\t\tname: \"ripgrep\",\n\t\trepo: \"BurntSushi/ripgrep\",\n\t\tbinaryName: \"rg\",\n\t\ttagPrefix: \"\",\n\t\tgetAssetName: (version, plat, architecture) => {\n\t\t\tif (plat === \"darwin\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;\n\t\t\t} else if (plat === \"linux\") {\n\t\t\t\tif (architecture === \"arm64\") {\n\t\t\t\t\treturn `ripgrep-${version}-aarch64-unknown-linux-gnu.tar.gz`;\n\t\t\t\t}\n\t\t\t\treturn `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;\n\t\t\t} else if (plat === \"win32\") {\n\t\t\t\tconst archStr = architecture === \"arm64\" ? \"aarch64\" : \"x86_64\";\n\t\t\t\treturn `ripgrep-${version}-${archStr}-pc-windows-msvc.zip`;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t},\n};\n\n// Check if a command exists in PATH by trying to run it\nfunction commandExists(cmd: string): boolean {\n\ttry {\n\t\tconst result = spawnSync(cmd, [\"--version\"], { stdio: \"pipe\" });\n\t\t// Check for ENOENT error (command not found)\n\t\treturn result.error === undefined || result.error === null;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n// Get the path to a tool (system-wide or in our tools dir)\nexport function getToolPath(tool: \"fd\" | \"rg\"): string | null {\n\tconst config = TOOLS[tool];\n\tif (!config) return null;\n\n\t// Check our tools directory first\n\tconst localPath = join(TOOLS_DIR, config.binaryName + (platform() === \"win32\" ? \".exe\" : \"\"));\n\tif (existsSync(localPath)) {\n\t\treturn localPath;\n\t}\n\n\t// Check system PATH - if found, just return the command name (it's in PATH)\n\tif (commandExists(config.binaryName)) {\n\t\treturn config.binaryName;\n\t}\n\n\treturn null;\n}\n\n// Fetch latest release info from GitHub\nasync function getLatestRelease(repo: string): Promise<{ version: string; assets: GithubReleaseAsset[] }> {\n\tconst response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {\n\t\theaders: { \"User-Agent\": `${APP_NAME}-coding-agent` },\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`GitHub API error: ${response.status}`);\n\t}\n\n\tconst data = (await response.json()) as GithubReleaseResponse;\n\treturn {\n\t\tversion: data.tag_name.replace(/^v/, \"\"),\n\t\tassets: Array.isArray(data.assets) ? data.assets : [],\n\t};\n}\n\n// Download a file from URL\nasync function downloadFile(url: string, dest: string): Promise<void> {\n\tconst response = await fetch(url, {\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to download: ${response.status}`);\n\t}\n\n\tif (!response.body) {\n\t\tthrow new Error(\"No response body\");\n\t}\n\n\tconst fileStream = createWriteStream(dest);\n\tawait finished(Readable.fromWeb(response.body as any).pipe(fileStream));\n}\n\nfunction sha256File(path: string): string {\n\tconst content = readFileSync(path);\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nasync function resolveAssetChecksum(\n\treleaseAssets: GithubReleaseAsset[],\n\tassetName: string,\n): Promise<string | undefined> {\n\tconst exactChecksumAsset = releaseAssets.find((asset) => asset.name === `${assetName}.sha256`);\n\tif (exactChecksumAsset) {\n\t\tconst response = await fetch(exactChecksumAsset.browser_download_url, {\n\t\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t\t});\n\t\tif (!response.ok) return undefined;\n\t\tconst raw = (await response.text()).trim();\n\t\tconst firstToken = raw.split(/\\s+/)[0];\n\t\treturn firstToken.length >= 64 ? firstToken.toLowerCase() : undefined;\n\t}\n\n\tconst checksumManifest = releaseAssets.find((asset) => /(sha256|checksums?)/i.test(asset.name));\n\tif (!checksumManifest) return undefined;\n\tconst response = await fetch(checksumManifest.browser_download_url, {\n\t\tsignal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),\n\t});\n\tif (!response.ok) return undefined;\n\tconst raw = await response.text();\n\tfor (const line of raw.split(/\\r?\\n/)) {\n\t\tif (!line.includes(assetName)) continue;\n\t\tconst hashMatch = line.match(/[a-fA-F0-9]{64}/);\n\t\tif (hashMatch) return hashMatch[0].toLowerCase();\n\t}\n\treturn undefined;\n}\n\nfunction findBinaryRecursively(rootDir: string, binaryFileName: string): string | null {\n\tconst stack: string[] = [rootDir];\n\n\twhile (stack.length > 0) {\n\t\tconst currentDir = stack.pop();\n\t\tif (!currentDir) continue;\n\n\t\tconst entries = readdirSync(currentDir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(currentDir, entry.name);\n\t\t\tif (entry.isFile() && entry.name === binaryFileName) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tstack.push(fullPath);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// Download and install a tool\nasync function downloadTool(tool: \"fd\" | \"rg\", options: { silent?: boolean } = {}): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (!config) throw new Error(`Unknown tool: ${tool}`);\n\n\tconst plat = platform();\n\tconst architecture = arch();\n\n\t// Get latest release\n\tconst release = await getLatestRelease(config.repo);\n\tconst version = release.version;\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tmkdirSync(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst archivePath = join(TOOLS_DIR, assetName);\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = join(TOOLS_DIR, config.binaryName + binaryExt);\n\tconst expectedChecksum = await resolveAssetChecksum(release.assets, assetName);\n\tif (!expectedChecksum) {\n\t\tthrow new Error(`Missing checksum asset for ${assetName} in ${config.repo} release ${version}`);\n\t}\n\n\tawait TOOL_SECURITY.verify({\n\t\taction: \"download\",\n\t\tsourceType: \"tool-download\",\n\t\tsource: downloadUrl,\n\t\tidentity: `${config.repo}/${assetName}`,\n\t\thost: \"github.com\",\n\t\tfingerprint: expectedChecksum,\n\t\tallowOverride: false,\n\t\tallowPrompt: options.silent !== true,\n\t});\n\n\t// Download\n\tawait downloadFile(downloadUrl, archivePath);\n\tconst actualChecksum = sha256File(archivePath);\n\tif (actualChecksum.toLowerCase() !== expectedChecksum.toLowerCase()) {\n\t\trmSync(archivePath, { force: true });\n\t\tthrow new Error(`Checksum mismatch for ${assetName}`);\n\t}\n\n\t// Extract into a unique temp directory. fd and rg downloads can run concurrently\n\t// during startup, so sharing a fixed directory causes races.\n\tconst extractDir = join(\n\t\tTOOLS_DIR,\n\t\t`extract_tmp_${config.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,\n\t);\n\tmkdirSync(extractDir, { recursive: true });\n\n\ttry {\n\t\tif (assetName.endsWith(\".tar.gz\")) {\n\t\t\tconst extractResult = spawnSync(\"tar\", [\"xzf\", archivePath, \"-C\", extractDir], { stdio: \"pipe\" });\n\t\t\tif (extractResult.error || extractResult.status !== 0) {\n\t\t\t\tconst errMsg = extractResult.error?.message ?? extractResult.stderr?.toString().trim() ?? \"unknown error\";\n\t\t\t\tthrow new Error(`Failed to extract ${assetName}: ${errMsg}`);\n\t\t\t}\n\t\t} else if (assetName.endsWith(\".zip\")) {\n\t\t\tawait extractZip(archivePath, { dir: extractDir });\n\t\t} else {\n\t\t\tthrow new Error(`Unsupported archive format: ${assetName}`);\n\t\t}\n\n\t\t// Find the binary in extracted files. Some archives contain files directly\n\t\t// at root, others nest under a versioned subdirectory.\n\t\tconst binaryFileName = config.binaryName + binaryExt;\n\t\tconst extractedDir = join(extractDir, assetName.replace(/\\.(tar\\.gz|zip)$/, \"\"));\n\t\tconst extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];\n\t\tlet extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));\n\n\t\tif (!extractedBinary) {\n\t\t\textractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;\n\t\t}\n\n\t\tif (extractedBinary) {\n\t\t\trenameSync(extractedBinary, binaryPath);\n\t\t} else {\n\t\t\tthrow new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);\n\t\t}\n\n\t\t// Make executable (Unix only)\n\t\tif (plat !== \"win32\") {\n\t\t\tchmodSync(binaryPath, 0o755);\n\t\t}\n\t} finally {\n\t\t// Cleanup\n\t\trmSync(archivePath, { force: true });\n\t\trmSync(extractDir, { recursive: true, force: true });\n\t}\n\n\treturn binaryPath;\n}\n\n// Termux package names for tools\nconst TERMUX_PACKAGES: Record<string, string> = {\n\tfd: \"fd\",\n\trg: \"ripgrep\",\n};\n\n// Ensure a tool is available, downloading if necessary\n// Returns the path to the tool, or null if unavailable\nexport async function ensureTool(tool: \"fd\" | \"rg\", silent: boolean = false): Promise<string | undefined> {\n\tconst existingPath = getToolPath(tool);\n\tif (existingPath) {\n\t\treturn existingPath;\n\t}\n\n\tconst config = TOOLS[tool];\n\tif (!config) return undefined;\n\n\tif (isOfflineModeEnabled()) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Offline mode enabled, skipping download.`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// On Android/Termux, Linux binaries don't work due to Bionic libc incompatibility.\n\t// Users must install via pkg.\n\tif (platform() === \"android\") {\n\t\tconst pkgName = TERMUX_PACKAGES[tool] ?? tool;\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`${config.name} not found. Install with: pkg install ${pkgName}`));\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// Tool not found - download it\n\tif (!silent) {\n\t\tconsole.log(chalk.dim(`${config.name} not found. Downloading...`));\n\t}\n\n\ttry {\n\t\tconst path = await downloadTool(tool, { silent });\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.dim(`${config.name} installed to ${path}`));\n\t\t}\n\t\treturn path;\n\t} catch (e) {\n\t\tif (!silent) {\n\t\t\tconsole.log(chalk.yellow(`Failed to download ${config.name}: ${e instanceof Error ? e.message : e}`));\n\t\t}\n\t\treturn undefined;\n\t}\n}\n"]}
|
package/docs/README.md
CHANGED
|
@@ -13,8 +13,10 @@ Comprehensive documentation for `iosm-cli` — an AI-powered engineering agent w
|
|
|
13
13
|
| [Orchestration & Subagents](./orchestration-and-subagents.md) | Task delegation, parallel execution, custom agents |
|
|
14
14
|
| [Extensions & Packages](./extensions-packages-themes.md) | Extension API, skills, themes, package management |
|
|
15
15
|
| [Configuration](./configuration.md) | Settings hierarchy, environment variables, profiles |
|
|
16
|
+
| [Configuration (Generated)](./configuration.generated.md) | Schema-derived settings reference generated from `settings.schema.json` |
|
|
16
17
|
| [Sessions & Export](./sessions-traces-export.md) | Persistence, branching, traces, HTML export, sharing |
|
|
17
18
|
| [JSON/RPC/SDK](./rpc-json-sdk.md) | Programmatic integrations, event streaming, SDK |
|
|
19
|
+
| [ACP RPC Mapping](./acp-rpc-mapping.md) | ACP adapter protocol surface and RPC compatibility mapping |
|
|
18
20
|
| [Development & Testing](./development-and-testing.md) | Contributing, testing, architecture |
|
|
19
21
|
|
|
20
22
|
## Related Resources
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ACP Adapter Mapping (MVP)
|
|
2
|
+
|
|
3
|
+
This document defines the compatibility contract for `--mode acp`.
|
|
4
|
+
|
|
5
|
+
## Capability Negotiation
|
|
6
|
+
|
|
7
|
+
- Request: `acp.handshake`
|
|
8
|
+
- Response: protocol version + capabilities (`streaming`, `permissionBridge`, `toolEvents`, `sessionLifecycle`, `backCompatRpc`, `execSessions`).
|
|
9
|
+
- Unsupported methods return JSON-RPC `-32601` with `reason=capability_not_supported`.
|
|
10
|
+
|
|
11
|
+
## Method Mapping
|
|
12
|
+
|
|
13
|
+
| ACP Method | Internal Runtime Action |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `acp.session.start` | `AgentSession` lifecycle bootstrap (returns current `sessionId/sessionFile`) |
|
|
16
|
+
| `acp.session.prompt` | `session.prompt(...)` |
|
|
17
|
+
| `acp.session.steer` | `session.steer(...)` |
|
|
18
|
+
| `acp.session.follow_up` | `session.followUp(...)` |
|
|
19
|
+
| `acp.session.abort` | `session.abort()` |
|
|
20
|
+
| `acp.session.state` | Session state snapshot (`model`, `thinkingLevel`, `isStreaming`, permission mode) |
|
|
21
|
+
| `acp.command.run_builtin` | `dispatchBuiltinSlashCommand(...)` |
|
|
22
|
+
| `acp.exec.command` | Starts resumable shell execution (returns output chunk + optional `sessionId`; supports `tty/shell/login` options) |
|
|
23
|
+
| `acp.exec.write_stdin` | Writes to a running exec session and polls next output chunk |
|
|
24
|
+
| `acp.permission.response` | Permission bridge response for pending tool confirmation (supports `scope=once|turn|session`) |
|
|
25
|
+
|
|
26
|
+
## Event Mapping
|
|
27
|
+
|
|
28
|
+
| Internal Event | ACP Notification |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `AgentSessionEvent` stream | `acp.event` |
|
|
31
|
+
| tool permission confirmation request | `acp.permission.request` (includes available scopes + default scope) |
|
|
32
|
+
| async prompt failure (after `acp.session.prompt` accepted) | `acp.event` with `type=error` and `source=acp.session.prompt` |
|
|
33
|
+
|
|
34
|
+
## Compatibility Guarantees
|
|
35
|
+
|
|
36
|
+
- `--mode rpc` remains unchanged and fully supported.
|
|
37
|
+
- ACP adapter is additive and does not alter existing RPC protocol semantics.
|
|
38
|
+
- Unsupported ACP features fail with capability-level rejections instead of runtime crashes.
|