ai-foreman 1.7.8 → 1.7.10
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 +15 -29
- package/dist/adapters/claude.js +90 -334
- package/dist/adapters/codex.d.ts +15 -18
- package/dist/adapters/codex.js +112 -195
- package/dist/adapters/recovering.d.ts +6 -6
- package/dist/adapters/recovering.js +6 -9
- package/dist/adapters/types.d.ts +37 -66
- package/dist/branch/currentGuard.d.ts +6 -5
- package/dist/branch/currentGuard.js +5 -6
- package/dist/branch/runner.d.ts +2 -0
- package/dist/branch/runner.js +2 -1
- package/dist/cli/start.js +95 -165
- package/dist/continuity.d.ts +7 -8
- package/dist/continuity.js +27 -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 +22 -108
- package/dist/sessionLifecycle.js +322 -1023
- package/dist/statusReporter.d.ts +6 -27
- package/dist/statusReporter.js +21 -76
- package/dist/workflowDb.d.ts +10 -47
- package/dist/workflowDb.js +41 -146
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -115,9 +115,7 @@ What each part does:
|
|
|
115
115
|
| `--branch-prefix <prefix>` | `feature` / `rafi` / another valid Git prefix | `feature` | Prefix for generated ticket branches. Explicit prefixes are preserved verbatim. |
|
|
116
116
|
| `--max-branch-depth <n>` | positive integer | `5` | Maximum selected branch/PR stack depth (root PR is depth 1). |
|
|
117
117
|
| `--show-session-cost` / `--hide-session-cost` | flags | saved role preferences | Show authoritative provider cost or trustworthy cumulative tokens for Builder and QA; does not change context occupancy display. |
|
|
118
|
-
| `--auto-compact-threshold <percent>` | integer `1`–`99` | saved Builder value, then `50` | Initial
|
|
119
|
-
|
|
120
|
-
Builder and QA context ceilings are configured independently (default `50%`, maximum `10` successful compactions per scoped provider session). Claude and Codex install the ceiling as a native in-turn auto-compaction limit before real work begins; Rafi verifies the post-compaction occupancy and counts provider-native and host-requested compactions together. An ineffective or failed compact receives one bounded retry, followed by a validated cumulative handoff. Status output reports the configured and installed ceilings, lifecycle state, scoped count/maximum, and settings revision without substituting cumulative session tokens for active context occupancy.
|
|
118
|
+
| `--auto-compact-threshold <percent>` | integer `1`–`99` | saved Builder value, then `50` | Initial run threshold override. A newer persistent settings revision wins at the next safe boundary. |
|
|
121
119
|
|
|
122
120
|
Auto-detected tracker files:
|
|
123
121
|
|
|
@@ -609,14 +607,6 @@ pnpm build
|
|
|
609
607
|
pnpm dev -- start ../../examples/dummy-project --steps 2
|
|
610
608
|
```
|
|
611
609
|
|
|
612
|
-
Changes to provider adapters or context lifecycle enforcement also require the opt-in authenticated gate:
|
|
613
|
-
|
|
614
|
-
```bash
|
|
615
|
-
pnpm test:live-providers
|
|
616
|
-
```
|
|
617
|
-
|
|
618
|
-
It exercises Claude and Codex as both Builder and QA with a low native ceiling, verifies in-turn compaction and same-session continuation, then verifies a maximum-one boundary interruption and validated fresh handoff. Set `RAFI_LIVE_CONTEXT_THRESHOLD_PERCENT` to an integer from `1` through `10` to override its default `10%` ceiling. Very low Claude ceilings can intentionally fail the capability check when they fall below the SDK's minimum native window. The gate uses locally authenticated provider CLIs and is intentionally skipped by the ordinary test suite.
|
|
619
|
-
|
|
620
610
|
Package output:
|
|
621
611
|
|
|
622
612
|
- The package publishes an `ai-foreman` binary from `dist/index.js`.
|
package/dist/activity.js
CHANGED
|
@@ -236,8 +236,8 @@ export function reportBuilderEvent(event) {
|
|
|
236
236
|
reporter.update("processing agent response");
|
|
237
237
|
else if (event.kind === "session-transition")
|
|
238
238
|
reporter.update(`session ${event.transition}`, event.detail);
|
|
239
|
-
else if (event.kind === "context-
|
|
240
|
-
reporter.
|
|
239
|
+
else if (event.kind === "context-usage")
|
|
240
|
+
reporter.pulse(event.percentage === undefined ? undefined : `context ${event.percentage.toFixed(0)}%`);
|
|
241
241
|
else if (event.kind === "turn-complete")
|
|
242
242
|
reporter.update(event.result.isError ? "agent turn failed" : "agent turn complete");
|
|
243
243
|
else if (event.kind === "error")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SDKSessionInfo, PermissionResult } from "@anthropic-ai/claude-agent-sdk";
|
|
2
2
|
/** Lazy-load the Claude Agent SDK. Throws an actionable error if not installed. */
|
|
3
3
|
export declare function requireClaudeSDK(): Promise<typeof import("@anthropic-ai/claude-agent-sdk")>;
|
|
4
|
-
import type { BuilderAdapter, BuilderAdapterOptions, BuilderEvent,
|
|
4
|
+
import type { BuilderAdapter, BuilderAdapterOptions, BuilderEvent, NativeCompaction, NativeAutoCompactionPolicy, CompactResult, ContextUsage, PermissionDecision, ProviderSettingSwitch, ProviderSessionUsage, TurnResult } from "./types.js";
|
|
5
5
|
import type { ProviderSessionRefV1, SessionAvailabilityV1 } from "rafi-spec";
|
|
6
6
|
/**
|
|
7
7
|
* Pure function: build the `options` object passed to `query()`.
|
|
@@ -43,14 +43,11 @@ export declare function claudeApiRetryEvent(message: {
|
|
|
43
43
|
export declare class ClaudeAdapter implements BuilderAdapter {
|
|
44
44
|
private readonly opts;
|
|
45
45
|
readonly agent: "claude";
|
|
46
|
-
private inbox;
|
|
46
|
+
private readonly inbox;
|
|
47
47
|
private readonly eventQueue;
|
|
48
|
-
private query;
|
|
49
|
-
private abort;
|
|
50
|
-
private pumpDone;
|
|
51
|
-
private readonly queryFactory;
|
|
52
|
-
private transportGeneration;
|
|
53
|
-
private transportObservedSessionId?;
|
|
48
|
+
private readonly query;
|
|
49
|
+
private readonly abort;
|
|
50
|
+
private readonly pumpDone;
|
|
54
51
|
private _sessionId?;
|
|
55
52
|
private _sessionRef?;
|
|
56
53
|
private readonly stderrChunks;
|
|
@@ -58,19 +55,12 @@ export declare class ClaudeAdapter implements BuilderAdapter {
|
|
|
58
55
|
private structuredError?;
|
|
59
56
|
private apiErrorStatus?;
|
|
60
57
|
private compactResult?;
|
|
61
|
-
private
|
|
62
|
-
private
|
|
63
|
-
private
|
|
64
|
-
private
|
|
65
|
-
private
|
|
66
|
-
private
|
|
67
|
-
private compactionTerminalObserved;
|
|
68
|
-
private lastContextUsage?;
|
|
69
|
-
/** Full provider context capacity, before Rafi narrows Claude's auto-compact window. */
|
|
70
|
-
private modelContextWindow?;
|
|
71
|
-
/** SDK-owned space between autoCompactWindow and the actual used-token trigger. */
|
|
72
|
-
private nativeAutoCompactReserve?;
|
|
73
|
-
private contextPrepared;
|
|
58
|
+
private autoCompactionPrepared;
|
|
59
|
+
private preparedAutoCompactThreshold?;
|
|
60
|
+
private preparedAutoCompactionPolicy?;
|
|
61
|
+
private manualCompactionInFlight;
|
|
62
|
+
private nativeCompactions;
|
|
63
|
+
private nativeCompactionSequence;
|
|
74
64
|
private cumulativeUsage;
|
|
75
65
|
private pending?;
|
|
76
66
|
private terminalResult?;
|
|
@@ -78,7 +68,6 @@ export declare class ClaudeAdapter implements BuilderAdapter {
|
|
|
78
68
|
private closed;
|
|
79
69
|
static create(opts: BuilderAdapterOptions): Promise<ClaudeAdapter>;
|
|
80
70
|
private constructor();
|
|
81
|
-
private openQuery;
|
|
82
71
|
/** Background loop: consume the SDK message stream until it ends. */
|
|
83
72
|
private pump;
|
|
84
73
|
private handle;
|
|
@@ -90,19 +79,16 @@ export declare class ClaudeAdapter implements BuilderAdapter {
|
|
|
90
79
|
adoptSessionRef(ref: ProviderSessionRefV1): void;
|
|
91
80
|
validateSession(): Promise<SessionAvailabilityV1>;
|
|
92
81
|
compact(): Promise<CompactResult>;
|
|
82
|
+
prepareAutoCompaction(thresholdPercent?: number | undefined): Promise<NativeAutoCompactionPolicy | void>;
|
|
83
|
+
autoCompactionPolicy(): NativeAutoCompactionPolicy | undefined;
|
|
84
|
+
drainNativeCompactions(): NativeCompaction[];
|
|
85
|
+
restoreNativeCompactions(compactions: NativeCompaction[]): void;
|
|
93
86
|
contextUsage(): Promise<ContextUsage | undefined>;
|
|
94
|
-
prepareContextManagement(policy: ContextManagementPolicy): Promise<PreparedContextManagement>;
|
|
95
|
-
updateContextManagement(policy: ContextManagementPolicy): Promise<PreparedContextManagement>;
|
|
96
|
-
interruptTurnAtCompactionBoundary(providerEventId?: string): Promise<InterruptResult>;
|
|
97
87
|
sessionUsage(): Promise<ProviderSessionUsage | undefined>;
|
|
98
88
|
switchSettings(settings: ProviderSettingSwitch): Promise<CompactResult>;
|
|
99
89
|
events(): AsyncIterable<BuilderEvent>;
|
|
100
90
|
close(): Promise<void>;
|
|
101
91
|
private observeSession;
|
|
102
|
-
private makeContextUsage;
|
|
103
|
-
private configureContextManagement;
|
|
104
|
-
private restartTransport;
|
|
105
|
-
private completeCompaction;
|
|
106
92
|
private settlePending;
|
|
107
93
|
private streamFailureResult;
|
|
108
94
|
}
|