qlogicagent 2.24.1 → 2.24.2
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 +52 -324
- package/dist/agent.js +38 -43
- package/dist/cli.js +7 -7
- package/dist/default-project-knowledge/INSTRUCTIONS.md +7 -7
- package/dist/default-project-knowledge/rules/project-workflow.md +6 -6
- package/dist/index.js +265 -1018
- package/dist/orchestration.js +10 -10
- package/dist/types/agent/runtime-vars.d.ts +1 -16
- package/dist/types/agent/tool-loop/compression-pipeline.d.ts +0 -2
- package/dist/types/agent/tool-loop.d.ts +0 -6
- package/dist/types/agent/types.d.ts +3 -22
- package/dist/types/cli/acp-commands.d.ts +4 -5
- package/dist/types/cli/acp-message-router.d.ts +1 -2
- package/dist/types/cli/acp-session-handlers.d.ts +6 -12
- package/dist/types/cli/acp-session-host.d.ts +5 -48
- package/dist/types/cli/adapter-launch-config.d.ts +14 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +2 -23
- package/dist/types/cli/agent-runtime-session-state.d.ts +1 -6
- package/dist/types/cli/base-tool-bootstrap.d.ts +0 -2
- package/dist/types/cli/cli-acp-request-handler.d.ts +3 -5
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -4
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +0 -3
- package/dist/types/cli/core-tools/fork-system-prompt.d.ts +1 -5
- package/dist/types/cli/handlers/files-handler.d.ts +0 -6
- package/dist/types/cli/handlers/turn-handler.d.ts +7 -83
- package/dist/types/cli/main.d.ts +2 -4
- package/dist/types/cli/permission-approval-bridge.d.ts +2 -6
- package/dist/types/cli/permission-bootstrap.d.ts +2 -12
- package/dist/types/cli/plugin-bootstrap.d.ts +2 -4
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +0 -21
- package/dist/types/cli/session-context.d.ts +4 -14
- package/dist/types/cli/session-coordinator.d.ts +1 -9
- package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +2 -9
- package/dist/types/cli/stdio-acp-request-host.d.ts +3 -15
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +3 -23
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -8
- package/dist/types/cli/stdio-runtime-services.d.ts +2 -13
- package/dist/types/cli/stdio-server.d.ts +6 -128
- package/dist/types/cli/tool-bootstrap.d.ts +4 -8
- package/dist/types/cli/tool-catalog.d.ts +2 -2
- package/dist/types/cli/tool-invoker-factory.d.ts +0 -2
- package/dist/types/cli/tool-registry-adapter.d.ts +3 -7
- package/dist/types/cli/tool-result-processor.d.ts +0 -1
- package/dist/types/cli/turn-core.d.ts +6 -10
- package/dist/types/cli/turn-event-forwarder.d.ts +6 -3
- package/dist/types/cli/turn-lifecycle.d.ts +0 -3
- package/dist/types/cli/turn-project-router.d.ts +0 -7
- package/dist/types/contracts/hooks.d.ts +1 -20
- package/dist/types/contracts/tool-execution-evidence.d.ts +20 -1
- package/dist/types/contracts/turn-event.d.ts +2 -2
- package/dist/types/orchestration/index.d.ts +1 -1
- package/dist/types/protocol/notifications.d.ts +2 -9
- package/dist/types/protocol/wire/acp-protocol.d.ts +12 -186
- package/dist/types/protocol/wire/capability-transport.d.ts +0 -2
- package/dist/types/protocol/wire/index.d.ts +2 -10
- package/dist/types/protocol/wire/notification-payloads.d.ts +4 -989
- package/dist/types/protocol/wire/thread-protocol.d.ts +24 -3
- package/dist/types/runtime/config/tunable-defaults.d.ts +3 -75
- package/dist/types/runtime/execution/forked-agent.d.ts +2 -5
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +0 -2
- package/dist/types/runtime/execution/tool-result-storage.d.ts +13 -4
- package/dist/types/runtime/infra/agent-paths.d.ts +4 -54
- package/dist/types/runtime/infra/agent-project-projection.d.ts +20 -0
- package/dist/types/runtime/infra/background-tasks.d.ts +3 -3
- package/dist/types/runtime/infra/default-path-service.d.ts +0 -7
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +1 -1
- package/dist/types/runtime/infra/model-registry.d.ts +6 -9
- package/dist/types/runtime/infra/project-store.d.ts +3 -3
- package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +54 -7
- package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +1 -3
- package/dist/types/runtime/ports/index.d.ts +0 -4
- package/dist/types/runtime/ports/path-service.d.ts +1 -9
- package/dist/types/runtime/ports/tool-contracts.d.ts +0 -1
- package/dist/types/runtime/session/agent-session-projection.d.ts +37 -0
- package/dist/types/runtime/tasks/task-types.d.ts +2 -25
- package/dist/types/skills/mcp/mcp-manager.d.ts +2 -2
- package/dist/types/skills/plugins/plugin-loader.d.ts +1 -1
- package/dist/types/skills/skill-system/skill-category.d.ts +4 -2
- package/dist/types/skills/tools.d.ts +1 -18
- package/dist/types/test-support/project-store-fixture.d.ts +4 -4
- package/dist/types/transport/acp-event-emitter.d.ts +1 -20
- package/dist/types/transport/acp-server.d.ts +8 -88
- package/package.json +4 -96
- package/dist/agent-contract.js +0 -1
- package/dist/host-contract.js +0 -1
- package/dist/host-session-collection-contract.js +0 -1
- package/dist/memory-category-contract.js +0 -1
- package/dist/permissions.js +0 -1
- package/dist/plugin-marketplace-compute.js +0 -1
- package/dist/project-memory-host.js +0 -38
- package/dist/protocol.js +0 -1
- package/dist/skill-category-contract.js +0 -1
- package/dist/tunables.js +0 -1
- package/dist/types/agent/memory-recall-context.d.ts +0 -22
- package/dist/types/agent/memory-recall-injection.d.ts +0 -32
- package/dist/types/cli/acp-extended-handlers.d.ts +0 -110
- package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -20
- package/dist/types/cli/community-resource-installer.d.ts +0 -39
- package/dist/types/cli/community-skill-installer.d.ts +0 -18
- package/dist/types/cli/community-workflow-installer.d.ts +0 -29
- package/dist/types/cli/default-project-bootstrap.d.ts +0 -12
- package/dist/types/cli/dream-host-adapter.d.ts +0 -24
- package/dist/types/cli/gateway-rpc-connection.d.ts +0 -50
- package/dist/types/cli/handlers/community-handler.d.ts +0 -14
- package/dist/types/cli/handlers/config-handler.d.ts +0 -19
- package/dist/types/cli/handlers/control-handler.d.ts +0 -29
- package/dist/types/cli/handlers/dream-handler.d.ts +0 -41
- package/dist/types/cli/handlers/goal-handler.d.ts +0 -66
- package/dist/types/cli/handlers/memory-handler.d.ts +0 -23
- package/dist/types/cli/handlers/product-handler.d.ts +0 -35
- package/dist/types/cli/handlers/session-handler.d.ts +0 -29
- package/dist/types/cli/handlers/skill-curator-handler.d.ts +0 -8
- package/dist/types/cli/handlers/solo-handler.d.ts +0 -25
- package/dist/types/cli/handlers/turn-baseline-handler.d.ts +0 -8
- package/dist/types/cli/handlers/workflow-compute-handler.d.ts +0 -8
- package/dist/types/cli/handlers/working-materials-handler.d.ts +0 -9
- package/dist/types/cli/idle-dream-coordinator.d.ts +0 -57
- package/dist/types/cli/memory-background-coordinator.d.ts +0 -26
- package/dist/types/cli/memory-candidate-service.d.ts +0 -75
- package/dist/types/cli/memory-coordinator.d.ts +0 -40
- package/dist/types/cli/multi-agent-handler-host.d.ts +0 -16
- package/dist/types/cli/multi-agent-state-coordinator.d.ts +0 -8
- package/dist/types/cli/orchestration-memory-context.d.ts +0 -23
- package/dist/types/cli/product-acp-params.d.ts +0 -30
- package/dist/types/cli/product-coordinator.d.ts +0 -21
- package/dist/types/cli/project-memory-store-factory.d.ts +0 -12
- package/dist/types/cli/project-template-seeder.d.ts +0 -5
- package/dist/types/cli/rpc-registry.d.ts +0 -56
- package/dist/types/cli/session-history-coordinator.d.ts +0 -8
- package/dist/types/cli/session-query-service.d.ts +0 -27
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -56
- package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -17
- package/dist/types/cli/task-distillation-coordinator.d.ts +0 -146
- package/dist/types/cli/turn-ask-user-setup.d.ts +0 -24
- package/dist/types/cli/turn-suggestion-generator.d.ts +0 -15
- package/dist/types/contracts/memory-recall-packet.d.ts +0 -31
- package/dist/types/contracts/memory-response-contract.d.ts +0 -2
- package/dist/types/host-contract/fts-segment.d.ts +0 -20
- package/dist/types/host-contract/index.d.ts +0 -1819
- package/dist/types/host-contract/memory-category.d.ts +0 -8
- package/dist/types/host-contract/skill-category.d.ts +0 -5
- package/dist/types/host-session-collection-contract.d.ts +0 -65
- package/dist/types/orchestration/agent-instance.d.ts +0 -215
- package/dist/types/orchestration/agent-roster.d.ts +0 -32
- package/dist/types/orchestration/dag-scheduler.d.ts +0 -219
- package/dist/types/orchestration/delegate-approval-policy.d.ts +0 -8
- package/dist/types/orchestration/delegate-bridge.d.ts +0 -8
- package/dist/types/orchestration/goal-acceptance.d.ts +0 -17
- package/dist/types/orchestration/goal-context-envelope.d.ts +0 -7
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +0 -151
- package/dist/types/orchestration/goal-mode-adapters.d.ts +0 -152
- package/dist/types/orchestration/goal-run-persistence.d.ts +0 -21
- package/dist/types/orchestration/goal-run-types.d.ts +0 -225
- package/dist/types/orchestration/planner-memory-brief.d.ts +0 -39
- package/dist/types/orchestration/product-budget.d.ts +0 -94
- package/dist/types/orchestration/product-checkpoint.d.ts +0 -50
- package/dist/types/orchestration/product-dag-mutation-applier.d.ts +0 -10
- package/dist/types/orchestration/product-persistence.d.ts +0 -90
- package/dist/types/orchestration/product-planner.d.ts +0 -332
- package/dist/types/orchestration/product-run-coordinator.d.ts +0 -49
- package/dist/types/orchestration/product-worktree.d.ts +0 -19
- package/dist/types/orchestration/run-state-host-authority.d.ts +0 -7
- package/dist/types/orchestration/solo-evaluator.d.ts +0 -179
- package/dist/types/orchestration/solo-persistence.d.ts +0 -47
- package/dist/types/orchestration/solo-spec-builder.d.ts +0 -58
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +0 -23
- package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +0 -7
- package/dist/types/orchestration/testing/run-state-client-double.d.ts +0 -13
- package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +0 -94
- package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +0 -3
- package/dist/types/orchestration/workflow/builtin-executors.d.ts +0 -18
- package/dist/types/orchestration/workflow/capability-catalog.d.ts +0 -72
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +0 -36
- package/dist/types/orchestration/workflow/data-item.d.ts +0 -39
- package/dist/types/orchestration/workflow/expression.d.ts +0 -60
- package/dist/types/orchestration/workflow/host-executors.d.ts +0 -15
- package/dist/types/orchestration/workflow/n8n-expression.d.ts +0 -48
- package/dist/types/orchestration/workflow/n8n-import.d.ts +0 -64
- package/dist/types/orchestration/workflow/n8n-template-compat.d.ts +0 -5
- package/dist/types/orchestration/workflow/node-registry.d.ts +0 -32
- package/dist/types/orchestration/workflow/node-schema.d.ts +0 -249
- package/dist/types/orchestration/workflow/params-schema.d.ts +0 -69
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +0 -63
- package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +0 -53
- package/dist/types/orchestration/workflow/run-history-store.d.ts +0 -103
- package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +0 -65
- package/dist/types/orchestration/workflow/trigger-validation.d.ts +0 -22
- package/dist/types/orchestration/workflow/workflow-audit-store.d.ts +0 -31
- package/dist/types/orchestration/workflow/workflow-authoring.d.ts +0 -74
- package/dist/types/orchestration/workflow/workflow-bundle.d.ts +0 -51
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +0 -237
- package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +0 -46
- package/dist/types/orchestration/workflow/workflow-error.d.ts +0 -28
- package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +0 -56
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +0 -122
- package/dist/types/orchestration/workflow/workflow-render.d.ts +0 -40
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +0 -184
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +0 -122
- package/dist/types/orchestration/workflow/workflow-store.d.ts +0 -85
- package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +0 -65
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +0 -43
- package/dist/types/orchestration/workflow-chat-builder.d.ts +0 -152
- package/dist/types/orchestration/worktree-task-prompt.d.ts +0 -1
- package/dist/types/permissions.d.ts +0 -4
- package/dist/types/project-memory-host.d.ts +0 -4
- package/dist/types/protocol/agent-contract.d.ts +0 -93
- package/dist/types/protocol/methods.d.ts +0 -645
- package/dist/types/protocol/wire/acp-agent-management.d.ts +0 -533
- package/dist/types/protocol/wire/agent-events.d.ts +0 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +0 -500
- package/dist/types/protocol/wire/agent-rpc.d.ts +0 -100
- package/dist/types/protocol/wire/gateway-contract.d.ts +0 -61
- package/dist/types/protocol/wire/gateway-rpc.d.ts +0 -1177
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +0 -31
- package/dist/types/protocol/wire/turn.d.ts +0 -208
- package/dist/types/runtime/community/autonomy-budget.d.ts +0 -26
- package/dist/types/runtime/community/community-consent-client.d.ts +0 -55
- package/dist/types/runtime/community/package-materialize.d.ts +0 -19
- package/dist/types/runtime/community/ranged-download.d.ts +0 -21
- package/dist/types/runtime/community/registry-signature.d.ts +0 -48
- package/dist/types/runtime/execution/dream-agent.d.ts +0 -273
- package/dist/types/runtime/execution/dream-category-context.d.ts +0 -47
- package/dist/types/runtime/execution/memory-decay.d.ts +0 -73
- package/dist/types/runtime/execution/turn-progress-notifier.d.ts +0 -16
- package/dist/types/runtime/hooks/memory-hooks.d.ts +0 -111
- package/dist/types/runtime/infra/acp-host-handler.d.ts +0 -31
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +0 -209
- package/dist/types/runtime/infra/acp-usage-tracker.d.ts +0 -46
- package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +0 -4
- package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +0 -20
- package/dist/types/runtime/infra/feedback-distillation.d.ts +0 -32
- package/dist/types/runtime/infra/feedback-event-store.d.ts +0 -179
- package/dist/types/runtime/infra/feedback-host-authority.d.ts +0 -4
- package/dist/types/runtime/infra/feedback-outbox.d.ts +0 -26
- package/dist/types/runtime/infra/feedback-redaction.d.ts +0 -71
- package/dist/types/runtime/infra/feedback-upload-client.d.ts +0 -39
- package/dist/types/runtime/infra/feedback-upload-worker.d.ts +0 -11
- package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +0 -17
- package/dist/types/runtime/infra/project-authority-facade.d.ts +0 -11
- package/dist/types/runtime/infra/project-data-paths.d.ts +0 -24
- package/dist/types/runtime/infra/project-host-authority.d.ts +0 -11
- package/dist/types/runtime/infra/project-instructions-store.d.ts +0 -30
- package/dist/types/runtime/infra/turn-baseline-store.d.ts +0 -102
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +0 -100
- package/dist/types/runtime/infra/working-materials-store.d.ts +0 -29
- package/dist/types/runtime/memory/find-relevant-memories.d.ts +0 -26
- package/dist/types/runtime/memory/implicit-extraction.d.ts +0 -69
- package/dist/types/runtime/memory/memory-recall-attribution.d.ts +0 -24
- package/dist/types/runtime/ports/memory-provider.d.ts +0 -219
- package/dist/types/runtime/ports/memory-recall-source.d.ts +0 -14
- package/dist/types/runtime/ports/memory-writer.d.ts +0 -70
- package/dist/types/runtime/ports/project-memory-store.d.ts +0 -49
- package/dist/types/runtime/prompt/host-skill-directory.d.ts +0 -16
- package/dist/types/runtime/session/group-session-split.d.ts +0 -38
- package/dist/types/runtime/session/inbound-upload-persistence.d.ts +0 -47
- package/dist/types/runtime/session/session-catalog.d.ts +0 -12
- package/dist/types/runtime/session/session-deletion-guard.d.ts +0 -4
- package/dist/types/runtime/session/session-locator.d.ts +0 -26
- package/dist/types/runtime/session/session-metadata-store.d.ts +0 -8
- package/dist/types/runtime/session/session-paths.d.ts +0 -8
- package/dist/types/runtime/session/session-permission-store.d.ts +0 -6
- package/dist/types/runtime/session/session-persistence.d.ts +0 -37
- package/dist/types/runtime/session/session-recovery.d.ts +0 -62
- package/dist/types/runtime/session/session-resource-key.d.ts +0 -28
- package/dist/types/runtime/session/session-resume.d.ts +0 -9
- package/dist/types/runtime/session/session-schema.d.ts +0 -10
- package/dist/types/runtime/session/session-summary.d.ts +0 -7
- package/dist/types/runtime/session/session-title.d.ts +0 -9
- package/dist/types/runtime/session/session-transcript-store.d.ts +0 -30
- package/dist/types/runtime/session/session-types.d.ts +0 -113
- package/dist/types/runtime/session/session-write-queue.d.ts +0 -3
- package/dist/types/skills/memory/host-memory-provider.d.ts +0 -235
- package/dist/types/skills/memory/memdir.d.ts +0 -111
- package/dist/types/skills/memory/memory-content-safety.d.ts +0 -1
- package/dist/types/skills/memory/memory-vector-utils.d.ts +0 -2
- package/dist/types/skills/memory/task-distillation.d.ts +0 -183
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +0 -43
- package/dist/types/skills/skill-system/skill-bundles.d.ts +0 -8
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +0 -89
- package/dist/types/test-support/run-state-authority-setup.d.ts +0 -1
- package/dist/types/transport/delegate-client.d.ts +0 -82
- package/dist/types/transport/host-capability-client.d.ts +0 -21
- package/dist/types/transport/host-cloud-auth-client.d.ts +0 -10
- package/dist/types/transport/host-community-client.d.ts +0 -7
- package/dist/types/transport/host-feedback-client.d.ts +0 -25
- package/dist/types/transport/host-profile-client.d.ts +0 -19
- package/dist/types/transport/host-project-client.d.ts +0 -16
- package/dist/types/transport/host-request-client.d.ts +0 -42
- package/dist/types/transport/host-run-state-client.d.ts +0 -23
- package/dist/types/transport/host-session-client.d.ts +0 -30
- package/dist/types/tunables.d.ts +0 -2
- package/dist/types/workflow-host.d.ts +0 -38
- package/dist/workflow-host.js +0 -11
- /package/dist/types/{host-contract → protocol/wire}/acp-content.d.ts +0 -0
- /package/dist/types/{host-contract → runtime/infra}/project-id.d.ts +0 -0
- /package/dist/types/{host-contract → runtime/infra}/provider-profile.d.ts +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { type HostRunStateAuthority } from "./run-state-host-authority.js";
|
|
2
|
-
import type { ContextEnvelope } from "../protocol/wire/chat-types.js";
|
|
3
|
-
import type { ProductFailureAssigneeSelection } from "./agent-instance.js";
|
|
4
|
-
import { type AcceptanceChecklist, type AcceptanceDelta, type GoalInstructionKind, type GoalMilestone, type GoalQueuedMessage, type GoalTaskProjection, type GoalSpec, type GoalTurnContext, type PersistedGoalRunState, type PhaseSpec } from "./goal-run-types.js";
|
|
5
|
-
export interface LeaderPort {
|
|
6
|
-
/** Reapply the durable user turn policy before any leader call, including crash recovery. */
|
|
7
|
-
setTurnContext?(context: GoalTurnContext | undefined): void;
|
|
8
|
-
/** Re-ground the native leader's own compaction state in canonical Host Goal facts. */
|
|
9
|
-
setContextEnvelope?(context: ContextEnvelope | undefined): void;
|
|
10
|
-
selectHandoffCandidate(input: ProductFailureAssigneeSelection): Promise<string | undefined>;
|
|
11
|
-
draftGoalSpec(goal: string, revisionFeedback: GoalQueuedMessage[], revision: number): Promise<GoalSpec>;
|
|
12
|
-
planPhase(goalSpec: GoalSpec, summary: string, drained: GoalQueuedMessage[], checklist: AcceptanceChecklist, agentPool: string[]): Promise<PhaseSpec>;
|
|
13
|
-
critiquePlan(spec: PhaseSpec, goalSpec: GoalSpec, checklist: AcceptanceChecklist, agentPool: string[]): Promise<PhaseSpec>;
|
|
14
|
-
assess(productId: string, goalSpec: GoalSpec, checklist: AcceptanceChecklist, milestones?: GoalMilestone[], agentPool?: string[]): Promise<{
|
|
15
|
-
deltas: AcceptanceDelta[];
|
|
16
|
-
producedFiles: boolean;
|
|
17
|
-
tasks?: GoalTaskProjection[];
|
|
18
|
-
usage?: {
|
|
19
|
-
inputTokens: number;
|
|
20
|
-
outputTokens: number;
|
|
21
|
-
};
|
|
22
|
-
}>;
|
|
23
|
-
compact(prevSummary: string, deltas: AcceptanceDelta[]): Promise<string>;
|
|
24
|
-
}
|
|
25
|
-
export interface PhaseRunnerPort {
|
|
26
|
-
startBoundedProductPhase(spec: PhaseSpec, agentPool: string[], cwd: string, opts: {
|
|
27
|
-
signal: AbortSignal;
|
|
28
|
-
onProductId: (productId: string) => void;
|
|
29
|
-
budget?: {
|
|
30
|
-
maxTotalTokens?: number;
|
|
31
|
-
maxDuration?: number;
|
|
32
|
-
};
|
|
33
|
-
turnContext?: GoalTurnContext;
|
|
34
|
-
contextEnvelope?: ContextEnvelope;
|
|
35
|
-
}): Promise<{
|
|
36
|
-
productId: string;
|
|
37
|
-
result: string;
|
|
38
|
-
}>;
|
|
39
|
-
resumePhase(productId: string, opts: {
|
|
40
|
-
signal: AbortSignal;
|
|
41
|
-
cwd: string;
|
|
42
|
-
phaseStartMs: number;
|
|
43
|
-
}): Promise<{
|
|
44
|
-
result: string;
|
|
45
|
-
}>;
|
|
46
|
-
/** Interrupt a persisted in-flight Product when the control RPC cannot see the original AbortController. */
|
|
47
|
-
pausePhase?(productId: string): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export type GoalNotifier = (method: string, payload: Record<string, unknown>) => void;
|
|
50
|
-
export interface GoalLoopCoordinatorDeps {
|
|
51
|
-
leader: LeaderPort;
|
|
52
|
-
runner: PhaseRunnerPort;
|
|
53
|
-
cwd: string;
|
|
54
|
-
projectId: string;
|
|
55
|
-
canonicalSessionId: string;
|
|
56
|
-
leaderAgentId: string;
|
|
57
|
-
runStateAuthority?: HostRunStateAuthority;
|
|
58
|
-
notify?: GoalNotifier;
|
|
59
|
-
log?: {
|
|
60
|
-
warn(message: string): void;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export declare class GoalLoopCoordinator {
|
|
64
|
-
private readonly deps;
|
|
65
|
-
private seq;
|
|
66
|
-
private opChain;
|
|
67
|
-
private activePhase;
|
|
68
|
-
private readonly persistenceContext;
|
|
69
|
-
constructor(deps: GoalLoopCoordinatorDeps);
|
|
70
|
-
private serialize;
|
|
71
|
-
private notify;
|
|
72
|
-
private append;
|
|
73
|
-
private persist;
|
|
74
|
-
private transitionStage;
|
|
75
|
-
/** Durably reserve a goal-run without entering the leader lane. Returns the goalRunId immediately. */
|
|
76
|
-
start(goal: string, agentPool: string[], budget?: {
|
|
77
|
-
maxTotalTokens?: number;
|
|
78
|
-
maxDurationMs?: number;
|
|
79
|
-
}, turnContext?: GoalTurnContext): Promise<string>;
|
|
80
|
-
private startImpl;
|
|
81
|
-
private goalSpecConfirmationMessage;
|
|
82
|
-
private ensureGoalSpecImpl;
|
|
83
|
-
private ensureChecklistInitializedImpl;
|
|
84
|
-
private hydrate;
|
|
85
|
-
/** Load the run; seed `seq` so a fresh instance (post-crash) keeps appending monotonically. */
|
|
86
|
-
private load;
|
|
87
|
-
enqueueMessage(goalRunId: string, text: string, kind?: GoalInstructionKind): Promise<void>;
|
|
88
|
-
private enqueueMessageImpl;
|
|
89
|
-
/** Resolve a structured blocker and resume in one serialized mutation. A UI or IM client must not
|
|
90
|
-
* coordinate message + resume as two RPCs because a transport failure between them duplicates the
|
|
91
|
-
* answer or leaves the blocker visible after execution has continued. */
|
|
92
|
-
answerBlocker(goalRunId: string, text: string): Promise<PersistedGoalRunState>;
|
|
93
|
-
/** Run exactly one phase. Returns the updated state. */
|
|
94
|
-
runOnePhase(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
95
|
-
private runOnePhaseImpl;
|
|
96
|
-
/** B: the single phase tail — assess the in-flight/just-finished Product, flip the checklist, compact
|
|
97
|
-
* the summary, append phase_assessed/progress_compacted/phase_boundary, advance phaseIndex, clear the
|
|
98
|
-
* in-flight breadcrumb, then run the terminal checks. Called by BOTH the normal path and crash-recovery
|
|
99
|
-
* so neither duplicates this logic. Assess throwing propagates to the caller's failure handling. */
|
|
100
|
-
private finishPhase;
|
|
101
|
-
private planPhaseWithRetry;
|
|
102
|
-
private recordPhasePlan;
|
|
103
|
-
private block;
|
|
104
|
-
/** B (crash-resume): re-attach to a Product that started before a crash. Restore its Host RunState
|
|
105
|
-
* checkpoint and re-drive it to terminal (runner.resumePhase), then run the SAME phase tail
|
|
106
|
-
* (finishPhase). Honest-fail ONLY if resume itself throws — a started phase is recovered, never lost,
|
|
107
|
-
* but progress is never fabricated. Bounded by an abort handle so pause() can still drain it. */
|
|
108
|
-
private recoverCrashedPhase;
|
|
109
|
-
/** #4: classify how an in-flight phase's throw should land. A user pause aborts the signal (whatever
|
|
110
|
-
* error then surfaces → "user_pause"); the adapter's phase wall throws an AbortError
|
|
111
|
-
* WITHOUT the signal being aborted, tagged pauseReason="phase_timeout" (untagged AbortErrors from
|
|
112
|
-
* simpler runner ports default to phase_timeout — the only engine-side AbortError source). Anything
|
|
113
|
-
* else is a real failure → undefined (the caller honest-FAILs). */
|
|
114
|
-
private pauseReasonOf;
|
|
115
|
-
/** I3: true when the loaded state shows a phase that started (currentProductId set) but never reached
|
|
116
|
-
* its assessment/boundary — i.e. a process died mid-phase. Inspects the durable event log because
|
|
117
|
-
* the snapshot alone can't distinguish "just started" from "started and crashed". */
|
|
118
|
-
private crashedMidPhase;
|
|
119
|
-
/** The ms timestamp of the phase_started event for `productId` (when the crashed phase originally began).
|
|
120
|
-
* Used as the crash-resume deliverable-capture window so files created before the crash are kept.
|
|
121
|
-
* Returns 0 (no lower bound) if not found — capture-all is acceptable for this rare path. */
|
|
122
|
-
private phaseStartedMs;
|
|
123
|
-
/** Drive phases until the run ends or is paused. Not serialized: it only calls the serialized
|
|
124
|
-
* runOnePhase in a loop, so a concurrent pause/stop is observed at the next boundary. */
|
|
125
|
-
runToCompletion(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
126
|
-
private publishRoundMessage;
|
|
127
|
-
/** Pause: abort the in-flight phase IMMEDIATELY (before serialize) so it drains fast and the mutex
|
|
128
|
-
* frees quickly, then persist the paused state. If the in-flight phase is the one being aborted, it
|
|
129
|
-
* drains via its abort handler and persists `paused` itself (runOnePhaseImpl's catch); pauseImpl then
|
|
130
|
-
* no-ops on the already-paused state. */
|
|
131
|
-
pause(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
132
|
-
private pauseImpl;
|
|
133
|
-
/** Edit the goal while paused and invalidate the prior Spec; execution requires fresh confirmation. */
|
|
134
|
-
updateGoal(goalRunId: string, newGoal: string): Promise<PersistedGoalRunState>;
|
|
135
|
-
private updateGoalImpl;
|
|
136
|
-
/** Resume a paused run; an optional newGoal applies a goal-edit first (reusing updateGoalImpl). */
|
|
137
|
-
resume(goalRunId: string, newGoal?: string, additionalBudget?: {
|
|
138
|
-
maxTotalTokens?: number;
|
|
139
|
-
maxDurationMs?: number;
|
|
140
|
-
}): Promise<PersistedGoalRunState>;
|
|
141
|
-
private resumeImpl;
|
|
142
|
-
/** User stop — ends the run as stopped. The caller stops driving the detached loop. */
|
|
143
|
-
stop(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
144
|
-
private stopImpl;
|
|
145
|
-
private end;
|
|
146
|
-
private finishTerminal;
|
|
147
|
-
/** Re-attach a fresh Agent process to a durable active run without changing a user pause. */
|
|
148
|
-
recover(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
149
|
-
/** Clear a terminal Goal from the thread-native current-goal projection without deleting its audit log. */
|
|
150
|
-
dismiss(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
151
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import type { HostAgentProviderDirectory } from "../runtime/infra/host-agent-provider-directory.js";
|
|
2
|
-
import type { DelegateBridge } from "./delegate-bridge.js";
|
|
3
|
-
import { type PlannerMemoryContext } from "./planner-memory-brief.js";
|
|
4
|
-
import type { ProductFailureAssigneeSelector, ProductOrchestrator } from "./agent-instance.js";
|
|
5
|
-
import type { HostRunStateAuthority } from "./run-state-host-authority.js";
|
|
6
|
-
import type { LeaderPort, PhaseRunnerPort } from "./goal-loop-coordinator.js";
|
|
7
|
-
import { type AcceptanceCriterion, type AcceptanceDelta, type PhaseSpec } from "./goal-run-types.js";
|
|
8
|
-
export type GoalVerifyCommandValidation = {
|
|
9
|
-
valid: true;
|
|
10
|
-
} | {
|
|
11
|
-
valid: false;
|
|
12
|
-
reason: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Persisted Goal verifiers are unattended acceptance contracts, not general-purpose shell scripts.
|
|
16
|
-
* Reject known stdin, interactive, host-specific and nondeterministic constructs before persistence;
|
|
17
|
-
* runVerifyDeltas repeats the check for old snapshots and defense in depth.
|
|
18
|
-
*/
|
|
19
|
-
export declare function validateGoalVerifyCommand(command: string): GoalVerifyCommandValidation;
|
|
20
|
-
export declare function validateGoalVerifyCommandInWorkspace(command: string, cwd: string): GoalVerifyCommandValidation;
|
|
21
|
-
/**
|
|
22
|
-
* #2 verify 输出的头尾截断:测试/构建命令的失败摘要通常在输出**末尾**(框架的 summary 行),裸
|
|
23
|
-
* slice(0,N) 保头丢尾会把真正的失败原因截掉,判官只能看到无关的开头。超限时保留头尾各半,并在
|
|
24
|
-
* 中间插入可见的省略注记(对齐 ASSESS 路径 "…(已截断)" 的风格 —— 截断必须留痕,不静默)。
|
|
25
|
-
*/
|
|
26
|
-
export declare function capVerifyOutput(text: string, cap?: number): string;
|
|
27
|
-
/**
|
|
28
|
-
* Deterministic runtime verification — the cc/codex-style "the runner OBSERVES the result" applied to
|
|
29
|
-
* the judge, run EVERY phase as a continuous regression gate (not a one-time entry ticket). For each
|
|
30
|
-
* criterion that carries a `verify` shell command (run in the project workspace):
|
|
31
|
-
* - FORWARD (pending/failed): exit 0 → a TRUSTED passed delta (bypasses the LLM evidence-gate because
|
|
32
|
-
* real exit-0 is harder evidence than any LLM citation — closes the gap where a worker runs a test
|
|
33
|
-
* successfully but its distilled summary can't convince a conservative leader).
|
|
34
|
-
* - REGRESSION (already passed): re-run it. exit ≠ 0 → a TRUSTED passed→failed regression delta. This
|
|
35
|
-
* is what stops a later phase from silently breaking an earlier verified deliverable and the run
|
|
36
|
-
* still declaring `done` ("checklist all green, disk actually broken"). A passing re-check is a no-op.
|
|
37
|
-
* Files accumulate across phases in the same workspace, so without this re-check a regression goes
|
|
38
|
-
* unnoticed; with it, the strongest deterministic check we have doubles as the regression baseline.
|
|
39
|
-
*/
|
|
40
|
-
export declare function runVerifyDeltas(criteria: AcceptanceCriterion[], cwd: string, log?: {
|
|
41
|
-
info?(m: string): void;
|
|
42
|
-
warn?(m: string): void;
|
|
43
|
-
}): Promise<AcceptanceDelta[]>;
|
|
44
|
-
/**
|
|
45
|
-
* #1 residual regression cover for criteria WITHOUT a `verify` command. Such a criterion passed by citing
|
|
46
|
-
* an evidence file; if that cited file later VANISHES from the project workspace, the deliverable is
|
|
47
|
-
* unambiguously gone → emit a TRUSTED passed→failed regression delta. We only flag DELETION (not
|
|
48
|
-
* modification): a "content contains X" file can be legitimately extended by a later phase, so a content
|
|
49
|
-
* change is ambiguous, but a missing file is not. Verify-backed criteria are handled by runVerifyDeltas;
|
|
50
|
-
* "output"-only citations have no on-disk artifact to check and are skipped.
|
|
51
|
-
*/
|
|
52
|
-
export declare function runFileEvidenceRegressionDeltas(criteria: AcceptanceCriterion[], cwd: string, log?: {
|
|
53
|
-
warn?(m: string): void;
|
|
54
|
-
}): AcceptanceDelta[];
|
|
55
|
-
export declare function recordGoalPhaseChangedFiles(productId: string, cwd: string, phaseStartMs: number): Promise<void>;
|
|
56
|
-
export declare function takeGoalPhaseChangedFiles(productId: string): string[];
|
|
57
|
-
/**
|
|
58
|
-
* Find the first balanced `{...}` or `[...]` in `text` and JSON.parse it. The leader (an LLM) may
|
|
59
|
-
* wrap the JSON in prose or a ```json fence; this scans for the first balanced bracket with
|
|
60
|
-
* string-awareness (braces/brackets inside string values are ignored) so an embedded fence or quote
|
|
61
|
-
* can't truncate the block. Throws if no balanced JSON is found or it won't parse.
|
|
62
|
-
*/
|
|
63
|
-
export declare function extractJson<T>(text: string): T;
|
|
64
|
-
export interface LeaderAdapterDeps {
|
|
65
|
-
/** Resolves the leader's external ACP descriptor (product-planner.ts:583). */
|
|
66
|
-
providerDirectory: HostAgentProviderDirectory;
|
|
67
|
-
/** Catalog id of the leader agent (e.g. "qlogicagent"). */
|
|
68
|
-
leaderAgentId: string;
|
|
69
|
-
/** Project workspaceDir — the leader process cwd. */
|
|
70
|
-
cwd: string;
|
|
71
|
-
projectId: string;
|
|
72
|
-
canonicalSessionId: string;
|
|
73
|
-
/** Live Product engine — assess() reads task outputs/changedFiles via getStatus. */
|
|
74
|
-
orchestrator: ProductOrchestrator;
|
|
75
|
-
/** Stable id used as the leader process memberId (one persistent leader per goal-run). */
|
|
76
|
-
goalRunId: string;
|
|
77
|
-
/** (c) Planning-time memory: ONE search per run + global cheat-sheet into the
|
|
78
|
-
* checklist/plan prompts. Optional — planning runs without it. */
|
|
79
|
-
memoryContext?: PlannerMemoryContext;
|
|
80
|
-
log?: {
|
|
81
|
-
info(msg: string): void;
|
|
82
|
-
warn(msg: string): void;
|
|
83
|
-
};
|
|
84
|
-
/** Required Gateway delegate access; Goal leader turns fail loud when unavailable. */
|
|
85
|
-
getDelegateBridge?: () => DelegateBridge | undefined;
|
|
86
|
-
}
|
|
87
|
-
export declare function createLeaderAdapter(deps: LeaderAdapterDeps): LeaderPort;
|
|
88
|
-
export interface PhaseRunnerAdapterDeps {
|
|
89
|
-
/** The live Product engine (same one ProductRunCoordinator.confirmAndStart drives — I3). */
|
|
90
|
-
orchestrator: ProductOrchestrator;
|
|
91
|
-
projectId: string;
|
|
92
|
-
runStateAuthority: HostRunStateAuthority;
|
|
93
|
-
failureAssigneeSelector: ProductFailureAssigneeSelector;
|
|
94
|
-
/** Optional per-phase budget passed through to ProductOrchestrator.create. */
|
|
95
|
-
budget?: {
|
|
96
|
-
maxTotalTokens?: number;
|
|
97
|
-
maxDuration?: number;
|
|
98
|
-
};
|
|
99
|
-
/** Poll interval (ms) while awaiting phase completion. Default 2000. */
|
|
100
|
-
pollIntervalMs?: number;
|
|
101
|
-
log?: {
|
|
102
|
-
info(msg: string): void;
|
|
103
|
-
warn(msg: string): void;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export declare function createPhaseRunnerAdapter(deps: PhaseRunnerAdapterDeps): PhaseRunnerPort;
|
|
107
|
-
export declare function parsePhaseSpec(reply: string, availableAgentIds: string[], log?: {
|
|
108
|
-
warn?(m: string): void;
|
|
109
|
-
}): PhaseSpec;
|
|
110
|
-
/**
|
|
111
|
-
* B (evidence-gating): goal-mode's assess() is the SOLE acceptance authority (Product's per-task judge
|
|
112
|
-
* is a no-op for a session-less goal-mode run), so a criterion may only flip to `passed` when it is
|
|
113
|
-
* backed by CITED PRIMARY EVIDENCE — not a bare "PASS". This is the pure decision the LLM cannot be
|
|
114
|
-
* trusted to self-enforce; it's unit-tested independently of the live judge call.
|
|
115
|
-
*
|
|
116
|
-
* Rules:
|
|
117
|
-
* - `passed` delta: keep only evidence items with a non-empty `source` AND non-empty `quote`, AND
|
|
118
|
-
* whose `source` is PRIMARY — i.e. it matches one of the run's actual `changedFiles` (exact or
|
|
119
|
-
* basename/suffix match, since the judge may cite a relative path) OR is the literal `"output"`.
|
|
120
|
-
* If, after filtering, a passed delta has zero evidence items, do NOT flip it — demote it to a
|
|
121
|
-
* VISIBLE `pending` note delta (#1③: it reaches the phase_assessed event, the progress summary and
|
|
122
|
-
* the next phase's "受阻原因", instead of vanishing with only an engine log line).
|
|
123
|
-
* - `failed` / other deltas: kept as-is (their reason is informational; failed needs no evidence).
|
|
124
|
-
*/
|
|
125
|
-
export declare function validateAssessDeltas(rawDeltas: AcceptanceDelta[], changedFiles: string[], log?: {
|
|
126
|
-
warn(msg: string): void;
|
|
127
|
-
}, context?: {
|
|
128
|
-
criteria?: AcceptanceCriterion[];
|
|
129
|
-
outputTexts?: string[];
|
|
130
|
-
assignmentReceiptLines?: string[];
|
|
131
|
-
requiredAssignmentAgentIds?: string[];
|
|
132
|
-
}): AcceptanceDelta[];
|
|
133
|
-
/**
|
|
134
|
-
* A Host assignment criterion accepts the Goal's selected worker pool, not merely one authentic
|
|
135
|
-
* receipt. Re-check coverage every phase so a prematurely persisted pass regresses after recovery.
|
|
136
|
-
*/
|
|
137
|
-
export declare function runAssignmentEvidenceCoverageDeltas(criteria: AcceptanceCriterion[], assignmentReceiptLines: string[], requiredAgentIds: string[], log?: {
|
|
138
|
-
warn(msg: string): void;
|
|
139
|
-
}): AcceptanceDelta[];
|
|
140
|
-
/**
|
|
141
|
-
* #1②: the judge-prompt view of this phase's project changed files. The PROMPT is windowed to stay
|
|
142
|
-
* bounded, but the truncation is DISCLOSED in-band — a hidden remainder must not read as "没有更多改动"
|
|
143
|
-
* (and the whitelist gate in assess() always uses the untruncated set, so citing an unlisted-but-real
|
|
144
|
-
* file still counts as primary evidence).
|
|
145
|
-
*/
|
|
146
|
-
export declare const ASSESS_FILES_WINDOW = 50;
|
|
147
|
-
export declare function buildProjectFilesBlock(allFiles: string[], window?: number): string;
|
|
148
|
-
/** Build the evidence block for the judge from a live Product status (task outputs + changed files).
|
|
149
|
-
* Exported for the #3 regression test: the >ASSESS_MAX_TASKS window note must never silently vanish. */
|
|
150
|
-
export declare function buildEvidenceBlock(status: ReturnType<ProductOrchestrator["getStatus"]>): string;
|
|
151
|
-
export declare const ASSESS_ASSIGNMENT_HISTORY_WINDOW = 60;
|
|
152
|
-
export declare function buildGoalAssignmentHistoryBlock(allLines: string[], window?: number): string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { GoalRunEvent, PersistedGoalRunState } from "./goal-run-types.js";
|
|
2
|
-
import type { HostRunStateAuthority } from "./run-state-host-authority.js";
|
|
3
|
-
import { type ThreadItemEvent } from "../host-contract/index.js";
|
|
4
|
-
export interface GoalPersistenceContext {
|
|
5
|
-
projectId: string;
|
|
6
|
-
canonicalSessionId: string;
|
|
7
|
-
authority: HostRunStateAuthority;
|
|
8
|
-
}
|
|
9
|
-
/** Build the sole live-and-durable representation of a Goal fact. */
|
|
10
|
-
export declare function toGoalThreadItemEvent(goalRunId: string, event: GoalRunEvent, context: GoalPersistenceContext): ThreadItemEvent;
|
|
11
|
-
/** Append one canonical item to the Gateway-owned durable RunState event log. */
|
|
12
|
-
export declare function appendGoalRunEvent(goalRunId: string, event: GoalRunEvent, context: GoalPersistenceContext): Promise<ThreadItemEvent>;
|
|
13
|
-
export declare function readGoalRunEvents(goalRunId: string, context: GoalPersistenceContext): Promise<GoalRunEvent[]>;
|
|
14
|
-
export declare function saveGoalRunSnapshot(state: PersistedGoalRunState, context: GoalPersistenceContext): Promise<void>;
|
|
15
|
-
export declare function loadGoalRunSnapshot(goalRunId: string, context: GoalPersistenceContext): Promise<PersistedGoalRunState | undefined>;
|
|
16
|
-
/** Apply events newer than the checkpoint cursor. This closes the append→checkpoint crash window
|
|
17
|
-
* without introducing a second journal or compatibility reader: Host events.jsonl remains the single
|
|
18
|
-
* durable fact stream, and the checkpoint remains its replaceable projection. */
|
|
19
|
-
export declare function replayGoalRunEvents(state: PersistedGoalRunState, events: GoalRunEvent[]): PersistedGoalRunState;
|
|
20
|
-
/** Replay the Host event log into a snapshot. Returns undefined before goal_started. */
|
|
21
|
-
export declare function rebuildSnapshotFromEvents(goalRunId: string, context: GoalPersistenceContext): Promise<PersistedGoalRunState | undefined>;
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/** Loop tunables (single source of truth — I9). */
|
|
2
|
-
export declare const GOAL_NO_PROGRESS_LIMIT = 3;
|
|
3
|
-
export declare const GOAL_SOFT_NO_PROGRESS_LIMIT = 8;
|
|
4
|
-
export declare const GOAL_PHASE_TIMEOUT_MS: number;
|
|
5
|
-
export declare const GOAL_UNREACHABLE_MIN_STREAK = 2;
|
|
6
|
-
export type GoalRunStatus = "running" | "blocked" | "ended";
|
|
7
|
-
export type GoalPauseState = "running" | "draining" | "paused";
|
|
8
|
-
/** Why a run is paused; the canonical paused item keeps engine and user intent distinguishable. */
|
|
9
|
-
export type GoalPauseReason = "user_pause" | "phase_timeout";
|
|
10
|
-
export type GoalEndReason = "done" | "stopped" | "failed";
|
|
11
|
-
export type AcceptanceStatus = "pending" | "passed" | "failed" | "superseded";
|
|
12
|
-
export type GoalSpecStatus = "drafting" | "awaiting_clarification" | "awaiting_confirmation" | "confirmed";
|
|
13
|
-
export type GoalStageName = "drafting_spec" | "initializing_checklist" | "planning_phase" | "reviewing_plan" | "executing_tasks" | "assessing_results" | "compacting_progress" | "recovering";
|
|
14
|
-
/** Durable, user-safe activity projection. It exposes what is happening without leaking reasoning. */
|
|
15
|
-
export interface GoalStage {
|
|
16
|
-
stage: GoalStageName;
|
|
17
|
-
phaseIndex: number;
|
|
18
|
-
agentId: string;
|
|
19
|
-
role: GoalControlRole | "worker_team" | "system";
|
|
20
|
-
startedAt: string;
|
|
21
|
-
detail?: string;
|
|
22
|
-
}
|
|
23
|
-
export type GoalInstructionKind = "instruction_once" | "constraint_add" | "constraint_remove" | "answer_to_blocker" | "priority_change";
|
|
24
|
-
export type GoalTaskStatus = "pending" | "running" | "completed" | "failed" | "blocked" | "superseded";
|
|
25
|
-
export type GoalControlRole = "leader" | "planner" | "plan_critic" | "acceptance_judge";
|
|
26
|
-
export type GoalExecutionRole = "implementer" | "tester" | "reviewer" | "integrator";
|
|
27
|
-
export type GoalAgentRole = GoalControlRole | GoalExecutionRole;
|
|
28
|
-
export interface GoalTaskProjection {
|
|
29
|
-
taskId: string;
|
|
30
|
-
assignee: string;
|
|
31
|
-
prompt: string;
|
|
32
|
-
dependsOn?: string[];
|
|
33
|
-
acceptanceCriteria?: string;
|
|
34
|
-
status: GoalTaskStatus;
|
|
35
|
-
result?: string;
|
|
36
|
-
error?: string;
|
|
37
|
-
inputTokens?: number;
|
|
38
|
-
outputTokens?: number;
|
|
39
|
-
changedFiles?: string[];
|
|
40
|
-
}
|
|
41
|
-
export interface GoalRoleProjection {
|
|
42
|
-
name: string;
|
|
43
|
-
role: GoalAgentRole;
|
|
44
|
-
agentId: string;
|
|
45
|
-
}
|
|
46
|
-
export interface GoalMilestone {
|
|
47
|
-
phaseIndex: number;
|
|
48
|
-
label: string;
|
|
49
|
-
status: "planned" | "running" | "completed" | "failed" | "blocked";
|
|
50
|
-
productId?: string;
|
|
51
|
-
tasks: GoalTaskProjection[];
|
|
52
|
-
roles: GoalRoleProjection[];
|
|
53
|
-
}
|
|
54
|
-
export interface GoalBlocker {
|
|
55
|
-
code: string;
|
|
56
|
-
message: string;
|
|
57
|
-
phaseIndex?: number;
|
|
58
|
-
taskId?: string;
|
|
59
|
-
askId?: string;
|
|
60
|
-
questions?: Array<{
|
|
61
|
-
id: string;
|
|
62
|
-
prompt: string;
|
|
63
|
-
}>;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
}
|
|
66
|
-
export interface GoalBudget {
|
|
67
|
-
maxTotalTokens?: number;
|
|
68
|
-
maxDurationMs?: number;
|
|
69
|
-
inputTokens: number;
|
|
70
|
-
outputTokens: number;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Execution choices captured when the user starts a Goal. They are durable so a recovered
|
|
74
|
-
* driver uses the same model/permission/skill policy instead of silently falling back to defaults.
|
|
75
|
-
*/
|
|
76
|
-
export interface GoalTurnContext {
|
|
77
|
-
modelId?: string;
|
|
78
|
-
reasoningEffort?: string;
|
|
79
|
-
permissions?: unknown;
|
|
80
|
-
activeSkills?: string[];
|
|
81
|
-
}
|
|
82
|
-
/** The single user-confirmed authority for planning, execution and acceptance. */
|
|
83
|
-
export interface GoalSpec {
|
|
84
|
-
revision: number;
|
|
85
|
-
objective: string;
|
|
86
|
-
/** Canonical execution boundary confirmed by the user with the rest of the GoalSpec. */
|
|
87
|
-
workspaceMutationPolicy: "forbid" | "allow";
|
|
88
|
-
inScope: string[];
|
|
89
|
-
outOfScope: string[];
|
|
90
|
-
constraints: string[];
|
|
91
|
-
assumptions: string[];
|
|
92
|
-
acceptanceCriteria: AcceptanceCriterion[];
|
|
93
|
-
verificationStrategy: string[];
|
|
94
|
-
openQuestions: Array<{
|
|
95
|
-
id: string;
|
|
96
|
-
prompt: string;
|
|
97
|
-
}>;
|
|
98
|
-
}
|
|
99
|
-
export interface GoalFinalReport {
|
|
100
|
-
outcome: GoalEndReason;
|
|
101
|
-
summary: string;
|
|
102
|
-
acceptanceChecklist: AcceptanceChecklist;
|
|
103
|
-
milestones: GoalMilestone[];
|
|
104
|
-
changedFiles: string[];
|
|
105
|
-
inputTokens: number;
|
|
106
|
-
outputTokens: number;
|
|
107
|
-
wallClockStartedAt: string;
|
|
108
|
-
finishedAt: string;
|
|
109
|
-
failedReason?: string;
|
|
110
|
-
}
|
|
111
|
-
/** FINAL evidence type (I9 — not staged). source = file path / check name; quote = cited excerpt. */
|
|
112
|
-
export interface AcceptanceEvidence {
|
|
113
|
-
source: string;
|
|
114
|
-
quote: string;
|
|
115
|
-
}
|
|
116
|
-
export interface AcceptanceCriterion {
|
|
117
|
-
id: string;
|
|
118
|
-
criterion: string;
|
|
119
|
-
status: AcceptanceStatus;
|
|
120
|
-
/** Output-only criteria (reply/copy/summary/etc.) are accepted from the Product task result text,
|
|
121
|
-
* never by inventing a shell verifier or citing an unrelated file. */
|
|
122
|
-
evidenceSource?: "output" | "host.product.assignment";
|
|
123
|
-
evidence?: AcceptanceEvidence[];
|
|
124
|
-
reason?: string;
|
|
125
|
-
verify?: string;
|
|
126
|
-
}
|
|
127
|
-
export interface AcceptanceChecklist {
|
|
128
|
-
version: number;
|
|
129
|
-
criteria: AcceptanceCriterion[];
|
|
130
|
-
}
|
|
131
|
-
/** A bounded phase plan (a subset of the Product plan). */
|
|
132
|
-
export interface PhaseSpec {
|
|
133
|
-
phaseLabel: string;
|
|
134
|
-
tasks: {
|
|
135
|
-
taskId: string;
|
|
136
|
-
assignee: string;
|
|
137
|
-
prompt: string;
|
|
138
|
-
workspaceMutation: "none" | "required";
|
|
139
|
-
dependsOn?: string[];
|
|
140
|
-
acceptanceCriteria?: string;
|
|
141
|
-
}[];
|
|
142
|
-
instances: {
|
|
143
|
-
name: string;
|
|
144
|
-
role: GoalExecutionRole;
|
|
145
|
-
agentId: string;
|
|
146
|
-
}[];
|
|
147
|
-
controlRoles?: GoalRoleProjection[];
|
|
148
|
-
reasoning?: string;
|
|
149
|
-
unreachable?: {
|
|
150
|
-
criterionId: string;
|
|
151
|
-
reason: string;
|
|
152
|
-
}[];
|
|
153
|
-
/** fail-open 打标:critique 判官坏 JSON 重试后仍失败,本计划未经精修直接执行。 */
|
|
154
|
-
critiqueSkipped?: boolean;
|
|
155
|
-
/** 截断收据:超 MAX_TASKS_PER_PHASE 被丢弃的任务数(其对应标准仍未通过,下一阶段会重新规划)。 */
|
|
156
|
-
droppedTaskCount?: number;
|
|
157
|
-
}
|
|
158
|
-
/** Output of assess() — one per criterion the phase touched. */
|
|
159
|
-
export interface AcceptanceDelta {
|
|
160
|
-
criterionId: string;
|
|
161
|
-
oldStatus: AcceptanceStatus;
|
|
162
|
-
newStatus: AcceptanceStatus;
|
|
163
|
-
evidence?: AcceptanceEvidence[];
|
|
164
|
-
reasonIfFailed?: string;
|
|
165
|
-
regression?: boolean;
|
|
166
|
-
}
|
|
167
|
-
export interface GoalQueuedMessage {
|
|
168
|
-
id: string;
|
|
169
|
-
ts: string;
|
|
170
|
-
text: string;
|
|
171
|
-
kind: GoalInstructionKind;
|
|
172
|
-
}
|
|
173
|
-
/** Append-only event (events.jsonl). seq is monotonic from 1. */
|
|
174
|
-
export interface GoalRunEvent {
|
|
175
|
-
seq: number;
|
|
176
|
-
ts: string;
|
|
177
|
-
type: "goal_started" | "goal_spec_drafted" | "blocker_answered" | "checklist_initialized" | "phase_planned" | "phase_started" | "phase_assessed" | "progress_compacted" | "goal_edited" | "message_queued" | "blocked" | "paused" | "resumed" | "stopped" | "phase_boundary" | "round_message" | "budget_updated" | "stage_changed" | "recovery_failed" | "final_report" | "dismissed" | "recovered" | "ended";
|
|
178
|
-
payload: Record<string, unknown>;
|
|
179
|
-
}
|
|
180
|
-
/** Goal checkpoint stored by Gateway RunState and advanced by replaying later Host events. */
|
|
181
|
-
export interface PersistedGoalRunState {
|
|
182
|
-
goalRunId: string;
|
|
183
|
-
projectId: string;
|
|
184
|
-
canonicalSessionId: string;
|
|
185
|
-
leaderAgentId: string;
|
|
186
|
-
originalGoal: string;
|
|
187
|
-
currentGoal: string;
|
|
188
|
-
goalSpecStatus: GoalSpecStatus;
|
|
189
|
-
goalSpec?: GoalSpec;
|
|
190
|
-
goalUpdatedAt?: string;
|
|
191
|
-
checklistVersion: number;
|
|
192
|
-
/** False only between the durable start acknowledgement and the detached leader initialization. */
|
|
193
|
-
checklistInitialized: boolean;
|
|
194
|
-
status: GoalRunStatus;
|
|
195
|
-
pauseState: GoalPauseState;
|
|
196
|
-
phaseIndex: number;
|
|
197
|
-
noProgressCount: number;
|
|
198
|
-
noFlipStreak: number;
|
|
199
|
-
unreachableStreak: Record<string, number>;
|
|
200
|
-
progressSummary: string;
|
|
201
|
-
currentStage?: GoalStage;
|
|
202
|
-
/** Timestamp of the latest durable Goal activity, used by every surface to judge freshness. */
|
|
203
|
-
lastActivityAt?: string;
|
|
204
|
-
acceptanceChecklist: AcceptanceChecklist;
|
|
205
|
-
queuedMessages: GoalQueuedMessage[];
|
|
206
|
-
/** Durable constraints are re-grounded into every later phase until explicitly removed. */
|
|
207
|
-
constraints: GoalQueuedMessage[];
|
|
208
|
-
agentPool: string[];
|
|
209
|
-
milestones: GoalMilestone[];
|
|
210
|
-
budget: GoalBudget;
|
|
211
|
-
turnContext?: GoalTurnContext;
|
|
212
|
-
blocker?: GoalBlocker;
|
|
213
|
-
finalReport?: GoalFinalReport;
|
|
214
|
-
dismissedAt?: string;
|
|
215
|
-
wallClockStartedAt: string;
|
|
216
|
-
pausedAt?: string;
|
|
217
|
-
/** How the run became paused (user_pause / phase_timeout) — cleared on resume. */
|
|
218
|
-
pauseReason?: GoalPauseReason;
|
|
219
|
-
stopReason?: string;
|
|
220
|
-
endReason?: GoalEndReason;
|
|
221
|
-
failedReason?: string;
|
|
222
|
-
currentProductId?: string;
|
|
223
|
-
projectWorkspaceDir: string;
|
|
224
|
-
lastEventSeq: number;
|
|
225
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory context for long-run orchestration (Product / goal-mode / Solo).
|
|
3
|
-
*
|
|
4
|
-
* Two deliberately different depths — the design decision is graduated, not
|
|
5
|
-
* uniform (worker 每轮召回被否决:杂讯+成本×成员×轮数+破坏验收可复现):
|
|
6
|
-
* (a) EVERY member dispatch carries the owner's global cheat-sheet — the
|
|
7
|
-
* 2KB baseline (language, boundaries, style) any executor must honor.
|
|
8
|
-
* Self-hosted qlogicagent workers already inject it per-turn; this
|
|
9
|
-
* covers third-party workers and is harmlessly redundant otherwise.
|
|
10
|
-
* (c) The LEADER does ONE memory search at planning time (run-scoped) and
|
|
11
|
-
* carries the hits into checklist derivation + phase planning — long
|
|
12
|
-
* tasks plan once and execute many turns, so retrieval belongs to the
|
|
13
|
-
* planning step, not the execution loop.
|
|
14
|
-
*
|
|
15
|
-
* Everything here is injected (no direct skills import from orchestration);
|
|
16
|
-
* the cli wiring supplies readUserIndexForPrompt + provider.search.
|
|
17
|
-
*/
|
|
18
|
-
export interface PlannerMemoryContext {
|
|
19
|
-
/** Owner-level global INDEX (cheat-sheet). Null when absent. */
|
|
20
|
-
globalIndex(): string | null;
|
|
21
|
-
/** One-shot L2 search (goal text as query). Optional — planning must run without it. */
|
|
22
|
-
search?(query: string): Promise<Array<{
|
|
23
|
-
text: string;
|
|
24
|
-
}>>;
|
|
25
|
-
}
|
|
26
|
-
export interface PlannerMemoryLog {
|
|
27
|
-
warn(msg: string): void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* (c) Planning-time brief: global cheat-sheet + goal-relevant L2 hits.
|
|
31
|
-
* Returns "" when there is nothing — callers splice it in only when non-empty.
|
|
32
|
-
* A failed search degrades to cheat-sheet-only WITH a trace (never silently).
|
|
33
|
-
*/
|
|
34
|
-
export declare function buildPlannerMemoryBrief(ctx: PlannerMemoryContext | undefined, goal: string, log?: PlannerMemoryLog): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* (a) Worker dispatch preamble: cheat-sheet only, no retrieval.
|
|
37
|
-
* Returns "" when the owner has no global layer yet.
|
|
38
|
-
*/
|
|
39
|
-
export declare function buildWorkerMemoryPreamble(ctx: PlannerMemoryContext | undefined, log?: PlannerMemoryLog): string;
|