@usine/core 0.4.0 → 0.5.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/LICENSE +661 -21
- package/README.md +9 -7
- package/dist/agent/session.d.ts +28 -6
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +29 -7
- package/dist/agent/session.js.map +1 -1
- package/dist/attempt/attempt.d.ts +42 -2
- package/dist/attempt/attempt.d.ts.map +1 -1
- package/dist/attempt/attempt.js +44 -2
- package/dist/attempt/attempt.js.map +1 -1
- package/dist/attempt/channel.d.ts +7 -1
- package/dist/attempt/channel.d.ts.map +1 -1
- package/dist/attempt/channel.js +1 -1
- package/dist/attempt/channel.js.map +1 -1
- package/dist/attempt/salvage.d.ts +29 -2
- package/dist/attempt/salvage.d.ts.map +1 -1
- package/dist/attempt/salvage.js +29 -1
- package/dist/attempt/salvage.js.map +1 -1
- package/dist/closed-struct.d.ts +7 -0
- package/dist/closed-struct.d.ts.map +1 -0
- package/dist/closed-struct.js +12 -0
- package/dist/closed-struct.js.map +1 -0
- package/dist/cycle-budget.d.ts.map +1 -1
- package/dist/cycle-budget.js +7 -10
- package/dist/cycle-budget.js.map +1 -1
- package/dist/instance.d.ts +6 -0
- package/dist/instance.d.ts.map +1 -1
- package/dist/instance.js +5 -0
- package/dist/instance.js.map +1 -1
- package/dist/run/again.d.ts.map +1 -1
- package/dist/run/again.js +3 -2
- package/dist/run/again.js.map +1 -1
- package/dist/run/approval.d.ts.map +1 -1
- package/dist/run/approval.js +3 -4
- package/dist/run/approval.js.map +1 -1
- package/dist/worker.d.ts +124 -12
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +136 -12
- package/dist/worker.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -12,16 +12,16 @@ Domain model for [usine](https://github.com/basaltbytes/usine): event, run, step
|
|
|
12
12
|
| `@usine/core/run`, `@usine/core/run/state` | `Run`, `RunId`; the run state machine as a tagged union with typestate transitions (`RunState.start`, `RunState.supersede`, and others) |
|
|
13
13
|
| `@usine/core/step`, `@usine/core/step/result` | `Step`, `StepName`; `StepResult` and its facts (`Commit`, `PullRequest`, `Comment`) |
|
|
14
14
|
| `@usine/core/step/harvest` | `harvestFacts`, `harvestPostedComments`, `HarvestError`, `HarvestSpec`, `AttemptWindowsRead`: the commits and pull requests in an attempt's finished checkout, and the comments and reviews it posted on its item, read with the caller's `git`/`gh` runner |
|
|
15
|
-
| `@usine/core/attempt` | `Attempt`, `AttemptId`, `AttemptNumber`, `AttemptTask`, `shouldAutoRetry`, and `AttemptWindow`, `windowOf`, `windowHolds`, `windowsOverlap`, `AttemptWindows` |
|
|
15
|
+
| `@usine/core/attempt` | `Attempt`, `FailureResolution` (the time and operator of a failure resolution), `AttemptId`, `AttemptNumber`, `AttemptTask`, `OutOfMemoryKills` (the processes the kernel killed in an attempt's containers for memory), `ContainerOutOfMemoryKills` (those of one container, by `ContainerId`), `totalOutOfMemoryKills`, `shouldAutoRetry`, and `AttemptWindow`, `windowOf`, `windowHolds`, `windowsOverlap`, `AttemptWindows` |
|
|
16
16
|
| `@usine/core/attempt/outcome` | `AttemptSucceeded`, `AttemptFailed`, `AttemptCanceled`, `AttemptOutcome` |
|
|
17
17
|
| `@usine/core/attempt/failure` | `InfraFailure`, `DefectFailure`, `AgentFailure`, `RunawayFailure`, `ChildSessionBudgetFailure`, `AttemptFailure`, `isAutoRetryableFailure` |
|
|
18
|
-
| `@usine/core/attempt/salvage` | `SalvageRef`, `salvageRefFor`, `SalvagePushed`, `SalvageRetained`, `AttemptSalvage`, `AttemptRecovery`, `RecoverySink` (its `windows` reads the windows a recovered attempt's harvest needs) |
|
|
18
|
+
| `@usine/core/attempt/salvage` | `SalvageRef`, `salvageRefFor`, `SalvagePushed`, `SalvagePartlyPushed` (pushed work whose checkout keeps the files that the push left out), `SalvageRetained`, `SalvageRejected` (a push that the remote refused for good), `AttemptSalvage`, `AttemptRecovery` (its `rejected` is the recorded `SalvageRejected`, whose commit recovery doesn't push again), `RecoverySink` (its `windows` reads the windows a recovered attempt's harvest needs) |
|
|
19
19
|
| `@usine/core/attempt/start` | Why an attempt started: `StartedByEvent`, `StartedByRetry`, `StartedByEditAndRetry` (with the operator login), `StartedByInfraRetry`, `StartedAfterRestart`, `AttemptStart`, `OperatorRetryStart` |
|
|
20
|
-
| `@usine/core/attempt/channel` | `RunSpec`, versioned envelopes, the `Sink` (stores envelopes, reads the `transcript` and the harvest's `windows`), and the `admit` reducer. Import as a namespace (`AttemptChannel.Started`). |
|
|
20
|
+
| `@usine/core/attempt/channel` | `RunSpec`, versioned envelopes, the `Sink` (stores envelopes, records the salvage, comments, and out-of-memory kills, reads the `transcript` and the harvest's `windows`), and the `admit` reducer. Import as a namespace (`AttemptChannel.Started`). |
|
|
21
21
|
| `@usine/core/agent`, `/agent/brain`, `/agent/session` | `Agent`, `AgentName`, `AgentPersona`, parent model resolution, `githubSignature` (the last line of an agent's GitHub comments); `BrainSpec`, `ModelId`, `Harness`, `Effort`; `AgentSessionId`, session descriptors, `AgentSessionEvent`, `ChildSessionBudget`, `ChildSessionCount` |
|
|
22
22
|
| `@usine/core/agent/capability` | `HarnessCapability`, `HarnessReady`, `HarnessUnavailableError`, and the credential-free `HarnessReadiness` preflight response |
|
|
23
23
|
| `@usine/core/repository` | `RepositoryName`, `RepositoryRevision`, `CommitSha`, `safeSegment`, `splitRepositoryName`, `canonicalRepositoryName` |
|
|
24
|
-
| `@usine/core/worker`, `/item`, `/loop`, `/instance` | `WorkerName`, `WorkerKind`, `GatewayCredentialKind`; `ItemKey`, `ItemNumber`; `LoopName`, `ApprovalRequirement`; `InstanceDirectory` |
|
|
24
|
+
| `@usine/core/worker`, `/item`, `/loop`, `/instance` | `WorkerName`, `WorkerKind`, `GatewayCredentialKind`, `ContainerId`; `ItemKey`, `ItemNumber`; `LoopName`, `ApprovalRequirement`; `InstanceDirectory`, `InstanceId` |
|
|
25
25
|
| `@usine/core/cycle-budget` | `CycleLimit`, `CycleGeneration`, `CycleCount`, `LoopCycleCount`, `CycleBudgetAsk` |
|
|
26
26
|
|
|
27
27
|
Branded schemas are exported under their brand name, as a value and a type. `PullRequest` and `Comment` facts use `URL` values in memory and strings in JSON, so step results round-trip through the channel and durable storage.
|
|
@@ -37,10 +37,12 @@ An item-level `CycleBudgetAsk`, which can exist before another run opens, record
|
|
|
37
37
|
|
|
38
38
|
## Attempts
|
|
39
39
|
|
|
40
|
-
Each attempt records its child `BrainSpec`, its effective Pi parent model, why it started (`start`, none for attempts from before usine recorded it),
|
|
40
|
+
Each attempt records its child `BrainSpec`, its effective Pi parent model, why it started (`start`, none for attempts from before usine recorded it), when a restart last reattached it (`reattachedAt`), and how many processes the kernel killed in its containers for memory, with the memory limit of the last container that had kills (`outOfMemory`, none if it killed none or the attempt ran without a container). A reattachment runs the attempt in a new container, so `outOfMemory` adds up the kills of each container. `RunSpec` is the immutable repo, payload, task, agent context, and child-session budget that the parent starts from.
|
|
41
41
|
|
|
42
42
|
Only infra failures retry automatically, up to a cap. Agent failures wait for the operator. Runaway guard failures, exhausted child-session budgets, and `DefectFailure` never retry automatically; `DefectFailure` records a defect caught at a boundary that needs a serializable outcome, with its original cause.
|
|
43
43
|
|
|
44
|
+
`Attempt.failureResolution` records when an operator marked its failure resolved and the configured operator login, if any. It stays with that attempt across later retries. Older resolutions without a recorded time have `None`.
|
|
45
|
+
|
|
44
46
|
## Attempt windows
|
|
45
47
|
|
|
46
48
|
`AttemptWindow` is when an attempt worked on its run's item: `startedAt` to `endedAt` from its record, with no end while open. `windowOf(attempt)` returns none for an attempt that ended before usine recorded end times. `windowHolds(window, at)` opens a window at its start second, since GitHub records times to the second. `windowsOverlap` says whether GitHub can record a time inside both windows.
|
|
@@ -55,8 +57,8 @@ Outbound `SessionEvent` envelopes keep parent and first-level child session iden
|
|
|
55
57
|
|
|
56
58
|
`SessionTokensUpdated` has a session's cumulative `TokenCount` and, as `costUsd`, the `UsdAmount` its harness priced it at: Pi from its model catalog, Claude Code from the Agent SDK. Codex sets no price. Older transcripts decode it to `Option.none()`.
|
|
57
59
|
|
|
58
|
-
`ChildSession.gatewayCredential` is the `GatewayCredentialKind` the gateway in front of the child's worker used for its model requests: none if the child used its harness's login, and in older transcripts. `brainPool(brain, gatewayCredential)` returns a started session's billing pool; `sessionPool(session)` reads a recorded one's. A Claude Code child is in `apiKeys` if its gateway used an API key, otherwise in `claudePlan` (ADR 0013, ADR 0021).
|
|
60
|
+
`ChildSession.gatewayCredential` is the `GatewayCredentialKind` the gateway in front of the child's worker used for its model requests: none if the child used its harness's login, and in older transcripts. `brainPool(brain, gatewayCredential)` returns a started session's billing pool; `sessionPool(session)` reads a recorded one's. A Claude Code child is in `apiKeys` if its gateway used an API key, otherwise in `claudePlan`; a Codex child is in `apiKeys` if its gateway used an API key, otherwise in `chatgptPlan` (ADR 0013, ADR 0021). `GatewayLlmProvider` is `anthropic` (Claude Code) or `openai` (Codex).
|
|
59
61
|
|
|
60
|
-
The optional `SessionStarted.harnessSession` (`HarnessSession`) records the harness's `HarnessSessionId` and the worker `cwd`, apart from usine's session identity. Older transcripts decode
|
|
62
|
+
The optional `SessionStarted.harnessSession` (`HarnessSession`) records the harness's `HarnessSessionId` and the worker `cwd`, apart from usine's session identity. Its optional `home` is the directory the harness saved the session in when the attempt set one, Codex's `CODEX_HOME`. Older transcripts decode `harnessSession`, and a `HarnessSession` without `home`, to `Option.none()`.
|
|
61
63
|
|
|
62
64
|
Envelopes include `PROTOCOL_VERSION` (7), which the transcript store uses to read older envelopes. Version 7 added the previous attempt's pushed salvage to `RunSpec` (`resume`); version 6 added harness session metadata.
|
package/dist/agent/session.d.ts
CHANGED
|
@@ -26,8 +26,9 @@ declare const ChildSession_base: Schema.Class<ChildSession, Schema.TaggedStruct<
|
|
|
26
26
|
readonly agent: Schema.brand<Schema.String, "AgentName">;
|
|
27
27
|
readonly brain: typeof BrainSpec;
|
|
28
28
|
/**
|
|
29
|
-
* The credential kind the Gateway
|
|
30
|
-
* if the child used its harness's own login or the
|
|
29
|
+
* The credential kind the Gateway (ADR 0027) or a Cloudflare Worker's outbound handler used
|
|
30
|
+
* for the child's model requests, or `None` if the child used its harness's own login or the
|
|
31
|
+
* record is older.
|
|
31
32
|
*/
|
|
32
33
|
readonly gatewayCredential: Schema.withConstructorDefault<Schema.OptionFromOptionalKey<Schema.Literals<readonly ["api-key", "subscription"]>>>;
|
|
33
34
|
}>, {}>;
|
|
@@ -42,6 +43,11 @@ export type HarnessSessionId = typeof HarnessSessionId.Type;
|
|
|
42
43
|
declare const HarnessSession_base: Schema.Class<HarnessSession, Schema.Struct<{
|
|
43
44
|
readonly id: Schema.brand<Schema.NonEmptyString, "HarnessSessionId">;
|
|
44
45
|
readonly cwd: Schema.NonEmptyString;
|
|
46
|
+
/**
|
|
47
|
+
* The directory the harness saved the conversation in, if the Attempt set one in place of the
|
|
48
|
+
* harness's default: Codex's `CODEX_HOME`. `None` for the default or an older record.
|
|
49
|
+
*/
|
|
50
|
+
readonly home: Schema.withConstructorDefault<Schema.OptionFromOptionalKey<Schema.NonEmptyString>>;
|
|
45
51
|
}>, {}>;
|
|
46
52
|
/** A saved harness conversation; `cwd` is the Worker checkout to resume it from. */
|
|
47
53
|
export declare class HarnessSession extends HarnessSession_base {
|
|
@@ -98,27 +104,43 @@ declare const SessionResumed_base: Schema.Class<SessionResumed, Schema.TaggedStr
|
|
|
98
104
|
/** A live session that started another user turn in the same conversation. */
|
|
99
105
|
export declare class SessionResumed extends SessionResumed_base {
|
|
100
106
|
}
|
|
101
|
-
/** An estimated amount in US dollars from
|
|
107
|
+
/** An estimated amount in US dollars from a rate table, not a bill (ADR 0013). */
|
|
102
108
|
export declare const UsdAmount: Schema.brand<Schema.Finite, "UsdAmount">;
|
|
103
109
|
export type UsdAmount = typeof UsdAmount.Type;
|
|
110
|
+
declare const TokenBreakdown_base: Schema.Class<TokenBreakdown, Schema.Struct<{
|
|
111
|
+
/** Input tokens that are neither read from nor written to the prompt cache. */
|
|
112
|
+
readonly input: Schema.Int;
|
|
113
|
+
/** Input tokens read from the prompt cache. */
|
|
114
|
+
readonly cachedInput: Schema.Int;
|
|
115
|
+
/** Input tokens written to the prompt cache. */
|
|
116
|
+
readonly cacheWrite: Schema.Int;
|
|
117
|
+
/** Output tokens, including reasoning tokens. */
|
|
118
|
+
readonly output: Schema.Int;
|
|
119
|
+
}>, {}>;
|
|
120
|
+
/** A session's cumulative tokens per billing rate; each token counts in one field only. */
|
|
121
|
+
export declare class TokenBreakdown extends TokenBreakdown_base {
|
|
122
|
+
}
|
|
104
123
|
declare const SessionTokensUpdated_base: Schema.Class<SessionTokensUpdated, Schema.TaggedStruct<"SessionTokensUpdated", {
|
|
105
124
|
readonly session: Schema.Union<readonly [typeof ParentSession, typeof ChildSession]>;
|
|
106
125
|
readonly totalTokens: Schema.brand<Schema.Int, "TokenCount">;
|
|
107
126
|
readonly costUsd: Schema.withConstructorDefault<Schema.OptionFromOptionalKey<Schema.brand<Schema.Finite, "UsdAmount">>>;
|
|
127
|
+
readonly breakdown: Schema.withConstructorDefault<Schema.OptionFromOptionalKey<typeof TokenBreakdown>>;
|
|
108
128
|
}>, {}>;
|
|
109
129
|
/**
|
|
110
130
|
* The session's cumulative token count and price, including later operator turns. `costUsd` is
|
|
111
131
|
* `None` for harnesses that don't price usage, such as Codex, and for older transcripts.
|
|
132
|
+
* `breakdown` is `None` for harnesses other than Codex and for older transcripts.
|
|
112
133
|
*/
|
|
113
134
|
export declare class SessionTokensUpdated extends SessionTokensUpdated_base {
|
|
114
135
|
}
|
|
115
136
|
export declare const BillingPool: Schema.Literals<readonly ["apiKeys", "claudePlan", "chatgptPlan"]>;
|
|
116
137
|
export type BillingPool = typeof BillingPool.Type;
|
|
117
138
|
/**
|
|
118
|
-
* Returns the billing pool of a session with `brain` and the
|
|
139
|
+
* Returns the billing pool of a session with `brain` and the kind of the credential that a
|
|
140
|
+
* Gateway or a Cloudflare Worker's outbound handler injects, if any.
|
|
119
141
|
*
|
|
120
|
-
* - Claude Code: `apiKeys` if
|
|
121
|
-
* - Codex: `chatgptPlan`.
|
|
142
|
+
* - Claude Code: `apiKeys` if an API key is injected, otherwise `claudePlan` (ADR 0013).
|
|
143
|
+
* - Codex: `apiKeys` if an API key is injected, otherwise `chatgptPlan`.
|
|
122
144
|
* - Pi: `chatgptPlan` for `openai-codex/` models, otherwise `apiKeys` (ADR 0021).
|
|
123
145
|
*/
|
|
124
146
|
export declare const brainPool: (brain: BrainSpec, gatewayCredential: Option.Option<GatewayCredentialKind>) => BillingPool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/agent/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,mFAAmF;AACnF,eAAO,MAAM,cAAc,uDAA6D,CAAC;AACzF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,oHAAoH;AACpH,eAAO,MAAM,UAAU,wCAEtB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAIhD,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,gDAAuD,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAC;AAEhE,wGAAwG;AACxG,eAAO,MAAM,iBAAiB,+CAAsD,CAAC;AACrF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;;AAE9D,qBAAa,aAAc,SAAQ,kBAOlC;CAAG;;;;;;IAUA;;;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/agent/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAi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QpC;CAAG;;;IAOH,mDAAmD;;;AALrD,6EAA6E;AAC7E,qBAAa,iBAAkB,SAAQ,sBAMrC;CAAG;AAEL,eAAO,MAAM,iBAAiB,6RAY5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC"}
|
package/dist/agent/session.js
CHANGED
|
@@ -24,8 +24,9 @@ export class ChildSession extends Schema.TaggedClass("Agent/ChildSession")("Chil
|
|
|
24
24
|
agent: AgentName,
|
|
25
25
|
brain: BrainSpec,
|
|
26
26
|
/**
|
|
27
|
-
* The credential kind the Gateway
|
|
28
|
-
* if the child used its harness's own login or the
|
|
27
|
+
* The credential kind the Gateway (ADR 0027) or a Cloudflare Worker's outbound handler used
|
|
28
|
+
* for the child's model requests, or `None` if the child used its harness's own login or the
|
|
29
|
+
* record is older.
|
|
29
30
|
*/
|
|
30
31
|
gatewayCredential: Schema.OptionFromOptionalKey(GatewayCredentialKind).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
31
32
|
}) {
|
|
@@ -37,6 +38,11 @@ export const HarnessSessionId = Schema.NonEmptyString.pipe(Schema.brand("Harness
|
|
|
37
38
|
export class HarnessSession extends Schema.Class("Agent/HarnessSession")({
|
|
38
39
|
id: HarnessSessionId,
|
|
39
40
|
cwd: Schema.NonEmptyString,
|
|
41
|
+
/**
|
|
42
|
+
* The directory the harness saved the conversation in, if the Attempt set one in place of the
|
|
43
|
+
* harness's default: Codex's `CODEX_HOME`. `None` for the default or an older record.
|
|
44
|
+
*/
|
|
45
|
+
home: Schema.OptionFromOptionalKey(Schema.NonEmptyString).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
40
46
|
}) {
|
|
41
47
|
}
|
|
42
48
|
/** The session identity and the brain selected at launch. */
|
|
@@ -78,24 +84,40 @@ export class SessionIdle extends Schema.TaggedClass("Agent/SessionIdle")("Sessio
|
|
|
78
84
|
/** A live session that started another user turn in the same conversation. */
|
|
79
85
|
export class SessionResumed extends Schema.TaggedClass("Agent/SessionResumed")("SessionResumed", { session: AgentSession }) {
|
|
80
86
|
}
|
|
81
|
-
/** An estimated amount in US dollars from
|
|
87
|
+
/** An estimated amount in US dollars from a rate table, not a bill (ADR 0013). */
|
|
82
88
|
export const UsdAmount = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.brand("UsdAmount"));
|
|
89
|
+
const TokenTally = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
90
|
+
/** A session's cumulative tokens per billing rate; each token counts in one field only. */
|
|
91
|
+
export class TokenBreakdown extends Schema.Class("Agent/TokenBreakdown")({
|
|
92
|
+
/** Input tokens that are neither read from nor written to the prompt cache. */
|
|
93
|
+
input: TokenTally,
|
|
94
|
+
/** Input tokens read from the prompt cache. */
|
|
95
|
+
cachedInput: TokenTally,
|
|
96
|
+
/** Input tokens written to the prompt cache. */
|
|
97
|
+
cacheWrite: TokenTally,
|
|
98
|
+
/** Output tokens, including reasoning tokens. */
|
|
99
|
+
output: TokenTally,
|
|
100
|
+
}) {
|
|
101
|
+
}
|
|
83
102
|
/**
|
|
84
103
|
* The session's cumulative token count and price, including later operator turns. `costUsd` is
|
|
85
104
|
* `None` for harnesses that don't price usage, such as Codex, and for older transcripts.
|
|
105
|
+
* `breakdown` is `None` for harnesses other than Codex and for older transcripts.
|
|
86
106
|
*/
|
|
87
107
|
export class SessionTokensUpdated extends Schema.TaggedClass("Agent/SessionTokensUpdated")("SessionTokensUpdated", {
|
|
88
108
|
session: AgentSession,
|
|
89
109
|
totalTokens: TokenCount,
|
|
90
110
|
costUsd: Schema.OptionFromOptionalKey(UsdAmount).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
111
|
+
breakdown: Schema.OptionFromOptionalKey(TokenBreakdown).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
91
112
|
}) {
|
|
92
113
|
}
|
|
93
114
|
export const BillingPool = Schema.Literals(["apiKeys", "claudePlan", "chatgptPlan"]);
|
|
94
115
|
/**
|
|
95
|
-
* Returns the billing pool of a session with `brain` and the
|
|
116
|
+
* Returns the billing pool of a session with `brain` and the kind of the credential that a
|
|
117
|
+
* Gateway or a Cloudflare Worker's outbound handler injects, if any.
|
|
96
118
|
*
|
|
97
|
-
* - Claude Code: `apiKeys` if
|
|
98
|
-
* - Codex: `chatgptPlan`.
|
|
119
|
+
* - Claude Code: `apiKeys` if an API key is injected, otherwise `claudePlan` (ADR 0013).
|
|
120
|
+
* - Codex: `apiKeys` if an API key is injected, otherwise `chatgptPlan`.
|
|
99
121
|
* - Pi: `chatgptPlan` for `openai-codex/` models, otherwise `apiKeys` (ADR 0021).
|
|
100
122
|
*/
|
|
101
123
|
export const brainPool = (brain, gatewayCredential) => {
|
|
@@ -103,7 +125,7 @@ export const brainPool = (brain, gatewayCredential) => {
|
|
|
103
125
|
case "claude":
|
|
104
126
|
return Option.contains(gatewayCredential, "api-key") ? "apiKeys" : "claudePlan";
|
|
105
127
|
case "codex":
|
|
106
|
-
return "chatgptPlan";
|
|
128
|
+
return Option.contains(gatewayCredential, "api-key") ? "apiKeys" : "chatgptPlan";
|
|
107
129
|
case "pi":
|
|
108
130
|
return brain.model.startsWith("openai-codex/") ? "chatgptPlan" : "apiKeys";
|
|
109
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/agent/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,C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AM,CAAC,gBAAgB,CAAC,eAAe,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC;CACpD,CAAC;CAAG;AAEL,4EAA4E;AAC5E,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,CAC3D,6BAA6B,CAC9B,CAAC,uBAAuB,EAAE;IACzB,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,kBAAkB;CAC/B,CAAC;CAAG;AAEL,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAGjF;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,CACtD,wBAAwB,CACzB,CAAC,kBAAkB,EAAE;IACpB,OAAO,EAAE,YAAY;IACrB,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC,cAAc;IAC9B,oEAAoE;IACpE,OAAO,EAAE,eAAe;CACzB,CAAC;CAAG;AAEL,6EAA6E;AAC7E,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,CACvD,yBAAyB,CAC1B,CAAC,mBAAmB,EAAE;IACrB,OAAO,EAAE,YAAY;IACrB,mDAAmD;IACnD,OAAO,EAAE,eAAe;CACzB,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5C,cAAc;IACd,UAAU;IACV,WAAW;IACX,YAAY;IACZ,qBAAqB;IACrB,eAAe;IACf,WAAW;IACX,cAAc;IACd,oBAAoB;IACpB,gBAAgB;IAChB,iBAAiB;CAClB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateTime, Option, Schema } from "effect";
|
|
1
|
+
import { Array as EffectArray, DateTime, Option, Schema } from "effect";
|
|
2
2
|
import { Agent } from "../agent/agent.ts";
|
|
3
3
|
import { BrainSpec } from "../agent/brain.ts";
|
|
4
4
|
import { Comment } from "../step/result.ts";
|
|
@@ -12,6 +12,12 @@ export type AttemptNumber = typeof AttemptNumber.Type;
|
|
|
12
12
|
/** The task text for the agent: the interpolated loop prompt or the operator's edit-and-retry text. */
|
|
13
13
|
export declare const AttemptTask: Schema.brand<Schema.String, "AttemptTask">;
|
|
14
14
|
export type AttemptTask = typeof AttemptTask.Type;
|
|
15
|
+
/**
|
|
16
|
+
* Why the engine stops an Attempt's parent task: the operator canceled the Attempt (`cancel`), the
|
|
17
|
+
* Attempt failed (`failed`), or startup found the Attempt closed or not reattached (`startup`).
|
|
18
|
+
*/
|
|
19
|
+
export declare const StopReason: Schema.Literals<readonly ["cancel", "failed", "startup"]>;
|
|
20
|
+
export type StopReason = typeof StopReason.Type;
|
|
15
21
|
declare const AttemptContext_base: Schema.Class<AttemptContext, Schema.Struct<{
|
|
16
22
|
readonly task: Schema.brand<Schema.String, "AttemptTask">;
|
|
17
23
|
readonly agent: typeof Agent;
|
|
@@ -20,6 +26,36 @@ declare const AttemptContext_base: Schema.Class<AttemptContext, Schema.Struct<{
|
|
|
20
26
|
/** The task and Agent that an operator sets for a Run's later Attempts. */
|
|
21
27
|
export declare class AttemptContext extends AttemptContext_base {
|
|
22
28
|
}
|
|
29
|
+
declare const FailureResolution_base: Schema.Class<FailureResolution, Schema.Struct<{
|
|
30
|
+
readonly resolvedAt: Schema.DateTimeUtcFromString;
|
|
31
|
+
readonly operator: Schema.OptionFromNullOr<Schema.brand<Schema.String, "OperatorLogin">>;
|
|
32
|
+
}>, {}>;
|
|
33
|
+
/** An operator's resolution of a failed attempt; the login is absent if none is configured. */
|
|
34
|
+
export declare class FailureResolution extends FailureResolution_base {
|
|
35
|
+
}
|
|
36
|
+
declare const OutOfMemoryKills_base: Schema.Class<OutOfMemoryKills, Schema.Struct<{
|
|
37
|
+
readonly kills: Schema.Int;
|
|
38
|
+
readonly memoryMib: Schema.brand<Schema.Int, "ContainerMemoryMib">;
|
|
39
|
+
}>, {}>;
|
|
40
|
+
/**
|
|
41
|
+
* The processes that the kernel killed in an Attempt's containers because a container reached
|
|
42
|
+
* its memory limit, `memoryMib`: the limit of the last container that recorded kills.
|
|
43
|
+
*/
|
|
44
|
+
export declare class OutOfMemoryKills extends OutOfMemoryKills_base {
|
|
45
|
+
}
|
|
46
|
+
declare const ContainerOutOfMemoryKills_base: Schema.Class<ContainerOutOfMemoryKills, Schema.Struct<{
|
|
47
|
+
readonly container: Schema.brand<Schema.String, "ContainerId">;
|
|
48
|
+
readonly kills: Schema.Int;
|
|
49
|
+
readonly memoryMib: Schema.brand<Schema.Int, "ContainerMemoryMib">;
|
|
50
|
+
}>, {}>;
|
|
51
|
+
/**
|
|
52
|
+
* The processes that the kernel killed in one of an Attempt's containers, `container`, because it
|
|
53
|
+
* reached its memory limit, `memoryMib`. A reattachment runs the Attempt in a new container.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ContainerOutOfMemoryKills extends ContainerOutOfMemoryKills_base {
|
|
56
|
+
}
|
|
57
|
+
/** Returns the kills in `containers` together, with the memory limit of the last one. */
|
|
58
|
+
export declare const totalOutOfMemoryKills: (containers: EffectArray.NonEmptyReadonlyArray<ContainerOutOfMemoryKills>) => OutOfMemoryKills;
|
|
23
59
|
declare const Attempt_base: Schema.Class<Attempt, Schema.Struct<{
|
|
24
60
|
readonly id: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
25
61
|
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
@@ -34,10 +70,12 @@ declare const Attempt_base: Schema.Class<Attempt, Schema.Struct<{
|
|
|
34
70
|
readonly startedAt: Schema.DateTimeUtc;
|
|
35
71
|
readonly outcome: Schema.Option<Schema.Union<readonly [typeof import("./outcome.ts").AttemptSucceeded, typeof import("./outcome.ts").AttemptFailed, typeof import("./outcome.ts").AttemptCanceled]>>;
|
|
36
72
|
readonly endedAt: Schema.Option<Schema.DateTimeUtc>;
|
|
37
|
-
readonly salvage: Schema.Option<Schema.Union<readonly [typeof import("./salvage.ts").SalvagePushed, typeof import("./salvage.ts").SalvageRetained]>>;
|
|
73
|
+
readonly salvage: Schema.Option<Schema.Union<readonly [typeof import("./salvage.ts").SalvagePushed, typeof import("./salvage.ts").SalvagePartlyPushed, typeof import("./salvage.ts").SalvageRetained, typeof import("./salvage.ts").SalvageRejected]>>;
|
|
74
|
+
readonly failureResolution: Schema.withConstructorDefault<Schema.Option<typeof FailureResolution>>;
|
|
38
75
|
readonly start: Schema.withConstructorDefault<Schema.Option<Schema.Union<readonly [typeof import("./start.ts").StartedByEvent, typeof import("./start.ts").StartedByRetry, typeof import("./start.ts").StartedByEditAndRetry, typeof import("./start.ts").StartedByInfraRetry, typeof import("./start.ts").StartedAfterRestart]>>>;
|
|
39
76
|
readonly reattachedAt: Schema.withConstructorDefault<Schema.Option<Schema.DateTimeUtc>>;
|
|
40
77
|
readonly comments: Schema.withConstructorDefault<Schema.$Array<typeof Comment>>;
|
|
78
|
+
readonly outOfMemory: Schema.withConstructorDefault<Schema.Option<typeof OutOfMemoryKills>>;
|
|
41
79
|
}>, {}>;
|
|
42
80
|
/**
|
|
43
81
|
* One try of a Step on a Worker.
|
|
@@ -49,6 +87,8 @@ declare const Attempt_base: Schema.Class<Attempt, Schema.Struct<{
|
|
|
49
87
|
* - `reattachedAt`: the last time an orchestrator restart reattached the Attempt.
|
|
50
88
|
* - `comments`: the comments and reviews posted by an unsuccessful Attempt; a successful
|
|
51
89
|
* Attempt's are in the Step result.
|
|
90
|
+
* - `outOfMemory`: the processes the kernel killed in the Attempt's containers for memory, in all
|
|
91
|
+
* of them together; `None` if it killed none or the Attempt ran without a container.
|
|
52
92
|
*/
|
|
53
93
|
export declare class Attempt extends Attempt_base {
|
|
54
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attempt.d.ts","sourceRoot":"","sources":["../../src/attempt/attempt.ts"],"names":[],"mappings":"AAAA,OAAO,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AAyB,CAAC,KACvE,gBAIC,CAAC;;;;;;;;;;;;;;;;;;;;;;AAEL;;;;;;;;;;;;GAYG;AACH,qBAAa,OAAQ,SAAQ,YA4B3B;CAAG;;;;;;AAEL;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAIjC;CAAG;AAEL,0FAA0F;AAC1F,eAAO,MAAM,QAAQ,YAAa,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAShE,CAAC;AAeR,oEAAoE;AACpE,eAAO,MAAM,WAAW,WAAY,aAAa,MAAM,QAAQ,CAAC,GAAG,KAAG,OAGrE,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,cAAc,SAAU,aAAa,SAAS,aAAa,KAAG,OACX,CAAC;;;;;AAEjE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,mBAGlC;CAAG;AAEL;;;GAGG;AACH,eAAO,MAAM,eAAe,YAAa;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;CACzC,KAAG,OAA8F,CAAC"}
|
package/dist/attempt/attempt.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { DateTime, Effect, Option, Schema } from "effect";
|
|
1
|
+
import { Array as EffectArray, DateTime, Effect, Option, Schema } from "effect";
|
|
2
2
|
import { Agent, AgentName } from "../agent/agent.js";
|
|
3
3
|
import { BrainSpec, ModelId } from "../agent/brain.js";
|
|
4
|
+
import { closedStruct } from "../closed-struct.js";
|
|
5
|
+
import { OperatorLogin } from "../operator.js";
|
|
4
6
|
import { RunId } from "../run/run.js";
|
|
5
7
|
import { Comment } from "../step/result.js";
|
|
6
8
|
import { StepName } from "../step/step.js";
|
|
7
|
-
import { WorkerName } from "../worker.js";
|
|
9
|
+
import { ContainerId, ContainerMemoryMib, WorkerName } from "../worker.js";
|
|
8
10
|
import { AttemptFailure, isAutoRetryableFailure } from "./failure.js";
|
|
9
11
|
import { AttemptOutcome } from "./outcome.js";
|
|
10
12
|
import { AttemptSalvage } from "./salvage.js";
|
|
@@ -15,6 +17,11 @@ export const AttemptId = Schema.NonEmptyString.pipe(Schema.brand("AttemptId"));
|
|
|
15
17
|
export const AttemptNumber = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.brand("AttemptNumber"));
|
|
16
18
|
/** The task text for the agent: the interpolated loop prompt or the operator's edit-and-retry text. */
|
|
17
19
|
export const AttemptTask = Schema.String.check(Schema.isPattern(/\S/u, { message: "Expected non-blank task text" })).pipe(Schema.brand("AttemptTask"));
|
|
20
|
+
/**
|
|
21
|
+
* Why the engine stops an Attempt's parent task: the operator canceled the Attempt (`cancel`), the
|
|
22
|
+
* Attempt failed (`failed`), or startup found the Attempt closed or not reattached (`startup`).
|
|
23
|
+
*/
|
|
24
|
+
export const StopReason = Schema.Literals(["cancel", "failed", "startup"]);
|
|
18
25
|
/** The task and Agent that an operator sets for a Run's later Attempts. */
|
|
19
26
|
export class AttemptContext extends Schema.Class("AttemptContext")({
|
|
20
27
|
task: AttemptTask,
|
|
@@ -22,6 +29,37 @@ export class AttemptContext extends Schema.Class("AttemptContext")({
|
|
|
22
29
|
parentModel: Schema.OptionFromNullOr(ModelId),
|
|
23
30
|
}) {
|
|
24
31
|
}
|
|
32
|
+
/** An operator's resolution of a failed attempt; the login is absent if none is configured. */
|
|
33
|
+
export class FailureResolution extends Schema.Class("FailureResolution")(closedStruct({
|
|
34
|
+
resolvedAt: Schema.DateTimeUtcFromString,
|
|
35
|
+
operator: Schema.OptionFromNullOr(OperatorLogin),
|
|
36
|
+
})) {
|
|
37
|
+
}
|
|
38
|
+
const Kills = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
|
|
39
|
+
/**
|
|
40
|
+
* The processes that the kernel killed in an Attempt's containers because a container reached
|
|
41
|
+
* its memory limit, `memoryMib`: the limit of the last container that recorded kills.
|
|
42
|
+
*/
|
|
43
|
+
export class OutOfMemoryKills extends Schema.Class("OutOfMemoryKills")({
|
|
44
|
+
kills: Kills,
|
|
45
|
+
memoryMib: ContainerMemoryMib,
|
|
46
|
+
}) {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The processes that the kernel killed in one of an Attempt's containers, `container`, because it
|
|
50
|
+
* reached its memory limit, `memoryMib`. A reattachment runs the Attempt in a new container.
|
|
51
|
+
*/
|
|
52
|
+
export class ContainerOutOfMemoryKills extends Schema.Class("ContainerOutOfMemoryKills")({
|
|
53
|
+
container: ContainerId,
|
|
54
|
+
kills: Kills,
|
|
55
|
+
memoryMib: ContainerMemoryMib,
|
|
56
|
+
}) {
|
|
57
|
+
}
|
|
58
|
+
/** Returns the kills in `containers` together, with the memory limit of the last one. */
|
|
59
|
+
export const totalOutOfMemoryKills = (containers) => new OutOfMemoryKills({
|
|
60
|
+
kills: containers.reduce((total, { kills }) => total + kills, 0),
|
|
61
|
+
memoryMib: EffectArray.lastNonEmpty(containers).memoryMib,
|
|
62
|
+
});
|
|
25
63
|
/**
|
|
26
64
|
* One try of a Step on a Worker.
|
|
27
65
|
*
|
|
@@ -32,6 +70,8 @@ export class AttemptContext extends Schema.Class("AttemptContext")({
|
|
|
32
70
|
* - `reattachedAt`: the last time an orchestrator restart reattached the Attempt.
|
|
33
71
|
* - `comments`: the comments and reviews posted by an unsuccessful Attempt; a successful
|
|
34
72
|
* Attempt's are in the Step result.
|
|
73
|
+
* - `outOfMemory`: the processes the kernel killed in the Attempt's containers for memory, in all
|
|
74
|
+
* of them together; `None` if it killed none or the Attempt ran without a container.
|
|
35
75
|
*/
|
|
36
76
|
export class Attempt extends Schema.Class("Attempt")({
|
|
37
77
|
id: AttemptId,
|
|
@@ -48,9 +88,11 @@ export class Attempt extends Schema.Class("Attempt")({
|
|
|
48
88
|
outcome: Schema.Option(AttemptOutcome),
|
|
49
89
|
endedAt: Schema.Option(Schema.DateTimeUtc),
|
|
50
90
|
salvage: Schema.Option(AttemptSalvage),
|
|
91
|
+
failureResolution: Schema.Option(FailureResolution).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
51
92
|
start: Schema.Option(AttemptStart).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
52
93
|
reattachedAt: Schema.Option(Schema.DateTimeUtc).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
53
94
|
comments: Schema.Array(Comment).pipe(Schema.withConstructorDefault(Effect.succeed([]))),
|
|
95
|
+
outOfMemory: Schema.Option(OutOfMemoryKills).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
54
96
|
}) {
|
|
55
97
|
}
|
|
56
98
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attempt.js","sourceRoot":"","sources":["../../src/attempt/attempt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"attempt.js","sourceRoot":"","sources":["../../src/attempt/attempt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,kBAAkB,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AAC,EAAE,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAE,KAAoB,EAAW,EAAE,CACnF,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,KAAK,CAAiB,gBAAgB,CAAC,CAAC;IACjF,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;CACzC,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAI/B,EAAW,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Result, Schema } from "effect";
|
|
2
2
|
import { Agent } from "../agent/agent.ts";
|
|
3
|
-
import { AttemptId, type AttemptWindows } from "./attempt.ts";
|
|
3
|
+
import { AttemptId, type AttemptWindows, type ContainerOutOfMemoryKills } from "./attempt.ts";
|
|
4
4
|
import { type Comment, StepResult } from "../step/result.ts";
|
|
5
5
|
import { AttemptFailure } from "./failure.ts";
|
|
6
6
|
import { AttemptSalvage, SalvagePushed } from "./salvage.ts";
|
|
@@ -204,6 +204,12 @@ export interface Sink {
|
|
|
204
204
|
readonly salvage: (salvage: AttemptSalvage) => Effect.Effect<void, AttemptFailure>;
|
|
205
205
|
/** Records the comments and reviews an unsuccessful Attempt posted on the Run's Item. */
|
|
206
206
|
readonly comments: (comments: ReadonlyArray<Comment>) => Effect.Effect<void, AttemptFailure>;
|
|
207
|
+
/**
|
|
208
|
+
* Records the processes that the kernel killed in one of the Attempt's containers for memory.
|
|
209
|
+
* The kills of the Attempt's other containers stay; a second record of a container replaces
|
|
210
|
+
* its count.
|
|
211
|
+
*/
|
|
212
|
+
readonly outOfMemory: (kills: ContainerOutOfMemoryKills) => Effect.Effect<void, AttemptFailure>;
|
|
207
213
|
/** Reads the Attempt windows; harvesting runs it after GitHub lists the Attempt's comments. */
|
|
208
214
|
readonly windows: Effect.Effect<AttemptWindows, AttemptFailure>;
|
|
209
215
|
/** Reads the envelopes recorded by `append`, in order; reattach uses them to restore counters. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EACL,SAAS,EAET,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7D,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C,6GAA6G;AAC7G,eAAO,MAAM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AK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACnF,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC7F;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChG,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAChE,kGAAkG;IAClG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC;IAC3D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,QAAwD,CAAC;AAEvF,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAKD;;;GAGG;AACH,eAAO,MAAM,KAAK,aACN,QAAQ,aACP,SAAS,YACV,gBAAgB,KACzB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAuCnC,CAAC"}
|
package/dist/attempt/channel.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Effect, Option, Result, Schema } from "effect";
|
|
|
2
2
|
import { Agent } from "../agent/agent.js";
|
|
3
3
|
import { Effort, ModelId } from "../agent/brain.js";
|
|
4
4
|
import { AgentSessionEvent, AgentSessionId, ChildSessionBudget } from "../agent/session.js";
|
|
5
|
-
import { AttemptId, AttemptTask } from "./attempt.js";
|
|
5
|
+
import { AttemptId, AttemptTask, } from "./attempt.js";
|
|
6
6
|
import { RepositoryName, CommitSha, RepositoryRevision } from "../repository.js";
|
|
7
7
|
import { StepResult } from "../step/result.js";
|
|
8
8
|
import { BotLogin, WorkerName } from "../worker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACL,SAAS,EACT,WAAW,GAGZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAgB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EA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,KAAK,iBAAiB;QACpC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS;QACnC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAClC,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,sEAAsE;YAC/E,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI;SAC9B,CAAC,CAAC;IACL,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACxE,OAAO,MAAM,CAAC,IAAI,CAAC;YACjB,OAAO,EAAE,yDAAyD;YAClE,MAAM,EAAE,4BAA4B;SACrC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;QAC5D,YAAY,EAAE,QAAQ,CAAC,YAAY,GAAG,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Effect, Schema } from "effect";
|
|
1
|
+
import { type Effect, type Option, Schema } from "effect";
|
|
2
2
|
import type { LoopPermissions } from "../loop.ts";
|
|
3
3
|
import { type RepositoryName } from "../repository.ts";
|
|
4
4
|
import type { RunId } from "../run/run.ts";
|
|
@@ -16,6 +16,19 @@ declare const SalvagePushed_base: Schema.Class<SalvagePushed, Schema.TaggedStruc
|
|
|
16
16
|
/** Unfinished work committed and pushed to `ref`; `commit` is the pushed head. */
|
|
17
17
|
export declare class SalvagePushed extends SalvagePushed_base {
|
|
18
18
|
}
|
|
19
|
+
declare const SalvagePartlyPushed_base: Schema.Class<SalvagePartlyPushed, Schema.TaggedStruct<"PartlyPushed", {
|
|
20
|
+
readonly ref: Schema.brand<Schema.NonEmptyString, "SalvageRef">;
|
|
21
|
+
readonly commit: Schema.brand<Schema.String, "CommitSha">;
|
|
22
|
+
readonly path: Schema.NonEmptyString;
|
|
23
|
+
readonly message: Schema.String;
|
|
24
|
+
}>, {}>;
|
|
25
|
+
/**
|
|
26
|
+
* Unfinished work pushed to `ref` at `commit`, without files that the salvage can't push, such as
|
|
27
|
+
* a file over GitHub's size limit. The workspace at `path` on the Worker keeps their only copy,
|
|
28
|
+
* and `message` names them.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SalvagePartlyPushed extends SalvagePartlyPushed_base {
|
|
31
|
+
}
|
|
19
32
|
declare const SalvageRetained_base: Schema.Class<SalvageRetained, Schema.TaggedStruct<"Retained", {
|
|
20
33
|
readonly path: Schema.NonEmptyString;
|
|
21
34
|
readonly commit: Schema.OptionFromNullOr<Schema.brand<Schema.String, "CommitSha">>;
|
|
@@ -24,8 +37,20 @@ declare const SalvageRetained_base: Schema.Class<SalvageRetained, Schema.TaggedS
|
|
|
24
37
|
/** A failed salvage that left the workspace at `path` on the Worker. `commit` is `None` if inspection failed. */
|
|
25
38
|
export declare class SalvageRetained extends SalvageRetained_base {
|
|
26
39
|
}
|
|
40
|
+
declare const SalvageRejected_base: Schema.Class<SalvageRejected, Schema.TaggedStruct<"Rejected", {
|
|
41
|
+
readonly path: Schema.NonEmptyString;
|
|
42
|
+
readonly commit: Schema.brand<Schema.String, "CommitSha">;
|
|
43
|
+
readonly message: Schema.String;
|
|
44
|
+
}>, {}>;
|
|
45
|
+
/**
|
|
46
|
+
* A salvage whose push the remote refused for a reason that pushing again can't fix, such as a
|
|
47
|
+
* file over GitHub's size limit. It left the workspace at `path` on the Worker, and recovery
|
|
48
|
+
* doesn't push `commit` again.
|
|
49
|
+
*/
|
|
50
|
+
export declare class SalvageRejected extends SalvageRejected_base {
|
|
51
|
+
}
|
|
27
52
|
/** What the executor kept of the workspace of an unsuccessful Attempt. */
|
|
28
|
-
export declare const AttemptSalvage: Schema.Union<readonly [typeof SalvagePushed, typeof SalvageRetained]>;
|
|
53
|
+
export declare const AttemptSalvage: Schema.Union<readonly [typeof SalvagePushed, typeof SalvagePartlyPushed, typeof SalvageRetained, typeof SalvageRejected]>;
|
|
29
54
|
export type AttemptSalvage = typeof AttemptSalvage.Type;
|
|
30
55
|
/** A persisted Attempt whose checkout can still exist on its Worker. */
|
|
31
56
|
export interface AttemptRecovery {
|
|
@@ -39,6 +64,8 @@ export interface AttemptRecovery {
|
|
|
39
64
|
readonly succeeded: boolean;
|
|
40
65
|
/** Whether the Attempt has no outcome yet, so a restart can reattach it if its parent task runs. */
|
|
41
66
|
readonly open: boolean;
|
|
67
|
+
/** The recorded salvage that the remote rejected, whose commit recovery doesn't push again. */
|
|
68
|
+
readonly rejected: Option.Option<SalvageRejected>;
|
|
42
69
|
}
|
|
43
70
|
/** The storage that startup reconciliation uses for a persisted Attempt's salvage, comments, and windows. */
|
|
44
71
|
export interface RecoverySink<E> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salvage.d.ts","sourceRoot":"","sources":["../../src/attempt/salvage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"salvage.d.ts","sourceRoot":"","sources":["../../src/attempt/salvage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EA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