@odla-ai/cli 0.41.1 → 0.42.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/bin/odla-ai.js +2 -3
- package/bin/workspace-build.d.ts +1 -0
- package/bin/workspace-build.js +8 -0
- package/dist/bin.cjs +36 -22
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-6RGM4W73.js → chunk-74DXL2MT.js} +36 -22
- package/dist/chunk-74DXL2MT.js.map +1 -0
- package/dist/{cli-N5PASRYU.js → cli-EGZGMIKB.js} +2 -2
- package/dist/index.cjs +35 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6RGM4W73.js.map +0 -1
- /package/dist/{cli-N5PASRYU.js.map → cli-EGZGMIKB.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runCli
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-74DXL2MT.js";
|
|
5
5
|
import {
|
|
6
6
|
exitCodeFor
|
|
7
7
|
} from "./chunk-UKLSRQ5J.js";
|
|
@@ -9,4 +9,4 @@ export {
|
|
|
9
9
|
exitCodeFor,
|
|
10
10
|
runCli
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=cli-
|
|
12
|
+
//# sourceMappingURL=cli-EGZGMIKB.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -6275,7 +6275,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
|
|
|
6275
6275
|
}
|
|
6276
6276
|
}
|
|
6277
6277
|
|
|
6278
|
-
// ../harness/dist/chunk-
|
|
6278
|
+
// ../harness/dist/chunk-QZXCQSPZ.js
|
|
6279
6279
|
var import_crypto = require("crypto");
|
|
6280
6280
|
var import_promises5 = require("fs/promises");
|
|
6281
6281
|
var import_path5 = require("path");
|
|
@@ -6612,7 +6612,7 @@ function validateSnapshot(snapshot, limits) {
|
|
|
6612
6612
|
}
|
|
6613
6613
|
}
|
|
6614
6614
|
|
|
6615
|
-
// ../harness/dist/chunk-
|
|
6615
|
+
// ../harness/dist/chunk-QZXCQSPZ.js
|
|
6616
6616
|
var import_child_process4 = require("child_process");
|
|
6617
6617
|
var import_promises6 = require("fs/promises");
|
|
6618
6618
|
var import_path6 = require("path");
|
|
@@ -6915,7 +6915,7 @@ function looksLikeDestination(value2) {
|
|
|
6915
6915
|
return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text3) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text3);
|
|
6916
6916
|
}
|
|
6917
6917
|
|
|
6918
|
-
// ../harness/dist/chunk-
|
|
6918
|
+
// ../harness/dist/chunk-QZXCQSPZ.js
|
|
6919
6919
|
var import_promises10 = require("fs/promises");
|
|
6920
6920
|
var import_promises11 = require("fs/promises");
|
|
6921
6921
|
var import_path10 = require("path");
|
|
@@ -7183,7 +7183,7 @@ async function buildCodeGraph(input) {
|
|
|
7183
7183
|
return builder.build();
|
|
7184
7184
|
}
|
|
7185
7185
|
|
|
7186
|
-
// ../harness/dist/chunk-
|
|
7186
|
+
// ../harness/dist/chunk-QZXCQSPZ.js
|
|
7187
7187
|
var import_crypto4 = require("crypto");
|
|
7188
7188
|
async function digestStagedWorkspace(root, limits) {
|
|
7189
7189
|
const files = [];
|
|
@@ -8012,7 +8012,7 @@ var CodeRuntimeCheckpointManager = class {
|
|
|
8012
8012
|
await this.options.event(command, { type: "message", actor: "system", body: prepared.note }, active.conversationRefs).catch(() => void 0);
|
|
8013
8013
|
await active.workspace.cleanup();
|
|
8014
8014
|
await this.options.event(command, { type: "status", status: "checkpointed" }, active.conversationRefs).catch(() => void 0);
|
|
8015
|
-
return { status: "checkpointed", checkpoint: prepared.checkpoint, message: "
|
|
8015
|
+
return { status: "checkpointed", checkpoint: prepared.checkpoint, message: "Theseus stopped at a portable checkpoint" };
|
|
8016
8016
|
}
|
|
8017
8017
|
async acknowledged(command, result) {
|
|
8018
8018
|
if (command.kind !== "checkpoint_stop" || result.status !== "checkpointed") return false;
|
|
@@ -8237,7 +8237,7 @@ async function materializeCommandWorkspace(input) {
|
|
|
8237
8237
|
await materialized.cleanup();
|
|
8238
8238
|
}
|
|
8239
8239
|
}
|
|
8240
|
-
var V1_SYSTEM_PROMPT = `You are
|
|
8240
|
+
var V1_SYSTEM_PROMPT = `You are Theseus, the coding agent inside an odla Code harness.
|
|
8241
8241
|
Use only the odla_read, odla_apply_git_diff, and odla_run_recipe tools.
|
|
8242
8242
|
For mutations, call odla_apply_git_diff with raw git diff text. It must start
|
|
8243
8243
|
with "diff --git a/<path> b/<path>", include matching "---" and "+++" file
|
|
@@ -8284,7 +8284,12 @@ function codeSkill(opts) {
|
|
|
8284
8284
|
{ lease: opts.lease, workspaceDir: opts.workspaceDir, signal },
|
|
8285
8285
|
{ requestId: `bench-${tool}-${++seq}`, tool, input }
|
|
8286
8286
|
);
|
|
8287
|
-
opts.onToolCall?.({
|
|
8287
|
+
opts.onToolCall?.({
|
|
8288
|
+
tool,
|
|
8289
|
+
ok: response2.ok,
|
|
8290
|
+
durationMs: Date.now() - startedAt,
|
|
8291
|
+
...response2.ok ? {} : { error: String(response2.content).slice(0, 300) }
|
|
8292
|
+
});
|
|
8288
8293
|
return { content: response2.content, isError: !response2.ok };
|
|
8289
8294
|
};
|
|
8290
8295
|
const read22 = {
|
|
@@ -8315,11 +8320,17 @@ function codeSkill(opts) {
|
|
|
8315
8320
|
};
|
|
8316
8321
|
const runRecipe = {
|
|
8317
8322
|
name: "odla_run_recipe",
|
|
8318
|
-
description:
|
|
8323
|
+
description: `Run one app-registered build or test recipe through CaMeL policy.${opts.recipeIds?.length ? ` Available recipes: ${opts.recipeIds.join(", ")}.` : ""}`,
|
|
8319
8324
|
inputSchema: {
|
|
8320
8325
|
type: "object",
|
|
8321
8326
|
required: ["recipeId"],
|
|
8322
|
-
properties: { recipeId: {
|
|
8327
|
+
properties: { recipeId: {
|
|
8328
|
+
type: "string",
|
|
8329
|
+
minLength: 1,
|
|
8330
|
+
maxLength: 120,
|
|
8331
|
+
pattern: "^[a-zA-Z0-9._:-]+$",
|
|
8332
|
+
...opts.recipeIds?.length ? { enum: [...opts.recipeIds] } : {}
|
|
8333
|
+
} },
|
|
8323
8334
|
additionalProperties: false
|
|
8324
8335
|
},
|
|
8325
8336
|
handler: (input, ctx) => call4("sandbox.run_recipe", input, ctx.signal)
|
|
@@ -8401,6 +8412,7 @@ async function runCodeAgent(options) {
|
|
|
8401
8412
|
lease: options.lease,
|
|
8402
8413
|
workspaceDir: options.workspaceDir,
|
|
8403
8414
|
surface,
|
|
8415
|
+
...options.recipeIds ? { recipeIds: options.recipeIds } : {},
|
|
8404
8416
|
onToolCall: (call4) => {
|
|
8405
8417
|
toolCalls.push(call4);
|
|
8406
8418
|
options.onToolCall?.(call4);
|
|
@@ -8429,7 +8441,7 @@ async function runCodeAgent(options) {
|
|
|
8429
8441
|
}
|
|
8430
8442
|
async function runCodeAgentAttempt(options) {
|
|
8431
8443
|
try {
|
|
8432
|
-
const surface = options.surface ?? "
|
|
8444
|
+
const surface = options.surface ?? "v3";
|
|
8433
8445
|
const { run } = await runCodeAgent({
|
|
8434
8446
|
inference: options.inference,
|
|
8435
8447
|
broker: options.broker,
|
|
@@ -8440,6 +8452,7 @@ async function runCodeAgentAttempt(options) {
|
|
|
8440
8452
|
// id only labels the request the control plane is about to rewrite.
|
|
8441
8453
|
model: "brokered",
|
|
8442
8454
|
surface,
|
|
8455
|
+
...options.recipeIds ? { recipeIds: options.recipeIds } : {},
|
|
8443
8456
|
...options.maxSteps === void 0 ? {} : { maxSteps: options.maxSteps },
|
|
8444
8457
|
...options.budget ? { budget: options.budget } : {},
|
|
8445
8458
|
...options.signal ? { signal: options.signal } : {},
|
|
@@ -9375,7 +9388,7 @@ async function appendCodeRuntimeEvent(control, command, event, refs) {
|
|
|
9375
9388
|
}
|
|
9376
9389
|
var digestRuntimeValue = (value2) => `sha256:${(0, import_crypto4.createHash)("sha256").update(value2).digest("hex")}`;
|
|
9377
9390
|
var runtimeErrorMessage = (value2) => value2 instanceof Error ? value2.message : String(value2);
|
|
9378
|
-
var
|
|
9391
|
+
var TheseusRuntimeEngine = class {
|
|
9379
9392
|
constructor(options) {
|
|
9380
9393
|
this.options = options;
|
|
9381
9394
|
this.#attempt = options.runAgentAttempt ?? runCodeAgentAttempt;
|
|
@@ -9461,7 +9474,7 @@ var CodePiRuntimeEngine = class {
|
|
|
9461
9474
|
await this.#failure(command, active, detail);
|
|
9462
9475
|
return null;
|
|
9463
9476
|
});
|
|
9464
|
-
return { status: "running", message: resume ? "
|
|
9477
|
+
return { status: "running", message: resume ? "Theseus resumed from a portable checkpoint" : "Theseus started" };
|
|
9465
9478
|
}
|
|
9466
9479
|
/**
|
|
9467
9480
|
* Pursue a goal: attempt, judge with the clean verifier, re-prompt from what
|
|
@@ -9549,7 +9562,7 @@ var CodePiRuntimeEngine = class {
|
|
|
9549
9562
|
await this.#failure(command, active, detail);
|
|
9550
9563
|
return null;
|
|
9551
9564
|
});
|
|
9552
|
-
return { status: "running", message: "
|
|
9565
|
+
return { status: "running", message: "Theseus accepted the owner prompt" };
|
|
9553
9566
|
}
|
|
9554
9567
|
async #runAttempt(command, metadata2, active) {
|
|
9555
9568
|
const lease = fakeCodeLease(command, metadata2);
|
|
@@ -9574,7 +9587,8 @@ var CodePiRuntimeEngine = class {
|
|
|
9574
9587
|
lease,
|
|
9575
9588
|
workspaceDir: active.workspace.workspaceDir,
|
|
9576
9589
|
prompt: metadata2.prompt,
|
|
9577
|
-
signal: active.abort.signal
|
|
9590
|
+
signal: active.abort.signal,
|
|
9591
|
+
recipeIds: this.options.recipes.map((recipe2) => recipe2.id)
|
|
9578
9592
|
});
|
|
9579
9593
|
const closing = result.finalText.trim();
|
|
9580
9594
|
const completed = result.status === "completed" && Boolean(closing);
|
|
@@ -9638,7 +9652,7 @@ var CodePiRuntimeEngine = class {
|
|
|
9638
9652
|
}
|
|
9639
9653
|
}
|
|
9640
9654
|
async #diagnostic(command, active, value2) {
|
|
9641
|
-
const detail = value2.trim().slice(0, 2e3) || "
|
|
9655
|
+
const detail = value2.trim().slice(0, 2e3) || "Theseus runtime failed";
|
|
9642
9656
|
this.options.onDiagnostic?.(detail);
|
|
9643
9657
|
await this.#event(
|
|
9644
9658
|
command,
|
|
@@ -9968,8 +9982,9 @@ async function codeConnect(options) {
|
|
|
9968
9982
|
const appId = requestedAppId ?? cfg?.app.id;
|
|
9969
9983
|
const platform = (options.platform ?? cfg?.platformUrl ?? process.env.ODLA_PLATFORM_URL ?? "https://odla.ai").replace(/\/+$/, "");
|
|
9970
9984
|
const appEnv = options.env ?? (cfg ? cfg.envs.includes("dev") ? "dev" : cfg.envs[0] : void 0);
|
|
9971
|
-
|
|
9972
|
-
|
|
9985
|
+
const explicitEnv = options.env !== void 0;
|
|
9986
|
+
if (appEnv !== "dev" && appEnv !== "prod" || !explicitEnv && cfg && !cfg.envs.includes(appEnv)) {
|
|
9987
|
+
throw new Error(cfg ? `Code env "${appEnv ?? ""}" must be dev or prod and declared in ${options.configPath}, unless dev or prod is passed explicitly` : `Code env "${appEnv ?? ""}" must be dev or prod; pass --env explicitly when there is no ${options.configPath}`);
|
|
9973
9988
|
}
|
|
9974
9989
|
if (process.platform !== "darwin" && process.platform !== "linux") {
|
|
9975
9990
|
throw new Error("odla Code hosts require macOS or Linux");
|
|
@@ -10066,16 +10081,15 @@ async function runCodeRuntime(input) {
|
|
|
10066
10081
|
const control = createCodeRuntimeControlClient({
|
|
10067
10082
|
endpoint: input.endpoint,
|
|
10068
10083
|
token: input.token,
|
|
10069
|
-
signal,
|
|
10070
10084
|
fetch: input.fetch
|
|
10071
10085
|
});
|
|
10072
|
-
const commandEngine = new
|
|
10086
|
+
const commandEngine = new TheseusRuntimeEngine({
|
|
10073
10087
|
control,
|
|
10074
10088
|
engine: input.engine,
|
|
10075
10089
|
recipes: CODE_BUILD_RECIPES,
|
|
10076
10090
|
recipeAuthorization: "registered_recipe",
|
|
10077
10091
|
localSource: input.localSource,
|
|
10078
|
-
onDiagnostic: (message2) => input.stdout.error(`
|
|
10092
|
+
onDiagnostic: (message2) => input.stdout.error(`Theseus runtime failed \xB7 ${message2}`)
|
|
10079
10093
|
});
|
|
10080
10094
|
const reconciler = new CodeRuntimeReconciler(control, commandEngine);
|
|
10081
10095
|
try {
|
|
@@ -10827,7 +10841,7 @@ Commands:
|
|
|
10827
10841
|
their own credentials for the shared db (the live one included)
|
|
10828
10842
|
\u2014 no secret is ever copied between people.
|
|
10829
10843
|
capabilities Show what the CLI automates vs agent edits and human checkpoints.
|
|
10830
|
-
code Enroll this Mac/Linux host for the current Studio-connected repository and run
|
|
10844
|
+
code Enroll this Mac/Linux host for the current Studio-connected repository and run Theseus.
|
|
10831
10845
|
"code repository show" reports the repository an app works on (Studio or a
|
|
10832
10846
|
human session connects one); "code grant request|list|approve|revoke" then
|
|
10833
10847
|
governs unattended access: an agent may request, only a human may approve.
|