sidekick-shared 0.29.0 → 0.30.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 +48 -0
- package/README.md +198 -56
- package/dist/aggregation/EventAggregator.d.ts +96 -2
- package/dist/aggregation/EventAggregator.js +535 -42
- package/dist/aggregation/snapshot.d.ts +37 -8
- package/dist/aggregation/snapshot.js +31 -9
- package/dist/aggregation/types.d.ts +38 -1
- package/dist/browser.d.ts +9 -1
- package/dist/browser.js +29 -3
- package/dist/context/sessionContext.js +8 -0
- package/dist/esm/aggregation/EventAggregator.js +535 -42
- package/dist/esm/aggregation/snapshot.js +31 -9
- package/dist/esm/browser.js +3 -0
- package/dist/esm/context/sessionContext.js +8 -0
- package/dist/esm/fileContinuity.js +149 -0
- package/dist/esm/formatters/toolSummary.js +4 -1
- package/dist/esm/index.js +7 -2
- package/dist/esm/modelCatalog.js +5 -4
- package/dist/esm/modelContext.js +4 -3
- package/dist/esm/modelInfo.js +4 -3
- package/dist/esm/node.js +3 -1
- package/dist/esm/observedContextWindows.js +2 -1
- package/dist/esm/ownKey.js +26 -0
- package/dist/esm/parsers/codexParser.js +372 -7
- package/dist/esm/parsers/openCodeParser.js +2 -1
- package/dist/esm/parsers/subagentEndState.js +61 -0
- package/dist/esm/parsers/subagentScanner.js +37 -12
- package/dist/esm/parsers/subagentTraceParser.js +103 -37
- package/dist/esm/pricingCatalog.js +3 -2
- package/dist/esm/promptHistory.js +22 -11
- package/dist/esm/providers/claudeCode.js +60 -29
- package/dist/esm/providers/codex.js +235 -201
- package/dist/esm/providers/codexCompressedReader.js +184 -0
- package/dist/esm/providers/codexDatabase.js +47 -2
- package/dist/esm/providers/codexRollouts.js +20 -2
- package/dist/esm/providers/codexSubagents.js +456 -0
- package/dist/esm/providers/compressedRollouts.js +330 -0
- package/dist/esm/providers/factory.js +4 -1
- package/dist/esm/providers/rolloutWalker.js +32 -4
- package/dist/esm/schemas/sessionEvent.js +63 -14
- package/dist/esm/sessionMonitor.js +7 -1
- package/dist/esm/sessionPreviews.js +9 -0
- package/dist/esm/sessionPromptHistory.js +5 -3
- package/dist/esm/subagentActivity.js +125 -0
- package/dist/esm/subagentDisplayState.js +81 -0
- package/dist/esm/subagentSpawn.js +363 -0
- package/dist/esm/testing/codexSubagentFixtures.js +336 -0
- package/dist/esm/toolCallOrigins.js +17 -10
- package/dist/esm/toolCategory.js +6 -2
- package/dist/esm/transcript.js +8 -0
- package/dist/esm/turns/assistantTurn.js +6 -2
- package/dist/esm/usage/claudeUsageDedupe.js +68 -0
- package/dist/esm/usage/usageEvents.js +4 -1
- package/dist/esm/watchers/eventBridge.js +45 -0
- package/dist/esm/watchers/factory.js +5 -3
- package/dist/esm/watchers/jsonlTail.js +82 -48
- package/dist/esm/watchers/jsonlWatcher.js +61 -4
- package/dist/esm/watchers/providerReaderWatcher.js +18 -4
- package/dist/esm/zaiQuota.js +2 -1
- package/dist/fileContinuity.d.ts +95 -0
- package/dist/fileContinuity.js +187 -0
- package/dist/formatters/toolSummary.js +4 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.js +48 -10
- package/dist/modelCatalog.js +5 -4
- package/dist/modelContext.js +4 -3
- package/dist/modelInfo.js +4 -3
- package/dist/node.d.ts +5 -1
- package/dist/node.js +18 -2
- package/dist/observedContextWindows.js +2 -1
- package/dist/ownKey.d.ts +16 -0
- package/dist/ownKey.js +30 -0
- package/dist/parsers/codexParser.d.ts +107 -0
- package/dist/parsers/codexParser.js +373 -7
- package/dist/parsers/openCodeParser.js +2 -1
- package/dist/parsers/subagentEndState.d.ts +20 -0
- package/dist/parsers/subagentEndState.js +65 -0
- package/dist/parsers/subagentScanner.d.ts +19 -6
- package/dist/parsers/subagentScanner.js +37 -12
- package/dist/parsers/subagentTraceParser.d.ts +33 -5
- package/dist/parsers/subagentTraceParser.js +103 -37
- package/dist/pricingCatalog.js +3 -2
- package/dist/promptHistory.d.ts +13 -3
- package/dist/promptHistory.js +22 -11
- package/dist/providers/claudeCode.js +59 -28
- package/dist/providers/codex.d.ts +35 -5
- package/dist/providers/codex.js +232 -198
- package/dist/providers/codexCompressedReader.d.ts +58 -0
- package/dist/providers/codexCompressedReader.js +221 -0
- package/dist/providers/codexDatabase.d.ts +25 -0
- package/dist/providers/codexDatabase.js +48 -2
- package/dist/providers/codexRollouts.d.ts +16 -2
- package/dist/providers/codexRollouts.js +20 -2
- package/dist/providers/codexSubagents.d.ts +66 -0
- package/dist/providers/codexSubagents.js +495 -0
- package/dist/providers/compressedRollouts.d.ts +114 -0
- package/dist/providers/compressedRollouts.js +380 -0
- package/dist/providers/factory.d.ts +5 -0
- package/dist/providers/factory.js +4 -1
- package/dist/providers/rolloutWalker.d.ts +15 -2
- package/dist/providers/rolloutWalker.js +33 -4
- package/dist/providers/types.d.ts +36 -1
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/sessionEvent.d.ts +51 -10
- package/dist/schemas/sessionEvent.js +63 -14
- package/dist/sessionMonitor.d.ts +6 -0
- package/dist/sessionMonitor.js +7 -1
- package/dist/sessionPreviews.js +9 -0
- package/dist/sessionPromptHistory.d.ts +5 -0
- package/dist/sessionPromptHistory.js +5 -36
- package/dist/subagentActivity.d.ts +91 -0
- package/dist/subagentActivity.js +132 -0
- package/dist/subagentDisplayState.d.ts +81 -0
- package/dist/subagentDisplayState.js +86 -0
- package/dist/subagentSpawn.d.ts +175 -0
- package/dist/subagentSpawn.js +385 -0
- package/dist/testing/codexSubagentFixtures.d.ts +48 -0
- package/dist/testing/codexSubagentFixtures.js +344 -0
- package/dist/toolCallOrigins.d.ts +5 -0
- package/dist/toolCallOrigins.js +17 -10
- package/dist/toolCategory.js +6 -2
- package/dist/transcript.js +8 -0
- package/dist/turns/assistantTurn.d.ts +4 -0
- package/dist/turns/assistantTurn.js +6 -2
- package/dist/types/codex.d.ts +71 -2
- package/dist/types/sessionEvent.d.ts +38 -3
- package/dist/usage/claudeUsageDedupe.d.ts +31 -0
- package/dist/usage/claudeUsageDedupe.js +68 -0
- package/dist/usage/usageEvents.d.ts +4 -1
- package/dist/usage/usageEvents.js +4 -1
- package/dist/watchers/eventBridge.js +45 -0
- package/dist/watchers/factory.d.ts +6 -0
- package/dist/watchers/factory.js +5 -3
- package/dist/watchers/jsonlTail.d.ts +27 -4
- package/dist/watchers/jsonlTail.js +84 -48
- package/dist/watchers/jsonlWatcher.d.ts +22 -1
- package/dist/watchers/jsonlWatcher.js +60 -3
- package/dist/watchers/providerReaderWatcher.d.ts +7 -0
- package/dist/watchers/providerReaderWatcher.js +18 -4
- package/dist/watchers/types.d.ts +12 -0
- package/dist/zaiQuota.js +2 -1
- package/package.json +1 -1
|
@@ -13,8 +13,12 @@ import type { EventAggregatorOptions, AggregatedTokens, ModelUsageStats, BurnRat
|
|
|
13
13
|
import type { SerializedFrequencyState } from './FrequencyTracker';
|
|
14
14
|
import type { SerializedHeatmapState } from './HeatmapTracker';
|
|
15
15
|
import type { SerializedPatternState } from './PatternExtractor';
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Schema version for serialized snapshots. v6: token totals count each Claude
|
|
18
|
+
* response and Codex call once. v7: subagent lifecycles track Codex spawns and
|
|
19
|
+
* record what settled a background agent (`settledBy`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const SNAPSHOT_SCHEMA_VERSION = 7;
|
|
18
22
|
/**
|
|
19
23
|
* JSON-serializable snapshot of EventAggregator state.
|
|
20
24
|
* Used by session snapshot sidecar files for fast resume.
|
|
@@ -83,6 +87,21 @@ export interface SerializedAggregatorState {
|
|
|
83
87
|
patternState?: SerializedPatternState;
|
|
84
88
|
heatmapState?: SerializedHeatmapState;
|
|
85
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Host-supplied evidence about how a subagent ended, for
|
|
92
|
+
* {@link EventAggregator.applySubagentEvidence}: Claude Code's
|
|
93
|
+
* `agent-<id>.meta.json` flags, matched by agent id or spawning tool_use id.
|
|
94
|
+
*/
|
|
95
|
+
export interface SubagentEvidence {
|
|
96
|
+
/** The agent id (Claude Code's `agent-<id>` name, or a Codex child thread id). */
|
|
97
|
+
agentId?: string;
|
|
98
|
+
/** The spawning tool_use id (meta `toolUseId`). */
|
|
99
|
+
toolUseId?: string;
|
|
100
|
+
/** Meta `finished`: the background agent is done. `false` reopens an agent `meta` settled. */
|
|
101
|
+
finished?: boolean;
|
|
102
|
+
/** Meta `stoppedByUser`: the user stopped the agent. */
|
|
103
|
+
stoppedByUser?: boolean;
|
|
104
|
+
}
|
|
86
105
|
/**
|
|
87
106
|
* Parses dependency references from a todo item's content text.
|
|
88
107
|
*
|
|
@@ -139,6 +158,8 @@ export declare class EventAggregator {
|
|
|
139
158
|
private activeTaskId;
|
|
140
159
|
private subagents;
|
|
141
160
|
private pendingSubagents;
|
|
161
|
+
/** Codex `spawn_agent` calls still waiting for their result (always a background launch). */
|
|
162
|
+
private pendingCodexSpawns;
|
|
142
163
|
private planExtractor;
|
|
143
164
|
private planState;
|
|
144
165
|
private planEnteredAt;
|
|
@@ -173,6 +194,8 @@ export declare class EventAggregator {
|
|
|
173
194
|
getBurnRate(): BurnRateInfo;
|
|
174
195
|
getTaskState(): TaskState;
|
|
175
196
|
getSubagents(): SubagentLifecycle[];
|
|
197
|
+
/** Timestamp of the last counted event (`getMetrics().lastEventTime`), without building the metrics. */
|
|
198
|
+
getLastEventTime(): string | null;
|
|
176
199
|
getPlan(): PlanState | null;
|
|
177
200
|
getContextAttribution(): ContextAttribution;
|
|
178
201
|
getTimeline(): TimelineEvent[];
|
|
@@ -226,7 +249,78 @@ export declare class EventAggregator {
|
|
|
226
249
|
private isGoalGateTask;
|
|
227
250
|
private extractSubagentFromEvent;
|
|
228
251
|
private extractSubagentFromFollowEvent;
|
|
252
|
+
private trackSubagentSpawn;
|
|
253
|
+
/**
|
|
254
|
+
* The spawning tool call's result. A foreground agent ends here; a
|
|
255
|
+
* background launch only reports the agent id (a Codex spawn, its agent
|
|
256
|
+
* path), and the agent keeps running until a notification or another
|
|
257
|
+
* record says it ended.
|
|
258
|
+
*/
|
|
259
|
+
private resolveSubagentResult;
|
|
260
|
+
private markBackgroundLaunch;
|
|
229
261
|
private completeSubagent;
|
|
262
|
+
private finishSubagent;
|
|
263
|
+
/** Puts a settled agent back to running (it resumed). */
|
|
264
|
+
private reopenSubagent;
|
|
265
|
+
/**
|
|
266
|
+
* Settles a lifecycle that is still running (and its task card). Agents
|
|
267
|
+
* already settled are left alone: a stop notice or status can name agents
|
|
268
|
+
* that finished earlier.
|
|
269
|
+
*/
|
|
270
|
+
private settleRunningSubagent;
|
|
271
|
+
/**
|
|
272
|
+
* Moves an agent's task card with its lifecycle: `null` back to in
|
|
273
|
+
* progress, a failure to deleted, any other outcome to completed.
|
|
274
|
+
*/
|
|
275
|
+
private settleAgentTask;
|
|
276
|
+
/**
|
|
277
|
+
* Applies a background task's notification to the subagent it reports on,
|
|
278
|
+
* matched by the spawning tool_use id (or by agent id when the notification
|
|
279
|
+
* has none). The latest notification wins: an interim one ("waiting on its
|
|
280
|
+
* own background work") keeps or puts the agent back to running, a final one
|
|
281
|
+
* completes it. Notifications for background shell tasks match nothing.
|
|
282
|
+
*/
|
|
283
|
+
private applyTaskNotification;
|
|
284
|
+
private findNotifiedSubagent;
|
|
285
|
+
/**
|
|
286
|
+
* Applies host evidence about a subagent (Claude Code's meta flags):
|
|
287
|
+
* `stoppedByUser` settles a running agent as `stopped`, `finished` as
|
|
288
|
+
* `completed` (`settledBy: 'meta'`). Agents already settled some other way
|
|
289
|
+
* keep their outcome; `finished: false` reopens an agent that only meta
|
|
290
|
+
* settled. Matches by `toolUseId`, then `agentId` (the newest such agent),
|
|
291
|
+
* and records the agent id when matched by tool_use id.
|
|
292
|
+
*
|
|
293
|
+
* @param timestamp ISO time to record as the completion (the agent's last
|
|
294
|
+
* activity, when the host knows it)
|
|
295
|
+
* @returns Whether a lifecycle changed
|
|
296
|
+
*/
|
|
297
|
+
applySubagentEvidence(evidence: SubagentEvidence, timestamp: string): boolean;
|
|
298
|
+
/** The newest lifecycle with this spawning tool_use id, else with this agent id. */
|
|
299
|
+
private findSubagent;
|
|
300
|
+
/** `agents_killed`: the user killed every running background agent. */
|
|
301
|
+
private applyAgentsKilled;
|
|
302
|
+
/**
|
|
303
|
+
* "N background agents were stopped by the user: "A", "B"": settles the
|
|
304
|
+
* running agents with those descriptions, the newest first for repeats.
|
|
305
|
+
*/
|
|
306
|
+
private applyAgentsStopped;
|
|
307
|
+
/** A background agent's final `task_status` attachment, matched by agent id. */
|
|
308
|
+
private applyTaskStatus;
|
|
309
|
+
/**
|
|
310
|
+
* A Codex subagent lifecycle record: `started` links the spawn to its child
|
|
311
|
+
* thread; `completed` (a child turn finished) and `final-answer` (the
|
|
312
|
+
* child's report, matched by its agent path) complete it; `interacted`
|
|
313
|
+
* after `followup_task` puts it back to running (a `send_message` does
|
|
314
|
+
* not: it does not start a turn); `interrupted` (`interrupt_agent`) settles
|
|
315
|
+
* it as `stopped`, since the child keeps its thread and a follow-up can
|
|
316
|
+
* run it again, like a user stop rather than a kill.
|
|
317
|
+
*/
|
|
318
|
+
private applySubagentActivity;
|
|
319
|
+
/** The newest lifecycle with this Codex agent path (with `runningFirst`, a running one first). */
|
|
320
|
+
private findSubagentByPath;
|
|
321
|
+
private applySubagentFollowRecord;
|
|
322
|
+
private addSubagentTimeline;
|
|
323
|
+
private addTaskNotificationTimeline;
|
|
230
324
|
private extractPlanFromSessionEvent;
|
|
231
325
|
private processPlanFollowEvent;
|
|
232
326
|
private convertExtractedPlanToPlanState;
|