@modelprofile.com/flexharness 10.23.0 → 10.24.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.
Files changed (83) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/classes.flexharness.admission.d.ts +17 -0
  3. package/dist_ts/classes.flexharness.admission.js +263 -0
  4. package/dist_ts/classes.flexharness.callbacks.d.ts +38 -0
  5. package/dist_ts/classes.flexharness.callbacks.js +313 -0
  6. package/dist_ts/classes.flexharness.compaction.d.ts +25 -0
  7. package/dist_ts/classes.flexharness.compaction.js +87 -0
  8. package/dist_ts/classes.flexharness.configurations.d.ts +11 -0
  9. package/dist_ts/classes.flexharness.configurations.js +137 -0
  10. package/dist_ts/classes.flexharness.core.d.ts +143 -0
  11. package/dist_ts/classes.flexharness.core.js +1538 -0
  12. package/dist_ts/classes.flexharness.d.ts +2 -437
  13. package/dist_ts/classes.flexharness.deletion.d.ts +31 -0
  14. package/dist_ts/classes.flexharness.deletion.js +396 -0
  15. package/dist_ts/classes.flexharness.imports.d.ts +24 -0
  16. package/dist_ts/classes.flexharness.imports.js +345 -0
  17. package/dist_ts/classes.flexharness.js +119 -9776
  18. package/dist_ts/classes.flexharness.lifecycle.d.ts +47 -0
  19. package/dist_ts/classes.flexharness.lifecycle.js +625 -0
  20. package/dist_ts/classes.flexharness.permissions.d.ts +19 -0
  21. package/dist_ts/classes.flexharness.permissions.js +450 -0
  22. package/dist_ts/classes.flexharness.projects.d.ts +55 -0
  23. package/dist_ts/classes.flexharness.projects.js +575 -0
  24. package/dist_ts/classes.flexharness.prompts.d.ts +44 -0
  25. package/dist_ts/classes.flexharness.prompts.js +659 -0
  26. package/dist_ts/classes.flexharness.providers.d.ts +18 -0
  27. package/dist_ts/classes.flexharness.providers.js +267 -0
  28. package/dist_ts/classes.flexharness.results.d.ts +26 -0
  29. package/dist_ts/classes.flexharness.results.js +89 -0
  30. package/dist_ts/classes.flexharness.reversions.d.ts +52 -0
  31. package/dist_ts/classes.flexharness.reversions.js +1306 -0
  32. package/dist_ts/classes.flexharness.runs.d.ts +63 -0
  33. package/dist_ts/classes.flexharness.runs.js +1058 -0
  34. package/dist_ts/classes.flexharness.sessions.d.ts +20 -0
  35. package/dist_ts/classes.flexharness.sessions.js +381 -0
  36. package/dist_ts/classes.flexharness.slashcommands.d.ts +40 -0
  37. package/dist_ts/classes.flexharness.slashcommands.js +458 -0
  38. package/dist_ts/classes.flexharness.subagents.d.ts +31 -0
  39. package/dist_ts/classes.flexharness.subagents.js +690 -0
  40. package/dist_ts/classes.flexharness.tooldispatch.d.ts +53 -0
  41. package/dist_ts/classes.flexharness.tooldispatch.js +418 -0
  42. package/dist_ts/interfaces.flexharness.d.ts +455 -0
  43. package/dist_ts/interfaces.flexharness.js +2 -0
  44. package/dist_ts/utils.flexharness.d.ts +19 -0
  45. package/dist_ts/utils.flexharness.js +83 -0
  46. package/dist_ts_compaction/plugins.d.ts +2 -2
  47. package/dist_ts_compaction/plugins.js +3 -3
  48. package/dist_ts_compaction/smartagent.compaction.js +6 -5
  49. package/dist_ts_stores_nosqldb/classes.nosqldbstores.d.ts +9 -0
  50. package/dist_ts_stores_nosqldb/classes.nosqldbstores.js +13 -1
  51. package/dist_ts_stores_nosqldb/classes.recordstore.d.ts +2 -2
  52. package/dist_ts_stores_nosqldb/classes.recordstore.js +3 -3
  53. package/package.json +3 -3
  54. package/readme.md +1 -1
  55. package/ts/00_commitinfo_data.ts +1 -1
  56. package/ts/classes.flexharness.admission.ts +331 -0
  57. package/ts/classes.flexharness.callbacks.ts +352 -0
  58. package/ts/classes.flexharness.compaction.ts +167 -0
  59. package/ts/classes.flexharness.configurations.ts +167 -0
  60. package/ts/classes.flexharness.core.ts +1830 -0
  61. package/ts/classes.flexharness.deletion.ts +616 -0
  62. package/ts/classes.flexharness.imports.ts +414 -0
  63. package/ts/classes.flexharness.lifecycle.ts +786 -0
  64. package/ts/classes.flexharness.permissions.ts +535 -0
  65. package/ts/classes.flexharness.projects.ts +1006 -0
  66. package/ts/classes.flexharness.prompts.ts +857 -0
  67. package/ts/classes.flexharness.providers.ts +322 -0
  68. package/ts/classes.flexharness.results.ts +98 -0
  69. package/ts/classes.flexharness.reversions.ts +1684 -0
  70. package/ts/classes.flexharness.runs.ts +1204 -0
  71. package/ts/classes.flexharness.sessions.ts +483 -0
  72. package/ts/classes.flexharness.slashcommands.ts +705 -0
  73. package/ts/classes.flexharness.subagents.ts +860 -0
  74. package/ts/classes.flexharness.tooldispatch.ts +475 -0
  75. package/ts/classes.flexharness.ts +147 -12567
  76. package/ts/interfaces.flexharness.ts +517 -0
  77. package/ts/readme.md +1 -1
  78. package/ts/utils.flexharness.ts +121 -0
  79. package/ts_compaction/plugins.ts +2 -2
  80. package/ts_compaction/smartagent.compaction.ts +5 -4
  81. package/ts_stores_nosqldb/classes.nosqldbstores.ts +13 -0
  82. package/ts_stores_nosqldb/classes.recordstore.ts +5 -5
  83. package/ts_stores_nosqldb/readme.md +7 -0
