@karowanorg/orc-core 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts.d.ts +3 -7
- package/dist/engine.js +0 -1
- package/dist/status.js +0 -1
- package/dist/supervisor.d.ts +2 -2
- package/dist/supervisor.js +7 -18
- package/package.json +1 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ export interface Proc {
|
|
|
35
35
|
pid: number | undefined;
|
|
36
36
|
}
|
|
37
37
|
export interface Executor {
|
|
38
|
-
/** undefined for local; the ssh destination string otherwise (e.g. "build@ci-box"). */
|
|
39
|
-
readonly host: string | undefined;
|
|
40
38
|
spawn(cmd: string[], opts?: SpawnOptions): Proc;
|
|
41
39
|
/** Run a command to completion, capturing output. */
|
|
42
40
|
run(cmd: string[], opts?: SpawnOptions & {
|
|
@@ -80,7 +78,6 @@ export interface LeafRequest {
|
|
|
80
78
|
reasoningEffort?: string;
|
|
81
79
|
readOnly: boolean;
|
|
82
80
|
cwd: string;
|
|
83
|
-
host?: string;
|
|
84
81
|
approvalMode: ApprovalMode;
|
|
85
82
|
sessionId?: string;
|
|
86
83
|
idleTimeoutMs?: number | false;
|
|
@@ -95,6 +92,8 @@ export interface LeafRequest {
|
|
|
95
92
|
*/
|
|
96
93
|
sandbox?: boolean;
|
|
97
94
|
sandboxDirs?: string[];
|
|
95
|
+
/** Permit outbound network while retaining the requested filesystem sandbox. */
|
|
96
|
+
networkAccess?: boolean;
|
|
98
97
|
}
|
|
99
98
|
export type HarnessEvent = {
|
|
100
99
|
kind: "tool-call-open";
|
|
@@ -175,7 +174,6 @@ export interface ThunkSpec {
|
|
|
175
174
|
schema?: Json;
|
|
176
175
|
readOnly: boolean;
|
|
177
176
|
cwd?: string;
|
|
178
|
-
host?: string;
|
|
179
177
|
phase?: string;
|
|
180
178
|
idleTimeoutMs?: number | false;
|
|
181
179
|
groupId?: string;
|
|
@@ -261,7 +259,6 @@ export interface LeafTraceRecord {
|
|
|
261
259
|
harness?: string;
|
|
262
260
|
model?: string;
|
|
263
261
|
reasoningEffort?: string;
|
|
264
|
-
host?: string;
|
|
265
262
|
cwd?: string;
|
|
266
263
|
readOnly: boolean;
|
|
267
264
|
startMs: number;
|
|
@@ -320,12 +317,12 @@ export interface RunManifest {
|
|
|
320
317
|
programPath: string;
|
|
321
318
|
programSha256: string;
|
|
322
319
|
cwd: string;
|
|
323
|
-
host?: string;
|
|
324
320
|
brief: string;
|
|
325
321
|
allowWrites: boolean;
|
|
326
322
|
approvalMode: ApprovalMode;
|
|
327
323
|
sandbox: boolean;
|
|
328
324
|
sandboxDirs: string[];
|
|
325
|
+
networkAccess: boolean;
|
|
329
326
|
maxParallel: number;
|
|
330
327
|
idleTimeoutMs: number | false;
|
|
331
328
|
/** Reactive USD cap: the run fails once observed estimated cost exceeds this. */
|
|
@@ -343,7 +340,6 @@ export interface LeafStatus {
|
|
|
343
340
|
status: "pending" | "running" | "ok" | "error";
|
|
344
341
|
readOnly: boolean;
|
|
345
342
|
harness?: string;
|
|
346
|
-
host?: string;
|
|
347
343
|
startMs?: number;
|
|
348
344
|
endMs?: number;
|
|
349
345
|
error?: string;
|
package/dist/engine.js
CHANGED
package/dist/status.js
CHANGED
|
@@ -61,7 +61,6 @@ export function projectStatus(manifest, journal, traces) {
|
|
|
61
61
|
if (tr.attempt < currentAttempt)
|
|
62
62
|
continue;
|
|
63
63
|
leaf.harness = tr.harness;
|
|
64
|
-
leaf.host = tr.host;
|
|
65
64
|
leaf.startMs = tr.startMs;
|
|
66
65
|
leaf.endMs = tr.endMs;
|
|
67
66
|
if (tr.status === "running" && (tr.attempt > currentAttempt || leaf.status === "pending")) {
|
package/dist/supervisor.d.ts
CHANGED
|
@@ -4,17 +4,17 @@ export interface Registry {
|
|
|
4
4
|
harnesses: Map<string, Harness>;
|
|
5
5
|
extensions: Map<string, ExtensionLeaf>;
|
|
6
6
|
defaultHarness: string;
|
|
7
|
-
|
|
7
|
+
executor: Executor;
|
|
8
8
|
}
|
|
9
9
|
export interface LaunchOptions {
|
|
10
10
|
programPath: string;
|
|
11
11
|
cwd?: string;
|
|
12
|
-
host?: string;
|
|
13
12
|
brief: string;
|
|
14
13
|
allowWrites?: boolean;
|
|
15
14
|
approvalMode?: RunManifest["approvalMode"];
|
|
16
15
|
sandbox?: boolean;
|
|
17
16
|
sandboxDirs?: string[];
|
|
17
|
+
networkAccess?: boolean;
|
|
18
18
|
maxParallel?: number;
|
|
19
19
|
idleTimeout?: number | false;
|
|
20
20
|
budgetUsd?: number;
|
package/dist/supervisor.js
CHANGED
|
@@ -22,18 +22,9 @@ export function sourceRequestsWrite(source) {
|
|
|
22
22
|
}
|
|
23
23
|
export async function prepareRun(opts, registry) {
|
|
24
24
|
const { bundle, sha256 } = await compileProgram(opts.programPath);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let cwd;
|
|
29
|
-
if (opts.host) {
|
|
30
|
-
cwd = opts.cwd ?? ".";
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
cwd = fs.realpathSync(path.resolve(opts.cwd ?? process.cwd()));
|
|
34
|
-
if (!fs.statSync(cwd).isDirectory())
|
|
35
|
-
throw new Error(`cwd is not a directory: ${cwd}`);
|
|
36
|
-
}
|
|
25
|
+
const cwd = fs.realpathSync(path.resolve(opts.cwd ?? process.cwd()));
|
|
26
|
+
if (!fs.statSync(cwd).isDirectory())
|
|
27
|
+
throw new Error(`cwd is not a directory: ${cwd}`);
|
|
37
28
|
const brief = opts.brief?.trim();
|
|
38
29
|
if (!brief)
|
|
39
30
|
throw new Error("brief is required");
|
|
@@ -46,12 +37,12 @@ export async function prepareRun(opts, registry) {
|
|
|
46
37
|
programPath: path.resolve(opts.programPath),
|
|
47
38
|
programSha256: sha256,
|
|
48
39
|
cwd,
|
|
49
|
-
host: opts.host,
|
|
50
40
|
brief,
|
|
51
41
|
allowWrites: opts.allowWrites ?? false,
|
|
52
42
|
approvalMode: opts.approvalMode ?? "auto",
|
|
53
43
|
sandbox: opts.sandbox ?? false,
|
|
54
44
|
sandboxDirs: opts.sandboxDirs ?? [],
|
|
45
|
+
networkAccess: opts.networkAccess ?? false,
|
|
55
46
|
maxParallel: Math.min(opts.maxParallel ?? DEFAULT_POLICY.maxParallel, 64),
|
|
56
47
|
idleTimeoutMs: opts.idleTimeout ?? 15 * 60_000,
|
|
57
48
|
budgetUsd: opts.budgetUsd,
|
|
@@ -616,9 +607,8 @@ class Supervisor {
|
|
|
616
607
|
// -------------------------------------------------------------------------
|
|
617
608
|
async executeLeaf(leaf) {
|
|
618
609
|
const { spec, seq, attempt } = leaf;
|
|
619
|
-
const host = spec.host ?? this.manifest.host;
|
|
620
610
|
const cwd = spec.cwd ?? this.manifest.cwd;
|
|
621
|
-
const executor = this.registry.
|
|
611
|
+
const executor = this.registry.executor;
|
|
622
612
|
let rev = 0;
|
|
623
613
|
const startMs = Date.now();
|
|
624
614
|
const toolCalls = new Map();
|
|
@@ -637,7 +627,6 @@ class Supervisor {
|
|
|
637
627
|
phase: spec.phase,
|
|
638
628
|
kind: spec.kind,
|
|
639
629
|
harness: spec.kind === "agent" ? (spec.harness ?? this.manifest.defaultHarness) : undefined,
|
|
640
|
-
host,
|
|
641
630
|
cwd,
|
|
642
631
|
readOnly: spec.readOnly,
|
|
643
632
|
startMs,
|
|
@@ -704,11 +693,11 @@ class Supervisor {
|
|
|
704
693
|
reasoningEffort: spec.reasoningEffort,
|
|
705
694
|
readOnly: spec.readOnly,
|
|
706
695
|
cwd,
|
|
707
|
-
host,
|
|
708
696
|
approvalMode: this.manifest.approvalMode,
|
|
709
697
|
idleTimeoutMs: leaf.idleTimeoutMs,
|
|
710
698
|
sandbox: this.manifest.sandbox,
|
|
711
699
|
sandboxDirs: this.manifest.sandboxDirs,
|
|
700
|
+
networkAccess: this.manifest.networkAccess,
|
|
712
701
|
};
|
|
713
702
|
let result;
|
|
714
703
|
let errorMsg;
|
|
@@ -978,7 +967,7 @@ function isRetryable(error) {
|
|
|
978
967
|
// model call and delays the real failure. Config/routing errors plus the
|
|
979
968
|
// structured-output schema rejections (OpenAI/codex strict mode) are all
|
|
980
969
|
// author-fixable, not transient.
|
|
981
|
-
return !/unknown harness|unknown extension|unregistered extension|fails inputSchema|
|
|
970
|
+
return !/unknown harness|unknown extension|unregistered extension|fails inputSchema|allow_writes|invalid_json_schema|invalid schema|unsupported schema|additionalProperties|output[\s_-]?schema|result exceeds cap|result is not valid JSON/i.test(error);
|
|
982
971
|
}
|
|
983
972
|
function attemptKey(seq, attempt) {
|
|
984
973
|
return `${seq}:${attempt}`;
|