@pellux/goodvibes-sdk 0.34.2 → 0.36.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/README.md +11 -1
- package/dist/contracts/artifacts/operator-contract.json +4 -1
- package/dist/events/agents.d.ts +14 -0
- package/dist/events/agents.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/turn.d.ts +17 -0
- package/dist/events/turn.d.ts.map +1 -1
- package/dist/events/workflows.d.ts +8 -0
- package/dist/events/workflows.d.ts.map +1 -1
- package/dist/platform/acp/connection.d.ts +16 -0
- package/dist/platform/acp/connection.d.ts.map +1 -1
- package/dist/platform/acp/connection.js +17 -0
- package/dist/platform/agents/orchestrator-runner.d.ts +1 -1
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +20 -24
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +3 -2
- package/dist/platform/agents/worktree.d.ts +11 -1
- package/dist/platform/agents/worktree.d.ts.map +1 -1
- package/dist/platform/agents/worktree.js +48 -14
- package/dist/platform/agents/wrfc-config.d.ts +23 -0
- package/dist/platform/agents/wrfc-config.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-config.js +24 -0
- package/dist/platform/agents/wrfc-controller.d.ts +49 -1
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +271 -16
- package/dist/platform/agents/wrfc-types.d.ts +48 -1
- package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
- package/dist/platform/automation/manager-runtime-delivery.d.ts +1 -1
- package/dist/platform/automation/manager-runtime-delivery.d.ts.map +1 -1
- package/dist/platform/automation/manager-runtime-delivery.js +4 -3
- package/dist/platform/channels/policy-manager.d.ts +8 -0
- package/dist/platform/channels/policy-manager.d.ts.map +1 -1
- package/dist/platform/channels/policy-manager.js +43 -1
- package/dist/platform/companion/companion-chat-manager.d.ts +1 -0
- package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-manager.js +10 -0
- package/dist/platform/companion/companion-chat-routes.js +1 -0
- package/dist/platform/companion/companion-chat-types.d.ts +1 -0
- package/dist/platform/companion/companion-chat-types.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-core.d.ts +3 -0
- package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-core.js +24 -0
- package/dist/platform/config/schema-types.d.ts +6 -2
- package/dist/platform/config/schema-types.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.d.ts +7 -0
- package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.js +30 -0
- package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-channels.js +2 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-email.js +1 -0
- package/dist/platform/core/compaction-sections.d.ts.map +1 -1
- package/dist/platform/core/compaction-sections.js +16 -5
- package/dist/platform/core/compaction-types.d.ts +7 -1
- package/dist/platform/core/compaction-types.d.ts.map +1 -1
- package/dist/platform/core/compaction-types.js +6 -0
- package/dist/platform/core/context-compaction.d.ts +20 -4
- package/dist/platform/core/context-compaction.d.ts.map +1 -1
- package/dist/platform/core/context-compaction.js +34 -7
- package/dist/platform/core/conversation-utils.js +1 -1
- package/dist/platform/core/conversation.d.ts.map +1 -1
- package/dist/platform/core/conversation.js +9 -4
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +22 -3
- package/dist/platform/core/orchestrator.d.ts +12 -0
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +36 -8
- package/dist/platform/daemon/http/home-graph-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/home-graph-routes.js +2 -1
- package/dist/platform/daemon/http/project-planning-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/project-planning-routes.js +2 -1
- package/dist/platform/hooks/dispatcher.d.ts.map +1 -1
- package/dist/platform/hooks/dispatcher.js +4 -0
- package/dist/platform/hooks/runners/command.d.ts.map +1 -1
- package/dist/platform/hooks/runners/command.js +11 -2
- package/dist/platform/integrations/delivery.d.ts.map +1 -1
- package/dist/platform/integrations/delivery.js +0 -2
- package/dist/platform/intelligence/import-graph.d.ts.map +1 -1
- package/dist/platform/intelligence/import-graph.js +8 -0
- package/dist/platform/knowledge/extractors.d.ts.map +1 -1
- package/dist/platform/knowledge/extractors.js +30 -4
- package/dist/platform/mcp/client.d.ts +2 -0
- package/dist/platform/mcp/client.d.ts.map +1 -1
- package/dist/platform/mcp/client.js +17 -3
- package/dist/platform/mcp/registry.d.ts.map +1 -1
- package/dist/platform/mcp/registry.js +4 -0
- package/dist/platform/media/builtin-generation-providers.d.ts.map +1 -1
- package/dist/platform/media/builtin-generation-providers.js +2 -3
- package/dist/platform/media/provider-registry.d.ts.map +1 -1
- package/dist/platform/media/provider-registry.js +3 -1
- package/dist/platform/multimodal/service.d.ts.map +1 -1
- package/dist/platform/multimodal/service.js +18 -3
- package/dist/platform/providers/anthropic-compat.js +2 -2
- package/dist/platform/providers/anthropic-sdk-provider.js +1 -1
- package/dist/platform/providers/anthropic-sse-assembler.d.ts.map +1 -1
- package/dist/platform/providers/anthropic-sse-assembler.js +24 -0
- package/dist/platform/providers/anthropic.js +2 -2
- package/dist/platform/providers/capabilities.d.ts +6 -0
- package/dist/platform/providers/capabilities.d.ts.map +1 -1
- package/dist/platform/providers/capabilities.js +20 -1
- package/dist/platform/providers/gemini.d.ts.map +1 -1
- package/dist/platform/providers/gemini.js +57 -48
- package/dist/platform/providers/index.d.ts +1 -0
- package/dist/platform/providers/index.d.ts.map +1 -1
- package/dist/platform/providers/index.js +1 -0
- package/dist/platform/providers/interface.d.ts +9 -1
- package/dist/platform/providers/interface.d.ts.map +1 -1
- package/dist/platform/providers/llama-cpp.js +1 -1
- package/dist/platform/providers/lm-studio.js +1 -1
- package/dist/platform/providers/model-limits.d.ts.map +1 -1
- package/dist/platform/providers/model-limits.js +14 -2
- package/dist/platform/providers/ollama.js +1 -1
- package/dist/platform/providers/openai-codex.js +1 -1
- package/dist/platform/providers/openai-compat.d.ts.map +1 -1
- package/dist/platform/providers/openai-compat.js +2 -2
- package/dist/platform/providers/openai.js +2 -2
- package/dist/platform/runtime/emitters/agents.d.ts +2 -0
- package/dist/platform/runtime/emitters/agents.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/turn.d.ts +9 -0
- package/dist/platform/runtime/emitters/turn.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/turn.js +4 -0
- package/dist/platform/runtime/emitters/workflows.d.ts +1 -0
- package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
- package/dist/platform/runtime/store/domains/agents.d.ts +7 -0
- package/dist/platform/runtime/store/domains/agents.d.ts.map +1 -1
- package/dist/platform/runtime/store/domains/conversation.d.ts +0 -2
- package/dist/platform/runtime/store/domains/conversation.d.ts.map +1 -1
- package/dist/platform/runtime/store/domains/conversation.js +0 -1
- package/dist/platform/runtime/store/helpers/reducers/conversation.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/conversation.js +20 -2
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.js +6 -0
- package/dist/platform/runtime/store/helpers/reducers/sync.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/sync.js +7 -1
- package/dist/platform/runtime/tools/phases/execute.d.ts.map +1 -1
- package/dist/platform/runtime/tools/phases/execute.js +11 -1
- package/dist/platform/runtime/ui-read-models-core.d.ts.map +1 -1
- package/dist/platform/runtime/ui-read-models-core.js +4 -1
- package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/platform/tools/exec/runtime.js +9 -0
- package/dist/platform/tools/shared/overflow.d.ts.map +1 -1
- package/dist/platform/tools/shared/overflow.js +21 -2
- package/dist/platform/types/errors.d.ts +26 -0
- package/dist/platform/types/errors.d.ts.map +1 -1
- package/dist/platform/types/errors.js +63 -1
- package/dist/platform/utils/error-display.d.ts.map +1 -1
- package/dist/platform/utils/error-display.js +14 -6
- package/dist/platform/utils/retry.d.ts +4 -2
- package/dist/platform/utils/retry.d.ts.map +1 -1
- package/dist/platform/utils/retry.js +4 -2
- package/dist/platform/version.js +1 -1
- package/dist/platform/voice/providers/shared.d.ts.map +1 -1
- package/dist/platform/voice/providers/shared.js +2 -3
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -25,13 +25,23 @@ const sdk = createGoodVibesSdk({
|
|
|
25
25
|
console.log(await sdk.operator.control.snapshot());
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Primary entry points (see [public-surface.md](../../docs/public-surface.md) and the package `exports` map for the complete list):
|
|
29
29
|
- `@pellux/goodvibes-sdk`
|
|
30
30
|
- `@pellux/goodvibes-sdk/auth`
|
|
31
|
+
- `@pellux/goodvibes-sdk/client-auth`
|
|
31
32
|
- `@pellux/goodvibes-sdk/operator`
|
|
32
33
|
- `@pellux/goodvibes-sdk/peer`
|
|
33
34
|
- `@pellux/goodvibes-sdk/contracts`
|
|
35
|
+
- `@pellux/goodvibes-sdk/contracts/node`
|
|
36
|
+
- `@pellux/goodvibes-sdk/errors`
|
|
37
|
+
- `@pellux/goodvibes-sdk/events`
|
|
38
|
+
- `@pellux/goodvibes-sdk/observer`
|
|
39
|
+
- `@pellux/goodvibes-sdk/transport-core`
|
|
40
|
+
- `@pellux/goodvibes-sdk/transport-http`
|
|
41
|
+
- `@pellux/goodvibes-sdk/transport-realtime`
|
|
42
|
+
- `@pellux/goodvibes-sdk/transport-direct`
|
|
34
43
|
- `@pellux/goodvibes-sdk/browser`
|
|
44
|
+
- `@pellux/goodvibes-sdk/browser/agent`
|
|
35
45
|
- `@pellux/goodvibes-sdk/browser/knowledge`
|
|
36
46
|
- `@pellux/goodvibes-sdk/browser/homeassistant`
|
|
37
47
|
- `@pellux/goodvibes-sdk/web`
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"product": {
|
|
4
4
|
"id": "goodvibes",
|
|
5
5
|
"surface": "operator",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.36.0"
|
|
7
7
|
},
|
|
8
8
|
"auth": {
|
|
9
9
|
"modes": [
|
|
@@ -19080,6 +19080,7 @@
|
|
|
19080
19080
|
],
|
|
19081
19081
|
"additionalProperties": false
|
|
19082
19082
|
},
|
|
19083
|
+
"dangerous": true,
|
|
19083
19084
|
"invokable": true
|
|
19084
19085
|
},
|
|
19085
19086
|
{
|
|
@@ -20213,6 +20214,7 @@
|
|
|
20213
20214
|
],
|
|
20214
20215
|
"additionalProperties": false
|
|
20215
20216
|
},
|
|
20217
|
+
"dangerous": true,
|
|
20216
20218
|
"invokable": true
|
|
20217
20219
|
},
|
|
20218
20220
|
{
|
|
@@ -25383,6 +25385,7 @@
|
|
|
25383
25385
|
],
|
|
25384
25386
|
"additionalProperties": false
|
|
25385
25387
|
},
|
|
25388
|
+
"dangerous": true,
|
|
25386
25389
|
"invokable": true
|
|
25387
25390
|
},
|
|
25388
25391
|
{
|
package/dist/events/agents.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export type AgentEvent =
|
|
|
75
75
|
durationMs: number;
|
|
76
76
|
output?: string;
|
|
77
77
|
toolCallsMade?: number;
|
|
78
|
+
/** Accumulated token usage for the agent's run, when the execution path tracked it. */
|
|
79
|
+
usage?: AgentUsage | undefined;
|
|
78
80
|
}
|
|
79
81
|
/** Agent failed with an error. */
|
|
80
82
|
| {
|
|
@@ -93,4 +95,16 @@ export type AgentEvent =
|
|
|
93
95
|
};
|
|
94
96
|
/** All agent event type literals as a union. */
|
|
95
97
|
export type AgentEventType = AgentEvent['type'];
|
|
98
|
+
/**
|
|
99
|
+
* Token usage for a single agent's run. Mirrors the shape of
|
|
100
|
+
* `TokenUsage` in `platform/core/conversation.ts` — kept as a structural
|
|
101
|
+
* duplicate here (rather than an import) so this leaf event module stays
|
|
102
|
+
* free of dependencies on `platform/`.
|
|
103
|
+
*/
|
|
104
|
+
export type AgentUsage = {
|
|
105
|
+
inputTokens: number;
|
|
106
|
+
outputTokens: number;
|
|
107
|
+
cacheReadTokens?: number | undefined;
|
|
108
|
+
cacheWriteTokens?: number | undefined;
|
|
109
|
+
};
|
|
96
110
|
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/events/agents.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;GAIG;AAEH,MAAM,MAAM,UAAU;AACpB,iDAAiD;AAC/C;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;IAChH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AACH,gDAAgD;GAC9C;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EA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Ac,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE;AAC/F,6CAA6C;GAC3C;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,CAAC"}
|
package/dist/events/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { TurnEvent, TurnEventType, TurnInputOrigin, TurnStopReason, Partial
|
|
|
12
12
|
export type { ProviderEvent, ProviderEventType } from './providers.js';
|
|
13
13
|
export type { ToolEvent, ToolEventType, ToolResultSummary } from './tools.js';
|
|
14
14
|
export type { TaskEvent, TaskEventType } from './tasks.js';
|
|
15
|
-
export type { AgentEvent, AgentEventType } from './agents.js';
|
|
15
|
+
export type { AgentEvent, AgentEventType, AgentUsage } from './agents.js';
|
|
16
16
|
export type { WorkflowEvent, WorkflowEventType, Constraint, WrfcState } from './workflows.js';
|
|
17
17
|
export type { OrchestrationEvent, OrchestrationEventType, OrchestrationTaskContract } from './orchestration.js';
|
|
18
18
|
export type { CommunicationEvent, CommunicationEventType, CommunicationKind, CommunicationScope } from './communication.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AA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EACzB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
package/dist/events/turn.d.ts
CHANGED
|
@@ -66,6 +66,23 @@ export type TurnEvent =
|
|
|
66
66
|
scope?: 'provider';
|
|
67
67
|
terminal?: false;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* A provider chat call hit a retryable transport error mid-stream and is
|
|
71
|
+
* about to retry the same request against the same provider after a delay.
|
|
72
|
+
*
|
|
73
|
+
* This is distinct from provider failover (a new provider chosen after a
|
|
74
|
+
* terminal TURN_ERROR): STREAM_RETRY fires from inside a single in-flight
|
|
75
|
+
* `provider.chat()` call, before any TURN_ERROR is ever raised.
|
|
76
|
+
*/
|
|
77
|
+
| {
|
|
78
|
+
type: 'STREAM_RETRY';
|
|
79
|
+
turnId: string;
|
|
80
|
+
provider: string;
|
|
81
|
+
attempt: number;
|
|
82
|
+
maxAttempts: number;
|
|
83
|
+
delayMs: number;
|
|
84
|
+
reason: string;
|
|
85
|
+
}
|
|
69
86
|
/** An LLM request is about to be dispatched to the provider. */
|
|
70
87
|
| {
|
|
71
88
|
type: 'LLM_REQUEST_STARTED';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../src/events/turn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACnE;AAED,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,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|
|
50
|
+
* Why the chain failed. 'transport' means the failure was classified as a
|
|
51
|
+
* transient network/transport error (and had already exhausted its automatic
|
|
52
|
+
* retry budget — see WrfcChain.transportRetryCount); absent/'other' covers
|
|
53
|
+
* ordinary review/gate rejections and anything else. Optional so existing
|
|
54
|
+
* consumers that don't inspect it keep working unchanged.
|
|
55
|
+
*/
|
|
56
|
+
failureKind?: 'transport' | 'other' | undefined;
|
|
49
57
|
} | {
|
|
50
58
|
type: 'WORKFLOW_AUTO_COMMITTED';
|
|
51
59
|
chainId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/events/workflows.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,aAAa,GACb,aAAa,GACb,WAAW,GACX,QAAQ,GACR,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAEjB,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,SAAS,CAAA;CAAE,GACnF;IACE,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,mFAAm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,UAAU,EAAE,CAAA;CAAE,GACvF;IAAE,IAAI,EAAE,2BAA2B,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -9,6 +9,21 @@ import type { SubagentInfo, SubagentResult, SubagentTask } from './protocol.js';
|
|
|
9
9
|
import type { PermissionRequestHandler } from '../permissions/prompt.js';
|
|
10
10
|
import type { RuntimeEventBus } from '../runtime/events/index.js';
|
|
11
11
|
import type { HookDispatcher } from '../hooks/index.js';
|
|
12
|
+
import type { AgentUsage } from '../../events/agents.js';
|
|
13
|
+
/** Shape of the (experimental/unstable) ACP `PromptResponse.usage` field. */
|
|
14
|
+
interface AcpPromptUsage {
|
|
15
|
+
inputTokens: number;
|
|
16
|
+
outputTokens: number;
|
|
17
|
+
cachedReadTokens?: number | null;
|
|
18
|
+
cachedWriteTokens?: number | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Map the ACP prompt response's usage field (`cachedReadTokens`/`cachedWriteTokens`,
|
|
22
|
+
* ACP protocol naming) onto the SDK's `AgentUsage` shape (`cacheReadTokens`/
|
|
23
|
+
* `cacheWriteTokens`). Exported for unit testing without spawning a real
|
|
24
|
+
* ACP subprocess.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mapAcpUsage(usage: AcpPromptUsage | null | undefined): AgentUsage | undefined;
|
|
12
27
|
/**
|
|
13
28
|
* AcpConnection manages the lifecycle of a single subagent child process.
|
|
14
29
|
*
|
|
@@ -56,4 +71,5 @@ export declare class AcpConnection {
|
|
|
56
71
|
private buildClientImpl;
|
|
57
72
|
private buildPromptText;
|
|
58
73
|
}
|
|
74
|
+
export {};
|
|
59
75
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/platform/acp/connection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAKzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAalE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/platform/acp/connection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAKzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAalE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAgBzD,6EAA6E;AAC7E,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAQ5F;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAa;IAgBtB,OAAO,CAAC,IAAI;IAfd,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,iBAAiB,CAA2B;IACpD,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,IAAI,CAAqC;IACjD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAA6C;IACjE,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsC;gBAGnE,EAAE,EAAE,MAAM,EACF,IAAI,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,EAAE,EAClB,iBAAiB,GAAE,wBAA6E,EAChG,UAAU,GAAE,eAAe,GAAG,IAAW,EACzC,cAAc,GAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,IAAW;IAe5D,6BAA6B;IAC7B,OAAO,IAAI,YAAY;IAIvB;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;IAyHpC,mCAAmC;IAC7B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB7B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,yBAAyB;IAYjC,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,4BAA4B;YAatB,iBAAiB;IAqB/B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,eAAe;IAiEvB,OAAO,CAAC,eAAe;CAiBxB"}
|
|
@@ -17,6 +17,22 @@ function isMessageChunk(update) {
|
|
|
17
17
|
return (update.sessionUpdate === 'agent_message_chunk' &&
|
|
18
18
|
('content' in update));
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Map the ACP prompt response's usage field (`cachedReadTokens`/`cachedWriteTokens`,
|
|
22
|
+
* ACP protocol naming) onto the SDK's `AgentUsage` shape (`cacheReadTokens`/
|
|
23
|
+
* `cacheWriteTokens`). Exported for unit testing without spawning a real
|
|
24
|
+
* ACP subprocess.
|
|
25
|
+
*/
|
|
26
|
+
export function mapAcpUsage(usage) {
|
|
27
|
+
if (!usage)
|
|
28
|
+
return undefined;
|
|
29
|
+
return {
|
|
30
|
+
inputTokens: usage.inputTokens,
|
|
31
|
+
outputTokens: usage.outputTokens,
|
|
32
|
+
...(usage.cachedReadTokens != null ? { cacheReadTokens: usage.cachedReadTokens } : {}),
|
|
33
|
+
...(usage.cachedWriteTokens != null ? { cacheWriteTokens: usage.cachedWriteTokens } : {}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
20
36
|
/**
|
|
21
37
|
* AcpConnection manages the lifecycle of a single subagent child process.
|
|
22
38
|
*
|
|
@@ -142,6 +158,7 @@ export class AcpConnection {
|
|
|
142
158
|
durationMs: result.duration,
|
|
143
159
|
output: result.output,
|
|
144
160
|
toolCallsMade: result.toolCallsMade,
|
|
161
|
+
usage: mapAcpUsage(promptResp.usage),
|
|
145
162
|
});
|
|
146
163
|
}
|
|
147
164
|
this.emitTransportDisconnected('ACP session completed', false);
|
|
@@ -23,7 +23,7 @@ export interface AgentOrchestratorRunContext {
|
|
|
23
23
|
readonly emitOrchestrationCancelled: (record: AgentRecord, reason: string) => void;
|
|
24
24
|
readonly emitAgentFailedEvent: (recordId: string, error: string, durationMs: number) => void;
|
|
25
25
|
readonly emitOrchestrationFailed: (record: AgentRecord, error: string) => void;
|
|
26
|
-
readonly emitAgentCompletedEvent: (recordId: string, durationMs: number, output: string, toolCallsMade: number) => void;
|
|
26
|
+
readonly emitAgentCompletedEvent: (recordId: string, durationMs: number, output: string, toolCallsMade: number, usage: AgentRecord['usage'] | undefined) => void;
|
|
27
27
|
readonly emitOrchestrationCompleted: (record: AgentRecord, output: string) => void;
|
|
28
28
|
readonly emitStreamDelta: (recordId: string, content: string, accumulated: string) => void;
|
|
29
29
|
readonly processManager?: ProcessManager | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-runner.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/orchestrator-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrator-runner.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/orchestrator-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,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jD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,YAAY,CAAC,EAC1E,WAAW,EAAE,mBAAmB,GAC/B,eAAe,CAuBjB;AAgQD,wBAAsB,YAAY,CAChC,OAAO,EAAE,2BAA2B,EACpC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAoVf"}
|
|
@@ -10,7 +10,7 @@ import { join } from 'node:path';
|
|
|
10
10
|
import { splitModelRegistryKey } from '../providers/registry-helpers.js';
|
|
11
11
|
import { logger } from '../utils/logger.js';
|
|
12
12
|
import { ConsecutiveErrorBreaker } from '../core/circuit-breaker.js';
|
|
13
|
-
import { isRateLimitOrQuotaError, isContextSizeExceededError } from '../types/errors.js';
|
|
13
|
+
import { isRateLimitOrQuotaError, isContextSizeExceededError, isNetworkTransportError } from '../types/errors.js';
|
|
14
14
|
import { AgentSession } from './session.js';
|
|
15
15
|
import { estimateTokens, estimateConversationTokens, compactSmallWindow, } from '../core/context-compaction.js';
|
|
16
16
|
import { summarizeToolArgs } from './orchestrator-utils.js';
|
|
@@ -22,7 +22,6 @@ const MAX_TURNS = 50; // hard cap per agent run to prevent unbounded loops
|
|
|
22
22
|
const NETWORK_RETRY_DELAYS_MS = [5_000, 10_000, 20_000, 40_000, 60_000]; // exponential back-off on transient network errors
|
|
23
23
|
const RATE_LIMIT_RETRY_DELAY_MS = 60_000; // fixed pause on 429/quota responses
|
|
24
24
|
const RATE_LIMIT_MAX_RETRIES = 3; // cap retries so a sustained quota violation terminates cleanly
|
|
25
|
-
const MAX_CHAT_RETRY_ITERATIONS = NETWORK_RETRY_DELAYS_MS.length + RATE_LIMIT_MAX_RETRIES + 4; // total iteration budget across all retry categories
|
|
26
25
|
const CONTEXT_COMPACT_THRESHOLD = 0.85; // fraction of context window at which compaction is triggered
|
|
27
26
|
const MIN_WINDOW_FOR_LLM_COMPACT = 12_000; // don't attempt LLM-driven compaction below this token floor
|
|
28
27
|
function parseProviderQualifiedRouteId(modelId) {
|
|
@@ -58,24 +57,6 @@ export function resolveContextWindowModelDefinition(providerRegistry, activeRout
|
|
|
58
57
|
(model.id === activeRoute.modelId ||
|
|
59
58
|
model.id === activeRoute.requestedModelId)) ?? providerRegistry.getCurrentModel();
|
|
60
59
|
}
|
|
61
|
-
function isNetworkError(err) {
|
|
62
|
-
if (!(err instanceof Error))
|
|
63
|
-
return false;
|
|
64
|
-
const msg = err.message.toLowerCase();
|
|
65
|
-
return (msg.includes('fetch failed') ||
|
|
66
|
-
msg.includes('econnrefused') ||
|
|
67
|
-
msg.includes('enotfound') ||
|
|
68
|
-
msg.includes('network error') ||
|
|
69
|
-
msg.includes('network timeout') ||
|
|
70
|
-
msg.includes('networkerror') ||
|
|
71
|
-
msg.includes('econnreset') ||
|
|
72
|
-
msg.includes('etimedout') ||
|
|
73
|
-
msg.includes('socket hang up') ||
|
|
74
|
-
msg.includes('dns') ||
|
|
75
|
-
msg.includes('connection lost') ||
|
|
76
|
-
msg.includes('epipe') ||
|
|
77
|
-
msg.includes('ehostunreach'));
|
|
78
|
-
}
|
|
79
60
|
function applyContextWindowAwareness(context, record, modelId, modelWindow, conversation, systemPrompt, toolTokens, turn) {
|
|
80
61
|
if (!(context.featureFlagManager?.isEnabled('agent-context-window-awareness') ?? true)) {
|
|
81
62
|
return systemPrompt;
|
|
@@ -197,7 +178,7 @@ async function finalizeAgentRun(context, record, session, preAgentProcessIds) {
|
|
|
197
178
|
record.completedAt = Date.now();
|
|
198
179
|
cleanupLeakedProcesses(context.processManager, preAgentProcessIds);
|
|
199
180
|
if (context.runtimeBus && record.status !== 'failed' && statusAfterLoop !== 'cancelled') {
|
|
200
|
-
context.emitAgentCompletedEvent(record.id, (record.completedAt ?? Date.now()) - record.startedAt, record.fullOutput ?? '', record.toolCallCount);
|
|
181
|
+
context.emitAgentCompletedEvent(record.id, (record.completedAt ?? Date.now()) - record.startedAt, record.fullOutput ?? '', record.toolCallCount, record.usage);
|
|
201
182
|
context.emitOrchestrationCompleted(record, record.fullOutput ?? '');
|
|
202
183
|
}
|
|
203
184
|
if (record.status === 'failed') {
|
|
@@ -321,6 +302,14 @@ export async function runAgentTask(context, record) {
|
|
|
321
302
|
const LOOP_USER_THRESHOLD = 5;
|
|
322
303
|
const CALL_HISTORY_WINDOW = 20;
|
|
323
304
|
const circuitBreaker = new ConsecutiveErrorBreaker();
|
|
305
|
+
// Track which inter-agent messages have already been injected so a single
|
|
306
|
+
// directive/broadcast is appended to the conversation exactly once (getMessages
|
|
307
|
+
// returns all unexpired messages every turn until their TTL elapses).
|
|
308
|
+
const injectedMessageIds = new Set();
|
|
309
|
+
// Iteration budget for the chat retry loop. Includes one slot per fallback
|
|
310
|
+
// route so fallback-model transitions don't cannibalize the network/rate-limit
|
|
311
|
+
// retry allowances.
|
|
312
|
+
const maxChatRetryIterations = NETWORK_RETRY_DELAYS_MS.length + RATE_LIMIT_MAX_RETRIES + fallbackRoutes.length + 4;
|
|
324
313
|
while (continueLoop) {
|
|
325
314
|
if (record.status === 'cancelled') {
|
|
326
315
|
record.completedAt = Date.now();
|
|
@@ -350,6 +339,13 @@ export async function runAgentTask(context, record) {
|
|
|
350
339
|
session.appendMessage({ type: 'llm_request', turn, messageCount: conversation.getMessagesForLLM().length, timestamp: new Date().toISOString() });
|
|
351
340
|
const pending = context.messageBus.getMessages(record.id);
|
|
352
341
|
for (const msg of pending) {
|
|
342
|
+
// Skip the agent's own broadcasts and any message already injected on a
|
|
343
|
+
// prior turn so each directive is surfaced to the model exactly once.
|
|
344
|
+
if (msg.from === record.id)
|
|
345
|
+
continue;
|
|
346
|
+
if (injectedMessageIds.has(msg.id))
|
|
347
|
+
continue;
|
|
348
|
+
injectedMessageIds.add(msg.id);
|
|
353
349
|
const kindLabel = (msg.kind[0] ?? '').toUpperCase() + msg.kind.slice(1);
|
|
354
350
|
conversation.addUserMessage(`[${kindLabel} from ${msg.from}]: ${msg.content}`);
|
|
355
351
|
}
|
|
@@ -363,7 +359,7 @@ export async function runAgentTask(context, record) {
|
|
|
363
359
|
let networkAttempt = 0;
|
|
364
360
|
let rateLimitAttempt = 0;
|
|
365
361
|
let contextRetried = false;
|
|
366
|
-
for (let chatRetryIteration = 0; chatRetryIteration <
|
|
362
|
+
for (let chatRetryIteration = 0; chatRetryIteration < maxChatRetryIterations; chatRetryIteration++) {
|
|
367
363
|
let streamAccumulated = '';
|
|
368
364
|
record.streamingContent = undefined;
|
|
369
365
|
const onDelta = (delta) => {
|
|
@@ -423,7 +419,7 @@ export async function runAgentTask(context, record) {
|
|
|
423
419
|
context.emitAgentProgress(record.id, record.progress);
|
|
424
420
|
context.emitOrchestrationProgress(record, record.progress);
|
|
425
421
|
}
|
|
426
|
-
else if (
|
|
422
|
+
else if (isNetworkTransportError(chatErr) && networkAttempt < NETWORK_RETRY_DELAYS_MS.length) {
|
|
427
423
|
const delayMs = NETWORK_RETRY_DELAYS_MS[networkAttempt];
|
|
428
424
|
const delaySec = Math.round(delayMs / 1000);
|
|
429
425
|
logger.warn(`Agent ${record.id}: network error on turn ${turn}, retrying in ${delaySec}s (attempt ${networkAttempt + 1}/${NETWORK_RETRY_DELAYS_MS.length})`, { error: chatErr instanceof Error ? chatErr.message : String(chatErr) });
|
|
@@ -460,7 +456,7 @@ export async function runAgentTask(context, record) {
|
|
|
460
456
|
}
|
|
461
457
|
}
|
|
462
458
|
if (response === undefined) {
|
|
463
|
-
throw new Error(`Agent ${record.id}: chat retry loop exceeded ${
|
|
459
|
+
throw new Error(`Agent ${record.id}: chat retry loop exceeded ${maxChatRetryIterations} iterations`);
|
|
464
460
|
}
|
|
465
461
|
record.streamingContent = undefined;
|
|
466
462
|
record.progress = `Turn ${turn} · Thinking…`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,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{
|
|
|
103
103
|
error,
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
emitAgentCompletedEvent(recordId, durationMs, output, toolCallsMade) {
|
|
106
|
+
emitAgentCompletedEvent(recordId, durationMs, output, toolCallsMade, usage) {
|
|
107
107
|
if (!this.runtimeBus)
|
|
108
108
|
return;
|
|
109
109
|
emitAgentCompleted(this.runtimeBus, this.emitterContext(recordId), {
|
|
@@ -111,6 +111,7 @@ export class AgentOrchestrator {
|
|
|
111
111
|
durationMs,
|
|
112
112
|
output,
|
|
113
113
|
toolCallsMade,
|
|
114
|
+
usage,
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
emitOrchestrationCompleted(record, output) {
|
|
@@ -340,7 +341,7 @@ export class AgentOrchestrator {
|
|
|
340
341
|
emitOrchestrationCancelled: (record, reason) => this.emitOrchestrationCancelled(record, reason),
|
|
341
342
|
emitAgentFailedEvent: (recordId, error, durationMs) => this.emitAgentFailedEvent(recordId, error, durationMs),
|
|
342
343
|
emitOrchestrationFailed: (record, error) => this.emitOrchestrationFailed(record, error),
|
|
343
|
-
emitAgentCompletedEvent: (recordId, durationMs, output, toolCallsMade) => this.emitAgentCompletedEvent(recordId, durationMs, output, toolCallsMade),
|
|
344
|
+
emitAgentCompletedEvent: (recordId, durationMs, output, toolCallsMade, usage) => this.emitAgentCompletedEvent(recordId, durationMs, output, toolCallsMade, usage),
|
|
344
345
|
emitOrchestrationCompleted: (record, output) => this.emitOrchestrationCompleted(record, output),
|
|
345
346
|
emitStreamDelta: (recordId, content, accumulated) => this.emitStreamDelta(recordId, content, accumulated),
|
|
346
347
|
processManager: this.toolDeps?.processManager,
|
|
@@ -22,7 +22,17 @@ export declare class AgentWorktree {
|
|
|
22
22
|
* Returns true if a merge was performed, false if no changes were found.
|
|
23
23
|
*/
|
|
24
24
|
merge(agentId: string): Promise<boolean>;
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @param paths When provided (non-empty), stage only these paths instead of sweeping the
|
|
27
|
+
* whole working tree. Paths are self-reported LLM claims, not ground truth, so they are
|
|
28
|
+
* filtered before staging: a path that exists on disk (created/modified) is kept outright;
|
|
29
|
+
* a path that does not exist is kept only if `git ls-files` shows it as tracked (a real
|
|
30
|
+
* deletion), otherwise it is a hallucinated path and dropped. This matters because
|
|
31
|
+
* `git add -A -- <path>` throws "pathspec did not match any files" for a path that is
|
|
32
|
+
* neither on disk nor known to git — a single bad claim must not fail the whole batch.
|
|
33
|
+
* Omit (or pass an empty array) to keep the legacy `git add --all` sweep for back-compat.
|
|
34
|
+
*/
|
|
35
|
+
commitWorkingTree(message: string, paths?: string[]): Promise<string | null>;
|
|
26
36
|
currentHead(): Promise<string | null>;
|
|
27
37
|
/**
|
|
28
38
|
* Remove the worktree without merging (cancel/error path).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/worktree.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;gBAErB,GAAG,EAAE,MAAM;IAIvB;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU9C;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/worktree.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;gBAErB,GAAG,EAAE,MAAM;IAIvB;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU9C;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqC9C;;;;;;;;;OASG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA2D5E,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAU3C;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB7C,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;IAInB;;;OAGG;YACW,WAAW;YAeX,aAAa;IAU3B;;OAEG;YACW,eAAe;IAgB7B;;OAEG;YACW,aAAa;CAQ5B"}
|
|
@@ -64,22 +64,56 @@ export class AgentWorktree {
|
|
|
64
64
|
logger.debug('AgentWorktree.merge: complete', { agentId });
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* @param paths When provided (non-empty), stage only these paths instead of sweeping the
|
|
69
|
+
* whole working tree. Paths are self-reported LLM claims, not ground truth, so they are
|
|
70
|
+
* filtered before staging: a path that exists on disk (created/modified) is kept outright;
|
|
71
|
+
* a path that does not exist is kept only if `git ls-files` shows it as tracked (a real
|
|
72
|
+
* deletion), otherwise it is a hallucinated path and dropped. This matters because
|
|
73
|
+
* `git add -A -- <path>` throws "pathspec did not match any files" for a path that is
|
|
74
|
+
* neither on disk nor known to git — a single bad claim must not fail the whole batch.
|
|
75
|
+
* Omit (or pass an empty array) to keep the legacy `git add --all` sweep for back-compat.
|
|
76
|
+
*/
|
|
77
|
+
async commitWorkingTree(message, paths) {
|
|
68
78
|
const git = simpleGit({ baseDir: this.git.getCwd() });
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const scoped = paths && paths.length > 0 ? paths : null;
|
|
80
|
+
if (scoped) {
|
|
81
|
+
const cwd = this.git.getCwd();
|
|
82
|
+
const onDisk = scoped.filter((p) => existsSync(join(cwd, p)));
|
|
83
|
+
const maybeDeleted = scoped.filter((p) => !onDisk.includes(p));
|
|
84
|
+
let trackedDeleted = [];
|
|
85
|
+
if (maybeDeleted.length > 0) {
|
|
86
|
+
const tracked = await git.raw(['ls-files', '--', ...maybeDeleted]);
|
|
87
|
+
const trackedSet = new Set(tracked.split('\n').map((line) => line.trim()).filter(Boolean));
|
|
88
|
+
trackedDeleted = maybeDeleted.filter((p) => trackedSet.has(p));
|
|
89
|
+
}
|
|
90
|
+
const existingPaths = [...onDisk, ...trackedDeleted];
|
|
91
|
+
if (existingPaths.length === 0) {
|
|
92
|
+
logger.debug('AgentWorktree.commitWorkingTree: no scoped paths exist on disk or in the index, nothing to stage', {
|
|
93
|
+
claimedPaths: scoped,
|
|
94
|
+
});
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
// -A (not plain add) scoped to just these pathspecs so confirmed deletions are staged
|
|
98
|
+
// too (plain `git add <path>` silently no-ops on a path that no longer exists on disk).
|
|
99
|
+
await git.raw(['add', '-A', '--', ...existingPaths]);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const status = await git.raw([
|
|
103
|
+
'status',
|
|
104
|
+
'--porcelain',
|
|
105
|
+
'--untracked-files=all',
|
|
106
|
+
'--',
|
|
107
|
+
'.',
|
|
108
|
+
':(exclude).goodvibes',
|
|
109
|
+
':(exclude).goodvibes/**',
|
|
110
|
+
]);
|
|
111
|
+
if (status.trim().length === 0) {
|
|
112
|
+
logger.debug('AgentWorktree.commitWorkingTree: no direct working tree changes');
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
await git.raw(['add', '--all', '--', '.', ':(exclude).goodvibes', ':(exclude).goodvibes/**']);
|
|
81
116
|
}
|
|
82
|
-
await git.raw(['add', '--all', '--', '.', ':(exclude).goodvibes', ':(exclude).goodvibes/**']);
|
|
83
117
|
try {
|
|
84
118
|
const result = await this.git.commit(message, {
|
|
85
119
|
fallbackIdentity: { name: 'GoodVibes', email: 'goodvibes@local' },
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { ConfigManager } from '../config/manager.js';
|
|
2
2
|
import type { AgentManager } from '../tools/agent/index.js';
|
|
3
3
|
export type AgentManagerLike = Pick<AgentManager, 'spawn' | 'getStatus' | 'list' | 'cancel' | 'listByCohort' | 'clear'>;
|
|
4
|
+
export type WrfcCommitScope = 'off' | 'scoped' | 'all';
|
|
4
5
|
export type WrfcConfigLike = {
|
|
5
6
|
scoreThreshold: number;
|
|
6
7
|
maxFixAttempts: number;
|
|
7
8
|
autoCommit: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Scope of files staged on WRFC auto-commit:
|
|
11
|
+
* - 'off': never commit on gate pass.
|
|
12
|
+
* - 'scoped' (default): stage only the paths the chain's own completion reports claim
|
|
13
|
+
* to have touched (see collectChainTouchedPaths in wrfc-controller.ts).
|
|
14
|
+
* - 'all': legacy full-tree `git add -A` sweep.
|
|
15
|
+
*/
|
|
16
|
+
commitScope: WrfcCommitScope;
|
|
8
17
|
gates: Array<{
|
|
9
18
|
name: string;
|
|
10
19
|
command: string;
|
|
@@ -15,12 +24,26 @@ export type WrfcConfigLike = {
|
|
|
15
24
|
* as hung/silent and failing the chain. Default: 0 (disabled).
|
|
16
25
|
*/
|
|
17
26
|
agentHeartbeatTimeoutMs: number;
|
|
27
|
+
/**
|
|
28
|
+
* How many times a chain will auto-retry a transport-classified child-agent
|
|
29
|
+
* failure (respawning the same role) before failing the chain outright.
|
|
30
|
+
* Separate from maxFixAttempts — a transport blip is not a fix cycle. Default: 1.
|
|
31
|
+
*/
|
|
32
|
+
transportRetryLimit: number;
|
|
33
|
+
/**
|
|
34
|
+
* How long (in ms) to wait before respawning after a transport-classified
|
|
35
|
+
* failure. Default: 5000.
|
|
36
|
+
*/
|
|
37
|
+
transportRetryDelayMs: number;
|
|
18
38
|
};
|
|
19
39
|
export type WrfcConfigReader = Pick<ConfigManager, 'get' | 'getCategory'>;
|
|
20
40
|
export declare function readWrfcConfig(configManager: WrfcConfigReader): WrfcConfigLike;
|
|
21
41
|
export declare function getWrfcAgentHeartbeatTimeoutMs(configManager: WrfcConfigReader): number;
|
|
42
|
+
export declare function getWrfcTransportRetryLimit(configManager: WrfcConfigReader): number;
|
|
43
|
+
export declare function getWrfcTransportRetryDelayMs(configManager: WrfcConfigReader): number;
|
|
22
44
|
export declare function getWrfcScoreThreshold(configManager: WrfcConfigReader): number;
|
|
23
45
|
export declare function getWrfcMaxFixAttempts(configManager: WrfcConfigReader): number;
|
|
24
46
|
export declare function getWrfcAutoCommit(configManager: WrfcConfigReader): boolean;
|
|
47
|
+
export declare function getWrfcCommitScope(configManager: WrfcConfigReader): WrfcCommitScope;
|
|
25
48
|
export declare function getEnabledWrfcGates(configManager: WrfcConfigReader): WrfcConfigLike['gates'];
|
|
26
49
|
//# sourceMappingURL=wrfc-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrfc-config.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/wrfc-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC,CAAC;AACxH,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,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