@@ -1,62 +1,7 @@
1
1
  import type { IFlexBackgroundExecution, IFlexBeginSessionImportOptions, IFlexCompactSessionOptions, IFlexCreateProjectTaskInput, IFlexCreateSessionOptions, IFlexDeleteSessionGenerationCohortInput, IFlexDeleteSessionGenerationCohortResult, IFlexEventArchiveMetadata, IFlexHarnessOptions, IFlexImportedRun, IFlexMessage, IFlexMessagePage, IFlexMessagePageOptions, IFlexPermissionRequest, IFlexProjectGoalResult, IFlexSteerAdmission, IFlexSteerInput, IFlexProjectScratchpadResult, IFlexProjectStateResult, IFlexProjectTaskResult, IFlexProjectTasksResult, IFlexPromptAdmission, IFlexPromptQueueAdmission, IFlexPromptQueueEntry, IFlexPromptOptions, IFlexPromptResult, IFlexRedoSessionResult, IFlexScheduledPromptAdmission, IFlexSchedulePromptOptions, IFlexSession, IFlexSessionView, IFlexSessionMetrics, IFlexSessionImportHandle, IFlexSessionImportProgress, IFlexSessionReversionInfo, IFlexSlashCommandDescriptor, IFlexSlashCommandExecutionOptions, IFlexUncertainToolExecution, IFlexUndoSessionResult, IFlexUpdateSessionOptions, IFlexUpdateProjectTaskInput, IJsonObject, TFlexBeginSessionImportResult, TFlexHarnessEventListener, TFlexPermissionDecision, TFlexPrompt, TFlexSlashCommandExecutionResult, TFlexToolExecutionReconciliation } from './interfaces.js';
