@modelprofile.com/flexharness 18.1.0 → 18.2.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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.flexharness.cachewarm.js +3 -3
- package/dist_ts/classes.flexharness.callbacks.d.ts +37 -0
- package/dist_ts/classes.flexharness.callbacks.js +129 -2
- package/dist_ts/classes.flexharness.compaction.js +2 -2
- package/dist_ts/classes.flexharness.configurations.js +4 -4
- package/dist_ts/classes.flexharness.core.d.ts +39 -4
- package/dist_ts/classes.flexharness.core.js +467 -134
- package/dist_ts/classes.flexharness.d.ts +4 -0
- package/dist_ts/classes.flexharness.deletion.d.ts +13 -0
- package/dist_ts/classes.flexharness.deletion.js +122 -40
- package/dist_ts/classes.flexharness.imports.js +26 -21
- package/dist_ts/classes.flexharness.js +9 -1
- package/dist_ts/classes.flexharness.lifecycle.js +9 -3
- package/dist_ts/classes.flexharness.projects.js +2 -2
- package/dist_ts/classes.flexharness.prompts.js +14 -8
- package/dist_ts/classes.flexharness.reversions.js +3 -3
- package/dist_ts/classes.flexharness.runs.js +18 -2
- package/dist_ts/classes.flexharness.sessions.d.ts +1 -1
- package/dist_ts/classes.flexharness.sessions.js +18 -18
- package/dist_ts/classes.flexharness.slashcommands.js +3 -3
- package/dist_ts/classes.flexharness.subagents.js +37 -16
- package/dist_ts/classes.flexharness.tooldispatch.js +3 -3
- package/dist_ts/classes.scoperecovery.d.ts +36 -0
- package/dist_ts/classes.scoperecovery.js +228 -0
- package/dist_ts/classes.stores.d.ts +14 -1
- package/dist_ts/classes.stores.js +150 -17
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +2 -1
- package/dist_ts/interfaces.d.ts +84 -0
- package/dist_ts/interfaces.flexharness.d.ts +36 -0
- package/dist_ts/interfaces.js +1 -1
- package/dist_ts/utils.harnessoptions.d.ts +2 -0
- package/dist_ts/utils.harnessoptions.js +16 -11
- package/dist_ts_stores_nosqldb/classes.nosqldbstores.d.ts +3 -2
- package/dist_ts_stores_nosqldb/classes.nosqldbstores.js +33 -2
- package/dist_ts_stores_nosqldb/classes.recordstore.d.ts +10 -1
- package/dist_ts_stores_nosqldb/classes.recordstore.js +75 -7
- package/package.json +3 -3
- package/readme.md +42 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.flexharness.cachewarm.ts +2 -2
- package/ts/classes.flexharness.callbacks.ts +142 -1
- package/ts/classes.flexharness.compaction.ts +1 -1
- package/ts/classes.flexharness.configurations.ts +3 -3
- package/ts/classes.flexharness.core.ts +463 -133
- package/ts/classes.flexharness.deletion.ts +161 -52
- package/ts/classes.flexharness.imports.ts +26 -21
- package/ts/classes.flexharness.lifecycle.ts +8 -2
- package/ts/classes.flexharness.projects.ts +1 -1
- package/ts/classes.flexharness.prompts.ts +11 -7
- package/ts/classes.flexharness.reversions.ts +2 -2
- package/ts/classes.flexharness.runs.ts +16 -1
- package/ts/classes.flexharness.sessions.ts +17 -17
- package/ts/classes.flexharness.slashcommands.ts +2 -2
- package/ts/classes.flexharness.subagents.ts +40 -15
- package/ts/classes.flexharness.tooldispatch.ts +2 -2
- package/ts/classes.flexharness.ts +13 -0
- package/ts/classes.scoperecovery.ts +290 -0
- package/ts/classes.stores.ts +150 -16
- package/ts/index.ts +2 -0
- package/ts/interfaces.flexharness.ts +38 -0
- package/ts/interfaces.ts +89 -0
- package/ts/readme.md +42 -4
- package/ts/utils.harnessoptions.ts +18 -12
- package/ts_stores_nosqldb/classes.nosqldbstores.ts +52 -2
- package/ts_stores_nosqldb/classes.recordstore.ts +78 -8
- package/ts_stores_nosqldb/readme.md +10 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import { FlexHarnessAbortError } from './errors.js';
|
|
3
|
-
import type { IFlexAgentSessionPolicy, IFlexCallbackLimits, IFlexHarnessOptions, IFlexHarnessStores, IFlexMessage, IFlexPartSnapshotEvent, IFlexPromptQueueLimits, IFlexProjectionSnapshotCurrent, IFlexReversionLimits, IFlexResolvedScope, IFlexResultLimits, IFlexSession, IFlexSessionImportLimits, IFlexSubagentDefinition, IFlexToolCatalogOptions, IJsonObject, TFlexExternalErrorSource, TFlexHarnessEventListener, TFlexMessagePart, TFlexProjectionSnapshot, TFlexReversionPolicy } from './interfaces.js';
|
|
3
|
+
import type { IFlexAgentSessionPolicy, IFlexCacheWarmClock, IFlexCallbackLimits, IFlexHarnessOptions, IFlexHarnessStores, IFlexMessage, IFlexPartSnapshotEvent, IFlexPromptQueueLimits, IFlexProjectionSnapshotCurrent, IFlexReversionLimits, IFlexResolvedScope, IFlexResultLimits, IFlexSession, IFlexSessionImportLimits, IFlexSubagentDefinition, IFlexToolCatalogOptions, IJsonObject, TFlexExternalErrorSource, TFlexHarnessEventListener, TFlexMessagePart, TFlexProjectionSnapshot, TFlexReversionPolicy } from './interfaces.js';
|
|
4
4
|
import { FlexCodeSandbox } from './classes.codesandbox.js';
|
|
5
5
|
import { type INormalizedBuiltInTools, type INormalizedCacheWarmOptions, type TRegisteredSlashCommand } from './utils.harnessoptions.js';
|
|
6
|
-
import type { TCanonicalOutcome, IStoredSessionState, IStorageState, IActiveRun, IScopeAdmissionState, IFlexMessageCursor, IScopeLoadPass, TEventDetails } from './interfaces.flexharness.js';
|
|
6
|
+
import type { TCanonicalOutcome, IStoredSessionState, IStorageState, IActiveRun, IScopeAdmissionState, IFlexMessageCursor, IScopeLoadPass, TEventDetails, TProjectionSaved } from './interfaces.flexharness.js';
|
|
7
7
|
import { FlexHarnessResults } from './classes.flexharness.results.js';
|
|
8
8
|
import { FlexHarnessToolDispatch } from './classes.flexharness.tooldispatch.js';
|
|
9
9
|
import { FlexHarnessToolProviders } from './classes.flexharness.providers.js';
|
|
@@ -39,6 +39,8 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
39
39
|
/** The URL protocols, colon included, of the attachment references prompts may carry. */
|
|
40
40
|
readonly attachmentReferenceProtocols: ReadonlySet<string>;
|
|
41
41
|
readonly stores: IFlexHarnessStores;
|
|
42
|
+
readonly sessionLoading: 'eager' | 'session-local';
|
|
43
|
+
private readonly legacyQualifications;
|
|
42
44
|
readonly agentSessionPolicy: IFlexAgentSessionPolicy<TScope>;
|
|
43
45
|
readonly toolOutputLimits: Required<NonNullable<IFlexHarnessOptions<TScope>['toolOutputLimits']>>;
|
|
44
46
|
readonly callbackLimits: Required<IFlexCallbackLimits>;
|
|
@@ -54,6 +56,8 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
54
56
|
readonly subagents: ReadonlyMap<string, Readonly<IFlexSubagentDefinition>>;
|
|
55
57
|
readonly builtInTools: INormalizedBuiltInTools;
|
|
56
58
|
readonly cacheWarmOptions: INormalizedCacheWarmOptions;
|
|
59
|
+
/** The clock of running turns' projection checkpoints: their spacing and save timings. */
|
|
60
|
+
readonly checkpointClock: IFlexCacheWarmClock;
|
|
57
61
|
readonly toolCatalogOptions: Readonly<IFlexToolCatalogOptions>;
|
|
58
62
|
readonly slashCommands: ReadonlyMap<string, TRegisteredSlashCommand<TScope>>;
|
|
59
63
|
readonly maxSubagentDepth: number;
|
|
@@ -111,6 +115,23 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
111
115
|
/** Reports a scope load to the scope load observer, which can neither delay nor fail it. */
|
|
112
116
|
private observeScopeLoad;
|
|
113
117
|
private loadStateSliced;
|
|
118
|
+
/** Enumerates metadata/proof only; explicit prepareScope owns startup recovery. */
|
|
119
|
+
getScopeCatalogue(scopeId: string): Promise<import('./interfaces.js').IFlexScopeCatalogue>;
|
|
120
|
+
prepareScope(scopeId: string, options?: import('./interfaces.js').IFlexPrepareScopeOptions): Promise<import('./interfaces.js').IFlexScopeCatalogue>;
|
|
121
|
+
hydrateSession(state: IStorageState, sessionId: string, scopeId: string, scope: TScope): Promise<IStoredSessionState>;
|
|
122
|
+
/** Retries ownerless shared-workspace obligations, never an active run's normal capture. */
|
|
123
|
+
private recoverSharedState;
|
|
124
|
+
hydrateAllSessions(state: IStorageState, scopeId: string, scope: TScope): Promise<void>;
|
|
125
|
+
private saveScopeSnapshot;
|
|
126
|
+
/** Registers before the projection's pending intent can reach any workspace provider. */
|
|
127
|
+
updateRecoveryObligation(state: IStorageState, stored: IStoredSessionState, registerOnly?: boolean): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Brings a session's recovery obligation up to date after an outcome is already recorded: a
|
|
130
|
+
* finished prompt or run, a saved projection. Its failure never changes that outcome. The
|
|
131
|
+
* durable obligation stays as it was, which the next load repairs, and the namespace is fenced
|
|
132
|
+
* through its drain instead of throwing into the caller.
|
|
133
|
+
*/
|
|
134
|
+
settleRecoveryObligation(state: IStorageState, stored: IStoredSessionState): Promise<void>;
|
|
114
135
|
createUninitializedStoredSession(session: IFlexSession, storageKey: string, compactorLifecycleController?: AbortController): IStoredSessionState;
|
|
115
136
|
loadSessionRuntime(state: IStorageState, metadata: IFlexSession, scopeId: string, scope: TScope, compactorLifecycleController?: AbortController, newSession?: boolean, pass?: IScopeLoadPass): Promise<IStoredSessionState>;
|
|
116
137
|
/**
|
|
@@ -171,7 +192,19 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
171
192
|
mutateScopeOwned<TValue>(state: IStorageState, mutation: () => TValue, onlySessionId?: string): Promise<TValue>;
|
|
172
193
|
/** Holds a mutation declared for one session to that session: no other session, tombstone or cleanup changed. */
|
|
173
194
|
private assertOnlySessionChanged;
|
|
174
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Changes `stored`'s projection in its FIFO and saves it. `onSaved` gets the checkpoint clock's
|
|
197
|
+
* times the save started and completed, right after it completed.
|
|
198
|
+
*/
|
|
199
|
+
mutateProjection<TValue>(state: IStorageState, stored: IStoredSessionState, mutation: () => TValue, _allowDuringDrain?: boolean, onSaved?: TProjectionSaved): Promise<TValue>;
|
|
200
|
+
/**
|
|
201
|
+
* A running turn's projection checkpoint, at its turn in the projection FIFO: `prepare` decides
|
|
202
|
+
* there what to save and returns the mutation, or nothing, which saves nothing. Resolves whether
|
|
203
|
+
* it saved.
|
|
204
|
+
*/
|
|
205
|
+
checkpointProjection(state: IStorageState, stored: IStoredSessionState, prepare: () => (() => void) | undefined, onSaved: TProjectionSaved): Promise<boolean>;
|
|
206
|
+
private enqueueProjectionOperation;
|
|
207
|
+
private saveProjectionMutation;
|
|
175
208
|
private createScopeSnapshot;
|
|
176
209
|
private createProjectionSnapshot;
|
|
177
210
|
/** The change from the lists the store holds to the session's projection at `revision`. */
|
|
@@ -186,7 +219,7 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
186
219
|
private sessionParentSessionId;
|
|
187
220
|
private sessionMetadata;
|
|
188
221
|
appendUnexpectedErrors(target: unknown[], error: unknown): void;
|
|
189
|
-
resolveState(scopeId: string): Promise<{
|
|
222
|
+
resolveState(scopeId: string, sessionId?: string): Promise<{
|
|
190
223
|
scope: IFlexResolvedScope<TScope>;
|
|
191
224
|
state: IStorageState;
|
|
192
225
|
}>;
|
|
@@ -234,6 +267,8 @@ export declare class FlexHarnessCore<TScope> {
|
|
|
234
267
|
* one id each; a position is searched again only after it moved (a steer, a restored or
|
|
235
268
|
* reloaded projection).
|
|
236
269
|
*/
|
|
270
|
+
/** The run's remembered positions, its assistant message's checked; -1 when it is not projected. */
|
|
271
|
+
assistantMessagePositions(run: IActiveRun): NonNullable<IActiveRun['partEventPositions']>;
|
|
237
272
|
private partEventCoordinates;
|
|
238
273
|
emitEvent(scopeId: string, sourceSession: IFlexSession, details: TEventDetails): void;
|
|
239
274
|
validateRuntimeEvent(event: unknown): asserts event is IJsonObject & {
|