@llm4ts/flow 2.7.2 → 2.9.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/Approval.d.ts +1 -1
- package/dist/Approval.d.ts.map +1 -1
- package/dist/Artifacts.d.ts +2 -2
- package/dist/Artifacts.d.ts.map +1 -1
- package/dist/BenchReport.d.ts +2 -2
- package/dist/BenchReport.d.ts.map +1 -1
- package/dist/Chat.d.ts.map +1 -1
- package/dist/Chat.js +35 -4
- package/dist/Chat.js.map +1 -1
- package/dist/CostLedger.d.ts +2 -2
- package/dist/CostLedger.d.ts.map +1 -1
- package/dist/Equiv.d.ts +3 -3
- package/dist/Equiv.d.ts.map +1 -1
- package/dist/Flow.d.ts +1 -1
- package/dist/Flow.d.ts.map +1 -1
- package/dist/FlowContext.d.ts +15 -1
- package/dist/FlowContext.d.ts.map +1 -1
- package/dist/FlowContext.js.map +1 -1
- package/dist/FlowError.d.ts +40 -1
- package/dist/FlowError.d.ts.map +1 -1
- package/dist/FlowError.js +58 -3
- package/dist/FlowError.js.map +1 -1
- package/dist/GitTool.d.ts +26 -2
- package/dist/GitTool.d.ts.map +1 -1
- package/dist/GitTool.js +54 -3
- package/dist/GitTool.js.map +1 -1
- package/dist/Judgment.d.ts +2 -2
- package/dist/Judgment.d.ts.map +1 -1
- package/dist/Perimeter.d.ts +22 -1
- package/dist/Perimeter.d.ts.map +1 -1
- package/dist/Perimeter.js +57 -1
- package/dist/Perimeter.js.map +1 -1
- package/dist/Persistence.d.ts +2 -2
- package/dist/Persistence.d.ts.map +1 -1
- package/dist/PlanExecution.d.ts +1 -1
- package/dist/PlanExecution.d.ts.map +1 -1
- package/dist/ProgramJudge.d.ts +1 -1
- package/dist/ProgramJudge.d.ts.map +1 -1
- package/dist/Replay.d.ts +2 -2
- package/dist/Replay.d.ts.map +1 -1
- package/dist/Review.d.ts +3 -3
- package/dist/Review.d.ts.map +1 -1
- package/dist/ReviewCache.d.ts +1 -1
- package/dist/ReviewCache.d.ts.map +1 -1
- package/dist/Roster.d.ts +163 -0
- package/dist/Roster.d.ts.map +1 -0
- package/dist/Roster.js +560 -0
- package/dist/Roster.js.map +1 -0
- package/dist/RosterSeats.d.ts +71 -0
- package/dist/RosterSeats.d.ts.map +1 -0
- package/dist/RosterSeats.js +144 -0
- package/dist/RosterSeats.js.map +1 -0
- package/dist/Stories.d.ts +54 -8
- package/dist/Stories.d.ts.map +1 -1
- package/dist/Stories.js +413 -51
- package/dist/Stories.js.map +1 -1
- package/dist/StoryPlan.d.ts +15 -0
- package/dist/StoryPlan.d.ts.map +1 -1
- package/dist/StoryPlan.js +58 -0
- package/dist/StoryPlan.js.map +1 -1
- package/dist/TransientRetry.d.ts +9 -0
- package/dist/TransientRetry.d.ts.map +1 -1
- package/dist/TransientRetry.js +43 -8
- package/dist/TransientRetry.js.map +1 -1
- package/package.json +4 -2
- package/src/Chat.ts +45 -6
- package/src/FlowContext.ts +19 -1
- package/src/FlowError.ts +65 -3
- package/src/GitTool.ts +99 -5
- package/src/Perimeter.ts +85 -1
- package/src/Roster.ts +824 -0
- package/src/RosterSeats.ts +306 -0
- package/src/Stories.ts +588 -88
- package/src/StoryPlan.ts +73 -0
- package/src/TransientRetry.ts +97 -8
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
3
|
+
import type { LlmServiceShape } from "@llm4ts/core/LlmService";
|
|
4
|
+
import { type ConnectorCapabilities } from "@llm4ts/core/Models";
|
|
5
|
+
import { type FlowError } from "./FlowError.ts";
|
|
6
|
+
import { type FlowEventsShape } from "./FlowEvents.ts";
|
|
7
|
+
import { type ExecutorSpec, type Role, type RosterShape } from "./Roster.ts";
|
|
8
|
+
/** An executor's connector, as the runner resolved it for a role and a directory. */
|
|
9
|
+
export type RosterSeat = LlmServiceShape & {
|
|
10
|
+
readonly capabilities: ConnectorCapabilities;
|
|
11
|
+
};
|
|
12
|
+
export interface SeatSource {
|
|
13
|
+
readonly seatFor: (executor: ExecutorSpec, role: Role, workDir: string) => Effect.Effect<RosterSeat, FlowError>;
|
|
14
|
+
}
|
|
15
|
+
/** What a flow context knows about the roster behind its seats. */
|
|
16
|
+
export interface RosterView {
|
|
17
|
+
/** A seat for `role`, leased per call (independent of this context's coder where possible). */
|
|
18
|
+
readonly forRole: (role: Role) => LlmServiceShape;
|
|
19
|
+
/** Free slots for `role` right now. */
|
|
20
|
+
readonly available: (role: Role) => Effect.Effect<number>;
|
|
21
|
+
/** Configured slots for `role`. */
|
|
22
|
+
readonly slots: (role: Role) => number;
|
|
23
|
+
/** The executor holding this context's coder, once leased. */
|
|
24
|
+
readonly executor: Effect.Effect<string | undefined>;
|
|
25
|
+
/** Every executor that held this context's coder, in order (handovers). */
|
|
26
|
+
readonly history: Effect.Effect<ReadonlyArray<string>>;
|
|
27
|
+
}
|
|
28
|
+
export interface RosterSeatOptions {
|
|
29
|
+
readonly events: FlowEventsShape;
|
|
30
|
+
/** Executors this seat must not use: the context's coder, for independence. */
|
|
31
|
+
readonly avoid?: Effect.Effect<ReadonlyArray<string>>;
|
|
32
|
+
/** Used without a slot when nobody outside `avoid` can ever serve the role. */
|
|
33
|
+
readonly borrow?: Effect.Effect<ExecutorSpec | undefined>;
|
|
34
|
+
/** Who is asking, for the events. */
|
|
35
|
+
readonly label?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A seat for `role` that leases an executor for each call and releases it
|
|
39
|
+
* when the call (or its stream) ends. A failure is reported to the roster,
|
|
40
|
+
* which excludes the executor when the failure says it is out of quota or
|
|
41
|
+
* down; the call itself still fails — a per-call seat has nothing to hand
|
|
42
|
+
* over, and the retry layer below has already had its turn.
|
|
43
|
+
*/
|
|
44
|
+
export declare const rosterSeat: (roster: RosterShape, source: SeatSource, role: Role, workDir: string, options: RosterSeatOptions) => LlmServiceShape;
|
|
45
|
+
export interface HeldCoderOptions {
|
|
46
|
+
readonly events: FlowEventsShape;
|
|
47
|
+
/** Lease now (a story waiting for capacity), or on the first call (a flow's root coder). */
|
|
48
|
+
readonly eager: boolean;
|
|
49
|
+
/** The executor this context held before, taken first while free. */
|
|
50
|
+
readonly prefer?: string;
|
|
51
|
+
/** Handovers before a failure surfaces. Default 2. */
|
|
52
|
+
readonly maxHandovers?: number;
|
|
53
|
+
readonly label?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface HeldCoder {
|
|
56
|
+
readonly service: LlmServiceShape;
|
|
57
|
+
readonly executor: Effect.Effect<string | undefined>;
|
|
58
|
+
readonly lease: Effect.Effect<ExecutorSpec | undefined>;
|
|
59
|
+
readonly history: Effect.Effect<ReadonlyArray<string>>;
|
|
60
|
+
}
|
|
61
|
+
export declare const takeoverNote: (from: string, reason: string) => string;
|
|
62
|
+
/**
|
|
63
|
+
* The coder of one context (a story, or a flow's root): one executor held
|
|
64
|
+
* for the context's lifetime. When a call fails in a way that takes that
|
|
65
|
+
* executor out of the round (a usage limit, a dead serving engine), the
|
|
66
|
+
* lease is released, the next coder leased, and the call repeated there
|
|
67
|
+
* with a takeover note — the chat history the flow replays, the task
|
|
68
|
+
* checkpoint and the working tree carry the work across.
|
|
69
|
+
*/
|
|
70
|
+
export declare const makeHeldCoder: (roster: RosterShape, source: SeatSource, workDir: string, options: HeldCoderOptions) => Effect.Effect<HeldCoder, import("./FlowError.ts").PersistenceError | import("./FlowError.ts").PlanParseError | import("./FlowError.ts").UnsupportedSchemaVersion | import("./FlowError.ts").WorkspacePathError | import("./FlowError.ts").WorkspaceLimitError | import("./FlowError.ts").WorkspaceIoError | import("./FlowError.ts").FlowAborted | import("./FlowError.ts").ProcessError | import("./FlowError.ts").FlowLlmError | import("./FlowError.ts").FlowCapabilityDenied | import("./FlowError.ts").ColumnNotFound | import("./FlowError.ts").BudgetExceeded | import("./FlowError.ts").StoryPlanInvalid | import("./FlowError.ts").PerimeterViolation | import("./FlowError.ts").MissingDependency | import("./FlowError.ts").MergeConflict | import("./FlowError.ts").EpicCheckoutDirty | import("./FlowError.ts").RosterInvalid | import("./FlowError.ts").RosterExhausted | import("./FlowError.ts").StoryFailed | import("./FlowError.ts").DecisionsInvalid | import("./FlowError.ts").OpenPointsPending | import("./FlowError.ts").ContractConflict, Scope.Scope>;
|
|
71
|
+
//# sourceMappingURL=RosterSeats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RosterSeats.d.ts","sourceRoot":"","sources":["../src/RosterSeats.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAIrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAW,KAAK,qBAAqB,EAAiB,MAAM,qBAAqB,CAAA;AACxF,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,IAAI,EACT,KAAK,WAAW,EACjB,MAAM,aAAa,CAAA;AAEpB,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,qBAAqB,CAAA;CAAE,CAAA;AAE3F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,CAChB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;CAC1C;AAED,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,eAAe,CAAA;IACjD,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,E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AO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC,CAAA;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;CACvD;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,MAK/C,CAAA;AAOb;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,0mCA2FxB,CAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Seats over the executor roster (ADR 0019). A flow keeps calling an
|
|
2
|
+
// `LlmServiceShape`; behind it, a reasoning seat leases an executor for each
|
|
3
|
+
// call, and a coder seat holds one executor for its context and hands over
|
|
4
|
+
// to the next when that one is taken out of the round. The runner supplies
|
|
5
|
+
// `seatFor`, which turns an executor into a connector rooted in a directory.
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Ref from "effect/Ref";
|
|
8
|
+
import * as Scope from "effect/Scope";
|
|
9
|
+
import * as Semaphore from "effect/Semaphore";
|
|
10
|
+
import * as Stream from "effect/Stream";
|
|
11
|
+
import { ConfigError } from "@llm4ts/core/Errors";
|
|
12
|
+
import { Message } from "@llm4ts/core/Models";
|
|
13
|
+
import { describeFlowError } from "./FlowError.js";
|
|
14
|
+
import { Info } from "./FlowEvents.js";
|
|
15
|
+
import { describeExclusion, hasRole } from "./Roster.js";
|
|
16
|
+
/** A roster failure seen through an `LlmServiceShape`, whose failures are `LlmError`s. */
|
|
17
|
+
const asLlmError = (error) => ConfigError.make({ message: describeFlowError(error) });
|
|
18
|
+
const say = (events, message) => events.publish(Info.make({ message: `roster: ${message}` }));
|
|
19
|
+
const withNote = (note, prompt) => note === undefined ? prompt : `${note}\n\n${prompt}`;
|
|
20
|
+
const withNoteOnLast = (note, messages) => {
|
|
21
|
+
const last = messages.at(-1);
|
|
22
|
+
if (note === undefined || last === undefined) {
|
|
23
|
+
return messages;
|
|
24
|
+
}
|
|
25
|
+
return [
|
|
26
|
+
...messages.slice(0, -1),
|
|
27
|
+
Message.make({ ...last, content: withNote(note, last.content) })
|
|
28
|
+
];
|
|
29
|
+
};
|
|
30
|
+
const serviceOver = (runner) => ({
|
|
31
|
+
executeStream: (prompt) => runner.stream((seat, note) => seat.executeStream(withNote(note, prompt))),
|
|
32
|
+
executeStreamWithHistory: (messages) => runner.stream((seat, note) => seat.executeStreamWithHistory(withNoteOnLast(note, messages))),
|
|
33
|
+
executeWithTools: (prompt, tools) => runner.run((seat, note) => seat.executeWithTools(withNote(note, prompt), tools)),
|
|
34
|
+
executeStructured: (prompt, schema, jsonSchema) => runner.run((seat, note) => seat.executeStructured(withNote(note, prompt), schema, jsonSchema)),
|
|
35
|
+
executeStructuredWithUsage: (prompt, schema, jsonSchema) => runner.run((seat, note) => seat.executeStructuredWithUsage(withNote(note, prompt), schema, jsonSchema)),
|
|
36
|
+
scoreLabels: (prompt, labels) => runner.run((seat) => seat.scoreLabels(prompt, labels)),
|
|
37
|
+
isAvailable: runner.isAvailable
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* A seat for `role` that leases an executor for each call and releases it
|
|
41
|
+
* when the call (or its stream) ends. A failure is reported to the roster,
|
|
42
|
+
* which excludes the executor when the failure says it is out of quota or
|
|
43
|
+
* down; the call itself still fails — a per-call seat has nothing to hand
|
|
44
|
+
* over, and the retry layer below has already had its turn.
|
|
45
|
+
*/
|
|
46
|
+
export const rosterSeat = (roster, source, role, workDir, options) => {
|
|
47
|
+
const acquire = Effect.gen(function* () {
|
|
48
|
+
const avoid = options.avoid === undefined ? [] : yield* options.avoid;
|
|
49
|
+
if (avoid.length > 0 && !(yield* roster.canEverServe(role, avoid))) {
|
|
50
|
+
const borrowed = options.borrow === undefined ? undefined : yield* options.borrow;
|
|
51
|
+
if (borrowed !== undefined && hasRole(borrowed, role)) {
|
|
52
|
+
yield* say(options.events, `${borrowed.id} takes ${role}${options.label === undefined ? "" : ` for ${options.label}`} on its own coder's slot — not independent (no other executor can take ${role})`);
|
|
53
|
+
return borrowed;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const lease = yield* roster
|
|
57
|
+
.lease(role, { avoid, ...(options.label === undefined ? {} : { label: options.label }) })
|
|
58
|
+
.pipe(Effect.mapError(asLlmError));
|
|
59
|
+
return lease.executor;
|
|
60
|
+
});
|
|
61
|
+
const seatOf = (executor) => source.seatFor(executor, role, workDir).pipe(Effect.mapError(asLlmError));
|
|
62
|
+
const reportOn = (executor) => (error) => Effect.asVoid(roster.report(executor.id, error));
|
|
63
|
+
return serviceOver({
|
|
64
|
+
run: (use) => Effect.scoped(Effect.gen(function* () {
|
|
65
|
+
const executor = yield* acquire;
|
|
66
|
+
const seat = yield* seatOf(executor);
|
|
67
|
+
return yield* use(seat, undefined).pipe(Effect.tapError(reportOn(executor)));
|
|
68
|
+
})),
|
|
69
|
+
stream: (use) => Stream.unwrap(Effect.gen(function* () {
|
|
70
|
+
const executor = yield* acquire;
|
|
71
|
+
const seat = yield* seatOf(executor);
|
|
72
|
+
return use(seat, undefined).pipe(Stream.tapError(reportOn(executor)));
|
|
73
|
+
})),
|
|
74
|
+
isAvailable: roster.canEverServe(role)
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
export const takeoverNote = (from, reason) => [
|
|
78
|
+
`(You are taking over this work from another coding agent ('${from}'), which had to stop:`,
|
|
79
|
+
`${reason}. Its changes so far are in the working tree: inspect them (git status, git diff)`,
|
|
80
|
+
"before continuing, and carry on from there.)"
|
|
81
|
+
].join(" ");
|
|
82
|
+
/**
|
|
83
|
+
* The coder of one context (a story, or a flow's root): one executor held
|
|
84
|
+
* for the context's lifetime. When a call fails in a way that takes that
|
|
85
|
+
* executor out of the round (a usage limit, a dead serving engine), the
|
|
86
|
+
* lease is released, the next coder leased, and the call repeated there
|
|
87
|
+
* with a takeover note — the chat history the flow replays, the task
|
|
88
|
+
* checkpoint and the working tree carry the work across.
|
|
89
|
+
*/
|
|
90
|
+
export const makeHeldCoder = Effect.fn("@llm4ts/flow/RosterSeats.heldCoder")(function* (roster, source, workDir, options) {
|
|
91
|
+
const scope = yield* Effect.scope;
|
|
92
|
+
const current = yield* Ref.make(undefined);
|
|
93
|
+
const history = yield* Ref.make([]);
|
|
94
|
+
const handovers = yield* Ref.make(0);
|
|
95
|
+
const prefer = yield* Ref.make(options.prefer);
|
|
96
|
+
const gate = yield* Semaphore.make(1);
|
|
97
|
+
const maxHandovers = options.maxHandovers ?? 2;
|
|
98
|
+
const acquire = gate.withPermit(Effect.gen(function* () {
|
|
99
|
+
const held = yield* Ref.get(current);
|
|
100
|
+
if (held !== undefined) {
|
|
101
|
+
return held;
|
|
102
|
+
}
|
|
103
|
+
const preferred = yield* Ref.get(prefer);
|
|
104
|
+
const lease = yield* roster
|
|
105
|
+
.lease("coder", {
|
|
106
|
+
...(preferred === undefined ? {} : { prefer: preferred }),
|
|
107
|
+
...(options.label === undefined ? {} : { label: options.label })
|
|
108
|
+
})
|
|
109
|
+
.pipe(Scope.provide(scope));
|
|
110
|
+
const seat = yield* source.seatFor(lease.executor, "coder", workDir);
|
|
111
|
+
const next = { lease, seat };
|
|
112
|
+
yield* Ref.set(current, next);
|
|
113
|
+
yield* Ref.update(history, (ids) => ids.at(-1) === lease.executor.id ? ids : [...ids, lease.executor.id]);
|
|
114
|
+
return next;
|
|
115
|
+
}));
|
|
116
|
+
if (options.eager) {
|
|
117
|
+
yield* acquire;
|
|
118
|
+
}
|
|
119
|
+
/** Decides whether a failure hands over; returns the takeover note, or fails with the error. */
|
|
120
|
+
const handover = (held, error) => Effect.gen(function* () {
|
|
121
|
+
const exclusion = yield* roster.report(held.lease.executor.id, error);
|
|
122
|
+
if (exclusion === undefined || (yield* Ref.get(handovers)) >= maxHandovers) {
|
|
123
|
+
return yield* Effect.fail(error);
|
|
124
|
+
}
|
|
125
|
+
yield* Ref.update(handovers, (count) => count + 1);
|
|
126
|
+
yield* Ref.set(prefer, undefined);
|
|
127
|
+
yield* held.lease.release;
|
|
128
|
+
yield* Ref.set(current, undefined);
|
|
129
|
+
yield* say(options.events, `${options.label ?? workDir}: handing the coder over from ${held.lease.executor.id} (${describeExclusion(exclusion)})`);
|
|
130
|
+
return takeoverNote(held.lease.executor.id, exclusion.reason);
|
|
131
|
+
});
|
|
132
|
+
const run = (use, note) => Effect.gen(function* () {
|
|
133
|
+
const held = yield* acquire.pipe(Effect.mapError(asLlmError));
|
|
134
|
+
return yield* use(held.seat, note).pipe(Effect.catch((error) => Effect.flatMap(handover(held, error), (next) => run(use, next))));
|
|
135
|
+
});
|
|
136
|
+
const stream = (use, note) => Stream.unwrap(Effect.map(acquire.pipe(Effect.mapError(asLlmError)), (held) => use(held.seat, note).pipe(Stream.catchIf(() => true, (error) => Stream.unwrap(Effect.map(handover(held, error), (next) => stream(use, next)))))));
|
|
137
|
+
return {
|
|
138
|
+
service: serviceOver({ run, stream, isAvailable: roster.canEverServe("coder") }),
|
|
139
|
+
executor: Effect.map(Ref.get(current), (held) => held?.lease.executor.id),
|
|
140
|
+
lease: Effect.map(Ref.get(current), (held) => held?.lease.executor),
|
|
141
|
+
history: Ref.get(history)
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=RosterSeats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RosterSeats.js","sourceRoot":"","sources":["../src/RosterSeats.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;A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,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CACzF,CACF,CACF,CACF,CAAA;IAEH,OAAO;QACL,OAAO,EAAE,WAAW,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;QAChF,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC;QACnE,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;KAC1B,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/dist/Stories.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import type * as Scope from "effect/Scope";
|
|
|
5
5
|
import type { LlmServiceShape } from "@llm4ts/core/LlmService";
|
|
6
6
|
import type { TokenUsage } from "@llm4ts/core/Models";
|
|
7
7
|
import { type BoardSyncShape } from "./BoardSync.ts";
|
|
8
|
-
import type { FlowContextShape } from "./FlowContext.ts";
|
|
9
|
-
import { MissingDependency, StoryFailed, type FlowError } from "./FlowError.ts";
|
|
8
|
+
import type { ContextOptions, FlowContextShape } from "./FlowContext.ts";
|
|
9
|
+
import { EpicCheckoutDirty, MissingDependency, PerimeterViolation, StoryFailed, type FlowError } from "./FlowError.ts";
|
|
10
10
|
import { type PlainFileStoreShape } from "./Persistence.ts";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import { Plan } from "./Plan.ts";
|
|
12
|
+
import { ReviewResult } from "./Review.ts";
|
|
13
13
|
import type { Reviewer } from "./Reviewer.ts";
|
|
14
14
|
import { type Story, type StoryPlan } from "./StoryPlan.ts";
|
|
15
15
|
/** A flow context rooted in a story's worktree, plus that story's own usage totals. */
|
|
@@ -28,6 +28,8 @@ declare const StoryState_base: Schema.Class<StoryState, Schema.Struct<{
|
|
|
28
28
|
readonly branch: Schema.String;
|
|
29
29
|
readonly worktree: Schema.String;
|
|
30
30
|
readonly status: Schema.Literals<readonly ["started", "merged", "failed"]>;
|
|
31
|
+
/** The roster executor that last held the story's coder (ADR 0019); preferred on resume. */
|
|
32
|
+
readonly executor: Schema.optionalKey<Schema.String>;
|
|
31
33
|
}>, {}>;
|
|
32
34
|
/** What the executor remembers about a story between runs. */
|
|
33
35
|
export declare class StoryState extends StoryState_base {
|
|
@@ -44,6 +46,8 @@ declare const StoryOutcome_base: Schema.Class<StoryOutcome, Schema.Struct<{
|
|
|
44
46
|
/** Failure reason, or what a waiting story waits for. */
|
|
45
47
|
readonly reason: Schema.optionalKey<Schema.String>;
|
|
46
48
|
readonly judge: Schema.optionalKey<Schema.String>;
|
|
49
|
+
/** The roster executor(s) that coded the story, in order ("codex → claude"). */
|
|
50
|
+
readonly executor: Schema.optionalKey<Schema.String>;
|
|
47
51
|
/** ESTIMATES, never measurements (ADR 0012). */
|
|
48
52
|
readonly estimatedTokens: Schema.optionalKey<Schema.Int>;
|
|
49
53
|
readonly estimatedCostUsd: Schema.optionalKey<Schema.Number>;
|
|
@@ -70,12 +74,42 @@ export declare const blockedOnSentinel = "BLOCKED_ON:";
|
|
|
70
74
|
* read.
|
|
71
75
|
*/
|
|
72
76
|
export declare const blockedOnIn: (text: string) => string | undefined;
|
|
77
|
+
/** Where a story runs, which is what lets its rules name the other stories and checkouts. */
|
|
78
|
+
export interface StoryWhereabouts {
|
|
79
|
+
readonly plan: StoryPlan;
|
|
80
|
+
/** The story's own worktree — the coder's working directory. */
|
|
81
|
+
readonly worktree: string;
|
|
82
|
+
/** The epic branch's checkout, which no coder may touch. */
|
|
83
|
+
readonly epicCheckout: string;
|
|
84
|
+
}
|
|
73
85
|
/** The hard rules every story coder receives; the perimeter check enforces them afterwards. */
|
|
74
|
-
export declare const perimeterRules: (story: Story) => string;
|
|
86
|
+
export declare const perimeterRules: (story: Story, where?: StoryWhereabouts) => string;
|
|
75
87
|
export declare const storyPrompt: (story: Story) => string;
|
|
76
88
|
export declare const storyTaskPlanInstructions: (story: Story) => string;
|
|
77
89
|
/** The coder plans its own tasks from the story — the orchestrator split the epic, not the story. */
|
|
78
90
|
export declare const defaultPlanTasks: (seats: StorySeats, story: Story, prompt: string) => Effect.Effect<Plan, FlowError>;
|
|
91
|
+
/**
|
|
92
|
+
* Asks the planner again, once, when its tasks name paths outside the story;
|
|
93
|
+
* tasks that still name ANOTHER story's paths are then dropped (that work is
|
|
94
|
+
* planned elsewhere) and any remaining stray is left to the perimeter gate.
|
|
95
|
+
*/
|
|
96
|
+
export declare const planWithinPerimeter: (plan: StoryPlan, story: Story, planTasks: (prompt: string) => Effect.Effect<Plan, FlowError>, prompt: string, events: FlowContextShape["events"]) => Effect.Effect<Plan, FlowError>;
|
|
97
|
+
/**
|
|
98
|
+
* Why a BLOCKED_ON claim is wrong, when the plan alone can tell: the named
|
|
99
|
+
* path is the story's own, a dependency's (already merged into the worktree),
|
|
100
|
+
* or a dependent's (built later on top of this story). Undefined when the
|
|
101
|
+
* plan cannot settle it — a path no story owns, or a parallel story's.
|
|
102
|
+
*/
|
|
103
|
+
export declare const blockedRebuttal: (plan: StoryPlan, story: Story, need: string) => string | undefined;
|
|
104
|
+
declare const BlockedVerdict_base: Schema.Class<BlockedVerdict, Schema.Struct<{
|
|
105
|
+
/** True: the work is genuinely missing and owned by no dependency. */
|
|
106
|
+
readonly real: Schema.Boolean;
|
|
107
|
+
/** Why — shown to the coder when the claim is rejected. */
|
|
108
|
+
readonly reason: Schema.String;
|
|
109
|
+
}>, {}>;
|
|
110
|
+
/** A second opinion on a BLOCKED_ON claim the plan cannot settle. */
|
|
111
|
+
export declare class BlockedVerdict extends BlockedVerdict_base {
|
|
112
|
+
}
|
|
79
113
|
/**
|
|
80
114
|
* A coder whose turns are watched for the `BLOCKED_ON:` sentinel. The story
|
|
81
115
|
* loop reads the ref after the coder stops, so a blocked turn ends the story
|
|
@@ -92,7 +126,7 @@ export interface StoriesOptions {
|
|
|
92
126
|
/** Default `epic/<epicId>`. */
|
|
93
127
|
readonly epicBranch?: string;
|
|
94
128
|
/** Seats rooted in a worktree; the executor never resolves seats itself. */
|
|
95
|
-
readonly contextFor: (workDir: string) => Effect.Effect<StorySeats, FlowError, Scope.Scope>;
|
|
129
|
+
readonly contextFor: (workDir: string, options?: ContextOptions) => Effect.Effect<StorySeats, FlowError, Scope.Scope>;
|
|
96
130
|
readonly board: BoardSyncShape;
|
|
97
131
|
/**
|
|
98
132
|
* Prepares a worktree before its coder runs — a fresh checkout has no
|
|
@@ -103,7 +137,7 @@ export interface StoriesOptions {
|
|
|
103
137
|
/** The target's gates, run in a worktree per task and on the epic checkout after each merge. */
|
|
104
138
|
readonly gates: (workDir: string) => Effect.Effect<ReviewResult, FlowError>;
|
|
105
139
|
/** Story-level judge over the branch's diff against the epic branch; omit to skip. */
|
|
106
|
-
readonly judge?: (story: Story, diff: string) => Effect.Effect<ReviewResult, FlowError>;
|
|
140
|
+
readonly judge?: (story: Story, diff: string, seats: StorySeats) => Effect.Effect<ReviewResult, FlowError>;
|
|
107
141
|
/** Judge attempts, each but the last followed by one coder feedback round. Default 2. */
|
|
108
142
|
readonly judgeRounds?: number;
|
|
109
143
|
/** Extra system context per story (house rules, shared read-only excerpts). */
|
|
@@ -116,7 +150,19 @@ export interface StoriesOptions {
|
|
|
116
150
|
readonly failFast?: boolean;
|
|
117
151
|
readonly reviewers?: ReadonlyArray<Reviewer>;
|
|
118
152
|
readonly maxRounds?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Second opinion on a BLOCKED_ON claim the plan cannot settle (a path no
|
|
155
|
+
* story owns, or a parallel story's). `real: false` sends the coder back
|
|
156
|
+
* once with the reason. Omit to accept every such claim.
|
|
157
|
+
*/
|
|
158
|
+
readonly verifyBlocked?: (story: Story, need: string, workDir: string, seats: StorySeats) => Effect.Effect<BlockedVerdict, FlowError>;
|
|
159
|
+
/**
|
|
160
|
+
* Waits until a serving engine that went down (`isOutageMessage`) is back;
|
|
161
|
+
* the story it interrupted is then retried once. Omit, or fail it, and the
|
|
162
|
+
* executor stops launching stories instead of failing each in turn.
|
|
163
|
+
*/
|
|
164
|
+
readonly awaitRecovery?: (reason: string) => Effect.Effect<void, FlowError>;
|
|
119
165
|
}
|
|
120
|
-
export declare const implementStoriesFlow: (context: FlowContextShape, options: StoriesOptions) => Effect.Effect<EpicReport, import("./FlowError.ts").PersistenceError | import("./FlowError.ts").PlanParseError | import("./FlowError.ts").UnsupportedSchemaVersion | import("./FlowError.ts").WorkspacePathError | import("./FlowError.ts").WorkspaceLimitError | import("./FlowError.ts").WorkspaceIoError | import("./FlowError.ts").FlowAborted | import("./FlowError.ts").ProcessError | import("./FlowError.ts").FlowLlmError | import("./FlowError.ts").FlowCapabilityDenied | import("./FlowError.ts").ColumnNotFound | import("./FlowError.ts").BudgetExceeded | import("./FlowError.ts").StoryPlanInvalid | import("./FlowError.ts").
|
|
166
|
+
export declare const implementStoriesFlow: (context: FlowContextShape, options: StoriesOptions) => Effect.Effect<EpicReport, import("./FlowError.ts").PersistenceError | import("./FlowError.ts").PlanParseError | import("./FlowError.ts").UnsupportedSchemaVersion | import("./FlowError.ts").WorkspacePathError | import("./FlowError.ts").WorkspaceLimitError | import("./FlowError.ts").WorkspaceIoError | import("./FlowError.ts").FlowAborted | import("./FlowError.ts").ProcessError | import("./FlowError.ts").FlowLlmError | import("./FlowError.ts").FlowCapabilityDenied | import("./FlowError.ts").ColumnNotFound | import("./FlowError.ts").BudgetExceeded | import("./FlowError.ts").StoryPlanInvalid | PerimeterViolation | MissingDependency | import("./FlowError.ts").MergeConflict | EpicCheckoutDirty | import("./FlowError.ts").RosterInvalid | import("./FlowError.ts").RosterExhausted | StoryFailed | import("./FlowError.ts").DecisionsInvalid | import("./FlowError.ts").OpenPointsPending | import("./FlowError.ts").ContractConflict, never>;
|
|
121
167
|
export {};
|
|
122
168
|
//# sourceMappingURL=Stories.d.ts.map
|
package/dist/Stories.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stories.d.ts","sourceRoot":"","sources":["../src/Stories.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Stories.d.ts","sourceRoot":"","sources":["../src/Stories.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAGL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AAWvB,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EASL,KAAK,KAAK,EACV,KAAK,SAAS,EAEf,MAAM,gBAAgB,CAAA;AAQvB,uFAAuF;AACvF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