@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runCli
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XFIFFYNH.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-OH6PCYZ3.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -7010,7 +7010,7 @@ function createCodeRuntimeControlClient(options) {
|
|
|
7010
7010
|
throw new TypeError("modelRequestTimeoutMs must be an integer from 30000 to 1800000");
|
|
7011
7011
|
}
|
|
7012
7012
|
const request3 = options.fetch ?? fetch;
|
|
7013
|
-
const
|
|
7013
|
+
const call3 = async (path, body, timeoutMs = requestTimeoutMs) => {
|
|
7014
7014
|
const timeout = AbortSignal.timeout(timeoutMs);
|
|
7015
7015
|
const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
|
|
7016
7016
|
let response2;
|
|
@@ -7040,17 +7040,17 @@ function createCodeRuntimeControlClient(options) {
|
|
|
7040
7040
|
return {
|
|
7041
7041
|
heartbeat: async (version, capabilities) => {
|
|
7042
7042
|
validateHeartbeat(version, capabilities);
|
|
7043
|
-
return parseSnapshot(await
|
|
7043
|
+
return parseSnapshot(await call3("/registry/code/runtime/heartbeat", { runtimeVersion: version, capabilities }));
|
|
7044
7044
|
},
|
|
7045
7045
|
acknowledge: async (commandId, result) => {
|
|
7046
7046
|
if (!/^ccmd_[0-9a-f]{32}$/.test(commandId)) throw new TypeError("invalid Code runtime command id");
|
|
7047
|
-
await
|
|
7047
|
+
await call3(`/registry/code/runtime/commands/${commandId}/ack`, result);
|
|
7048
7048
|
},
|
|
7049
7049
|
source: async (sessionId) => parseSource(
|
|
7050
|
-
await
|
|
7050
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/source`, {})
|
|
7051
7051
|
),
|
|
7052
7052
|
infer: async (sessionId, inference) => {
|
|
7053
|
-
const value2 = record5(await
|
|
7053
|
+
const value2 = record5(await call3(
|
|
7054
7054
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/inference`,
|
|
7055
7055
|
inference,
|
|
7056
7056
|
modelRequestTimeoutMs
|
|
@@ -7061,11 +7061,11 @@ function createCodeRuntimeControlClient(options) {
|
|
|
7061
7061
|
return value2;
|
|
7062
7062
|
},
|
|
7063
7063
|
review: async (sessionId, review) => parseReview(
|
|
7064
|
-
await
|
|
7064
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/review`, review, modelRequestTimeoutMs)
|
|
7065
7065
|
),
|
|
7066
7066
|
submitCandidate: async (sessionId, checkpointId, verification) => {
|
|
7067
7067
|
if (!/^cpoint_[0-9a-f]{32}$/.test(checkpointId)) throw new TypeError("invalid Code checkpoint id");
|
|
7068
|
-
return parseCandidate(await
|
|
7068
|
+
return parseCandidate(await call3(
|
|
7069
7069
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/candidates`,
|
|
7070
7070
|
{ checkpointId, verification }
|
|
7071
7071
|
));
|
|
@@ -7075,21 +7075,21 @@ function createCodeRuntimeControlClient(options) {
|
|
|
7075
7075
|
if (!/^[A-Za-z0-9._:-]{1,120}$/.test(eventId) || !event || typeof event !== "object" || new TextEncoder().encode(serialized).byteLength > 24e3) {
|
|
7076
7076
|
throw new TypeError("invalid Code session event");
|
|
7077
7077
|
}
|
|
7078
|
-
await
|
|
7078
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/chat/events`, { eventId, event });
|
|
7079
7079
|
},
|
|
7080
7080
|
recallMemories: async (sessionId, subjects, limit) => {
|
|
7081
|
-
const response2 = await
|
|
7081
|
+
const response2 = await call3(
|
|
7082
7082
|
`/registry/code/runtime/sessions/${validSessionId(sessionId)}/recall`,
|
|
7083
7083
|
{ subjects: [...subjects], limit }
|
|
7084
7084
|
);
|
|
7085
7085
|
return Array.isArray(response2.memories) ? response2.memories : [];
|
|
7086
7086
|
},
|
|
7087
7087
|
rememberMemory: async (sessionId, memory) => {
|
|
7088
|
-
await
|
|
7088
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/remember`, memory);
|
|
7089
7089
|
},
|
|
7090
7090
|
reportSessionFailure: async (sessionId, message2) => {
|
|
7091
7091
|
if (!message2.trim() || message2.length > 2e3) throw new TypeError("invalid Code session failure");
|
|
7092
|
-
await
|
|
7092
|
+
await call3(`/registry/code/runtime/sessions/${validSessionId(sessionId)}/failure`, { message: message2 });
|
|
7093
7093
|
}
|
|
7094
7094
|
};
|
|
7095
7095
|
}
|
|
@@ -7978,7 +7978,7 @@ var SYSTEM_PROMPT_FOR = {
|
|
|
7978
7978
|
};
|
|
7979
7979
|
function codeSkill(opts) {
|
|
7980
7980
|
let seq = 0;
|
|
7981
|
-
const
|
|
7981
|
+
const call3 = async (tool, input, signal) => {
|
|
7982
7982
|
const startedAt = Date.now();
|
|
7983
7983
|
const response2 = await opts.broker.execute(
|
|
7984
7984
|
{ lease: opts.lease, workspaceDir: opts.workspaceDir, signal },
|
|
@@ -8000,7 +8000,7 @@ function codeSkill(opts) {
|
|
|
8000
8000
|
},
|
|
8001
8001
|
additionalProperties: false
|
|
8002
8002
|
},
|
|
8003
|
-
handler: (input, ctx) =>
|
|
8003
|
+
handler: (input, ctx) => call3("sandbox.read", input, ctx.signal)
|
|
8004
8004
|
};
|
|
8005
8005
|
const applyPatch = {
|
|
8006
8006
|
name: "odla_apply_git_diff",
|
|
@@ -8011,7 +8011,7 @@ function codeSkill(opts) {
|
|
|
8011
8011
|
properties: { patch: { type: "string", minLength: 1, maxLength: 262144 } },
|
|
8012
8012
|
additionalProperties: false
|
|
8013
8013
|
},
|
|
8014
|
-
handler: (input, ctx) =>
|
|
8014
|
+
handler: (input, ctx) => call3("sandbox.apply_patch", input, ctx.signal)
|
|
8015
8015
|
};
|
|
8016
8016
|
const runRecipe = {
|
|
8017
8017
|
name: "odla_run_recipe",
|
|
@@ -8022,7 +8022,7 @@ function codeSkill(opts) {
|
|
|
8022
8022
|
properties: { recipeId: { type: "string", minLength: 1, maxLength: 120, pattern: "^[a-zA-Z0-9._:-]+$" } },
|
|
8023
8023
|
additionalProperties: false
|
|
8024
8024
|
},
|
|
8025
|
-
handler: (input, ctx) =>
|
|
8025
|
+
handler: (input, ctx) => call3("sandbox.run_recipe", input, ctx.signal)
|
|
8026
8026
|
};
|
|
8027
8027
|
const listFiles2 = {
|
|
8028
8028
|
name: "odla_list",
|
|
@@ -8035,7 +8035,7 @@ function codeSkill(opts) {
|
|
|
8035
8035
|
},
|
|
8036
8036
|
additionalProperties: false
|
|
8037
8037
|
},
|
|
8038
|
-
handler: (input, ctx) =>
|
|
8038
|
+
handler: (input, ctx) => call3("sandbox.list", input, ctx.signal)
|
|
8039
8039
|
};
|
|
8040
8040
|
const searchFiles = {
|
|
8041
8041
|
name: "odla_search",
|
|
@@ -8051,7 +8051,7 @@ function codeSkill(opts) {
|
|
|
8051
8051
|
},
|
|
8052
8052
|
additionalProperties: false
|
|
8053
8053
|
},
|
|
8054
|
-
handler: (input, ctx) =>
|
|
8054
|
+
handler: (input, ctx) => call3("sandbox.search", input, ctx.signal)
|
|
8055
8055
|
};
|
|
8056
8056
|
const graphTool = (name, tool, description, required) => ({
|
|
8057
8057
|
name,
|
|
@@ -8062,7 +8062,7 @@ function codeSkill(opts) {
|
|
|
8062
8062
|
properties: { query: { type: "string", maxLength: 512 } },
|
|
8063
8063
|
additionalProperties: false
|
|
8064
8064
|
},
|
|
8065
|
-
handler: (input, ctx) =>
|
|
8065
|
+
handler: (input, ctx) => call3(tool, input, ctx.signal)
|
|
8066
8066
|
});
|
|
8067
8067
|
const orientation = [
|
|
8068
8068
|
graphTool(
|
|
@@ -8101,9 +8101,9 @@ async function runCodeAgent(options) {
|
|
|
8101
8101
|
lease: options.lease,
|
|
8102
8102
|
workspaceDir: options.workspaceDir,
|
|
8103
8103
|
surface,
|
|
8104
|
-
onToolCall: (
|
|
8105
|
-
toolCalls.push(
|
|
8106
|
-
options.onToolCall?.(
|
|
8104
|
+
onToolCall: (call3) => {
|
|
8105
|
+
toolCalls.push(call3);
|
|
8106
|
+
options.onToolCall?.(call3);
|
|
8107
8107
|
}
|
|
8108
8108
|
});
|
|
8109
8109
|
const compaction = options.compaction === void 0 ? (0, import_ai4.keepRecentExchanges)({ whenInputTokensExceed: 12e4, keep: 3 }) : options.compaction;
|
|
@@ -12884,9 +12884,15 @@ async function provisionEnvCredentials(opts) {
|
|
|
12884
12884
|
if (o11yToken) {
|
|
12885
12885
|
opts.stdout.log(`${opts.env}: reusing local o11y ingest token`);
|
|
12886
12886
|
} else {
|
|
12887
|
-
o11yToken = await issueO11yToken(opts);
|
|
12888
|
-
|
|
12889
|
-
|
|
12887
|
+
o11yToken = await issueO11yToken(opts) ?? void 0;
|
|
12888
|
+
if (o11yToken) {
|
|
12889
|
+
credentials = save(opts, credentials, tenantId, { ...dbKey ? { dbKey } : {}, o11yToken });
|
|
12890
|
+
opts.stdout.log(`${opts.env}: ${opts.rotateO11y ? "rotated" : "issued"} o11y ingest token`);
|
|
12891
|
+
} else {
|
|
12892
|
+
opts.stdout.log(
|
|
12893
|
+
`${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".`
|
|
12894
|
+
);
|
|
12895
|
+
}
|
|
12890
12896
|
}
|
|
12891
12897
|
}
|
|
12892
12898
|
return save(opts, credentials, tenantId, {
|
|
@@ -12940,11 +12946,7 @@ async function issueO11yToken(opts) {
|
|
|
12940
12946
|
`${opts.cfg.platformUrl}/o11y/${encodeURIComponent(opts.cfg.app.id)}/token${suffix}?env=${encodeURIComponent(opts.env)}`,
|
|
12941
12947
|
{ method: "POST", headers: { authorization: `Bearer ${opts.developerToken}` } }
|
|
12942
12948
|
);
|
|
12943
|
-
if (res.status === 409 && !opts.rotateO11y)
|
|
12944
|
-
throw new Error(
|
|
12945
|
-
`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`
|
|
12946
|
-
);
|
|
12947
|
-
}
|
|
12949
|
+
if (res.status === 409 && !opts.rotateO11y) return null;
|
|
12948
12950
|
if (!res.ok) throw new Error(`o11y token ${opts.rotateO11y ? "rotation" : "issue"} (${opts.env}) failed: ${res.status} ${await safeText7(res)}`);
|
|
12949
12951
|
const body = await res.json();
|
|
12950
12952
|
if (!body.token) throw new Error(`o11y token ${opts.rotateO11y ? "rotation" : "issue"} (${opts.env}) returned no token`);
|
|
@@ -13879,12 +13881,7 @@ ${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchan
|
|
|
13879
13881
|
);
|
|
13880
13882
|
}
|
|
13881
13883
|
async function upsert(ctx, r, visibility) {
|
|
13882
|
-
const
|
|
13883
|
-
ctx,
|
|
13884
|
-
"GET",
|
|
13885
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(r.slug)}&limit=1`
|
|
13886
|
-
);
|
|
13887
|
-
const found = page2.records[0];
|
|
13884
|
+
const found = await bySlug(ctx, r.slug).catch(() => null);
|
|
13888
13885
|
if (!found) {
|
|
13889
13886
|
await call(ctx, "POST", "/runbook", {
|
|
13890
13887
|
appId: ctx.appId,
|
|
@@ -14289,13 +14286,7 @@ async function runbookAsk(ctx, question, all) {
|
|
|
14289
14286
|
ctx.out.log(JSDOC_POINTER);
|
|
14290
14287
|
}
|
|
14291
14288
|
async function runbookComment(ctx, slug, body) {
|
|
14292
|
-
const
|
|
14293
|
-
ctx,
|
|
14294
|
-
"GET",
|
|
14295
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
|
|
14296
|
-
);
|
|
14297
|
-
const found = page2.records[0];
|
|
14298
|
-
if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
|
|
14289
|
+
const found = await bySlug(ctx, slug);
|
|
14299
14290
|
await call(ctx, "POST", `/runbook/${encodeURIComponent(found.id)}/comments`, { body });
|
|
14300
14291
|
ctx.out.log(`commented on ${slug} (v${found.version})`);
|
|
14301
14292
|
}
|
|
@@ -14346,13 +14337,7 @@ var defaultRunOrInjected = (deps) => deps.run ?? defaultRun;
|
|
|
14346
14337
|
|
|
14347
14338
|
// src/runbook-edit-flow.ts
|
|
14348
14339
|
async function editRunbook(ctx, slug, deps = {}) {
|
|
14349
|
-
const
|
|
14350
|
-
ctx,
|
|
14351
|
-
"GET",
|
|
14352
|
-
`/runbook?app=${encodeURIComponent(ctx.appId)}&slug=${encodeURIComponent(slug)}&limit=1`
|
|
14353
|
-
);
|
|
14354
|
-
const found = page2.records[0];
|
|
14355
|
-
if (!found) throw new Error(`no runbook "${slug}" in ${ctx.appId}`);
|
|
14340
|
+
const found = await bySlug(ctx, slug);
|
|
14356
14341
|
ctx.out.log(`opening ${slug} v${found.version} in your editor\u2026`);
|
|
14357
14342
|
const body = await editText(found.body, slug, deps);
|
|
14358
14343
|
return body === null ? null : { body, expectedVersion: found.version };
|