@pellux/goodvibes-agent 1.7.0 → 1.8.1

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.
@@ -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.5.0", VERSION2;
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.5.0",
264155
- operatorMethodCount: 329,
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.5.0"
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: 329,
345719
- typedInputs: 329,
346073
+ methods: 333,
346074
+ typedInputs: 333,
345720
346075
  genericInputs: 0,
345721
- typedOutputs: 329,
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: 329,
345731
- validated: 327,
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 overrides = new Map;
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 overrides;
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 overrides;
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
- overrides = null;
440542
+ state = null;
440152
440543
  constructor(filePath) {
440153
440544
  this.filePath = filePath;
440154
440545
  }
440155
440546
  load() {
440156
- this.overrides ??= loadContextWindowOverrides(this.filePath);
440157
- return this.overrides;
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
- const overrides = this.load();
440166
- overrides.set(registryKey, cap);
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 overrides = this.load();
440172
- const existed = overrides.delete(registryKey);
440173
- if (existed)
440174
- saveContextWindowOverrides(this.filePath, overrides);
440175
- return existed;
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
- function saveContextWindowOverrides(filePath, overrides) {
440185
- const file2 = {
440186
- version: 1,
440187
- overrides: Object.fromEntries([...overrides.entries()].sort(([a2], [b2]) => a2.localeCompare(b2)))
440188
- };
440189
- try {
440190
- mkdirSync33(dirname37(filePath), { recursive: true });
440191
- writeFileSync29(filePath, `${JSON.stringify(file2, null, 2)}
440192
- `, "utf-8");
440193
- } catch (error51) {
440194
- logger.warn("[context-window-overrides] Failed to persist overrides", {
440195
- filePath,
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 registerFleetGatewayMethods(catalog, registry3) {
460553
- const snapshotDescriptor = catalog.get("fleet.snapshot");
460554
- if (snapshotDescriptor) {
460555
- catalog.register(snapshotDescriptor, createFleetSnapshotHandler(registry3), { replace: true });
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(() => {
@@ -464738,6 +465260,23 @@ function createSchema2(db) {
464738
465260
  )
464739
465261
  `);
464740
465262
  }
465263
+ function getKnowledgeSchemaStatements() {
465264
+ const statements = [];
465265
+ createSchema2({
465266
+ run(sql) {
465267
+ const normalized = sql.trim();
465268
+ if (normalized.length > 0)
465269
+ statements.push(normalized);
465270
+ }
465271
+ });
465272
+ return statements;
465273
+ }
465274
+ function renderKnowledgeSchemaSql() {
465275
+ return `${getKnowledgeSchemaStatements().map((statement) => statement.endsWith(";") ? statement : `${statement};`).join(`
465276
+
465277
+ `)}
465278
+ `;
465279
+ }
464741
465280
  function rowObject(columns, values2) {
464742
465281
  return Object.fromEntries(columns.map((column, index) => [column, values2[index]]));
464743
465282
  }
@@ -778110,6 +778649,9 @@ var init_ingest = __esm(() => {
778110
778649
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/browser-history/index.js
778111
778650
  var init_browser_history = __esm(() => {
778112
778651
  init_ingest();
778652
+ init_discover();
778653
+ init_readers();
778654
+ init_paths2();
778113
778655
  });
778114
778656
 
778115
778657
  // node_modules/graphql/jsutils/devAssert.mjs
@@ -795984,6 +796526,7 @@ var init_semantic = __esm(() => {
795984
796526
  init_llm();
795985
796527
  init_gap_repair();
795986
796528
  init_service5();
796529
+ init_self_improvement();
795987
796530
  });
795988
796531
 
795989
796532
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/home-graph/helpers.js
@@ -799952,8 +800495,40 @@ var init_map_view = __esm(() => {
799952
800495
  });
799953
800496
 
799954
800497
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/home-graph/types.js
799955
- var HOME_GRAPH_CAPABILITIES;
800498
+ var HOME_GRAPH_NODE_KINDS, HOME_GRAPH_RELATIONS, HOME_GRAPH_CAPABILITIES;
799956
800499
  var init_types15 = __esm(() => {
800500
+ HOME_GRAPH_NODE_KINDS = [
800501
+ "ha_home",
800502
+ "ha_entity",
800503
+ "ha_device",
800504
+ "ha_area",
800505
+ "ha_automation",
800506
+ "ha_script",
800507
+ "ha_scene",
800508
+ "ha_label",
800509
+ "ha_integration",
800510
+ "ha_room",
800511
+ "ha_device_passport",
800512
+ "ha_maintenance_item",
800513
+ "ha_troubleshooting_case",
800514
+ "ha_purchase",
800515
+ "ha_network_node"
800516
+ ];
800517
+ HOME_GRAPH_RELATIONS = [
800518
+ "controls",
800519
+ "located_in",
800520
+ "belongs_to_device",
800521
+ "has_manual",
800522
+ "has_receipt",
800523
+ "has_warranty",
800524
+ "has_issue",
800525
+ "fixed_by",
800526
+ "uses_battery",
800527
+ "connected_via",
800528
+ "part_of_network",
800529
+ "mentioned_by",
800530
+ "source_for"
800531
+ ];
799957
800532
  HOME_GRAPH_CAPABILITIES = [
799958
800533
  "knowledge-space-isolation",
799959
800534
  "snapshot-sync",
@@ -801744,6 +802319,7 @@ var init_service6 = __esm(() => {
801744
802319
  var init_home_graph = __esm(() => {
801745
802320
  init_service6();
801746
802321
  init_extension();
802322
+ init_types15();
801747
802323
  });
801748
802324
 
801749
802325
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/store-record-delete.js
@@ -804168,10 +804744,14 @@ var init_service7 = __esm(() => {
804168
804744
  var init_project_planning = __esm(() => {
804169
804745
  init_service7();
804170
804746
  init_helpers3();
804747
+ init_readiness();
804171
804748
  });
804172
804749
 
804173
804750
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/persistence.js
804174
- var init_persistence = () => {};
804751
+ var init_persistence = __esm(() => {
804752
+ init_store_schema();
804753
+ init_store_load();
804754
+ });
804175
804755
 
804176
804756
  // node_modules/@pellux/goodvibes-sdk/dist/platform/knowledge/projections.js
804177
804757
  class KnowledgeProjectionService {
@@ -807725,21 +808305,21 @@ var init_service8 = __esm(() => {
807725
808305
  var exports_knowledge = {};
807726
808306
  __export(exports_knowledge, {
807727
808307
  withKnowledgeSpace: () => withKnowledgeSpace,
807728
- uniqKnowledgeValues: () => uniq3,
807729
- stabilizeKnowledgeText: () => stableText2,
807730
- runKnowledgeSemanticSelfImprovement: () => runKnowledgeSemanticSelfImprovement2,
808308
+ uniqKnowledgeValues: () => uniq2,
808309
+ stabilizeKnowledgeText: () => stableText,
808310
+ runKnowledgeSemanticSelfImprovement: () => runKnowledgeSemanticSelfImprovement,
807731
808311
  resolveProjectPlanningSpace: () => resolveProjectPlanningSpace,
807732
- resolveKnowledgeDbPathFromControlPlaneDir: () => resolveKnowledgeDbPathFromControlPlaneDir2,
808312
+ resolveKnowledgeDbPathFromControlPlaneDir: () => resolveKnowledgeDbPathFromControlPlaneDir,
807733
808313
  renderPacket: () => renderPacket,
807734
808314
  renderKnowledgeSchemaSql: () => renderKnowledgeSchemaSql,
807735
808315
  renderKnowledgeMap: () => renderKnowledgeMap,
807736
808316
  readKnowledgeSearchText: () => readKnowledgeSearchText,
807737
- readBrowserKnowledgeProfile: () => readBrowserKnowledgeProfile2,
808317
+ readBrowserKnowledgeProfile: () => readBrowserKnowledgeProfile,
807738
808318
  projectPlanningSourceId: () => projectPlanningSourceId,
807739
808319
  projectPlanningProjectIdFromPath: () => projectPlanningProjectIdFromPath,
807740
808320
  projectPlanningCanonicalUri: () => projectPlanningCanonicalUri,
807741
808321
  projectKnowledgeSpaceId: () => projectKnowledgeSpaceId,
807742
- parseKnowledgeJsonValue: () => parseJsonValue2,
808322
+ parseKnowledgeJsonValue: () => parseJsonValue,
807743
808323
  normalizeProjectId: () => normalizeProjectId,
807744
808324
  normalizeKnowledgeSpaceId: () => normalizeKnowledgeSpaceId,
807745
808325
  normalizeHomeAssistantInstallationId: () => normalizeHomeAssistantInstallationId,
@@ -807747,12 +808327,12 @@ __export(exports_knowledge, {
807747
808327
  materializeGeneratedKnowledgeProjection: () => materializeGeneratedKnowledgeProjection,
807748
808328
  looksLikeRawPdfPayload: () => looksLikeRawPdfPayload,
807749
808329
  looksBinaryLikeText: () => looksBinaryLikeText,
807750
- loadKnowledgeStoreSnapshot: () => loadKnowledgeStoreSnapshot2,
808330
+ loadKnowledgeStoreSnapshot: () => loadKnowledgeStoreSnapshot,
807751
808331
  listGeneratedKnowledgePages: () => listGeneratedKnowledgePages,
807752
- listBrowserKinds: () => listBrowserKinds2,
808332
+ listBrowserKinds: () => listBrowserKinds,
807753
808333
  knowledgeSpaceMetadata: () => knowledgeSpaceMetadata,
807754
808334
  knowledgePageSourceWeight: () => knowledgePageSourceWeight,
807755
- knowledgeNowMs: () => nowMs2,
808335
+ knowledgeNowMs: () => nowMs,
807756
808336
  knowledgeExtractionNeedsRefresh: () => knowledgeExtractionNeedsRefresh,
807757
808337
  isUsefulKnowledgePageSourceCandidate: () => isUsefulKnowledgePageSourceCandidate,
807758
808338
  isUsefulKnowledgePageSource: () => isUsefulKnowledgePageSource,
@@ -807772,12 +808352,12 @@ __export(exports_knowledge, {
807772
808352
  generatedKnowledgeSourceId: () => generatedKnowledgeSourceId,
807773
808353
  generatedKnowledgeCanonicalUri: () => generatedKnowledgeCanonicalUri,
807774
808354
  extractKnowledgeArtifact: () => extractKnowledgeArtifact,
807775
- evaluateProjectPlanningReadiness: () => evaluateProjectPlanningReadiness2,
807776
- discoverBrowserKnowledgeProfiles: () => discoverBrowserKnowledgeProfiles2,
808355
+ evaluateProjectPlanningReadiness: () => evaluateProjectPlanningReadiness,
808356
+ discoverBrowserKnowledgeProfiles: () => discoverBrowserKnowledgeProfiles,
807777
808357
  createWebKnowledgeGapRepairer: () => createWebKnowledgeGapRepairer,
807778
808358
  createProviderBackedKnowledgeSemanticLlm: () => createProviderBackedKnowledgeSemanticLlm,
807779
808359
  createMemoryApi: () => createMemoryApi,
807780
- createKnowledgeSchema: () => createSchema3,
808360
+ createKnowledgeSchema: () => createSchema2,
807781
808361
  createKnowledgeApi: () => createKnowledgeApi,
807782
808362
  createDefaultKnowledgeConnectorRegistry: () => createDefaultKnowledgeConnectorRegistry,
807783
808363
  compareKnowledgePageSources: () => compareKnowledgePageSources,
@@ -810250,7 +810830,7 @@ var init_delivery_manager = __esm(() => {
810250
810830
  });
810251
810831
 
810252
810832
  // node_modules/@pellux/goodvibes-sdk/dist/platform/automation/scheduler-capacity.js
810253
- function computeSchedulerCapacity(slotsTotal, runs, nowMs3 = Date.now()) {
810833
+ function computeSchedulerCapacity(slotsTotal, runs, nowMs2 = Date.now()) {
810254
810834
  let slotsInUse = 0;
810255
810835
  const queuedRuns = [];
810256
810836
  for (const run7 of runs) {
@@ -810260,7 +810840,7 @@ function computeSchedulerCapacity(slotsTotal, runs, nowMs3 = Date.now()) {
810260
810840
  queuedRuns.push(run7);
810261
810841
  }
810262
810842
  const queueDepth = queuedRuns.length;
810263
- const oldestQueuedAgeMs = queueDepth > 0 ? nowMs3 - Math.min(...queuedRuns.map((r6) => r6.queuedAt)) : null;
810843
+ const oldestQueuedAgeMs = queueDepth > 0 ? nowMs2 - Math.min(...queuedRuns.map((r6) => r6.queuedAt)) : null;
810264
810844
  return { slotsTotal, slotsInUse, queueDepth, oldestQueuedAgeMs };
810265
810845
  }
810266
810846
 
@@ -831868,9 +832448,145 @@ var init_registry8 = __esm(() => {
831868
832448
  };
831869
832449
  });
831870
832450
 
832451
+ // node_modules/@pellux/goodvibes-sdk/dist/platform/runtime/fleet/archive.js
832452
+ function collectSubtreeIds(rootId, nodes) {
832453
+ const childrenByParent = new Map;
832454
+ for (const node of nodes) {
832455
+ if (node.parentId === undefined)
832456
+ continue;
832457
+ const siblings = childrenByParent.get(node.parentId);
832458
+ if (siblings)
832459
+ siblings.push(node);
832460
+ else
832461
+ childrenByParent.set(node.parentId, [node]);
832462
+ }
832463
+ const ids = [];
832464
+ const stack = [rootId];
832465
+ const seen = new Set;
832466
+ while (stack.length > 0) {
832467
+ const id = stack.pop();
832468
+ if (seen.has(id))
832469
+ continue;
832470
+ seen.add(id);
832471
+ ids.push(id);
832472
+ for (const child of childrenByParent.get(id) ?? [])
832473
+ stack.push(child.id);
832474
+ }
832475
+ return ids;
832476
+ }
832477
+ function withFleetArchive(registry3) {
832478
+ const archivedIds = new Set;
832479
+ const listeners = new Set;
832480
+ let underlyingUnsub = null;
832481
+ const filterSnapshot = (snapshot) => ({
832482
+ capturedAt: snapshot.capturedAt,
832483
+ nodes: snapshot.nodes.filter((node) => !archivedIds.has(node.id))
832484
+ });
832485
+ const notifyAll = () => {
832486
+ const snapshot = filterSnapshot(registry3.query());
832487
+ for (const listener of listeners)
832488
+ listener(snapshot);
832489
+ };
832490
+ const archiveSubtree = (rootId, nodes) => {
832491
+ const root = nodes.find((node) => node.id === rootId);
832492
+ if (!root)
832493
+ return { archived: false, count: 0, reason: `node ${rootId} not found` };
832494
+ const subtreeIds = collectSubtreeIds(rootId, nodes);
832495
+ const subtreeNodes = nodes.filter((node) => subtreeIds.includes(node.id));
832496
+ const live = subtreeNodes.filter((node) => !ARCHIVE_TERMINAL_STATES.has(node.state));
832497
+ if (live.length > 0) {
832498
+ return {
832499
+ archived: false,
832500
+ count: 0,
832501
+ reason: `${live.length} node(s) in the subtree are still active (${live[0].state}) \u2014 only finished subtrees can be archived`
832502
+ };
832503
+ }
832504
+ for (const id of subtreeIds)
832505
+ archivedIds.add(id);
832506
+ return { archived: true, count: subtreeIds.length };
832507
+ };
832508
+ return {
832509
+ ...registry3,
832510
+ query(filter) {
832511
+ return filterSnapshot(registry3.query(filter));
832512
+ },
832513
+ subscribe(listener) {
832514
+ listeners.add(listener);
832515
+ underlyingUnsub ??= registry3.subscribe(() => {
832516
+ notifyAll();
832517
+ });
832518
+ return () => {
832519
+ listeners.delete(listener);
832520
+ if (listeners.size === 0 && underlyingUnsub) {
832521
+ underlyingUnsub();
832522
+ underlyingUnsub = null;
832523
+ }
832524
+ };
832525
+ },
832526
+ archive(id) {
832527
+ const result = archiveSubtree(id, registry3.query().nodes);
832528
+ if (result.archived)
832529
+ notifyAll();
832530
+ return result;
832531
+ },
832532
+ unarchive(id) {
832533
+ const subtreeIds = collectSubtreeIds(id, registry3.query().nodes);
832534
+ let released = 0;
832535
+ for (const subtreeId of subtreeIds) {
832536
+ if (archivedIds.delete(subtreeId))
832537
+ released++;
832538
+ }
832539
+ if (released > 0)
832540
+ notifyAll();
832541
+ return released;
832542
+ },
832543
+ archiveFinished() {
832544
+ const nodes = registry3.query().nodes;
832545
+ const present = new Set(nodes.map((node) => node.id));
832546
+ let archivedNodes = 0;
832547
+ for (const node of nodes) {
832548
+ if (archivedIds.has(node.id))
832549
+ continue;
832550
+ const isRoot = node.parentId === undefined || !present.has(node.parentId);
832551
+ if (!isRoot || !ARCHIVE_TERMINAL_STATES.has(node.state))
832552
+ continue;
832553
+ const result = archiveSubtree(node.id, nodes);
832554
+ if (result.archived)
832555
+ archivedNodes += result.count;
832556
+ }
832557
+ if (archivedNodes > 0)
832558
+ notifyAll();
832559
+ return archivedNodes;
832560
+ },
832561
+ listArchived() {
832562
+ const snapshot = registry3.query();
832563
+ return {
832564
+ capturedAt: snapshot.capturedAt,
832565
+ nodes: snapshot.nodes.filter((node) => archivedIds.has(node.id))
832566
+ };
832567
+ },
832568
+ archivedCount() {
832569
+ return archivedIds.size;
832570
+ },
832571
+ dispose() {
832572
+ listeners.clear();
832573
+ if (underlyingUnsub) {
832574
+ underlyingUnsub();
832575
+ underlyingUnsub = null;
832576
+ }
832577
+ registry3.dispose();
832578
+ }
832579
+ };
832580
+ }
832581
+ var ARCHIVE_TERMINAL_STATES;
832582
+ var init_archive = __esm(() => {
832583
+ ARCHIVE_TERMINAL_STATES = new Set(["done", "failed", "killed", "interrupted"]);
832584
+ });
832585
+
831871
832586
  // node_modules/@pellux/goodvibes-sdk/dist/platform/runtime/fleet/index.js
831872
832587
  var init_fleet2 = __esm(() => {
831873
832588
  init_registry8();
832589
+ init_archive();
831874
832590
  });
831875
832591
 
831876
832592
  // node_modules/@pellux/goodvibes-sdk/dist/platform/orchestration/budget.js
@@ -833592,7 +834308,7 @@ function createRuntimeServices(options) {
833592
834308
  projectRoot: workingDirectory,
833593
834309
  priceUsage
833594
834310
  });
833595
- const processRegistry = createProcessRegistry({
834311
+ const processRegistry = withFleetArchive(createProcessRegistry({
833596
834312
  agentManager,
833597
834313
  wrfcController,
833598
834314
  orchestrationEngine,
@@ -833608,7 +834324,7 @@ function createRuntimeServices(options) {
833608
834324
  runtimeBus: options.runtimeBus,
833609
834325
  priceUsage,
833610
834326
  codeIndexService: codeIndexStore
833611
- });
834327
+ }));
833612
834328
  registerGatewayVerbGroups(gatewayMethods, { processRegistry, workspaceCheckpointManager, sessionBroker, secretsManager, approvalBroker, shellPaths });
833613
834329
  return {
833614
834330
  workingDirectory,
@@ -837756,7 +838472,7 @@ var createStyledCell = (char, overrides = {}) => ({
837756
838472
  // src/version.ts
837757
838473
  import { readFileSync } from "fs";
837758
838474
  import { join } from "path";
837759
- var _version = "1.7.0";
838475
+ var _version = "1.8.1";
837760
838476
  try {
837761
838477
  const pkg = JSON.parse(readFileSync(join(import.meta.dir, "..", "package.json"), "utf-8"));
837762
838478
  _version = typeof pkg.version === "string" ? pkg.version : _version;
@@ -839872,6 +840588,7 @@ async function executeOrchestratorTurnLoop(context) {
839872
840588
  const toolDefinitions = context.toolRegistry.getToolDefinitions();
839873
840589
  const streamEnabled = context.configManager.get("display.stream");
839874
840590
  let continueLoop = true;
840591
+ let contextOverflowRetried = false;
839875
840592
  const circuitBreaker = new ConsecutiveErrorBreaker;
839876
840593
  let isFirstIterationOfThisCall = true;
839877
840594
  let turnKnowledgeBlock = null;
@@ -840065,6 +840782,19 @@ ${turnKnowledgeBlock}`;
840065
840782
  if (streamSessionStarted && context.runtimeBus) {
840066
840783
  emitStreamEnd(context.runtimeBus, context.emitterContext(context.turnId), { turnId: context.turnId });
840067
840784
  }
840785
+ if (isContextSizeExceededError(chatErr) && !contextOverflowRetried) {
840786
+ contextOverflowRetried = true;
840787
+ const rejectedAtTokens = estimateConversationTokens(context.conversation.getMessagesForLLM());
840788
+ context.providerRegistry.recordContextWindowRejection(model.registryKey, rejectedAtTokens);
840789
+ context.noteModelContextWindowWarning({
840790
+ provider: model.provider,
840791
+ model: model.id,
840792
+ providerStopReason: "context_length_exceeded (provider error)"
840793
+ });
840794
+ 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...`);
840795
+ context.requestRender();
840796
+ continue;
840797
+ }
840068
840798
  if (chatErr instanceof ProviderError && chatErr.statusCode === 429 && model.provider === "synthetic" && model.tier !== "free") {
840069
840799
  context.conversation.addSystemMessage(`All providers for ${model.displayName} are currently exhausted.
840070
840800
  ` + `Options:
@@ -840139,7 +840869,9 @@ ${turnKnowledgeBlock}`;
840139
840869
  logger.info(`[Cache] Low hit rate: ${(cacheMetrics.hitRate * 100).toFixed(0)}% over ${cacheMetrics.turns} turns`);
840140
840870
  }
840141
840871
  context.setLastRequestInputTokens(response.usage.inputTokens);
840142
- context.setLastInputTokens(response.usage.inputTokens + (response.usage.cacheReadTokens ?? 0) + (response.usage.cacheWriteTokens ?? 0));
840872
+ const realInputTokens = response.usage.inputTokens + (response.usage.cacheReadTokens ?? 0) + (response.usage.cacheWriteTokens ?? 0);
840873
+ context.setLastInputTokens(realInputTokens);
840874
+ context.providerRegistry.reconcileObservedContextWindow(model.registryKey, realInputTokens);
840143
840875
  if (context.runtimeBus) {
840144
840876
  emitLlmResponseReceived(context.runtimeBus, context.emitterContext(context.turnId), {
840145
840877
  turnId: context.turnId,
@@ -840776,6 +841508,9 @@ class Orchestrator {
840776
841508
  this.conversation.addSystemMessage(msg);
840777
841509
  }
840778
841510
  }
841511
+ for (const event of eventsToReplay) {
841512
+ this.replayQueue.acknowledge(event.id);
841513
+ }
840779
841514
  this.requestRender();
840780
841515
  }
840781
841516
  this.followUpRuntime.scheduleFlush();
@@ -862945,7 +863680,7 @@ var WORK_PLAN_STATUSES = [
862945
863680
  "failed",
862946
863681
  "cancelled"
862947
863682
  ];
862948
- function nowMs3() {
863683
+ function nowMs2() {
862949
863684
  return Date.now();
862950
863685
  }
862951
863686
  function isObject4(value) {
@@ -863051,7 +863786,7 @@ class WorkPlanStore {
863051
863786
  if (!normalizedTitle)
863052
863787
  throw new Error("Work plan item title is required.");
863053
863788
  const plan = this.readPlan();
863054
- const time4 = nowMs3();
863789
+ const time4 = nowMs2();
863055
863790
  const item = {
863056
863791
  id: createItemId(),
863057
863792
  title: normalizedTitle,
@@ -863075,7 +863810,7 @@ class WorkPlanStore {
863075
863810
  updateItem(idOrPrefix, patch2) {
863076
863811
  const plan = this.readPlan();
863077
863812
  const item = this.resolveItem(plan, idOrPrefix);
863078
- const time4 = nowMs3();
863813
+ const time4 = nowMs2();
863079
863814
  const nextStatus = patch2.status ?? item.status;
863080
863815
  const next = this.pruneItem({
863081
863816
  ...item,
@@ -863108,7 +863843,7 @@ class WorkPlanStore {
863108
863843
  removeItem(idOrPrefix) {
863109
863844
  const plan = this.readPlan();
863110
863845
  const item = this.resolveItem(plan, idOrPrefix);
863111
- const time4 = nowMs3();
863846
+ const time4 = nowMs2();
863112
863847
  const remaining = plan.items.filter((candidate) => candidate.id !== item.id);
863113
863848
  this.writePlan({
863114
863849
  ...plan,
@@ -863128,7 +863863,7 @@ class WorkPlanStore {
863128
863863
  ...plan,
863129
863864
  items: remaining,
863130
863865
  activeItemId: remaining[0]?.id,
863131
- updatedAt: nowMs3()
863866
+ updatedAt: nowMs2()
863132
863867
  });
863133
863868
  return removed;
863134
863869
  }
@@ -863167,7 +863902,7 @@ class WorkPlanStore {
863167
863902
  const parsed = JSON.parse(raw);
863168
863903
  if (!isObject4(parsed))
863169
863904
  return this.createEmptyPlan();
863170
- const time4 = nowMs3();
863905
+ const time4 = nowMs2();
863171
863906
  const createdAt = typeof parsed.createdAt === "number" ? parsed.createdAt : time4;
863172
863907
  const updatedAt = typeof parsed.updatedAt === "number" ? parsed.updatedAt : createdAt;
863173
863908
  const items = Array.isArray(parsed.items) ? parsed.items.map((item) => normalizeItem(item, createdAt)).filter((item) => item !== null) : [];
@@ -863186,7 +863921,7 @@ class WorkPlanStore {
863186
863921
  };
863187
863922
  }
863188
863923
  createEmptyPlan() {
863189
- const time4 = nowMs3();
863924
+ const time4 = nowMs2();
863190
863925
  return {
863191
863926
  id: createPlanId(this.options.projectId, this.options.projectRoot),
863192
863927
  projectId: this.options.projectId,
@@ -863989,7 +864724,7 @@ function createRuntimeServices2(options) {
863989
864724
  workingDirectory,
863990
864725
  isEnabled: () => false
863991
864726
  });
863992
- const processRegistry = createProcessRegistry({
864727
+ const processRegistry = withFleetArchive(createProcessRegistry({
863993
864728
  agentManager,
863994
864729
  wrfcController,
863995
864730
  orchestrationEngine,
@@ -864002,10 +864737,18 @@ function createRuntimeServices2(options) {
864002
864737
  messageBus: agentMessageBus,
864003
864738
  automationManager,
864004
864739
  runtimeBus: options.runtimeBus
864005
- });
864740
+ }));
864006
864741
  const workspaceCheckpointManager = new WorkspaceCheckpointManager({
864007
864742
  workspaceRoot: workingDirectory
864008
864743
  });
864744
+ registerGatewayVerbGroups(gatewayMethods, {
864745
+ processRegistry,
864746
+ workspaceCheckpointManager,
864747
+ sessionBroker,
864748
+ secretsManager,
864749
+ approvalBroker,
864750
+ shellPaths
864751
+ });
864009
864752
  return {
864010
864753
  workingDirectory,
864011
864754
  homeDirectory,
@@ -975001,8 +975744,8 @@ function formatDigestTime(at, from = Date.now()) {
975001
975744
  return `yesterday ${time4}`;
975002
975745
  return `${d4.toLocaleDateString(undefined, { month: "short", day: "numeric" })} ${time4}`;
975003
975746
  }
975004
- function formatRelativeTime(targetMs, nowMs4 = Date.now()) {
975005
- const diffMs = targetMs - nowMs4;
975747
+ function formatRelativeTime(targetMs, nowMs3 = Date.now()) {
975748
+ const diffMs = targetMs - nowMs3;
975006
975749
  if (diffMs <= 0)
975007
975750
  return "soon";
975008
975751
  const diffMin = Math.round(diffMs / 60000);