2
- export declare function createFlexResourceToolNamespace(resourceId: string, attachmentRevision: number): string;
3
- export declare function createFlexResourceToolName(namespace: string, toolName: string): string;
2
+ export { createFlexResourceToolNamespace, createFlexResourceToolName, } from './utils.flexharness.js';
4
3
  export declare class FlexHarness<TScope = unknown> {
5
- private readonly scopeResolver;
6
- private readonly modelResolver;
7
- private readonly sessionConfigurationResolver;
8
- private readonly toolProvider;
9
- private readonly resourceToolProviderResolver;
10
- private readonly executionContextProvider;
11
- private readonly delegatedRunAdmissionProvider;
12
- private readonly stores;
13
- private readonly agentSessionPolicy;
14
- private readonly toolOutputLimits;
15
- private readonly callbackLimits;
16
- private readonly promptQueueLimits;
17
- private readonly reversionLimits;
18
- private readonly sessionImportLimits;
19
- private readonly reversionMaintenanceTimeoutMs;
20
- private readonly turnReversionProvider;
21
- private readonly reversionPolicy;
22
- private readonly externalErrorProjector?;
23
- private readonly subagents;
24
- private readonly builtInTools;
25
- private readonly toolCatalogOptions;
26
- private readonly slashCommands;
27
- private readonly maxSubagentDepth;
28
- private readonly maxSubagentCallsPerRun;
29
- private readonly stateLoads;
30
- private readonly sessionConfigurations;
31
- private readonly scopeAdmissions;
32
- private readonly scopeRetirements;
33
- private readonly storageDrains;
34
- private readonly storageCompactorLifecycleControllers;
35
- private orphanedResourceQueue;
36
- private readonly listeners;
37
- private readonly trustedInternalErrors;
38
- private readonly orphanedStoredSessions;
39
- private readonly orphanedExecutionContexts;
40
- private readonly orphanedProviderReleases;
41
- private readonly orphanedTombstoneCleanups;
42
- private readonly orphanedTombstoneOwners;
43
- private readonly pendingPromptAdmissionOwners;
44
- private readonly projectManagementQueues;
45
- /** A session's result writes, one at a time: they share the session's index of results. */
46
- private readonly resultQueues;
47
- private readonly activeSlashCommandExecutions;
48
- private readonly activeSlashCommandListings;
49
- private readonly stagedSessionImports;
50
- private readonly compactorInvocationContext;
51
- private readonly slashCommandInvocationContext;
52
- private readonly slashCommandActivityContext;
53
- private readonly deferredCompactorContexts;
54
- private sequence;
55
- private promptQueueSequence;
56
- private pendingPromptAdmissions;
57
- private pendingPromptAdmissionBytes;
58
- private closed;
59
- private disposePromise?;
4
+ private readonly core;
60
5
  constructor(options: IFlexHarnessOptions<TScope>);
61
6
  listSessions(scopeId: string): Promise<IFlexSession[]>;
62
7
  createSession(scopeId: string, options?: IFlexCreateSessionOptions): Promise<IFlexSession>;
@@ -95,47 +40,19 @@ export declare class FlexHarness<TScope = unknown> {
95
40
  clearProjectScratchpad(scopeId: string, sessionId: string): Promise<IFlexProjectScratchpadResult>;
96
41
  deleteSessionGenerationCohort(scopeId: string, input: IFlexDeleteSessionGenerationCohortInput): Promise<IFlexDeleteSessionGenerationCohortResult>;
97
42
  deleteSession(scopeId: string, sessionId: string): Promise<void>;
98
- private startSessionDeletion;
99
- private startReservedSessionDeletion;
100
- private registerSessionDeletion;
101
- private assertAuthorizedSessionGenerationCohort;
102
- private reserveLiveSessionDeletion;
103
- private deleteSessionInternal;
104
- private finishReservedSessionDeletion;
105
43
  /**
106
44
  * Reads the session's metadata, visible messages and pending permissions in one step, together
107
45
  * with the instance's event sequence they include. It waits until no queued projection or scope
108
46
  * write and no change that emits events for the session is in progress.
109
47
  */
110
48
  getSessionView(scopeId: string, sessionId: string): Promise<IFlexSessionView>;
111
- /**
112
- * Opens a section that changes what a view of the session shows and emits the events that
113
- * describe the change. Closing is idempotent; close it once the events are emitted or the
114
- * change is rolled back.
115
- */
116
- private openPublication;
117
49
  getMessages(scopeId: string, sessionId: string): Promise<IFlexMessage[]>;
118
50
  listMessagePage(scopeId: string, sessionId: string, options?: IFlexMessagePageOptions): Promise<IFlexMessagePage>;
119
51
  getMessage(scopeId: string, sessionId: string, messageId: string): Promise<IFlexMessage>;
120
- private resolveSessionConfiguration;
121
- private abortSessionConfigurations;
122
52
  listSlashCommands(scopeId: string, sessionId: string): Promise<IFlexSlashCommandDescriptor[]>;
123
- private createSlashCommandDescriptors;
124
53
  executeSlashCommand(scopeId: string, sessionId: string, untouchedInput: string, options?: IFlexSlashCommandExecutionOptions): Promise<TFlexSlashCommandExecutionResult>;
125
54
  /** Resolves the exact session configuration before looking up custom commands. */
126
55
  executeSessionSlashCommand(scopeId: string, sessionId: string, untouchedInput: string, options?: IFlexSlashCommandExecutionOptions): Promise<TFlexSlashCommandExecutionResult>;
127
- private executeSlashCommandInternal;
128
- private isSessionAvailableForSlashCommand;
129
- private slashCommandPromptUnavailableReason;
130
- private slashCommandPromptAvailability;
131
- private requireSlashCommandPromptAvailable;
132
- private promptAdmissionByteSize;
133
- private isSessionRuntimeIdle;
134
- private slashCommandSessionKey;
135
- private requireSessionAvailableForSlashCommand;
136
- private trackSlashCommandExecution;
137
- private trackSlashCommandListing;
138
- private executeSlashCommandHandler;
139
56
  prompt(scopeId: string, sessionId: string, prompt: TFlexPrompt, options?: IFlexPromptOptions): Promise<IFlexPromptResult>;
140
57
  startPrompt(scopeId: string, sessionId: string, prompt: TFlexPrompt, options?: IFlexPromptOptions): Promise<IFlexPromptAdmission>;
141
58
  enqueuePrompt(scopeId: string, sessionId: string, prompt: TFlexPrompt, options?: IFlexPromptOptions): Promise<IFlexPromptQueueAdmission>;
@@ -156,11 +73,6 @@ export declare class FlexHarness<TScope = unknown> {
156
73
  steerPrompt(scopeId: string, sessionId: string, queueId: string, steer: IFlexSteerInput): Promise<IFlexSteerAdmission>;
157
74
  /** Sends follow-up input only to an exact running direct child owned by this parent run. */
158
75
  sendSubagentInput(scopeId: string, parentSessionId: string, parentRunId: string, taskId: string, steer: IFlexSteerInput): Promise<IFlexSteerAdmission>;
159
- /** The shared synchronous admission point; neither entrypoint starts or resumes a run. */
160
- private admitRunSteer;
161
- private sendSubagentInputInRun;
162
- /** Fences live ownership by exact runtime pointers and admission seeds all the way to root. */
163
- private assertLiveSubagentOwnership;
164
76
  abort(scopeId: string, sessionId: string): Promise<boolean>;
165
77
  listPendingPermissions(scopeId: string, sessionId?: string): Promise<IFlexPermissionRequest[]>;
166
78
  respondToPermission(scopeId: string, sessionId: string, permissionId: string, decision: TFlexPermissionDecision): Promise<void>;
@@ -170,20 +82,8 @@ export declare class FlexHarness<TScope = unknown> {
170
82
  type: string;
171
83
  }): Promise<void>;
172
84
  compactSession(scopeId: string, sessionId: string, options?: IFlexCompactSessionOptions): Promise<void>;
173
- private compactStoredSession;
174
85
  undoSession(scopeId: string, sessionId: string, signal?: AbortSignal): Promise<IFlexUndoSessionResult>;
175
86
  redoSession(scopeId: string, sessionId: string, signal?: AbortSignal): Promise<IFlexRedoSessionResult>;
176
- private reversionUnit;
177
- private reversionGroups;
178
- private requireReversionIdle;
179
- private reversionUnavailableReason;
180
- private awaitReversionOperation;
181
- private changeReversionCursor;
182
- private changeReversionCursorResolved;
183
- private reconcileContextAvailability;
184
- private resumePendingApply;
185
- private persistKnownNotApplied;
186
- private recoverPendingCapture;
187
87
  archiveSessionEvents(scopeId: string, sessionId: string, compactionEventId?: string): Promise<IFlexEventArchiveMetadata | undefined>;
188
88
  listBackgroundExecutions(scopeId: string, sessionId: string): Promise<IFlexBackgroundExecution[]>;
189
89
  getBackgroundExecution(scopeId: string, sessionId: string, executionId: string): Promise<IFlexBackgroundExecution>;
@@ -191,339 +91,4 @@ export declare class FlexHarness<TScope = unknown> {
191
91
  subscribe(listener: TFlexHarnessEventListener): () => void;
192
92
  retireScope(scopeId: string): Promise<void>;
193
93
  dispose(): Promise<void>;
194
- private enqueuePromptInternal;
195
- private reservePendingPromptAdmission;
196
- private schedulePromptQueueDrain;
197
- private drainPromptQueue;
198
- private createActiveRun;
199
- private assertPromptPromotion;
200
- private assertDelegatedRunAdmissionOwnership;
201
- private acquireDelegatedRunAdmission;
202
- private normalizeDelegatedRunAdmissionLease;
203
- private requestDelegatedRunAdmissionClose;
204
- private startDelegatedRunAdmissionCloseAttempt;
205
- private closeRunDelegatedRunAdmission;
206
- private promoteQueuedPrompt;
207
- private projectPromptQueueEntry;
208
- private promptQueueEntry;
209
- private emitPromptQueueEvent;
210
- private finishQueuedPrompt;
211
- private cancelQueuedPrompt;
212
- private cancelStoredPromptQueue;
213
- private purgeStoredPromptQueue;
214
- /**
215
- * Holds the end of a run's generation until one more of its background subagents settles. The
216
- * subagent commits its result to the generation before it settles, so the model takes the result
217
- * in with another step instead of the run ending without it. The engine bounds the scoped
218
- * wait from its observed dispatch and commits timer check-ins. Returns at once when none runs.
219
- */
220
- private awaitNextBackgroundSubagent;
221
- private executeRun;
222
- private finishFailedRun;
223
- private requireProjectManagementTools;
224
- private projectManagementKey;
225
- private queueProjectManagementOperation;
226
- private awaitProjectManagementOperations;
227
- private resolveProjectManagementSession;
228
- private assertProjectManagementSession;
229
- private loadProjectManagementState;
230
- private readProjectManagementState;
231
- private mutateProjectManagementState;
232
- private projectStateResult;
233
- private createSubagentProvenance;
234
- private createProjectManagementSessionContext;
235
- private projectTaskResult;
236
- private projectTasksResult;
237
- private projectGoalResult;
238
- private projectScratchpadResult;
239
- private createProjectTaskInState;
240
- private updateProjectTaskInState;
241
- private deleteProjectTaskInState;
242
- private clearProjectTasksInState;
243
- private setProjectGoalInState;
244
- private clearProjectGoalInState;
245
- private setProjectScratchpadInState;
246
- private appendProjectScratchpadInState;
247
- private clearProjectScratchpadInState;
248
- private prepareGeneration;
249
- /**
250
- * The output the model gets: the output itself within the output budget, or, in a run with a
251
- * catalog whose stores keep results, a handle to the stored output with a summary of it.
252
- */
253
- private budgetOutput;
254
- private resultQueueKey;
255
- /** The JSON bytes of one `results.get` page: the output budget, less room for the page's fields. */
256
- private resultPageBytes;
257
- /** One page of a stored result of the run's session, or the error `results.get` reports. */
258
- private readResult;
259
- /**
260
- * Whether a call of the run's tools only reads: search_tools and describe_tools, an `execute` of
261
- * a method declared read-only, or a call the tool handle classifies as read-only by its real name.
262
- */
263
- private isReadOnlyToolCall;
264
- /** The method's path when the prepared call only reads, for the turn's reads. */
265
- private readOnlyMethod;
266
- /** A method whose `onCall` decides its calls is gated: its calls run in order, whatever they read. */
267
- private isReadOnlyCatalogCall;
268
- private classifyHostToolCall;
269
- /**
270
- * Runs the run's tools through the turn's reads: a read-only call identical to an earlier read of
271
- * the turn shares its output, and any other call clears them. Records the confirmation of each
272
- * call that started while the model still streamed, which the permission requests naming the
273
- * call wait for. The catalog's tools read and run their methods by real name themselves.
274
- */
275
- private trackToolCalls;
276
- /**
277
- * Answers a read-only call (`name` set) from an identical read earlier in the turn, sharing the
278
- * output of one still running, or runs it and keeps its output for the reads after it. A failed
279
- * read, and a read whose response was discarded, are not kept. Any other call clears the turn's
280
- * reads before it runs.
281
- */
282
- private readOnce;
283
- private enabledBuiltInToolNames;
284
- private assertNoBuiltInToolCollisions;
285
- /**
286
- * search_tools, describe_tools and execute. `execute` validates the call and runs the method
287
- * inside this tool call, so the tool wrapper bounds its output and projects its errors, and the
288
- * call's part, events and permission requests carry the method's path.
289
- */
290
- private createCatalogTools;
291
- /** A refused catalog call as the trusted error the model and the tool part show. */
292
- private catalogCallError;
293
- /**
294
- * Runs a `run_code` program. Every catalog call it makes is dispatched like an `execute`
295
- * (validation, `onCall`, the method's run with its permission requests, the output limits, error
296
- * projection) and recorded as a tool part of its own, named by the method, with the `run_code`
297
- * call as its parent. Proposals go to `onProposals` as one batch once the program finished; a
298
- * program that fails proposes nothing.
299
- */
300
- private runCatalogProgram;
301
- private createBuiltInTools;
302
- private createRenameSessionTool;
303
- private createProjectTaskTool;
304
- private createProjectGoalTool;
305
- private createProjectScratchpadTool;
306
- private projectManagementAgentWriteContext;
307
- private executeProjectTaskTool;
308
- private executeProjectGoalTool;
309
- private executeProjectScratchpadTool;
310
- private createProjectTaskId;
311
- private createSubagentTool;
312
- private executeSubagentTask;
313
- private createSubagentSendTool;
314
- private createSubagentResultTool;
315
- private createDelegatedRunAdmissionSeed;
316
- private acquireSubagentSession;
317
- private createSubagentSessionId;
318
- private updateSubagentToolPart;
319
- private abortExactRun;
320
- private createReservation;
321
- private userMessageParts;
322
- /**
323
- * Ends steering intake once the run's generation has settled and fixes what became of its
324
- * steers. A run that stays in the model context reports the steers its generation did not
325
- * record; a run that does not, because it failed, was stopped before any model output or its
326
- * outcome could not be established, reports every steer it accepted, since the model context
327
- * of later turns holds none of them. The bytes of the steers not taken in are released.
328
- */
329
- private closeRunSteering;
330
- /**
331
- * Projects a steer the run's generation took in as a user message of the run. The assistant
332
- * message that answered before it is completed and the run answers on in a new one; a steer
333
- * taken in before the run answered anything is placed before its still empty assistant message.
334
- */
335
- private applyRunSteer;
336
- private buildTerminal;
337
- private reversionId;
338
- private reversionProviderProtocolVersion;
339
- private reversionCaptureContext;
340
- private withReversionMaintenanceSignal;
341
- private inspectReversionCapture;
342
- private finalizeReversionCapture;
343
- private resolveReversionCaptureOutcome;
344
- private normalizeReversionReference;
345
- private normalizeReversionOutcome;
346
- private normalizeAffectedWorkspaces;
347
- private prepareRunReversion;
348
- private finalizeRunReversion;
349
- private applyFinalizedReversionOutcome;
350
- private hiddenReversionSegments;
351
- private enqueueReversionRelease;
352
- private enqueueReversionReleaseReference;
353
- private pruneReversionState;
354
- private commitRevertedBranch;
355
- private commitRevertedBranchState;
356
- private commitArchivedHiddenBranchState;
357
- private refreshAutomaticArchiveHorizon;
358
- private filterReversionContextEvents;
359
- private drainReversionReleases;
360
- private releaseDeletedSessionReversions;
361
- private promoteCompletedTerminal;
362
- private publishFailedTerminal;
363
- private replaceStagedTerminal;
364
- /**
365
- * Puts a run's terminal messages in place of their projected versions: its prompt, and its last
366
- * assistant message. The steers a run took in, and the assistant messages it completed before
367
- * them, stay where they are. A terminal message that is not projected yet is added: the prompt
368
- * before the run's other messages, the assistant message after them.
369
- */
370
- private replaceVisibleRun;
371
- private emitTerminalProjection;
372
- /**
373
- * Ends a run that fails without publishing a terminal projection, because its namespace was
374
- * fenced or retired or its durable outcome could not be established: listeners still receive
375
- * its terminal message events and its one `run.finished`. Nothing here is persisted; the next
376
- * load of the namespace repairs the stored projection from the canonical outcome.
377
- */
378
- private emitUnpublishedRunFinish;
379
- private emitFinalRunEvent;
380
- private onTextDelta;
381
- private onReasoningStart;
382
- private onReasoningDelta;
383
- private onReasoningEnd;
384
- private textAppendAccounting;
385
- private onToolStart;
386
- private onToolFinish;
387
- private onToolUpdate;
388
- private onRetry;
389
- /**
390
- * Emits the usage of every model call and adds reported usage to its run. A run executes a
391
- * transactional generation, and `AgentSession.generate()` settles a transactional generation only
392
- * after it has reported each of its model calls, also when it is aborted. `executeRun()` awaits
393
- * that settlement before it builds the terminal, so the run is still active for each of its
394
- * events: they all reach `run.usage` and precede its `run.finished`. The events bypass the
395
- * callback limits and a failed callback: their number is bounded by the run's model calls, and
396
- * the usage of a run that exhausted its callback budget or failed in a callback must not be lost.
397
- */
398
- private onModelCallUsage;
399
- private settleMetricsOperation;
400
- private callbackRun;
401
- private reserveCallbackCapacity;
402
- private failCallback;
403
- private requestPermission;
404
- private decideSessionPermissionPolicy;
405
- private applyPermissionResponse;
406
- private rollbackRememberedGrant;
407
- private reconcileRememberedPermissionRemoval;
408
- private rejectRunPermissions;
409
- private rejectPending;
410
- private forceRejectPending;
411
- private cancelRun;
412
- private abortRunInternally;
413
- private rollbackAdmission;
414
- private normalizeToolHandle;
415
- private provideRunToolHandle;
416
- private normalizeResourceToolProviderDescriptors;
417
- private closePartialToolHandle;
418
- private retainDetachedCleanup;
419
- private observeDetachedToolProvider;
420
- private trackDetachedCleanup;
421
- private runDetachedCleanup;
422
- private beginDetachedCleanupSettlement;
423
- private settleDetachedCleanups;
424
- private delegatedRunAdmissionOwnersForGeneration;
425
- private settleDelegatedRunAdmissionOwners;
426
- private projectExternalError;
427
- private projectOperationError;
428
- private trustInternalError;
429
- private canonicalOutcomes;
430
- private durableCanonicalOutcomes;
431
- private loadState;
432
- private createUninitializedStoredSession;
433
- private loadSessionRuntime;
434
- private repairLoadedSession;
435
- private repairTerminal;
436
- private withScopeMutationOwnership;
437
- private mutateScope;
438
- private mutateScopeOwned;
439
- private mutateProjection;
440
- private mutatePermissions;
441
- private createScopeSnapshot;
442
- private createProjectionSnapshot;
443
- private upgradeProjectionSnapshot;
444
- private reconcileProjectionFromStore;
445
- private cleanupSessionDomains;
446
- private tombstoneProjectManagementSession;
447
- private collectSessionSubtree;
448
- private tombstoneGroup;
449
- private tombstonesForRoots;
450
- private descendantTombstoneRoots;
451
- private orderTombstoneRootsChildFirst;
452
- private finishTombstoneCleanup;
453
- private finishTombstoneCleanupInternal;
454
- private fenceNamespace;
455
- private deferNamespaceDrain;
456
- private deferReversionReleaseDrain;
457
- private sessionsAreDependencyRelated;
458
- private isSessionAncestor;
459
- private sessionAncestryDepth;
460
- private sessionParentSessionId;
461
- private sessionMetadata;
462
- private closeStoredSession;
463
- private abortStoredSession;
464
- private storedSessionCleanupCompleted;
465
- private releasePartialProviderSession;
466
- private retainPartialProviderSession;
467
- private hasOrphanedSessionResources;
468
- private retainOrphanedTombstoneCleanup;
469
- private closeOrphanedResources;
470
- private closeOrphanedResourcesInternal;
471
- private orphanedResourceStorageKeys;
472
- private retireScopeInternal;
473
- private drainStorage;
474
- private drainStorageInternal;
475
- private disposeInternal;
476
- private abortSlashCommandExecutions;
477
- private abortSlashCommandListings;
478
- private appendUnexpectedErrors;
479
- private abortCompactorLifecycle;
480
- private resolveState;
481
- private getScopeAdmission;
482
- private pruneScopeAdmission;
483
- private createScopeRetirementError;
484
- private ambientSlashCommandOwner;
485
- private assertNoAmbientSlashCommandTeardown;
486
- private assertStateAcceptingWork;
487
- private createCompactorContext;
488
- /**
489
- * The model the compacted work was dispatched on: the resolved model of the run whose context
490
- * overflowed, or the model hint a manual compaction was requested with. Retention states none.
491
- */
492
- private compactionModel;
493
- private withCompactorContext;
494
- private createRunCompactorContext;
495
- private effectiveRunCompactorContext;
496
- private withRunCompactorContext;
497
- private requireSession;
498
- private completedReversionCandidates;
499
- private visibleMessages;
500
- private requireMutableSession;
501
- /** Refuses an operation that would change an imported session's history or model context. */
502
- private assertSessionWritable;
503
- /** An imported session never ran here, so it has no hidden stage and no reversion state. */
504
- private assertImportedSessionState;
505
- private assertNoCommittingSessionImport;
506
- private findStagedSessionImport;
507
- private requireStagedSessionImport;
508
- private armStagedImportIdleTimer;
509
- private clearStagedImportIdleTimer;
510
- private releaseStagedSessionImport;
511
- /**
512
- * An imported child session belongs to a committed imported parent whose run `parent.runId` holds
513
- * the tool call `parent.toolCallId` naming the child, and no other session claims that tool call.
514
- */
515
- private requireImportParent;
516
- private requireMessage;
517
- private isTombstoned;
518
- private emitPartEvent;
519
- private emitPartDeltaEvent;
520
- private partEventCoordinates;
521
- private emitEvent;
522
- private validateRuntimeEvent;
523
- private projectBackgroundExecution;
524
- private boundedIdentifier;
525
- private messageCursorNamespace;
526
- private createMessageCursor;
527
- private parseMessageCursor;
528
- private assertOpen;
529
94
  }
@@ -0,0 +1,31 @@
1
+ import type { IFlexDeleteSessionGenerationCohortInput, IFlexDeleteSessionGenerationCohortResult, IFlexSessionTombstone } from './interfaces.js';
2
+ import type { IStorageState } from './interfaces.flexharness.js';
3
+ import type { FlexHarnessCore } from './classes.flexharness.core.js';
4
+ /**
5
+ * Session deletion: reservations, subtree tombstones and the cleanup of every domain a session
6
+ * owns.
7
+ */
8
+ export declare class FlexHarnessSessionDeletion<TScope> {
9
+ private readonly core;
10
+ constructor(core: FlexHarnessCore<TScope>);
11
+ deleteSessionGenerationCohort(scopeId: string, input: IFlexDeleteSessionGenerationCohortInput): Promise<IFlexDeleteSessionGenerationCohortResult>;
12
+ deleteSession(scopeId: string, sessionId: string): Promise<void>;
13
+ private startSessionDeletion;
14
+ private startReservedSessionDeletion;
15
+ private registerSessionDeletion;
16
+ private assertAuthorizedSessionGenerationCohort;
17
+ private reserveLiveSessionDeletion;
18
+ deleteSessionInternal(state: IStorageState, scopeId: string, scope: TScope, sessionId: string): Promise<void>;
19
+ private finishReservedSessionDeletion;
20
+ cleanupSessionDomains(state: IStorageState, tombstone: IFlexSessionTombstone): Promise<void>;
21
+ private collectSessionSubtree;
22
+ tombstoneGroup(state: IStorageState, rootSessionId: string): IFlexSessionTombstone[];
23
+ private tombstonesForRoots;
24
+ descendantTombstoneRoots(state: IStorageState, ancestorSessionId: string): string[];
25
+ orderTombstoneRootsChildFirst(state: IStorageState, rootSessionIds: readonly string[]): string[];
26
+ finishTombstoneCleanup(state: IStorageState, rootSessionId: string, scopeId: string, invocation?: {
27
+ scopeId: string;
28
+ scope: TScope;
29
+ }): Promise<void>;
30
+ private finishTombstoneCleanupInternal;
31
+ }