@odla-ai/cli 0.16.2 → 0.16.3
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/README.md +2 -2
- package/dist/bin.cjs +85 -25
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-PQX6SKYJ.js → chunk-YWC7F5T3.js} +86 -26
- package/dist/chunk-YWC7F5T3.js.map +1 -0
- package/dist/index.cjs +85 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/skills/odla-migrate/references/phase-2-db.md +2 -2
- package/dist/chunk-PQX6SKYJ.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -1775,12 +1775,15 @@ async function defaultReadOrigin(cwd) {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
|
|
1777
1777
|
// src/code-runtime-config.ts
|
|
1778
|
-
var CODE_PI_IMAGE = "ghcr.io/cory/odla-pi-agent@sha256:
|
|
1778
|
+
var CODE_PI_IMAGE = "ghcr.io/cory/odla-pi-agent@sha256:2a52a1c8eed66ad167e7bccab4d603ed8fcd75c42dddfb320083436ed89b7c9c";
|
|
1779
1779
|
var CODE_BUILD_RECIPES = Object.freeze([{
|
|
1780
1780
|
id: "odla-code-contracts",
|
|
1781
1781
|
image: "node:24-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd",
|
|
1782
1782
|
command: [
|
|
1783
1783
|
"node",
|
|
1784
|
+
// The clean source mount deliberately has no node_modules. Reuse the
|
|
1785
|
+
// semver copy inside this digest-pinned npm image without network access.
|
|
1786
|
+
"--import=data:text/javascript,import%20Module%20from%20%22node%3Amodule%22%3Bprocess.env.NODE_PATH%3D%22%2Fusr%2Flocal%2Flib%2Fnode_modules%2Fnpm%2Fnode_modules%22%3BModule._initPaths%28%29",
|
|
1784
1787
|
"--test",
|
|
1785
1788
|
"scripts/lib/directories.test.mjs",
|
|
1786
1789
|
"scripts/lib/internal-deps.test.mjs",
|
|
@@ -1800,10 +1803,10 @@ import { existsSync as existsSync4 } from "fs";
|
|
|
1800
1803
|
import { cpus, hostname, totalmem } from "os";
|
|
1801
1804
|
import { resolve as resolve5 } from "path";
|
|
1802
1805
|
|
|
1803
|
-
// ../harness/dist/chunk-
|
|
1806
|
+
// ../harness/dist/chunk-QTUEF2HZ.js
|
|
1804
1807
|
var HARNESS_PROTOCOL_VERSION = 1;
|
|
1805
1808
|
|
|
1806
|
-
// ../harness/dist/chunk-
|
|
1809
|
+
// ../harness/dist/chunk-GE6CCN7W.js
|
|
1807
1810
|
var CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
|
|
1808
1811
|
var HarnessProtocolError = class extends Error {
|
|
1809
1812
|
name = "HarnessProtocolError";
|
|
@@ -1881,7 +1884,7 @@ function encodeAgentInput(message2) {
|
|
|
1881
1884
|
`;
|
|
1882
1885
|
}
|
|
1883
1886
|
|
|
1884
|
-
// ../harness/dist/chunk-
|
|
1887
|
+
// ../harness/dist/chunk-IRFCMVKU.js
|
|
1885
1888
|
import { execFile as execFile2, spawn as spawn2 } from "child_process";
|
|
1886
1889
|
import { constants } from "fs";
|
|
1887
1890
|
import { access } from "fs/promises";
|
|
@@ -2398,7 +2401,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
|
|
|
2398
2401
|
}
|
|
2399
2402
|
}
|
|
2400
2403
|
|
|
2401
|
-
// ../harness/dist/chunk-
|
|
2404
|
+
// ../harness/dist/chunk-4MOSEKB6.js
|
|
2402
2405
|
import { createHash } from "crypto";
|
|
2403
2406
|
import { readFile, readdir as readdir2 } from "fs/promises";
|
|
2404
2407
|
import { relative as relative3, resolve as resolve4 } from "path";
|
|
@@ -2735,7 +2738,7 @@ function validateSnapshot(snapshot, limits) {
|
|
|
2735
2738
|
}
|
|
2736
2739
|
}
|
|
2737
2740
|
|
|
2738
|
-
// ../harness/dist/chunk-
|
|
2741
|
+
// ../harness/dist/chunk-4MOSEKB6.js
|
|
2739
2742
|
import { spawn as spawn4 } from "child_process";
|
|
2740
2743
|
import { lstat as lstat2 } from "fs/promises";
|
|
2741
2744
|
import { resolve as resolve23, sep as sep3 } from "path";
|
|
@@ -3028,7 +3031,7 @@ function looksLikeDestination(value) {
|
|
|
3028
3031
|
return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text);
|
|
3029
3032
|
}
|
|
3030
3033
|
|
|
3031
|
-
// ../harness/dist/chunk-
|
|
3034
|
+
// ../harness/dist/chunk-4MOSEKB6.js
|
|
3032
3035
|
import { createHash as createHash3 } from "crypto";
|
|
3033
3036
|
async function digestStagedWorkspace(root, limits) {
|
|
3034
3037
|
const files = [];
|
|
@@ -4219,6 +4222,7 @@ function codeCommandMetadata(payload, resume) {
|
|
|
4219
4222
|
const role = payload.role;
|
|
4220
4223
|
const title = payload.title;
|
|
4221
4224
|
const prompt = payload.prompt;
|
|
4225
|
+
const maxTokensPerInteraction = payload.maxTokensPerInteraction ?? 32e3;
|
|
4222
4226
|
if (role !== "coding" && role !== "review" || typeof title !== "string" || typeof prompt !== "string") {
|
|
4223
4227
|
throw new TypeError(`invalid Code ${resume ? "resume" : "start"} metadata`);
|
|
4224
4228
|
}
|
|
@@ -4230,10 +4234,14 @@ function codeCommandMetadata(payload, resume) {
|
|
|
4230
4234
|
if (typeof repository !== "string" || !repository.includes("/") || typeof baseCommitSha !== "string" || !/^[0-9a-f]{40}$/.test(baseCommitSha) || typeof sourceTreeDigest !== "string" || !/^sha256:[0-9a-f]{64}$/.test(sourceTreeDigest)) {
|
|
4231
4235
|
throw new TypeError(`invalid Code ${resume ? "resume" : "start"} trusted base`);
|
|
4232
4236
|
}
|
|
4237
|
+
if (!Number.isSafeInteger(maxTokensPerInteraction) || Number(maxTokensPerInteraction) < 4e3 || Number(maxTokensPerInteraction) > 2e5) {
|
|
4238
|
+
throw new TypeError(`invalid Code ${resume ? "resume" : "start"} interaction token limit`);
|
|
4239
|
+
}
|
|
4233
4240
|
return {
|
|
4234
4241
|
role,
|
|
4235
4242
|
title,
|
|
4236
4243
|
prompt,
|
|
4244
|
+
maxTokensPerInteraction: Number(maxTokensPerInteraction),
|
|
4237
4245
|
planningInputDigest: typeof planning === "string" && /^sha256:[0-9a-f]{64}$/.test(planning) ? planning : null,
|
|
4238
4246
|
attestationDigest: typeof attestation === "string" ? attestation : "resume",
|
|
4239
4247
|
repository,
|
|
@@ -4309,6 +4317,57 @@ function createCodeRuntimeToolBroker(input, lease, role) {
|
|
|
4309
4317
|
});
|
|
4310
4318
|
return role === "coding" ? broker : { execute: (context, request) => request.tool === "sandbox.read" ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
|
|
4311
4319
|
}
|
|
4320
|
+
async function handleCodeRuntimeInference(input) {
|
|
4321
|
+
const { command, metadata: metadata2, request, state } = input;
|
|
4322
|
+
if (state.tokens >= metadata2.maxTokensPerInteraction) {
|
|
4323
|
+
if (!state.noticeEmitted) {
|
|
4324
|
+
state.noticeEmitted = true;
|
|
4325
|
+
await input.event({
|
|
4326
|
+
type: "message",
|
|
4327
|
+
actor: "system",
|
|
4328
|
+
body: `Pi paused at the ${metadata2.maxTokensPerInteraction.toLocaleString("en-US")}-token per-interaction limit. Send a new instruction to continue.`
|
|
4329
|
+
}).catch(() => void 0);
|
|
4330
|
+
}
|
|
4331
|
+
return {
|
|
4332
|
+
protocolVersion: HARNESS_PROTOCOL_VERSION,
|
|
4333
|
+
type: "inference.response",
|
|
4334
|
+
requestId: request.requestId,
|
|
4335
|
+
response: {
|
|
4336
|
+
id: `budget:${command.commandId}`,
|
|
4337
|
+
provider: "openai",
|
|
4338
|
+
model: "interaction-budget",
|
|
4339
|
+
role: "assistant",
|
|
4340
|
+
content: [{ type: "text", text: "Pause now. The owner-set token limit for this interaction has been reached." }],
|
|
4341
|
+
stopReason: "end_turn",
|
|
4342
|
+
usage: { inputTokens: 0, outputTokens: 0 }
|
|
4343
|
+
}
|
|
4344
|
+
};
|
|
4345
|
+
}
|
|
4346
|
+
const startedAt = Date.now();
|
|
4347
|
+
const response2 = await input.control.infer(command.sessionId, {
|
|
4348
|
+
requestId: request.requestId,
|
|
4349
|
+
interactionId: command.commandId,
|
|
4350
|
+
call: request.call
|
|
4351
|
+
});
|
|
4352
|
+
state.tokens += response2.receipt.inputTokens + response2.receipt.outputTokens;
|
|
4353
|
+
await input.event({
|
|
4354
|
+
type: "usage",
|
|
4355
|
+
provider: response2.receipt.provider,
|
|
4356
|
+
model: response2.receipt.model,
|
|
4357
|
+
inputTokens: response2.receipt.inputTokens,
|
|
4358
|
+
outputTokens: response2.receipt.outputTokens,
|
|
4359
|
+
durationMs: Date.now() - startedAt,
|
|
4360
|
+
interactionId: command.commandId,
|
|
4361
|
+
interactionTokens: state.tokens,
|
|
4362
|
+
interactionMaxTokens: metadata2.maxTokensPerInteraction
|
|
4363
|
+
}).catch(() => void 0);
|
|
4364
|
+
return {
|
|
4365
|
+
protocolVersion: HARNESS_PROTOCOL_VERSION,
|
|
4366
|
+
type: "inference.response",
|
|
4367
|
+
requestId: request.requestId,
|
|
4368
|
+
response: response2.response
|
|
4369
|
+
};
|
|
4370
|
+
}
|
|
4312
4371
|
async function appendCodeRuntimeEvent(control, command, event, refs) {
|
|
4313
4372
|
const eventId = `${command.commandId.slice(0, 45)}:${refs.length + 1}`;
|
|
4314
4373
|
refs.push(eventId);
|
|
@@ -4420,6 +4479,7 @@ var CodePiRuntimeEngine = class {
|
|
|
4420
4479
|
acknowledged: false,
|
|
4421
4480
|
role: metadata2.role,
|
|
4422
4481
|
title: metadata2.title,
|
|
4482
|
+
maxTokensPerInteraction: metadata2.maxTokensPerInteraction,
|
|
4423
4483
|
baseCommitSha: metadata2.baseCommitSha,
|
|
4424
4484
|
repository: metadata2.repository,
|
|
4425
4485
|
sourceTreeDigest: metadata2.sourceTreeDigest,
|
|
@@ -4456,6 +4516,11 @@ var CodePiRuntimeEngine = class {
|
|
|
4456
4516
|
if (!active || typeof prompt !== "string" || !prompt.trim() || prompt.length > 2e4) {
|
|
4457
4517
|
throw new TypeError("prompt requires an active Code session and bounded text");
|
|
4458
4518
|
}
|
|
4519
|
+
const requestedLimit = command.payload.maxTokensPerInteraction ?? active.maxTokensPerInteraction;
|
|
4520
|
+
if (!Number.isSafeInteger(requestedLimit) || Number(requestedLimit) < 4e3 || Number(requestedLimit) > 2e5) {
|
|
4521
|
+
throw new TypeError("prompt requires a valid interaction token limit");
|
|
4522
|
+
}
|
|
4523
|
+
active.maxTokensPerInteraction = Number(requestedLimit);
|
|
4459
4524
|
await active.done;
|
|
4460
4525
|
active.abort = new AbortController();
|
|
4461
4526
|
active.acknowledged = false;
|
|
@@ -4464,6 +4529,7 @@ var CodePiRuntimeEngine = class {
|
|
|
4464
4529
|
role: active.role,
|
|
4465
4530
|
title: active.title,
|
|
4466
4531
|
prompt,
|
|
4532
|
+
maxTokensPerInteraction: active.maxTokensPerInteraction,
|
|
4467
4533
|
planningInputDigest: active.planningInputDigest,
|
|
4468
4534
|
attestationDigest: "follow-up",
|
|
4469
4535
|
repository: active.repository,
|
|
@@ -4492,6 +4558,7 @@ var CodePiRuntimeEngine = class {
|
|
|
4492
4558
|
}, lease, metadata2.role);
|
|
4493
4559
|
const startedAt = Date.now();
|
|
4494
4560
|
let completionSeen = false;
|
|
4561
|
+
const interaction = { tokens: 0, noticeEmitted: false };
|
|
4495
4562
|
const result = await this.#run({
|
|
4496
4563
|
engine: this.options.engine,
|
|
4497
4564
|
image: this.options.image,
|
|
@@ -4507,25 +4574,18 @@ var CodePiRuntimeEngine = class {
|
|
|
4507
4574
|
}, active.conversationRefs),
|
|
4508
4575
|
onMessage: async (output) => {
|
|
4509
4576
|
if (output.type === "inference.request") {
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4577
|
+
return handleCodeRuntimeInference({
|
|
4578
|
+
command,
|
|
4579
|
+
metadata: metadata2,
|
|
4580
|
+
request: output,
|
|
4581
|
+
state: interaction,
|
|
4582
|
+
control: this.options.control,
|
|
4583
|
+
event: (event) => this.#event(
|
|
4584
|
+
command,
|
|
4585
|
+
event,
|
|
4586
|
+
active.conversationRefs
|
|
4587
|
+
)
|
|
4514
4588
|
});
|
|
4515
|
-
await this.#event(command, {
|
|
4516
|
-
type: "usage",
|
|
4517
|
-
provider: response2.receipt.provider,
|
|
4518
|
-
model: response2.receipt.model,
|
|
4519
|
-
inputTokens: response2.receipt.inputTokens,
|
|
4520
|
-
outputTokens: response2.receipt.outputTokens,
|
|
4521
|
-
durationMs: Date.now() - inferenceStarted
|
|
4522
|
-
}, active.conversationRefs).catch(() => void 0);
|
|
4523
|
-
return {
|
|
4524
|
-
protocolVersion: HARNESS_PROTOCOL_VERSION,
|
|
4525
|
-
type: "inference.response",
|
|
4526
|
-
requestId: output.requestId,
|
|
4527
|
-
response: response2.response
|
|
4528
|
-
};
|
|
4529
4589
|
}
|
|
4530
4590
|
if (output.type === "tool.request") {
|
|
4531
4591
|
const toolStarted = Date.now();
|
|
@@ -7776,4 +7836,4 @@ export {
|
|
|
7776
7836
|
exitCodeFor,
|
|
7777
7837
|
runCli
|
|
7778
7838
|
};
|
|
7779
|
-
//# sourceMappingURL=chunk-
|
|
7839
|
+
//# sourceMappingURL=chunk-YWC7F5T3.js.map
|