@odla-ai/cli 0.25.9 → 0.25.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/bin.cjs +54 -17
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-HXUVCUEM.js → chunk-335ODYSF.js} +55 -18
- package/dist/chunk-335ODYSF.js.map +1 -0
- package/dist/index.cjs +54 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HXUVCUEM.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -6623,7 +6623,7 @@ Usage:
|
|
|
6623
6623
|
odla-ai pm handoff --app <id> [--json]
|
|
6624
6624
|
odla-ai discuss groups [--json]
|
|
6625
6625
|
odla-ai discuss list [--app <id>] [--q <text>] [--state open|resolved|all] [--json]
|
|
6626
|
-
odla-ai discuss read <topic> [--json]
|
|
6626
|
+
odla-ai discuss read <topic> [--limit <n> --offset <n>] [--json]
|
|
6627
6627
|
odla-ai discuss post --app <id> --subject "..." --body "..." [--markup "... @[Label](kind/id)"] [--mutation-id <id>]
|
|
6628
6628
|
odla-ai discuss reply <topic> --body "..." [--markup "..."] [--mutation-id <id>]
|
|
6629
6629
|
odla-ai discuss resolve <topic> [--reopen] [--mutation-id <id>]
|
|
@@ -7469,22 +7469,59 @@ async function discussList(ctx, parsed) {
|
|
|
7469
7469
|
}
|
|
7470
7470
|
});
|
|
7471
7471
|
}
|
|
7472
|
-
async function discussRead(ctx, id) {
|
|
7473
|
-
const
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7472
|
+
async function discussRead(ctx, id, parsed) {
|
|
7473
|
+
const requestedLimit = stringOpt(parsed.options.limit);
|
|
7474
|
+
const requestedOffset = stringOpt(parsed.options.offset);
|
|
7475
|
+
if (requestedLimit !== void 0 || requestedOffset !== void 0) {
|
|
7476
|
+
const query = new URLSearchParams({
|
|
7477
|
+
limit: requestedLimit ?? "200",
|
|
7478
|
+
offset: requestedOffset ?? "0"
|
|
7479
|
+
});
|
|
7480
|
+
const page = await request(ctx, "GET", `/topics/${encodeURIComponent(id)}?${query}`);
|
|
7481
|
+
emit(ctx, page, () => renderRead(ctx, page.topic, page.posts));
|
|
7482
|
+
return;
|
|
7483
|
+
}
|
|
7484
|
+
for (let scan = 0; scan < 3; scan++) {
|
|
7485
|
+
const posts = /* @__PURE__ */ new Map();
|
|
7486
|
+
let topic = null;
|
|
7487
|
+
let offset = 0;
|
|
7488
|
+
for (; ; ) {
|
|
7489
|
+
const page = await request(
|
|
7490
|
+
ctx,
|
|
7491
|
+
"GET",
|
|
7492
|
+
`/topics/${encodeURIComponent(id)}?limit=200&offset=${offset}`
|
|
7493
|
+
);
|
|
7494
|
+
topic = page.topic;
|
|
7495
|
+
for (const post of page.posts) posts.set(post.id, post);
|
|
7496
|
+
if (posts.size > 1e4) throw new Error("discuss read failed: conversation exceeds 10000 posts");
|
|
7497
|
+
if (!page.page?.hasMore) break;
|
|
7498
|
+
if (page.page.nextOffset === null || page.page.nextOffset <= offset) {
|
|
7499
|
+
throw new Error("discuss read failed: registry returned a non-advancing post page");
|
|
7500
|
+
}
|
|
7501
|
+
offset = page.page.nextOffset;
|
|
7486
7502
|
}
|
|
7487
|
-
|
|
7503
|
+
const ordered = [...posts.values()].sort(
|
|
7504
|
+
(a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)
|
|
7505
|
+
);
|
|
7506
|
+
const expected = Number.isInteger(topic.replyCount) ? topic.replyCount + 1 : ordered.length;
|
|
7507
|
+
if (ordered.length === expected) {
|
|
7508
|
+
const result = { topic, posts: ordered };
|
|
7509
|
+
emit(ctx, result, () => renderRead(ctx, result.topic, result.posts));
|
|
7510
|
+
return;
|
|
7511
|
+
}
|
|
7512
|
+
if (offset === 0) throw new Error("discuss read failed: registry did not provide forward post pages");
|
|
7513
|
+
}
|
|
7514
|
+
throw new Error("discuss read failed: conversation changed during every complete-read attempt");
|
|
7515
|
+
}
|
|
7516
|
+
function renderRead(ctx, topic, posts) {
|
|
7517
|
+
ctx.out.log(`${topic.subject} [${state(topic)}] ${topic.appId ?? ""}`);
|
|
7518
|
+
for (const post of posts) {
|
|
7519
|
+
const who = post.authorKind === "bot" ? `${post.authorId} (agent)` : post.authorId;
|
|
7520
|
+
ctx.out.log(`
|
|
7521
|
+
\u2014 ${who}`);
|
|
7522
|
+
ctx.out.log(bodyWithRefs(post));
|
|
7523
|
+
for (const file of post.attachments ?? []) ctx.out.log(` [attachment] ${file.name} (${file.size} bytes)`);
|
|
7524
|
+
}
|
|
7488
7525
|
}
|
|
7489
7526
|
async function discussPost(ctx, parsed) {
|
|
7490
7527
|
const appId = stringOpt(parsed.options.app);
|
|
@@ -7811,7 +7848,7 @@ async function discussCommand(parsed, deps = {}) {
|
|
|
7811
7848
|
case "topics":
|
|
7812
7849
|
return discussList(ctx, parsed);
|
|
7813
7850
|
case "read":
|
|
7814
|
-
return discussRead(ctx, requireId(id, "read"));
|
|
7851
|
+
return discussRead(ctx, requireId(id, "read"), parsed);
|
|
7815
7852
|
case "post":
|
|
7816
7853
|
return discussPost(ctx, parsed);
|
|
7817
7854
|
case "reply":
|