@pellux/goodvibes-agent 1.7.0 → 1.8.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/package/main.js +758 -81
- package/docs/README.md +1 -1
- package/package.json +2 -2
- package/release/live-verification/live-verification.json +12 -12
- package/release/live-verification/live-verification.md +13 -13
- package/src/runtime/services.ts +5 -3
- package/src/runtime/ui/model-picker/types.ts +3 -1
- package/src/version.ts +1 -1
package/dist/package/main.js
CHANGED
|
@@ -4463,7 +4463,7 @@ var init_mcp = __esm(() => {
|
|
|
4463
4463
|
// node_modules/@pellux/goodvibes-sdk/dist/platform/version.js
|
|
4464
4464
|
import { readFileSync as readFileSync3 } from "fs";
|
|
4465
4465
|
import { join as join4 } from "path";
|
|
4466
|
-
var version = "1.
|
|
4466
|
+
var version = "1.6.1", VERSION2;
|
|
4467
4467
|
var init_version = __esm(() => {
|
|
4468
4468
|
try {
|
|
4469
4469
|
const pkg = JSON.parse(readFileSync3(join4(import.meta.dir, "..", "..", "package.json"), "utf-8"));
|
|
@@ -264151,8 +264151,8 @@ var FOUNDATION_METADATA;
|
|
|
264151
264151
|
var init_foundation_metadata = __esm(() => {
|
|
264152
264152
|
FOUNDATION_METADATA = {
|
|
264153
264153
|
productId: "goodvibes",
|
|
264154
|
-
productVersion: "1.
|
|
264155
|
-
operatorMethodCount:
|
|
264154
|
+
productVersion: "1.6.1",
|
|
264155
|
+
operatorMethodCount: 333,
|
|
264156
264156
|
operatorEventCount: 31,
|
|
264157
264157
|
peerEndpointCount: 6
|
|
264158
264158
|
};
|
|
@@ -264166,7 +264166,7 @@ var init_operator_contract = __esm(() => {
|
|
|
264166
264166
|
product: {
|
|
264167
264167
|
id: "goodvibes",
|
|
264168
264168
|
surface: "operator",
|
|
264169
|
-
version: "1.
|
|
264169
|
+
version: "1.6.1"
|
|
264170
264170
|
},
|
|
264171
264171
|
auth: {
|
|
264172
264172
|
modes: [
|
|
@@ -290713,6 +290713,322 @@ var init_operator_contract = __esm(() => {
|
|
|
290713
290713
|
dangerous: true,
|
|
290714
290714
|
invokable: false
|
|
290715
290715
|
},
|
|
290716
|
+
{
|
|
290717
|
+
id: "fleet.archive",
|
|
290718
|
+
title: "Archive Finished Fleet Subtree",
|
|
290719
|
+
description: "Move one FINISHED process subtree (root id + all descendants, every node terminal) out of the live fleet view into the session archive. Honest refusal (archived:false + reason) for an unknown id or a subtree with live members. Archived nodes stay inspectable via fleet.archived.list.",
|
|
290720
|
+
category: "fleet",
|
|
290721
|
+
source: "builtin",
|
|
290722
|
+
access: "authenticated",
|
|
290723
|
+
transport: [
|
|
290724
|
+
"ws"
|
|
290725
|
+
],
|
|
290726
|
+
scopes: [
|
|
290727
|
+
"write:fleet"
|
|
290728
|
+
],
|
|
290729
|
+
inputSchema: {
|
|
290730
|
+
type: "object",
|
|
290731
|
+
properties: {
|
|
290732
|
+
id: {
|
|
290733
|
+
type: "string"
|
|
290734
|
+
}
|
|
290735
|
+
},
|
|
290736
|
+
required: [
|
|
290737
|
+
"id"
|
|
290738
|
+
],
|
|
290739
|
+
additionalProperties: false
|
|
290740
|
+
},
|
|
290741
|
+
outputSchema: {
|
|
290742
|
+
type: "object",
|
|
290743
|
+
properties: {
|
|
290744
|
+
archived: {
|
|
290745
|
+
type: "boolean"
|
|
290746
|
+
},
|
|
290747
|
+
count: {
|
|
290748
|
+
type: "number"
|
|
290749
|
+
},
|
|
290750
|
+
reason: {
|
|
290751
|
+
type: "string"
|
|
290752
|
+
}
|
|
290753
|
+
},
|
|
290754
|
+
required: [
|
|
290755
|
+
"archived",
|
|
290756
|
+
"count"
|
|
290757
|
+
],
|
|
290758
|
+
additionalProperties: false
|
|
290759
|
+
},
|
|
290760
|
+
invokable: true
|
|
290761
|
+
},
|
|
290762
|
+
{
|
|
290763
|
+
id: "fleet.archived.list",
|
|
290764
|
+
title: "List Archived Fleet Processes",
|
|
290765
|
+
description: "Return the session-archived process nodes (same node shape as fleet.snapshot; still live-derived from the source managers, so usage/cost stay current).",
|
|
290766
|
+
category: "fleet",
|
|
290767
|
+
source: "builtin",
|
|
290768
|
+
access: "authenticated",
|
|
290769
|
+
transport: [
|
|
290770
|
+
"ws"
|
|
290771
|
+
],
|
|
290772
|
+
scopes: [
|
|
290773
|
+
"read:fleet"
|
|
290774
|
+
],
|
|
290775
|
+
inputSchema: {
|
|
290776
|
+
type: "object",
|
|
290777
|
+
properties: {},
|
|
290778
|
+
additionalProperties: false
|
|
290779
|
+
},
|
|
290780
|
+
outputSchema: {
|
|
290781
|
+
type: "object",
|
|
290782
|
+
properties: {
|
|
290783
|
+
capturedAt: {
|
|
290784
|
+
type: "number"
|
|
290785
|
+
},
|
|
290786
|
+
nodes: {
|
|
290787
|
+
type: "array",
|
|
290788
|
+
items: {
|
|
290789
|
+
type: "object",
|
|
290790
|
+
properties: {
|
|
290791
|
+
id: {
|
|
290792
|
+
type: "string"
|
|
290793
|
+
},
|
|
290794
|
+
kind: {
|
|
290795
|
+
type: "string",
|
|
290796
|
+
enum: [
|
|
290797
|
+
"agent",
|
|
290798
|
+
"wrfc-chain",
|
|
290799
|
+
"wrfc-subtask",
|
|
290800
|
+
"workflow",
|
|
290801
|
+
"trigger",
|
|
290802
|
+
"schedule",
|
|
290803
|
+
"watcher",
|
|
290804
|
+
"background-process",
|
|
290805
|
+
"workstream",
|
|
290806
|
+
"phase",
|
|
290807
|
+
"work-item",
|
|
290808
|
+
"code-index"
|
|
290809
|
+
]
|
|
290810
|
+
},
|
|
290811
|
+
parentId: {
|
|
290812
|
+
type: "string"
|
|
290813
|
+
},
|
|
290814
|
+
label: {
|
|
290815
|
+
type: "string"
|
|
290816
|
+
},
|
|
290817
|
+
task: {
|
|
290818
|
+
type: "string"
|
|
290819
|
+
},
|
|
290820
|
+
state: {
|
|
290821
|
+
type: "string",
|
|
290822
|
+
enum: [
|
|
290823
|
+
"thinking",
|
|
290824
|
+
"executing-tool",
|
|
290825
|
+
"awaiting-approval",
|
|
290826
|
+
"streaming",
|
|
290827
|
+
"stalled",
|
|
290828
|
+
"retrying",
|
|
290829
|
+
"done",
|
|
290830
|
+
"failed",
|
|
290831
|
+
"killed",
|
|
290832
|
+
"interrupted",
|
|
290833
|
+
"idle",
|
|
290834
|
+
"queued",
|
|
290835
|
+
"paused"
|
|
290836
|
+
]
|
|
290837
|
+
},
|
|
290838
|
+
startedAt: {
|
|
290839
|
+
type: "number"
|
|
290840
|
+
},
|
|
290841
|
+
completedAt: {
|
|
290842
|
+
type: "number"
|
|
290843
|
+
},
|
|
290844
|
+
elapsedMs: {
|
|
290845
|
+
type: "number"
|
|
290846
|
+
},
|
|
290847
|
+
usage: {
|
|
290848
|
+
type: "object",
|
|
290849
|
+
properties: {
|
|
290850
|
+
inputTokens: {
|
|
290851
|
+
type: "number"
|
|
290852
|
+
},
|
|
290853
|
+
outputTokens: {
|
|
290854
|
+
type: "number"
|
|
290855
|
+
},
|
|
290856
|
+
cacheReadTokens: {
|
|
290857
|
+
type: "number"
|
|
290858
|
+
},
|
|
290859
|
+
cacheWriteTokens: {
|
|
290860
|
+
type: "number"
|
|
290861
|
+
},
|
|
290862
|
+
reasoningTokens: {
|
|
290863
|
+
type: "number"
|
|
290864
|
+
},
|
|
290865
|
+
llmCallCount: {
|
|
290866
|
+
type: "number"
|
|
290867
|
+
},
|
|
290868
|
+
turnCount: {
|
|
290869
|
+
type: "number"
|
|
290870
|
+
},
|
|
290871
|
+
toolCallCount: {
|
|
290872
|
+
type: "number"
|
|
290873
|
+
}
|
|
290874
|
+
},
|
|
290875
|
+
required: [
|
|
290876
|
+
"inputTokens",
|
|
290877
|
+
"outputTokens",
|
|
290878
|
+
"cacheReadTokens",
|
|
290879
|
+
"cacheWriteTokens",
|
|
290880
|
+
"llmCallCount",
|
|
290881
|
+
"turnCount",
|
|
290882
|
+
"toolCallCount"
|
|
290883
|
+
],
|
|
290884
|
+
additionalProperties: false
|
|
290885
|
+
},
|
|
290886
|
+
model: {
|
|
290887
|
+
type: "string"
|
|
290888
|
+
},
|
|
290889
|
+
provider: {
|
|
290890
|
+
type: "string"
|
|
290891
|
+
},
|
|
290892
|
+
costUsd: {
|
|
290893
|
+
anyOf: [
|
|
290894
|
+
{
|
|
290895
|
+
type: "number"
|
|
290896
|
+
},
|
|
290897
|
+
{
|
|
290898
|
+
type: "null"
|
|
290899
|
+
}
|
|
290900
|
+
]
|
|
290901
|
+
},
|
|
290902
|
+
costState: {
|
|
290903
|
+
type: "string",
|
|
290904
|
+
enum: [
|
|
290905
|
+
"priced",
|
|
290906
|
+
"unpriced",
|
|
290907
|
+
"estimated"
|
|
290908
|
+
]
|
|
290909
|
+
},
|
|
290910
|
+
currentActivity: {
|
|
290911
|
+
type: "object",
|
|
290912
|
+
properties: {
|
|
290913
|
+
kind: {
|
|
290914
|
+
type: "string",
|
|
290915
|
+
enum: [
|
|
290916
|
+
"tool",
|
|
290917
|
+
"output-line",
|
|
290918
|
+
"phase"
|
|
290919
|
+
]
|
|
290920
|
+
},
|
|
290921
|
+
text: {
|
|
290922
|
+
type: "string"
|
|
290923
|
+
},
|
|
290924
|
+
toolName: {
|
|
290925
|
+
type: "string"
|
|
290926
|
+
},
|
|
290927
|
+
at: {
|
|
290928
|
+
type: "number"
|
|
290929
|
+
}
|
|
290930
|
+
},
|
|
290931
|
+
required: [
|
|
290932
|
+
"kind",
|
|
290933
|
+
"text",
|
|
290934
|
+
"at"
|
|
290935
|
+
],
|
|
290936
|
+
additionalProperties: false
|
|
290937
|
+
},
|
|
290938
|
+
capabilities: {
|
|
290939
|
+
type: "object",
|
|
290940
|
+
properties: {
|
|
290941
|
+
interruptible: {
|
|
290942
|
+
type: "boolean"
|
|
290943
|
+
},
|
|
290944
|
+
killable: {
|
|
290945
|
+
type: "boolean"
|
|
290946
|
+
},
|
|
290947
|
+
pausable: {
|
|
290948
|
+
type: "boolean"
|
|
290949
|
+
},
|
|
290950
|
+
resumable: {
|
|
290951
|
+
type: "boolean"
|
|
290952
|
+
},
|
|
290953
|
+
steerable: {
|
|
290954
|
+
type: "boolean"
|
|
290955
|
+
}
|
|
290956
|
+
},
|
|
290957
|
+
required: [
|
|
290958
|
+
"interruptible",
|
|
290959
|
+
"killable",
|
|
290960
|
+
"pausable",
|
|
290961
|
+
"resumable",
|
|
290962
|
+
"steerable"
|
|
290963
|
+
],
|
|
290964
|
+
additionalProperties: false
|
|
290965
|
+
},
|
|
290966
|
+
sessionRef: {
|
|
290967
|
+
type: "object",
|
|
290968
|
+
properties: {
|
|
290969
|
+
sessionId: {
|
|
290970
|
+
type: "string"
|
|
290971
|
+
},
|
|
290972
|
+
agentId: {
|
|
290973
|
+
type: "string"
|
|
290974
|
+
}
|
|
290975
|
+
},
|
|
290976
|
+
additionalProperties: false
|
|
290977
|
+
}
|
|
290978
|
+
},
|
|
290979
|
+
required: [
|
|
290980
|
+
"id",
|
|
290981
|
+
"kind",
|
|
290982
|
+
"label",
|
|
290983
|
+
"state",
|
|
290984
|
+
"elapsedMs",
|
|
290985
|
+
"costState",
|
|
290986
|
+
"capabilities"
|
|
290987
|
+
],
|
|
290988
|
+
additionalProperties: true
|
|
290989
|
+
}
|
|
290990
|
+
}
|
|
290991
|
+
},
|
|
290992
|
+
required: [
|
|
290993
|
+
"capturedAt",
|
|
290994
|
+
"nodes"
|
|
290995
|
+
],
|
|
290996
|
+
additionalProperties: false
|
|
290997
|
+
},
|
|
290998
|
+
invokable: true
|
|
290999
|
+
},
|
|
291000
|
+
{
|
|
291001
|
+
id: "fleet.archiveFinished",
|
|
291002
|
+
title: "Archive All Finished Fleet Subtrees",
|
|
291003
|
+
description: "Archive every root subtree whose nodes are all terminal (done/failed/killed/interrupted). A finished member of a still-running swarm stays with its parent. Returns the number of nodes archived.",
|
|
291004
|
+
category: "fleet",
|
|
291005
|
+
source: "builtin",
|
|
291006
|
+
access: "authenticated",
|
|
291007
|
+
transport: [
|
|
291008
|
+
"ws"
|
|
291009
|
+
],
|
|
291010
|
+
scopes: [
|
|
291011
|
+
"write:fleet"
|
|
291012
|
+
],
|
|
291013
|
+
inputSchema: {
|
|
291014
|
+
type: "object",
|
|
291015
|
+
properties: {},
|
|
291016
|
+
additionalProperties: false
|
|
291017
|
+
},
|
|
291018
|
+
outputSchema: {
|
|
291019
|
+
type: "object",
|
|
291020
|
+
properties: {
|
|
291021
|
+
archivedCount: {
|
|
291022
|
+
type: "number"
|
|
291023
|
+
}
|
|
291024
|
+
},
|
|
291025
|
+
required: [
|
|
291026
|
+
"archivedCount"
|
|
291027
|
+
],
|
|
291028
|
+
additionalProperties: false
|
|
291029
|
+
},
|
|
291030
|
+
invokable: true
|
|
291031
|
+
},
|
|
290716
291032
|
{
|
|
290717
291033
|
id: "fleet.list",
|
|
290718
291034
|
title: "List Fleet Processes",
|
|
@@ -291223,6 +291539,45 @@ var init_operator_contract = __esm(() => {
|
|
|
291223
291539
|
},
|
|
291224
291540
|
invokable: true
|
|
291225
291541
|
},
|
|
291542
|
+
{
|
|
291543
|
+
id: "fleet.unarchive",
|
|
291544
|
+
title: "Restore Archived Fleet Subtree",
|
|
291545
|
+
description: "Return an archived subtree to the live fleet view. Returns the number of nodes restored (0 when nothing under the id was archived).",
|
|
291546
|
+
category: "fleet",
|
|
291547
|
+
source: "builtin",
|
|
291548
|
+
access: "authenticated",
|
|
291549
|
+
transport: [
|
|
291550
|
+
"ws"
|
|
291551
|
+
],
|
|
291552
|
+
scopes: [
|
|
291553
|
+
"write:fleet"
|
|
291554
|
+
],
|
|
291555
|
+
inputSchema: {
|
|
291556
|
+
type: "object",
|
|
291557
|
+
properties: {
|
|
291558
|
+
id: {
|
|
291559
|
+
type: "string"
|
|
291560
|
+
}
|
|
291561
|
+
},
|
|
291562
|
+
required: [
|
|
291563
|
+
"id"
|
|
291564
|
+
],
|
|
291565
|
+
additionalProperties: false
|
|
291566
|
+
},
|
|
291567
|
+
outputSchema: {
|
|
291568
|
+
type: "object",
|
|
291569
|
+
properties: {
|
|
291570
|
+
restored: {
|
|
291571
|
+
type: "number"
|
|
291572
|
+
}
|
|
291573
|
+
},
|
|
291574
|
+
required: [
|
|
291575
|
+
"restored"
|
|
291576
|
+
],
|
|
291577
|
+
additionalProperties: false
|
|
291578
|
+
},
|
|
291579
|
+
invokable: true
|
|
291580
|
+
},
|
|
291226
291581
|
{
|
|
291227
291582
|
id: "health.snapshot",
|
|
291228
291583
|
title: "Health Snapshot",
|
|
@@ -345715,10 +346070,10 @@ var init_operator_contract = __esm(() => {
|
|
|
345715
346070
|
}
|
|
345716
346071
|
],
|
|
345717
346072
|
schemaCoverage: {
|
|
345718
|
-
methods:
|
|
345719
|
-
typedInputs:
|
|
346073
|
+
methods: 333,
|
|
346074
|
+
typedInputs: 333,
|
|
345720
346075
|
genericInputs: 0,
|
|
345721
|
-
typedOutputs:
|
|
346076
|
+
typedOutputs: 333,
|
|
345722
346077
|
genericOutputs: 0
|
|
345723
346078
|
},
|
|
345724
346079
|
eventCoverage: {
|
|
@@ -345727,8 +346082,8 @@ var init_operator_contract = __esm(() => {
|
|
|
345727
346082
|
withWireEvents: 31
|
|
345728
346083
|
},
|
|
345729
346084
|
validationCoverage: {
|
|
345730
|
-
methods:
|
|
345731
|
-
validated:
|
|
346085
|
+
methods: 333,
|
|
346086
|
+
validated: 331,
|
|
345732
346087
|
skippedGeneric: 0,
|
|
345733
346088
|
skippedUntyped: 2
|
|
345734
346089
|
}
|
|
@@ -345854,8 +346209,12 @@ var init_operator_method_ids = __esm(() => {
|
|
|
345854
346209
|
"email.inbox.list",
|
|
345855
346210
|
"email.inbox.read",
|
|
345856
346211
|
"email.send",
|
|
346212
|
+
"fleet.archive",
|
|
346213
|
+
"fleet.archiveFinished",
|
|
346214
|
+
"fleet.archived.list",
|
|
345857
346215
|
"fleet.list",
|
|
345858
346216
|
"fleet.snapshot",
|
|
346217
|
+
"fleet.unarchive",
|
|
345859
346218
|
"health.snapshot",
|
|
345860
346219
|
"homeassistant.homeGraph.askHomeGraph",
|
|
345861
346220
|
"homeassistant.homeGraph.browse",
|
|
@@ -348642,6 +349001,11 @@ var init_core_verbs = __esm(() => {
|
|
|
348642
349001
|
"push-delivery": [
|
|
348643
349002
|
"verify"
|
|
348644
349003
|
],
|
|
349004
|
+
"fleet-archive": [
|
|
349005
|
+
"archive",
|
|
349006
|
+
"unarchive",
|
|
349007
|
+
"archiveFinished"
|
|
349008
|
+
],
|
|
348645
349009
|
"process-control": [
|
|
348646
349010
|
"install",
|
|
348647
349011
|
"restart",
|
|
@@ -365839,6 +366203,7 @@ ${priorTurnKnowledgeBlock}`;
|
|
|
365839
366203
|
} catch (chatErr) {
|
|
365840
366204
|
if (isContextSizeExceededError(chatErr) && !contextRetried && (context.featureFlagManager?.isEnabled("agent-context-window-awareness") ?? true)) {
|
|
365841
366205
|
contextRetried = true;
|
|
366206
|
+
context.providerRegistry.recordContextWindowRejection(`${activeRoute.provider.name}:${activeRoute.modelId}`, estimateConversationTokens(conversation.getMessagesForLLM()));
|
|
365842
366207
|
logger.warn(`[AgentOrchestrator] context-window awareness: context size exceeded on turn ${turn2} - emergency compaction and retry`, { agentId: record2.id, error: chatErr instanceof Error ? chatErr.message : String(chatErr) });
|
|
365843
366208
|
record2.progress = `Turn ${turn2} \xB7 Context exceeded, compacting\u2026`;
|
|
365844
366209
|
context.emitAgentProgress(record2.id, record2.progress);
|
|
@@ -440036,7 +440401,7 @@ class ModelLimitsService {
|
|
|
440036
440401
|
return this.resolveTokenLimits(modelDef);
|
|
440037
440402
|
}
|
|
440038
440403
|
getContextWindowForModel(modelDef) {
|
|
440039
|
-
if ((modelDef.contextWindowProvenance === "provider_api" || modelDef.contextWindowProvenance === "configured_cap") && modelDef.contextWindow > 0) {
|
|
440404
|
+
if ((modelDef.contextWindowProvenance === "provider_api" || modelDef.contextWindowProvenance === "configured_cap" || modelDef.contextWindowProvenance === "observed_limit") && modelDef.contextWindow > 0) {
|
|
440040
440405
|
return modelDef.contextWindow;
|
|
440041
440406
|
}
|
|
440042
440407
|
const orMap = this.ensureOpenRouterMap();
|
|
@@ -440116,86 +440481,134 @@ function getContextWindowOverridesPath(configDir) {
|
|
|
440116
440481
|
function isValidContextWindowOverride(value) {
|
|
440117
440482
|
return Number.isInteger(value) && value > 0 && value <= MAX_CONTEXT_WINDOW_OVERRIDE;
|
|
440118
440483
|
}
|
|
440484
|
+
function readValidEntries(source, label) {
|
|
440485
|
+
const map5 = new Map;
|
|
440486
|
+
for (const [registryKey, value] of Object.entries(source ?? {})) {
|
|
440487
|
+
if (typeof value === "number" && isValidContextWindowOverride(value)) {
|
|
440488
|
+
map5.set(registryKey, value);
|
|
440489
|
+
} else {
|
|
440490
|
+
logger.warn(`[context-window-overrides] Dropping invalid ${label} entry`, { registryKey, value });
|
|
440491
|
+
}
|
|
440492
|
+
}
|
|
440493
|
+
return map5;
|
|
440494
|
+
}
|
|
440119
440495
|
function loadContextWindowOverrides(filePath) {
|
|
440120
|
-
const
|
|
440496
|
+
const empty = { overrides: new Map, observed: new Map };
|
|
440121
440497
|
let raw;
|
|
440122
440498
|
try {
|
|
440123
440499
|
raw = readFileSync48(filePath, "utf-8");
|
|
440124
440500
|
} catch {
|
|
440125
|
-
return
|
|
440501
|
+
return empty;
|
|
440126
440502
|
}
|
|
440127
440503
|
try {
|
|
440128
440504
|
const parsed = JSON.parse(raw);
|
|
440129
|
-
if (!parsed || parsed.version !== 1 || typeof parsed.overrides !== "object" || parsed.overrides === null) {
|
|
440505
|
+
if (!parsed || parsed.version !== 1 && parsed.version !== 2 || typeof parsed.overrides !== "object" || parsed.overrides === null) {
|
|
440130
440506
|
logger.warn("[context-window-overrides] Ignoring malformed overrides file", { filePath });
|
|
440131
|
-
return
|
|
440132
|
-
}
|
|
440133
|
-
for (const [registryKey, value] of Object.entries(parsed.overrides)) {
|
|
440134
|
-
if (typeof value === "number" && isValidContextWindowOverride(value)) {
|
|
440135
|
-
overrides.set(registryKey, value);
|
|
440136
|
-
} else {
|
|
440137
|
-
logger.warn("[context-window-overrides] Dropping invalid override entry", { registryKey, value });
|
|
440138
|
-
}
|
|
440507
|
+
return empty;
|
|
440139
440508
|
}
|
|
440509
|
+
return {
|
|
440510
|
+
overrides: readValidEntries(parsed.overrides, "override"),
|
|
440511
|
+
observed: readValidEntries(parsed.observed, "observed-limit")
|
|
440512
|
+
};
|
|
440140
440513
|
} catch (error51) {
|
|
440141
440514
|
logger.warn("[context-window-overrides] Failed to parse overrides file", {
|
|
440142
440515
|
filePath,
|
|
440143
440516
|
error: summarizeError(error51)
|
|
440144
440517
|
});
|
|
440518
|
+
return empty;
|
|
440519
|
+
}
|
|
440520
|
+
}
|
|
440521
|
+
function saveContextWindowOverrides(filePath, state) {
|
|
440522
|
+
const sorted2 = (map5) => Object.fromEntries([...map5.entries()].sort(([a2], [b2]) => a2.localeCompare(b2)));
|
|
440523
|
+
const file2 = {
|
|
440524
|
+
version: 2,
|
|
440525
|
+
overrides: sorted2(state.overrides),
|
|
440526
|
+
observed: sorted2(state.observed)
|
|
440527
|
+
};
|
|
440528
|
+
try {
|
|
440529
|
+
mkdirSync33(dirname37(filePath), { recursive: true });
|
|
440530
|
+
writeFileSync29(filePath, `${JSON.stringify(file2, null, 2)}
|
|
440531
|
+
`, "utf-8");
|
|
440532
|
+
} catch (error51) {
|
|
440533
|
+
logger.warn("[context-window-overrides] Failed to persist overrides", {
|
|
440534
|
+
filePath,
|
|
440535
|
+
error: summarizeError(error51)
|
|
440536
|
+
});
|
|
440145
440537
|
}
|
|
440146
|
-
return overrides;
|
|
440147
440538
|
}
|
|
440148
440539
|
|
|
440149
440540
|
class ContextWindowOverrideStore {
|
|
440150
440541
|
filePath;
|
|
440151
|
-
|
|
440542
|
+
state = null;
|
|
440152
440543
|
constructor(filePath) {
|
|
440153
440544
|
this.filePath = filePath;
|
|
440154
440545
|
}
|
|
440155
440546
|
load() {
|
|
440156
|
-
this.
|
|
440157
|
-
return this.
|
|
440547
|
+
this.state ??= loadContextWindowOverrides(this.filePath);
|
|
440548
|
+
return this.state;
|
|
440549
|
+
}
|
|
440550
|
+
persist() {
|
|
440551
|
+
saveContextWindowOverrides(this.filePath, this.load());
|
|
440158
440552
|
}
|
|
440159
440553
|
get(registryKey) {
|
|
440160
|
-
return this.load().get(registryKey) ?? null;
|
|
440554
|
+
return this.load().overrides.get(registryKey) ?? null;
|
|
440555
|
+
}
|
|
440556
|
+
getObserved(registryKey) {
|
|
440557
|
+
return this.load().observed.get(registryKey) ?? null;
|
|
440161
440558
|
}
|
|
440162
440559
|
set(registryKey, cap) {
|
|
440163
440560
|
if (!isValidContextWindowOverride(cap))
|
|
440164
440561
|
return false;
|
|
440165
|
-
|
|
440166
|
-
|
|
440167
|
-
saveContextWindowOverrides(this.filePath, overrides);
|
|
440562
|
+
this.load().overrides.set(registryKey, cap);
|
|
440563
|
+
this.persist();
|
|
440168
440564
|
return true;
|
|
440169
440565
|
}
|
|
440170
440566
|
clear(registryKey) {
|
|
440171
|
-
const
|
|
440172
|
-
const existed = overrides.delete(registryKey);
|
|
440173
|
-
|
|
440174
|
-
|
|
440175
|
-
|
|
440176
|
-
|
|
440177
|
-
apply(model) {
|
|
440178
|
-
const override = this.load().get(model.registryKey);
|
|
440179
|
-
if (override === undefined)
|
|
440180
|
-
return model;
|
|
440181
|
-
return { ...model, contextWindow: override, contextWindowProvenance: "configured_cap" };
|
|
440567
|
+
const state = this.load();
|
|
440568
|
+
const existed = state.overrides.delete(registryKey);
|
|
440569
|
+
const observedExisted = state.observed.delete(registryKey);
|
|
440570
|
+
if (existed || observedExisted)
|
|
440571
|
+
this.persist();
|
|
440572
|
+
return existed || observedExisted;
|
|
440182
440573
|
}
|
|
440183
|
-
|
|
440184
|
-
|
|
440185
|
-
|
|
440186
|
-
|
|
440187
|
-
|
|
440188
|
-
|
|
440189
|
-
|
|
440190
|
-
|
|
440191
|
-
|
|
440192
|
-
|
|
440193
|
-
|
|
440194
|
-
|
|
440195
|
-
|
|
440196
|
-
error: summarizeError(error51)
|
|
440574
|
+
recordRejection(registryKey, rejectedAtTokens) {
|
|
440575
|
+
const rounded = Math.floor(rejectedAtTokens);
|
|
440576
|
+
if (!isValidContextWindowOverride(rounded))
|
|
440577
|
+
return;
|
|
440578
|
+
const state = this.load();
|
|
440579
|
+
const existing = state.observed.get(registryKey);
|
|
440580
|
+
if (existing !== undefined && existing <= rounded)
|
|
440581
|
+
return;
|
|
440582
|
+
state.observed.set(registryKey, rounded);
|
|
440583
|
+
this.persist();
|
|
440584
|
+
logger.info("[context-window-overrides] Learned context ceiling from provider rejection", {
|
|
440585
|
+
registryKey,
|
|
440586
|
+
observedTokens: rounded
|
|
440197
440587
|
});
|
|
440198
440588
|
}
|
|
440589
|
+
reconcileSuccess(registryKey, successfulInputTokens) {
|
|
440590
|
+
const rounded = Math.floor(successfulInputTokens);
|
|
440591
|
+
const state = this.load();
|
|
440592
|
+
const existing = state.observed.get(registryKey);
|
|
440593
|
+
if (existing === undefined || rounded <= existing)
|
|
440594
|
+
return;
|
|
440595
|
+
if (!isValidContextWindowOverride(rounded))
|
|
440596
|
+
return;
|
|
440597
|
+
state.observed.set(registryKey, rounded);
|
|
440598
|
+
this.persist();
|
|
440599
|
+
}
|
|
440600
|
+
apply(model) {
|
|
440601
|
+
const state = this.load();
|
|
440602
|
+
const override = state.overrides.get(model.registryKey);
|
|
440603
|
+
if (override !== undefined) {
|
|
440604
|
+
return { ...model, contextWindow: override, contextWindowProvenance: "configured_cap" };
|
|
440605
|
+
}
|
|
440606
|
+
const observed = state.observed.get(model.registryKey);
|
|
440607
|
+
if (observed !== undefined && (model.contextWindow <= 0 || observed < model.contextWindow)) {
|
|
440608
|
+
return { ...model, contextWindow: observed, contextWindowProvenance: "observed_limit" };
|
|
440609
|
+
}
|
|
440610
|
+
return model;
|
|
440611
|
+
}
|
|
440199
440612
|
}
|
|
440200
440613
|
var MAX_CONTEXT_WINDOW_OVERRIDE = 1e7;
|
|
440201
440614
|
var init_context_window_overrides = __esm(() => {
|
|
@@ -440630,6 +441043,20 @@ class ProviderRegistry {
|
|
|
440630
441043
|
getModelContextCap(registryKey) {
|
|
440631
441044
|
return this.contextWindowOverrideStore().get(registryKey);
|
|
440632
441045
|
}
|
|
441046
|
+
getObservedContextWindow(registryKey) {
|
|
441047
|
+
return this.contextWindowOverrideStore().getObserved(registryKey);
|
|
441048
|
+
}
|
|
441049
|
+
recordContextWindowRejection(registryKey, rejectedAtTokens) {
|
|
441050
|
+
this.contextWindowOverrideStore().recordRejection(registryKey, rejectedAtTokens);
|
|
441051
|
+
this._invalidateModelRegistry();
|
|
441052
|
+
}
|
|
441053
|
+
reconcileObservedContextWindow(registryKey, successfulInputTokens) {
|
|
441054
|
+
const before = this.contextWindowOverrideStore().getObserved(registryKey);
|
|
441055
|
+
if (before === null || successfulInputTokens <= before)
|
|
441056
|
+
return;
|
|
441057
|
+
this.contextWindowOverrideStore().reconcileSuccess(registryKey, successfulInputTokens);
|
|
441058
|
+
this._invalidateModelRegistry();
|
|
441059
|
+
}
|
|
440633
441060
|
setCurrentModel(registryKey) {
|
|
440634
441061
|
if (!registryKey.includes(":")) {
|
|
440635
441062
|
throw new Error(`Model selection requires a provider-qualified registryKey; received '${registryKey}'.`);
|
|
@@ -451451,7 +451878,7 @@ var init_operator_contract_schemas_runtime = __esm(() => {
|
|
|
451451
451878
|
});
|
|
451452
451879
|
|
|
451453
451880
|
// node_modules/@pellux/goodvibes-sdk/dist/platform/control-plane/operator-contract-schemas-fleet.js
|
|
451454
|
-
var PROCESS_KIND_SCHEMA, PROCESS_STATE_SCHEMA, PROCESS_COST_STATE_SCHEMA, PROCESS_USAGE_SCHEMA, PROCESS_ACTIVITY_SCHEMA, PROCESS_CAPABILITIES_SCHEMA, PROCESS_SESSION_REF_SCHEMA, PROCESS_NODE_SCHEMA, FLEET_SNAPSHOT_OUTPUT_SCHEMA, FLEET_LIST_INPUT_SCHEMA, FLEET_LIST_OUTPUT_SCHEMA, CHECKPOINT_KIND_SCHEMA, RETENTION_CLASS_SCHEMA, WORKSPACE_CHECKPOINT_SCHEMA, CHECKPOINTS_LIST_INPUT_SCHEMA, CHECKPOINTS_LIST_OUTPUT_SCHEMA, CHECKPOINTS_CREATE_INPUT_SCHEMA, CHECKPOINTS_CREATE_OUTPUT_SCHEMA, CHECKPOINT_DIFF_SCHEMA, CHECKPOINTS_DIFF_INPUT_SCHEMA, CHECKPOINTS_DIFF_OUTPUT_SCHEMA, CHECKPOINT_RESTORE_RESULT_SCHEMA, CHECKPOINTS_RESTORE_INPUT_SCHEMA, CHECKPOINTS_RESTORE_OUTPUT_SCHEMA, SESSIONS_SEARCH_INPUT_SCHEMA, SESSIONS_SEARCH_OUTPUT_SCHEMA;
|
|
451881
|
+
var PROCESS_KIND_SCHEMA, PROCESS_STATE_SCHEMA, PROCESS_COST_STATE_SCHEMA, PROCESS_USAGE_SCHEMA, PROCESS_ACTIVITY_SCHEMA, PROCESS_CAPABILITIES_SCHEMA, PROCESS_SESSION_REF_SCHEMA, PROCESS_NODE_SCHEMA, FLEET_SNAPSHOT_OUTPUT_SCHEMA, FLEET_LIST_INPUT_SCHEMA, FLEET_LIST_OUTPUT_SCHEMA, FLEET_ARCHIVE_INPUT_SCHEMA, FLEET_ARCHIVE_OUTPUT_SCHEMA, FLEET_UNARCHIVE_OUTPUT_SCHEMA, FLEET_ARCHIVE_FINISHED_OUTPUT_SCHEMA, FLEET_ARCHIVED_LIST_OUTPUT_SCHEMA, CHECKPOINT_KIND_SCHEMA, RETENTION_CLASS_SCHEMA, WORKSPACE_CHECKPOINT_SCHEMA, CHECKPOINTS_LIST_INPUT_SCHEMA, CHECKPOINTS_LIST_OUTPUT_SCHEMA, CHECKPOINTS_CREATE_INPUT_SCHEMA, CHECKPOINTS_CREATE_OUTPUT_SCHEMA, CHECKPOINT_DIFF_SCHEMA, CHECKPOINTS_DIFF_INPUT_SCHEMA, CHECKPOINTS_DIFF_OUTPUT_SCHEMA, CHECKPOINT_RESTORE_RESULT_SCHEMA, CHECKPOINTS_RESTORE_INPUT_SCHEMA, CHECKPOINTS_RESTORE_OUTPUT_SCHEMA, SESSIONS_SEARCH_INPUT_SCHEMA, SESSIONS_SEARCH_OUTPUT_SCHEMA;
|
|
451455
451882
|
var init_operator_contract_schemas_fleet = __esm(() => {
|
|
451456
451883
|
init_method_catalog_shared();
|
|
451457
451884
|
init_operator_contract_schemas_shared();
|
|
@@ -451550,6 +451977,24 @@ var init_operator_contract_schemas_fleet = __esm(() => {
|
|
|
451550
451977
|
hasMore: BOOLEAN_SCHEMA,
|
|
451551
451978
|
capturedAt: NUMBER_SCHEMA
|
|
451552
451979
|
}, ["items", "hasMore", "capturedAt"]);
|
|
451980
|
+
FLEET_ARCHIVE_INPUT_SCHEMA = objectSchema({
|
|
451981
|
+
id: STRING_SCHEMA
|
|
451982
|
+
}, ["id"]);
|
|
451983
|
+
FLEET_ARCHIVE_OUTPUT_SCHEMA = objectSchema({
|
|
451984
|
+
archived: BOOLEAN_SCHEMA,
|
|
451985
|
+
count: NUMBER_SCHEMA,
|
|
451986
|
+
reason: STRING_SCHEMA
|
|
451987
|
+
}, ["archived", "count"]);
|
|
451988
|
+
FLEET_UNARCHIVE_OUTPUT_SCHEMA = objectSchema({
|
|
451989
|
+
restored: NUMBER_SCHEMA
|
|
451990
|
+
}, ["restored"]);
|
|
451991
|
+
FLEET_ARCHIVE_FINISHED_OUTPUT_SCHEMA = objectSchema({
|
|
451992
|
+
archivedCount: NUMBER_SCHEMA
|
|
451993
|
+
}, ["archivedCount"]);
|
|
451994
|
+
FLEET_ARCHIVED_LIST_OUTPUT_SCHEMA = objectSchema({
|
|
451995
|
+
capturedAt: NUMBER_SCHEMA,
|
|
451996
|
+
nodes: arraySchema(PROCESS_NODE_SCHEMA)
|
|
451997
|
+
}, ["capturedAt", "nodes"]);
|
|
451553
451998
|
CHECKPOINT_KIND_SCHEMA = enumSchema(["turn", "agent-run", "manual"]);
|
|
451554
451999
|
RETENTION_CLASS_SCHEMA = enumSchema(["short", "standard", "forensic"]);
|
|
451555
452000
|
WORKSPACE_CHECKPOINT_SCHEMA = objectSchema({
|
|
@@ -454835,6 +455280,46 @@ var init_method_catalog_fleet = __esm(() => {
|
|
|
454835
455280
|
inputSchema: FLEET_LIST_INPUT_SCHEMA,
|
|
454836
455281
|
outputSchema: FLEET_LIST_OUTPUT_SCHEMA
|
|
454837
455282
|
}),
|
|
455283
|
+
methodDescriptor({
|
|
455284
|
+
id: "fleet.archive",
|
|
455285
|
+
title: "Archive Finished Fleet Subtree",
|
|
455286
|
+
description: "Move one FINISHED process subtree (root id + all descendants, every node terminal) out of the live fleet view into the session archive. Honest refusal (archived:false + reason) for an unknown id or a subtree with live members. Archived nodes stay inspectable via fleet.archived.list.",
|
|
455287
|
+
category: "fleet",
|
|
455288
|
+
scopes: ["write:fleet"],
|
|
455289
|
+
transport: ["ws"],
|
|
455290
|
+
inputSchema: FLEET_ARCHIVE_INPUT_SCHEMA,
|
|
455291
|
+
outputSchema: FLEET_ARCHIVE_OUTPUT_SCHEMA
|
|
455292
|
+
}),
|
|
455293
|
+
methodDescriptor({
|
|
455294
|
+
id: "fleet.unarchive",
|
|
455295
|
+
title: "Restore Archived Fleet Subtree",
|
|
455296
|
+
description: "Return an archived subtree to the live fleet view. Returns the number of nodes restored (0 when nothing under the id was archived).",
|
|
455297
|
+
category: "fleet",
|
|
455298
|
+
scopes: ["write:fleet"],
|
|
455299
|
+
transport: ["ws"],
|
|
455300
|
+
inputSchema: FLEET_ARCHIVE_INPUT_SCHEMA,
|
|
455301
|
+
outputSchema: FLEET_UNARCHIVE_OUTPUT_SCHEMA
|
|
455302
|
+
}),
|
|
455303
|
+
methodDescriptor({
|
|
455304
|
+
id: "fleet.archiveFinished",
|
|
455305
|
+
title: "Archive All Finished Fleet Subtrees",
|
|
455306
|
+
description: "Archive every root subtree whose nodes are all terminal (done/failed/killed/interrupted). A finished member of a still-running swarm stays with its parent. Returns the number of nodes archived.",
|
|
455307
|
+
category: "fleet",
|
|
455308
|
+
scopes: ["write:fleet"],
|
|
455309
|
+
transport: ["ws"],
|
|
455310
|
+
inputSchema: EMPTY_OBJECT_SCHEMA,
|
|
455311
|
+
outputSchema: FLEET_ARCHIVE_FINISHED_OUTPUT_SCHEMA
|
|
455312
|
+
}),
|
|
455313
|
+
methodDescriptor({
|
|
455314
|
+
id: "fleet.archived.list",
|
|
455315
|
+
title: "List Archived Fleet Processes",
|
|
455316
|
+
description: "Return the session-archived process nodes (same node shape as fleet.snapshot; still live-derived from the source managers, so usage/cost stay current).",
|
|
455317
|
+
category: "fleet",
|
|
455318
|
+
scopes: ["read:fleet"],
|
|
455319
|
+
transport: ["ws"],
|
|
455320
|
+
inputSchema: EMPTY_OBJECT_SCHEMA,
|
|
455321
|
+
outputSchema: FLEET_ARCHIVED_LIST_OUTPUT_SCHEMA
|
|
455322
|
+
}),
|
|
454838
455323
|
methodDescriptor({
|
|
454839
455324
|
id: "checkpoints.list",
|
|
454840
455325
|
title: "List Workspace Checkpoints",
|
|
@@ -460549,15 +461034,52 @@ function createFleetListHandler(registry3) {
|
|
|
460549
461034
|
};
|
|
460550
461035
|
};
|
|
460551
461036
|
}
|
|
460552
|
-
function
|
|
460553
|
-
const
|
|
460554
|
-
if (
|
|
460555
|
-
|
|
460556
|
-
}
|
|
460557
|
-
const listDescriptor = catalog.get("fleet.list");
|
|
460558
|
-
if (listDescriptor) {
|
|
460559
|
-
catalog.register(listDescriptor, createFleetListHandler(registry3), { replace: true });
|
|
461037
|
+
function requireArchive(registry3, method) {
|
|
461038
|
+
const fn = registry3[method];
|
|
461039
|
+
if (!fn) {
|
|
461040
|
+
throw new GatewayVerbError("This runtime has no fleet archive layer.", "UNSUPPORTED", 501);
|
|
460560
461041
|
}
|
|
461042
|
+
return fn;
|
|
461043
|
+
}
|
|
461044
|
+
function createFleetArchiveHandler(registry3) {
|
|
461045
|
+
return (invocation) => {
|
|
461046
|
+
const params = readInvocationParams(invocation);
|
|
461047
|
+
const id = typeof params.id === "string" ? params.id.trim() : "";
|
|
461048
|
+
if (!id)
|
|
461049
|
+
throw new GatewayVerbError("id is required", "INVALID_ARGUMENT", 400);
|
|
461050
|
+
return requireArchive(registry3, "archive")(id);
|
|
461051
|
+
};
|
|
461052
|
+
}
|
|
461053
|
+
function createFleetUnarchiveHandler(registry3) {
|
|
461054
|
+
return (invocation) => {
|
|
461055
|
+
const params = readInvocationParams(invocation);
|
|
461056
|
+
const id = typeof params.id === "string" ? params.id.trim() : "";
|
|
461057
|
+
if (!id)
|
|
461058
|
+
throw new GatewayVerbError("id is required", "INVALID_ARGUMENT", 400);
|
|
461059
|
+
return { restored: requireArchive(registry3, "unarchive")(id) };
|
|
461060
|
+
};
|
|
461061
|
+
}
|
|
461062
|
+
function createFleetArchiveFinishedHandler(registry3) {
|
|
461063
|
+
return () => ({ archivedCount: requireArchive(registry3, "archiveFinished")() });
|
|
461064
|
+
}
|
|
461065
|
+
function createFleetArchivedListHandler(registry3) {
|
|
461066
|
+
return () => {
|
|
461067
|
+
const snapshot = requireArchive(registry3, "listArchived")();
|
|
461068
|
+
return { capturedAt: snapshot.capturedAt, nodes: snapshot.nodes };
|
|
461069
|
+
};
|
|
461070
|
+
}
|
|
461071
|
+
function registerFleetGatewayMethods(catalog, registry3) {
|
|
461072
|
+
const attach = (id, handler) => {
|
|
461073
|
+
const descriptor = catalog.get(id);
|
|
461074
|
+
if (descriptor)
|
|
461075
|
+
catalog.register(descriptor, handler, { replace: true });
|
|
461076
|
+
};
|
|
461077
|
+
attach("fleet.snapshot", createFleetSnapshotHandler(registry3));
|
|
461078
|
+
attach("fleet.list", createFleetListHandler(registry3));
|
|
461079
|
+
attach("fleet.archive", createFleetArchiveHandler(registry3));
|
|
461080
|
+
attach("fleet.unarchive", createFleetUnarchiveHandler(registry3));
|
|
461081
|
+
attach("fleet.archiveFinished", createFleetArchiveFinishedHandler(registry3));
|
|
461082
|
+
attach("fleet.archived.list", createFleetArchivedListHandler(registry3));
|
|
460561
461083
|
}
|
|
460562
461084
|
var FLEET_SNAPSHOT_NODE_CAP = 2000, FLEET_LIST_DEFAULT_LIMIT = 100, FLEET_LIST_MAX_LIMIT = 500, PROCESS_KINDS, PROCESS_STATES;
|
|
460563
461085
|
var init_fleet = __esm(() => {
|
|
@@ -831868,9 +832390,145 @@ var init_registry8 = __esm(() => {
|
|
|
831868
832390
|
};
|
|
831869
832391
|
});
|
|
831870
832392
|
|
|
832393
|
+
// node_modules/@pellux/goodvibes-sdk/dist/platform/runtime/fleet/archive.js
|
|
832394
|
+
function collectSubtreeIds(rootId, nodes) {
|
|
832395
|
+
const childrenByParent = new Map;
|
|
832396
|
+
for (const node of nodes) {
|
|
832397
|
+
if (node.parentId === undefined)
|
|
832398
|
+
continue;
|
|
832399
|
+
const siblings = childrenByParent.get(node.parentId);
|
|
832400
|
+
if (siblings)
|
|
832401
|
+
siblings.push(node);
|
|
832402
|
+
else
|
|
832403
|
+
childrenByParent.set(node.parentId, [node]);
|
|
832404
|
+
}
|
|
832405
|
+
const ids = [];
|
|
832406
|
+
const stack = [rootId];
|
|
832407
|
+
const seen = new Set;
|
|
832408
|
+
while (stack.length > 0) {
|
|
832409
|
+
const id = stack.pop();
|
|
832410
|
+
if (seen.has(id))
|
|
832411
|
+
continue;
|
|
832412
|
+
seen.add(id);
|
|
832413
|
+
ids.push(id);
|
|
832414
|
+
for (const child of childrenByParent.get(id) ?? [])
|
|
832415
|
+
stack.push(child.id);
|
|
832416
|
+
}
|
|
832417
|
+
return ids;
|
|
832418
|
+
}
|
|
832419
|
+
function withFleetArchive(registry3) {
|
|
832420
|
+
const archivedIds = new Set;
|
|
832421
|
+
const listeners = new Set;
|
|
832422
|
+
let underlyingUnsub = null;
|
|
832423
|
+
const filterSnapshot = (snapshot) => ({
|
|
832424
|
+
capturedAt: snapshot.capturedAt,
|
|
832425
|
+
nodes: snapshot.nodes.filter((node) => !archivedIds.has(node.id))
|
|
832426
|
+
});
|
|
832427
|
+
const notifyAll = () => {
|
|
832428
|
+
const snapshot = filterSnapshot(registry3.query());
|
|
832429
|
+
for (const listener of listeners)
|
|
832430
|
+
listener(snapshot);
|
|
832431
|
+
};
|
|
832432
|
+
const archiveSubtree = (rootId, nodes) => {
|
|
832433
|
+
const root = nodes.find((node) => node.id === rootId);
|
|
832434
|
+
if (!root)
|
|
832435
|
+
return { archived: false, count: 0, reason: `node ${rootId} not found` };
|
|
832436
|
+
const subtreeIds = collectSubtreeIds(rootId, nodes);
|
|
832437
|
+
const subtreeNodes = nodes.filter((node) => subtreeIds.includes(node.id));
|
|
832438
|
+
const live = subtreeNodes.filter((node) => !ARCHIVE_TERMINAL_STATES.has(node.state));
|
|
832439
|
+
if (live.length > 0) {
|
|
832440
|
+
return {
|
|
832441
|
+
archived: false,
|
|
832442
|
+
count: 0,
|
|
832443
|
+
reason: `${live.length} node(s) in the subtree are still active (${live[0].state}) \u2014 only finished subtrees can be archived`
|
|
832444
|
+
};
|
|
832445
|
+
}
|
|
832446
|
+
for (const id of subtreeIds)
|
|
832447
|
+
archivedIds.add(id);
|
|
832448
|
+
return { archived: true, count: subtreeIds.length };
|
|
832449
|
+
};
|
|
832450
|
+
return {
|
|
832451
|
+
...registry3,
|
|
832452
|
+
query(filter) {
|
|
832453
|
+
return filterSnapshot(registry3.query(filter));
|
|
832454
|
+
},
|
|
832455
|
+
subscribe(listener) {
|
|
832456
|
+
listeners.add(listener);
|
|
832457
|
+
underlyingUnsub ??= registry3.subscribe(() => {
|
|
832458
|
+
notifyAll();
|
|
832459
|
+
});
|
|
832460
|
+
return () => {
|
|
832461
|
+
listeners.delete(listener);
|
|
832462
|
+
if (listeners.size === 0 && underlyingUnsub) {
|
|
832463
|
+
underlyingUnsub();
|
|
832464
|
+
underlyingUnsub = null;
|
|
832465
|
+
}
|
|
832466
|
+
};
|
|
832467
|
+
},
|
|
832468
|
+
archive(id) {
|
|
832469
|
+
const result = archiveSubtree(id, registry3.query().nodes);
|
|
832470
|
+
if (result.archived)
|
|
832471
|
+
notifyAll();
|
|
832472
|
+
return result;
|
|
832473
|
+
},
|
|
832474
|
+
unarchive(id) {
|
|
832475
|
+
const subtreeIds = collectSubtreeIds(id, registry3.query().nodes);
|
|
832476
|
+
let released = 0;
|
|
832477
|
+
for (const subtreeId of subtreeIds) {
|
|
832478
|
+
if (archivedIds.delete(subtreeId))
|
|
832479
|
+
released++;
|
|
832480
|
+
}
|
|
832481
|
+
if (released > 0)
|
|
832482
|
+
notifyAll();
|
|
832483
|
+
return released;
|
|
832484
|
+
},
|
|
832485
|
+
archiveFinished() {
|
|
832486
|
+
const nodes = registry3.query().nodes;
|
|
832487
|
+
const present = new Set(nodes.map((node) => node.id));
|
|
832488
|
+
let archivedNodes = 0;
|
|
832489
|
+
for (const node of nodes) {
|
|
832490
|
+
if (archivedIds.has(node.id))
|
|
832491
|
+
continue;
|
|
832492
|
+
const isRoot = node.parentId === undefined || !present.has(node.parentId);
|
|
832493
|
+
if (!isRoot || !ARCHIVE_TERMINAL_STATES.has(node.state))
|
|
832494
|
+
continue;
|
|
832495
|
+
const result = archiveSubtree(node.id, nodes);
|
|
832496
|
+
if (result.archived)
|
|
832497
|
+
archivedNodes += result.count;
|
|
832498
|
+
}
|
|
832499
|
+
if (archivedNodes > 0)
|
|
832500
|
+
notifyAll();
|
|
832501
|
+
return archivedNodes;
|
|
832502
|
+
},
|
|
832503
|
+
listArchived() {
|
|
832504
|
+
const snapshot = registry3.query();
|
|
832505
|
+
return {
|
|
832506
|
+
capturedAt: snapshot.capturedAt,
|
|
832507
|
+
nodes: snapshot.nodes.filter((node) => archivedIds.has(node.id))
|
|
832508
|
+
};
|
|
832509
|
+
},
|
|
832510
|
+
archivedCount() {
|
|
832511
|
+
return archivedIds.size;
|
|
832512
|
+
},
|
|
832513
|
+
dispose() {
|
|
832514
|
+
listeners.clear();
|
|
832515
|
+
if (underlyingUnsub) {
|
|
832516
|
+
underlyingUnsub();
|
|
832517
|
+
underlyingUnsub = null;
|
|
832518
|
+
}
|
|
832519
|
+
registry3.dispose();
|
|
832520
|
+
}
|
|
832521
|
+
};
|
|
832522
|
+
}
|
|
832523
|
+
var ARCHIVE_TERMINAL_STATES;
|
|
832524
|
+
var init_archive = __esm(() => {
|
|
832525
|
+
ARCHIVE_TERMINAL_STATES = new Set(["done", "failed", "killed", "interrupted"]);
|
|
832526
|
+
});
|
|
832527
|
+
|
|
831871
832528
|
// node_modules/@pellux/goodvibes-sdk/dist/platform/runtime/fleet/index.js
|
|
831872
832529
|
var init_fleet2 = __esm(() => {
|
|
831873
832530
|
init_registry8();
|
|
832531
|
+
init_archive();
|
|
831874
832532
|
});
|
|
831875
832533
|
|
|
831876
832534
|
// node_modules/@pellux/goodvibes-sdk/dist/platform/orchestration/budget.js
|
|
@@ -833592,7 +834250,7 @@ function createRuntimeServices(options) {
|
|
|
833592
834250
|
projectRoot: workingDirectory,
|
|
833593
834251
|
priceUsage
|
|
833594
834252
|
});
|
|
833595
|
-
const processRegistry = createProcessRegistry({
|
|
834253
|
+
const processRegistry = withFleetArchive(createProcessRegistry({
|
|
833596
834254
|
agentManager,
|
|
833597
834255
|
wrfcController,
|
|
833598
834256
|
orchestrationEngine,
|
|
@@ -833608,7 +834266,7 @@ function createRuntimeServices(options) {
|
|
|
833608
834266
|
runtimeBus: options.runtimeBus,
|
|
833609
834267
|
priceUsage,
|
|
833610
834268
|
codeIndexService: codeIndexStore
|
|
833611
|
-
});
|
|
834269
|
+
}));
|
|
833612
834270
|
registerGatewayVerbGroups(gatewayMethods, { processRegistry, workspaceCheckpointManager, sessionBroker, secretsManager, approvalBroker, shellPaths });
|
|
833613
834271
|
return {
|
|
833614
834272
|
workingDirectory,
|
|
@@ -837756,7 +838414,7 @@ var createStyledCell = (char, overrides = {}) => ({
|
|
|
837756
838414
|
// src/version.ts
|
|
837757
838415
|
import { readFileSync } from "fs";
|
|
837758
838416
|
import { join } from "path";
|
|
837759
|
-
var _version = "1.
|
|
838417
|
+
var _version = "1.8.0";
|
|
837760
838418
|
try {
|
|
837761
838419
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, "..", "package.json"), "utf-8"));
|
|
837762
838420
|
_version = typeof pkg.version === "string" ? pkg.version : _version;
|
|
@@ -839872,6 +840530,7 @@ async function executeOrchestratorTurnLoop(context) {
|
|
|
839872
840530
|
const toolDefinitions = context.toolRegistry.getToolDefinitions();
|
|
839873
840531
|
const streamEnabled = context.configManager.get("display.stream");
|
|
839874
840532
|
let continueLoop = true;
|
|
840533
|
+
let contextOverflowRetried = false;
|
|
839875
840534
|
const circuitBreaker = new ConsecutiveErrorBreaker;
|
|
839876
840535
|
let isFirstIterationOfThisCall = true;
|
|
839877
840536
|
let turnKnowledgeBlock = null;
|
|
@@ -840065,6 +840724,19 @@ ${turnKnowledgeBlock}`;
|
|
|
840065
840724
|
if (streamSessionStarted && context.runtimeBus) {
|
|
840066
840725
|
emitStreamEnd(context.runtimeBus, context.emitterContext(context.turnId), { turnId: context.turnId });
|
|
840067
840726
|
}
|
|
840727
|
+
if (isContextSizeExceededError(chatErr) && !contextOverflowRetried) {
|
|
840728
|
+
contextOverflowRetried = true;
|
|
840729
|
+
const rejectedAtTokens = estimateConversationTokens(context.conversation.getMessagesForLLM());
|
|
840730
|
+
context.providerRegistry.recordContextWindowRejection(model.registryKey, rejectedAtTokens);
|
|
840731
|
+
context.noteModelContextWindowWarning({
|
|
840732
|
+
provider: model.provider,
|
|
840733
|
+
model: model.id,
|
|
840734
|
+
providerStopReason: "context_length_exceeded (provider error)"
|
|
840735
|
+
});
|
|
840736
|
+
context.conversation.addSystemMessage(`${model.displayName} rejected the request as exceeding its context window (~${rejectedAtTokens.toLocaleString()} tokens sent). Learned this as the model's practical limit. Auto-compacting and retrying...`);
|
|
840737
|
+
context.requestRender();
|
|
840738
|
+
continue;
|
|
840739
|
+
}
|
|
840068
840740
|
if (chatErr instanceof ProviderError && chatErr.statusCode === 429 && model.provider === "synthetic" && model.tier !== "free") {
|
|
840069
840741
|
context.conversation.addSystemMessage(`All providers for ${model.displayName} are currently exhausted.
|
|
840070
840742
|
` + `Options:
|
|
@@ -840139,7 +840811,9 @@ ${turnKnowledgeBlock}`;
|
|
|
840139
840811
|
logger.info(`[Cache] Low hit rate: ${(cacheMetrics.hitRate * 100).toFixed(0)}% over ${cacheMetrics.turns} turns`);
|
|
840140
840812
|
}
|
|
840141
840813
|
context.setLastRequestInputTokens(response.usage.inputTokens);
|
|
840142
|
-
|
|
840814
|
+
const realInputTokens = response.usage.inputTokens + (response.usage.cacheReadTokens ?? 0) + (response.usage.cacheWriteTokens ?? 0);
|
|
840815
|
+
context.setLastInputTokens(realInputTokens);
|
|
840816
|
+
context.providerRegistry.reconcileObservedContextWindow(model.registryKey, realInputTokens);
|
|
840143
840817
|
if (context.runtimeBus) {
|
|
840144
840818
|
emitLlmResponseReceived(context.runtimeBus, context.emitterContext(context.turnId), {
|
|
840145
840819
|
turnId: context.turnId,
|
|
@@ -840776,6 +841450,9 @@ class Orchestrator {
|
|
|
840776
841450
|
this.conversation.addSystemMessage(msg);
|
|
840777
841451
|
}
|
|
840778
841452
|
}
|
|
841453
|
+
for (const event of eventsToReplay) {
|
|
841454
|
+
this.replayQueue.acknowledge(event.id);
|
|
841455
|
+
}
|
|
840779
841456
|
this.requestRender();
|
|
840780
841457
|
}
|
|
840781
841458
|
this.followUpRuntime.scheduleFlush();
|
|
@@ -863989,7 +864666,7 @@ function createRuntimeServices2(options) {
|
|
|
863989
864666
|
workingDirectory,
|
|
863990
864667
|
isEnabled: () => false
|
|
863991
864668
|
});
|
|
863992
|
-
const processRegistry = createProcessRegistry({
|
|
864669
|
+
const processRegistry = withFleetArchive(createProcessRegistry({
|
|
863993
864670
|
agentManager,
|
|
863994
864671
|
wrfcController,
|
|
863995
864672
|
orchestrationEngine,
|
|
@@ -864002,7 +864679,7 @@ function createRuntimeServices2(options) {
|
|
|
864002
864679
|
messageBus: agentMessageBus,
|
|
864003
864680
|
automationManager,
|
|
864004
864681
|
runtimeBus: options.runtimeBus
|
|
864005
|
-
});
|
|
864682
|
+
}));
|
|
864006
864683
|
const workspaceCheckpointManager = new WorkspaceCheckpointManager({
|
|
864007
864684
|
workspaceRoot: workingDirectory
|
|
864008
864685
|
});
|
|
@@ -895000,13 +895677,13 @@ init_state();
|
|
|
895000
895677
|
|
|
895001
895678
|
// src/input/commands/recall-shared.ts
|
|
895002
895679
|
var VALID_CLASSES = ["decision", "constraint", "incident", "pattern", "fact", "risk", "runbook", "architecture", "ownership"];
|
|
895003
|
-
var
|
|
895680
|
+
var VALID_SCOPES2 = ["session", "project", "team"];
|
|
895004
895681
|
var VALID_REVIEW_STATES = ["fresh", "reviewed", "stale", "contradicted"];
|
|
895005
895682
|
function isValidClass(s4) {
|
|
895006
895683
|
return VALID_CLASSES.includes(s4);
|
|
895007
895684
|
}
|
|
895008
895685
|
function isValidScope(s4) {
|
|
895009
|
-
return
|
|
895686
|
+
return VALID_SCOPES2.includes(s4);
|
|
895010
895687
|
}
|
|
895011
895688
|
function isValidReviewState(s4) {
|
|
895012
895689
|
return VALID_REVIEW_STATES.includes(s4);
|
|
@@ -895049,7 +895726,7 @@ function handleRecallSearch(args2, context) {
|
|
|
895049
895726
|
if (isValidScope(scope))
|
|
895050
895727
|
filter.scope = scope;
|
|
895051
895728
|
else {
|
|
895052
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
895729
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES2.join(", ")}.`);
|
|
895053
895730
|
return;
|
|
895054
895731
|
}
|
|
895055
895732
|
}
|
|
@@ -895224,7 +895901,7 @@ function handleRecallList(args2, context) {
|
|
|
895224
895901
|
if (scopeIdx !== -1 && args2[scopeIdx + 1]) {
|
|
895225
895902
|
const scope = args2[scopeIdx + 1];
|
|
895226
895903
|
if (!isValidScope(scope)) {
|
|
895227
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
895904
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES2.join(", ")}.`);
|
|
895228
895905
|
return;
|
|
895229
895906
|
}
|
|
895230
895907
|
filter.scope = scope;
|
|
@@ -895274,7 +895951,7 @@ async function handleRecallAdd(args2, context) {
|
|
|
895274
895951
|
const tags = tagsRaw ? tagsRaw.split(",").map((token) => token.trim()).filter(Boolean) : [];
|
|
895275
895952
|
const scope = scopeRaw && isValidScope(scopeRaw) ? scopeRaw : "project";
|
|
895276
895953
|
if (scopeRaw && !isValidScope(scopeRaw)) {
|
|
895277
|
-
context.print(`[memory] Invalid scope "${scopeRaw}". Valid values ${
|
|
895954
|
+
context.print(`[memory] Invalid scope "${scopeRaw}". Valid values ${VALID_SCOPES2.join(", ")}.`);
|
|
895278
895955
|
return;
|
|
895279
895956
|
}
|
|
895280
895957
|
const provenance = [];
|
|
@@ -895409,7 +896086,7 @@ function handleRecallExport(args2, context) {
|
|
|
895409
896086
|
if (scopeIdx !== -1 && commandArgs[scopeIdx + 1]) {
|
|
895410
896087
|
const scope = commandArgs[scopeIdx + 1];
|
|
895411
896088
|
if (!isValidScope(scope)) {
|
|
895412
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
896089
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES2.join(", ")}.`);
|
|
895413
896090
|
return;
|
|
895414
896091
|
}
|
|
895415
896092
|
filter.scope = scope;
|
|
@@ -895488,7 +896165,7 @@ function handleRecallHandoffExport(args2, context) {
|
|
|
895488
896165
|
const scopeIdx = commandArgs.indexOf("--scope");
|
|
895489
896166
|
const scopeRaw = scopeIdx !== -1 ? commandArgs[scopeIdx + 1] : "team";
|
|
895490
896167
|
if (!scopeRaw || !isValidScope(scopeRaw)) {
|
|
895491
|
-
context.print(`[memory] Unknown scope "${scopeRaw ?? ""}". Valid values ${
|
|
896168
|
+
context.print(`[memory] Unknown scope "${scopeRaw ?? ""}". Valid values ${VALID_SCOPES2.join(", ")}.`);
|
|
895492
896169
|
return;
|
|
895493
896170
|
}
|
|
895494
896171
|
const bundle = memory.exportBundle({ scope: scopeRaw });
|
|
@@ -895604,7 +896281,7 @@ function handleRecallPromote(args2, context) {
|
|
|
895604
896281
|
const id = parsed.rest[0];
|
|
895605
896282
|
const scope = parsed.rest[1];
|
|
895606
896283
|
if (!id || !scope || !isValidScope(scope)) {
|
|
895607
|
-
context.print(`[memory] Usage: /memory promote <id> <${
|
|
896284
|
+
context.print(`[memory] Usage: /memory promote <id> <${VALID_SCOPES2.join("|")}> --yes`);
|
|
895608
896285
|
return;
|
|
895609
896286
|
}
|
|
895610
896287
|
if (!parsed.yes) {
|
|
@@ -909194,7 +909871,7 @@ async function tryWireMemoryCommand(runtime2, normalized, rest) {
|
|
|
909194
909871
|
|
|
909195
909872
|
// src/cli/memory-command.ts
|
|
909196
909873
|
var VALID_CLASSES2 = ["decision", "constraint", "incident", "pattern", "fact", "risk", "runbook", "architecture", "ownership"];
|
|
909197
|
-
var
|
|
909874
|
+
var VALID_SCOPES4 = ["session", "project", "team"];
|
|
909198
909875
|
var VALID_REVIEW_STATES3 = ["fresh", "reviewed", "stale", "contradicted"];
|
|
909199
909876
|
var VALID_PROVENANCE_KINDS = ["session", "turn", "task", "event", "file"];
|
|
909200
909877
|
var VALUE_OPTIONS = new Set([
|
|
@@ -909294,7 +909971,7 @@ function isMemoryClass2(value) {
|
|
|
909294
909971
|
return VALID_CLASSES2.includes(value);
|
|
909295
909972
|
}
|
|
909296
909973
|
function isMemoryScope2(value) {
|
|
909297
|
-
return
|
|
909974
|
+
return VALID_SCOPES4.includes(value);
|
|
909298
909975
|
}
|
|
909299
909976
|
function isReviewState(value) {
|
|
909300
909977
|
return VALID_REVIEW_STATES3.includes(value);
|
|
@@ -909309,7 +909986,7 @@ function requireClass(value) {
|
|
|
909309
909986
|
}
|
|
909310
909987
|
function requireScope(value) {
|
|
909311
909988
|
if (!value || !isMemoryScope2(value))
|
|
909312
|
-
throw new Error(`Invalid memory scope "${value ?? ""}". Valid values ${
|
|
909989
|
+
throw new Error(`Invalid memory scope "${value ?? ""}". Valid values ${VALID_SCOPES4.join(", ")}`);
|
|
909313
909990
|
return value;
|
|
909314
909991
|
}
|
|
909315
909992
|
function optionalScope(value) {
|
|
@@ -963327,7 +964004,7 @@ var invokeContractRoute2 = exports_transport.invokeContractRoute;
|
|
|
963327
964004
|
var openContractRouteStream2 = exports_transport.openContractRouteStream;
|
|
963328
964005
|
var requireContractRoute2 = exports_transport.requireContractRoute;
|
|
963329
964006
|
var isAbortError6 = exports_transport.isAbortError;
|
|
963330
|
-
var
|
|
964007
|
+
var openServerSentEventStream2 = exports_transport.openServerSentEventStream;
|
|
963331
964008
|
var createOperatorRemoteClient2 = exports_transport.createOperatorRemoteClient;
|
|
963332
964009
|
var createPeerRemoteClient2 = exports_transport.createPeerRemoteClient;
|
|
963333
964010
|
var buildEventSourceUrl2 = exports_transport.buildEventSourceUrl;
|