@di-code/coding-agent 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -567
- package/compositions/base.yml +54 -0
- package/compositions/interactive.yml +14 -0
- package/compositions/json.yml +6 -0
- package/compositions/print.yml +5 -0
- package/compositions/rpc.yml +12 -0
- package/compositions/webui.yml +9 -0
- package/dist/cli.d.ts +22 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +97 -3
- package/dist/cli.js.map +1 -1
- package/dist/composition-loader-entry.d.ts +11 -0
- package/dist/composition-loader-entry.d.ts.map +1 -0
- package/dist/composition-loader-entry.js +12 -0
- package/dist/composition-loader-entry.js.map +1 -0
- package/dist/compositions.d.ts +32 -0
- package/dist/compositions.d.ts.map +1 -0
- package/dist/compositions.js +173 -0
- package/dist/compositions.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +9 -2
- package/dist/core/session/session-manager.d.ts.map +1 -1
- package/dist/core/session/session-manager.js +28 -0
- package/dist/core/session/session-manager.js.map +1 -1
- package/dist/core/session/session-storage.d.ts.map +1 -1
- package/dist/core/session/session-storage.js +20 -3
- package/dist/core/session/session-storage.js.map +1 -1
- package/dist/core/session/types.d.ts +11 -2
- package/dist/core/session/types.d.ts.map +1 -1
- package/dist/core/session/types.js.map +1 -1
- package/dist/core/session-tools.d.ts +5 -0
- package/dist/core/session-tools.d.ts.map +1 -0
- package/dist/core/session-tools.js +17 -0
- package/dist/core/session-tools.js.map +1 -0
- package/dist/core/session.d.ts +19 -7
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +71 -39
- package/dist/core/session.js.map +1 -1
- package/dist/core/tools/bash.d.ts +1 -38
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -207
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +1 -24
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +1 -135
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -26
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +1 -140
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +1 -23
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/file-search.d.ts +1 -13
- package/dist/core/tools/file-search.d.ts.map +1 -1
- package/dist/core/tools/file-search.js +1 -98
- package/dist/core/tools/file-search.js.map +1 -1
- package/dist/core/tools/glob.d.ts +1 -10
- package/dist/core/tools/glob.d.ts.map +1 -1
- package/dist/core/tools/glob.js +1 -43
- package/dist/core/tools/glob.js.map +1 -1
- package/dist/core/tools/grep.d.ts +1 -12
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -66
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/load-skill.d.ts +1 -9
- package/dist/core/tools/load-skill.d.ts.map +1 -1
- package/dist/core/tools/load-skill.js +1 -21
- package/dist/core/tools/load-skill.js.map +1 -1
- package/dist/core/tools/path-boundary.d.ts +1 -4
- package/dist/core/tools/path-boundary.d.ts.map +1 -1
- package/dist/core/tools/path-boundary.js +1 -65
- package/dist/core/tools/path-boundary.js.map +1 -1
- package/dist/core/tools/read.d.ts +1 -16
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -131
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +1 -16
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -44
- package/dist/core/tools/write.js.map +1 -1
- package/dist/entry.js +30 -28
- package/dist/entry.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/interactive/builtin.d.ts +17 -0
- package/dist/interactive/builtin.d.ts.map +1 -0
- package/dist/interactive/builtin.js +47 -0
- package/dist/interactive/builtin.js.map +1 -0
- package/dist/interactive/controller.d.ts +85 -0
- package/dist/interactive/controller.d.ts.map +1 -0
- package/dist/interactive/controller.js +211 -0
- package/dist/interactive/controller.js.map +1 -0
- package/dist/interactive/index.d.ts +3 -0
- package/dist/interactive/index.d.ts.map +1 -0
- package/dist/interactive/index.js +3 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive-host-entry.d.ts +7 -0
- package/dist/interactive-host-entry.d.ts.map +1 -0
- package/dist/interactive-host-entry.js +123 -0
- package/dist/interactive-host-entry.js.map +1 -0
- package/dist/interactive-profile.d.ts +18 -0
- package/dist/interactive-profile.d.ts.map +1 -0
- package/dist/interactive-profile.js +290 -0
- package/dist/interactive-profile.js.map +1 -0
- package/dist/interactive-resources-entry.d.ts +7 -0
- package/dist/interactive-resources-entry.d.ts.map +1 -0
- package/dist/interactive-resources-entry.js +42 -0
- package/dist/interactive-resources-entry.js.map +1 -0
- package/dist/legacy-main.d.ts +39 -0
- package/dist/legacy-main.d.ts.map +1 -0
- package/dist/legacy-main.js +611 -0
- package/dist/legacy-main.js.map +1 -0
- package/dist/main.d.ts +15 -34
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +130 -518
- package/dist/main.js.map +1 -1
- package/dist/mcp/entries.d.ts +42 -0
- package/dist/mcp/entries.d.ts.map +1 -0
- package/dist/mcp/entries.js +98 -0
- package/dist/mcp/entries.js.map +1 -0
- package/dist/mcp-client-entry.d.ts +5 -0
- package/dist/mcp-client-entry.d.ts.map +1 -0
- package/dist/mcp-client-entry.js +6 -0
- package/dist/mcp-client-entry.js.map +1 -0
- package/dist/mcp-config-entry.d.ts +5 -0
- package/dist/mcp-config-entry.d.ts.map +1 -0
- package/dist/mcp-config-entry.js +6 -0
- package/dist/mcp-config-entry.js.map +1 -0
- package/dist/mcp-tools-entry.d.ts +5 -0
- package/dist/mcp-tools-entry.d.ts.map +1 -0
- package/dist/mcp-tools-entry.js +6 -0
- package/dist/mcp-tools-entry.js.map +1 -0
- package/dist/mcp-transport-entry.d.ts +5 -0
- package/dist/mcp-transport-entry.d.ts.map +1 -0
- package/dist/mcp-transport-entry.js +6 -0
- package/dist/mcp-transport-entry.js.map +1 -0
- package/dist/modes/interactive-entry.d.ts +18 -0
- package/dist/modes/interactive-entry.d.ts.map +1 -0
- package/dist/modes/interactive-entry.js +21 -0
- package/dist/modes/interactive-entry.js.map +1 -0
- package/dist/modes/interactive.d.ts +16 -6
- package/dist/modes/interactive.d.ts.map +1 -1
- package/dist/modes/interactive.js +81 -32
- package/dist/modes/interactive.js.map +1 -1
- package/dist/modes/json-entry.d.ts +13 -0
- package/dist/modes/json-entry.d.ts.map +1 -0
- package/dist/modes/json-entry.js +14 -0
- package/dist/modes/json-entry.js.map +1 -0
- package/dist/modes/json.d.ts +4 -1
- package/dist/modes/json.d.ts.map +1 -1
- package/dist/modes/json.js +3 -3
- package/dist/modes/json.js.map +1 -1
- package/dist/modes/print-entry.d.ts +10 -0
- package/dist/modes/print-entry.d.ts.map +1 -0
- package/dist/modes/print-entry.js +11 -0
- package/dist/modes/print-entry.js.map +1 -0
- package/dist/modes/tree-selector.d.ts.map +1 -1
- package/dist/modes/tree-selector.js +4 -0
- package/dist/modes/tree-selector.js.map +1 -1
- package/dist/plugin-dump-composition.d.ts +6 -0
- package/dist/plugin-dump-composition.d.ts.map +1 -0
- package/dist/plugin-dump-composition.js +7 -0
- package/dist/plugin-dump-composition.js.map +1 -0
- package/dist/plugin-inventory.d.ts +7 -0
- package/dist/plugin-inventory.d.ts.map +1 -0
- package/dist/plugin-inventory.js +8 -0
- package/dist/plugin-inventory.js.map +1 -0
- package/dist/plugin-manager.d.ts +6 -0
- package/dist/plugin-manager.d.ts.map +1 -0
- package/dist/plugin-manager.js +7 -0
- package/dist/plugin-manager.js.map +1 -0
- package/dist/plugin-trace.d.ts +6 -0
- package/dist/plugin-trace.d.ts.map +1 -0
- package/dist/plugin-trace.js +7 -0
- package/dist/plugin-trace.js.map +1 -0
- package/dist/plugins/dynamic-broker.d.ts +76 -0
- package/dist/plugins/dynamic-broker.d.ts.map +1 -0
- package/dist/plugins/dynamic-broker.js +852 -0
- package/dist/plugins/dynamic-broker.js.map +1 -0
- package/dist/plugins/profile.d.ts +15 -0
- package/dist/plugins/profile.d.ts.map +1 -0
- package/dist/plugins/profile.js +34 -0
- package/dist/plugins/profile.js.map +1 -0
- package/dist/plugins/runtime-host.d.ts +37 -0
- package/dist/plugins/runtime-host.d.ts.map +1 -0
- package/dist/plugins/runtime-host.js +95 -0
- package/dist/plugins/runtime-host.js.map +1 -0
- package/dist/plugins/trust.d.ts +8 -0
- package/dist/plugins/trust.d.ts.map +1 -0
- package/dist/plugins/trust.js +59 -0
- package/dist/plugins/trust.js.map +1 -0
- package/dist/project-trust-entry.d.ts +15 -0
- package/dist/project-trust-entry.d.ts.map +1 -0
- package/dist/project-trust-entry.js +15 -0
- package/dist/project-trust-entry.js.map +1 -0
- package/dist/rpc/client.d.ts +78 -6
- package/dist/rpc/client.d.ts.map +1 -1
- package/dist/rpc/client.js +172 -4
- package/dist/rpc/client.js.map +1 -1
- package/dist/rpc/dispatcher.d.ts +121 -0
- package/dist/rpc/dispatcher.d.ts.map +1 -0
- package/dist/rpc/dispatcher.js +994 -0
- package/dist/rpc/dispatcher.js.map +1 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +2 -0
- package/dist/rpc/index.js.map +1 -1
- package/dist/rpc/lifecycle.d.ts +6 -0
- package/dist/rpc/lifecycle.d.ts.map +1 -0
- package/dist/rpc/lifecycle.js +24 -0
- package/dist/rpc/lifecycle.js.map +1 -0
- package/dist/rpc/protocol.d.ts +112 -31
- package/dist/rpc/protocol.d.ts.map +1 -1
- package/dist/rpc/protocol.js +569 -117
- package/dist/rpc/protocol.js.map +1 -1
- package/dist/rpc/server-service.d.ts +7 -0
- package/dist/rpc/server-service.d.ts.map +1 -0
- package/dist/rpc/server-service.js +3 -0
- package/dist/rpc/server-service.js.map +1 -0
- package/dist/rpc/server.d.ts +16 -19
- package/dist/rpc/server.d.ts.map +1 -1
- package/dist/rpc/server.js +59 -115
- package/dist/rpc/server.js.map +1 -1
- package/dist/rpc-client-sdk-entry.d.ts +12 -0
- package/dist/rpc-client-sdk-entry.d.ts.map +1 -0
- package/dist/rpc-client-sdk-entry.js +11 -0
- package/dist/rpc-client-sdk-entry.js.map +1 -0
- package/dist/rpc-entry.js +50 -18
- package/dist/rpc-entry.js.map +1 -1
- package/dist/rpc-server-entry.d.ts +8 -0
- package/dist/rpc-server-entry.d.ts.map +1 -0
- package/dist/rpc-server-entry.js +67 -0
- package/dist/rpc-server-entry.js.map +1 -0
- package/dist/runtime/attachment-store.d.ts +13 -0
- package/dist/runtime/attachment-store.d.ts.map +1 -0
- package/dist/runtime/attachment-store.js +93 -0
- package/dist/runtime/attachment-store.js.map +1 -0
- package/dist/runtime/bootstrap.d.ts +14 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +29 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/interactive-host-service.d.ts +22 -0
- package/dist/runtime/interactive-host-service.d.ts.map +1 -0
- package/dist/runtime/interactive-host-service.js +2 -0
- package/dist/runtime/interactive-host-service.js.map +1 -0
- package/dist/runtime/interactive-resource-service.d.ts +11 -0
- package/dist/runtime/interactive-resource-service.d.ts.map +1 -0
- package/dist/runtime/interactive-resource-service.js +3 -0
- package/dist/runtime/interactive-resource-service.js.map +1 -0
- package/dist/runtime/plugin-inventory-entry.d.ts +5 -0
- package/dist/runtime/plugin-inventory-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-inventory-entry.js +18 -0
- package/dist/runtime/plugin-inventory-entry.js.map +1 -0
- package/dist/runtime/plugin-inventory-service.d.ts +8 -0
- package/dist/runtime/plugin-inventory-service.d.ts.map +1 -0
- package/dist/runtime/plugin-inventory-service.js +3 -0
- package/dist/runtime/plugin-inventory-service.js.map +1 -0
- package/dist/runtime/plugin-manager-entry.d.ts +20 -0
- package/dist/runtime/plugin-manager-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-manager-entry.js +96 -0
- package/dist/runtime/plugin-manager-entry.js.map +1 -0
- package/dist/runtime/plugin-observability-entry.d.ts +12 -0
- package/dist/runtime/plugin-observability-entry.d.ts.map +1 -0
- package/dist/runtime/plugin-observability-entry.js +73 -0
- package/dist/runtime/plugin-observability-entry.js.map +1 -0
- package/dist/runtime/product-host.d.ts +91 -0
- package/dist/runtime/product-host.d.ts.map +1 -0
- package/dist/runtime/product-host.js +529 -0
- package/dist/runtime/product-host.js.map +1 -0
- package/dist/runtime/session-factory.d.ts +17 -0
- package/dist/runtime/session-factory.d.ts.map +1 -0
- package/dist/runtime/session-factory.js +75 -0
- package/dist/runtime/session-factory.js.map +1 -0
- package/dist/runtime/session-host.d.ts +152 -0
- package/dist/runtime/session-host.d.ts.map +1 -0
- package/dist/runtime/session-host.js +895 -0
- package/dist/runtime/session-host.js.map +1 -0
- package/dist/runtime-core-entry.d.ts +11 -0
- package/dist/runtime-core-entry.d.ts.map +1 -0
- package/dist/runtime-core-entry.js +9 -0
- package/dist/runtime-core-entry.js.map +1 -0
- package/dist/session-factory-entry.d.ts +7 -0
- package/dist/session-factory-entry.d.ts.map +1 -0
- package/dist/session-factory-entry.js +9 -0
- package/dist/session-factory-entry.js.map +1 -0
- package/dist/session-store-jsonl-entry.d.ts +7 -0
- package/dist/session-store-jsonl-entry.d.ts.map +1 -0
- package/dist/session-store-jsonl-entry.js +33 -0
- package/dist/session-store-jsonl-entry.js.map +1 -0
- package/dist/startup.d.ts +12 -1
- package/dist/startup.d.ts.map +1 -1
- package/dist/startup.js +106 -15
- package/dist/startup.js.map +1 -1
- package/dist/subagents/index.d.ts +2 -0
- package/dist/subagents/index.d.ts.map +1 -0
- package/dist/subagents/index.js +2 -0
- package/dist/subagents/index.js.map +1 -0
- package/dist/subagents/service.d.ts +50 -0
- package/dist/subagents/service.d.ts.map +1 -0
- package/dist/subagents/service.js +521 -0
- package/dist/subagents/service.js.map +1 -0
- package/dist/ui-host.d.ts +125 -0
- package/dist/ui-host.d.ts.map +1 -0
- package/dist/ui-host.js +275 -0
- package/dist/ui-host.js.map +1 -0
- package/dist/web/assets/index-BwfuGMvv.css +1 -0
- package/dist/web/assets/index-DPUaJqFJ.js +41 -0
- package/dist/web/assets/index-DPUaJqFJ.js.map +1 -0
- package/dist/web/index.html +14 -0
- package/dist/web-command.d.ts +11 -0
- package/dist/web-command.d.ts.map +1 -0
- package/dist/web-command.js +114 -0
- package/dist/web-command.js.map +1 -0
- package/dist/web-frontend.d.ts +73 -0
- package/dist/web-frontend.d.ts.map +1 -0
- package/dist/web-frontend.js +249 -0
- package/dist/web-frontend.js.map +1 -0
- package/dist/web.d.ts +254 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +740 -0
- package/dist/web.js.map +1 -0
- package/dist/webui-entry.d.ts +3 -0
- package/dist/webui-entry.d.ts.map +1 -0
- package/dist/webui-entry.js +73 -0
- package/dist/webui-entry.js.map +1 -0
- package/dist/webui.d.ts +91 -0
- package/dist/webui.d.ts.map +1 -0
- package/dist/webui.js +882 -0
- package/dist/webui.js.map +1 -0
- package/package.json +89 -8
package/dist/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,eAAe,MAAM,iBAAiB,CAAC,OAAO,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YAChC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YAC5C,WAAW,EAAE,EAAE,qBAAqB,EAAE,kBAAkB,EAAE;YAC1D,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;gBACzB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG;oBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnG,CAAC;YACD,iBAAiB,EAAE,GAAG,EAAE;gBACvB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG;oBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;YACrG,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IAChB,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;IACtG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { createInterface } from \"node:readline/promises\";\nimport { redactSensitiveText } from \"@di-code/plugin-runtime\";\nimport packageMetadata from \"../package.json\" with { type: \"json\" };\nimport { parseCliArgs } from \"./cli.ts\";\nimport { runMinimalProfile } from \"./main.ts\";\nimport { resolveStartupArgs } from \"./startup.ts\";\nimport { runWebCommand } from \"./web-command.ts\";\n\nasync function promptProjectTrust(cwd: string): Promise<boolean> {\n\tconst readline = createInterface({ input: process.stdin, output: process.stdout });\n\ttry {\n\t\tconst answer = await readline.question(`Trust project-local Skills and MCP configuration in ${cwd}? [y/N] `);\n\t\treturn /^(?:y|yes)$/i.test(answer.trim());\n\t} finally {\n\t\treadline.close();\n\t}\n}\n\ntry {\n\tconst rawArgs = process.argv.slice(2);\n\tconst args = resolveStartupArgs(rawArgs);\n\tconst command = parseCliArgs(args);\n\tif (command.kind === \"web\") {\n\t\tprocess.exitCode = await runWebCommand(command);\n\t} else {\n\t\tconst isInteractiveTerminal = Boolean(process.stdin.isTTY && process.stdout.isTTY);\n\t\tprocess.exitCode = await runMinimalProfile(args, {\n\t\t\tversion: packageMetadata.version,\n\t\t\tstdout: (text) => process.stdout.write(text),\n\t\t\tstderr: (text) => process.stderr.write(text),\n\t\t\tinteractive: { isInteractiveTerminal, promptProjectTrust },\n\t\t\tonRuntimeEvent: (event) => {\n\t\t\t\tif (process.env.DI_CODE_TRACE_PLUGINS === \"1\") process.stderr.write(`${JSON.stringify(event)}\\n`);\n\t\t\t},\n\t\t\tonSessionDisposed: () => {\n\t\t\t\tif (process.env.DI_CODE_TRACE_PLUGINS === \"1\") process.stderr.write('{\"type\":\"session_dispose\"}\\n');\n\t\t\t},\n\t\t});\n\t}\n} catch (cause) {\n\tconst message = redactSensitiveText(cause instanceof Error ? cause.message : \"Unknown startup error\");\n\tprocess.stderr.write(`${message}\\n`);\n\tprocess.exitCode = 1;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,12 @@ export * from "./core/session/session-storage.ts";
|
|
|
6
6
|
export * from "./core/session/types.ts";
|
|
7
7
|
export * from "./core/session.ts";
|
|
8
8
|
export * from "./core/system-prompt.ts";
|
|
9
|
-
export * from "./extensions/index.ts";
|
|
10
9
|
export * from "./mcp/config.ts";
|
|
11
|
-
export * from "./mcp/
|
|
10
|
+
export * from "./mcp/entries.ts";
|
|
12
11
|
export * from "./mcp/tool-adapter.ts";
|
|
13
|
-
export
|
|
12
|
+
export { apiVersion as rpcClientSdkApiVersion, apply as rpcClientSdkApply, name as rpcClientSdkName, type RpcClientSdk, rpcClientSdkKey, version as rpcClientSdkVersion, } from "./rpc-client-sdk-entry.ts";
|
|
13
|
+
export { pluginInventory } from "./runtime/plugin-inventory-entry.ts";
|
|
14
|
+
export { type PluginInventoryService, pluginInventoryKey } from "./runtime/plugin-inventory-service.ts";
|
|
15
|
+
export { type PluginManagementAction, type PluginManagementCommand, type PluginManagerEntryConfig, type PluginManagerService, pluginManager, pluginManagerKey, } from "./runtime/plugin-manager-entry.ts";
|
|
16
|
+
export { type PluginObservationService, pluginDumpComposition, pluginDumpCompositionKey, pluginTrace, pluginTraceKey, } from "./runtime/plugin-observability-entry.ts";
|
|
14
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,UAAU,IAAI,sBAAsB,EACpC,KAAK,IAAI,iBAAiB,EAC1B,IAAI,IAAI,gBAAgB,EACxB,KAAK,YAAY,EACjB,eAAe,EACf,OAAO,IAAI,mBAAmB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,KAAK,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACxG,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,aAAa,EACb,gBAAgB,GAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,cAAc,GACd,MAAM,yCAAyC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,12 @@ export * from "./core/session/session-storage.js";
|
|
|
6
6
|
export * from "./core/session/types.js";
|
|
7
7
|
export * from "./core/session.js";
|
|
8
8
|
export * from "./core/system-prompt.js";
|
|
9
|
-
export * from "./extensions/index.js";
|
|
10
9
|
export * from "./mcp/config.js";
|
|
11
|
-
export * from "./mcp/
|
|
10
|
+
export * from "./mcp/entries.js";
|
|
12
11
|
export * from "./mcp/tool-adapter.js";
|
|
13
|
-
export
|
|
12
|
+
export { apiVersion as rpcClientSdkApiVersion, apply as rpcClientSdkApply, name as rpcClientSdkName, rpcClientSdkKey, version as rpcClientSdkVersion, } from "./rpc-client-sdk-entry.js";
|
|
13
|
+
export { pluginInventory } from "./runtime/plugin-inventory-entry.js";
|
|
14
|
+
export { pluginInventoryKey } from "./runtime/plugin-inventory-service.js";
|
|
15
|
+
export { pluginManager, pluginManagerKey, } from "./runtime/plugin-manager-entry.js";
|
|
16
|
+
export { pluginDumpComposition, pluginDumpCompositionKey, pluginTrace, pluginTraceKey, } from "./runtime/plugin-observability-entry.js";
|
|
14
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,UAAU,IAAI,sBAAsB,EACpC,KAAK,IAAI,iBAAiB,EAC1B,IAAI,IAAI,gBAAgB,EAExB,eAAe,EACf,OAAO,IAAI,mBAAmB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAA+B,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACxG,OAAO,EAKN,aAAa,EACb,gBAAgB,GAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEN,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,cAAc,GACd,MAAM,yCAAyC,CAAC","sourcesContent":["export * from \"./cli.ts\";\nexport * from \"./core/context-builder.ts\";\nexport * from \"./core/resources/index.ts\";\nexport * from \"./core/session/session-manager.ts\";\nexport * from \"./core/session/session-storage.ts\";\nexport * from \"./core/session/types.ts\";\nexport * from \"./core/session.ts\";\nexport * from \"./core/system-prompt.ts\";\nexport * from \"./mcp/config.ts\";\nexport * from \"./mcp/entries.ts\";\nexport * from \"./mcp/tool-adapter.ts\";\nexport {\n\tapiVersion as rpcClientSdkApiVersion,\n\tapply as rpcClientSdkApply,\n\tname as rpcClientSdkName,\n\ttype RpcClientSdk,\n\trpcClientSdkKey,\n\tversion as rpcClientSdkVersion,\n} from \"./rpc-client-sdk-entry.ts\";\nexport { pluginInventory } from \"./runtime/plugin-inventory-entry.ts\";\nexport { type PluginInventoryService, pluginInventoryKey } from \"./runtime/plugin-inventory-service.ts\";\nexport {\n\ttype PluginManagementAction,\n\ttype PluginManagementCommand,\n\ttype PluginManagerEntryConfig,\n\ttype PluginManagerService,\n\tpluginManager,\n\tpluginManagerKey,\n} from \"./runtime/plugin-manager-entry.ts\";\nexport {\n\ttype PluginObservationService,\n\tpluginDumpComposition,\n\tpluginDumpCompositionKey,\n\tpluginTrace,\n\tpluginTraceKey,\n} from \"./runtime/plugin-observability-entry.ts\";\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PluginFrontendController, PluginTerminalFrontendHost } from "@di-code/plugin-runtime";
|
|
2
|
+
import { type InteractiveModeOptions } from "../modes/interactive.ts";
|
|
3
|
+
export interface BuiltinInteractiveFrontendOptions extends Omit<InteractiveModeOptions, "tui"> {
|
|
4
|
+
readonly initialPrompt?: string;
|
|
5
|
+
}
|
|
6
|
+
/** The default ANSI frontend. It owns only the terminal facade supplied by the host. */
|
|
7
|
+
export declare class BuiltinInteractiveFrontend {
|
|
8
|
+
readonly id: "builtin";
|
|
9
|
+
private readonly options;
|
|
10
|
+
private mode?;
|
|
11
|
+
private resolveStart?;
|
|
12
|
+
constructor(options: BuiltinInteractiveFrontendOptions);
|
|
13
|
+
start(_controller: PluginFrontendController, terminal: PluginTerminalFrontendHost): Promise<void>;
|
|
14
|
+
dispose(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createBuiltinInteractiveFrontend(options: BuiltinInteractiveFrontendOptions): BuiltinInteractiveFrontend;
|
|
17
|
+
//# sourceMappingURL=builtin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/interactive/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,MAAM,WAAW,iCAAkC,SAAQ,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC;IAC7F,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wFAAwF;AACxF,qBAAa,0BAA0B;IACtC,QAAQ,CAAC,EAAE,EAAG,SAAS,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAkB;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAa;gBAEtB,OAAO,EAAE,iCAAiC;IAIhD,KAAK,CAAC,WAAW,EAAE,wBAAwB,EAAE,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAM9B;AAED,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,iCAAiC,GACxC,0BAA0B,CAE5B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TUI } from "@di-code/tui";
|
|
2
|
+
import { InteractiveMode } from "../modes/interactive.js";
|
|
3
|
+
/** The default ANSI frontend. It owns only the terminal facade supplied by the host. */
|
|
4
|
+
export class BuiltinInteractiveFrontend {
|
|
5
|
+
id = "builtin";
|
|
6
|
+
options;
|
|
7
|
+
mode;
|
|
8
|
+
resolveStart;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
}
|
|
12
|
+
async start(_controller, terminal) {
|
|
13
|
+
if (this.mode)
|
|
14
|
+
throw new Error("Builtin interactive frontend is already started.");
|
|
15
|
+
await new Promise((resolve, reject) => {
|
|
16
|
+
this.resolveStart = resolve;
|
|
17
|
+
const onExit = this.options.onExit;
|
|
18
|
+
this.mode = new InteractiveMode({
|
|
19
|
+
...this.options,
|
|
20
|
+
tui: new TUI(terminal),
|
|
21
|
+
onExit: () => {
|
|
22
|
+
onExit?.();
|
|
23
|
+
this.resolveStart = undefined;
|
|
24
|
+
resolve();
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
this.mode.start(this.options.initialPrompt);
|
|
29
|
+
}
|
|
30
|
+
catch (cause) {
|
|
31
|
+
this.mode = undefined;
|
|
32
|
+
this.resolveStart = undefined;
|
|
33
|
+
reject(cause);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async dispose() {
|
|
38
|
+
this.mode?.stop();
|
|
39
|
+
this.mode = undefined;
|
|
40
|
+
this.resolveStart?.();
|
|
41
|
+
this.resolveStart = undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function createBuiltinInteractiveFrontend(options) {
|
|
45
|
+
return new BuiltinInteractiveFrontend(options);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.js","sourceRoot":"","sources":["../../src/interactive/builtin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,eAAe,EAA+B,MAAM,yBAAyB,CAAC;AAMvF,wFAAwF;AACxF,MAAM,OAAO,0BAA0B;IAC7B,EAAE,GAAG,SAAkB,CAAC;IAChB,OAAO,CAAoC;IACpD,IAAI,CAAmB;IACvB,YAAY,CAAc;IAElC,YAAY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OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import type { PluginFrontendController, PluginTerminalFrontendHost } from \"@di-code/plugin-runtime\";\nimport { TUI } from \"@di-code/tui\";\nimport { InteractiveMode, type InteractiveModeOptions } from \"../modes/interactive.ts\";\n\nexport interface BuiltinInteractiveFrontendOptions extends Omit<InteractiveModeOptions, \"tui\"> {\n\treadonly initialPrompt?: string;\n}\n\n/** The default ANSI frontend. It owns only the terminal facade supplied by the host. */\nexport class BuiltinInteractiveFrontend {\n\treadonly id = \"builtin\" as const;\n\tprivate readonly options: BuiltinInteractiveFrontendOptions;\n\tprivate mode?: InteractiveMode;\n\tprivate resolveStart?: () => void;\n\n\tconstructor(options: BuiltinInteractiveFrontendOptions) {\n\t\tthis.options = options;\n\t}\n\n\tasync start(_controller: PluginFrontendController, terminal: PluginTerminalFrontendHost): Promise<void> {\n\t\tif (this.mode) throw new Error(\"Builtin interactive frontend is already started.\");\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tthis.resolveStart = resolve;\n\t\t\tconst onExit = this.options.onExit;\n\t\t\tthis.mode = new InteractiveMode({\n\t\t\t\t...this.options,\n\t\t\t\ttui: new TUI(terminal),\n\t\t\t\tonExit: () => {\n\t\t\t\t\tonExit?.();\n\t\t\t\t\tthis.resolveStart = undefined;\n\t\t\t\t\tresolve();\n\t\t\t\t},\n\t\t\t});\n\t\t\ttry {\n\t\t\t\tthis.mode.start(this.options.initialPrompt);\n\t\t\t} catch (cause) {\n\t\t\t\tthis.mode = undefined;\n\t\t\t\tthis.resolveStart = undefined;\n\t\t\t\treject(cause);\n\t\t\t}\n\t\t});\n\t}\n\n\tasync dispose(): Promise<void> {\n\t\tthis.mode?.stop();\n\t\tthis.mode = undefined;\n\t\tthis.resolveStart?.();\n\t\tthis.resolveStart = undefined;\n\t}\n}\n\nexport function createBuiltinInteractiveFrontend(\n\toptions: BuiltinInteractiveFrontendOptions,\n): BuiltinInteractiveFrontend {\n\treturn new BuiltinInteractiveFrontend(options);\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ImageContent } from "@di-code/ai";
|
|
2
|
+
import type { PluginUiContributions } from "@di-code/plugin-runtime";
|
|
3
|
+
import type { AgentSession, AgentSessionEvent } from "../core/session.ts";
|
|
4
|
+
import { type InteractiveState } from "../modes/interactive-state.ts";
|
|
5
|
+
import type { CodingAgentPluginHost } from "../plugins/runtime-host.ts";
|
|
6
|
+
export type InteractiveInput = string | {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly images?: readonly ImageContent[];
|
|
9
|
+
};
|
|
10
|
+
export interface InteractiveSessionChoice {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
open(): AgentSession | Promise<AgentSession>;
|
|
15
|
+
}
|
|
16
|
+
export interface InteractiveControllerState extends InteractiveState {
|
|
17
|
+
readonly model: string;
|
|
18
|
+
readonly provider: string;
|
|
19
|
+
readonly sessionId: string;
|
|
20
|
+
readonly streaming: boolean;
|
|
21
|
+
/** Child runs are host-owned and expose no Agent or Session internals to a frontend. */
|
|
22
|
+
readonly subagents: readonly {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly status: import("@di-code/plugin-runtime").SubagentStatus;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export type InteractiveViewEvent = {
|
|
28
|
+
readonly type: "state";
|
|
29
|
+
readonly state: InteractiveControllerState;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: "session_event";
|
|
32
|
+
readonly event: AgentSessionEvent;
|
|
33
|
+
} | {
|
|
34
|
+
readonly type: "diagnostic";
|
|
35
|
+
readonly message: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: "exit";
|
|
38
|
+
readonly reason: "user" | "error";
|
|
39
|
+
};
|
|
40
|
+
export type InteractiveControllerListener = (event: InteractiveViewEvent) => void;
|
|
41
|
+
export interface InteractiveControllerOptions {
|
|
42
|
+
readonly session: AgentSession;
|
|
43
|
+
readonly sessions?: readonly InteractiveSessionChoice[];
|
|
44
|
+
readonly runtimePluginHost?: CodingAgentPluginHost;
|
|
45
|
+
}
|
|
46
|
+
/** Product-layer controller shared by the builtin TUI and future frontends. */
|
|
47
|
+
export declare class InteractiveController {
|
|
48
|
+
private session;
|
|
49
|
+
private readonly sessionChoices;
|
|
50
|
+
private readonly runtimePluginHost?;
|
|
51
|
+
private readonly projection;
|
|
52
|
+
private readonly listeners;
|
|
53
|
+
private unsubscribeSession?;
|
|
54
|
+
private activeAbort?;
|
|
55
|
+
private promptActive;
|
|
56
|
+
private switching;
|
|
57
|
+
private compactionActive;
|
|
58
|
+
private queue;
|
|
59
|
+
private lastRetryInput?;
|
|
60
|
+
private disposed;
|
|
61
|
+
constructor(options: InteractiveControllerOptions);
|
|
62
|
+
get state(): InteractiveControllerState;
|
|
63
|
+
/** Restricted panel data and result formatters supplied by active plugin scopes. */
|
|
64
|
+
get ui(): PluginUiContributions;
|
|
65
|
+
subscribe(listener: InteractiveControllerListener): {
|
|
66
|
+
dispose(): void;
|
|
67
|
+
};
|
|
68
|
+
submit(input: InteractiveInput): Promise<void>;
|
|
69
|
+
steer(input: InteractiveInput): void;
|
|
70
|
+
cancel(): void;
|
|
71
|
+
retry(): Promise<void>;
|
|
72
|
+
runCommand(name: string, args: string): Promise<void>;
|
|
73
|
+
selectModel(modelId: string): void;
|
|
74
|
+
openSession(sessionId: string): Promise<void>;
|
|
75
|
+
createSession(): Promise<void>;
|
|
76
|
+
requestCompaction(): Promise<void>;
|
|
77
|
+
dispose(): void;
|
|
78
|
+
disposeSubagents(): Promise<void>;
|
|
79
|
+
private steerAsync;
|
|
80
|
+
private subscribeSession;
|
|
81
|
+
private emitState;
|
|
82
|
+
private emit;
|
|
83
|
+
private reportError;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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0BAA0B,CAStC;IAED,oFAAoF;IACpF,IAAI,EAAE,IAAI,qBAAqB,CAE9B;IAED,SAAS,CAAC,QAAQ,EAAE,6BAA6B,GAAG;QAAE,OAAO,IAAI,IAAI,CAAA;KAAE;IAMjE,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCpD,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAIpC,MAAM,IAAI,IAAI;IAIR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3D,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB7C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYxC,OAAO,IAAI,IAAI;IAST,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,UAAU;IAaxB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,WAAW;CAMnB"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { InteractiveProjection } from "../modes/interactive-state.js";
|
|
2
|
+
/** Product-layer controller shared by the builtin TUI and future frontends. */
|
|
3
|
+
export class InteractiveController {
|
|
4
|
+
session;
|
|
5
|
+
sessionChoices;
|
|
6
|
+
runtimePluginHost;
|
|
7
|
+
projection = new InteractiveProjection();
|
|
8
|
+
listeners = new Set();
|
|
9
|
+
unsubscribeSession;
|
|
10
|
+
activeAbort;
|
|
11
|
+
promptActive = false;
|
|
12
|
+
switching = false;
|
|
13
|
+
compactionActive = false;
|
|
14
|
+
queue = [];
|
|
15
|
+
lastRetryInput;
|
|
16
|
+
disposed = false;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.session = options.session;
|
|
19
|
+
this.sessionChoices = [...(options.sessions ?? [])];
|
|
20
|
+
this.runtimePluginHost = options.runtimePluginHost;
|
|
21
|
+
this.projection.replaceTranscript(this.session.transcript);
|
|
22
|
+
this.projection.setUsage(this.session.usage);
|
|
23
|
+
this.subscribeSession();
|
|
24
|
+
}
|
|
25
|
+
get state() {
|
|
26
|
+
return {
|
|
27
|
+
...this.projection.state,
|
|
28
|
+
model: `${this.session.modelId}${this.session.thinkingLevel ? `(${this.session.thinkingLevel})` : ""}`,
|
|
29
|
+
provider: this.session.providerId,
|
|
30
|
+
sessionId: this.session.sessionId,
|
|
31
|
+
streaming: this.promptActive,
|
|
32
|
+
subagents: this.session.subagents?.list().map((run) => ({ id: run.id, status: run.status })) ?? [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Restricted panel data and result formatters supplied by active plugin scopes. */
|
|
36
|
+
get ui() {
|
|
37
|
+
return this.runtimePluginHost?.getUiContributions() ?? { panels: [], toolDetailRenderers: [] };
|
|
38
|
+
}
|
|
39
|
+
subscribe(listener) {
|
|
40
|
+
if (this.disposed)
|
|
41
|
+
throw new Error("Interactive controller is disposed.");
|
|
42
|
+
this.listeners.add(listener);
|
|
43
|
+
return { dispose: () => this.listeners.delete(listener) };
|
|
44
|
+
}
|
|
45
|
+
async submit(input) {
|
|
46
|
+
if (this.disposed)
|
|
47
|
+
throw new Error("Interactive controller is disposed.");
|
|
48
|
+
const text = typeof input === "string" ? input.trim() : input.text.trim();
|
|
49
|
+
if (!text)
|
|
50
|
+
return;
|
|
51
|
+
if (this.switching)
|
|
52
|
+
throw new Error("A session is opening; wait before submitting a prompt.");
|
|
53
|
+
if (this.compactionActive)
|
|
54
|
+
throw new Error("A compaction is running; wait before submitting a prompt.");
|
|
55
|
+
if (this.promptActive) {
|
|
56
|
+
this.queue.push(typeof input === "string" ? text : { ...input, text });
|
|
57
|
+
this.projection.setQueue(this.queue.map((item) => (typeof item === "string" ? item : item.text)));
|
|
58
|
+
this.emitState();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.promptActive = true;
|
|
62
|
+
this.activeAbort = new AbortController();
|
|
63
|
+
this.emitState();
|
|
64
|
+
try {
|
|
65
|
+
const result = typeof input === "string"
|
|
66
|
+
? await this.session.prompt(input, this.activeAbort.signal)
|
|
67
|
+
: await this.session.promptWithImages(input.text, input.images ?? [], this.activeAbort.signal);
|
|
68
|
+
if (result.stopReason === "error" || result.stopReason === "aborted") {
|
|
69
|
+
this.lastRetryInput = typeof input === "string" ? input : { ...input, images: [...(input.images ?? [])] };
|
|
70
|
+
this.projection.setError(result.errorMessage);
|
|
71
|
+
}
|
|
72
|
+
else
|
|
73
|
+
this.lastRetryInput = undefined;
|
|
74
|
+
}
|
|
75
|
+
catch (cause) {
|
|
76
|
+
this.lastRetryInput = typeof input === "string" ? input : { ...input, images: [...(input.images ?? [])] };
|
|
77
|
+
this.reportError(cause);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
this.promptActive = false;
|
|
81
|
+
this.activeAbort = undefined;
|
|
82
|
+
this.emitState();
|
|
83
|
+
const next = this.queue.shift();
|
|
84
|
+
this.projection.setQueue(this.queue.map((item) => (typeof item === "string" ? item : item.text)));
|
|
85
|
+
if (next && !this.disposed)
|
|
86
|
+
void this.submit(next);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
steer(input) {
|
|
90
|
+
void this.steerAsync(input);
|
|
91
|
+
}
|
|
92
|
+
cancel() {
|
|
93
|
+
this.activeAbort?.abort();
|
|
94
|
+
}
|
|
95
|
+
async retry() {
|
|
96
|
+
if (!this.lastRetryInput)
|
|
97
|
+
throw new Error("There is no failed or cancelled prompt to retry.");
|
|
98
|
+
if (this.promptActive)
|
|
99
|
+
throw new Error("Cannot retry while a prompt is running.");
|
|
100
|
+
await this.submit(this.lastRetryInput);
|
|
101
|
+
}
|
|
102
|
+
async runCommand(name, args) {
|
|
103
|
+
if (!this.runtimePluginHost)
|
|
104
|
+
throw new Error(`Unknown plugin command: "${name}"`);
|
|
105
|
+
await this.runtimePluginHost.runCommand(name, args, this.session.sessionId);
|
|
106
|
+
}
|
|
107
|
+
selectModel(modelId) {
|
|
108
|
+
this.session.setModel(modelId);
|
|
109
|
+
this.emitState();
|
|
110
|
+
}
|
|
111
|
+
async openSession(sessionId) {
|
|
112
|
+
if (this.promptActive || this.switching)
|
|
113
|
+
throw new Error("Cannot switch sessions while a prompt is running.");
|
|
114
|
+
const choice = this.sessionChoices.find((item) => item.id === sessionId);
|
|
115
|
+
if (!choice)
|
|
116
|
+
throw new Error(`Unknown session: "${sessionId}"`);
|
|
117
|
+
this.switching = true;
|
|
118
|
+
try {
|
|
119
|
+
await this.session.disposeSubagents();
|
|
120
|
+
const next = await choice.open();
|
|
121
|
+
this.unsubscribeSession?.();
|
|
122
|
+
this.session = next;
|
|
123
|
+
this.projection.replaceTranscript(next.transcript);
|
|
124
|
+
this.projection.setUsage(next.usage);
|
|
125
|
+
this.subscribeSession();
|
|
126
|
+
this.emitState();
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
this.switching = false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async createSession() {
|
|
133
|
+
await this.openSession("new-session");
|
|
134
|
+
}
|
|
135
|
+
async requestCompaction() {
|
|
136
|
+
if (this.promptActive || this.compactionActive)
|
|
137
|
+
throw new Error("Cannot compact while a prompt is running.");
|
|
138
|
+
this.compactionActive = true;
|
|
139
|
+
this.emitState();
|
|
140
|
+
try {
|
|
141
|
+
await this.session.compact();
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
this.compactionActive = false;
|
|
145
|
+
this.emitState();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
dispose() {
|
|
149
|
+
if (this.disposed)
|
|
150
|
+
return;
|
|
151
|
+
this.disposed = true;
|
|
152
|
+
this.activeAbort?.abort();
|
|
153
|
+
this.unsubscribeSession?.();
|
|
154
|
+
this.unsubscribeSession = undefined;
|
|
155
|
+
this.listeners.clear();
|
|
156
|
+
}
|
|
157
|
+
async disposeSubagents() {
|
|
158
|
+
await this.session.disposeSubagents();
|
|
159
|
+
}
|
|
160
|
+
async steerAsync(input) {
|
|
161
|
+
if (!this.promptActive) {
|
|
162
|
+
this.reportError(new Error("Steering is only available while a prompt is running."));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
if (typeof input === "string")
|
|
167
|
+
await this.session.steer(input);
|
|
168
|
+
else
|
|
169
|
+
await this.session.steerWithImages(input.text, input.images ?? []);
|
|
170
|
+
}
|
|
171
|
+
catch (cause) {
|
|
172
|
+
this.reportError(cause);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
subscribeSession() {
|
|
176
|
+
this.unsubscribeSession = this.session.subscribeSession((event) => {
|
|
177
|
+
if (event.type === "queue_update")
|
|
178
|
+
this.projection.setQueue(event.steering);
|
|
179
|
+
else if (event.type === "tree_navigated")
|
|
180
|
+
this.projection.replaceTranscript(this.session.transcript);
|
|
181
|
+
else if (event.type.startsWith("subagent_")) {
|
|
182
|
+
// Subagent state is read through the restricted controller projection above.
|
|
183
|
+
}
|
|
184
|
+
else
|
|
185
|
+
this.projection.apply(event);
|
|
186
|
+
this.emit({ type: "session_event", event });
|
|
187
|
+
this.emitState();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
emitState() {
|
|
191
|
+
this.emit({ type: "state", state: this.state });
|
|
192
|
+
}
|
|
193
|
+
emit(event) {
|
|
194
|
+
for (const listener of this.listeners) {
|
|
195
|
+
try {
|
|
196
|
+
listener(event);
|
|
197
|
+
}
|
|
198
|
+
catch (cause) {
|
|
199
|
+
this.reportError(cause);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
reportError(cause) {
|
|
204
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
205
|
+
this.projection.setError(message);
|
|
206
|
+
for (const listener of this.listeners)
|
|
207
|
+
listener({ type: "diagnostic", message });
|
|
208
|
+
this.emitState();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/interactive/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAyB,MAAM,+BAA+B,CAAC;AAsC7F,+EAA+E;AAC/E,MAAM,OAAO,qBAAqB;IACzB,OAAO,CAAe;IACb,cAAc,CAAsC;IACpD,iBAAiB,CAAyB;IAC1C,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;IACzC,SAAS,GAAG,IAAI,GAAG,EAAiC,CAAC;IAC9D,kBAAkB,CAAc;IAChC,WAAW,CAAmB;IAC9B,YAAY,GAAG,KAAK,CAAC;IACrB,SAAS,GAAG,KAAK,CAAC;IAClB,gBAAgB,GAAG,KAAK,CAAC;IACzB,KAAK,GAAuB,EAAE,CAAC;IAC/B,cAAc,CAAoB;IAClC,QAAQ,GAAG,KAAK,CAAC;IAEzB,YAAY,OAAqC;QAChD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,KAAK;QACR,OAAO;YACN,GAAG,I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AAC,WAAW,CAAC,EAAE,CAAC;gBAC7C,6EAA6E;YAC9E,CAAC;;gBAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,SAAS;QAChB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IAEO,IAAI,CAAC,KAA2B;QACvC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC;gBACJ,QAAQ,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACF,CAAC;IACF,CAAC;IAEO,WAAW,CAAC,KAAc;QACjC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS;YAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;QACjF,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;CACD","sourcesContent":["import type { ImageContent } from \"@di-code/ai\";\nimport type { PluginUiContributions } from \"@di-code/plugin-runtime\";\nimport type { AgentSession, AgentSessionEvent } from \"../core/session.ts\";\nimport { InteractiveProjection, type InteractiveState } from \"../modes/interactive-state.ts\";\nimport type { CodingAgentPluginHost } from \"../plugins/runtime-host.ts\";\n\nexport type InteractiveInput = string | { readonly text: string; readonly images?: readonly ImageContent[] };\n\nexport interface InteractiveSessionChoice {\n\treadonly id: string;\n\treadonly label: string;\n\treadonly description?: string;\n\topen(): AgentSession | Promise<AgentSession>;\n}\n\nexport interface InteractiveControllerState extends InteractiveState {\n\treadonly model: string;\n\treadonly provider: string;\n\treadonly sessionId: string;\n\treadonly streaming: boolean;\n\t/** Child runs are host-owned and expose no Agent or Session internals to a frontend. */\n\treadonly subagents: readonly {\n\t\treadonly id: string;\n\t\treadonly status: import(\"@di-code/plugin-runtime\").SubagentStatus;\n\t}[];\n}\n\nexport type InteractiveViewEvent =\n\t| { readonly type: \"state\"; readonly state: InteractiveControllerState }\n\t| { readonly type: \"session_event\"; readonly event: AgentSessionEvent }\n\t| { readonly type: \"diagnostic\"; readonly message: string }\n\t| { readonly type: \"exit\"; readonly reason: \"user\" | \"error\" };\n\nexport type InteractiveControllerListener = (event: InteractiveViewEvent) => void;\n\nexport interface InteractiveControllerOptions {\n\treadonly session: AgentSession;\n\treadonly sessions?: readonly InteractiveSessionChoice[];\n\treadonly runtimePluginHost?: CodingAgentPluginHost;\n}\n\n/** Product-layer controller shared by the builtin TUI and future frontends. */\nexport class InteractiveController {\n\tprivate session: AgentSession;\n\tprivate readonly sessionChoices: readonly InteractiveSessionChoice[];\n\tprivate readonly runtimePluginHost?: CodingAgentPluginHost;\n\tprivate readonly projection = new InteractiveProjection();\n\tprivate readonly listeners = new Set<InteractiveControllerListener>();\n\tprivate unsubscribeSession?: () => void;\n\tprivate activeAbort?: AbortController;\n\tprivate promptActive = false;\n\tprivate switching = false;\n\tprivate compactionActive = false;\n\tprivate queue: InteractiveInput[] = [];\n\tprivate lastRetryInput?: InteractiveInput;\n\tprivate disposed = false;\n\n\tconstructor(options: InteractiveControllerOptions) {\n\t\tthis.session = options.session;\n\t\tthis.sessionChoices = [...(options.sessions ?? [])];\n\t\tthis.runtimePluginHost = options.runtimePluginHost;\n\t\tthis.projection.replaceTranscript(this.session.transcript);\n\t\tthis.projection.setUsage(this.session.usage);\n\t\tthis.subscribeSession();\n\t}\n\n\tget state(): InteractiveControllerState {\n\t\treturn {\n\t\t\t...this.projection.state,\n\t\t\tmodel: `${this.session.modelId}${this.session.thinkingLevel ? `(${this.session.thinkingLevel})` : \"\"}`,\n\t\t\tprovider: this.session.providerId,\n\t\t\tsessionId: this.session.sessionId,\n\t\t\tstreaming: this.promptActive,\n\t\t\tsubagents: this.session.subagents?.list().map((run) => ({ id: run.id, status: run.status })) ?? [],\n\t\t};\n\t}\n\n\t/** Restricted panel data and result formatters supplied by active plugin scopes. */\n\tget ui(): PluginUiContributions {\n\t\treturn this.runtimePluginHost?.getUiContributions() ?? { panels: [], toolDetailRenderers: [] };\n\t}\n\n\tsubscribe(listener: InteractiveControllerListener): { dispose(): void } {\n\t\tif (this.disposed) throw new Error(\"Interactive controller is disposed.\");\n\t\tthis.listeners.add(listener);\n\t\treturn { dispose: () => this.listeners.delete(listener) };\n\t}\n\n\tasync submit(input: InteractiveInput): Promise<void> {\n\t\tif (this.disposed) throw new Error(\"Interactive controller is disposed.\");\n\t\tconst text = typeof input === \"string\" ? input.trim() : input.text.trim();\n\t\tif (!text) return;\n\t\tif (this.switching) throw new Error(\"A session is opening; wait before submitting a prompt.\");\n\t\tif (this.compactionActive) throw new Error(\"A compaction is running; wait before submitting a prompt.\");\n\t\tif (this.promptActive) {\n\t\t\tthis.queue.push(typeof input === \"string\" ? text : { ...input, text });\n\t\t\tthis.projection.setQueue(this.queue.map((item) => (typeof item === \"string\" ? item : item.text)));\n\t\t\tthis.emitState();\n\t\t\treturn;\n\t\t}\n\t\tthis.promptActive = true;\n\t\tthis.activeAbort = new AbortController();\n\t\tthis.emitState();\n\t\ttry {\n\t\t\tconst result =\n\t\t\t\ttypeof input === \"string\"\n\t\t\t\t\t? await this.session.prompt(input, this.activeAbort.signal)\n\t\t\t\t\t: await this.session.promptWithImages(input.text, input.images ?? [], this.activeAbort.signal);\n\t\t\tif (result.stopReason === \"error\" || result.stopReason === \"aborted\") {\n\t\t\t\tthis.lastRetryInput = typeof input === \"string\" ? input : { ...input, images: [...(input.images ?? [])] };\n\t\t\t\tthis.projection.setError(result.errorMessage);\n\t\t\t} else this.lastRetryInput = undefined;\n\t\t} catch (cause) {\n\t\t\tthis.lastRetryInput = typeof input === \"string\" ? input : { ...input, images: [...(input.images ?? [])] };\n\t\t\tthis.reportError(cause);\n\t\t} finally {\n\t\t\tthis.promptActive = false;\n\t\t\tthis.activeAbort = undefined;\n\t\t\tthis.emitState();\n\t\t\tconst next = this.queue.shift();\n\t\t\tthis.projection.setQueue(this.queue.map((item) => (typeof item === \"string\" ? item : item.text)));\n\t\t\tif (next && !this.disposed) void this.submit(next);\n\t\t}\n\t}\n\n\tsteer(input: InteractiveInput): void {\n\t\tvoid this.steerAsync(input);\n\t}\n\n\tcancel(): void {\n\t\tthis.activeAbort?.abort();\n\t}\n\n\tasync retry(): Promise<void> {\n\t\tif (!this.lastRetryInput) throw new Error(\"There is no failed or cancelled prompt to retry.\");\n\t\tif (this.promptActive) throw new Error(\"Cannot retry while a prompt is running.\");\n\t\tawait this.submit(this.lastRetryInput);\n\t}\n\n\tasync runCommand(name: string, args: string): Promise<void> {\n\t\tif (!this.runtimePluginHost) throw new Error(`Unknown plugin command: \"${name}\"`);\n\t\tawait this.runtimePluginHost.runCommand(name, args, this.session.sessionId);\n\t}\n\n\tselectModel(modelId: string): void {\n\t\tthis.session.setModel(modelId);\n\t\tthis.emitState();\n\t}\n\n\tasync openSession(sessionId: string): Promise<void> {\n\t\tif (this.promptActive || this.switching) throw new Error(\"Cannot switch sessions while a prompt is running.\");\n\t\tconst choice = this.sessionChoices.find((item) => item.id === sessionId);\n\t\tif (!choice) throw new Error(`Unknown session: \"${sessionId}\"`);\n\t\tthis.switching = true;\n\t\ttry {\n\t\t\tawait this.session.disposeSubagents();\n\t\t\tconst next = await choice.open();\n\t\t\tthis.unsubscribeSession?.();\n\t\t\tthis.session = next;\n\t\t\tthis.projection.replaceTranscript(next.transcript);\n\t\t\tthis.projection.setUsage(next.usage);\n\t\t\tthis.subscribeSession();\n\t\t\tthis.emitState();\n\t\t} finally {\n\t\t\tthis.switching = false;\n\t\t}\n\t}\n\n\tasync createSession(): Promise<void> {\n\t\tawait this.openSession(\"new-session\");\n\t}\n\n\tasync requestCompaction(): Promise<void> {\n\t\tif (this.promptActive || this.compactionActive) throw new Error(\"Cannot compact while a prompt is running.\");\n\t\tthis.compactionActive = true;\n\t\tthis.emitState();\n\t\ttry {\n\t\t\tawait this.session.compact();\n\t\t} finally {\n\t\t\tthis.compactionActive = false;\n\t\t\tthis.emitState();\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tthis.activeAbort?.abort();\n\t\tthis.unsubscribeSession?.();\n\t\tthis.unsubscribeSession = undefined;\n\t\tthis.listeners.clear();\n\t}\n\n\tasync disposeSubagents(): Promise<void> {\n\t\tawait this.session.disposeSubagents();\n\t}\n\n\tprivate async steerAsync(input: InteractiveInput): Promise<void> {\n\t\tif (!this.promptActive) {\n\t\t\tthis.reportError(new Error(\"Steering is only available while a prompt is running.\"));\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tif (typeof input === \"string\") await this.session.steer(input);\n\t\t\telse await this.session.steerWithImages(input.text, input.images ?? []);\n\t\t} catch (cause) {\n\t\t\tthis.reportError(cause);\n\t\t}\n\t}\n\n\tprivate subscribeSession(): void {\n\t\tthis.unsubscribeSession = this.session.subscribeSession((event) => {\n\t\t\tif (event.type === \"queue_update\") this.projection.setQueue(event.steering);\n\t\t\telse if (event.type === \"tree_navigated\") this.projection.replaceTranscript(this.session.transcript);\n\t\t\telse if (event.type.startsWith(\"subagent_\")) {\n\t\t\t\t// Subagent state is read through the restricted controller projection above.\n\t\t\t} else this.projection.apply(event);\n\t\t\tthis.emit({ type: \"session_event\", event });\n\t\t\tthis.emitState();\n\t\t});\n\t}\n\n\tprivate emitState(): void {\n\t\tthis.emit({ type: \"state\", state: this.state });\n\t}\n\n\tprivate emit(event: InteractiveViewEvent): void {\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch (cause) {\n\t\t\t\tthis.reportError(cause);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate reportError(cause: unknown): void {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthis.projection.setError(message);\n\t\tfor (const listener of this.listeners) listener({ type: \"diagnostic\", message });\n\t\tthis.emitState();\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interactive/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interactive/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./builtin.ts\";\nexport * from \"./controller.ts\";\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginDefinition } from "@di-code/plugin-runtime";
|
|
2
|
+
/** Owns the interactive ProductHost and gives the presentation mode only its UiHost facade. */
|
|
3
|
+
export declare const apiVersion: 1;
|
|
4
|
+
export declare const name = "interactive-host";
|
|
5
|
+
export declare const version = "0.1.7";
|
|
6
|
+
export declare const apply: PluginDefinition["apply"];
|
|
7
|
+
//# sourceMappingURL=interactive-host-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-host-entry.d.ts","sourceRoot":"","sources":["../src/interactive-host-entry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA6BhE,+FAA+F;AAC/F,eAAO,MAAM,UAAU,EAAG,CAAU,CAAC;AACrC,eAAO,MAAM,IAAI,qBAAqB,CAAC;AACvC,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,KAAK,EAAE,gBAAgB,CAAC,OAAO,CA6F3C,CAAC"}
|