@usine/executor 0.0.1 → 0.2.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.
Files changed (74) hide show
  1. package/README.md +85 -2
  2. package/dist/child-command.d.ts +21 -0
  3. package/dist/child-command.d.ts.map +1 -0
  4. package/dist/child-command.js +50 -0
  5. package/dist/child-command.js.map +1 -0
  6. package/dist/exe-dev/channel.d.ts +11 -0
  7. package/dist/exe-dev/channel.d.ts.map +1 -0
  8. package/dist/exe-dev/channel.js +41 -0
  9. package/dist/exe-dev/channel.js.map +1 -0
  10. package/dist/exe-dev/commands.d.ts +22 -0
  11. package/dist/exe-dev/commands.d.ts.map +1 -0
  12. package/dist/exe-dev/commands.js +66 -0
  13. package/dist/exe-dev/commands.js.map +1 -0
  14. package/dist/exe-dev/exe-dev.d.ts +8 -0
  15. package/dist/exe-dev/exe-dev.d.ts.map +1 -0
  16. package/dist/exe-dev/exe-dev.js +153 -0
  17. package/dist/exe-dev/exe-dev.js.map +1 -0
  18. package/dist/exe-dev/grants.d.ts +8 -0
  19. package/dist/exe-dev/grants.d.ts.map +1 -0
  20. package/dist/exe-dev/grants.js +104 -0
  21. package/dist/exe-dev/grants.js.map +1 -0
  22. package/dist/exe-dev/model.d.ts +43 -0
  23. package/dist/exe-dev/model.d.ts.map +1 -0
  24. package/dist/exe-dev/model.js +26 -0
  25. package/dist/exe-dev/model.js.map +1 -0
  26. package/dist/exe-dev/preflight.d.ts +10 -0
  27. package/dist/exe-dev/preflight.d.ts.map +1 -0
  28. package/dist/exe-dev/preflight.js +82 -0
  29. package/dist/exe-dev/preflight.js.map +1 -0
  30. package/dist/exe-dev/shell.d.ts +12 -0
  31. package/dist/exe-dev/shell.d.ts.map +1 -0
  32. package/dist/exe-dev/shell.js +31 -0
  33. package/dist/exe-dev/shell.js.map +1 -0
  34. package/dist/exe-dev/sweep.d.ts +10 -0
  35. package/dist/exe-dev/sweep.d.ts.map +1 -0
  36. package/dist/exe-dev/sweep.js +117 -0
  37. package/dist/exe-dev/sweep.js.map +1 -0
  38. package/dist/executor.d.ts +118 -0
  39. package/dist/executor.d.ts.map +1 -0
  40. package/dist/executor.js +98 -0
  41. package/dist/executor.js.map +1 -0
  42. package/dist/harness-preflight.d.ts +6 -0
  43. package/dist/harness-preflight.d.ts.map +1 -0
  44. package/dist/harness-preflight.js +50 -0
  45. package/dist/harness-preflight.js.map +1 -0
  46. package/dist/invalid-frame.d.ts +17 -0
  47. package/dist/invalid-frame.d.ts.map +1 -0
  48. package/dist/invalid-frame.js +111 -0
  49. package/dist/invalid-frame.js.map +1 -0
  50. package/dist/keyed-lock.d.ts +11 -0
  51. package/dist/keyed-lock.d.ts.map +1 -0
  52. package/dist/keyed-lock.js +21 -0
  53. package/dist/keyed-lock.js.map +1 -0
  54. package/dist/local/local.d.ts +20 -0
  55. package/dist/local/local.d.ts.map +1 -0
  56. package/dist/local/local.js +273 -0
  57. package/dist/local/local.js.map +1 -0
  58. package/dist/prepared-attempt.d.ts +5 -0
  59. package/dist/prepared-attempt.d.ts.map +1 -0
  60. package/dist/prepared-attempt.js +40 -0
  61. package/dist/prepared-attempt.js.map +1 -0
  62. package/dist/provision.d.ts +43 -0
  63. package/dist/provision.d.ts.map +1 -0
  64. package/dist/provision.js +147 -0
  65. package/dist/provision.js.map +1 -0
  66. package/dist/run-host-session.d.ts +26 -0
  67. package/dist/run-host-session.d.ts.map +1 -0
  68. package/dist/run-host-session.js +241 -0
  69. package/dist/run-host-session.js.map +1 -0
  70. package/package.json +21 -5
  71. package/dist/index.d.ts +0 -8
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/index.js +0 -8
  74. package/dist/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAmB,MAAM,yBAAyB,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a,QAAS,SAAQ,aAoBC;CAAG"}
