@elevasis/sdk 1.33.1 → 1.34.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/cli.cjs +680 -197
- package/dist/index.d.ts +162 -12
- package/dist/index.js +111 -17
- package/dist/node/index.d.ts +27 -9
- package/dist/node/index.js +29 -3
- package/dist/test-utils/index.d.ts +137 -5
- package/dist/test-utils/index.js +87 -15
- package/dist/worker/index.js +79 -4
- package/package.json +8 -6
- package/reference/_navigation.md +2 -1
- package/reference/_reference-manifest.json +14 -0
- package/reference/claude-config/Overview.md +2 -3
- package/reference/claude-config/skills/om/SKILL.md +108 -50
- package/reference/claude-config/skills/om/operations/build.md +237 -0
- package/reference/claude-config/skills/project/SKILL.md +16 -14
- package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +29 -0
- package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +86 -0
- package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +47 -0
- package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +50 -0
- package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +76 -0
- package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +75 -0
- package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +42 -0
- package/reference/sdk/cli-management.mdx +130 -24
- package/reference/sdk/cli.mdx +2 -1
- package/reference/ui/exports.mdx +1 -0
package/dist/cli.cjs
CHANGED
|
@@ -7142,14 +7142,14 @@ var require_async_iterator = __commonJS({
|
|
|
7142
7142
|
};
|
|
7143
7143
|
}
|
|
7144
7144
|
function readAndResolve(iter) {
|
|
7145
|
-
var
|
|
7146
|
-
if (
|
|
7145
|
+
var resolve6 = iter[kLastResolve];
|
|
7146
|
+
if (resolve6 !== null) {
|
|
7147
7147
|
var data = iter[kStream].read();
|
|
7148
7148
|
if (data !== null) {
|
|
7149
7149
|
iter[kLastPromise] = null;
|
|
7150
7150
|
iter[kLastResolve] = null;
|
|
7151
7151
|
iter[kLastReject] = null;
|
|
7152
|
-
|
|
7152
|
+
resolve6(createIterResult(data, false));
|
|
7153
7153
|
}
|
|
7154
7154
|
}
|
|
7155
7155
|
}
|
|
@@ -7157,13 +7157,13 @@ var require_async_iterator = __commonJS({
|
|
|
7157
7157
|
process.nextTick(readAndResolve, iter);
|
|
7158
7158
|
}
|
|
7159
7159
|
function wrapForNext(lastPromise, iter) {
|
|
7160
|
-
return function(
|
|
7160
|
+
return function(resolve6, reject) {
|
|
7161
7161
|
lastPromise.then(function() {
|
|
7162
7162
|
if (iter[kEnded]) {
|
|
7163
|
-
|
|
7163
|
+
resolve6(createIterResult(void 0, true));
|
|
7164
7164
|
return;
|
|
7165
7165
|
}
|
|
7166
|
-
iter[kHandlePromise](
|
|
7166
|
+
iter[kHandlePromise](resolve6, reject);
|
|
7167
7167
|
}, reject);
|
|
7168
7168
|
};
|
|
7169
7169
|
}
|
|
@@ -7183,12 +7183,12 @@ var require_async_iterator = __commonJS({
|
|
|
7183
7183
|
return Promise.resolve(createIterResult(void 0, true));
|
|
7184
7184
|
}
|
|
7185
7185
|
if (this[kStream].destroyed) {
|
|
7186
|
-
return new Promise(function(
|
|
7186
|
+
return new Promise(function(resolve6, reject) {
|
|
7187
7187
|
process.nextTick(function() {
|
|
7188
7188
|
if (_this[kError]) {
|
|
7189
7189
|
reject(_this[kError]);
|
|
7190
7190
|
} else {
|
|
7191
|
-
|
|
7191
|
+
resolve6(createIterResult(void 0, true));
|
|
7192
7192
|
}
|
|
7193
7193
|
});
|
|
7194
7194
|
});
|
|
@@ -7211,13 +7211,13 @@ var require_async_iterator = __commonJS({
|
|
|
7211
7211
|
return this;
|
|
7212
7212
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
7213
7213
|
var _this2 = this;
|
|
7214
|
-
return new Promise(function(
|
|
7214
|
+
return new Promise(function(resolve6, reject) {
|
|
7215
7215
|
_this2[kStream].destroy(null, function(err) {
|
|
7216
7216
|
if (err) {
|
|
7217
7217
|
reject(err);
|
|
7218
7218
|
return;
|
|
7219
7219
|
}
|
|
7220
|
-
|
|
7220
|
+
resolve6(createIterResult(void 0, true));
|
|
7221
7221
|
});
|
|
7222
7222
|
});
|
|
7223
7223
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -7239,15 +7239,15 @@ var require_async_iterator = __commonJS({
|
|
|
7239
7239
|
value: stream._readableState.endEmitted,
|
|
7240
7240
|
writable: true
|
|
7241
7241
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
7242
|
-
value: function value(
|
|
7242
|
+
value: function value(resolve6, reject) {
|
|
7243
7243
|
var data = iterator[kStream].read();
|
|
7244
7244
|
if (data) {
|
|
7245
7245
|
iterator[kLastPromise] = null;
|
|
7246
7246
|
iterator[kLastResolve] = null;
|
|
7247
7247
|
iterator[kLastReject] = null;
|
|
7248
|
-
|
|
7248
|
+
resolve6(createIterResult(data, false));
|
|
7249
7249
|
} else {
|
|
7250
|
-
iterator[kLastResolve] =
|
|
7250
|
+
iterator[kLastResolve] = resolve6;
|
|
7251
7251
|
iterator[kLastReject] = reject;
|
|
7252
7252
|
}
|
|
7253
7253
|
},
|
|
@@ -7266,12 +7266,12 @@ var require_async_iterator = __commonJS({
|
|
|
7266
7266
|
iterator[kError] = err;
|
|
7267
7267
|
return;
|
|
7268
7268
|
}
|
|
7269
|
-
var
|
|
7270
|
-
if (
|
|
7269
|
+
var resolve6 = iterator[kLastResolve];
|
|
7270
|
+
if (resolve6 !== null) {
|
|
7271
7271
|
iterator[kLastPromise] = null;
|
|
7272
7272
|
iterator[kLastResolve] = null;
|
|
7273
7273
|
iterator[kLastReject] = null;
|
|
7274
|
-
|
|
7274
|
+
resolve6(createIterResult(void 0, true));
|
|
7275
7275
|
}
|
|
7276
7276
|
iterator[kEnded] = true;
|
|
7277
7277
|
});
|
|
@@ -7286,7 +7286,7 @@ var require_async_iterator = __commonJS({
|
|
|
7286
7286
|
var require_from = __commonJS({
|
|
7287
7287
|
"../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
|
|
7288
7288
|
"use strict";
|
|
7289
|
-
function asyncGeneratorStep(gen,
|
|
7289
|
+
function asyncGeneratorStep(gen, resolve6, reject, _next, _throw, key, arg) {
|
|
7290
7290
|
try {
|
|
7291
7291
|
var info = gen[key](arg);
|
|
7292
7292
|
var value = info.value;
|
|
@@ -7295,7 +7295,7 @@ var require_from = __commonJS({
|
|
|
7295
7295
|
return;
|
|
7296
7296
|
}
|
|
7297
7297
|
if (info.done) {
|
|
7298
|
-
|
|
7298
|
+
resolve6(value);
|
|
7299
7299
|
} else {
|
|
7300
7300
|
Promise.resolve(value).then(_next, _throw);
|
|
7301
7301
|
}
|
|
@@ -7303,13 +7303,13 @@ var require_from = __commonJS({
|
|
|
7303
7303
|
function _asyncToGenerator(fn) {
|
|
7304
7304
|
return function() {
|
|
7305
7305
|
var self2 = this, args = arguments;
|
|
7306
|
-
return new Promise(function(
|
|
7306
|
+
return new Promise(function(resolve6, reject) {
|
|
7307
7307
|
var gen = fn.apply(self2, args);
|
|
7308
7308
|
function _next(value) {
|
|
7309
|
-
asyncGeneratorStep(gen,
|
|
7309
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "next", value);
|
|
7310
7310
|
}
|
|
7311
7311
|
function _throw(err) {
|
|
7312
|
-
asyncGeneratorStep(gen,
|
|
7312
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "throw", err);
|
|
7313
7313
|
}
|
|
7314
7314
|
_next(void 0);
|
|
7315
7315
|
});
|
|
@@ -23629,18 +23629,18 @@ var init_config = __esm({
|
|
|
23629
23629
|
// src/cli/commands/om/project-layout.ts
|
|
23630
23630
|
function assertSplitLayout(projectDir) {
|
|
23631
23631
|
const omDir = (0, import_node_path9.join)(projectDir, "core", "config", "organization-model");
|
|
23632
|
-
const missing = REQUIRED_FILES.filter((f) => !(0,
|
|
23632
|
+
const missing = REQUIRED_FILES.filter((f) => !(0, import_node_fs11.existsSync)((0, import_node_path9.join)(omDir, f)));
|
|
23633
23633
|
if (missing.length > 0) {
|
|
23634
23634
|
throw new Error(
|
|
23635
23635
|
"Legacy single-file OM layout detected. Split into `core/config/organization-model/{profile.ts, systems.ts, navigation.ts}` before scaffolding."
|
|
23636
23636
|
);
|
|
23637
23637
|
}
|
|
23638
23638
|
}
|
|
23639
|
-
var
|
|
23639
|
+
var import_node_fs11, import_node_path9, REQUIRED_FILES;
|
|
23640
23640
|
var init_project_layout = __esm({
|
|
23641
23641
|
"src/cli/commands/om/project-layout.ts"() {
|
|
23642
23642
|
"use strict";
|
|
23643
|
-
|
|
23643
|
+
import_node_fs11 = require("node:fs");
|
|
23644
23644
|
import_node_path9 = require("node:path");
|
|
23645
23645
|
REQUIRED_FILES = ["profile.ts", "systems.ts", "navigation.ts"];
|
|
23646
23646
|
}
|
|
@@ -23656,11 +23656,11 @@ async function promptIfAbsent(value, question, options) {
|
|
|
23656
23656
|
input: process.stdin,
|
|
23657
23657
|
output: process.stdout
|
|
23658
23658
|
});
|
|
23659
|
-
return new Promise((
|
|
23659
|
+
return new Promise((resolve6) => {
|
|
23660
23660
|
const prompt = options?.default ? `${question} [${options.default}]: ` : `${question}: `;
|
|
23661
23661
|
rl.question(prompt, (answer) => {
|
|
23662
23662
|
rl.close();
|
|
23663
|
-
|
|
23663
|
+
resolve6(answer.trim() || (options?.default ?? ""));
|
|
23664
23664
|
});
|
|
23665
23665
|
});
|
|
23666
23666
|
}
|
|
@@ -23741,7 +23741,7 @@ async function withSnapshotRollback(filePaths, op) {
|
|
|
23741
23741
|
const snapshots = /* @__PURE__ */ new Map();
|
|
23742
23742
|
for (const filePath of filePaths) {
|
|
23743
23743
|
try {
|
|
23744
|
-
snapshots.set(filePath, (0,
|
|
23744
|
+
snapshots.set(filePath, (0, import_node_fs12.readFileSync)(filePath, "utf8"));
|
|
23745
23745
|
} catch {
|
|
23746
23746
|
snapshots.set(filePath, null);
|
|
23747
23747
|
}
|
|
@@ -23752,7 +23752,7 @@ async function withSnapshotRollback(filePaths, op) {
|
|
|
23752
23752
|
for (const [filePath, snapshot] of snapshots) {
|
|
23753
23753
|
if (snapshot !== null) {
|
|
23754
23754
|
try {
|
|
23755
|
-
(0,
|
|
23755
|
+
(0, import_node_fs12.writeFileSync)(filePath, snapshot, "utf8");
|
|
23756
23756
|
} catch {
|
|
23757
23757
|
}
|
|
23758
23758
|
}
|
|
@@ -23773,14 +23773,14 @@ function insertBeforeAnchorInContent(content, code, anchor) {
|
|
|
23773
23773
|
return lines.join("\n");
|
|
23774
23774
|
}
|
|
23775
23775
|
async function appendBeforeAnchor(filePath, code, anchor) {
|
|
23776
|
-
const content = (0,
|
|
23776
|
+
const content = (0, import_node_fs12.readFileSync)(filePath, "utf8");
|
|
23777
23777
|
const updated = insertBeforeAnchorInContent(content, code, anchor);
|
|
23778
|
-
(0,
|
|
23778
|
+
(0, import_node_fs12.writeFileSync)(filePath, updated, "utf8");
|
|
23779
23779
|
}
|
|
23780
23780
|
async function applyConstImport(systemsFilePath, importLine, fieldLine, importAnchor, fieldAnchor, newConstFilePath, newConstFileCode) {
|
|
23781
|
-
(0,
|
|
23782
|
-
(0,
|
|
23783
|
-
const systemsContent = (0,
|
|
23781
|
+
(0, import_node_fs12.mkdirSync)((0, import_node_path10.dirname)(newConstFilePath), { recursive: true });
|
|
23782
|
+
(0, import_node_fs12.writeFileSync)(newConstFilePath, newConstFileCode, "utf8");
|
|
23783
|
+
const systemsContent = (0, import_node_fs12.readFileSync)(systemsFilePath, "utf8");
|
|
23784
23784
|
const afterImport = insertBeforeAnchorInContent(systemsContent, importLine + "\n", importAnchor);
|
|
23785
23785
|
const lines = afterImport.split("\n");
|
|
23786
23786
|
const fieldAnchorIndex = lines.findIndex((line) => fieldAnchor.test(line));
|
|
@@ -23790,13 +23790,13 @@ async function applyConstImport(systemsFilePath, importLine, fieldLine, importAn
|
|
|
23790
23790
|
);
|
|
23791
23791
|
}
|
|
23792
23792
|
lines.splice(fieldAnchorIndex + 1, 0, fieldLine);
|
|
23793
|
-
(0,
|
|
23793
|
+
(0, import_node_fs12.writeFileSync)(systemsFilePath, lines.join("\n"), "utf8");
|
|
23794
23794
|
}
|
|
23795
|
-
var
|
|
23795
|
+
var import_node_fs12, import_node_path10;
|
|
23796
23796
|
var init_splice = __esm({
|
|
23797
23797
|
"src/cli/commands/om/splice.ts"() {
|
|
23798
23798
|
"use strict";
|
|
23799
|
-
|
|
23799
|
+
import_node_fs12 = require("node:fs");
|
|
23800
23800
|
import_node_path10 = require("node:path");
|
|
23801
23801
|
}
|
|
23802
23802
|
});
|
|
@@ -24168,24 +24168,24 @@ async function scaffoldKnowledge(opts) {
|
|
|
24168
24168
|
return;
|
|
24169
24169
|
}
|
|
24170
24170
|
const absoluteFilePath = (0, import_node_path14.join)(projectDir, relativeFilePath);
|
|
24171
|
-
if ((0,
|
|
24171
|
+
if ((0, import_node_fs13.existsSync)(absoluteFilePath)) {
|
|
24172
24172
|
process.stderr.write(
|
|
24173
24173
|
source_default.red(`Knowledge node file already exists at \`${relativeFilePath}\`. Choose a different id.
|
|
24174
24174
|
`)
|
|
24175
24175
|
);
|
|
24176
24176
|
process.exit(1);
|
|
24177
24177
|
}
|
|
24178
|
-
(0,
|
|
24179
|
-
(0,
|
|
24178
|
+
(0, import_node_fs13.mkdirSync)((0, import_node_path14.join)(projectDir, "core", "config", "knowledge", "nodes"), { recursive: true });
|
|
24179
|
+
(0, import_node_fs13.writeFileSync)(absoluteFilePath, content, "utf8");
|
|
24180
24180
|
console.log(source_default.green(`Knowledge node \`${id}\` written to \`${relativeFilePath}\``));
|
|
24181
24181
|
console.log(source_default.yellow("Run `elevasis-sdk om:generate` to register this node."));
|
|
24182
24182
|
}
|
|
24183
|
-
var import_node_path14,
|
|
24183
|
+
var import_node_path14, import_node_fs13, VALID_KINDS;
|
|
24184
24184
|
var init_scaffold_knowledge = __esm({
|
|
24185
24185
|
"src/cli/commands/om/scaffold-knowledge.ts"() {
|
|
24186
24186
|
"use strict";
|
|
24187
24187
|
import_node_path14 = require("node:path");
|
|
24188
|
-
|
|
24188
|
+
import_node_fs13 = require("node:fs");
|
|
24189
24189
|
init_source();
|
|
24190
24190
|
init_config();
|
|
24191
24191
|
init_project_layout();
|
|
@@ -24261,7 +24261,7 @@ async function scaffoldFill(opts) {
|
|
|
24261
24261
|
process.stderr.write(source_default.red("Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.\n"));
|
|
24262
24262
|
process.exit(1);
|
|
24263
24263
|
}
|
|
24264
|
-
if (!(0,
|
|
24264
|
+
if (!(0, import_node_fs14.existsSync)(options.gaps)) {
|
|
24265
24265
|
process.stderr.write(
|
|
24266
24266
|
source_default.red(
|
|
24267
24267
|
`Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.
|
|
@@ -24273,7 +24273,7 @@ async function scaffoldFill(opts) {
|
|
|
24273
24273
|
}
|
|
24274
24274
|
let payload;
|
|
24275
24275
|
try {
|
|
24276
|
-
const raw = (0,
|
|
24276
|
+
const raw = (0, import_node_fs14.readFileSync)(options.gaps, "utf8");
|
|
24277
24277
|
payload = JSON.parse(raw);
|
|
24278
24278
|
} catch {
|
|
24279
24279
|
process.stderr.write(
|
|
@@ -24394,7 +24394,7 @@ async function scaffoldFill(opts) {
|
|
|
24394
24394
|
}
|
|
24395
24395
|
if (skippedGaps.length > 0) {
|
|
24396
24396
|
const skippedPath = options.skipped ?? (0, import_node_path15.join)(os2.tmpdir(), `elevasis-fill-skipped-${systemPath}-${Date.now()}.json`);
|
|
24397
|
-
(0,
|
|
24397
|
+
(0, import_node_fs14.writeFileSync)(skippedPath, JSON.stringify({ systemPath, skipped: skippedGaps }, null, 2), "utf8");
|
|
24398
24398
|
console.log(
|
|
24399
24399
|
source_default.yellow(
|
|
24400
24400
|
`Partial fill: ${appliedGaps.length} gap(s) applied, ${skippedGaps.length} skipped \u2014 see \`${skippedPath}\` for fields requiring manual input.`
|
|
@@ -24408,13 +24408,13 @@ async function scaffoldFill(opts) {
|
|
|
24408
24408
|
)
|
|
24409
24409
|
);
|
|
24410
24410
|
}
|
|
24411
|
-
var import_node_path15, os2,
|
|
24411
|
+
var import_node_path15, os2, import_node_fs14, import_node_child_process5;
|
|
24412
24412
|
var init_scaffold_fill = __esm({
|
|
24413
24413
|
"src/cli/commands/om/scaffold-fill.ts"() {
|
|
24414
24414
|
"use strict";
|
|
24415
24415
|
import_node_path15 = require("node:path");
|
|
24416
24416
|
os2 = __toESM(require("node:os"), 1);
|
|
24417
|
-
|
|
24417
|
+
import_node_fs14 = require("node:fs");
|
|
24418
24418
|
import_node_child_process5 = require("node:child_process");
|
|
24419
24419
|
init_source();
|
|
24420
24420
|
init_config();
|
|
@@ -37533,16 +37533,13 @@ var OntologyKindSchema = external_exports.enum([
|
|
|
37533
37533
|
"value-type",
|
|
37534
37534
|
"property",
|
|
37535
37535
|
"group",
|
|
37536
|
-
"
|
|
37536
|
+
"endpoint"
|
|
37537
37537
|
]);
|
|
37538
37538
|
var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
|
|
37539
37539
|
var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
|
|
37540
37540
|
var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
|
|
37541
37541
|
var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
|
|
37542
|
-
var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(
|
|
37543
|
-
ONTOLOGY_ID_REGEX,
|
|
37544
|
-
"Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
37545
|
-
);
|
|
37542
|
+
var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(ONTOLOGY_ID_REGEX, "Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>");
|
|
37546
37543
|
function parseOntologyId(id) {
|
|
37547
37544
|
const normalized = OntologyIdSchema.parse(id);
|
|
37548
37545
|
const match = ONTOLOGY_ID_REGEX.exec(normalized);
|
|
@@ -37605,7 +37602,7 @@ var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
|
|
|
37605
37602
|
var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
|
|
37606
37603
|
members: OntologyReferenceListSchema
|
|
37607
37604
|
});
|
|
37608
|
-
var
|
|
37605
|
+
var OntologyEndpointTypeSchema = OntologyRecordBaseSchema.extend({
|
|
37609
37606
|
route: external_exports.string().trim().min(1).max(500).optional()
|
|
37610
37607
|
});
|
|
37611
37608
|
var OntologyScopeSchema = external_exports.object({
|
|
@@ -37618,7 +37615,7 @@ var OntologyScopeSchema = external_exports.object({
|
|
|
37618
37615
|
valueTypes: external_exports.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
|
|
37619
37616
|
sharedProperties: external_exports.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
|
|
37620
37617
|
groups: external_exports.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
|
|
37621
|
-
|
|
37618
|
+
endpoints: external_exports.record(OntologyIdSchema, OntologyEndpointTypeSchema).default({}).optional()
|
|
37622
37619
|
}).default({});
|
|
37623
37620
|
var DEFAULT_ONTOLOGY_SCOPE = {
|
|
37624
37621
|
valueTypes: {
|
|
@@ -37654,7 +37651,7 @@ var SCOPE_KIND = {
|
|
|
37654
37651
|
valueTypes: "value-type",
|
|
37655
37652
|
sharedProperties: "property",
|
|
37656
37653
|
groups: "group",
|
|
37657
|
-
|
|
37654
|
+
endpoints: "endpoint"
|
|
37658
37655
|
};
|
|
37659
37656
|
var SCOPE_KEYS = Object.keys(SCOPE_KIND);
|
|
37660
37657
|
function ontologyGraphNodeId(id) {
|
|
@@ -37690,7 +37687,7 @@ function createEmptyIndex() {
|
|
|
37690
37687
|
valueTypes: {},
|
|
37691
37688
|
sharedProperties: {},
|
|
37692
37689
|
groups: {},
|
|
37693
|
-
|
|
37690
|
+
endpoints: {}
|
|
37694
37691
|
};
|
|
37695
37692
|
}
|
|
37696
37693
|
function sortResolvedOntologyIndex(index) {
|
|
@@ -37923,7 +37920,7 @@ var ONTOLOGY_REFERENCE_KEY_KINDS = {
|
|
|
37923
37920
|
interfaceType: "interface",
|
|
37924
37921
|
propertyType: "property",
|
|
37925
37922
|
groupType: "group",
|
|
37926
|
-
|
|
37923
|
+
endpointType: "endpoint",
|
|
37927
37924
|
stepCatalog: "catalog"
|
|
37928
37925
|
};
|
|
37929
37926
|
var omCompilationContextCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -37951,7 +37948,7 @@ function buildOmCrossRefIndexFromOntology(model, ontologyCompilation) {
|
|
|
37951
37948
|
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
37952
37949
|
property: ontologyCompilation.ontology.sharedProperties,
|
|
37953
37950
|
group: ontologyCompilation.ontology.groups,
|
|
37954
|
-
|
|
37951
|
+
endpoint: ontologyCompilation.ontology.endpoints
|
|
37955
37952
|
};
|
|
37956
37953
|
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
37957
37954
|
const stageIds = /* @__PURE__ */ new Set();
|
|
@@ -41180,17 +41177,38 @@ var GoogleConfigSchema = external_exports.object({
|
|
|
41180
41177
|
topP: external_exports.number().min(0).max(1).optional(),
|
|
41181
41178
|
modelOptions: GoogleOptionsSchema.optional()
|
|
41182
41179
|
});
|
|
41183
|
-
var AnthropicOptionsSchema = external_exports.object({});
|
|
41184
|
-
var
|
|
41185
|
-
model: external_exports.enum([
|
|
41180
|
+
var AnthropicOptionsSchema = external_exports.object({}).strict();
|
|
41181
|
+
var AnthropicStandardConfigSchema = external_exports.object({
|
|
41182
|
+
model: external_exports.enum([
|
|
41183
|
+
"claude-sonnet-4-6",
|
|
41184
|
+
"claude-haiku-4-5-20251001",
|
|
41185
|
+
"claude-haiku-4-5",
|
|
41186
|
+
"claude-sonnet-4-5"
|
|
41187
|
+
]),
|
|
41186
41188
|
provider: external_exports.literal("anthropic"),
|
|
41187
41189
|
apiKey: external_exports.string(),
|
|
41188
41190
|
temperature: external_exports.number().min(0).max(1).optional(),
|
|
41189
|
-
maxOutputTokens: external_exports.number().min(1e3).optional(),
|
|
41191
|
+
maxOutputTokens: external_exports.number().min(1e3).max(64e3).optional(),
|
|
41190
41192
|
// Anthropic requires max_tokens
|
|
41191
41193
|
topP: external_exports.number().min(0).max(1).optional(),
|
|
41192
41194
|
modelOptions: AnthropicOptionsSchema.optional()
|
|
41193
41195
|
});
|
|
41196
|
+
var AnthropicOpus48ConfigSchema = external_exports.object({
|
|
41197
|
+
model: external_exports.literal("claude-opus-4-8"),
|
|
41198
|
+
provider: external_exports.literal("anthropic"),
|
|
41199
|
+
apiKey: external_exports.string(),
|
|
41200
|
+
temperature: external_exports.literal(1).optional(),
|
|
41201
|
+
maxOutputTokens: external_exports.number().min(1e3).max(128e3).optional(),
|
|
41202
|
+
// Anthropic requires max_tokens
|
|
41203
|
+
topP: external_exports.literal(1).optional(),
|
|
41204
|
+
topK: external_exports.undefined().optional(),
|
|
41205
|
+
top_k: external_exports.undefined().optional(),
|
|
41206
|
+
modelOptions: AnthropicOptionsSchema.optional()
|
|
41207
|
+
});
|
|
41208
|
+
var AnthropicConfigSchema = external_exports.discriminatedUnion("model", [
|
|
41209
|
+
AnthropicOpus48ConfigSchema,
|
|
41210
|
+
AnthropicStandardConfigSchema
|
|
41211
|
+
]);
|
|
41194
41212
|
var MODEL_INFO = {
|
|
41195
41213
|
// OpenAI GPT-5 (Reasoning Models)
|
|
41196
41214
|
"gpt-5": {
|
|
@@ -41283,6 +41301,58 @@ var MODEL_INFO = {
|
|
|
41283
41301
|
configSchema: GoogleConfigSchema
|
|
41284
41302
|
},
|
|
41285
41303
|
// Anthropic Claude Models (direct SDK access via @anthropic-ai/sdk)
|
|
41304
|
+
"claude-opus-4-8": {
|
|
41305
|
+
inputCostPer1M: 500,
|
|
41306
|
+
// $5.00 per 1M tokens
|
|
41307
|
+
outputCostPer1M: 2500,
|
|
41308
|
+
// $25.00 per 1M tokens
|
|
41309
|
+
minTokens: 4e3,
|
|
41310
|
+
recommendedTokens: 8e3,
|
|
41311
|
+
maxTokens: 1e6,
|
|
41312
|
+
// 1M context window
|
|
41313
|
+
maxOutputTokens: 128e3,
|
|
41314
|
+
category: "reasoning",
|
|
41315
|
+
configSchema: AnthropicConfigSchema
|
|
41316
|
+
},
|
|
41317
|
+
"claude-sonnet-4-6": {
|
|
41318
|
+
inputCostPer1M: 300,
|
|
41319
|
+
// $3.00 per 1M tokens
|
|
41320
|
+
outputCostPer1M: 1500,
|
|
41321
|
+
// $15.00 per 1M tokens
|
|
41322
|
+
minTokens: 4e3,
|
|
41323
|
+
recommendedTokens: 8e3,
|
|
41324
|
+
maxTokens: 1e6,
|
|
41325
|
+
// 1M context window
|
|
41326
|
+
maxOutputTokens: 64e3,
|
|
41327
|
+
category: "standard",
|
|
41328
|
+
configSchema: AnthropicConfigSchema
|
|
41329
|
+
},
|
|
41330
|
+
"claude-haiku-4-5-20251001": {
|
|
41331
|
+
inputCostPer1M: 100,
|
|
41332
|
+
// $1.00 per 1M tokens
|
|
41333
|
+
outputCostPer1M: 500,
|
|
41334
|
+
// $5.00 per 1M tokens
|
|
41335
|
+
minTokens: 4e3,
|
|
41336
|
+
recommendedTokens: 8e3,
|
|
41337
|
+
maxTokens: 2e5,
|
|
41338
|
+
// 200k context window
|
|
41339
|
+
maxOutputTokens: 64e3,
|
|
41340
|
+
category: "standard",
|
|
41341
|
+
configSchema: AnthropicConfigSchema
|
|
41342
|
+
},
|
|
41343
|
+
"claude-haiku-4-5": {
|
|
41344
|
+
inputCostPer1M: 100,
|
|
41345
|
+
// $1.00 per 1M tokens
|
|
41346
|
+
outputCostPer1M: 500,
|
|
41347
|
+
// $5.00 per 1M tokens
|
|
41348
|
+
minTokens: 4e3,
|
|
41349
|
+
recommendedTokens: 8e3,
|
|
41350
|
+
maxTokens: 2e5,
|
|
41351
|
+
// 200k context window
|
|
41352
|
+
maxOutputTokens: 64e3,
|
|
41353
|
+
category: "standard",
|
|
41354
|
+
configSchema: AnthropicConfigSchema
|
|
41355
|
+
},
|
|
41286
41356
|
"claude-sonnet-4-5": {
|
|
41287
41357
|
inputCostPer1M: 300,
|
|
41288
41358
|
// $3.00 per 1M tokens
|
|
@@ -41292,6 +41362,7 @@ var MODEL_INFO = {
|
|
|
41292
41362
|
recommendedTokens: 8e3,
|
|
41293
41363
|
maxTokens: 2e5,
|
|
41294
41364
|
// 200k context window
|
|
41365
|
+
maxOutputTokens: 64e3,
|
|
41295
41366
|
category: "standard",
|
|
41296
41367
|
configSchema: AnthropicConfigSchema
|
|
41297
41368
|
}
|
|
@@ -41873,8 +41944,8 @@ function ontologyIndexForKind(index, kind) {
|
|
|
41873
41944
|
return index.sharedProperties;
|
|
41874
41945
|
case "group":
|
|
41875
41946
|
return index.groups;
|
|
41876
|
-
case "
|
|
41877
|
-
return index.
|
|
41947
|
+
case "endpoint":
|
|
41948
|
+
return index.endpoints;
|
|
41878
41949
|
}
|
|
41879
41950
|
}
|
|
41880
41951
|
function sameJson(left, right) {
|
|
@@ -45734,7 +45805,7 @@ function wrapAction(commandName, fn) {
|
|
|
45734
45805
|
// package.json
|
|
45735
45806
|
var package_default = {
|
|
45736
45807
|
name: "@elevasis/sdk",
|
|
45737
|
-
version: "1.
|
|
45808
|
+
version: "1.34.1",
|
|
45738
45809
|
description: "SDK for building Elevasis organization resources",
|
|
45739
45810
|
type: "module",
|
|
45740
45811
|
bin: {
|
|
@@ -45777,8 +45848,10 @@ var package_default = {
|
|
|
45777
45848
|
build: `node -e "require('fs').rmSync('dist',{recursive:true,force:true})" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --banner:js="#!/usr/bin/env node" && node scripts/verify-skill-coverage.mjs && node scripts/copy-reference-docs.mjs && node ../../scripts/monorepo/generate-reference-artifacts.js`,
|
|
45778
45849
|
"type-check": "tsc --noEmit",
|
|
45779
45850
|
"check-types": "pnpm type-check",
|
|
45780
|
-
test: "pnpm
|
|
45781
|
-
"test:
|
|
45851
|
+
test: "pnpm test:bundle",
|
|
45852
|
+
"test:source": "vitest run --config vitest.config.ts",
|
|
45853
|
+
"test:dist": "pnpm build && node ../../scripts/monorepo/validate-reference-artifacts.js && vitest run --config vitest.bundle.config.ts",
|
|
45854
|
+
"test:bundle": "pnpm test:source && pnpm test:dist"
|
|
45782
45855
|
},
|
|
45783
45856
|
dependencies: {
|
|
45784
45857
|
"@mdx-js/mdx": "^3.1.1",
|
|
@@ -45911,7 +45984,8 @@ function extractResourceMetadata(resource, schemaWarnings) {
|
|
|
45911
45984
|
version: resource.config.version,
|
|
45912
45985
|
status: resource.config.status,
|
|
45913
45986
|
description: resource.config.description,
|
|
45914
|
-
category: resource.config.category
|
|
45987
|
+
category: resource.config.category,
|
|
45988
|
+
sessionCapable: resource.config.sessionCapable
|
|
45915
45989
|
};
|
|
45916
45990
|
if (resource.contract.inputSchema) {
|
|
45917
45991
|
try {
|
|
@@ -46577,7 +46651,7 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
|
46577
46651
|
if (interrupted) {
|
|
46578
46652
|
return;
|
|
46579
46653
|
}
|
|
46580
|
-
await new Promise((
|
|
46654
|
+
await new Promise((resolve6) => setTimeout(resolve6, POLL_INTERVAL_MS));
|
|
46581
46655
|
if (interrupted) {
|
|
46582
46656
|
return;
|
|
46583
46657
|
}
|
|
@@ -46711,6 +46785,9 @@ function registerExecCommand(program3) {
|
|
|
46711
46785
|
// src/cli/commands/resources.ts
|
|
46712
46786
|
init_source();
|
|
46713
46787
|
init_config();
|
|
46788
|
+
function getResourceType(resource) {
|
|
46789
|
+
return resource.type ?? resource.resourceType;
|
|
46790
|
+
}
|
|
46714
46791
|
function registerResourcesCommand(program3) {
|
|
46715
46792
|
program3.command("resources").description("List deployed resources for your organization").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("resources", async (options) => {
|
|
46716
46793
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
@@ -46729,8 +46806,8 @@ function registerResourcesCommand(program3) {
|
|
|
46729
46806
|
console.log(source_default.gray("Deploy with: elevasis-sdk deploy"));
|
|
46730
46807
|
return;
|
|
46731
46808
|
}
|
|
46732
|
-
const workflows = data.resources.filter((r) => r
|
|
46733
|
-
const agents = data.resources.filter((r) => r
|
|
46809
|
+
const workflows = data.resources.filter((r) => getResourceType(r) === "workflow");
|
|
46810
|
+
const agents = data.resources.filter((r) => getResourceType(r) === "agent");
|
|
46734
46811
|
if (workflows.length > 0) {
|
|
46735
46812
|
console.log(source_default.yellow("Workflows:"));
|
|
46736
46813
|
for (const w of workflows) {
|
|
@@ -46747,6 +46824,7 @@ function registerResourcesCommand(program3) {
|
|
|
46747
46824
|
console.log(source_default.white(` ${source_default.bold(a.resourceId)}`));
|
|
46748
46825
|
if (a.name) console.log(source_default.gray(` Name: ${a.name}`));
|
|
46749
46826
|
if (a.description) console.log(source_default.gray(` Description: ${a.description}`));
|
|
46827
|
+
console.log(source_default.gray(` Session capable: ${a.sessionCapable ? "yes" : "no"}`));
|
|
46750
46828
|
console.log(source_default.gray(` Status: ${a.status}`));
|
|
46751
46829
|
console.log();
|
|
46752
46830
|
}
|
|
@@ -47213,10 +47291,10 @@ init_source();
|
|
|
47213
47291
|
var import_readline = require("readline");
|
|
47214
47292
|
function confirm(message) {
|
|
47215
47293
|
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
47216
|
-
return new Promise((
|
|
47294
|
+
return new Promise((resolve6) => {
|
|
47217
47295
|
rl.question(message, (answer) => {
|
|
47218
47296
|
rl.close();
|
|
47219
|
-
|
|
47297
|
+
resolve6(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
47220
47298
|
});
|
|
47221
47299
|
});
|
|
47222
47300
|
}
|
|
@@ -47970,8 +48048,28 @@ Project ${id} deleted.`));
|
|
|
47970
48048
|
}
|
|
47971
48049
|
|
|
47972
48050
|
// src/cli/commands/project/milestones.ts
|
|
48051
|
+
var import_node_fs3 = require("node:fs");
|
|
47973
48052
|
init_source();
|
|
47974
48053
|
init_config();
|
|
48054
|
+
function parseChecklistOption(options) {
|
|
48055
|
+
if (options.checklist !== void 0 && options.checklistFile !== void 0) {
|
|
48056
|
+
process.stderr.write(
|
|
48057
|
+
JSON.stringify({
|
|
48058
|
+
error: "Provide only one of --checklist or --checklist-file",
|
|
48059
|
+
code: "CONFLICTING_FLAGS"
|
|
48060
|
+
}) + "\n"
|
|
48061
|
+
);
|
|
48062
|
+
process.exit(1);
|
|
48063
|
+
}
|
|
48064
|
+
const raw = options.checklistFile !== void 0 ? (0, import_node_fs3.readFileSync)(resolveProjectRelative(options.checklistFile), "utf8") : options.checklist;
|
|
48065
|
+
if (raw === void 0) return void 0;
|
|
48066
|
+
try {
|
|
48067
|
+
return JSON.parse(raw);
|
|
48068
|
+
} catch {
|
|
48069
|
+
process.stderr.write(JSON.stringify({ error: "Checklist must be valid JSON", code: "INVALID_JSON" }) + "\n");
|
|
48070
|
+
process.exit(1);
|
|
48071
|
+
}
|
|
48072
|
+
}
|
|
47975
48073
|
function registerMilestoneList(program3) {
|
|
47976
48074
|
program3.command("project:milestone:list").description("List milestones for a project\n Example: elevasis-sdk project:milestone:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
47977
48075
|
wrapAction("project:milestone:list", async (options) => {
|
|
@@ -48031,7 +48129,10 @@ Milestone created: ${m.name}`));
|
|
|
48031
48129
|
);
|
|
48032
48130
|
}
|
|
48033
48131
|
function registerMilestoneUpdate(program3) {
|
|
48034
|
-
program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48132
|
+
program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48133
|
+
"--checklist-file <path>",
|
|
48134
|
+
"Read replacement checklist from a JSON file. Relative paths resolve against the project root."
|
|
48135
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48035
48136
|
wrapAction(
|
|
48036
48137
|
"project:milestone:update",
|
|
48037
48138
|
async (id, options) => {
|
|
@@ -48040,20 +48141,12 @@ function registerMilestoneUpdate(program3) {
|
|
|
48040
48141
|
if (options.status !== void 0) body.status = options.status;
|
|
48041
48142
|
if (options.description !== void 0) body.description = options.description;
|
|
48042
48143
|
if (options.dueDate !== void 0) body.due_date = options.dueDate;
|
|
48043
|
-
|
|
48044
|
-
|
|
48045
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48046
|
-
} catch {
|
|
48047
|
-
process.stderr.write(
|
|
48048
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48049
|
-
);
|
|
48050
|
-
process.exit(1);
|
|
48051
|
-
}
|
|
48052
|
-
}
|
|
48144
|
+
const checklist = parseChecklistOption(options);
|
|
48145
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48053
48146
|
if (Object.keys(body).length === 0) {
|
|
48054
48147
|
process.stderr.write(
|
|
48055
48148
|
JSON.stringify({
|
|
48056
|
-
error: "At least one field must be provided (--name, --status, --description, --due-date, --checklist)",
|
|
48149
|
+
error: "At least one field must be provided (--name, --status, --description, --due-date, --checklist, --checklist-file)",
|
|
48057
48150
|
code: "MISSING_FIELDS"
|
|
48058
48151
|
}) + "\n"
|
|
48059
48152
|
);
|
|
@@ -48091,8 +48184,28 @@ Milestone ${id} deleted.`));
|
|
|
48091
48184
|
}
|
|
48092
48185
|
|
|
48093
48186
|
// src/cli/commands/project/tasks.ts
|
|
48187
|
+
var import_node_fs4 = require("node:fs");
|
|
48094
48188
|
init_source();
|
|
48095
48189
|
init_config();
|
|
48190
|
+
function parseChecklistOption2(options) {
|
|
48191
|
+
if (options.checklist !== void 0 && options.checklistFile !== void 0) {
|
|
48192
|
+
process.stderr.write(
|
|
48193
|
+
JSON.stringify({
|
|
48194
|
+
error: "Provide only one of --checklist or --checklist-file",
|
|
48195
|
+
code: "CONFLICTING_FLAGS"
|
|
48196
|
+
}) + "\n"
|
|
48197
|
+
);
|
|
48198
|
+
process.exit(1);
|
|
48199
|
+
}
|
|
48200
|
+
const raw = options.checklistFile !== void 0 ? (0, import_node_fs4.readFileSync)(resolveProjectRelative(options.checklistFile), "utf8") : options.checklist;
|
|
48201
|
+
if (raw === void 0) return void 0;
|
|
48202
|
+
try {
|
|
48203
|
+
return JSON.parse(raw);
|
|
48204
|
+
} catch {
|
|
48205
|
+
process.stderr.write(JSON.stringify({ error: "Checklist must be valid JSON", code: "INVALID_JSON" }) + "\n");
|
|
48206
|
+
process.exit(1);
|
|
48207
|
+
}
|
|
48208
|
+
}
|
|
48096
48209
|
function registerTaskList(program3) {
|
|
48097
48210
|
program3.command("project:task:list").description(
|
|
48098
48211
|
"List tasks for a project\n Example: elevasis-sdk project:task:list --project <uuid> --status in_progress"
|
|
@@ -48160,7 +48273,10 @@ function registerTaskCreate(program3) {
|
|
|
48160
48273
|
).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--title <title>", "Task title / name").option("--status <status>", "Status: planned | in_progress | blocked | completed | cancelled").option(
|
|
48161
48274
|
"--type <type>",
|
|
48162
48275
|
"Type: documentation | code | report | design | refactor | feature | bug | research | other"
|
|
48163
|
-
).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48276
|
+
).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48277
|
+
"--checklist-file <path>",
|
|
48278
|
+
"Read checklist items from a JSON file. Relative paths resolve against the project root."
|
|
48279
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48164
48280
|
wrapAction(
|
|
48165
48281
|
"project:task:create",
|
|
48166
48282
|
async (options) => {
|
|
@@ -48173,16 +48289,8 @@ function registerTaskCreate(program3) {
|
|
|
48173
48289
|
if (options.milestone) body.milestone_id = options.milestone;
|
|
48174
48290
|
if (options.parent) body.parent_task_id = options.parent;
|
|
48175
48291
|
if (options.description) body.description = options.description;
|
|
48176
|
-
|
|
48177
|
-
|
|
48178
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48179
|
-
} catch {
|
|
48180
|
-
process.stderr.write(
|
|
48181
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48182
|
-
);
|
|
48183
|
-
process.exit(1);
|
|
48184
|
-
}
|
|
48185
|
-
}
|
|
48292
|
+
const checklist = parseChecklistOption2(options);
|
|
48293
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48186
48294
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
48187
48295
|
const result = await apiPost("/api/external/project-tasks", body, apiUrl);
|
|
48188
48296
|
if (options.pretty) {
|
|
@@ -48203,7 +48311,10 @@ function registerTaskUpdate(program3) {
|
|
|
48203
48311
|
program3.command("project:task:update <id>").description("Update a task\n Example: elevasis-sdk project:task:update <uuid> --status completed").option("--title <title>", "New task title").option(
|
|
48204
48312
|
"--status <status>",
|
|
48205
48313
|
"New status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
|
|
48206
|
-
).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--description <description>", "New description").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48314
|
+
).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--description <description>", "New description").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48315
|
+
"--checklist-file <path>",
|
|
48316
|
+
"Read replacement checklist from a JSON file. Relative paths resolve against the project root."
|
|
48317
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48207
48318
|
wrapAction(
|
|
48208
48319
|
"project:task:update",
|
|
48209
48320
|
async (id, options) => {
|
|
@@ -48212,20 +48323,12 @@ function registerTaskUpdate(program3) {
|
|
|
48212
48323
|
if (options.status !== void 0) body.status = options.status;
|
|
48213
48324
|
if (options.milestone !== void 0) body.milestone_id = options.milestone;
|
|
48214
48325
|
if (options.description !== void 0) body.description = options.description;
|
|
48215
|
-
|
|
48216
|
-
|
|
48217
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48218
|
-
} catch {
|
|
48219
|
-
process.stderr.write(
|
|
48220
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48221
|
-
);
|
|
48222
|
-
process.exit(1);
|
|
48223
|
-
}
|
|
48224
|
-
}
|
|
48326
|
+
const checklist = parseChecklistOption2(options);
|
|
48327
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48225
48328
|
if (Object.keys(body).length === 0) {
|
|
48226
48329
|
process.stderr.write(
|
|
48227
48330
|
JSON.stringify({
|
|
48228
|
-
error: "At least one field must be provided (--title, --status, --milestone, --description, --checklist)",
|
|
48331
|
+
error: "At least one field must be provided (--title, --status, --milestone, --description, --checklist, --checklist-file)",
|
|
48229
48332
|
code: "MISSING_FIELDS"
|
|
48230
48333
|
}) + "\n"
|
|
48231
48334
|
);
|
|
@@ -48652,6 +48755,15 @@ function registerProjectCommands(program3) {
|
|
|
48652
48755
|
}
|
|
48653
48756
|
|
|
48654
48757
|
// ../core/src/knowledge/queries.ts
|
|
48758
|
+
var DOMAIN_ITEM_KINDS = ["clients", "roles", "policies", "customers", "offerings", "goals"];
|
|
48759
|
+
var BARE_PREFIX_TO_DOMAIN = {
|
|
48760
|
+
client: "clients",
|
|
48761
|
+
role: "roles",
|
|
48762
|
+
policy: "policies",
|
|
48763
|
+
customer: "customers",
|
|
48764
|
+
offering: "offerings",
|
|
48765
|
+
goal: "goals"
|
|
48766
|
+
};
|
|
48655
48767
|
function toGraphNodeId(omNodeId) {
|
|
48656
48768
|
return `knowledge:${omNodeId}`;
|
|
48657
48769
|
}
|
|
@@ -48800,11 +48912,32 @@ function parsePath(pathString) {
|
|
|
48800
48912
|
if (first === "all-roles" && rest.length === 0) {
|
|
48801
48913
|
return { mount: "all-roles", args: [] };
|
|
48802
48914
|
}
|
|
48915
|
+
if (first === "by-domain") {
|
|
48916
|
+
if (rest.length === 0) {
|
|
48917
|
+
throw new Error(`parsePath: /by-domain requires a domain argument, got: "${pathString}"`);
|
|
48918
|
+
}
|
|
48919
|
+
const domain2 = rest[0];
|
|
48920
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain2)) {
|
|
48921
|
+
throw new Error(`parsePath: /by-domain unknown domain "${domain2}". Supported: ${DOMAIN_ITEM_KINDS.join(", ")}`);
|
|
48922
|
+
}
|
|
48923
|
+
return { mount: "by-domain", args: [domain2] };
|
|
48924
|
+
}
|
|
48925
|
+
if (first === "by-item") {
|
|
48926
|
+
if (rest.length < 2) {
|
|
48927
|
+
throw new Error(`parsePath: /by-item requires <domain>/<itemId>, got: "${pathString}"`);
|
|
48928
|
+
}
|
|
48929
|
+
const domain2 = rest[0];
|
|
48930
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain2)) {
|
|
48931
|
+
throw new Error(`parsePath: /by-item unknown domain "${domain2}". Supported: ${DOMAIN_ITEM_KINDS.join(", ")}`);
|
|
48932
|
+
}
|
|
48933
|
+
const itemId = rest.slice(1).join("/");
|
|
48934
|
+
return { mount: "by-item", args: [domain2, itemId] };
|
|
48935
|
+
}
|
|
48803
48936
|
if (segments.length === 1) {
|
|
48804
48937
|
return { mount: "node", args: [first] };
|
|
48805
48938
|
}
|
|
48806
48939
|
throw new Error(
|
|
48807
|
-
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>, /all-systems, /all-resources, /all-roles`
|
|
48940
|
+
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /by-domain/<domain>, /by-item/<domain>/<itemId>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>, /all-systems, /all-resources, /all-roles`
|
|
48808
48941
|
);
|
|
48809
48942
|
}
|
|
48810
48943
|
function omSearch(model, query, options = {}) {
|
|
@@ -48989,7 +49122,7 @@ function collectOntologyEntries(scope) {
|
|
|
48989
49122
|
["value-type", scope.valueTypes],
|
|
48990
49123
|
["property", scope.sharedProperties],
|
|
48991
49124
|
["group", scope.groups],
|
|
48992
|
-
["
|
|
49125
|
+
["endpoint", scope.endpoints]
|
|
48993
49126
|
];
|
|
48994
49127
|
for (const [subKind, records] of buckets) {
|
|
48995
49128
|
if (!records) continue;
|
|
@@ -49013,12 +49146,26 @@ function collectOntologyEntries(scope) {
|
|
|
49013
49146
|
return entries;
|
|
49014
49147
|
}
|
|
49015
49148
|
function detectKind(model, id) {
|
|
49016
|
-
if (/:(object|action|event|catalog|link|interface|value-type|property|group|
|
|
49149
|
+
if (/:(object|action|event|catalog|link|interface|value-type|property|group|endpoint)\//.test(id)) {
|
|
49017
49150
|
return "ontology";
|
|
49018
49151
|
}
|
|
49019
49152
|
if (id.startsWith("knowledge.")) return "knowledge";
|
|
49020
49153
|
if (id.startsWith("role.")) return "role";
|
|
49021
49154
|
if (id.startsWith("policy.")) return "policy";
|
|
49155
|
+
if (id.startsWith("item:")) {
|
|
49156
|
+
const afterItem = id.slice("item:".length);
|
|
49157
|
+
const colonIdx = afterItem.indexOf(":");
|
|
49158
|
+
if (colonIdx > 0) {
|
|
49159
|
+
const domain2 = afterItem.slice(0, colonIdx);
|
|
49160
|
+
if (DOMAIN_ITEM_KINDS.includes(domain2)) return "domain-item";
|
|
49161
|
+
}
|
|
49162
|
+
return void 0;
|
|
49163
|
+
}
|
|
49164
|
+
const firstColon = id.indexOf(":");
|
|
49165
|
+
if (firstColon > 0) {
|
|
49166
|
+
const prefix = id.slice(0, firstColon);
|
|
49167
|
+
if (prefix in BARE_PREFIX_TO_DOMAIN) return "domain-item";
|
|
49168
|
+
}
|
|
49022
49169
|
if (model.systems && getSystemByPath(model.systems, id)) return "system";
|
|
49023
49170
|
if (model.resources?.[id]) return "resource";
|
|
49024
49171
|
return void 0;
|
|
@@ -49051,6 +49198,8 @@ function omDescribe(model, id) {
|
|
|
49051
49198
|
return describeRole(model, id);
|
|
49052
49199
|
case "policy":
|
|
49053
49200
|
return describePolicy(model, id);
|
|
49201
|
+
case "domain-item":
|
|
49202
|
+
return describeDomainItem(model, id);
|
|
49054
49203
|
}
|
|
49055
49204
|
}
|
|
49056
49205
|
function describeSystem(model, path3) {
|
|
@@ -49087,7 +49236,7 @@ function describeSystem(model, path3) {
|
|
|
49087
49236
|
["value-type", ontology.valueTypes],
|
|
49088
49237
|
["property", ontology.sharedProperties],
|
|
49089
49238
|
["group", ontology.groups],
|
|
49090
|
-
["
|
|
49239
|
+
["endpoint", ontology.endpoints]
|
|
49091
49240
|
];
|
|
49092
49241
|
for (const [k, records] of buckets) {
|
|
49093
49242
|
const count = records ? Object.keys(records).length : 0;
|
|
@@ -49165,7 +49314,7 @@ function describeOntology(model, id) {
|
|
|
49165
49314
|
["value-type", "valueTypes"],
|
|
49166
49315
|
["property", "sharedProperties"],
|
|
49167
49316
|
["group", "groups"],
|
|
49168
|
-
["
|
|
49317
|
+
["endpoint", "endpoints"]
|
|
49169
49318
|
];
|
|
49170
49319
|
const bucketKey = buckets.find((b) => b[0] === ontologyKind)?.[1];
|
|
49171
49320
|
if (!bucketKey) return void 0;
|
|
@@ -49226,6 +49375,77 @@ function describePolicy(model, id) {
|
|
|
49226
49375
|
effectKinds: (policy.actions ?? []).map((a) => a.kind)
|
|
49227
49376
|
};
|
|
49228
49377
|
}
|
|
49378
|
+
var DOMAIN_LABEL = {
|
|
49379
|
+
clients: "Clients",
|
|
49380
|
+
roles: "Roles",
|
|
49381
|
+
policies: "Policies",
|
|
49382
|
+
customers: "Customers",
|
|
49383
|
+
offerings: "Offerings",
|
|
49384
|
+
goals: "Goals"
|
|
49385
|
+
};
|
|
49386
|
+
var DOMAIN_GRAPH_PREFIX = {
|
|
49387
|
+
clients: "client",
|
|
49388
|
+
roles: "role",
|
|
49389
|
+
policies: "policy",
|
|
49390
|
+
customers: "customer-segment",
|
|
49391
|
+
offerings: "offering",
|
|
49392
|
+
goals: "goal"
|
|
49393
|
+
};
|
|
49394
|
+
function parseDomainItemRef(id) {
|
|
49395
|
+
if (id.startsWith("item:")) {
|
|
49396
|
+
const afterItem = id.slice("item:".length);
|
|
49397
|
+
const colonIdx = afterItem.indexOf(":");
|
|
49398
|
+
if (colonIdx <= 0) return void 0;
|
|
49399
|
+
const domain3 = afterItem.slice(0, colonIdx);
|
|
49400
|
+
const itemId2 = afterItem.slice(colonIdx + 1);
|
|
49401
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain3) || !itemId2) return void 0;
|
|
49402
|
+
return { domain: domain3, itemId: itemId2 };
|
|
49403
|
+
}
|
|
49404
|
+
const firstColon = id.indexOf(":");
|
|
49405
|
+
if (firstColon <= 0) return void 0;
|
|
49406
|
+
const prefix = id.slice(0, firstColon);
|
|
49407
|
+
const domain2 = BARE_PREFIX_TO_DOMAIN[prefix];
|
|
49408
|
+
if (!domain2) return void 0;
|
|
49409
|
+
const itemId = id.slice(firstColon + 1);
|
|
49410
|
+
if (!itemId) return void 0;
|
|
49411
|
+
return { domain: domain2, itemId };
|
|
49412
|
+
}
|
|
49413
|
+
function describeDomainItem(model, id) {
|
|
49414
|
+
const parsed = parseDomainItemRef(id);
|
|
49415
|
+
if (!parsed) return void 0;
|
|
49416
|
+
const { domain: domain2, itemId } = parsed;
|
|
49417
|
+
const collection = model[domain2];
|
|
49418
|
+
const record2 = collection?.[itemId];
|
|
49419
|
+
if (!record2) return void 0;
|
|
49420
|
+
const name = domain2 === "clients" ? String(record2["name"] ?? itemId) : domain2 === "roles" ? String(record2["title"] ?? itemId) : domain2 === "policies" ? String(record2["label"] ?? itemId) : domain2 === "goals" ? String(record2["description"] ?? itemId) : String(record2["name"] ?? itemId);
|
|
49421
|
+
const graphNodeId = `${DOMAIN_GRAPH_PREFIX[domain2]}:${itemId}`;
|
|
49422
|
+
const containsParentIds = ["organization-model"];
|
|
49423
|
+
const governingKnowledge = [];
|
|
49424
|
+
for (const node of Object.values(model.knowledge ?? {})) {
|
|
49425
|
+
const governs2 = (node.links ?? []).some((link) => link.nodeId === graphNodeId);
|
|
49426
|
+
if (governs2) {
|
|
49427
|
+
governingKnowledge.push({
|
|
49428
|
+
id: node.id,
|
|
49429
|
+
title: node.title,
|
|
49430
|
+
knowledgeKind: node.kind
|
|
49431
|
+
});
|
|
49432
|
+
}
|
|
49433
|
+
}
|
|
49434
|
+
const canonicalId = `item:${domain2}:${itemId}`;
|
|
49435
|
+
return {
|
|
49436
|
+
kind: "domain-item",
|
|
49437
|
+
id: canonicalId,
|
|
49438
|
+
domain: domain2,
|
|
49439
|
+
name,
|
|
49440
|
+
location: {
|
|
49441
|
+
domainLabel: DOMAIN_LABEL[domain2],
|
|
49442
|
+
graphNodeId,
|
|
49443
|
+
containsParentIds
|
|
49444
|
+
},
|
|
49445
|
+
record: record2,
|
|
49446
|
+
governingKnowledge
|
|
49447
|
+
};
|
|
49448
|
+
}
|
|
49229
49449
|
|
|
49230
49450
|
// ../core/src/knowledge/format.ts
|
|
49231
49451
|
function formatText(results) {
|
|
@@ -49287,6 +49507,8 @@ function formatOmDescribe(result) {
|
|
|
49287
49507
|
return formatRoleDescribe(result);
|
|
49288
49508
|
case "policy":
|
|
49289
49509
|
return formatPolicyDescribe(result);
|
|
49510
|
+
case "domain-item":
|
|
49511
|
+
return formatDomainItemDescribe(result);
|
|
49290
49512
|
}
|
|
49291
49513
|
}
|
|
49292
49514
|
function section(title, body) {
|
|
@@ -49409,6 +49631,31 @@ function formatPolicyDescribe(r) {
|
|
|
49409
49631
|
${appliesLines.join("\n")}` : "";
|
|
49410
49632
|
return join5([header, effectSection, appliesSection]);
|
|
49411
49633
|
}
|
|
49634
|
+
function formatDomainItemDescribe(r) {
|
|
49635
|
+
const header = join5([
|
|
49636
|
+
`Domain Item: ${r.id}`,
|
|
49637
|
+
[
|
|
49638
|
+
field("Domain", r.location.domainLabel),
|
|
49639
|
+
field("Name", r.name),
|
|
49640
|
+
field("Graph node", r.location.graphNodeId),
|
|
49641
|
+
field("Parent nodes", r.location.containsParentIds.join(", "))
|
|
49642
|
+
].filter((s) => s.length > 0).join("\n")
|
|
49643
|
+
]);
|
|
49644
|
+
const recordLines = [];
|
|
49645
|
+
for (const [k, v] of Object.entries(r.record)) {
|
|
49646
|
+
if (v === void 0 || v === null) continue;
|
|
49647
|
+
if (typeof v === "object" && !Array.isArray(v) && Object.keys(v).length === 0) continue;
|
|
49648
|
+
const display = Array.isArray(v) ? v.length === 0 ? null : `[${v.slice(0, 5).join(", ")}${v.length > 5 ? `, ...+${v.length - 5}` : ""}]` : typeof v === "object" ? JSON.stringify(v).slice(0, 120) : String(v);
|
|
49649
|
+
if (display === null) continue;
|
|
49650
|
+
recordLines.push(` ${k}: ${display}`);
|
|
49651
|
+
}
|
|
49652
|
+
const recordSection = recordLines.length ? `Record:
|
|
49653
|
+
${recordLines.join("\n")}` : "";
|
|
49654
|
+
const govLines = r.governingKnowledge.map((g) => ` - ${g.id} [${g.knowledgeKind}] ${g.title}`);
|
|
49655
|
+
const govSection = govLines.length ? `Governing knowledge:
|
|
49656
|
+
${govLines.join("\n")}` : "Governing knowledge:\n (none)";
|
|
49657
|
+
return join5([header, recordSection, govSection]);
|
|
49658
|
+
}
|
|
49412
49659
|
|
|
49413
49660
|
// ../core/src/knowledge/cli-helpers.ts
|
|
49414
49661
|
var OM_SEARCH_HIT_KINDS = ["system", "resource", "knowledge", "ontology", "role", "policy"];
|
|
@@ -49565,53 +49812,29 @@ init_config();
|
|
|
49565
49812
|
// src/cli/commands/knowledge/load-org-model.ts
|
|
49566
49813
|
var import_path3 = require("path");
|
|
49567
49814
|
var import_fs3 = require("fs");
|
|
49568
|
-
var import_module2 = require("module");
|
|
49569
49815
|
var ORG_MODEL_REL_PATH = "core/config/organization-model.ts";
|
|
49570
|
-
function getEsbuild2(startDir) {
|
|
49571
|
-
const consumerRequire = (0, import_module2.createRequire)((0, import_path3.resolve)(startDir, "package.json"));
|
|
49572
|
-
return consumerRequire("esbuild");
|
|
49573
|
-
}
|
|
49574
49816
|
async function loadOrgModel(projectRoot) {
|
|
49575
49817
|
const orgModelPath = (0, import_path3.resolve)(projectRoot, ORG_MODEL_REL_PATH);
|
|
49576
49818
|
if (!(0, import_fs3.existsSync)(orgModelPath)) {
|
|
49577
49819
|
return DEFAULT_ORGANIZATION_MODEL;
|
|
49578
49820
|
}
|
|
49579
|
-
let pkgDir = projectRoot;
|
|
49580
|
-
while (!(0, import_fs3.existsSync)((0, import_path3.resolve)(pkgDir, "package.json"))) {
|
|
49581
|
-
const parent = (0, import_path3.resolve)(pkgDir, "..");
|
|
49582
|
-
if (parent === pkgDir) break;
|
|
49583
|
-
pkgDir = parent;
|
|
49584
|
-
}
|
|
49585
|
-
let esbuild;
|
|
49586
|
-
try {
|
|
49587
|
-
esbuild = getEsbuild2(pkgDir);
|
|
49588
|
-
} catch {
|
|
49589
|
-
return DEFAULT_ORGANIZATION_MODEL;
|
|
49590
|
-
}
|
|
49591
|
-
const tmpOut = (0, import_path3.resolve)(projectRoot, `.elevasis-knowledge-tmp-${Date.now()}.mjs`);
|
|
49592
49821
|
try {
|
|
49593
|
-
await
|
|
49594
|
-
entryPoints: [orgModelPath],
|
|
49595
|
-
bundle: true,
|
|
49596
|
-
platform: "node",
|
|
49597
|
-
format: "esm",
|
|
49598
|
-
outfile: tmpOut,
|
|
49599
|
-
packages: "external",
|
|
49600
|
-
logLevel: "silent"
|
|
49601
|
-
});
|
|
49602
|
-
const fileUrl = `file:///${tmpOut.replace(/\\/g, "/")}`;
|
|
49603
|
-
const mod = await import(fileUrl);
|
|
49822
|
+
const mod = await loadTsModule(orgModelPath);
|
|
49604
49823
|
const model = mod["organizationModel"] ?? mod["canonicalOrganizationModel"] ?? mod["default"];
|
|
49605
49824
|
if (model && typeof model === "object" && "systems" in model) {
|
|
49606
49825
|
return model;
|
|
49607
49826
|
}
|
|
49608
|
-
|
|
49609
|
-
|
|
49610
|
-
|
|
49611
|
-
|
|
49612
|
-
|
|
49613
|
-
|
|
49614
|
-
|
|
49827
|
+
process.stderr.write(
|
|
49828
|
+
`[elevasis-sdk] loaded ${ORG_MODEL_REL_PATH} but found no organizationModel export; using empty default.
|
|
49829
|
+
`
|
|
49830
|
+
);
|
|
49831
|
+
} catch (error46) {
|
|
49832
|
+
const message = error46 instanceof Error ? error46.message : String(error46);
|
|
49833
|
+
process.stderr.write(
|
|
49834
|
+
`[elevasis-sdk] failed to load ${ORG_MODEL_REL_PATH}: ${message}
|
|
49835
|
+
Falling back to empty default model.
|
|
49836
|
+
`
|
|
49837
|
+
);
|
|
49615
49838
|
}
|
|
49616
49839
|
return DEFAULT_ORGANIZATION_MODEL;
|
|
49617
49840
|
}
|
|
@@ -49619,7 +49842,7 @@ async function loadOrgModel(projectRoot) {
|
|
|
49619
49842
|
// src/cli/commands/knowledge/ls.ts
|
|
49620
49843
|
function registerKnowledgeLs(program3) {
|
|
49621
49844
|
program3.command("knowledge:ls <path>").alias("om:ls").description(
|
|
49622
|
-
"List knowledge nodes for a Knowledge Map path\n Examples:\n elevasis-sdk om:ls /by-kind/playbook\n elevasis-sdk om:ls /by-system/sales.crm\n elevasis-sdk om:ls /by-ontology/sales.crm:object/deal\n elevasis-sdk om:ls /by-owner/role.ops-lead\n elevasis-sdk om:ls /graph/knowledge.outreach-playbook/governs\n elevasis-sdk om:ls /graph/system:sales.crm/governed-by\n elevasis-sdk om:ls /all-systems\n elevasis-sdk om:ls /all-resources\n elevasis-sdk om:ls /all-roles"
|
|
49845
|
+
"List knowledge nodes for a Knowledge Map path\n Examples:\n elevasis-sdk om:ls /by-kind/playbook\n elevasis-sdk om:ls /by-system/sales.crm\n elevasis-sdk om:ls /by-ontology/sales.crm:object/deal\n elevasis-sdk om:ls /by-owner/role.ops-lead\n elevasis-sdk om:ls /graph/knowledge.outreach-playbook/governs\n elevasis-sdk om:ls /graph/system:sales.crm/governed-by\n elevasis-sdk om:ls /all-systems\n elevasis-sdk om:ls /all-resources\n elevasis-sdk om:ls /all-roles\n elevasis-sdk om:ls /by-domain/clients\n elevasis-sdk om:ls /by-item/clients/<uuid>"
|
|
49623
49846
|
).option("--json", "Print wrapped JSON envelope { path, mount, args, results }").option("--ids-only", "Print one ID per line (for piping)").action(
|
|
49624
49847
|
wrapAction("knowledge:ls", async (pathArg, options) => {
|
|
49625
49848
|
let parsed;
|
|
@@ -49668,6 +49891,49 @@ function registerKnowledgeLs(program3) {
|
|
|
49668
49891
|
}
|
|
49669
49892
|
return;
|
|
49670
49893
|
}
|
|
49894
|
+
if (parsed.mount === "by-domain") {
|
|
49895
|
+
const domain2 = parsed.args[0];
|
|
49896
|
+
const collection = model[domain2] ?? {};
|
|
49897
|
+
const ids = Object.keys(collection).map((id) => `item:${domain2}:${id}`);
|
|
49898
|
+
if (options.json) {
|
|
49899
|
+
process.stdout.write(formatJson({ path: pathArg, parsed, results: ids }) + "\n");
|
|
49900
|
+
} else if (options.idsOnly) {
|
|
49901
|
+
if (ids.length > 0) process.stdout.write(ids.join("\n") + "\n");
|
|
49902
|
+
} else {
|
|
49903
|
+
if (ids.length === 0) {
|
|
49904
|
+
process.stdout.write(`(no items in domain "${domain2}")
|
|
49905
|
+
`);
|
|
49906
|
+
} else {
|
|
49907
|
+
process.stdout.write(`Domain: ${domain2} (${ids.length} item${ids.length === 1 ? "" : "s"})
|
|
49908
|
+
`);
|
|
49909
|
+
for (const id of ids) process.stdout.write(` ${id}
|
|
49910
|
+
`);
|
|
49911
|
+
}
|
|
49912
|
+
}
|
|
49913
|
+
return;
|
|
49914
|
+
}
|
|
49915
|
+
if (parsed.mount === "by-item") {
|
|
49916
|
+
const domain2 = parsed.args[0];
|
|
49917
|
+
const itemId = parsed.args[1];
|
|
49918
|
+
const canonicalId = `item:${domain2}:${itemId}`;
|
|
49919
|
+
const result = omDescribe(model, canonicalId);
|
|
49920
|
+
if (!result) {
|
|
49921
|
+
process.stderr.write(
|
|
49922
|
+
`knowledge:ls: no item found for "${canonicalId}".
|
|
49923
|
+
Use om:ls /by-domain/${domain2} to list all items in this domain.
|
|
49924
|
+
`
|
|
49925
|
+
);
|
|
49926
|
+
process.exit(1);
|
|
49927
|
+
}
|
|
49928
|
+
if (options.json) {
|
|
49929
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
49930
|
+
} else if (options.idsOnly) {
|
|
49931
|
+
process.stdout.write(result.id + "\n");
|
|
49932
|
+
} else {
|
|
49933
|
+
process.stdout.write(formatOmDescribe(result) + "\n");
|
|
49934
|
+
}
|
|
49935
|
+
return;
|
|
49936
|
+
}
|
|
49671
49937
|
const graph = buildOrganizationGraph({ organizationModel: model });
|
|
49672
49938
|
const knowledgeNodes = Object.values(model.knowledge);
|
|
49673
49939
|
let results;
|
|
@@ -49841,11 +50107,11 @@ function registerKnowledgeSkills(program3) {
|
|
|
49841
50107
|
}
|
|
49842
50108
|
|
|
49843
50109
|
// src/cli/commands/knowledge/generate.ts
|
|
49844
|
-
var
|
|
50110
|
+
var import_node_fs6 = require("node:fs");
|
|
49845
50111
|
var import_node_path5 = require("node:path");
|
|
49846
50112
|
|
|
49847
50113
|
// src/knowledge-codegen.ts
|
|
49848
|
-
var
|
|
50114
|
+
var import_node_fs5 = require("node:fs");
|
|
49849
50115
|
var import_node_path4 = require("node:path");
|
|
49850
50116
|
function targetFromNodeId2(nodeId2) {
|
|
49851
50117
|
const [kind, ...idParts] = nodeId2.split(":");
|
|
@@ -49864,7 +50130,7 @@ function canonicalizeKnowledgeNodeLinks(node) {
|
|
|
49864
50130
|
};
|
|
49865
50131
|
}
|
|
49866
50132
|
function listMdxFiles(directory) {
|
|
49867
|
-
return (0,
|
|
50133
|
+
return (0, import_node_fs5.readdirSync)(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
49868
50134
|
const path3 = (0, import_node_path4.join)(directory, entry.name);
|
|
49869
50135
|
if (entry.isDirectory()) return listMdxFiles(path3);
|
|
49870
50136
|
return entry.isFile() && (0, import_node_path4.extname)(entry.name) === ".mdx" ? [path3] : [];
|
|
@@ -49875,6 +50141,9 @@ function parseScalar(value) {
|
|
|
49875
50141
|
const quoted = trimmed.match(/^['"]([\s\S]*)['"]$/);
|
|
49876
50142
|
return quoted ? quoted[1] : trimmed;
|
|
49877
50143
|
}
|
|
50144
|
+
function normalizeLineEndings(value) {
|
|
50145
|
+
return value.replace(/\r\n/g, "\n");
|
|
50146
|
+
}
|
|
49878
50147
|
function parseFrontmatter(raw, filePath) {
|
|
49879
50148
|
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
49880
50149
|
if (!match) throw new Error(`[knowledge-node-codegen] Missing frontmatter in ${filePath}`);
|
|
@@ -49898,7 +50167,7 @@ function parseFrontmatter(raw, filePath) {
|
|
|
49898
50167
|
}
|
|
49899
50168
|
frontmatter[key] = values;
|
|
49900
50169
|
}
|
|
49901
|
-
return { frontmatter, body: match[2].trim() };
|
|
50170
|
+
return { frontmatter, body: normalizeLineEndings(match[2]).trim() };
|
|
49902
50171
|
}
|
|
49903
50172
|
function assertString(frontmatter, key, filePath) {
|
|
49904
50173
|
const value = frontmatter[key];
|
|
@@ -50062,7 +50331,7 @@ function readCommandForNode(node, cliCommand = "elevasis") {
|
|
|
50062
50331
|
];
|
|
50063
50332
|
}
|
|
50064
50333
|
function readKnowledgeNodeMdx(filePath) {
|
|
50065
|
-
const raw = (0,
|
|
50334
|
+
const raw = (0, import_node_fs5.readFileSync)(filePath, "utf8");
|
|
50066
50335
|
const { frontmatter, body } = parseFrontmatter(raw, filePath);
|
|
50067
50336
|
return {
|
|
50068
50337
|
id: assertString(frontmatter, "id", filePath),
|
|
@@ -50177,8 +50446,8 @@ function generateKnowledgeNodes(options) {
|
|
|
50177
50446
|
if (ids.has(node.id)) throw new Error(`[knowledge-node-codegen] Duplicate knowledge node id: ${node.id}`);
|
|
50178
50447
|
ids.add(node.id);
|
|
50179
50448
|
}
|
|
50180
|
-
(0,
|
|
50181
|
-
(0,
|
|
50449
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path4.dirname)(options.outputPath), { recursive: true });
|
|
50450
|
+
(0, import_node_fs5.writeFileSync)(
|
|
50182
50451
|
options.outputPath,
|
|
50183
50452
|
generateKnowledgeNodesTs({
|
|
50184
50453
|
nodes,
|
|
@@ -50189,8 +50458,8 @@ function generateKnowledgeNodes(options) {
|
|
|
50189
50458
|
"utf8"
|
|
50190
50459
|
);
|
|
50191
50460
|
if (options.knowledgeFlagsOutputPath) {
|
|
50192
|
-
(0,
|
|
50193
|
-
(0,
|
|
50461
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path4.dirname)(options.knowledgeFlagsOutputPath), { recursive: true });
|
|
50462
|
+
(0, import_node_fs5.writeFileSync)(
|
|
50194
50463
|
options.knowledgeFlagsOutputPath,
|
|
50195
50464
|
`${JSON.stringify(
|
|
50196
50465
|
generateKnowledgeFlagRegistry(nodes, sourcePaths, {
|
|
@@ -50228,7 +50497,7 @@ function registerKnowledgeGenerate(program3) {
|
|
|
50228
50497
|
projectRoot,
|
|
50229
50498
|
options.flagsOutput ?? ".claude/registries/knowledge-flags.json"
|
|
50230
50499
|
);
|
|
50231
|
-
if (!(0,
|
|
50500
|
+
if (!(0, import_node_fs6.existsSync)(sourceDir)) {
|
|
50232
50501
|
process.stderr.write(`knowledge:generate: source directory not found: ${sourceDir}
|
|
50233
50502
|
`);
|
|
50234
50503
|
process.exitCode = 1;
|
|
@@ -50280,7 +50549,7 @@ function registerKnowledgeSearch(program3) {
|
|
|
50280
50549
|
init_config();
|
|
50281
50550
|
function registerKnowledgeDescribe(program3) {
|
|
50282
50551
|
program3.command("knowledge:describe <nodeId>").alias("om:describe").description(
|
|
50283
|
-
"Show a structured neighborhood view for any OM node id\n (system, resource, knowledge, ontology, role, policy \u2014 auto-detected
|
|
50552
|
+
"Show a structured neighborhood view for any OM node id\n (system, resource, knowledge, ontology, role, policy, domain-item \u2014 auto-detected)\n Domain items: item:<domain>:<id> OR bare client:<uuid>, role:<id>, etc.\n Example: elevasis-sdk om:describe sales.lead-gen\n Example: elevasis-sdk om:describe knowledge.outreach-playbook\n Example: elevasis-sdk om:describe item:clients:<uuid>\n Example: elevasis-sdk om:describe client:<uuid> (back-compat bare form)\n Note: for portfolio/DB data (deals, lineage) use client:get <id> instead."
|
|
50284
50553
|
).option("--json", "Print as JSON").action(
|
|
50285
50554
|
wrapAction("knowledge:describe", async (nodeId2, options) => {
|
|
50286
50555
|
const projectRoot = getProjectRoot();
|
|
@@ -50288,7 +50557,11 @@ function registerKnowledgeDescribe(program3) {
|
|
|
50288
50557
|
const result = omDescribe(model, nodeId2);
|
|
50289
50558
|
if (!result) {
|
|
50290
50559
|
process.stderr.write(
|
|
50291
|
-
`knowledge:describe: no OM node found for id "${nodeId2}".
|
|
50560
|
+
`knowledge:describe: no OM node found for id "${nodeId2}".
|
|
50561
|
+
- For domain items use: om:describe item:<domain>:<id> (domains: clients, roles, policies, customers, offerings, goals)
|
|
50562
|
+
- Bare forms also work: om:describe client:<uuid>, om:describe role:<id>, etc.
|
|
50563
|
+
- To find nodes by keyword: om:search <keyword>
|
|
50564
|
+
- To list all items in a domain: om:ls /by-domain/<domain>
|
|
50292
50565
|
`
|
|
50293
50566
|
);
|
|
50294
50567
|
process.exit(1);
|
|
@@ -50314,7 +50587,7 @@ function registerKnowledgeCommands(program3) {
|
|
|
50314
50587
|
}
|
|
50315
50588
|
|
|
50316
50589
|
// src/cli/commands/request/request.ts
|
|
50317
|
-
var
|
|
50590
|
+
var import_node_fs7 = require("node:fs");
|
|
50318
50591
|
var import_node_path6 = require("node:path");
|
|
50319
50592
|
init_source();
|
|
50320
50593
|
init_config();
|
|
@@ -50379,7 +50652,7 @@ function registerRequestCommands(program3) {
|
|
|
50379
50652
|
throw new Error("Provide --input <json> or --input-file <path>");
|
|
50380
50653
|
}
|
|
50381
50654
|
const resolvedInputFile = options.inputFile ? resolveProjectRelative(options.inputFile) : void 0;
|
|
50382
|
-
const raw = resolvedInputFile ? JSON.parse((0,
|
|
50655
|
+
const raw = resolvedInputFile ? JSON.parse((0, import_node_fs7.readFileSync)(resolvedInputFile, "utf8")) : JSON.parse(options.input);
|
|
50383
50656
|
const parsed = CreateRequestInputSchema.safeParse(raw);
|
|
50384
50657
|
if (!parsed.success) {
|
|
50385
50658
|
const issues = parsed.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
@@ -50403,7 +50676,7 @@ ${issues}`);
|
|
|
50403
50676
|
const tmpDir = (0, import_node_path6.join)(getProjectRoot(), "tmp");
|
|
50404
50677
|
if (resolvedInputFile.startsWith(tmpDir + "/") || resolvedInputFile.startsWith(tmpDir + "\\")) {
|
|
50405
50678
|
try {
|
|
50406
|
-
(0,
|
|
50679
|
+
(0, import_node_fs7.unlinkSync)(resolvedInputFile);
|
|
50407
50680
|
} catch {
|
|
50408
50681
|
}
|
|
50409
50682
|
} else {
|
|
@@ -50472,7 +50745,7 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
|
|
|
50472
50745
|
|
|
50473
50746
|
// src/cli/commands/ui/ui-switcher.ts
|
|
50474
50747
|
var import_node_child_process = require("node:child_process");
|
|
50475
|
-
var
|
|
50748
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
50476
50749
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
50477
50750
|
init_config();
|
|
50478
50751
|
function run(command, args, cwd) {
|
|
@@ -50483,10 +50756,10 @@ function run(command, args, cwd) {
|
|
|
50483
50756
|
});
|
|
50484
50757
|
}
|
|
50485
50758
|
function readJson(filePath) {
|
|
50486
|
-
return JSON.parse(
|
|
50759
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
50487
50760
|
}
|
|
50488
50761
|
function writeJson(filePath, value) {
|
|
50489
|
-
|
|
50762
|
+
import_node_fs8.default.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
50490
50763
|
`);
|
|
50491
50764
|
}
|
|
50492
50765
|
function requireDependencies(packageJson, filePath) {
|
|
@@ -50497,7 +50770,7 @@ function requireDependencies(packageJson, filePath) {
|
|
|
50497
50770
|
}
|
|
50498
50771
|
function resolveExistingDir(label, dir) {
|
|
50499
50772
|
const resolved = import_node_path7.default.resolve(dir);
|
|
50500
|
-
if (!
|
|
50773
|
+
if (!import_node_fs8.default.existsSync(resolved) || !import_node_fs8.default.statSync(resolved).isDirectory()) {
|
|
50501
50774
|
throw new Error(`${label} not found: ${resolved}`);
|
|
50502
50775
|
}
|
|
50503
50776
|
return resolved;
|
|
@@ -50505,7 +50778,7 @@ function resolveExistingDir(label, dir) {
|
|
|
50505
50778
|
function findRepoRootFromProject(projectRoot) {
|
|
50506
50779
|
let dir = projectRoot;
|
|
50507
50780
|
while (true) {
|
|
50508
|
-
if (
|
|
50781
|
+
if (import_node_fs8.default.existsSync(import_node_path7.default.join(dir, "packages", "ui", "package.json"))) return dir;
|
|
50509
50782
|
const parent = import_node_path7.default.dirname(dir);
|
|
50510
50783
|
if (parent === dir) return null;
|
|
50511
50784
|
dir = parent;
|
|
@@ -50522,10 +50795,10 @@ function resolveUiPackageRoot(projectRoot, explicitRoot) {
|
|
|
50522
50795
|
return import_node_path7.default.join(repoRoot, "packages", "ui");
|
|
50523
50796
|
}
|
|
50524
50797
|
function removeLocalUiTarballs(templateTmpDir) {
|
|
50525
|
-
if (!
|
|
50526
|
-
for (const entry of
|
|
50798
|
+
if (!import_node_fs8.default.existsSync(templateTmpDir)) return;
|
|
50799
|
+
for (const entry of import_node_fs8.default.readdirSync(templateTmpDir)) {
|
|
50527
50800
|
if (entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz")) {
|
|
50528
|
-
|
|
50801
|
+
import_node_fs8.default.rmSync(import_node_path7.default.join(templateTmpDir, entry), { force: true });
|
|
50529
50802
|
}
|
|
50530
50803
|
}
|
|
50531
50804
|
}
|
|
@@ -50550,24 +50823,24 @@ function useLocalUi(options = {}) {
|
|
|
50550
50823
|
const templateTmpDir = import_node_path7.default.join(projectRoot, "tmp");
|
|
50551
50824
|
const uiPackageJsonPath = import_node_path7.default.join(uiPackageRoot, "package.json");
|
|
50552
50825
|
const uiPackageBackupPath = import_node_path7.default.join(uiPackageRoot, "package.json.local-pack.bak");
|
|
50553
|
-
if (!
|
|
50826
|
+
if (!import_node_fs8.default.existsSync(templateUiPackageJsonPath)) {
|
|
50554
50827
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
50555
50828
|
}
|
|
50556
|
-
|
|
50829
|
+
import_node_fs8.default.mkdirSync(templateTmpDir, { recursive: true });
|
|
50557
50830
|
removeLocalUiTarballs(templateTmpDir);
|
|
50558
50831
|
run("pnpm", ["--filter", "@repo/ui", "build:publish"], commandRoot);
|
|
50559
50832
|
try {
|
|
50560
|
-
const raw =
|
|
50561
|
-
|
|
50833
|
+
const raw = import_node_fs8.default.readFileSync(uiPackageJsonPath, "utf8");
|
|
50834
|
+
import_node_fs8.default.writeFileSync(uiPackageBackupPath, raw);
|
|
50562
50835
|
writeJson(uiPackageJsonPath, prepareUiPackageForPack(JSON.parse(raw)));
|
|
50563
50836
|
run("pnpm", ["-C", uiPackageRoot, "pack", "--pack-destination", templateTmpDir], commandRoot);
|
|
50564
50837
|
} finally {
|
|
50565
|
-
if (
|
|
50566
|
-
|
|
50567
|
-
|
|
50838
|
+
if (import_node_fs8.default.existsSync(uiPackageBackupPath)) {
|
|
50839
|
+
import_node_fs8.default.copyFileSync(uiPackageBackupPath, uiPackageJsonPath);
|
|
50840
|
+
import_node_fs8.default.rmSync(uiPackageBackupPath, { force: true });
|
|
50568
50841
|
}
|
|
50569
50842
|
}
|
|
50570
|
-
const tarballName =
|
|
50843
|
+
const tarballName = import_node_fs8.default.readdirSync(templateTmpDir).find((entry) => entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz"));
|
|
50571
50844
|
if (!tarballName) {
|
|
50572
50845
|
throw new Error(`Failed to create local @elevasis/ui tarball in ${templateTmpDir}`);
|
|
50573
50846
|
}
|
|
@@ -50588,7 +50861,7 @@ function usePublishedUi(options = {}) {
|
|
|
50588
50861
|
if (!uiVersion) {
|
|
50589
50862
|
throw new Error("Could not determine @elevasis/ui version. Pass --version <version>.");
|
|
50590
50863
|
}
|
|
50591
|
-
if (!
|
|
50864
|
+
if (!import_node_fs8.default.existsSync(templateUiPackageJsonPath)) {
|
|
50592
50865
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
50593
50866
|
}
|
|
50594
50867
|
const templateUiPackageJson = readJson(templateUiPackageJsonPath);
|
|
@@ -50614,7 +50887,7 @@ function registerUiCommands(program3) {
|
|
|
50614
50887
|
}
|
|
50615
50888
|
|
|
50616
50889
|
// src/cli/commands/doctor.ts
|
|
50617
|
-
var
|
|
50890
|
+
var import_node_fs9 = require("node:fs");
|
|
50618
50891
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
50619
50892
|
init_source();
|
|
50620
50893
|
init_config();
|
|
@@ -50654,7 +50927,7 @@ function registerDoctorCommand(program3) {
|
|
|
50654
50927
|
process.exit(1);
|
|
50655
50928
|
}
|
|
50656
50929
|
const envPath2 = import_node_path8.default.join(projectRoot, ".env");
|
|
50657
|
-
const envExists = (0,
|
|
50930
|
+
const envExists = (0, import_node_fs9.existsSync)(envPath2);
|
|
50658
50931
|
if (!envExists) {
|
|
50659
50932
|
fail(".env", `Not found at ${envPath2}. Create it from .env.example and fill in ELEVASIS_PLATFORM_KEY.`);
|
|
50660
50933
|
if (isVerbose) verbose(`Checked: ${envPath2}`);
|
|
@@ -51624,6 +51897,9 @@ function registerNoteCommands(program3) {
|
|
|
51624
51897
|
// src/cli/commands/agent/agent.ts
|
|
51625
51898
|
init_source();
|
|
51626
51899
|
init_config();
|
|
51900
|
+
function getResourceType2(resource) {
|
|
51901
|
+
return resource.type ?? resource.resourceType;
|
|
51902
|
+
}
|
|
51627
51903
|
function printJson6(value) {
|
|
51628
51904
|
console.log(JSON.stringify(value, null, 2));
|
|
51629
51905
|
}
|
|
@@ -51632,7 +51908,7 @@ function registerAgentList(program3) {
|
|
|
51632
51908
|
wrapAction("agent:list", async (options) => {
|
|
51633
51909
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
51634
51910
|
const result = await apiGet("/api/external/resources", apiUrl);
|
|
51635
|
-
const agents = result.resources.filter((resource) => resource
|
|
51911
|
+
const agents = result.resources.filter((resource) => getResourceType2(resource) === "agent");
|
|
51636
51912
|
if (options.json) {
|
|
51637
51913
|
printJson6({ agents, total: agents.length });
|
|
51638
51914
|
return;
|
|
@@ -51685,6 +51961,7 @@ function registerAgentCommands(program3) {
|
|
|
51685
51961
|
}
|
|
51686
51962
|
|
|
51687
51963
|
// src/cli/commands/session/session.ts
|
|
51964
|
+
var import_node_fs10 = require("node:fs");
|
|
51688
51965
|
init_source();
|
|
51689
51966
|
init_config();
|
|
51690
51967
|
function printJson7(value) {
|
|
@@ -51698,8 +51975,108 @@ function endpointWithQuery6(endpoint, params) {
|
|
|
51698
51975
|
const query = params.toString();
|
|
51699
51976
|
return query ? `${endpoint}?${query}` : endpoint;
|
|
51700
51977
|
}
|
|
51978
|
+
function parseJson(value, label) {
|
|
51979
|
+
try {
|
|
51980
|
+
return JSON.parse(value);
|
|
51981
|
+
} catch (error46) {
|
|
51982
|
+
const message = error46 instanceof Error ? error46.message : String(error46);
|
|
51983
|
+
throw new Error(`Invalid JSON for ${label}: ${message}`);
|
|
51984
|
+
}
|
|
51985
|
+
}
|
|
51986
|
+
function readJsonFile(path3, label) {
|
|
51987
|
+
const resolved = resolveProjectRelative(path3);
|
|
51988
|
+
return parseJson((0, import_node_fs10.readFileSync)(resolved, "utf8"), label);
|
|
51989
|
+
}
|
|
51990
|
+
function resolveTurnInput(options) {
|
|
51991
|
+
if (options.input && options.inputFile) {
|
|
51992
|
+
throw new Error("Use either --input or --input-file, not both.");
|
|
51993
|
+
}
|
|
51994
|
+
if (options.inputFile) {
|
|
51995
|
+
return readJsonFile(options.inputFile, "--input-file");
|
|
51996
|
+
}
|
|
51997
|
+
if (options.input) {
|
|
51998
|
+
return parseJson(options.input, "--input");
|
|
51999
|
+
}
|
|
52000
|
+
throw new Error("Provide turn input with --input <json> or --input-file <path>.");
|
|
52001
|
+
}
|
|
52002
|
+
function messagesEndpoint(sessionId, limit, cursor) {
|
|
52003
|
+
const params = new URLSearchParams();
|
|
52004
|
+
appendQuery6(params, "limit", limit);
|
|
52005
|
+
appendQuery6(params, "cursor", cursor);
|
|
52006
|
+
return endpointWithQuery6(`/api/external/sessions/${sessionId}/messages`, params);
|
|
52007
|
+
}
|
|
52008
|
+
async function fetchSessionMessages(sessionId, apiUrl, options) {
|
|
52009
|
+
const fetchAll = options.all === true || options.page !== true;
|
|
52010
|
+
let cursor = options.cursor;
|
|
52011
|
+
let firstCursor;
|
|
52012
|
+
let lastPage;
|
|
52013
|
+
let pagesFetched = 0;
|
|
52014
|
+
const messages = [];
|
|
52015
|
+
while (true) {
|
|
52016
|
+
const page = await apiGet(messagesEndpoint(sessionId, options.limit, cursor), apiUrl);
|
|
52017
|
+
pagesFetched += 1;
|
|
52018
|
+
if (!fetchAll) {
|
|
52019
|
+
return { ...page, pagesFetched };
|
|
52020
|
+
}
|
|
52021
|
+
if (pagesFetched === 1) {
|
|
52022
|
+
firstCursor = page.cursor;
|
|
52023
|
+
}
|
|
52024
|
+
messages.push(...page.messages);
|
|
52025
|
+
lastPage = page;
|
|
52026
|
+
if (!page.hasMore) {
|
|
52027
|
+
return {
|
|
52028
|
+
sessionId: page.sessionId,
|
|
52029
|
+
messages,
|
|
52030
|
+
limit: page.limit,
|
|
52031
|
+
cursor: firstCursor,
|
|
52032
|
+
nextCursor: void 0,
|
|
52033
|
+
total: page.total ?? messages.length,
|
|
52034
|
+
hasMore: false,
|
|
52035
|
+
pagesFetched
|
|
52036
|
+
};
|
|
52037
|
+
}
|
|
52038
|
+
if (page.nextCursor === void 0 || page.nextCursor === null) {
|
|
52039
|
+
throw new Error("Messages response had hasMore=true but no nextCursor.");
|
|
52040
|
+
}
|
|
52041
|
+
cursor = String(page.nextCursor);
|
|
52042
|
+
}
|
|
52043
|
+
}
|
|
52044
|
+
function messageText(message) {
|
|
52045
|
+
const value = message.text ?? message.content;
|
|
52046
|
+
if (value !== void 0) return String(value);
|
|
52047
|
+
return JSON.stringify(message, null, 2);
|
|
52048
|
+
}
|
|
52049
|
+
function printMessage(message) {
|
|
52050
|
+
const index = message.messageIndex === void 0 ? "" : `#${message.messageIndex}`;
|
|
52051
|
+
const role = message.role ?? message.messageType ?? "message";
|
|
52052
|
+
const turn = message.turnNumber === void 0 ? "" : ` turn ${message.turnNumber}`;
|
|
52053
|
+
const heading = [index, role + turn].filter(Boolean).join(" ");
|
|
52054
|
+
console.log(source_default.white(` ${heading}`));
|
|
52055
|
+
for (const line of messageText(message).split(/\r?\n/)) {
|
|
52056
|
+
console.log(source_default.gray(` ${line}`));
|
|
52057
|
+
}
|
|
52058
|
+
}
|
|
52059
|
+
function registerSessionCreate(program3) {
|
|
52060
|
+
program3.command("session:create <resourceId>").description("Create a multi-turn agent session").option("--user-id <id>", "User ID for the session").option("--metadata <json>", "Session metadata as JSON").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
52061
|
+
wrapAction("session:create", async (resourceId, options) => {
|
|
52062
|
+
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
52063
|
+
const body = { resourceId };
|
|
52064
|
+
if (options.userId) body.userId = options.userId;
|
|
52065
|
+
if (options.metadata) body.metadata = parseJson(options.metadata, "--metadata");
|
|
52066
|
+
const session = await apiPost("/api/external/sessions", body, apiUrl);
|
|
52067
|
+
if (options.json) {
|
|
52068
|
+
printJson7(session);
|
|
52069
|
+
return;
|
|
52070
|
+
}
|
|
52071
|
+
console.log(source_default.green(`Created session ${session.sessionId}.`));
|
|
52072
|
+
console.log(source_default.gray(` Agent: ${session.resourceId}`));
|
|
52073
|
+
console.log(source_default.gray(` Turns: ${session.turnCount}`));
|
|
52074
|
+
console.log(source_default.gray(` Created: ${new Date(session.createdAt).toLocaleString()}`));
|
|
52075
|
+
})
|
|
52076
|
+
);
|
|
52077
|
+
}
|
|
51701
52078
|
function registerSessionList(program3) {
|
|
51702
|
-
program3.command("session:list").description("List
|
|
52079
|
+
program3.command("session:list").description("List multi-turn agent sessions").option("--resource-id <id>", "Filter by agent resource ID").option("--user-id <id>", "Filter by user ID").option("--limit <limit>", "Maximum number of sessions to return").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
51703
52080
|
wrapAction("session:list", async (options) => {
|
|
51704
52081
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
51705
52082
|
const params = new URLSearchParams();
|
|
@@ -51711,16 +52088,16 @@ function registerSessionList(program3) {
|
|
|
51711
52088
|
printJson7(result);
|
|
51712
52089
|
return;
|
|
51713
52090
|
}
|
|
51714
|
-
|
|
51715
|
-
|
|
51716
|
-
console.log(source_default.yellow("No active sessions found."));
|
|
52091
|
+
if (result.sessions.length === 0) {
|
|
52092
|
+
console.log(source_default.yellow("No sessions found."));
|
|
51717
52093
|
return;
|
|
51718
52094
|
}
|
|
51719
|
-
console.log(source_default.cyan(`Sessions (${
|
|
51720
|
-
for (const session of
|
|
52095
|
+
console.log(source_default.cyan(`Sessions (${result.sessions.length} of ${result.total}):`));
|
|
52096
|
+
for (const session of result.sessions) {
|
|
51721
52097
|
console.log(source_default.white(` ${source_default.bold(session.sessionId)}`));
|
|
51722
52098
|
if (session.title) console.log(source_default.gray(` Title: ${session.title}`));
|
|
51723
52099
|
console.log(source_default.gray(` Agent: ${session.resourceId}`));
|
|
52100
|
+
console.log(source_default.gray(` Status: ${session.isEnded ? "ended" : "active"}`));
|
|
51724
52101
|
console.log(source_default.gray(` Turns: ${session.turnCount}`));
|
|
51725
52102
|
console.log(source_default.gray(` Updated: ${new Date(session.updatedAt).toLocaleString()}`));
|
|
51726
52103
|
console.log();
|
|
@@ -51729,7 +52106,7 @@ function registerSessionList(program3) {
|
|
|
51729
52106
|
);
|
|
51730
52107
|
}
|
|
51731
52108
|
function registerSessionGet(program3) {
|
|
51732
|
-
program3.command("session:get <id>").description("Get session details
|
|
52109
|
+
program3.command("session:get <id>").description("Get session details").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
51733
52110
|
wrapAction("session:get", async (id, options) => {
|
|
51734
52111
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
51735
52112
|
const session = await apiGet(`/api/external/sessions/${id}`, apiUrl);
|
|
@@ -51749,11 +52126,57 @@ function registerSessionGet(program3) {
|
|
|
51749
52126
|
})
|
|
51750
52127
|
);
|
|
51751
52128
|
}
|
|
52129
|
+
function registerSessionTurn(program3) {
|
|
52130
|
+
program3.command("session:turn <id>").description("Execute a turn in an active agent session").option("-i, --input <json>", "Turn input as JSON").option("-f, --input-file <path>", "Read turn input from a JSON file").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
52131
|
+
wrapAction("session:turn", async (id, options) => {
|
|
52132
|
+
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
52133
|
+
const input = resolveTurnInput(options);
|
|
52134
|
+
const result = await apiPost(`/api/external/sessions/${id}/turns`, { input }, apiUrl);
|
|
52135
|
+
if (options.json) {
|
|
52136
|
+
printJson7(result);
|
|
52137
|
+
return;
|
|
52138
|
+
}
|
|
52139
|
+
console.log(source_default.green(`Turn ${result.turnNumber} complete.`));
|
|
52140
|
+
console.log(source_default.gray(` Session ID: ${result.sessionId}`));
|
|
52141
|
+
console.log(source_default.gray(` Execution ID: ${result.executionId}`));
|
|
52142
|
+
if (result.duration !== void 0) console.log(source_default.gray(` Duration: ${result.duration}ms`));
|
|
52143
|
+
console.log();
|
|
52144
|
+
console.log(source_default.green("Output:"));
|
|
52145
|
+
console.log(JSON.stringify(result.output, null, 2));
|
|
52146
|
+
})
|
|
52147
|
+
);
|
|
52148
|
+
}
|
|
52149
|
+
function registerSessionMessages(program3) {
|
|
52150
|
+
program3.command("session:messages <id>").description("Export session transcript messages").option("--limit <limit>", "Messages per API page").option("--cursor <cursor>", "Message_index cursor to start after").option("--page", "Fetch one API page instead of the full transcript").option("--all", "Fetch all pages (default)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
52151
|
+
wrapAction("session:messages", async (id, options) => {
|
|
52152
|
+
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
52153
|
+
const result = await fetchSessionMessages(id, apiUrl, options);
|
|
52154
|
+
if (options.json) {
|
|
52155
|
+
printJson7(result);
|
|
52156
|
+
return;
|
|
52157
|
+
}
|
|
52158
|
+
const total = result.total === void 0 ? result.messages.length : result.total;
|
|
52159
|
+
console.log(source_default.cyan(`Messages (${result.messages.length} of ${total}, ${result.pagesFetched} page(s)):`));
|
|
52160
|
+
if (result.messages.length === 0) {
|
|
52161
|
+
console.log(source_default.yellow("No messages found."));
|
|
52162
|
+
return;
|
|
52163
|
+
}
|
|
52164
|
+
for (const message of result.messages) {
|
|
52165
|
+
printMessage(message);
|
|
52166
|
+
console.log();
|
|
52167
|
+
}
|
|
52168
|
+
})
|
|
52169
|
+
);
|
|
52170
|
+
}
|
|
51752
52171
|
function registerSessionEnd(program3) {
|
|
51753
|
-
program3.command("session:end <id>").description("
|
|
52172
|
+
program3.command("session:end <id>").description("End an active agent session").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
|
|
51754
52173
|
wrapAction("session:end", async (id, options) => {
|
|
51755
52174
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
51756
|
-
const result = await
|
|
52175
|
+
const result = await apiPost(
|
|
52176
|
+
`/api/external/sessions/${id}/end`,
|
|
52177
|
+
{},
|
|
52178
|
+
apiUrl
|
|
52179
|
+
);
|
|
51757
52180
|
if (options.json) {
|
|
51758
52181
|
printJson7(result);
|
|
51759
52182
|
return;
|
|
@@ -51765,8 +52188,11 @@ function registerSessionEnd(program3) {
|
|
|
51765
52188
|
|
|
51766
52189
|
// src/cli/commands/session/index.ts
|
|
51767
52190
|
function registerSessionCommands(program3) {
|
|
52191
|
+
registerSessionCreate(program3);
|
|
51768
52192
|
registerSessionList(program3);
|
|
51769
52193
|
registerSessionGet(program3);
|
|
52194
|
+
registerSessionTurn(program3);
|
|
52195
|
+
registerSessionMessages(program3);
|
|
51770
52196
|
registerSessionEnd(program3);
|
|
51771
52197
|
}
|
|
51772
52198
|
|
|
@@ -51877,6 +52303,52 @@ function registerSkillScaffoldCommand(program3) {
|
|
|
51877
52303
|
);
|
|
51878
52304
|
}
|
|
51879
52305
|
|
|
52306
|
+
// src/cli/json-file-argv.ts
|
|
52307
|
+
var import_node_fs15 = require("node:fs");
|
|
52308
|
+
var import_node_path16 = require("node:path");
|
|
52309
|
+
init_config();
|
|
52310
|
+
var JSON_FILE_PREFIX = "@json:";
|
|
52311
|
+
var JsonFileArgError = class extends Error {
|
|
52312
|
+
constructor(message, code) {
|
|
52313
|
+
super(message);
|
|
52314
|
+
this.code = code;
|
|
52315
|
+
this.name = "JsonFileArgError";
|
|
52316
|
+
}
|
|
52317
|
+
};
|
|
52318
|
+
function resolveJsonFilePath(path3, options) {
|
|
52319
|
+
if (path3.trim() === "") {
|
|
52320
|
+
throw new JsonFileArgError("@json: requires a file path", "EMPTY_JSON_FILE_REF");
|
|
52321
|
+
}
|
|
52322
|
+
if ((0, import_node_path16.isAbsolute)(path3)) return path3;
|
|
52323
|
+
const cwd = options.cwd ?? process.cwd();
|
|
52324
|
+
const projectRoot = (options.findProjectRoot ?? tryFindProjectRoot)(cwd);
|
|
52325
|
+
return (0, import_node_path16.resolve)(projectRoot ?? cwd, path3);
|
|
52326
|
+
}
|
|
52327
|
+
function readJsonFileReference(ref, options) {
|
|
52328
|
+
const relativeOrAbsolutePath = ref.slice(JSON_FILE_PREFIX.length);
|
|
52329
|
+
const resolvedPath = resolveJsonFilePath(relativeOrAbsolutePath, options);
|
|
52330
|
+
const raw = (options.readFile ?? ((path3) => (0, import_node_fs15.readFileSync)(path3, "utf8")))(resolvedPath);
|
|
52331
|
+
try {
|
|
52332
|
+
JSON.parse(raw);
|
|
52333
|
+
} catch {
|
|
52334
|
+
throw new JsonFileArgError(`@json file must contain valid JSON: ${relativeOrAbsolutePath}`, "INVALID_JSON_FILE");
|
|
52335
|
+
}
|
|
52336
|
+
return raw;
|
|
52337
|
+
}
|
|
52338
|
+
function expandArg(arg, options) {
|
|
52339
|
+
if (arg.startsWith(JSON_FILE_PREFIX)) {
|
|
52340
|
+
return readJsonFileReference(arg, options);
|
|
52341
|
+
}
|
|
52342
|
+
const equalsRefIndex = arg.indexOf(`=${JSON_FILE_PREFIX}`);
|
|
52343
|
+
if (equalsRefIndex === -1) return arg;
|
|
52344
|
+
const prefix = arg.slice(0, equalsRefIndex + 1);
|
|
52345
|
+
const ref = arg.slice(equalsRefIndex + 1);
|
|
52346
|
+
return `${prefix}${readJsonFileReference(ref, options)}`;
|
|
52347
|
+
}
|
|
52348
|
+
function expandJsonFileArgs(args, options = {}) {
|
|
52349
|
+
return args.map((arg) => expandArg(arg, options));
|
|
52350
|
+
}
|
|
52351
|
+
|
|
51880
52352
|
// src/cli/index.ts
|
|
51881
52353
|
init_config();
|
|
51882
52354
|
var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
@@ -51962,9 +52434,12 @@ Commands:
|
|
|
51962
52434
|
elevasis-sdk schedule:create --name <name> ... Create a task schedule
|
|
51963
52435
|
elevasis-sdk agent:list List deployed agents
|
|
51964
52436
|
elevasis-sdk agent:get <id> Get agent metadata and OM linkage
|
|
51965
|
-
elevasis-sdk session:
|
|
51966
|
-
elevasis-sdk session:
|
|
51967
|
-
elevasis-sdk session:
|
|
52437
|
+
elevasis-sdk session:create <resourceId> Create an agent session
|
|
52438
|
+
elevasis-sdk session:turn <id> -f tmp/turn.json Execute a session turn
|
|
52439
|
+
elevasis-sdk session:messages <id> Export session transcript messages
|
|
52440
|
+
elevasis-sdk session:list List agent sessions
|
|
52441
|
+
elevasis-sdk session:get <id> Get session details
|
|
52442
|
+
elevasis-sdk session:end <id> End an active agent session
|
|
51968
52443
|
elevasis-sdk acquisition:list:list List acquisition lists
|
|
51969
52444
|
elevasis-sdk acquisition:deal:list List acquisition deals
|
|
51970
52445
|
elevasis-sdk knowledge:generate Generate knowledge nodes from MDX files
|
|
@@ -52012,7 +52487,15 @@ registerCliCatalogCommand(program2);
|
|
|
52012
52487
|
registerOmScaffoldCommands(program2);
|
|
52013
52488
|
registerSkillScaffoldCommand(program2);
|
|
52014
52489
|
registerSkillCheckCoverageCommand(program2);
|
|
52015
|
-
|
|
52490
|
+
try {
|
|
52491
|
+
program2.parse(expandJsonFileArgs(process.argv), { from: "node" });
|
|
52492
|
+
} catch (error46) {
|
|
52493
|
+
if (error46 instanceof JsonFileArgError) {
|
|
52494
|
+
process.stderr.write(JSON.stringify({ error: error46.message, code: error46.code }) + "\n");
|
|
52495
|
+
process.exit(1);
|
|
52496
|
+
}
|
|
52497
|
+
throw error46;
|
|
52498
|
+
}
|
|
52016
52499
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52017
52500
|
0 && (module.exports = {
|
|
52018
52501
|
getProjectRoot
|