@corenel/harness 0.7.2 → 0.7.3

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.
@@ -29,6 +29,37 @@ export interface AcpSessionUpdate {
29
29
  */
30
30
  export declare function eventToSessionUpdate(ev: AgentEvent): AcpSessionUpdate | null;
31
31
  /** Map our loop's stop reason onto ACP's. Unknown reasons report `end_turn`
32
- * rather than inventing a value the client would not recognize. */
32
+ * rather than inventing a value the client would not recognize.
33
+ *
34
+ * WHAT ARRIVES HERE IS NORMALIZED. The daemon's ACP prompt reads the reason off
35
+ * a run whose executor already put it through the shared vocabulary
36
+ * (`executor.ts`'s `normalizeRunStatus`), so the raw provider reasons reach
37
+ * this function only from a caller that skipped that edge. Both spellings are
38
+ * kept for that reason.
39
+ *
40
+ * `policy` -> `refusal` is that normalization's consequence, and it is the
41
+ * honest mapping for everything `policy` names: our own policy engine stopping
42
+ * the run, and the provider's two guardrails -- declining to answer
43
+ * ('refusal') and blocking the output it produced ('content_filter'). ACP's
44
+ * `refusal` means the agent would not continue, which is true of all of them;
45
+ * `end_turn` -- what these used to report -- tells the client the turn ended
46
+ * normally, which is true of none.
47
+ *
48
+ * `stuck` -> `max_tokens` is that same argument, applied to the other end of
49
+ * the vocabulary. An ACP stop reason describes the TURN'S OUTCOME, not which
50
+ * component decided it. `stuck` reaches here from TWO causes: the loop's
51
+ * no-progress guard (the model repeating one tool call, `loop.ts`) and a
52
+ * provider cutting the output off at its token ceiling (normalized from
53
+ * 'length'/'max_tokens'). ACP's `max_tokens` is exact for the second and
54
+ * IMPRECISE for the first -- a no-progress stop is reported to the client as a
55
+ * token limit the run did not actually hit, and this mapping accepts that
56
+ * knowingly. It is still the better answer, because both causes are "the turn
57
+ * did not finish" and `end_turn` is wrong for BOTH: trading a precise lie
58
+ * ("it completed") for an imprecise truth ("it stopped at a limit") is the
59
+ * right trade for a client deciding whether to continue the conversation.
60
+ *
61
+ * Note what is NOT here: the local budget gate normalizes to its own `budget`
62
+ * member and still reports `end_turn`, along with `error` and `stalled` --
63
+ * ACP's enum has no value for any of them. */
33
64
  export declare function stopReasonForAcp(reason: string): string;
34
65
  //# sourceMappingURL=agentMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentMap.d.ts","sourceRoot":"","sources":["../../acp/agentMap.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAmC3C;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAQ9D;AAED,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,UAAU,GAAG,gBAAgB,GAAG,IAAI,CA6B5E;AAED;mEACmE;AACnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAavD"}
1
+ {"version":3,"file":"agentMap.d.ts","sourceRoot":"","sources":["../../acp/agentMap.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAmC3C;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,CAQ9D;AAED,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,UAAU,GAAG,gBAAgB,GAAG,IAAI,CA6B5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAgC8C;AAC9C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBvD"}
@@ -92,7 +92,38 @@ export function eventToSessionUpdate(ev) {
92
92
  }
93
93
  }
94
94
  /** Map our loop's stop reason onto ACP's. Unknown reasons report `end_turn`
95
- * rather than inventing a value the client would not recognize. */
95
+ * rather than inventing a value the client would not recognize.
96
+ *
97
+ * WHAT ARRIVES HERE IS NORMALIZED. The daemon's ACP prompt reads the reason off
98
+ * a run whose executor already put it through the shared vocabulary
99
+ * (`executor.ts`'s `normalizeRunStatus`), so the raw provider reasons reach
100
+ * this function only from a caller that skipped that edge. Both spellings are
101
+ * kept for that reason.
102
+ *
103
+ * `policy` -> `refusal` is that normalization's consequence, and it is the
104
+ * honest mapping for everything `policy` names: our own policy engine stopping
105
+ * the run, and the provider's two guardrails -- declining to answer
106
+ * ('refusal') and blocking the output it produced ('content_filter'). ACP's
107
+ * `refusal` means the agent would not continue, which is true of all of them;
108
+ * `end_turn` -- what these used to report -- tells the client the turn ended
109
+ * normally, which is true of none.
110
+ *
111
+ * `stuck` -> `max_tokens` is that same argument, applied to the other end of
112
+ * the vocabulary. An ACP stop reason describes the TURN'S OUTCOME, not which
113
+ * component decided it. `stuck` reaches here from TWO causes: the loop's
114
+ * no-progress guard (the model repeating one tool call, `loop.ts`) and a
115
+ * provider cutting the output off at its token ceiling (normalized from
116
+ * 'length'/'max_tokens'). ACP's `max_tokens` is exact for the second and
117
+ * IMPRECISE for the first -- a no-progress stop is reported to the client as a
118
+ * token limit the run did not actually hit, and this mapping accepts that
119
+ * knowingly. It is still the better answer, because both causes are "the turn
120
+ * did not finish" and `end_turn` is wrong for BOTH: trading a precise lie
121
+ * ("it completed") for an imprecise truth ("it stopped at a limit") is the
122
+ * right trade for a client deciding whether to continue the conversation.
123
+ *
124
+ * Note what is NOT here: the local budget gate normalizes to its own `budget`
125
+ * member and still reports `end_turn`, along with `error` and `stalled` --
126
+ * ACP's enum has no value for any of them. */
96
127
  export function stopReasonForAcp(reason) {
97
128
  switch (reason) {
98
129
  case 'cancelled':
@@ -101,8 +132,11 @@ export function stopReasonForAcp(reason) {
101
132
  case 'max-turns':
102
133
  case 'max_turns':
103
134
  return 'max_turn_requests';
135
+ case 'policy':
104
136
  case 'refusal':
105
137
  return 'refusal';
138
+ case 'stuck':
139
+ return 'max_tokens';
106
140
  default:
107
141
  return 'end_turn';
108
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agentMap.js","sourceRoot":"","sources":["../../acp/agentMap.ts"],"names":[],"mappings":"AAmBA,4EAA4E;AAC5E,MAAM,UAAU,GAAgC;IAC9C,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,QAAQ;IACtB,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,QAAQ;IACzB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,MAAM;IACnB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,MAAM;IACnB,UAAU,EAAE,OAAO;IACnB,cAAc,EAAE,OAAO;IACvB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,OAAO;CAClB,CAAC;AAEF;+CAC+C;AAC/C,MAAM,eAAe,GAAgC;IACnD,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,OAAO;IACf,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,aAAqB;IAC/C,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,EAAE,GAAG,K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Aa;YAChB,OAAO;gBACL,aAAa,EAAE,kBAAkB;gBACjC,UAAU,EAAE,EAAE,CAAC,EAAE;gBACjB,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW;gBAC3C,SAAS,EAAE,EAAE,CAAC,MAAM;aACrB,CAAC;QACJ,KAAK,OAAO;YACV,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC;QAC3G;YACE,uEAAuE;YACvE,oEAAoE;YACpE,qEAAqE;YACrE,8DAA8D;YAC9D,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAgC8C;AAC9C,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS;YACZ,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,mBAAmB,CAAC;QAC7B,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,YAAY,CAAC;QACtB;YACE,OAAO,UAAU,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -5,4 +5,18 @@ export interface ModelRates {
5
5
  }
6
6
  export declare const CACHED_INPUT_FRACTION = 0.5;
7
7
  export declare function priceUsageWith(usage: Usage, rates: ModelRates | null): number | null;
8
+ export type PriceTable = Map<string, ModelRates>;
9
+ /** A usd cap can only be enforced against rates that actually cost something.
10
+ * Absent rates (the model never entered the table) and an all-zero rate both
11
+ * mean "spend will always read $0" -- neither can enforce a `maxUsd`. Every
12
+ * surface with a usd ceiling asks THIS question, so they cannot drift: the
13
+ * crew-run guard (executor.ts), the room guard (roomDeps.ts), and `corenel
14
+ * run`. */
15
+ export declare function pricedForUsd(rates: ModelRates | null): boolean;
16
+ /** Hydrate the rate table from the SAME backend the app uses (GET
17
+ * <endpoint>/llm-providers/available, Bearer login token), so prices are the
18
+ * current ones rather than a drifting static copy. An empty table means
19
+ * "cannot price" -- every caller must fail closed on a usd cap rather than
20
+ * treat unknown as free. */
21
+ export declare function hydratePrices(endpoint: string, getToken: () => Promise<string | null>, fetchImpl?: typeof fetch): Promise<PriceTable>;
8
22
  //# sourceMappingURL=pricing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../core/pricing.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,UAAU;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AACjE,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAQpF"}
1
+ {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../core/pricing.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,UAAU;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AACjE,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAQpF;AAYD,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEjD;;;;;WAKW;AACX,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAG9D;AASD;;;;4BAI4B;AAC5B,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EACtC,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,UAAU,CAAC,CAuBrB"}
@@ -9,4 +9,53 @@ export function priceUsageWith(usage, rates) {
9
9
  + (cached / perM) * rates.inPrice * CACHED_INPUT_FRACTION
10
10
  + (usage.completionTokens / perM) * rates.outPrice;
11
11
  }
12
+ /** A usd cap can only be enforced against rates that actually cost something.
13
+ * Absent rates (the model never entered the table) and an all-zero rate both
14
+ * mean "spend will always read $0" -- neither can enforce a `maxUsd`. Every
15
+ * surface with a usd ceiling asks THIS question, so they cannot drift: the
16
+ * crew-run guard (executor.ts), the room guard (roomDeps.ts), and `corenel
17
+ * run`. */
18
+ export function pricedForUsd(rates) {
19
+ if (!rates)
20
+ return false;
21
+ return rates.inPrice > 0 || rates.outPrice > 0;
22
+ }
23
+ /** Hydrate the rate table from the SAME backend the app uses (GET
24
+ * <endpoint>/llm-providers/available, Bearer login token), so prices are the
25
+ * current ones rather than a drifting static copy. An empty table means
26
+ * "cannot price" -- every caller must fail closed on a usd cap rather than
27
+ * treat unknown as free. */
28
+ export async function hydratePrices(endpoint, getToken, fetchImpl = fetch) {
29
+ const table = new Map();
30
+ let token = null;
31
+ try {
32
+ token = await getToken();
33
+ }
34
+ catch {
35
+ token = null;
36
+ }
37
+ if (!token)
38
+ return table;
39
+ try {
40
+ const res = await fetchImpl(`${endpoint.replace(/\/$/, '')}/llm-providers/available`, {
41
+ headers: { Authorization: `Bearer ${token}` },
42
+ });
43
+ if (!res.ok)
44
+ return table;
45
+ const json = (await res.json());
46
+ for (const p of json.providers ?? []) {
47
+ for (const m of p.models ?? []) {
48
+ // An UNPRICED model must stay ABSENT from the table, never entered at
49
+ // rate 0: a zero entry is truthy, so a fail-closed usd guard would pass
50
+ // and then price every turn at $0, making `maxUsd` unenforceable.
51
+ // Absence is what makes the guard trip.
52
+ if (m.inputPrice == null || m.outputPrice == null)
53
+ continue;
54
+ table.set(m.model, { inPrice: m.inputPrice, outPrice: m.outputPrice });
55
+ }
56
+ }
57
+ }
58
+ catch { /* leave the table empty -> caller fails closed on a usd cap */ }
59
+ return table;
60
+ }
12
61
  //# sourceMappingURL=pricing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../core/pricing.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,KAAwB;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAS,CAAC;IACvB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO;UACjC,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,qBAAqB;UACvD,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../core/pricing.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,KAAwB;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,I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GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAwC,CAAC;QACvE,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YACrC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBAC/B,sEAAsE;gBACtE,wEAAwE;gBACxE,kEAAkE;gBAClE,wCAAwC;gBACxC,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI;oBAAE,SAAS;gBAC5D,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,+DAA+D,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC"}
package/dist/todos.d.ts CHANGED
@@ -18,17 +18,24 @@ export interface AgentTodo {
18
18
  /** Tool calls / notes recorded while this task was active. */
19
19
  activity: TodoActivity[];
20
20
  }
21
- export declare function getTodos(): AgentTodo[];
22
- export declare function clearTodos(): void;
21
+ /** How many conversations keep a task list. One list per session kept forever
22
+ * is a localStorage leak that grows with every chat ever opened; the
23
+ * least-recently-written session is dropped instead. Same reasoning (and the
24
+ * same number) as the tool loader's per-conversation cap. */
25
+ export declare const SESSION_TODO_CAP = 24;
26
+ export declare function getTodos(session: string | null): AgentTodo[];
27
+ export declare function clearTodos(session: string | null): void;
23
28
  export type TodoView = 'timeline' | 'board';
24
29
  export declare function getTodoView(): TodoView;
25
30
  export declare function setTodoView(v: TodoView): void;
26
- /** Replace the list from a todo_write tool call. Activity accumulated for a task
27
- * (matched by id) is preserved across rewrites. */
28
- export declare function applyTodoWrite(input: unknown): void;
29
- /** Record a tool call under the active (in_progress) task. */
30
- export declare function addActivity(activityId: string, label: string): void;
31
- /** Resolve a recorded tool call (its result arrived). */
32
- export declare function resolveActivity(activityId: string, isError?: boolean, detail?: string): void;
33
- export declare function useTodos(): AgentTodo[];
31
+ /** Replace one session's list from a todo_write tool call. Activity accumulated
32
+ * for a task (matched by id, within that same session) is preserved across
33
+ * rewrites. */
34
+ export declare function applyTodoWrite(session: string | null, input: unknown): void;
35
+ /** Record a tool call under the active (in_progress) task of `session`. */
36
+ export declare function addActivity(session: string | null, activityId: string, label: string): void;
37
+ /** Resolve a recorded tool call (its result arrived) in `session`. A call id is
38
+ * only unique WITHIN a run, so this must never reach across sessions. */
39
+ export declare function resolveActivity(session: string | null, activityId: string, isError?: boolean, detail?: string): void;
40
+ export declare function useTodos(session: string | null): AgentTodo[];
34
41
  //# sourceMappingURL=todos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../todos.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,YAAY;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE;AAE/G,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAcD,wBAAgB,QAAQ,IAAI,SAAS,EAAE,CAAkB;AACzD,wBAAgB,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;AAC7D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAsDnC,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,CAG5D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAIvD;AAGD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE5C,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAE7C;AAUD;;eAEe;AACf,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAsB3E;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAa3F;AAED;yEACyE;AACzE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAapH;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,CAM5D"}
package/dist/todos.js CHANGED
@@ -3,36 +3,97 @@
3
3
  * the dock panel can render it as a sibling of the assistant.
4
4
  *
5
5
  * Source of truth flow: the worker's `todo_write` tool call surfaces its args via
6
- * the `tool-call` event; AgentPanel applies them here. Other tool calls made
7
- * while a task is `in_progress` are bucketed under it as "activity", so expanding
8
- * a node shows what the agent actually did for that task. */
6
+ * the `tool-call` event; the RUNTIME applies them here (tools-web/runtime.ts's
7
+ * onEvent -- the one choke point every surface passes through). Other tool calls
8
+ * made while a task is `in_progress` are bucketed under it as "activity", so
9
+ * expanding a node shows what the agent actually did for that task.
10
+ *
11
+ * KEYED BY SESSION. This was one module-level list until it wasn't: every chat
12
+ * on the page shared it, so opening a second conversation showed you the first
13
+ * one's plan, and the only way out was the Clear button. Two separate
14
+ * workarounds existed for that single defect -- the runtime cleared the list
15
+ * whenever it made a new chat, and AgentPanel cleared it again whenever the
16
+ * session changed -- and both are deleted by this file being keyed instead.
17
+ * A task list belongs to the conversation that wrote it.
18
+ */
9
19
  import { useSyncExternalStore } from 'react';
10
- const LS = 'prompd.web.todos.v1';
20
+ /* v2 because the shape changed from one list to a per-session map. A v1 list
21
+ * is deliberately NOT migrated: it is the shared leftover this change exists
22
+ * to abolish, it belongs to no identifiable conversation, and adopting it into
23
+ * whichever session happens to load first would reproduce exactly the bug --
24
+ * someone else's plan appearing in your chat -- one last time. It is scratch
25
+ * the agent rewrites on its next todo_write, so dropping it costs one call. */
26
+ const LS = 'prompd.web.todos.v2';
27
+ const LEGACY_LS = 'prompd.web.todos.v1';
28
+ /** How many conversations keep a task list. One list per session kept forever
29
+ * is a localStorage leak that grows with every chat ever opened; the
30
+ * least-recently-written session is dropped instead. Same reasoning (and the
31
+ * same number) as the tool loader's per-conversation cap. */
32
+ export const SESSION_TODO_CAP = 24;
33
+ /** A STABLE empty array. `useTodos` feeds useSyncExternalStore's getSnapshot,
34
+ * which compares by reference: returning a fresh `[]` for a session with no
35
+ * tasks would look like a new value on every render and loop forever. */
36
+ const EMPTY = Object.freeze([]);
11
37
  function load() {
12
38
  try {
13
- const r = localStorage.getItem(LS);
14
- const a = r ? JSON.parse(r) : [];
15
- return Array.isArray(a) ? a : [];
39
+ const raw = localStorage.getItem(LS);
40
+ if (!raw)
41
+ return new Map();
42
+ const parsed = JSON.parse(raw);
43
+ // Persisted as PAIRS, not an object, because insertion order is the LRU
44
+ // order and object key order is not guaranteed for every key shape.
45
+ if (!Array.isArray(parsed))
46
+ return new Map();
47
+ const out = new Map();
48
+ for (const entry of parsed) {
49
+ if (!Array.isArray(entry) || entry.length !== 2)
50
+ continue;
51
+ const [id, list] = entry;
52
+ if (typeof id !== 'string' || !Array.isArray(list))
53
+ continue;
54
+ out.set(id, list);
55
+ }
56
+ return out;
16
57
  }
17
58
  catch {
18
- return [];
59
+ return new Map();
19
60
  }
20
61
  }
21
62
  function persist() {
22
63
  try {
23
- localStorage.setItem(LS, JSON.stringify(todos));
64
+ localStorage.setItem(LS, JSON.stringify([...store.entries()]));
65
+ // The shared list this file replaces. Removed on the first write rather
66
+ // than read, so it cannot come back after a reload.
67
+ localStorage.removeItem(LEGACY_LS);
24
68
  }
25
69
  catch { /* ignore quota */ }
26
70
  }
27
- let todos = load();
71
+ let store = load();
28
72
  const subs = new Set();
29
73
  const emit = () => { persist(); for (const s of subs)
30
74
  s(); };
31
- export function getTodos() { return todos; }
32
- export function clearTodos() { if (todos.length) {
33
- todos = [];
75
+ /** Move `session` to the most-recent end and evict past the cap. */
76
+ function touch(session, list) {
77
+ store.delete(session);
78
+ store.set(session, list);
79
+ while (store.size > SESSION_TODO_CAP) {
80
+ const eldest = store.keys().next();
81
+ if (eldest.done)
82
+ break;
83
+ store.delete(eldest.value);
84
+ }
85
+ }
86
+ export function getTodos(session) {
87
+ if (!session)
88
+ return EMPTY;
89
+ return store.get(session) ?? EMPTY;
90
+ }
91
+ export function clearTodos(session) {
92
+ if (!session || !store.has(session))
93
+ return;
94
+ store.delete(session);
34
95
  emit();
35
- } }
96
+ }
36
97
  const VIEW_LS = 'prompd.web.todoView';
37
98
  export function getTodoView() {
38
99
  try {
@@ -59,15 +120,18 @@ function normalizeStatus(s) {
59
120
  return 'blocked';
60
121
  return 'pending';
61
122
  }
62
- /** Replace the list from a todo_write tool call. Activity accumulated for a task
63
- * (matched by id) is preserved across rewrites. */
64
- export function applyTodoWrite(input) {
123
+ /** Replace one session's list from a todo_write tool call. Activity accumulated
124
+ * for a task (matched by id, within that same session) is preserved across
125
+ * rewrites. */
126
+ export function applyTodoWrite(session, input) {
127
+ if (!session)
128
+ return;
65
129
  const raw = (input && typeof input === 'object' && Array.isArray(input.todos))
66
130
  ? input.todos
67
131
  : Array.isArray(input) ? input : [];
68
- const prev = new Map(todos.map((t) => [t.id, t]));
69
- todos = raw
70
- .filter((t) => t && t.title)
132
+ const prev = new Map(getTodos(session).map((t) => [t.id, t]));
133
+ const next = raw
134
+ .filter((t) => !!t && typeof t === 'object' && !!t.title)
71
135
  .map((t, i) => {
72
136
  const id = String(t.id ?? `todo-${i + 1}`);
73
137
  return {
@@ -80,33 +144,49 @@ export function applyTodoWrite(input) {
80
144
  activity: prev.get(id)?.activity ?? [],
81
145
  };
82
146
  });
147
+ touch(session, next);
83
148
  emit();
84
149
  }
85
- /** Record a tool call under the active (in_progress) task. */
86
- export function addActivity(activityId, label) {
150
+ /** Record a tool call under the active (in_progress) task of `session`. */
151
+ export function addActivity(session, activityId, label) {
152
+ if (!session)
153
+ return;
154
+ const list = store.get(session);
155
+ if (!list)
156
+ return;
87
157
  let done = false;
88
- todos = todos.map((t) => {
158
+ const next = list.map((t) => {
89
159
  if (done || t.status !== 'in_progress')
90
160
  return t;
91
161
  done = true;
92
162
  return { ...t, activity: [...t.activity, { id: activityId, label }] };
93
163
  });
94
- if (done)
95
- emit();
164
+ if (!done)
165
+ return;
166
+ store.set(session, next);
167
+ emit();
96
168
  }
97
- /** Resolve a recorded tool call (its result arrived). */
98
- export function resolveActivity(activityId, isError, detail) {
169
+ /** Resolve a recorded tool call (its result arrived) in `session`. A call id is
170
+ * only unique WITHIN a run, so this must never reach across sessions. */
171
+ export function resolveActivity(session, activityId, isError, detail) {
172
+ if (!session)
173
+ return;
174
+ const list = store.get(session);
175
+ if (!list)
176
+ return;
99
177
  let changed = false;
100
- todos = todos.map((t) => {
178
+ const next = list.map((t) => {
101
179
  if (!t.activity.some((a) => a.id === activityId))
102
180
  return t;
103
181
  changed = true;
104
182
  return { ...t, activity: t.activity.map((a) => (a.id === activityId ? { ...a, isError, detail, done: true } : a)) };
105
183
  });
106
- if (changed)
107
- emit();
184
+ if (!changed)
185
+ return;
186
+ store.set(session, next);
187
+ emit();
108
188
  }
109
- export function useTodos() {
110
- return useSyncExternalStore((cb) => { subs.add(cb); return () => { subs.delete(cb); }; }, getTodos, getTodos);
189
+ export function useTodos(session) {
190
+ return useSyncExternalStore((cb) => { subs.add(cb); return () => { subs.delete(cb); }; }, () => getTodos(session), () => getTodos(session));
111
191
  }
112
192
  //# sourceMappingURL=todos.js.map
package/dist/todos.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"todos.js","sourceRoot":"","sources":["../todos.ts"],"names":[],"mappings":"AAAA;;;;;;;6DAO6D;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAmB7C,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,SAAS,IAAI;IACX,IAAI,CAAC;QAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AACtI,CAAC;AACD,SAAS,OAAO;IACd,IAAI,CAAC;QAAC,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACvF,CAAC;AAED,IAAI,KAAK,GAAgB,IAAI,EAAE,CAAC;AAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAc,CAAC;AACnC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,IA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GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5D,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EACvB,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CACxB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/harness",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "description": "Corenel — host-agnostic agent harness (kernel). The app resolves it via the `corenel` path alias (bypasses these exports entirely); vitest aliases it to source too. Everything else — node consumers like @corenel/cli, @corenel/term, @corenel/sidecar — resolves it through this workspace package via the exports map below, which points at dist/ unconditionally (not just at publish) so in-repo and published resolution are identical: a bundle that treats @corenel/harness as external (see packages/term/build.mjs) must see the SAME module instance node sees when it later resolves this package at runtime, and plain node cannot execute the raw .ts sources at all. Run `pnpm build` here (or let a dependent's prebuild do it) before relying on this package outside the app/vitest. NOTE: @xyflow/react and dagre are NOT dependencies here at all — this package has no .tsx files and imports neither. `react` IS a real (small) runtime dependency: `todos.ts` uses `useSyncExternalStore`. It is declared below as an OPTIONAL peer, not a hard dependency, so node-only consumers (cli/term/sidecar) aren't forced to install react; node consumers hoist it today only because something else in the tree happens to pull it in. Do not add @xyflow/react or dagre as dependencies/peers without testing a packed install end to end — an earlier attempt at that (before this package had any .tsx files) failed npm's peer resolution with ERESOLVE.",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "openai": "^4.77.0",
31
31
  "yaml": "^2.8.3",
32
- "@corenel/protocol": "0.7.1"
32
+ "@corenel/protocol": "0.7.2"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0 || ^19.0.0"