@@ -0,0 +1,98 @@
1
+ import { Agent } from "@usine/core/agent";
2
+ import { BrainSpec, Effort, ModelId } from "@usine/core/agent/brain";
3
+ import { ChildSessionBudget } from "@usine/core/agent/session";
4
+ import { AttemptTask, AttemptId } from "@usine/core/attempt";
5
+ import * as AttemptChannel from "@usine/core/attempt/channel";
6
+ import { AttemptFailure } from "@usine/core/attempt/failure";
7
+ import { RepositoryName, RepositoryRevision } from "@usine/core/repository";
8
+ import { WorkerName, WorkerKind } from "@usine/core/worker";
9
+ import { StepResult } from "@usine/core/step/result";
10
+ import { Context, Effect, Redacted, Schema, Scope } from "effect";
11
+ /** The Worker operation that failed during readiness checks or an Attempt's lifecycle. */
12
+ export const ExecutorOperation = Schema.Literals([
13
+ "preflight",
14
+ "prepare",
15
+ "launch",
16
+ "cancel",
17
+ "cleanup",
18
+ ]);
19
+ /** A prerequisite a Worker must satisfy before it can accept Attempts. */
20
+ export const WorkerCapability = Schema.Literals([
21
+ "machine",
22
+ "toolchain",
23
+ "run-host",
24
+ "harness-login",
25
+ "credentials",
26
+ ]);
27
+ /** A Worker operation failed before its requested work completed. */
28
+ export class ExecutorOperationError extends Schema.TaggedError("@usine/executor/ExecutorOperationError")("ExecutorOperationError", {
29
+ operation: ExecutorOperation,
30
+ message: Schema.NonEmptyString,
31
+ cause: Schema.Defect(),
32
+ }) {
33
+ }
34
+ /** A Worker could not obtain access to the repository assigned to an Attempt. */
35
+ export class CredentialUnavailableError extends Schema.TaggedError("@usine/executor/CredentialUnavailableError")("CredentialUnavailableError", {
36
+ repository: RepositoryName,
37
+ message: Schema.NonEmptyString,
38
+ cause: Schema.Defect(),
39
+ }) {
40
+ }
41
+ /** A verify-only preflight found a Worker capability missing or incompatible. */
42
+ export class WorkerCapabilityError extends Schema.TaggedError("@usine/executor/WorkerCapabilityError")("WorkerCapabilityError", {
43
+ worker: WorkerName,
44
+ capability: WorkerCapability,
45
+ message: Schema.NonEmptyString,
46
+ cause: Schema.Defect(),
47
+ }) {
48
+ }
49
+ /** A readiness, access, or lifecycle failure reported by a Worker operation. */
50
+ export const ExecutorError = Schema.Union([
51
+ ExecutorOperationError,
52
+ CredentialUnavailableError,
53
+ WorkerCapabilityError,
54
+ ]);
55
+ /** Logs every preflight refusal so a missing capability is explainable from logs alone. */
56
+ export const logPreflightFailure = (effect) => Effect.tapError(effect, (error) => error instanceof WorkerCapabilityError
57
+ ? Effect.logError("Worker preflight failed", {
58
+ error: error._tag,
59
+ message: error.message,
60
+ worker: error.worker,
61
+ capability: error.capability,
62
+ })
63
+ : Effect.logError("Worker preflight failed", {
64
+ error: error._tag,
65
+ message: error.message,
66
+ }));
67
+ /** The repository, revision, and Agent task assigned to a Worker for one fresh Attempt checkout. */
68
+ export class CheckoutRequest extends Schema.Class("@usine/executor/CheckoutRequest")({
69
+ attemptId: AttemptId,
70
+ worker: WorkerName,
71
+ repository: RepositoryName,
72
+ revision: RepositoryRevision,
73
+ payload: Schema.Json,
74
+ task: AttemptTask,
75
+ agent: Agent,
76
+ parentModel: Schema.Option(ModelId),
77
+ maxChildren: ChildSessionBudget,
78
+ /** Maximum minutes of live run-host execution; preparation and resource cleanup are outside this budget. */
79
+ maxAttemptMinutes: Schema.Int.check(Schema.isGreaterThan(0)),
80
+ parentEffort: Effort,
81
+ }) {
82
+ }
83
+ /** One Attempt's disposable checkout directory. */
84
+ export const WorktreePath = Schema.NonEmptyString.pipe(Schema.brand("WorktreePath"));
85
+ /** The serializable location and RunSpec of an Attempt checkout. Owning this record does not grant access to live resources or credentials. */
86
+ export class AttemptWorkspace extends Schema.Class("@usine/executor/AttemptWorkspace")({
87
+ worker: WorkerName,
88
+ spec: AttemptChannel.RunSpec,
89
+ worktree: WorktreePath,
90
+ }) {
91
+ }
92
+ /** Mints exactly one repository-scoped credential for each prepared Attempt. */
93
+ export class CredentialProvider extends Context.Service()("@usine/executor/CredentialProvider") {
94
+ }
95
+ /** Prepares isolated checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
96
+ export class Executor extends Context.Service()("@usine/executor/Executor") {
97
+ }
98
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAElE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/C,WAAW;IACX,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;CACV,CAAC,CAAC;AAGH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC9C,SAAS;IACT,WAAW;IACX,UAAU;IACV,eAAe;IACf,aAAa;CACd,CAAC,CAAC;AAGH,qEAAqE;AACrE,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAC5D,wCAAwC,CACzC,CAAC,wBAAwB,EAAE;IAC1B,SAAS,EAAE,iBA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AK,CAAC,OAAO;KACvB,CAAC,CACP,CAAC;AAQJ,oGAAoG;AACpG,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,KAAK,CAC/C,iCAAiC,CAClC,CAAC;IACA,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,UAAU;IAClB,UAAU,EAAE,cAAc;IAC1B,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE,MAAM,CAAC,IAAI;IACpB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;IACnC,WAAW,EAAE,kBAAkB;IAC/B,4GAA4G;IAC5G,iBAAiB,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5D,YAAY,EAAE,MAAM;CACrB,CAAC;CAAG;AAEL,mDAAmD;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAGrF,+IAA+I;AAC/I,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,KAAK,CAChD,kCAAkC,CACnC,CAAC;IACA,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,cAAc,CAAC,OAAO;IAC5B,QAAQ,EAAE,YAAY;CACvB,CAAC;CAAG;AAmBL,gFAAgF;AAChF,MAAM,OAAO,kBAAmB,SAAQ,OAAO,CAAC,OAAO,EAQpD,CAAC,oCAAoC,CAAC;CAAG;AAE5C,uGAAuG;AACvG,MAAM,OAAO,QAAS,SAAQ,OAAO,CAAC,OAAO,EAoB1C,CAAC,0BAA0B,CAAC;CAAG"}
@@ -0,0 +1,6 @@
1
+ import { BrainSpec } from "@usine/core/agent/brain";
2
+ import { Effect } from "effect";
3
+ import { ExecutorOperationError, type RunHostCommand, WorkerCapabilityError } from "./executor.ts";
4
+ /** Uses the installed run host so both adapters check the same worker-side harness contract. */
5
+ export declare const verifyHarnesses: (worker: string & import("effect/Brand").Brand<"WorkerName">, brains: readonly BrainSpec[], runHost: RunHostCommand, execute: (command: string, args: ReadonlyArray<string>) => Effect.Effect<string, ExecutorOperationError>) => Effect.Effect<undefined, import("./executor.ts").CredentialUnavailableError | ExecutorOperationError | WorkerCapabilityError, never>;
6
+ //# sourceMappingURL=harness-preflight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-preflight.d.ts","sourceRoot":"","sources":["../src/harness-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAgB,MAAM,EAAU,MAAM,QAAQ,CAAC;AACtD,OAAO,EAEL,sBAAsB,EACtB,KAAK,cAAc,EACnB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAEvB,gGAAgG;AAChG,eAAO,MAAM,eAAe,0IAKf,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,KACxB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,yIA2D7B,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { BrainSpec } from "@usine/core/agent/brain";
2
+ import { HarnessReadiness } from "@usine/core/agent/capability";
3
+ import { Array as Arr, Effect, Schema } from "effect";
4
+ import { logPreflightFailure, ExecutorOperationError, WorkerCapabilityError, } from "./executor.js";
5
+ /** Uses the installed run host so both adapters check the same worker-side harness contract. */
6
+ export const verifyHarnesses = Effect.fn("Executor.verifyHarnesses")(function* (worker, brains, runHost, execute) {
7
+ yield* Effect.annotateCurrentSpan({ worker });
8
+ const distinct = Arr.dedupe(brains);
9
+ for (const brain of distinct) {
10
+ // Only a worker's readiness report proves a capability gap. Transport
11
+ // failures and timeouts remain infrastructure failures eligible for retry.
12
+ const response = yield* execute(runHost.command, [
13
+ ...runHost.args,
14
+ "--preflight",
15
+ Schema.encodeSync(Schema.fromJsonString(BrainSpec))(brain),
16
+ ]).pipe(Effect.timeout("75 seconds"), Effect.catchTag("TimeoutError", (cause) => new ExecutorOperationError({
17
+ operation: "preflight",
18
+ message: `Worker ${worker} did not finish probing ${brain.harness} readiness`,
19
+ cause,
20
+ })));
21
+ const result = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(HarnessReadiness))(response, { onExcessProperty: "error" }).pipe(Effect.mapError(() => new WorkerCapabilityError({
22
+ worker,
23
+ capability: "run-host",
24
+ message: `Worker ${worker} returned an invalid harness preflight response; update its run host`,
25
+ cause: new Error("invalid harness readiness response"),
26
+ })));
27
+ if (result.harness !== brain.harness)
28
+ return yield* new WorkerCapabilityError({
29
+ worker,
30
+ capability: "run-host",
31
+ message: `Worker ${worker} returned readiness for the wrong harness`,
32
+ cause: new Error("harness readiness mismatch"),
33
+ });
34
+ if (result._tag === "HarnessUnavailableError")
35
+ return yield* new WorkerCapabilityError({
36
+ worker,
37
+ capability: result.capability === "login" ? "harness-login" : "toolchain",
38
+ message: result.message,
39
+ cause: result,
40
+ });
41
+ yield* Effect.logInfo("Worker harness preflight verified", {
42
+ worker,
43
+ harness: brain.harness,
44
+ model: brain.model,
45
+ });
46
+ }
47
+ if (distinct.length === 0)
48
+ yield* Effect.logDebug("No rostered harnesses to preflight", { worker });
49
+ }, logPreflightFailure);
50
+ //# sourceMappingURL=harness-preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-preflight.js","sourceRoot":"","sources":["../src/harness-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,gGAAgG;AAChG,MAAM,CAAC,MA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CAAC,CACL,CACF,CAAC;QACF,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;YAClC,OAAO,KAAK,CAAC,CAAC,IAAI,qBAAqB,CAAC;gBACtC,MAAM;gBACN,UAAU,EAAE,UAAU;gBACtB,OAAO,EAAE,UAAU,MAAM,2CAA2C;gBACpE,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC;aAC/C,CAAC,CAAC;QACL,IAAI,MAAM,CAAC,IAAI,KAAK,yBAAyB;YAC3C,OAAO,KAAK,CAAC,CAAC,IAAI,qBAAqB,CAAC;gBACtC,MAAM;gBACN,UAAU,EAAE,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;gBACzE,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;QACL,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,EAAE;YACzD,MAAM;YACN,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;IACL,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7E,CAAC,EAAE,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ type FrameSource = "effect-log" | "json" | "non-json";
2
+ export interface InvalidFrameDiagnostic {
3
+ readonly byteLength: number;
4
+ readonly eventTag: string | undefined;
5
+ readonly issues: ReadonlyArray<{
6
+ readonly message: string;
7
+ readonly path: string;
8
+ }>;
9
+ readonly payloadTag: string | undefined;
10
+ readonly source: FrameSource;
11
+ readonly version: number | undefined;
12
+ }
13
+ /** Describes an invalid frame by shape and schema metadata only, never by its content. */
14
+ export declare const invalidFrameDiagnostic: (line: string, cause: unknown) => InvalidFrameDiagnostic;
15
+ export declare const invalidFrameMessage: (diagnostic: InvalidFrameDiagnostic) => string;
16
+ export {};
17
+ //# sourceMappingURL=invalid-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-frame.d.ts","sourceRoot":"","sources":["../src/invalid-frame.ts"],"names":[],"mappings":"AAkEA,KAAK,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAeD,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,SAAU,MAAM,SAAS,OAAO,KAAG,sBAgCrE,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,sBAAsB,KAAG,MAUxE,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { Option, Schema, SchemaIssue } from "effect";
2
+ const encoder = new TextEncoder();
3
+ const SAFE_TAG_VALUES = [
4
+ "Started",
5
+ "SessionEvent",
6
+ "Final",
7
+ "Failed",
8
+ "Interrupted",
9
+ "SessionStarted",
10
+ "TextOutput",
11
+ "ToolStarted",
12
+ "ToolFinished",
13
+ "PoolRateLimitsUpdated",
14
+ "SessionFinished",
15
+ ];
16
+ const SafeFrameTag = Schema.Literals(SAFE_TAG_VALUES);
17
+ const FramePreview = Schema.Struct({
18
+ version: Schema.optionalKey(Schema.Int),
19
+ payload: Schema.optionalKey(Schema.Struct({
20
+ _tag: Schema.optionalKey(Schema.String),
21
+ event: Schema.optionalKey(Schema.Struct({ _tag: Schema.optionalKey(Schema.String) })),
22
+ })),
23
+ });
24
+ const decodeJsonOption = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Json));
25
+ const decodeFramePreviewOption = Schema.decodeUnknownOption(FramePreview);
26
+ const decodeSafeFrameTagOption = Schema.decodeUnknownOption(SafeFrameTag);
27
+ const SAFE_PATH_SEGMENTS = new Set([
28
+ "version",
29
+ "attemptId",
30
+ "sequence",
31
+ "sentAt",
32
+ "payload",
33
+ "_tag",
34
+ "event",
35
+ "session",
36
+ "id",
37
+ "parentId",
38
+ "agent",
39
+ "brain",
40
+ "harness",
41
+ "model",
42
+ "effort",
43
+ "callId",
44
+ "tool",
45
+ "input",
46
+ "output",
47
+ "isError",
48
+ "text",
49
+ "pool",
50
+ "rateLimits",
51
+ "limitId",
52
+ "limitName",
53
+ "primary",
54
+ "secondary",
55
+ "usedPercent",
56
+ "windowDurationMinutes",
57
+ "resetsAt",
58
+ "parentModel",
59
+ "parentEffort",
60
+ "result",
61
+ "failure",
62
+ ]);
63
+ const formatSchemaIssues = SchemaIssue.makeFormatterStandardSchemaV1();
64
+ const safeIssuePath = (path) => path
65
+ .map((segment) => {
66
+ const value = String(segment);
67
+ return SAFE_PATH_SEGMENTS.has(value) ? value : "<unexpected>";
68
+ })
69
+ .join(".");
70
+ /** Describes an invalid frame by shape and schema metadata only, never by its content. */
71
+ export const invalidFrameDiagnostic = (line, cause) => {
72
+ const byteLength = encoder.encode(line).byteLength;
73
+ const parsed = decodeJsonOption(line);
74
+ if (Option.isNone(parsed)) {
75
+ return {
76
+ byteLength,
77
+ eventTag: undefined,
78
+ issues: [],
79
+ payloadTag: undefined,
80
+ source: /^\[\d{2}:\d{2}:\d{2}[.\]]/u.test(line) ? "effect-log" : "non-json",
81
+ version: undefined,
82
+ };
83
+ }
84
+ const preview = decodeFramePreviewOption(parsed.value);
85
+ const issues = Schema.isSchemaError(cause)
86
+ ? formatSchemaIssues(cause.issue).issues.map((issue) => ({
87
+ message: issue.message.slice(0, 200),
88
+ path: safeIssuePath(issue.path ?? []),
89
+ }))
90
+ : [];
91
+ return {
92
+ byteLength,
93
+ eventTag: Option.flatMap(preview, ({ payload }) => decodeSafeFrameTagOption(payload?.event?._tag)).pipe(Option.getOrUndefined),
94
+ issues,
95
+ payloadTag: Option.flatMap(preview, ({ payload }) => decodeSafeFrameTagOption(payload?._tag)).pipe(Option.getOrUndefined),
96
+ source: "json",
97
+ version: Option.map(preview, ({ version }) => version).pipe(Option.getOrUndefined),
98
+ };
99
+ };
100
+ export const invalidFrameMessage = (diagnostic) => {
101
+ if (diagnostic.source !== "json") {
102
+ return diagnostic.source === "effect-log"
103
+ ? "The run host wrote a log line to its protocol output"
104
+ : "The run host emitted malformed JSON";
105
+ }
106
+ const first = diagnostic.issues[0];
107
+ return first === undefined
108
+ ? "The run host emitted a schema-invalid frame"
109
+ : `The run host emitted a schema-invalid frame at ${first.path || "<root>"}: ${first.message}`;
110
+ };
111
+ //# sourceMappingURL=invalid-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-frame.js","sourceRoot":"","sources":["../src/invalid-frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,cAAc;IACd,OAAO;IACP,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,uBAAuB;IACvB,iBAAiB;CACT,CAAC;AACX,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,MAA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,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAChD,wBAAwB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAC/C,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7B,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAClD,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CACxC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;KACnF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAkC,EAAU,EAAE;IAChF,IAAI,UAAU,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,UAAU,CAAC,MAAM,KAAK,YAAY;YACvC,CAAC,CAAC,sDAAsD;YACxD,CAAC,CAAC,qCAAqC,CAAC;IAC5C,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO,KAAK,KAAK,SAAS;QACxB,CAAC,CAAC,6CAA6C;QAC/C,CAAC,CAAC,kDAAkD,KAAK,CAAC,IAAI,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;AACnG,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Effect } from "effect";
2
+ export interface KeyedLock<in K> {
3
+ readonly withLock: (key: K) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
4
+ }
5
+ /**
6
+ * One mutex per key. `PartitionedSemaphore` is not this: its `permits` option
7
+ * is one shared pool and the partition key only orders waiters, so
8
+ * `make({ permits: 1 })` serializes every key behind a single global permit.
9
+ */
10
+ export declare const keyedLockFor: <K>() => Effect.Effect<KeyedLock<K>>;
11
+ //# sourceMappingURL=keyed-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyed-lock.d.ts","sourceRoot":"","sources":["../src/keyed-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAEhD,MAAM,WAAW,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CACjB,GAAG,EAAE,CAAC,KACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAC1E;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,OAAK,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAcxD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Effect, Ref, Semaphore } from "effect";
2
+ /**
3
+ * One mutex per key. `PartitionedSemaphore` is not this: its `permits` option
4
+ * is one shared pool and the partition key only orders waiters, so
5
+ * `make({ permits: 1 })` serializes every key behind a single global permit.
6
+ */
7
+ export const keyedLockFor = () => Effect.map(Ref.make(new Map()), (locks) => ({
8
+ withLock: (key) => {
9
+ const semaphore = Ref.modify(locks, (current) => {
10
+ const existing = current.get(key);
11
+ if (existing !== undefined)
12
+ return [existing, current];
13
+ const created = Semaphore.makeUnsafe(1);
14
+ const next = new Map(current);
15
+ next.set(key, created);
16
+ return [created, next];
17
+ });
18
+ return (effect) => Effect.flatMap(semaphore, (lock) => Semaphore.withPermit(lock, effect));
19
+ },
20
+ }));
21
+ //# sourceMappingURL=keyed-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyed-lock.js","sourceRoot":"","sources":["../src/keyed-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAQhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAmC,EAAE,CAC/D,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,EAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAClE,QAAQ,EAAE,CAAC,GAAM,EAAE,EAAE;QACnB,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;YAChE,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACvB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAU,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,OAAO,CAAU,MAA8B,EAA0B,EAAE,CACzE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5E,CAAC;CACF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { RepositoryName } from "@usine/core/repository";
2
+ import { InstanceDirectory } from "@usine/core/instance";
3
+ import { Effect, FileSystem, Layer, Path } from "effect";
4
+ import { ChildProcessSpawner } from "effect/unstable/process";
5
+ import { CredentialProvider, Executor, type RunHostCommand } from "../executor.ts";
6
+ export type { RunHostCommand } from "../executor.ts";
7
+ /** Storage and run-host settings for Attempts executed on the local machine. */
8
+ export interface LocalExecutorOptions {
9
+ /** Factory folder under which local Worker caches and Attempt checkouts are stored. */
10
+ readonly instanceDirectory: InstanceDirectory;
11
+ /** How to launch the one-shot run host; the composition root resolves it. */
12
+ readonly runHost: RunHostCommand;
13
+ /** Repository fetch URL override, for example a local mirror; defaults to the GitHub HTTPS clone URL. */
14
+ readonly repositoryUrl?: (repository: RepositoryName) => string;
15
+ /** Grace for delivering a stop request, then for the run host to exit; each wait is bounded separately. Defaults to two seconds. */
16
+ readonly interruptGrace?: Parameters<typeof Effect.timeoutOption>[1];
17
+ }
18
+ /** Runs Attempts in isolated checkouts on the local machine. Requires Node; worker contracts are platform-free. */
19
+ export declare const layer: (options: LocalExecutorOptions) => Layer.Layer<Executor, never, CredentialProvider | FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
20
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/local/local.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,UAAU,EACV,KAAK,EACL,IAAI,EAML,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAgB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAEL,kBAAkB,EAClB,QAAQ,EAKR,KAAK,cAAc,EAGpB,MAAM,gBAAgB,CAAC;AAaxB,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACvF,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,yGAAyG;IACzG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,MAAM,CAAC;IAChE,oIAAoI;IACpI,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACtE;AAmVD,mHAAmH;AACnH,eAAO,MAAM,KAAK,YACP,oBAAoB,KAC5B,KAAK,CAAC,KAAK,CACZ,QAAQ,EACR,KAAK,EACL,kBAAkB,GAAG,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,mBAAmB,CAC3C,CAAC"}