@odla-ai/cli 0.37.0 → 0.37.1
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/bin.cjs +34 -49
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-OWTIDSL5.js → chunk-XFIFFYNH.js} +35 -50
- package/dist/{chunk-OWTIDSL5.js.map → chunk-XFIFFYNH.js.map} +1 -1
- package/dist/{cli-QR44X5IB.js → cli-OH6PCYZ3.js} +2 -2
- package/dist/index.cjs +34 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- /package/dist/{cli-QR44X5IB.js.map → cli-OH6PCYZ3.js.map} +0 -0
package/dist/bin.js
CHANGED
|
@@ -174,7 +174,7 @@ function absoluteEntryPath(entryPath) {
|
|
|
174
174
|
|
|
175
175
|
// src/bin.ts
|
|
176
176
|
var argv = process.argv.slice(2);
|
|
177
|
-
requireCurrentCliForProvision(argv).then(() => requireCoherentProvisionRuntime(argv)).then(async () => (await import("./cli-
|
|
177
|
+
requireCurrentCliForProvision(argv).then(() => requireCoherentProvisionRuntime(argv)).then(async () => (await import("./cli-OH6PCYZ3.js")).runCli()).catch((err) => {
|
|
178
178
|
console.error(redactSecrets(`odla-ai: ${err instanceof Error ? err.message : String(err)}`));
|
|
179
179
|
process.exitCode = exitCodeFor(err);
|
|
180
180
|
});
|
|
@@ -6883,7 +6883,7 @@ function createCodeRuntimeControlClient(options) {
|
|
|
6883
6883
|
throw new TypeError("modelRequestTimeoutMs must be an integer from 30000 to 1800000");
|
|
6884
6884
|
}
|
|
6885
6885
|
const request3 = options.fetch ?? fetch;
|
|
6886
|
-
const
|
|
6886
|
+
const call3 = async (path, body, timeoutMs = requestTimeoutMs) => {
|
|
6887
6887
|
const timeout = AbortSignal.timeout(timeoutMs);
|
|
6888
6888
|
const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
|
|
6889
6889
|
let response2;
|
|
@@ -6913,17 +6913,17 @@ function createCodeRuntimeControlClient(options) {
|
|
|
6913
6913
|
return {
|
|
6914
6914
|
heartbeat: async (version, capabilities) => {
|
|
6915
6915
|
validateHeartbeat(version, capabilities);
|
|
6916
|
-
return parseSnapshot(await
|
|
6916
|
+
return parseSnapshot(await call3("/registry/code/runtime/heartbeat", { runtimeVersion: version, capabilities }));
|
|
6917
6917
|
},
|
|
6918
6918
|
acknowledge: async (commandId, result) => {
|
|
6919
6919
|
if (!/^ccmd_[0-9a-f]{32}$/.test(commandId)) throw new TypeError("invalid Code runtime command id");
|
|
6920
|
-
await
|
|
6920
|
+
await call3(`/registry/code/runtime/commands/${commandId}/ack`, result);
|
|
6921
6921
|
},
|
|
6922
6922
|
source: async (sessionId) => parseSource(
|
|
6923
|
-
await
|
|
6923
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/source`, {})
|
|
6924
6924
|
),
|
|
6925
6925
|
infer: async (sessionId, inference) => {
|
|
6926
|
-
const value2 = record5(await
|
|
6926
|
+
const value2 = record5(await call3(
|
|
6927
6927
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/inference`,
|
|
6928
6928
|
inference,
|
|
6929
6929
|
modelRequestTimeoutMs
|
|
@@ -6934,11 +6934,11 @@ function createCodeRuntimeControlClient(options) {
|
|
|
6934
6934
|
return value2;
|
|
6935
6935
|
},
|
|
6936
6936
|
review: async (sessionId, review) => parseReview(
|
|
6937
|
-
await
|
|
6937
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/review`, review, modelRequestTimeoutMs)
|
|
6938
6938
|
),
|
|
6939
6939
|
submitCandidate: async (sessionId, checkpointId, verification) => {
|
|
6940
6940
|
if (!/^cpoint_[0-9a-f]{32}$/.test(checkpointId)) throw new TypeError("invalid Code checkpoint id");
|
|
6941
|
-
return parseCandidate(await
|
|
6941
|
+
return parseCandidate(await call3(
|
|
6942
6942
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/candidates`,
|
|
6943
6943
|
{ checkpointId, verification }
|
|
6944
6944
|
));
|
|
@@ -6948,21 +6948,21 @@ function createCodeRuntimeControlClient(options) {
|
|
|
6948
6948
|
if (!/^[A-Za-z0-9._:-]{1,120}$/.test(eventId) || !event || typeof event !== "object" || new TextEncoder().encode(serialized).byteLength > 24e3) {
|
|
6949
6949
|
throw new TypeError("invalid Code session event");
|
|
6950
6950
|
}
|
|
6951
|
-
await
|
|
6951
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/chat/events`, { eventId, event });
|
|
6952
6952
|
},
|
|
6953
6953
|
recallMemories: async (sessionId, subjects, limit) => {
|
|
6954
|
-
const response2 = await
|
|
6954
|
+
const response2 = await call3(
|
|
6955
6955
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/recall`,
|
|
6956
6956
|
{ subjects: [...subjects], limit }
|
|
6957
6957
|
);
|
|
6958
6958
|
return Array.isArray(response2.memories) ? response2.memories : [];
|
|
6959
6959
|
},
|
|
6960
6960
|
rememberMemory: async (sessionId, memory) => {
|
|
6961
|
-
await
|
|
6961
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/remember`, memory);
|
|
6962
6962
|
},
|
|
6963
6963
|
reportSessionFailure: async (sessionId, message2) => {
|
|
6964
6964
|
if (!message2.trim() || message2.length > 2e3) throw new TypeError("invalid Code session failure");
|
|
6965
|
-
await
|
|
6965
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/failure`, { message: message2 });
|
|
6966
6966
|
}
|
|
6967
6967
|
};
|
|
6968
6968
|
}
|
|
@@ -7851,7 +7851,7 @@ var SYSTEM_PROMPT_FOR = {
|
|
|
7851
7851
|
};
|
|
7852
7852
|
function codeSkill(opts) {
|
|
7853
7853
|
let seq = 0;
|
|
7854
|
-
const
|
|
7854
|
+
const call3 = async (tool, input, signal) => {
|
|
7855
7855
|
const startedAt = Date.now();
|
|
7856
7856
|
const response2 = await opts.broker.execute(
|
|
7857
7857
|
{ lease: opts.lease, workspaceDir: opts.workspaceDir, signal },
|
|
@@ -7873,7 +7873,7 @@ function codeSkill(opts) {
|
|
|
7873
7873
|
},
|
|
7874
7874
|
additionalProperties: false
|
|
7875
7875
|
},
|
|
7876
|
-
handler: (input, ctx) =>
|
|
7876
|
+
handler: (input, ctx) => call3("sandbox.read", input, ctx.signal)
|
|
7877
7877
|
};
|
|
7878
7878
|
const applyPatch = {
|
|
7879
7879
|
name: "odla_apply_git_diff",
|
|
@@ -7884,7 +7884,7 @@ function codeSkill(opts) {
|
|
|
7884
7884
|
properties: { patch: { type: "string", minLength: 1, maxLength: 262144 } },
|
|
7885
7885
|
additionalProperties: false
|
|
7886
7886
|
},
|
|
7887
|
-
handler: (input, ctx) =>
|
|
7887
|
+
handler: (input, ctx) => call3("sandbox.apply_patch", input, ctx.signal)
|
|
7888
7888
|
};
|
|
7889
7889
|
const runRecipe = {
|
|
7890
7890
|
name: "odla_run_recipe",
|
|
@@ -7895,7 +7895,7 @@ function codeSkill(opts) {
|
|
|
7895
7895
|
properties: { recipeId: { type: "string", minLength: 1, maxLength: 120, pattern: "^[a-zA-Z0-9._:-]+$" } },
|
|
7896
7896
|
additionalProperties: false
|
|
7897
7897
|
},
|
|
7898
|
-
handler: (input, ctx) =>
|
|
7898
|
+
handler: (input, ctx) => call3("sandbox.run_recipe", input, ctx.signal)
|
|
7899
7899
|
};
|
|
7900
7900
|
const listFiles2 = {
|
|
7901
7901
|
name: "odla_list",
|
|
@@ -7908,7 +7908,7 @@ function codeSkill(opts) {
|
|
|
7908
7908
|
},
|
|
7909
7909
|
additionalProperties: false
|
|
7910
7910
|
},
|
|
7911
|
-
handler: (input, ctx) =>
|
|
7911
|
+
handler: (input, ctx) => call3("sandbox.list", input, ctx.signal)
|
|
7912
7912
|
};
|
|
7913
7913
|
const searchFiles = {
|
|
7914
7914
|
name: "odla_search",
|
|
@@ -7924,7 +7924,7 @@ function codeSkill(opts) {
|
|
|
7924
7924
|
},
|
|
7925
7925
|
additionalProperties: false
|
|
7926
7926
|
},
|
|
7927
|
-
handler: (input, ctx) =>
|
|
7927
|
+
handler: (input, ctx) => call3("sandbox.search", input, ctx.signal)
|
|
7928
7928
|
};
|
|
7929
7929
|
const graphTool = (name, tool, description, required) => ({
|
|
7930
7930
|
name,
|
|
@@ -7935,7 +7935,7 @@ function codeSkill(opts) {
|
|
|
7935
7935
|
properties: { query: { type: "string", maxLength: 512 } },
|
|
7936
7936
|
additionalProperties: false
|
|
7937
7937
|
},
|
|
7938
|
-
handler: (input, ctx) =>
|
|
7938
|
+
handler: (input, ctx) => call3(tool, input, ctx.signal)
|
|
7939
7939
|
});
|
|
7940
7940
|
const orientation = [
|
|
7941
7941
|
graphTool(
|
|
@@ -7974,9 +7974,9 @@ async function runCodeAgent(options) {
|
|
|
7974
7974
|
lease: options.lease,
|
|
7975
7975
|
workspaceDir: options.workspaceDir,
|
|
7976
7976
|
surface,
|
|
7977
|
-
onToolCall: (
|
|
7978
|
-
toolCalls.push(
|
|
7979
|
-
options.onToolCall?.(
|
|
7977
|
+
onToolCall: (call3) => {
|
|
7978
|
+
toolCalls.push(call3);
|
|
7979
|
+
options.onToolCall?.(call3);
|
|
7980
7980
|
}
|
|
7981
7981
|
});
|
|
7982
7982
|
const compaction = options.compaction === void 0 ? keepRecentExchanges({ whenInputTokensExceed: 12e4, keep: 3 }) : options.compaction;
|
|
@@ -12757,9 +12757,15 @@ async function provisionEnvCredentials(opts) {
|
|
|
12757
12757
|
if (o11yToken) {
|
|
12758
12758
|
opts.stdout.log(`${opts.env}: reusing local o11y ingest token`);
|
|
12759
12759
|
} else {
|
|
12760
|
-
o11yToken = await issueO11yToken(opts);
|
|
12761
|
-
|
|
12762
|
-
|
|
12760
|
+
o11yToken = await issueO11yToken(opts) ?? void 0;
|
|
12761
|
+
if (o11yToken) {
|
|
12762
|
+
credentials = save(opts, credentials, tenantId, { ...dbKey ? { dbKey } : {}, o11yToken });
|
|
12763
|
+
opts.stdout.log(`${opts.env}: ${opts.rotateO11y ? "rotated" : "issued"} o11y ingest token`);
|
|
12764
|
+
} else {
|
|
12765
|
+
opts.stdout.log(
|
|
12766
|
+
`${opts.env}: o11y token already exists and its shown-once value is not on this machine \u2014 leaving it alone (a co-owner provisioned this env). Nothing was rotated, and this env's running Worker keeps its token. To replace it deliberately \u2014 which invalidates the token on whatever is deployed \u2014 run "odla-ai provision --rotate-o11y-token --push-secrets".`
|
|
12767
|
+
);
|
|
12768
|
+
}
|
|
12763
12769
|
}
|
|
12764
12770
|
}
|
|
12765
12771
|
return save(opts, credentials, tenantId, {
|
|
@@ -12813,11 +12819,7 @@ async function issueO11yToken(opts) {
|
|
|
12813
12819
|
`${opts.cfg.platformUrl}/o11y/${encodeURIComponent(opts.cfg.app.id)}/token${suffix}?env=${encodeURIComponent(opts.env)}`,
|
|
12814
12820
|
{ method: "POST", headers: { authorization: `Bearer ${opts.developerToken}` } }
|
|
12815
12821
|
);
|
|
12816
|
-
if (res.status === 409 && !opts.rotateO11y)
|
|
12817
|
-
throw new Error(
|
|
12818
|
-
`o11y token already exists for env "${opts.env}", but its shown-once value is not in the local credentials file; run "odla-ai provision --push-secrets" to install a separate runtime credential without rotating siblings`
|
|
12819
|
-
);
|
|
12820
|
-
}
|
|
12822
|
+
if (res.status === 409 && !opts.rotateO11y) return null;
|
|
12821
12823
|
if (!res.ok) throw new Error(`o11y token ${opts.rotateO11y ? "rotation" : "issue"} (${opts.env}) failed: ${res.status} ${await safeText7(res)}`);
|
|
12822
12824
|
const body = await res.json();
|
|
12823
12825
|
if (!body.token) throw new Error(`o11y token ${opts.rotateO11y ? "rotation" : "issue"} (${opts.env}) returned no token`);
|
|
@@ -13703,12 +13705,7 @@ ${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchan
|
|
|
13703
13705
|
);
|
|
13704
13706
|
}
|
|
13705
13707
|
async function upsert(ctx, r, visibility) {
|
|
13706
|
-
const
|
|
13707
|
-
ctx,
|
|
13708
|
-
"GET",
|
|
13709
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(r.slug)}&limit=1`
|
|
13710
|
-
);
|
|
13711
|
-
const found = page2.records[0];
|
|
13708
|
+
const found = await bySlug(ctx, r.slug).catch(() => null);
|
|
13712
13709
|
if (!found) {
|
|
13713
13710
|
await call(ctx, "POST", "/runbook", {
|
|
13714
13711
|
appId: ctx.appId,
|
|
@@ -14113,13 +14110,7 @@ async function runbookAsk(ctx, question, all) {
|
|
|
14113
14110
|
ctx.out.log(JSDOC_POINTER);
|
|
14114
14111
|
}
|
|
14115
14112
|
async function runbookComment(ctx, slug, body) {
|
|
14116
|
-
const
|
|
14117
|
-
ctx,
|
|
14118
|
-
"GET",
|
|
14119
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
|
|
14120
|
-
);
|
|
14121
|
-
const found = page2.records[0];
|
|
14122
|
-
if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
|
|
14113
|
+
const found = await bySlug(ctx, slug);
|
|
14123
14114
|
await call(ctx, "POST", `/runbook/${encodeURIComponent(found.id)}/comments`, { body });
|
|
14124
14115
|
ctx.out.log(`commented on ${slug} (v${found.version})`);
|
|
14125
14116
|
}
|
|
@@ -14170,13 +14161,7 @@ var defaultRunOrInjected = (deps) => deps.run ?? defaultRun;
|
|
|
14170
14161
|
|
|
14171
14162
|
// src/runbook-edit-flow.ts
|
|
14172
14163
|
async function editRunbook(ctx, slug, deps = {}) {
|
|
14173
|
-
const
|
|
14174
|
-
ctx,
|
|
14175
|
-
"GET",
|
|
14176
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
|
|
14177
|
-
);
|
|
14178
|
-
const found = page2.records[0];
|
|
14179
|
-
if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
|
|
14164
|
+
const found = await bySlug(ctx, slug);
|
|
14180
14165
|
ctx.out.log(`opening ${slug} v${found.version} in your editor\u2026`);
|
|
14181
14166
|
const body = await editText(found.body, slug, deps);
|
|
14182
14167
|
return body === null ? null : { body, expectedVersion: found.version };
|
|
@@ -15296,4 +15281,4 @@ export {
|
|
|
15296
15281
|
isTerminalHostedSecurityStatus,
|
|
15297
15282
|
runCli
|
|
15298
15283
|
};
|
|
15299
|
-
//# sourceMappingURL=chunk-
|
|
15284
|
+
//# sourceMappingURL=chunk-XFIFFYNH.js.map
|