@llm4ts/shell 2.45.0 → 2.46.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 (64) hide show
  1. package/dist/Cli.d.ts +3 -7
  2. package/dist/Cli.d.ts.map +1 -1
  3. package/dist/Cli.js +20 -4
  4. package/dist/Cli.js.map +1 -1
  5. package/dist/FlowLaunch.d.ts +2 -16
  6. package/dist/FlowLaunch.d.ts.map +1 -1
  7. package/dist/FlowLaunch.js +20 -66
  8. package/dist/FlowLaunch.js.map +1 -1
  9. package/dist/FlowProcess.d.ts +67 -0
  10. package/dist/FlowProcess.d.ts.map +1 -0
  11. package/dist/FlowProcess.js +175 -0
  12. package/dist/FlowProcess.js.map +1 -0
  13. package/dist/Menu.d.ts +1 -1
  14. package/dist/Menu.d.ts.map +1 -1
  15. package/dist/OperatorActTools.d.ts +170 -0
  16. package/dist/OperatorActTools.d.ts.map +1 -0
  17. package/dist/OperatorActTools.js +332 -0
  18. package/dist/OperatorActTools.js.map +1 -0
  19. package/dist/OperatorConfig.d.ts +44 -0
  20. package/dist/OperatorConfig.d.ts.map +1 -0
  21. package/dist/OperatorConfig.js +88 -0
  22. package/dist/OperatorConfig.js.map +1 -0
  23. package/dist/OperatorNode.d.ts +45 -0
  24. package/dist/OperatorNode.d.ts.map +1 -0
  25. package/dist/OperatorNode.js +103 -0
  26. package/dist/OperatorNode.js.map +1 -0
  27. package/dist/OperatorRuns.d.ts +76 -0
  28. package/dist/OperatorRuns.d.ts.map +1 -0
  29. package/dist/OperatorRuns.js +146 -0
  30. package/dist/OperatorRuns.js.map +1 -0
  31. package/dist/OperatorServer.d.ts +160 -0
  32. package/dist/OperatorServer.d.ts.map +1 -0
  33. package/dist/OperatorServer.js +123 -0
  34. package/dist/OperatorServer.js.map +1 -0
  35. package/dist/OperatorTools.d.ts +558 -0
  36. package/dist/OperatorTools.d.ts.map +1 -0
  37. package/dist/OperatorTools.js +398 -0
  38. package/dist/OperatorTools.js.map +1 -0
  39. package/dist/Refine.d.ts +2 -2
  40. package/dist/Refine.d.ts.map +1 -1
  41. package/dist/Refine.js +3 -5
  42. package/dist/Refine.js.map +1 -1
  43. package/dist/RunSupervisor.d.ts +51 -0
  44. package/dist/RunSupervisor.d.ts.map +1 -0
  45. package/dist/RunSupervisor.js +282 -0
  46. package/dist/RunSupervisor.js.map +1 -0
  47. package/dist/ShellErrors.d.ts +9 -0
  48. package/dist/ShellErrors.d.ts.map +1 -0
  49. package/dist/ShellErrors.js +7 -0
  50. package/dist/ShellErrors.js.map +1 -0
  51. package/flows/port-guide.js +4 -1
  52. package/package.json +13 -4
  53. package/src/Cli.ts +64 -3
  54. package/src/FlowLaunch.ts +20 -66
  55. package/src/FlowProcess.ts +239 -0
  56. package/src/OperatorActTools.ts +407 -0
  57. package/src/OperatorConfig.ts +148 -0
  58. package/src/OperatorNode.ts +147 -0
  59. package/src/OperatorRuns.ts +270 -0
  60. package/src/OperatorServer.ts +192 -0
  61. package/src/OperatorTools.ts +610 -0
  62. package/src/Refine.ts +4 -7
  63. package/src/RunSupervisor.ts +403 -0
  64. package/src/ShellErrors.ts +6 -0
