ai-foreman 1.7.8 → 1.7.9
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/README.md +1 -11
- package/dist/activity.js +2 -2
- package/dist/adapters/claude.d.ts +13 -29
- package/dist/adapters/claude.js +76 -334
- package/dist/adapters/codex.d.ts +13 -18
- package/dist/adapters/codex.js +103 -195
- package/dist/adapters/recovering.d.ts +5 -6
- package/dist/adapters/recovering.js +5 -9
- package/dist/adapters/types.d.ts +24 -66
- package/dist/branch/currentGuard.d.ts +5 -5
- package/dist/branch/currentGuard.js +4 -6
- package/dist/branch/runner.d.ts +2 -0
- package/dist/branch/runner.js +2 -1
- package/dist/cli/start.js +90 -165
- package/dist/continuity.d.ts +6 -8
- package/dist/continuity.js +26 -72
- package/dist/foreman.d.ts +7 -1
- package/dist/foreman.js +25 -1
- package/dist/handoffs.js +3 -223
- package/dist/qaReview.d.ts +2 -0
- package/dist/qaReview.js +1 -4
- package/dist/sessionLifecycle.d.ts +19 -108
- package/dist/sessionLifecycle.js +310 -1024
- package/dist/statusReporter.d.ts +5 -27
- package/dist/statusReporter.js +20 -76
- package/dist/workflowDb.d.ts +10 -47
- package/dist/workflowDb.js +41 -146
- package/package.json +4 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ConfigurableAgentRole, ContextSample, ProviderSessionRefV1, ResolvedAgentSettings, SessionAvailabilityV1, SessionStrategy, WorkflowIssue } from "rafi-spec";
|
|
2
|
-
import type { BuilderAdapter,
|
|
3
|
-
import { type ThresholdLifecycleState } from "./workflowDb.js";
|
|
2
|
+
import type { BuilderAdapter, ContextUsage } from "./adapters/types.js";
|
|
4
3
|
export interface SessionTransition {
|
|
5
|
-
kind: "initial" | "
|
|
4
|
+
kind: "initial" | "compacted" | "fresh" | "missing" | "compaction-retry" | "compaction-fallback" | "settings-attempt" | "settings-continued" | "settings-fallback";
|
|
6
5
|
role: ConfigurableAgentRole;
|
|
7
6
|
workSession: number;
|
|
8
7
|
sessionId?: string;
|
|
@@ -49,10 +48,9 @@ export declare class RoleSessionController {
|
|
|
49
48
|
*/
|
|
50
49
|
static managed(options: ThresholdCompactionOptions): RoleSessionController;
|
|
51
50
|
atSafeBoundary(adapter: BuilderAdapter, frozenAction: string): Promise<ContextBoundaryResult>;
|
|
52
|
-
/** Return the stable role facade whose sendTurn() contains the lifecycle gate. */
|
|
53
|
-
manage(adapter: BuilderAdapter): ManagedRoleAdapter;
|
|
54
|
-
contextSnapshot(): ManagedContextSnapshot | undefined;
|
|
55
51
|
atWorkSessionBoundary(adapter: BuilderAdapter, frozenAction: string, strategy?: SessionStrategy): Promise<ContextBoundaryResult>;
|
|
52
|
+
/** Record provider-native automatic compaction immediately after a role turn. */
|
|
53
|
+
observeNativeCompactions(adapter: BuilderAdapter): Promise<number | undefined>;
|
|
56
54
|
effectiveSettings(): ResolvedAgentSettings;
|
|
57
55
|
effectiveThreshold(): number;
|
|
58
56
|
next(durableHandoff: string, nextSettings?: ResolvedAgentSettings): Promise<SessionBoundary>;
|
|
@@ -103,10 +101,6 @@ export interface ThresholdCompactionOptions {
|
|
|
103
101
|
}) => void;
|
|
104
102
|
contextRetries?: number;
|
|
105
103
|
historicalCountUncertain?: boolean;
|
|
106
|
-
/** Production Builder/QA runs require native prepare/update/interrupt support. */
|
|
107
|
-
requireNativeContextManagement?: boolean;
|
|
108
|
-
/** Dedicated live-settings watcher interval. */
|
|
109
|
-
settingsPollMs?: number;
|
|
110
104
|
now?: () => Date;
|
|
111
105
|
}
|
|
112
106
|
export interface ContextBoundaryResult {
|
|
@@ -116,115 +110,32 @@ export interface ContextBoundaryResult {
|
|
|
116
110
|
effectiveThreshold: number;
|
|
117
111
|
compactionCount: number;
|
|
118
112
|
}
|
|
119
|
-
|
|
120
|
-
role: "builder" | "qa";
|
|
121
|
-
provider: "claude" | "codex";
|
|
122
|
-
model: string;
|
|
123
|
-
lifecycleState: ThresholdLifecycleState;
|
|
124
|
-
contextSample: ContextSample;
|
|
125
|
-
configuredCeilingPercent: number;
|
|
126
|
-
installedNativeTokenLimit?: number;
|
|
127
|
-
installedNativePercent?: number;
|
|
128
|
-
compactionCount: number;
|
|
129
|
-
compactMaximum: number;
|
|
130
|
-
settingsRevision: number;
|
|
131
|
-
}
|
|
132
|
-
/** Stable facade: every Builder/QA provider turn enters the coordinator here. */
|
|
133
|
-
export declare class ManagedRoleAdapter implements BuilderAdapter {
|
|
134
|
-
readonly coordinator: ThresholdCompactionController;
|
|
135
|
-
private adapter;
|
|
136
|
-
private readonly queue;
|
|
137
|
-
private eventPump?;
|
|
138
|
-
private processing;
|
|
139
|
-
private closed;
|
|
140
|
-
private activeSessionKeyValue?;
|
|
141
|
-
constructor(coordinator: ThresholdCompactionController, adapter: BuilderAdapter);
|
|
142
|
-
get agent(): "claude" | "codex";
|
|
143
|
-
sendTurn(text: string): Promise<TurnResult>;
|
|
144
|
-
sessionId(): string | undefined;
|
|
145
|
-
sessionRef(): ProviderSessionRefV1 | undefined;
|
|
146
|
-
adoptSessionRef(ref: ProviderSessionRefV1): void;
|
|
147
|
-
validateSession(): Promise<SessionAvailabilityV1>;
|
|
148
|
-
compact(): Promise<CompactResult>;
|
|
149
|
-
prepareContextManagement(policy: ContextManagementPolicy): Promise<PreparedContextManagement>;
|
|
150
|
-
updateContextManagement(policy: ContextManagementPolicy): Promise<PreparedContextManagement>;
|
|
151
|
-
interruptTurnAtCompactionBoundary(providerEventId?: string): Promise<InterruptResult>;
|
|
152
|
-
contextUsage(): Promise<ContextUsage | undefined>;
|
|
153
|
-
sessionUsage(): Promise<ProviderSessionUsage | undefined>;
|
|
154
|
-
switchSettings(settings: ProviderSettingSwitch): Promise<CompactResult>;
|
|
155
|
-
events(): AsyncIterable<BuilderEvent>;
|
|
156
|
-
underlying(): BuilderAdapter;
|
|
157
|
-
noteActiveSession(key: string): string | undefined;
|
|
158
|
-
activeSessionKey(): string | undefined;
|
|
159
|
-
isClosed(): boolean;
|
|
160
|
-
replace(adapter: BuilderAdapter): void;
|
|
161
|
-
settleEvents(): Promise<void>;
|
|
162
|
-
close(): Promise<void>;
|
|
163
|
-
private pump;
|
|
164
|
-
private attachDispatcher;
|
|
165
|
-
}
|
|
166
|
-
/** Per-scoped-session context state machine and the sole occupancy sample store. */
|
|
113
|
+
/** Threshold-triggered native compaction at host-owned safe boundaries. */
|
|
167
114
|
export declare class ThresholdCompactionController {
|
|
168
115
|
private readonly options;
|
|
169
116
|
private settings;
|
|
117
|
+
private armed;
|
|
118
|
+
private crossing;
|
|
119
|
+
private readonly seenSessions;
|
|
120
|
+
private runOnlyThreshold?;
|
|
121
|
+
private bootstrapScheduled;
|
|
122
|
+
private bootstrapRecoveryDepth;
|
|
170
123
|
private historicalCountUncertain;
|
|
171
|
-
|
|
172
|
-
private readonly states;
|
|
173
|
-
private readonly nativeAttempts;
|
|
174
|
-
private readonly observedCompactionPhases;
|
|
175
|
-
private readonly settingsWatchers;
|
|
176
|
-
private active?;
|
|
177
|
-
private provisional;
|
|
178
|
-
private refreshingSettings?;
|
|
179
|
-
private dispatchDepth;
|
|
180
|
-
constructor(options: ThresholdCompactionOptions & {
|
|
181
|
-
requireNativeContextManagement?: boolean;
|
|
182
|
-
settingsPollMs?: number;
|
|
183
|
-
});
|
|
184
|
-
manage(adapter: BuilderAdapter): ManagedRoleAdapter;
|
|
124
|
+
constructor(options: ThresholdCompactionOptions);
|
|
185
125
|
atSafeBoundary(adapter: BuilderAdapter, frozenAction: string): Promise<ContextBoundaryResult>;
|
|
126
|
+
/** Apply the configured ordinary work-session boundary without bypassing handoff or compaction accounting. */
|
|
186
127
|
atWorkSessionBoundary(adapter: BuilderAdapter, frozenAction: string, strategy?: SessionStrategy): Promise<ContextBoundaryResult>;
|
|
187
128
|
effectiveSettings(): ResolvedAgentSettings;
|
|
188
129
|
effectiveThreshold(): number;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
/** Same gate for continuity repair, recursive continuation, and runtime retry. */
|
|
193
|
-
dispatchFollowup(managed: ManagedRoleAdapter, frozenAction: string, invoke: () => Promise<TurnResult>): Promise<TurnResult>;
|
|
194
|
-
compactExplicit(managed: ManagedRoleAdapter): Promise<CompactResult>;
|
|
195
|
-
unregister(managed: ManagedRoleAdapter): void;
|
|
196
|
-
observe(managed: ManagedRoleAdapter, source: BuilderAdapter, event: BuilderEvent): Promise<void>;
|
|
197
|
-
private ensureInitialized;
|
|
198
|
-
private installNative;
|
|
199
|
-
private recoverOrCreateState;
|
|
200
|
-
private reconcileIncompleteCompaction;
|
|
201
|
-
private stateFor;
|
|
202
|
-
private measureIntoState;
|
|
203
|
-
private recoverMeasurementFailure;
|
|
204
|
-
private acceptUsage;
|
|
205
|
-
private enforceThreshold;
|
|
206
|
-
private compactAndVerify;
|
|
130
|
+
/** Persist provider-triggered compactions at a host-owned boundary. */
|
|
131
|
+
observeNativeCompactions(adapter: BuilderAdapter, afterSample?: ContextSample): Promise<number | undefined>;
|
|
132
|
+
private compactSession;
|
|
207
133
|
private performHandoff;
|
|
208
|
-
private
|
|
209
|
-
private
|
|
210
|
-
private
|
|
211
|
-
private refreshSettings;
|
|
212
|
-
private ensureSettingsWatcher;
|
|
213
|
-
private beginGeneration;
|
|
214
|
-
private transition;
|
|
215
|
-
private persist;
|
|
216
|
-
private invalidateSample;
|
|
217
|
-
private measuringSample;
|
|
218
|
-
private result;
|
|
219
|
-
private markActive;
|
|
220
|
-
private providerSequence;
|
|
221
|
-
private recordCompactionSessionUnavailable;
|
|
222
|
-
private persistedMaximum;
|
|
134
|
+
private adoptSettings;
|
|
135
|
+
private measure;
|
|
136
|
+
private sampleFromUsage;
|
|
223
137
|
private compactionCount;
|
|
224
138
|
private handoffGeneration;
|
|
225
|
-
private generationId;
|
|
226
139
|
private threshold;
|
|
227
|
-
private maximum;
|
|
228
140
|
private now;
|
|
229
|
-
private capability;
|
|
230
141
|
}
|