@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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.flexharness.admission.d.ts +17 -0
- package/dist_ts/classes.flexharness.admission.js +263 -0
- package/dist_ts/classes.flexharness.callbacks.d.ts +38 -0
- package/dist_ts/classes.flexharness.callbacks.js +313 -0
- package/dist_ts/classes.flexharness.compaction.d.ts +25 -0
- package/dist_ts/classes.flexharness.compaction.js +87 -0
- package/dist_ts/classes.flexharness.configurations.d.ts +11 -0
- package/dist_ts/classes.flexharness.configurations.js +137 -0
- package/dist_ts/classes.flexharness.core.d.ts +143 -0
- package/dist_ts/classes.flexharness.core.js +1538 -0
- package/dist_ts/classes.flexharness.d.ts +2 -437
- package/dist_ts/classes.flexharness.deletion.d.ts +31 -0
- package/dist_ts/classes.flexharness.deletion.js +396 -0
- package/dist_ts/classes.flexharness.imports.d.ts +24 -0
- package/dist_ts/classes.flexharness.imports.js +345 -0
- package/dist_ts/classes.flexharness.js +119 -9776
- package/dist_ts/classes.flexharness.lifecycle.d.ts +47 -0
- package/dist_ts/classes.flexharness.lifecycle.js +625 -0
- package/dist_ts/classes.flexharness.permissions.d.ts +19 -0
- package/dist_ts/classes.flexharness.permissions.js +450 -0
- package/dist_ts/classes.flexharness.projects.d.ts +55 -0
- package/dist_ts/classes.flexharness.projects.js +575 -0
- package/dist_ts/classes.flexharness.prompts.d.ts +44 -0
- package/dist_ts/classes.flexharness.prompts.js +659 -0
- package/dist_ts/classes.flexharness.providers.d.ts +18 -0
- package/dist_ts/classes.flexharness.providers.js +267 -0
- package/dist_ts/classes.flexharness.results.d.ts +26 -0
- package/dist_ts/classes.flexharness.results.js +89 -0
- package/dist_ts/classes.flexharness.reversions.d.ts +52 -0
- package/dist_ts/classes.flexharness.reversions.js +1306 -0
- package/dist_ts/classes.flexharness.runs.d.ts +63 -0
- package/dist_ts/classes.flexharness.runs.js +1058 -0
- package/dist_ts/classes.flexharness.sessions.d.ts +20 -0
- package/dist_ts/classes.flexharness.sessions.js +381 -0
- package/dist_ts/classes.flexharness.slashcommands.d.ts +40 -0
- package/dist_ts/classes.flexharness.slashcommands.js +458 -0
- package/dist_ts/classes.flexharness.subagents.d.ts +31 -0
- package/dist_ts/classes.flexharness.subagents.js +690 -0
- package/dist_ts/classes.flexharness.tooldispatch.d.ts +53 -0
- package/dist_ts/classes.flexharness.tooldispatch.js +418 -0
- package/dist_ts/interfaces.flexharness.d.ts +455 -0
- package/dist_ts/interfaces.flexharness.js +2 -0
- package/dist_ts/utils.flexharness.d.ts +19 -0
- package/dist_ts/utils.flexharness.js +83 -0
- package/dist_ts_compaction/plugins.d.ts +2 -2
- package/dist_ts_compaction/plugins.js +3 -3
- package/dist_ts_compaction/smartagent.compaction.js +6 -5
- package/dist_ts_stores_nosqldb/classes.nosqldbstores.d.ts +9 -0
- package/dist_ts_stores_nosqldb/classes.nosqldbstores.js +13 -1
- package/dist_ts_stores_nosqldb/classes.recordstore.d.ts +2 -2
- package/dist_ts_stores_nosqldb/classes.recordstore.js +3 -3
- package/package.json +3 -3
- package/readme.md +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.flexharness.admission.ts +331 -0
- package/ts/classes.flexharness.callbacks.ts +352 -0
- package/ts/classes.flexharness.compaction.ts +167 -0
- package/ts/classes.flexharness.configurations.ts +167 -0
- package/ts/classes.flexharness.core.ts +1830 -0
- package/ts/classes.flexharness.deletion.ts +616 -0
- package/ts/classes.flexharness.imports.ts +414 -0
- package/ts/classes.flexharness.lifecycle.ts +786 -0
- package/ts/classes.flexharness.permissions.ts +535 -0
- package/ts/classes.flexharness.projects.ts +1006 -0
- package/ts/classes.flexharness.prompts.ts +857 -0
- package/ts/classes.flexharness.providers.ts +322 -0
- package/ts/classes.flexharness.results.ts +98 -0
- package/ts/classes.flexharness.reversions.ts +1684 -0
- package/ts/classes.flexharness.runs.ts +1204 -0
- package/ts/classes.flexharness.sessions.ts +483 -0
- package/ts/classes.flexharness.slashcommands.ts +705 -0
- package/ts/classes.flexharness.subagents.ts +860 -0
- package/ts/classes.flexharness.tooldispatch.ts +475 -0
- package/ts/classes.flexharness.ts +147 -12567
- package/ts/interfaces.flexharness.ts +517 -0
- package/ts/readme.md +1 -1
- package/ts/utils.flexharness.ts +121 -0
- package/ts_compaction/plugins.ts +2 -2
- package/ts_compaction/smartagent.compaction.ts +5 -4
- package/ts_stores_nosqldb/classes.nosqldbstores.ts +13 -0
- package/ts_stores_nosqldb/classes.recordstore.ts +5 -5
- package/ts_stores_nosqldb/readme.md +7 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import { FlexHarnessAbortError } from './errors.js';
|
|
3
|
+
import type { IFlexAgentSessionPolicy, IFlexCallbackLimits, IFlexHarnessOptions, IFlexHarnessStores, IFlexMessage, IFlexPartSnapshotEvent, IFlexPromptQueueLimits, IFlexProjectionSnapshotCurrent, IFlexReversionLimits, IFlexResolvedScope, IFlexSession, IFlexSessionImportLimits, IFlexSubagentDefinition, IFlexToolCatalogOptions, IJsonObject, TFlexExternalErrorSource, TFlexHarnessEventListener, TFlexMessagePart, TFlexProjectionSnapshot, TFlexReversionPolicy } from './interfaces.js';
|
|
4
|
+
import { type INormalizedBuiltInTools, type TRegisteredSlashCommand } from './utils.harnessoptions.js';
|
|
5
|
+
import type { TCanonicalOutcome, IStoredSessionState, IStorageState, IActiveRun, IScopeAdmissionState, IFlexMessageCursor, TEventDetails } from './interfaces.flexharness.js';
|
|
6
|
+
import { FlexHarnessResults } from './classes.flexharness.results.js';
|
|
7
|
+
import { FlexHarnessToolDispatch } from './classes.flexharness.tooldispatch.js';
|
|
8
|
+
import { FlexHarnessToolProviders } from './classes.flexharness.providers.js';
|
|
9
|
+
import { FlexHarnessCompaction } from './classes.flexharness.compaction.js';
|
|
10
|
+
import { FlexHarnessSessionConfigurations } from './classes.flexharness.configurations.js';
|
|
11
|
+
import { FlexHarnessPermissions } from './classes.flexharness.permissions.js';
|
|
12
|
+
import { FlexHarnessRunCallbacks } from './classes.flexharness.callbacks.js';
|
|
13
|
+
import { FlexHarnessDelegatedRunAdmission } from './classes.flexharness.admission.js';
|
|
14
|
+
import { FlexHarnessProjectManagement } from './classes.flexharness.projects.js';
|
|
15
|
+
import { FlexHarnessSessionImports } from './classes.flexharness.imports.js';
|
|
16
|
+
import { FlexHarnessSlashCommands } from './classes.flexharness.slashcommands.js';
|
|
17
|
+
import { FlexHarnessSubagents } from './classes.flexharness.subagents.js';
|
|
18
|
+
import { FlexHarnessPromptQueue } from './classes.flexharness.prompts.js';
|
|
19
|
+
import { FlexHarnessReversions } from './classes.flexharness.reversions.js';
|
|
20
|
+
import { FlexHarnessSessionDeletion } from './classes.flexharness.deletion.js';
|
|
21
|
+
import { FlexHarnessLifecycle } from './classes.flexharness.lifecycle.js';
|
|
22
|
+
import { FlexHarnessRuns } from './classes.flexharness.runs.js';
|
|
23
|
+
import { FlexHarnessSessions } from './classes.flexharness.sessions.js';
|
|
24
|
+
/**
|
|
25
|
+
* The engine behind {@link FlexHarness}: its options, scope state, events and error projection, and
|
|
26
|
+
* the services that implement its API.
|
|
27
|
+
*/
|
|
28
|
+
export declare class FlexHarnessCore<TScope> {
|
|
29
|
+
readonly scopeResolver: IFlexHarnessOptions<TScope>['scopeResolver'];
|
|
30
|
+
readonly modelResolver: IFlexHarnessOptions<TScope>['modelResolver'];
|
|
31
|
+
readonly sessionConfigurationResolver: IFlexHarnessOptions<TScope>['sessionConfigurationResolver'];
|
|
32
|
+
readonly toolProvider: IFlexHarnessOptions<TScope>['toolProvider'];
|
|
33
|
+
readonly resourceToolProviderResolver: IFlexHarnessOptions<TScope>['resourceToolProviderResolver'];
|
|
34
|
+
private readonly executionContextProvider;
|
|
35
|
+
readonly delegatedRunAdmissionProvider: IFlexHarnessOptions<TScope>['delegatedRunAdmissionProvider'];
|
|
36
|
+
readonly stores: IFlexHarnessStores;
|
|
37
|
+
readonly agentSessionPolicy: IFlexAgentSessionPolicy<TScope>;
|
|
38
|
+
readonly toolOutputLimits: Required<NonNullable<IFlexHarnessOptions<TScope>['toolOutputLimits']>>;
|
|
39
|
+
readonly callbackLimits: Required<IFlexCallbackLimits>;
|
|
40
|
+
readonly promptQueueLimits: Required<IFlexPromptQueueLimits>;
|
|
41
|
+
readonly reversionLimits: Required<IFlexReversionLimits>;
|
|
42
|
+
readonly sessionImportLimits: Required<IFlexSessionImportLimits>;
|
|
43
|
+
readonly reversionMaintenanceTimeoutMs: number;
|
|
44
|
+
readonly turnReversionProvider: IFlexHarnessOptions<TScope>['turnReversionProvider'];
|
|
45
|
+
readonly reversionPolicy: TFlexReversionPolicy;
|
|
46
|
+
private readonly externalErrorProjector?;
|
|
47
|
+
readonly subagents: ReadonlyMap<string, Readonly<IFlexSubagentDefinition>>;
|
|
48
|
+
readonly builtInTools: INormalizedBuiltInTools;
|
|
49
|
+
readonly toolCatalogOptions: Readonly<IFlexToolCatalogOptions>;
|
|
50
|
+
readonly slashCommands: ReadonlyMap<string, TRegisteredSlashCommand<TScope>>;
|
|
51
|
+
readonly maxSubagentDepth: number;
|
|
52
|
+
readonly maxSubagentCallsPerRun: number;
|
|
53
|
+
readonly stateLoads: Map<string, Promise<IStorageState>>;
|
|
54
|
+
readonly scopeAdmissions: Map<string, IScopeAdmissionState>;
|
|
55
|
+
readonly listeners: Set<TFlexHarnessEventListener>;
|
|
56
|
+
readonly trustedInternalErrors: WeakSet<object>;
|
|
57
|
+
sequence: number;
|
|
58
|
+
closed: boolean;
|
|
59
|
+
readonly results: FlexHarnessResults<TScope>;
|
|
60
|
+
readonly toolDispatch: FlexHarnessToolDispatch<TScope>;
|
|
61
|
+
readonly providers: FlexHarnessToolProviders<TScope>;
|
|
62
|
+
readonly compaction: FlexHarnessCompaction<TScope>;
|
|
63
|
+
readonly configurations: FlexHarnessSessionConfigurations<TScope>;
|
|
64
|
+
readonly permissions: FlexHarnessPermissions<TScope>;
|
|
65
|
+
readonly callbacks: FlexHarnessRunCallbacks<TScope>;
|
|
66
|
+
readonly admission: FlexHarnessDelegatedRunAdmission<TScope>;
|
|
67
|
+
readonly projects: FlexHarnessProjectManagement<TScope>;
|
|
68
|
+
readonly imports: FlexHarnessSessionImports<TScope>;
|
|
69
|
+
readonly commands: FlexHarnessSlashCommands<TScope>;
|
|
70
|
+
readonly subagentTasks: FlexHarnessSubagents<TScope>;
|
|
71
|
+
readonly prompts: FlexHarnessPromptQueue<TScope>;
|
|
72
|
+
readonly reversions: FlexHarnessReversions<TScope>;
|
|
73
|
+
readonly deletion: FlexHarnessSessionDeletion<TScope>;
|
|
74
|
+
readonly lifecycle: FlexHarnessLifecycle<TScope>;
|
|
75
|
+
readonly runs: FlexHarnessRuns<TScope>;
|
|
76
|
+
readonly sessions: FlexHarnessSessions<TScope>;
|
|
77
|
+
constructor(options: IFlexHarnessOptions<TScope>);
|
|
78
|
+
/**
|
|
79
|
+
* Opens a section that changes what a view of the session shows and emits the events that
|
|
80
|
+
* describe the change. Closing is idempotent; close it once the events are emitted or the
|
|
81
|
+
* change is rolled back.
|
|
82
|
+
*/
|
|
83
|
+
openPublication(state: IStorageState, sessionId: string): () => void;
|
|
84
|
+
subscribe(listener: TFlexHarnessEventListener): () => void;
|
|
85
|
+
projectExternalError(run: IActiveRun, error: unknown, source: TFlexExternalErrorSource): Error;
|
|
86
|
+
projectOperationError(error: unknown, source: TFlexExternalErrorSource, scopeId: string, sessionId: string, runId: string): Error;
|
|
87
|
+
trustInternalError<TError extends Error>(error: TError): TError;
|
|
88
|
+
canonicalOutcomes(events: readonly plugins.TAgentEvent[]): Map<string, TCanonicalOutcome>;
|
|
89
|
+
durableCanonicalOutcomes(stored: IStoredSessionState): Promise<Map<string, TCanonicalOutcome>>;
|
|
90
|
+
private loadState;
|
|
91
|
+
createUninitializedStoredSession(session: IFlexSession, storageKey: string, compactorLifecycleController?: AbortController): IStoredSessionState;
|
|
92
|
+
loadSessionRuntime(state: IStorageState, metadata: IFlexSession, scopeId: string, scope: TScope, compactorLifecycleController?: AbortController, newSession?: boolean): Promise<IStoredSessionState>;
|
|
93
|
+
private repairLoadedSession;
|
|
94
|
+
private repairTerminal;
|
|
95
|
+
withScopeMutationOwnership<TValue>(state: IStorageState, operation: () => TValue | Promise<TValue>): Promise<TValue>;
|
|
96
|
+
mutateScope<TValue>(state: IStorageState, mutation: () => TValue, allowDuringDrain?: boolean): Promise<TValue>;
|
|
97
|
+
mutateScopeOwned<TValue>(state: IStorageState, mutation: () => TValue): Promise<TValue>;
|
|
98
|
+
mutateProjection<TValue>(state: IStorageState, stored: IStoredSessionState, mutation: () => TValue, _allowDuringDrain?: boolean): Promise<TValue>;
|
|
99
|
+
private createScopeSnapshot;
|
|
100
|
+
private createProjectionSnapshot;
|
|
101
|
+
upgradeProjectionSnapshot(projection: TFlexProjectionSnapshot): IFlexProjectionSnapshotCurrent;
|
|
102
|
+
reconcileProjectionFromStore(stored: IStoredSessionState): Promise<void>;
|
|
103
|
+
sessionsAreDependencyRelated(state: IStorageState, leftSessionId: string, rightSessionId: string): boolean;
|
|
104
|
+
isSessionAncestor(state: IStorageState, ancestorSessionId: string, descendantSessionId: string): boolean;
|
|
105
|
+
sessionAncestryDepth(state: IStorageState, sessionId: string): number;
|
|
106
|
+
private sessionParentSessionId;
|
|
107
|
+
private sessionMetadata;
|
|
108
|
+
appendUnexpectedErrors(target: unknown[], error: unknown): void;
|
|
109
|
+
resolveState(scopeId: string): Promise<{
|
|
110
|
+
scope: IFlexResolvedScope<TScope>;
|
|
111
|
+
state: IStorageState;
|
|
112
|
+
}>;
|
|
113
|
+
getScopeAdmission(scopeId: string): IScopeAdmissionState;
|
|
114
|
+
pruneScopeAdmission(scopeId: string, admission: IScopeAdmissionState): void;
|
|
115
|
+
createScopeRetirementError(): FlexHarnessAbortError;
|
|
116
|
+
assertStateAcceptingWork(state: IStorageState): void;
|
|
117
|
+
requireSession(state: IStorageState, sessionId: string): IStoredSessionState;
|
|
118
|
+
visibleMessages(stored: IStoredSessionState): IFlexMessage[];
|
|
119
|
+
requireMutableSession(state: IStorageState, sessionId: string): IStoredSessionState;
|
|
120
|
+
/** Refuses an operation that would change an imported session's history or model context. */
|
|
121
|
+
assertSessionWritable(stored: IStoredSessionState): void;
|
|
122
|
+
/** An imported session never ran here, so it has no hidden stage and no reversion state. */
|
|
123
|
+
private assertImportedSessionState;
|
|
124
|
+
requireMessage(stored: IStoredSessionState, messageId: string): IFlexMessage;
|
|
125
|
+
isTombstoned(run: IActiveRun): boolean;
|
|
126
|
+
emitPartEvent(run: IActiveRun, type: IFlexPartSnapshotEvent['type'], part: TFlexMessagePart): void;
|
|
127
|
+
emitPartDeltaEvent(run: IActiveRun, part: Extract<TFlexMessagePart, {
|
|
128
|
+
type: 'text' | 'reasoning';
|
|
129
|
+
}>, delta: string, accounting: {
|
|
130
|
+
baseTextUtf8Bytes: number;
|
|
131
|
+
textUtf8Bytes: number;
|
|
132
|
+
}): void;
|
|
133
|
+
private partEventCoordinates;
|
|
134
|
+
emitEvent(scopeId: string, sourceSession: IFlexSession, details: TEventDetails): void;
|
|
135
|
+
validateRuntimeEvent(event: unknown): asserts event is IJsonObject & {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
boundedIdentifier(value: string, name: string): string;
|
|
139
|
+
messageCursorNamespace(storageKey: string): string;
|
|
140
|
+
createMessageCursor(namespace: string, sessionId: string, anchorMessageId: string): string;
|
|
141
|
+
parseMessageCursor(cursor: string): IFlexMessageCursor;
|
|
142
|
+
assertOpen(): void;
|
|
143
|
+
}
|