@zhushanwen/pi-subagent-workflow 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -13
- package/relay/relay.mjs +1 -1
- package/src/host/__tests__/pi-host.test.ts +214 -0
- package/src/host/pi-host.ts +109 -0
- package/src/index.ts +89 -32
- package/src/injectors/__tests__/engine-awareness.test.ts +292 -0
- package/src/injectors/__tests__/engine-section-stability.test.ts +341 -0
- package/src/injectors/__tests__/subagent-list-injector.test.ts +5 -5
- package/src/injectors/__tests__/workflow-list-injector.test.ts +5 -5
- package/src/injectors/engine-awareness.ts +123 -0
- package/src/injectors/model-list-injector.ts +1 -1
- package/src/injectors/subagent-list-injector.ts +8 -8
- package/src/injectors/workflow-list-injector.ts +8 -8
- package/src/interface/__tests__/detectors.test.ts +3 -3
- package/src/interface/__tests__/subagent-tool-path-guard.test.ts +2 -2
- package/src/interface/__tests__/tool-workflow-script-generate.test.ts +2 -2
- package/src/interface/__tests__/tool-workflow-throw-paths.test.ts +1 -1
- package/src/interface/bg-notify-render.ts +4 -4
- package/src/interface/commands.ts +3 -3
- package/src/interface/format.ts +2 -2
- package/src/interface/helpers.ts +1 -1
- package/src/interface/list-component.ts +4 -4
- package/src/interface/list-shared.ts +2 -2
- package/src/interface/list-view.ts +2 -2
- package/src/interface/subagent-actions.ts +263 -11
- package/src/interface/subagent-tool-schema.ts +20 -13
- package/src/interface/subagent-tool.ts +11 -6
- package/src/interface/subagents.ts +3 -3
- package/src/interface/tool-render.ts +34 -2
- package/src/interface/tool-workflow-script.ts +4 -4
- package/src/interface/tool-workflow.ts +6 -6
- package/src/interface/views/WorkflowsView.ts +5 -5
- package/src/interface/views/__tests__/WorkflowsView-signature.test.ts +3 -3
- package/src/interface/views/__tests__/detail-content-session-file.test.ts +2 -2
- package/src/interface/views/detail-content.ts +4 -4
- package/src/interface/views/format.ts +4 -4
- package/src/{orchestration/jsonl-run-store.ts → jsonl-run-store.ts} +11 -11
- package/src/execution/__tests__/__fixtures__/notifier-golden-snapshots.json +0 -53
- package/src/execution/__tests__/__fixtures__/truncline.snapshot.json +0 -1
- package/src/execution/__tests__/agent-registry.test.ts +0 -363
- package/src/execution/__tests__/agent-result-mapper.test.ts +0 -150
- package/src/execution/__tests__/alive-store.test.ts +0 -147
- package/src/execution/__tests__/ask-user-transit-e2e.test.ts +0 -490
- package/src/execution/__tests__/before-agent-start-injection.test.ts +0 -132
- package/src/execution/__tests__/bg-notify-render.test.ts +0 -329
- package/src/execution/__tests__/channel-registry-handshake.test.ts +0 -243
- package/src/execution/__tests__/chat-engine-routing.test.ts +0 -601
- package/src/execution/__tests__/chatmode-first-round-closure-service.test.ts +0 -365
- package/src/execution/__tests__/chatmode-first-round-closure-spawn.test.ts +0 -190
- package/src/execution/__tests__/chatmode-round-notify-real-chain.test.ts +0 -215
- package/src/execution/__tests__/concurrency-pool.test.ts +0 -250
- package/src/execution/__tests__/config.test.ts +0 -110
- package/src/execution/__tests__/conversation-wiring.test.ts +0 -198
- package/src/execution/__tests__/crash-recovery.test.ts +0 -320
- package/src/execution/__tests__/delivery-methods.test.ts +0 -422
- package/src/execution/__tests__/dialog-queue.test.ts +0 -299
- package/src/execution/__tests__/epipe-fallback.test.ts +0 -241
- package/src/execution/__tests__/execute-and-await-worktree.test.ts +0 -243
- package/src/execution/__tests__/execute-nesting.test.ts +0 -323
- package/src/execution/__tests__/execute-options-mapper.test.ts +0 -200
- package/src/execution/__tests__/execution-record.test.ts +0 -1394
- package/src/execution/__tests__/explicit-agent-ref-guard.test.ts +0 -171
- package/src/execution/__tests__/finalize-record.test.ts +0 -368
- package/src/execution/__tests__/finalized-marker.test.ts +0 -82
- package/src/execution/__tests__/format-schema-instruction.test.ts +0 -169
- package/src/execution/__tests__/format.test.ts +0 -458
- package/src/execution/__tests__/gc-timer.test.ts +0 -184
- package/src/execution/__tests__/get-record-for-action-restart.test.ts +0 -254
- package/src/execution/__tests__/gui-mode-dispatch.test.ts +0 -59
- package/src/execution/__tests__/helpers/mock-extension-api.ts +0 -30
- package/src/execution/__tests__/helpers/spawn-mock.ts +0 -242
- package/src/execution/__tests__/host-mode.test.ts +0 -87
- package/src/execution/__tests__/index-session-start-identity.test.ts +0 -371
- package/src/execution/__tests__/index-session-start.test.ts +0 -672
- package/src/execution/__tests__/lifecycle-manager-lock.test.ts +0 -211
- package/src/execution/__tests__/lifecycle-manager.test.ts +0 -383
- package/src/execution/__tests__/lifecycle-predicates.test.ts +0 -116
- package/src/execution/__tests__/list-component.test.ts +0 -401
- package/src/execution/__tests__/list-fields.test.ts +0 -140
- package/src/execution/__tests__/manifest-parentid.test.ts +0 -117
- package/src/execution/__tests__/model-resolver.test.ts +0 -465
- package/src/execution/__tests__/nested-visibility-env-propagation.test.ts +0 -287
- package/src/execution/__tests__/nested-visibility.test.ts +0 -325
- package/src/execution/__tests__/notifier-flush.test.ts +0 -612
- package/src/execution/__tests__/notifier-golden-snapshot.test.ts +0 -261
- package/src/execution/__tests__/notify-ledger.test.ts +0 -826
- package/src/execution/__tests__/one-shot-upgrade.test.ts +0 -205
- package/src/execution/__tests__/output-collector.test.ts +0 -358
- package/src/execution/__tests__/parent-child-matrix.test.ts +0 -336
- package/src/execution/__tests__/path-encoding.test.ts +0 -104
- package/src/execution/__tests__/pi-invocation.test.ts +0 -134
- package/src/execution/__tests__/record-store.test.ts +0 -1057
- package/src/execution/__tests__/records-cwd-isolation.test.ts +0 -91
- package/src/execution/__tests__/recursive-visibility-baseline.test.ts +0 -339
- package/src/execution/__tests__/recursive-visibility-env.test.ts +0 -273
- package/src/execution/__tests__/relay-agent.test.ts +0 -448
- package/src/execution/__tests__/relay-env.test.ts +0 -42
- package/src/execution/__tests__/resource-policy.test.ts +0 -109
- package/src/execution/__tests__/rpc-mode.test.ts +0 -89
- package/src/execution/__tests__/run-and-finalize-chatmode.test.ts +0 -267
- package/src/execution/__tests__/run-spawn-chatmode-settled.test.ts +0 -253
- package/src/execution/__tests__/run-spawn-edges.test.ts +0 -687
- package/src/execution/__tests__/run-spawn-integration.test.ts +0 -933
- package/src/execution/__tests__/run-spawn-resume.test.ts +0 -322
- package/src/execution/__tests__/run-spawn-rpc-mode.test.ts +0 -196
- package/src/execution/__tests__/run-spawn-stdout-callback-throw.test.ts +0 -199
- package/src/execution/__tests__/sdk-contract.test.ts +0 -273
- package/src/execution/__tests__/session-context-resolver.test.ts +0 -167
- package/src/execution/__tests__/session-file-gc.test.ts +0 -293
- package/src/execution/__tests__/session-pending.test.ts +0 -197
- package/src/execution/__tests__/session-reconstructor.test.ts +0 -379
- package/src/execution/__tests__/session-runner-epipe.test.ts +0 -178
- package/src/execution/__tests__/session-runner-schema-env.test.ts +0 -350
- package/src/execution/__tests__/session-start-reaper.test.ts +0 -233
- package/src/execution/__tests__/spawn-args.test.ts +0 -445
- package/src/execution/__tests__/spawn-event-adapter-rpc.test.ts +0 -189
- package/src/execution/__tests__/spawn-event-adapter.test.ts +0 -167
- package/src/execution/__tests__/spawn-worktree-guidance.test.ts +0 -207
- package/src/execution/__tests__/spawned-children.test.ts +0 -92
- package/src/execution/__tests__/start-sync-model-guard.test.ts +0 -150
- package/src/execution/__tests__/startup-config-declaration.test.ts +0 -35
- package/src/execution/__tests__/status-refactor.test.ts +0 -345
- package/src/execution/__tests__/stdin-writer.test.ts +0 -463
- package/src/execution/__tests__/stream-sink-retirement.test.ts +0 -261
- package/src/execution/__tests__/subagent-service-abort.test.ts +0 -60
- package/src/execution/__tests__/subagent-service-message-close.test.ts +0 -629
- package/src/execution/__tests__/subagent-service-parent-guard.test.ts +0 -180
- package/src/execution/__tests__/subagent-service.test.ts +0 -788
- package/src/execution/__tests__/subprocess-agent-runner-routing.test.ts +0 -310
- package/src/execution/__tests__/subprocess-agent-runner.test.ts +0 -599
- package/src/execution/__tests__/temp-prompt.test.ts +0 -53
- package/src/execution/__tests__/timeout-integration.test.ts +0 -615
- package/src/execution/__tests__/tombstone-store.test.ts +0 -73
- package/src/execution/__tests__/tool-action.test.ts +0 -476
- package/src/execution/__tests__/truncline-snapshot.test.ts +0 -81
- package/src/execution/__tests__/turn-limiter-semantics.test.ts +0 -194
- package/src/execution/__tests__/turn-limiter.test.ts +0 -65
- package/src/execution/__tests__/ui-channels.test.ts +0 -187
- package/src/execution/__tests__/ui-interaction-model.test.ts +0 -67
- package/src/execution/__tests__/ui-request-handler-factory.test.ts +0 -370
- package/src/execution/__tests__/ui-request-handler.test.ts +0 -204
- package/src/execution/__tests__/ui-request-observability.test.ts +0 -114
- package/src/execution/__tests__/ui-request-queue.test.ts +0 -133
- package/src/execution/__tests__/worktree-manager.test.ts +0 -633
- package/src/execution/__tests__/worktree-pid-registration.integration.test.ts +0 -229
- package/src/execution/__tests__/worktree-reconcile.integration.test.ts +0 -181
- package/src/execution/__tests__/worktree-registry.test.ts +0 -199
- package/src/execution/agent-registry.ts +0 -199
- package/src/execution/agent-result-mapper.ts +0 -90
- package/src/execution/alive-store.ts +0 -92
- package/src/execution/argv-mirror.ts +0 -113
- package/src/execution/best-effort.ts +0 -38
- package/src/execution/channel-registry-access.ts +0 -144
- package/src/execution/concurrency-pool.ts +0 -116
- package/src/execution/config.ts +0 -96
- package/src/execution/dialog-queue.ts +0 -330
- package/src/execution/engine/__tests__/common/data-dir.test.ts +0 -53
- package/src/execution/engine/__tests__/common/errors.test.ts +0 -132
- package/src/execution/engine/__tests__/common/event-journal.test.ts +0 -177
- package/src/execution/engine/__tests__/common/kill-chain.test.ts +0 -192
- package/src/execution/engine/__tests__/common/nesting-guard.test.ts +0 -81
- package/src/execution/engine/__tests__/common/persona-router.test.ts +0 -123
- package/src/execution/engine/__tests__/common/pool-manager.test.ts +0 -154
- package/src/execution/engine/__tests__/common/schema-emulation.test.ts +0 -128
- package/src/execution/engine/__tests__/conformance/__fixtures__/pi-golden-events.json +0 -28
- package/src/execution/engine/__tests__/conformance/agent-event-invariants.ts +0 -141
- package/src/execution/engine/__tests__/conformance/contract.abort.test.ts +0 -109
- package/src/execution/engine/__tests__/conformance/contract.agent-events.test.ts +0 -101
- package/src/execution/engine/__tests__/conformance/contract.probe.test.ts +0 -77
- package/src/execution/engine/__tests__/conformance/contract.read-degradation.test.ts +0 -104
- package/src/execution/engine/__tests__/conformance/contract.relay.test.ts +0 -342
- package/src/execution/engine/__tests__/conformance/engine-conformance.live.test.ts +0 -201
- package/src/execution/engine/__tests__/conformance/golden-replay.pi.test.ts +0 -76
- package/src/execution/engine/__tests__/conformance/golden-replay.zcode.test.ts +0 -79
- package/src/execution/engine/__tests__/engine-discovery.test.ts +0 -87
- package/src/execution/engine/__tests__/engines-declaration.test.ts +0 -36
- package/src/execution/engine/__tests__/model-prompt.test.ts +0 -85
- package/src/execution/engine/__tests__/paths.test.ts +0 -39
- package/src/execution/engine/__tests__/registry.test.ts +0 -120
- package/src/execution/engine/__tests__/routing.test.ts +0 -231
- package/src/execution/engine/common/data-dir.ts +0 -62
- package/src/execution/engine/common/errors.ts +0 -183
- package/src/execution/engine/common/event-journal.ts +0 -254
- package/src/execution/engine/common/journal-replay.ts +0 -62
- package/src/execution/engine/common/kill-chain.ts +0 -221
- package/src/execution/engine/common/nesting-guard.ts +0 -50
- package/src/execution/engine/common/persona-router.ts +0 -108
- package/src/execution/engine/common/pool-manager.ts +0 -226
- package/src/execution/engine/common/schema-emulation.ts +0 -189
- package/src/execution/engine/common/session-view-projection.ts +0 -51
- package/src/execution/engine/engine-discovery.ts +0 -65
- package/src/execution/engine/engines/pi/__tests__/pi-engine.test.ts +0 -469
- package/src/execution/engine/engines/pi/__tests__/reader.test.ts +0 -155
- package/src/execution/engine/engines/pi/__tests__/task-spec-mapper.test.ts +0 -164
- package/src/execution/engine/engines/pi/pi-engine.ts +0 -415
- package/src/execution/engine/engines/pi/reader.ts +0 -48
- package/src/execution/engine/engines/pi/registration.ts +0 -35
- package/src/execution/engine/engines/pi/task-spec-mapper.ts +0 -100
- package/src/execution/engine/engines/zcode/__tests__/__fixtures__/zcode-golden-spawn.json +0 -39
- package/src/execution/engine/engines/zcode/__tests__/launcher.test.ts +0 -150
- package/src/execution/engine/engines/zcode/__tests__/parser.test.ts +0 -246
- package/src/execution/engine/engines/zcode/__tests__/preparer.test.ts +0 -228
- package/src/execution/engine/engines/zcode/__tests__/reader.test.ts +0 -210
- package/src/execution/engine/engines/zcode/__tests__/registration.test.ts +0 -64
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.live.test.ts +0 -127
- package/src/execution/engine/engines/zcode/__tests__/zcode-engine.test.ts +0 -580
- package/src/execution/engine/engines/zcode/constants.ts +0 -43
- package/src/execution/engine/engines/zcode/golden-sample.ts +0 -39
- package/src/execution/engine/engines/zcode/launcher.ts +0 -161
- package/src/execution/engine/engines/zcode/parser.ts +0 -436
- package/src/execution/engine/engines/zcode/preparer.ts +0 -363
- package/src/execution/engine/engines/zcode/reader.ts +0 -381
- package/src/execution/engine/engines/zcode/registration.ts +0 -37
- package/src/execution/engine/engines/zcode/zcode-engine.ts +0 -658
- package/src/execution/engine/host-task-spec.ts +0 -47
- package/src/execution/engine/model-prompt.ts +0 -59
- package/src/execution/engine/paths.ts +0 -42
- package/src/execution/engine/port.ts +0 -153
- package/src/execution/engine/registry.ts +0 -123
- package/src/execution/engine/routing.ts +0 -218
- package/src/execution/engine/types.ts +0 -309
- package/src/execution/execute-options-mapper.ts +0 -112
- package/src/execution/execution-record.ts +0 -965
- package/src/execution/finalize-record.ts +0 -251
- package/src/execution/finalized-marker.ts +0 -51
- package/src/execution/get-state-handshake.ts +0 -104
- package/src/execution/host-mode.ts +0 -56
- package/src/execution/idle-gc.ts +0 -47
- package/src/execution/lifecycle-manager.ts +0 -513
- package/src/execution/lifecycle-predicates.ts +0 -65
- package/src/execution/manifest-store.ts +0 -256
- package/src/execution/model-config-service.ts +0 -219
- package/src/execution/model-resolver.ts +0 -248
- package/src/execution/notifier.ts +0 -330
- package/src/execution/notify-ledger.ts +0 -580
- package/src/execution/output-collector.ts +0 -228
- package/src/execution/path-encoding.ts +0 -60
- package/src/execution/pi-invocation.ts +0 -120
- package/src/execution/record-entry.ts +0 -132
- package/src/execution/record-store.ts +0 -1234
- package/src/execution/relay-env.ts +0 -37
- package/src/execution/session-context-resolver.ts +0 -64
- package/src/execution/session-file-gc.ts +0 -120
- package/src/execution/session-pending.ts +0 -164
- package/src/execution/session-reconstructor.ts +0 -678
- package/src/execution/session-runner.ts +0 -1781
- package/src/execution/sessions-index.ts +0 -304
- package/src/execution/spawn-event-adapter.ts +0 -363
- package/src/execution/stdin-writer.ts +0 -198
- package/src/execution/stream-sink.ts +0 -126
- package/src/execution/subagent-service.ts +0 -2141
- package/src/execution/subprocess-agent-runner.ts +0 -317
- package/src/execution/temp-prompt.ts +0 -62
- package/src/execution/tombstone-store.ts +0 -72
- package/src/execution/turn-limiter.ts +0 -102
- package/src/execution/types.ts +0 -973
- package/src/execution/ui-channels.ts +0 -216
- package/src/execution/ui-interaction-model.ts +0 -48
- package/src/execution/ui-request-handler-factory.ts +0 -212
- package/src/execution/ui-request-observability.ts +0 -81
- package/src/execution/ui-request-queue.ts +0 -184
- package/src/execution/worktree-manager.ts +0 -688
- package/src/execution/worktree-registry.ts +0 -222
- package/src/orchestration/__tests__/__fixtures__/worker-template.snapshot.txt +0 -349
- package/src/orchestration/__tests__/agent-call-catch-fallback.test.ts +0 -202
- package/src/orchestration/__tests__/agent-call-stream.test.ts +0 -152
- package/src/orchestration/__tests__/args-validator.test.ts +0 -143
- package/src/orchestration/__tests__/config-loader.test.ts +0 -503
- package/src/orchestration/__tests__/error-recovery-handlers.test.ts +0 -809
- package/src/orchestration/__tests__/error-recovery-postmessage-defense.test.ts +0 -405
- package/src/orchestration/__tests__/error-recovery-serialize-failed-result.test.ts +0 -56
- package/src/orchestration/__tests__/error-recovery-workflow-call.test.ts +0 -166
- package/src/orchestration/__tests__/execute-agent-call.test.ts +0 -451
- package/src/orchestration/__tests__/jsonl-run-store-corrupt-entry.test.ts +0 -150
- package/src/orchestration/__tests__/jsonl-run-store-loadall-sources.test.ts +0 -171
- package/src/orchestration/__tests__/jsonl-run-store-retention.test.ts +0 -202
- package/src/orchestration/__tests__/jsonl-run-store-session-file.test.ts +0 -1030
- package/src/orchestration/__tests__/launcher-nested-workflow.test.ts +0 -600
- package/src/orchestration/__tests__/lifecycle-runid-injection.test.ts +0 -96
- package/src/orchestration/__tests__/lifecycle.test.ts +0 -659
- package/src/orchestration/__tests__/non-cloneable-return-e2e.test.ts +0 -95
- package/src/orchestration/__tests__/review-fix-loop-e2e.test.ts +0 -2025
- package/src/orchestration/__tests__/script-lint.test.ts +0 -831
- package/src/orchestration/__tests__/skill-discovery.test.ts +0 -201
- package/src/orchestration/__tests__/test-mocks.ts +0 -197
- package/src/orchestration/__tests__/worker-exit-without-result.test.ts +0 -368
- package/src/orchestration/__tests__/worker-host.test.ts +0 -120
- package/src/orchestration/__tests__/worker-returnmeta-passthrough.test.ts +0 -164
- package/src/orchestration/__tests__/worker-script-builder-runtime.test.ts +0 -563
- package/src/orchestration/__tests__/worker-script-builder.test.ts +0 -309
- package/src/orchestration/__tests__/worker-script-template-snapshot.test.ts +0 -129
- package/src/orchestration/__tests__/workflow-nesting-e2e.test.ts +0 -317
- package/src/orchestration/__tests__/workflow-script-lint-memo.test.ts +0 -110
- package/src/orchestration/__tests__/workflows-e2e.test.ts +0 -537
- package/src/orchestration/agent-opts-resolver.ts +0 -174
- package/src/orchestration/args-validator.ts +0 -127
- package/src/orchestration/config-loader.ts +0 -315
- package/src/orchestration/error-recovery.ts +0 -1018
- package/src/orchestration/execute-agent-call.ts +0 -256
- package/src/orchestration/launcher.ts +0 -455
- package/src/orchestration/lifecycle.ts +0 -399
- package/src/orchestration/models/__tests__/budget.test.ts +0 -307
- package/src/orchestration/models/__tests__/trace.test.ts +0 -408
- package/src/orchestration/models/agent-call.ts +0 -83
- package/src/orchestration/models/budget.ts +0 -118
- package/src/orchestration/models/ports.ts +0 -164
- package/src/orchestration/models/run-runtime.ts +0 -104
- package/src/orchestration/models/run-spec.ts +0 -83
- package/src/orchestration/models/run-state.ts +0 -44
- package/src/orchestration/models/trace.ts +0 -183
- package/src/orchestration/models/types.ts +0 -301
- package/src/orchestration/models/workflow-run.ts +0 -254
- package/src/orchestration/models/workflow-script-registry.ts +0 -35
- package/src/orchestration/models/workflow-script.ts +0 -117
- package/src/orchestration/script-lint.ts +0 -766
- package/src/orchestration/skill-discovery.ts +0 -115
- package/src/orchestration/worker-handle.ts +0 -115
- package/src/orchestration/worker-host.ts +0 -98
- package/src/orchestration/worker-script-builder.ts +0 -421
- package/src/orchestration/workflow-files.ts +0 -85
- package/src/orchestration/workflow-script-registry-impl.ts +0 -133
- package/src/shared/__tests__/agent-ref.test.ts +0 -34
- package/src/shared/__tests__/meta-parser.test.ts +0 -304
- package/src/shared/__tests__/model-ref.test.ts +0 -306
- package/src/shared/__tests__/resource-discovery-manifest-cache.test.ts +0 -280
- package/src/shared/__tests__/resource-discovery.test.ts +0 -736
- package/src/shared/__tests__/resource-meta.test.ts +0 -51
- package/src/shared/__tests__/schema-jsonify.test.ts +0 -81
- package/src/shared/__tests__/timer-delay.test.ts +0 -61
- package/src/shared/agent-event.ts +0 -13
- package/src/shared/agent-ref.ts +0 -57
- package/src/shared/meta-parser.ts +0 -261
- package/src/shared/model-ref.ts +0 -286
- package/src/shared/resource-discovery.ts +0 -811
- package/src/shared/resource-meta.ts +0 -65
- package/src/shared/schema-env.ts +0 -44
- package/src/shared/schema-jsonify.ts +0 -58
- package/src/shared/timer-delay.ts +0 -54
- package/src/shared/xml-injection.ts +0 -35
- package/workflows/README.md +0 -81
- package/workflows/_shared/agent-refs.cjs +0 -40
- package/workflows/chain.js +0 -131
- package/workflows/map-reduce.js +0 -174
- package/workflows/parallel.js +0 -148
- package/workflows/review-fix-loop-utils.cjs +0 -1309
- package/workflows/review-fix-loop.js +0 -1404
- package/workflows/scatter-gather.js +0 -178
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
12
12
|
|
|
13
|
-
import type { DiscoveredResource } from "
|
|
13
|
+
import type { DiscoveredResource } from "@zhushanwen/subagent-core/shared/resource-discovery.ts";
|
|
14
14
|
// 共享 mock 基建(vi.mock 工厂 / mock pi / mock ctx):helpers/injector-test-mocks.ts
|
|
15
15
|
import { createDiscoveryModuleMock, createLoggerModuleMock, createMockCtx, createMockPi, type CapturedHandlers } from "./helpers/injector-test-mocks.ts";
|
|
16
16
|
|
|
17
17
|
// ── 稳定 spy(vi.hoisted 保证 resetModules 后引用不变,见 subagent 测试同款注释) ──
|
|
18
18
|
const spies = vi.hoisted(() => ({ discoverResources: vi.fn(), getCachedFileContent: vi.fn() }));
|
|
19
19
|
|
|
20
|
-
vi.mock("
|
|
20
|
+
vi.mock("@zhushanwen/subagent-core/shared/resource-discovery.ts", () => createDiscoveryModuleMock(spies));
|
|
21
21
|
|
|
22
22
|
// 工厂必须写成箭头惰性形式(vi.mock 提升后直接传引用会 TDZ,见 helper 文件头注释)
|
|
23
23
|
vi.mock("@zhushanwen/pi-extension-logger", () => createLoggerModuleMock());
|
|
@@ -293,7 +293,7 @@ describe("discoverAllWorkflows 顺序契约(KV-cache)", () => {
|
|
|
293
293
|
spies.getCachedFileContent.mockImplementation((p: string) => byPath[p] ?? null);
|
|
294
294
|
|
|
295
295
|
const { discoverAllWorkflows } = await import("../workflow-list-injector");
|
|
296
|
-
const workflows = await discoverAllWorkflows("/ws"
|
|
296
|
+
const workflows = await discoverAllWorkflows("/ws");
|
|
297
297
|
expect(workflows.map((w) => w.name)).toEqual(["alpha", "chain", "zeta"]);
|
|
298
298
|
});
|
|
299
299
|
|
|
@@ -314,8 +314,8 @@ describe("discoverAllWorkflows 顺序契约(KV-cache)", () => {
|
|
|
314
314
|
spies.getCachedFileContent.mockImplementation((p: string) => byPath[p] ?? null);
|
|
315
315
|
|
|
316
316
|
const { discoverAllWorkflows, formatWorkflowList } = await import("../workflow-list-injector");
|
|
317
|
-
const first = await discoverAllWorkflows("/ws"
|
|
318
|
-
const second = await discoverAllWorkflows("/ws"
|
|
317
|
+
const first = await discoverAllWorkflows("/ws");
|
|
318
|
+
const second = await discoverAllWorkflows("/ws");
|
|
319
319
|
expect(second).toEqual(first);
|
|
320
320
|
expect(formatWorkflowList(second)).toBe(formatWorkflowList(first));
|
|
321
321
|
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// src/injectors/engine-awareness.ts
|
|
2
|
+
//
|
|
3
|
+
// [engine-awareness U3] 引擎感知检测编排。设计权威源:
|
|
4
|
+
// docs/design/subagent-engine-awareness-injection.md §2.3 物理数据流 /
|
|
5
|
+
// §3.3 D1(per-turn poll)、D1b(lastEngine 初始化与静默基线化)、D2(reload 先行)、
|
|
6
|
+
// D3(通知通道)、D5(三态读取语义)。
|
|
7
|
+
//
|
|
8
|
+
// 职责:per-turn(before_agent_start)三态 poll 全局 config → 与 per-session
|
|
9
|
+
// lastEngine diff → 变更时按硬约束顺序编排:提交读取结果到路由缓存(D2,先于一切——
|
|
10
|
+
// 只改注入不改路由会出现「prompt 说引擎 B、实际派发跑引擎 A」,权威信息源说谎)
|
|
11
|
+
// → sendMessage 对话流通知(D3/D4,短文案不含任何模型清单)→ 更新 lastEngine。
|
|
12
|
+
//
|
|
13
|
+
// 本模块是无状态纯编排(依赖注入式,可测);状态(lastEngine)与宿主能力
|
|
14
|
+
// (readConfig / applyRead / sendMessage)由 index.ts engine handler 装配注入。
|
|
15
|
+
|
|
16
|
+
import { getLogger } from "@zhushanwen/pi-extension-logger";
|
|
17
|
+
|
|
18
|
+
import type { GlobalConfigReadResult } from "@zhushanwen/subagent-core/execution/config.ts";
|
|
19
|
+
import { DEFAULT_ENGINE_ID, normalizeEngineId } from "@zhushanwen/subagent-core/execution/engine/registry.ts";
|
|
20
|
+
|
|
21
|
+
const logger = getLogger("subagents");
|
|
22
|
+
|
|
23
|
+
/** 引擎变更通知 customType(D3;renderer/测试按此识别引擎变更消息)。 */
|
|
24
|
+
export const ENGINE_CHANGE_CUSTOM_TYPE = "subagent-engine-changed";
|
|
25
|
+
|
|
26
|
+
// normalizeEngineId 单一权威源在 registry.ts,此处再导出保持既有导入面(index.ts
|
|
27
|
+
// 与测试经本模块导入)不断裂。
|
|
28
|
+
export { normalizeEngineId };
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 引擎变更通知文案(设计 §3.1 英文基准,三行结构逐字骨架;D4:不含任何模型清单,
|
|
32
|
+
* 清单只活在 system prompt 现值一份)。指路段按目标引擎参数化,与
|
|
33
|
+
* <current_subagent_engine> 恒在段的分界语义一致:目标 pi → 指向核心段
|
|
34
|
+
* <available_provider_models>;非 pi → 指向该引擎清单段 <available_<engine>_models>。
|
|
35
|
+
*/
|
|
36
|
+
export function buildEngineChangeNotice(from: string, to: string): string {
|
|
37
|
+
const modelsLine =
|
|
38
|
+
to === DEFAULT_ENGINE_ID
|
|
39
|
+
? "Use pi-registry ids from <available_provider_models> for explicit models;"
|
|
40
|
+
: `Use ids from <available_${to}_models> for explicit models;`;
|
|
41
|
+
return [
|
|
42
|
+
`Subagent default engine changed: ${from} → ${to} (effective this turn).`,
|
|
43
|
+
modelsLine,
|
|
44
|
+
"omit `model` to inherit. The <current_subagent_engine> section reflects the current state.",
|
|
45
|
+
].join("\n");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 检测编排依赖(注入式)。生产装配在 index.ts engine handler;测试用 stub。 */
|
|
49
|
+
export interface EngineAwarenessDeps {
|
|
50
|
+
/** 三态读取全局 config(D5;生产 = () => readGlobalConfig(getAgentDir()))。 */
|
|
51
|
+
readConfig(): GlobalConfigReadResult;
|
|
52
|
+
/**
|
|
53
|
+
* D2:将本 turn 三态读取结果提交路由缓存(生产 = ModelConfigService.applyGlobalConfig,
|
|
54
|
+
* 纯赋值幂等;failed 已由编排层早退,到达此调用的必为 ok/absent)。
|
|
55
|
+
*/
|
|
56
|
+
applyRead(read: GlobalConfigReadResult): void;
|
|
57
|
+
/** 对话流通知投递(D3;生产 = pi.sendMessage(message, {}),不设 triggerTurn)。 */
|
|
58
|
+
sendMessage(message: {
|
|
59
|
+
customType: string;
|
|
60
|
+
content: string;
|
|
61
|
+
display: boolean;
|
|
62
|
+
details?: unknown;
|
|
63
|
+
}): void;
|
|
64
|
+
/** per-session lastEngine 读取(undefined = 未基线化,D1b)。 */
|
|
65
|
+
getLastEngine(): string | undefined;
|
|
66
|
+
/** per-session lastEngine 写入(仅合法引擎 id,不写 undefined)。 */
|
|
67
|
+
setLastEngine(engine: string): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 单次 per-turn 检测的编排结果(测试断言面 + 诊断留痕消费)。 */
|
|
71
|
+
export type EngineAwarenessOutcome =
|
|
72
|
+
| { outcome: "changed"; from: string; to: string }
|
|
73
|
+
| { outcome: "unchanged"; engine: string }
|
|
74
|
+
| { outcome: "baseline"; engine: string }
|
|
75
|
+
| { outcome: "read-failed"; reason: string };
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 单个 session 的 per-turn 引擎检测编排(§2.3 数据流 ①② 步;③ 渲染归 index.ts)。
|
|
79
|
+
*
|
|
80
|
+
* 分派(D5 三态 × D1b 基线):
|
|
81
|
+
* - read failed → 保持 lastEngine 不动、不提交缓存、不通知(防 torn write 瞬间伪通知);
|
|
82
|
+
* read-failure warn 日志由 readGlobalConfig 内部落,此处只返回结果。
|
|
83
|
+
* - lastEngine === undefined(session_start 初始化读失败的兜底形态)→ 静默基线化为
|
|
84
|
+
* 当前目标值:不算变更、不发通知(防「changed: undefined → zcode」首 turn 伪通知)。
|
|
85
|
+
* - last === target(absent 归一后同值也在内)→ 无事。
|
|
86
|
+
* - last ≠ target(含 ENOENT=合法缺省)→ 提交缓存先行 → 通知 → 记账,三步同 turn。
|
|
87
|
+
*
|
|
88
|
+
* 抛错面:不主动 try-catch——readGlobalConfig 三态返回不抛,applyRead/sendMessage 的
|
|
89
|
+
* 生产实现各自吞错;handler 顶层 catch 兜底(fail-safe 不阻塞 agent loop)。
|
|
90
|
+
*/
|
|
91
|
+
export function runEngineAwarenessTurn(deps: EngineAwarenessDeps): EngineAwarenessOutcome {
|
|
92
|
+
const read = deps.readConfig();
|
|
93
|
+
if (read.status === "failed") {
|
|
94
|
+
return { outcome: "read-failed", reason: read.reason };
|
|
95
|
+
}
|
|
96
|
+
const target = normalizeEngineId(read.config.defaultEngine);
|
|
97
|
+
const last = deps.getLastEngine();
|
|
98
|
+
if (last === undefined) {
|
|
99
|
+
// D1b(修订):基线化前把本 turn 读取结果提交到单例缓存。baseline 形态可能来自
|
|
100
|
+
// session_start 读取失败(lastEngine 未设置 + Service 缓存回落缺省)而文件此后被
|
|
101
|
+
// 修好——若只记账不提交,缓存/路由/状态段永停旧值且永不通知(「改 config 不生效」
|
|
102
|
+
// 以更隐蔽形态复活)。apply 纯赋值——检测值与缓存值构造性同源,重复提交无害。
|
|
103
|
+
deps.applyRead(read);
|
|
104
|
+
deps.setLastEngine(target);
|
|
105
|
+
return { outcome: "baseline", engine: target };
|
|
106
|
+
}
|
|
107
|
+
if (last === target) {
|
|
108
|
+
return { outcome: "unchanged", engine: target };
|
|
109
|
+
}
|
|
110
|
+
// D2 顺序硬约束:先提交读取结果到路由缓存(本 turn 路由 + 渲染同源生效)→ 再通知 → 再记账。
|
|
111
|
+
deps.applyRead(read);
|
|
112
|
+
deps.sendMessage({
|
|
113
|
+
customType: ENGINE_CHANGE_CUSTOM_TYPE,
|
|
114
|
+
content: buildEngineChangeNotice(last, target),
|
|
115
|
+
display: true,
|
|
116
|
+
details: { from: last, to: target },
|
|
117
|
+
});
|
|
118
|
+
deps.setLastEngine(target);
|
|
119
|
+
logger.debug(
|
|
120
|
+
`[engine-awareness] default engine changed: ${last} -> ${target} (route reloaded, notice sent)`,
|
|
121
|
+
);
|
|
122
|
+
return { outcome: "changed", from: last, to: target };
|
|
123
|
+
}
|
|
@@ -35,7 +35,7 @@ import type {
|
|
|
35
35
|
} from "@earendil-works/pi-coding-agent";
|
|
36
36
|
import { getLogger } from "@zhushanwen/pi-extension-logger";
|
|
37
37
|
|
|
38
|
-
import { escapeXml, renderXmlSection } from "
|
|
38
|
+
import { escapeXml, renderXmlSection } from "@zhushanwen/subagent-core/shared/xml-injection.ts";
|
|
39
39
|
|
|
40
40
|
const logger = getLogger("injector");
|
|
41
41
|
|
|
@@ -28,17 +28,18 @@ import type {
|
|
|
28
28
|
SessionShutdownEvent,
|
|
29
29
|
SessionStartEvent,
|
|
30
30
|
} from "@earendil-works/pi-coding-agent";
|
|
31
|
-
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
32
31
|
import { getLogger } from "@zhushanwen/pi-extension-logger";
|
|
33
32
|
|
|
33
|
+
import { getHostServices } from "@zhushanwen/subagent-core/core/host-services.ts";
|
|
34
|
+
|
|
34
35
|
import {
|
|
35
36
|
discoverResources,
|
|
36
37
|
findWorkspaceRoot,
|
|
37
38
|
getCachedFileContent,
|
|
38
39
|
getCachedParsed,
|
|
39
|
-
} from "
|
|
40
|
-
import { parseResourceMeta } from "
|
|
41
|
-
import { escapeXml, renderXmlSection } from "
|
|
40
|
+
} from "@zhushanwen/subagent-core/shared/resource-discovery.ts";
|
|
41
|
+
import { parseResourceMeta } from "@zhushanwen/subagent-core/shared/meta-parser.ts";
|
|
42
|
+
import { escapeXml, renderXmlSection } from "@zhushanwen/subagent-core/shared/xml-injection.ts";
|
|
42
43
|
|
|
43
44
|
const logger = getLogger("injector");
|
|
44
45
|
|
|
@@ -112,12 +113,13 @@ export function parseAgentFrontmatter(content: string): AgentEntry | null {
|
|
|
112
113
|
*/
|
|
113
114
|
export async function discoverAllAgents(
|
|
114
115
|
workspaceRoot: string,
|
|
115
|
-
agentDir: string,
|
|
116
116
|
): Promise<AgentEntry[]> {
|
|
117
117
|
const resources = await discoverResources({
|
|
118
118
|
kind: "agents",
|
|
119
119
|
workspaceRoot,
|
|
120
|
-
|
|
120
|
+
// 宿主注入根现取(pi 壳 discoveryRoots 每次现取 getAgentDir,实例隔离);
|
|
121
|
+
// agentDir 形参已删——其唯一用途就是喂 ScanConfig(u0-data-discovery 偏差 #7)
|
|
122
|
+
hostRoots: getHostServices().discoveryRoots?.()?.agents ?? [],
|
|
121
123
|
});
|
|
122
124
|
|
|
123
125
|
const agentMap = new Map<string, AgentEntry>();
|
|
@@ -214,7 +216,6 @@ export function setupSubagentListInjector(pi: ExtensionAPI): void {
|
|
|
214
216
|
setAgentCache(
|
|
215
217
|
await discoverAllAgents(
|
|
216
218
|
findWorkspaceRoot(ctx.cwd),
|
|
217
|
-
getAgentDir(),
|
|
218
219
|
),
|
|
219
220
|
);
|
|
220
221
|
} catch (err) {
|
|
@@ -238,7 +239,6 @@ export function setupSubagentListInjector(pi: ExtensionAPI): void {
|
|
|
238
239
|
setAgentCache(
|
|
239
240
|
await discoverAllAgents(
|
|
240
241
|
findWorkspaceRoot(ctx.cwd),
|
|
241
|
-
getAgentDir(),
|
|
242
242
|
),
|
|
243
243
|
);
|
|
244
244
|
}
|
|
@@ -25,16 +25,17 @@ import type {
|
|
|
25
25
|
SessionShutdownEvent,
|
|
26
26
|
SessionStartEvent,
|
|
27
27
|
} from "@earendil-works/pi-coding-agent";
|
|
28
|
-
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
29
28
|
import { getLogger } from "@zhushanwen/pi-extension-logger";
|
|
30
29
|
|
|
30
|
+
import { getHostServices } from "@zhushanwen/subagent-core/core/host-services.ts";
|
|
31
|
+
|
|
31
32
|
import {
|
|
32
33
|
discoverResources,
|
|
33
34
|
findWorkspaceRoot,
|
|
34
35
|
getCachedParsed,
|
|
35
|
-
} from "
|
|
36
|
-
import { parseResourceMeta } from "
|
|
37
|
-
import { escapeXml, renderXmlSection } from "
|
|
36
|
+
} from "@zhushanwen/subagent-core/shared/resource-discovery.ts";
|
|
37
|
+
import { parseResourceMeta } from "@zhushanwen/subagent-core/shared/meta-parser.ts";
|
|
38
|
+
import { escapeXml, renderXmlSection } from "@zhushanwen/subagent-core/shared/xml-injection.ts";
|
|
38
39
|
|
|
39
40
|
const logger = getLogger("injector");
|
|
40
41
|
|
|
@@ -114,12 +115,13 @@ export function parseWorkflowMeta(content: string): WorkflowEntry | null {
|
|
|
114
115
|
*/
|
|
115
116
|
export async function discoverAllWorkflows(
|
|
116
117
|
workspaceRoot: string,
|
|
117
|
-
agentDir: string,
|
|
118
118
|
): Promise<WorkflowEntry[]> {
|
|
119
119
|
const resources = await discoverResources({
|
|
120
120
|
kind: "workflows",
|
|
121
121
|
workspaceRoot,
|
|
122
|
-
|
|
122
|
+
// 宿主注入根现取(pi 壳 discoveryRoots 每次现取 getAgentDir,实例隔离);
|
|
123
|
+
// agentDir 形参已删——其唯一用途就是喂 ScanConfig(u0-data-discovery 偏差 #7)
|
|
124
|
+
hostRoots: getHostServices().discoveryRoots?.()?.workflows ?? [],
|
|
123
125
|
includeTmp: true,
|
|
124
126
|
});
|
|
125
127
|
|
|
@@ -178,7 +180,6 @@ export function setupWorkflowListInjector(pi: ExtensionAPI): void {
|
|
|
178
180
|
setWorkflowCache(
|
|
179
181
|
await discoverAllWorkflows(
|
|
180
182
|
findWorkspaceRoot(ctx.cwd),
|
|
181
|
-
getAgentDir(),
|
|
182
183
|
),
|
|
183
184
|
);
|
|
184
185
|
} catch (err) {
|
|
@@ -202,7 +203,6 @@ export function setupWorkflowListInjector(pi: ExtensionAPI): void {
|
|
|
202
203
|
setWorkflowCache(
|
|
203
204
|
await discoverAllWorkflows(
|
|
204
205
|
findWorkspaceRoot(ctx.cwd),
|
|
205
|
-
getAgentDir(),
|
|
206
206
|
),
|
|
207
207
|
);
|
|
208
208
|
}
|
|
@@ -18,17 +18,17 @@ import { readFileSync } from "node:fs";
|
|
|
18
18
|
import { join } from "node:path";
|
|
19
19
|
|
|
20
20
|
import { argKeysFromMeta, findFlattenedArgKeys } from "../tool-workflow";
|
|
21
|
-
import { parseResourceMeta } from "
|
|
21
|
+
import { parseResourceMeta } from "@zhushanwen/subagent-core/shared/meta-parser.ts";
|
|
22
22
|
|
|
23
23
|
// 真实参数集(argKeysFromMeta 产物——m6 动态数据源,与 TC2 同源防漂移)
|
|
24
24
|
function rflKeys() {
|
|
25
|
-
const src = readFileSync(join(__dirname, "../../../workflows/review-fix-loop.js"), "utf-8");
|
|
25
|
+
const src = readFileSync(join(__dirname, "../../../node_modules/@zhushanwen/subagent-core/workflows/review-fix-loop.js"), "utf-8");
|
|
26
26
|
const meta = parseResourceMeta(src, "workflow");
|
|
27
27
|
if (!meta || meta.kind !== "workflow" || !meta.parameters) throw new Error("rfl meta");
|
|
28
28
|
return argKeysFromMeta(meta.parameters);
|
|
29
29
|
}
|
|
30
30
|
function chainKeys() {
|
|
31
|
-
const src = readFileSync(join(__dirname, "../../../workflows/chain.js"), "utf-8");
|
|
31
|
+
const src = readFileSync(join(__dirname, "../../../node_modules/@zhushanwen/subagent-core/workflows/chain.js"), "utf-8");
|
|
32
32
|
const meta = parseResourceMeta(src, "workflow");
|
|
33
33
|
if (!meta || meta.kind !== "workflow" || !meta.parameters) throw new Error("chain meta");
|
|
34
34
|
return argKeysFromMeta(meta.parameters);
|
|
@@ -39,12 +39,12 @@ vi.mock("typebox", () => ({
|
|
|
39
39
|
const { mockServiceExecute } = vi.hoisted(() => ({
|
|
40
40
|
mockServiceExecute: vi.fn(),
|
|
41
41
|
}));
|
|
42
|
-
vi.mock("
|
|
42
|
+
vi.mock("@zhushanwen/subagent-core/execution/subagent-service.ts", () => ({
|
|
43
43
|
getSubagentService: () => ({ execute: mockServiceExecute }),
|
|
44
44
|
}));
|
|
45
45
|
|
|
46
46
|
import { registerSubagentTool } from "../../interface/subagent-tool.ts";
|
|
47
|
-
import { mockExtensionApi } from "
|
|
47
|
+
import { mockExtensionApi } from "@zhushanwen/subagent-core/execution/__tests__/helpers/mock-extension-api.ts";
|
|
48
48
|
|
|
49
49
|
type ExecuteCb = (...args: unknown[]) => Promise<unknown>;
|
|
50
50
|
|
|
@@ -11,14 +11,14 @@ import { mkdirSync, writeFileSync } from "node:fs";
|
|
|
11
11
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { actionGenerate, type ScriptParams, type TextContent, registerWorkflowScriptTool } from "../tool-workflow-script.ts";
|
|
14
|
-
import { deleteWorkflow, saveWorkflow } from "
|
|
14
|
+
import { deleteWorkflow, saveWorkflow } from "@zhushanwen/subagent-core/orchestration/workflow-files.ts";
|
|
15
15
|
|
|
16
16
|
vi.mock("node:fs", () => ({
|
|
17
17
|
mkdirSync: vi.fn(),
|
|
18
18
|
writeFileSync: vi.fn(),
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
|
-
vi.mock("
|
|
21
|
+
vi.mock("@zhushanwen/subagent-core/orchestration/workflow-files.ts", () => ({
|
|
22
22
|
saveWorkflow: vi.fn(),
|
|
23
23
|
deleteWorkflow: vi.fn(),
|
|
24
24
|
}));
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { describe, expect, it, vi } from "vitest";
|
|
17
17
|
|
|
18
|
-
import { SLUG_MAX_LENGTH } from "
|
|
18
|
+
import { SLUG_MAX_LENGTH } from "@zhushanwen/subagent-core/execution/execute-options-mapper.ts";
|
|
19
19
|
import { REENTRY_BUSY_MESSAGE, type ReentryGuardRef } from "../reentry-guard.ts";
|
|
20
20
|
import { registerWorkflowTool } from "../tool-workflow.ts";
|
|
21
21
|
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
import type { Component } from "@earendil-works/pi-tui";
|
|
23
23
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
24
24
|
|
|
25
|
-
import { displayAgentName } from "
|
|
26
|
-
import { deriveOutcome } from "
|
|
27
|
-
import { CLOSED_REASONS } from "
|
|
28
|
-
import type { ClosedReason, ExecutionOutcome } from "
|
|
25
|
+
import { displayAgentName } from "@zhushanwen/subagent-core/shared/agent-ref.ts";
|
|
26
|
+
import { deriveOutcome } from "@zhushanwen/subagent-core/execution/execution-record.ts";
|
|
27
|
+
import { CLOSED_REASONS } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
28
|
+
import type { ClosedReason, ExecutionOutcome } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
29
29
|
import {
|
|
30
30
|
firstLine,
|
|
31
31
|
padToVisible,
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@earendil-works/pi-coding-agent";
|
|
23
23
|
|
|
24
|
-
import type { LauncherDeps } from "
|
|
25
|
-
import { abortRun } from "
|
|
26
|
-
import type { WorkflowRun } from "
|
|
24
|
+
import type { LauncherDeps } from "@zhushanwen/subagent-core/orchestration/launcher.ts";
|
|
25
|
+
import { abortRun } from "@zhushanwen/subagent-core/orchestration/lifecycle.ts";
|
|
26
|
+
import type { WorkflowRun } from "@zhushanwen/subagent-core/orchestration/models/workflow-run.ts";
|
|
27
27
|
import { parseWorkflowRpcCommand } from "./command-actions.ts";
|
|
28
28
|
import { createWorkflowsView, type ViewActions } from "./views/WorkflowsView.ts";
|
|
29
29
|
|
package/src/interface/format.ts
CHANGED
|
@@ -14,8 +14,8 @@ import os from "node:os";
|
|
|
14
14
|
|
|
15
15
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
16
16
|
|
|
17
|
-
import type { AgentEventLogEntry, DisplayItem, ExecutionStatus } from "
|
|
18
|
-
import { DEFAULT_AGENT_NAME } from "
|
|
17
|
+
import type { AgentEventLogEntry, DisplayItem, ExecutionStatus } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
18
|
+
import { DEFAULT_AGENT_NAME } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* ThemeLike:TUI 语义 token 着色接口(duck-typed,兼容 Pi Theme).
|
package/src/interface/helpers.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
|
|
13
|
-
import type { WorkflowRun } from "
|
|
13
|
+
import type { WorkflowRun } from "@zhushanwen/subagent-core/orchestration/models/workflow-run.ts";
|
|
14
14
|
import {
|
|
15
15
|
guiComponent,
|
|
16
16
|
type GuiContext,
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
import type { Component } from "@earendil-works/pi-tui";
|
|
12
12
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
13
13
|
|
|
14
|
-
import { computeElapsedSeconds } from "
|
|
15
|
-
import type { SubagentService } from "
|
|
16
|
-
import type { SubagentRecord } from "
|
|
17
|
-
import { displayAgentName } from "
|
|
14
|
+
import { computeElapsedSeconds } from "@zhushanwen/subagent-core/execution/execution-record.ts";
|
|
15
|
+
import type { SubagentService } from "@zhushanwen/subagent-core/execution/subagent-service.ts";
|
|
16
|
+
import type { SubagentRecord } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
17
|
+
import { displayAgentName } from "@zhushanwen/subagent-core/shared/agent-ref.ts";
|
|
18
18
|
import {
|
|
19
19
|
firstLine,
|
|
20
20
|
formatDisplayItem,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// 按键处理 processKey 仍留 list-view,由 list-view factory 注入给组件(KeyHandler 类型在此),
|
|
7
7
|
// 故 list-component 无需 import list-view,循环消除。
|
|
8
8
|
|
|
9
|
-
import type { SubagentService } from "
|
|
10
|
-
import type { SubagentRecord } from "
|
|
9
|
+
import type { SubagentService } from "@zhushanwen/subagent-core/execution/subagent-service.ts";
|
|
10
|
+
import type { SubagentRecord } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
11
11
|
|
|
12
12
|
// ============================================================
|
|
13
13
|
// 常量
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
import { matchesKey } from "@earendil-works/pi-tui";
|
|
36
36
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
37
37
|
|
|
38
|
-
import type { SubagentService } from "
|
|
39
|
-
import type { SubagentRecord } from "
|
|
38
|
+
import type { SubagentService } from "@zhushanwen/subagent-core/execution/subagent-service.ts";
|
|
39
|
+
import type { SubagentRecord } from "@zhushanwen/subagent-core/execution/types.ts";
|
|
40
40
|
import { type ThemeLike } from "./format.ts";
|
|
41
41
|
import { SubagentsListComponent } from "./list-component.ts";
|
|
42
42
|
import {
|