@@ -0,0 +1,175 @@
1
+ import { spawn } from "node:child_process";
2
+ import { closeSync, existsSync, mkdirSync, openSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import * as Deferred from "effect/Deferred";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Ref from "effect/Ref";
8
+ import * as Schema from "effect/Schema";
9
+ export class FlowLaunchError extends Schema.TaggedError()("FlowLaunch", {
10
+ message: Schema.String
11
+ }) {
12
+ }
13
+ /**
14
+ * True when the flow script cannot resolve `@llm4ts/runner` from its own
15
+ * location — a global flow, a built-in copy, or a bare repository. Project
16
+ * flows inside a repository that installs `@llm4ts/*` resolve their own pin
17
+ * and need no help (the project-wins policy of ADR 0006). Implemented as the
18
+ * same `node_modules` directory walk ESM resolution performs, so the check
19
+ * stays honest under test runners that patch the module system.
20
+ */
21
+ export const needsResolveFallback = (flowPath) => {
22
+ let directory = dirname(resolve(flowPath));
23
+ while (true) {
24
+ if (existsSync(join(directory, "node_modules", "@llm4ts", "runner", "package.json"))) {
25
+ return false;
26
+ }
27
+ const parent = dirname(directory);
28
+ if (parent === directory) {
29
+ return true;
30
+ }
31
+ directory = parent;
32
+ }
33
+ };
34
+ // In the published package the hook is the compiled sibling; when running
35
+ // from src (tests), it is the TypeScript source, which the child can load
36
+ // because it always runs with type stripping enabled.
37
+ const resolveFallbackUrl = (() => {
38
+ const compiled = new URL("./ResolveFallback.js", import.meta.url);
39
+ return existsSync(fileURLToPath(compiled))
40
+ ? compiled.href
41
+ : new URL("./ResolveFallback.ts", import.meta.url).href;
42
+ })();
43
+ export const flowNodeArgs = (flowPath) => [
44
+ "--experimental-strip-types",
45
+ ...(needsResolveFallback(flowPath) ? ["--import", resolveFallbackUrl] : [])
46
+ ];
47
+ const openAppend = (path) => {
48
+ mkdirSync(dirname(path), { recursive: true });
49
+ return openSync(path, "a");
50
+ };
51
+ export const nodeFlowProcess = {
52
+ start: (options) => Effect.callback((resume) => {
53
+ const exited = Deferred.makeUnsafe();
54
+ const fds = [];
55
+ const closeAll = () => {
56
+ for (const fd of fds.splice(0)) {
57
+ try {
58
+ closeSync(fd);
59
+ }
60
+ catch {
61
+ // already closed
62
+ }
63
+ }
64
+ };
65
+ let stdio;
66
+ try {
67
+ if (typeof options.stdio === "string") {
68
+ stdio = options.stdio;
69
+ }
70
+ else {
71
+ const out = openAppend(options.stdio.stdout);
72
+ fds.push(out);
73
+ const err = openAppend(options.stdio.stderr);
74
+ fds.push(err);
75
+ stdio = ["ignore", out, err];
76
+ }
77
+ }
78
+ catch (error) {
79
+ closeAll();
80
+ resume(Effect.fail(new FlowLaunchError({ message: error instanceof Error ? error.message : String(error) })));
81
+ return Effect.void;
82
+ }
83
+ const child = spawn(process.execPath, [...flowNodeArgs(options.flowPath), options.flowPath, ...options.args], {
84
+ stdio,
85
+ env: { ...options.environment },
86
+ ...(options.detached === true ? { detached: true } : {}),
87
+ ...(options.cwd === undefined ? {} : { cwd: options.cwd })
88
+ });
89
+ closeAll();
90
+ let started = false;
91
+ child.on("error", (error) => {
92
+ if (!started) {
93
+ resume(Effect.fail(new FlowLaunchError({ message: error.message })));
94
+ }
95
+ });
96
+ child.on("spawn", () => {
97
+ started = true;
98
+ resume(Effect.succeed({
99
+ pid: child.pid ?? 0,
100
+ exited: Deferred.await(exited),
101
+ signal: (signal) => Effect.sync(() => {
102
+ child.kill(signal);
103
+ })
104
+ }));
105
+ });
106
+ child.on("exit", (code, signal) => {
107
+ Deferred.doneUnsafe(exited, Effect.succeed({ code: code ?? undefined, signal: signal ?? undefined }));
108
+ });
109
+ return Effect.void;
110
+ }),
111
+ isAlive: (pid) => {
112
+ try {
113
+ process.kill(pid, 0);
114
+ return true;
115
+ }
116
+ catch {
117
+ return false;
118
+ }
119
+ },
120
+ signal: (pid, signal) => Effect.sync(() => {
121
+ try {
122
+ process.kill(pid, signal);
123
+ }
124
+ catch {
125
+ // already gone (ESRCH) or not ours to signal
126
+ }
127
+ })
128
+ };
129
+ export const makeFakeFlowProcess = () => Effect.gen(function* () {
130
+ const starts = yield* Ref.make([]);
131
+ const signals = yield* Ref.make([]);
132
+ const alive = yield* Ref.make(new Set());
133
+ const exits = new Map();
134
+ let nextPid = 1000;
135
+ const setMember = (pid, member) => Ref.update(alive, (set) => {
136
+ const next = new Set(set);
137
+ if (member) {
138
+ next.add(pid);
139
+ }
140
+ else {
141
+ next.delete(pid);
142
+ }
143
+ return next;
144
+ });
145
+ const process = {
146
+ start: (options) => Effect.gen(function* () {
147
+ const pid = nextPid++;
148
+ const exited = yield* Deferred.make();
149
+ exits.set(pid, exited);
150
+ yield* Ref.update(starts, (all) => [...all, options]);
151
+ yield* setMember(pid, true);
152
+ return {
153
+ pid,
154
+ exited: Deferred.await(exited),
155
+ signal: (signal) => Ref.update(signals, (all) => [...all, { pid, signal }])
156
+ };
157
+ }),
158
+ isAlive: (pid) => Ref.getUnsafe(alive).has(pid),
159
+ signal: (pid, signal) => Ref.update(signals, (all) => [...all, { pid, signal }])
160
+ };
161
+ return {
162
+ process,
163
+ started: Ref.get(starts),
164
+ signals: Ref.get(signals),
165
+ exit: (pid, exit) => Effect.gen(function* () {
166
+ yield* setMember(pid, false);
167
+ const deferred = exits.get(pid);
168
+ if (deferred !== undefined) {
169
+ yield* Deferred.succeed(deferred, exit);
170
+ }
171
+ }),
172
+ setAlive: (pid, value) => setMember(pid, value)
173
+ };
174
+ });
175
+ //# sourceMappingURL=FlowProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowProcess.js","sourceRoot":"","sources":["../src/FlowProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CAAC,YAAY,EAAE;IACvF,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAEL;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAChE,IAAI,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC1C,OAAO,IAAI,EAAE,CAAC;QACZ,I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AAC;aAC5E,CAAA;QACH,CAAC,CAAC;QACJ,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QAC/C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;KACjF,CAAA;IACD,OAAO;QACL,OAAO;QACP,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;QACxB,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC/B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YACzC,CAAC;QACH,CAAC,CAAC;QACJ,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;KAChD,CAAA;AACH,CAAC,CAAC,CAAA"}
package/dist/Menu.d.ts CHANGED
@@ -5,5 +5,5 @@ import { type FlowTierPaths } from "./FlowCatalog.ts";
5
5
  * The interactive main menu: run a flow, view a flow, exit. Ctrl-C inside a
6
6
  * prompt quits the menu cleanly rather than crashing the shell.
7
7
  */
8
- export declare const mainMenu: (tiers: FlowTierPaths) => Effect.Effect<void, import("./FlowLaunch.ts").FlowLaunchError, Prompt.Environment>;
8
+ export declare const mainMenu: (tiers: FlowTierPaths) => Effect.Effect<void, import("./FlowProcess.ts").FlowLaunchError, Prompt.Environment>;
9
9
  //# sourceMappingURL=Menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAuFzF;;;GAGG;AACH,eAAO,MAAM,QAAQ,8GA0BnB,CAAA"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAuFzF;;;GAGG;AACH,eAAO,MAAM,QAAQ,+GA0BnB,CAAA"}
@@ -0,0 +1,170 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
+ import * as Tool from "effect/ai/Tool";
4
+ import * as Toolkit from "effect/ai/Toolkit";
5
+ import { PersistenceError } from "@llm4ts/flow/FlowError";
6
+ import { InvalidKnob, NotAllowed, OperatorRun, ReadFailed, RunInProgress, RunWaitResult, UnknownEpic, UnknownFlow, UnknownRepo, UnknownRun, type OperatorKnobs } from "@llm4ts/flow/OperatorSchemas";
7
+ import { TraceUnreadable } from "@llm4ts/runner/RunReaders";
8
+ import { FlowLaunchError } from "./FlowProcess.ts";
9
+ import { type OperatorDeps } from "./OperatorTools.ts";
10
+ export declare const runWaitTool: Tool.Tool<"run_wait", {
11
+ readonly parameters: Schema.Struct<{
12
+ readonly runId: Schema.String;
13
+ readonly sinceSeq: Schema.optional<Schema.Int>;
14
+ readonly timeoutSeconds: Schema.optional<Schema.Int>;
15
+ }>;
16
+ readonly success: typeof RunWaitResult;
17
+ readonly failure: Schema.Union<readonly [typeof UnknownRun, typeof TraceUnreadable, typeof ReadFailed]>;
18
+ readonly failureMode: "error";
19
+ }, never>;
20
+ export declare const waitToolkit: Toolkit.Toolkit<{
21
+ readonly run_wait: Tool.Tool<"run_wait", {
22
+ readonly parameters: Schema.Struct<{
23
+ readonly runId: Schema.String;
24
+ readonly sinceSeq: Schema.optional<Schema.Int>;
25
+ readonly timeoutSeconds: Schema.optional<Schema.Int>;
26
+ }>;
27
+ readonly success: typeof RunWaitResult;
28
+ readonly failure: Schema.Union<readonly [typeof UnknownRun, typeof TraceUnreadable, typeof ReadFailed]>;
29
+ readonly failureMode: "error";
30
+ }, never>;
31
+ }>;
32
+ export declare const waitHandlers: (deps: OperatorDeps) => Toolkit.HandlersFrom<Toolkit.Tools<typeof waitToolkit>>;
33
+ export declare const StartedRun: Schema.Struct<{
34
+ readonly runId: Schema.String;
35
+ readonly tracePath: Schema.optionalKey<Schema.String>;
36
+ readonly pid: Schema.optionalKey<Schema.Int>;
37
+ }>;
38
+ export declare const startRunTool: Tool.Tool<"start_run", {
39
+ readonly parameters: Schema.Struct<{
40
+ readonly repo: Schema.optional<Schema.String>;
41
+ readonly flow: Schema.String;
42
+ readonly task: Schema.optional<Schema.String>;
43
+ readonly epic: Schema.optional<Schema.String>;
44
+ readonly pack: Schema.optional<Schema.String>;
45
+ readonly executors: Schema.optional<Schema.$Array<Schema.String>>;
46
+ readonly coder: Schema.optional<Schema.String>;
47
+ readonly judgeRounds: Schema.optional<Schema.Int>;
48
+ readonly mergeRevisions: Schema.optional<Schema.Int>;
49
+ readonly land: Schema.optional<Schema.String>;
50
+ readonly flags: Schema.optional<Schema.$Array<Schema.String>>;
51
+ readonly requestId: Schema.optional<Schema.String>;
52
+ }>;
53
+ readonly success: Schema.Struct<{
54
+ readonly runId: Schema.String;
55
+ readonly tracePath: Schema.optionalKey<Schema.String>;
56
+ readonly pid: Schema.optionalKey<Schema.Int>;
57
+ }>;
58
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof InvalidKnob, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof UnknownFlow, typeof ReadFailed, typeof FlowLaunchError, typeof RunInProgress, typeof PersistenceError]>;
59
+ readonly failureMode: "error";
60
+ }, never>;
61
+ export declare const stopRunTool: Tool.Tool<"stop_run", {
62
+ readonly parameters: Schema.Struct<{
63
+ readonly runId: Schema.String;
64
+ }>;
65
+ readonly success: typeof OperatorRun;
66
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof UnknownRun]>;
67
+ readonly failureMode: "error";
68
+ }, never>;
69
+ export declare const retroStartTool: Tool.Tool<"retro_start", {
70
+ readonly parameters: Schema.Struct<{
71
+ readonly repo: Schema.optional<Schema.String>;
72
+ readonly epic: Schema.String;
73
+ readonly run: Schema.optional<Schema.String>;
74
+ }>;
75
+ readonly success: Schema.Struct<{
76
+ readonly runId: Schema.String;
77
+ readonly tracePath: Schema.optionalKey<Schema.String>;
78
+ readonly pid: Schema.optionalKey<Schema.Int>;
79
+ }>;
80
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof InvalidKnob, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof UnknownFlow, typeof ReadFailed, typeof FlowLaunchError, typeof RunInProgress, typeof PersistenceError]>;
81
+ readonly failureMode: "error";
82
+ }, never>;
83
+ export declare const approveTool: Tool.Tool<"approve", {
84
+ readonly parameters: Schema.Struct<{
85
+ readonly repo: Schema.optional<Schema.String>;
86
+ readonly kind: Schema.Literals<readonly ["retro"]>;
87
+ readonly epic: Schema.String;
88
+ readonly id: Schema.String;
89
+ }>;
90
+ readonly success: Schema.Struct<{
91
+ readonly path: Schema.String;
92
+ readonly approved: Schema.Boolean;
93
+ }>;
94
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof ReadFailed, typeof PersistenceError]>;
95
+ readonly failureMode: "error";
96
+ }, never>;
97
+ export declare const actToolkit: Toolkit.Toolkit<{
98
+ readonly start_run: Tool.Tool<"start_run", {
99
+ readonly parameters: Schema.Struct<{
100
+ readonly repo: Schema.optional<Schema.String>;
101
+ readonly flow: Schema.String;
102
+ readonly task: Schema.optional<Schema.String>;
103
+ readonly epic: Schema.optional<Schema.String>;
104
+ readonly pack: Schema.optional<Schema.String>;
105
+ readonly executors: Schema.optional<Schema.$Array<Schema.String>>;
106
+ readonly coder: Schema.optional<Schema.String>;
107
+ readonly judgeRounds: Schema.optional<Schema.Int>;
108
+ readonly mergeRevisions: Schema.optional<Schema.Int>;
109
+ readonly land: Schema.optional<Schema.String>;
110
+ readonly flags: Schema.optional<Schema.$Array<Schema.String>>;
111
+ readonly requestId: Schema.optional<Schema.String>;
112
+ }>;
113
+ readonly success: Schema.Struct<{
114
+ readonly runId: Schema.String;
115
+ readonly tracePath: Schema.optionalKey<Schema.String>;
116
+ readonly pid: Schema.optionalKey<Schema.Int>;
117
+ }>;
118
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof InvalidKnob, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof UnknownFlow, typeof ReadFailed, typeof FlowLaunchError, typeof RunInProgress, typeof PersistenceError]>;
119
+ readonly failureMode: "error";
120
+ }, never>;
121
+ readonly stop_run: Tool.Tool<"stop_run", {
122
+ readonly parameters: Schema.Struct<{
123
+ readonly runId: Schema.String;
124
+ }>;
125
+ readonly success: typeof OperatorRun;
126
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof UnknownRun]>;
127
+ readonly failureMode: "error";
128
+ }, never>;
129
+ readonly retro_start: Tool.Tool<"retro_start", {
130
+ readonly parameters: Schema.Struct<{
131
+ readonly repo: Schema.optional<Schema.String>;
132
+ readonly epic: Schema.String;
133
+ readonly run: Schema.optional<Schema.String>;
134
+ }>;
135
+ readonly success: Schema.Struct<{
136
+ readonly runId: Schema.String;
137
+ readonly tracePath: Schema.optionalKey<Schema.String>;
138
+ readonly pid: Schema.optionalKey<Schema.Int>;
139
+ }>;
140
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof InvalidKnob, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof UnknownFlow, typeof ReadFailed, typeof FlowLaunchError, typeof RunInProgress, typeof PersistenceError]>;
141
+ readonly failureMode: "error";
142
+ }, never>;
143
+ readonly approve: Tool.Tool<"approve", {
144
+ readonly parameters: Schema.Struct<{
145
+ readonly repo: Schema.optional<Schema.String>;
146
+ readonly kind: Schema.Literals<readonly ["retro"]>;
147
+ readonly epic: Schema.String;
148
+ readonly id: Schema.String;
149
+ }>;
150
+ readonly success: Schema.Struct<{
151
+ readonly path: Schema.String;
152
+ readonly approved: Schema.Boolean;
153
+ }>;
154
+ readonly failure: Schema.Union<readonly [typeof NotAllowed, typeof UnknownRepo, typeof UnknownEpic, typeof UnknownRun, typeof ReadFailed, typeof PersistenceError]>;
155
+ readonly failureMode: "error";
156
+ }, never>;
157
+ }>;
158
+ /**
159
+ * Every client value that reaches the flow's argv or environment, checked
160
+ * before the supervisor sees it. Names stay names, never paths or flags:
161
+ * `pack` is a kit or kit/pack name (no `.`/`..` segment), `epic`, `coder` and
162
+ * executors are ids, `land` is a branch name. `task` is the flow's first
163
+ * positional argument, so it may not start with `-` (it would parse as a
164
+ * flag) or `@` (the flow parser reads `@<path>` as a prompt file on the
165
+ * server). `flags` is an allowlist of shapes: `--flag[=value]`, or a plain
166
+ * value right after a flag, never a reserved flag (`reservedFlags`).
167
+ */
168
+ export declare const validateKnobs: (knobs: OperatorKnobs) => Effect.Effect<OperatorKnobs, InvalidKnob>;
169
+ export declare const actHandlers: (deps: OperatorDeps) => Toolkit.HandlersFrom<Toolkit.Tools<typeof actToolkit>>;
170
+ //# sourceMappingURL=OperatorActTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperatorActT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