@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/bin.js
CHANGED
|
@@ -5990,7 +5990,7 @@ Usage:
|
|
|
5990
5990
|
odla-ai pm handoff --app <id> [--json]
|
|
5991
5991
|
odla-ai discuss groups [--json]
|
|
5992
5992
|
odla-ai discuss list [--app <id>] [--q <text>] [--state open|resolved|all] [--json]
|
|
5993
|
-
odla-ai discuss read <topic> [--json]
|
|
5993
|
+
odla-ai discuss read <topic> [--limit <n> --offset <n>] [--json]
|
|
5994
5994
|
odla-ai discuss post --app <id> --subject "..." --body "..." [--markup "... @[Label](kind/id)"] [--mutation-id <id>]
|
|
5995
5995
|
odla-ai discuss reply <topic> --body "..." [--markup "..."] [--mutation-id <id>]
|
|
5996
5996
|
odla-ai discuss resolve <topic> [--reopen] [--mutation-id <id>]
|
|
@@ -8208,22 +8208,59 @@ async function discussList(ctx, parsed) {
|
|
|
8208
8208
|
}
|
|
8209
8209
|
});
|
|
8210
8210
|
}
|
|
8211
|
-
async function discussRead(ctx, id) {
|
|
8212
|
-
const
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8211
|
+
async function discussRead(ctx, id, parsed) {
|
|
8212
|
+
const requestedLimit = stringOpt(parsed.options.limit);
|
|
8213
|
+
const requestedOffset = stringOpt(parsed.options.offset);
|
|
8214
|
+
if (requestedLimit !== void 0 || requestedOffset !== void 0) {
|
|
8215
|
+
const query = new URLSearchParams({
|
|
8216
|
+
limit: requestedLimit ?? "200",
|
|
8217
|
+
offset: requestedOffset ?? "0"
|
|
8218
|
+
});
|
|
8219
|
+
const page = await request(ctx, "GET", `/topics/${encodeURIComponent(id)}?${query}`);
|
|
8220
|
+
emit(ctx, page, () => renderRead(ctx, page.topic, page.posts));
|
|
8221
|
+
return;
|
|
8222
|
+
}
|
|
8223
|
+
for (let scan = 0; scan < 3; scan++) {
|
|
8224
|
+
const posts = /* @__PURE__ */ new Map();
|
|
8225
|
+
let topic = null;
|
|
8226
|
+
let offset = 0;
|
|
8227
|
+
for (; ; ) {
|
|
8228
|
+
const page = await request(
|
|
8229
|
+
ctx,
|
|
8230
|
+
"GET",
|
|
8231
|
+
`/topics/${encodeURIComponent(id)}?limit=200&offset=${offset}`
|
|
8232
|
+
);
|
|
8233
|
+
topic = page.topic;
|
|
8234
|
+
for (const post of page.posts) posts.set(post.id, post);
|
|
8235
|
+
if (posts.size > 1e4) throw new Error("discuss read failed: conversation exceeds 10000 posts");
|
|
8236
|
+
if (!page.page?.hasMore) break;
|
|
8237
|
+
if (page.page.nextOffset === null || page.page.nextOffset <= offset) {
|
|
8238
|
+
throw new Error("discuss read failed: registry returned a non-advancing post page");
|
|
8239
|
+
}
|
|
8240
|
+
offset = page.page.nextOffset;
|
|
8225
8241
|
}
|
|
8226
|
-
|
|
8242
|
+
const ordered = [...posts.values()].sort(
|
|
8243
|
+
(a, b) => a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)
|
|
8244
|
+
);
|
|
8245
|
+
const expected = Number.isInteger(topic.replyCount) ? topic.replyCount + 1 : ordered.length;
|
|
8246
|
+
if (ordered.length === expected) {
|
|
8247
|
+
const result = { topic, posts: ordered };
|
|
8248
|
+
emit(ctx, result, () => renderRead(ctx, result.topic, result.posts));
|
|
8249
|
+
return;
|
|
8250
|
+
}
|
|
8251
|
+
if (offset === 0) throw new Error("discuss read failed: registry did not provide forward post pages");
|
|
8252
|
+
}
|
|
8253
|
+
throw new Error("discuss read failed: conversation changed during every complete-read attempt");
|
|
8254
|
+
}
|
|
8255
|
+
function renderRead(ctx, topic, posts) {
|
|
8256
|
+
ctx.out.log(`${topic.subject} [${state(topic)}] ${topic.appId ?? ""}`);
|
|
8257
|
+
for (const post of posts) {
|
|
8258
|
+
const who = post.authorKind === "bot" ? `${post.authorId} (agent)` : post.authorId;
|
|
8259
|
+
ctx.out.log(`
|
|
8260
|
+
\u2014 ${who}`);
|
|
8261
|
+
ctx.out.log(bodyWithRefs(post));
|
|
8262
|
+
for (const file of post.attachments ?? []) ctx.out.log(` [attachment] ${file.name} (${file.size} bytes)`);
|
|
8263
|
+
}
|
|
8227
8264
|
}
|
|
8228
8265
|
async function discussPost(ctx, parsed) {
|
|
8229
8266
|
const appId = stringOpt(parsed.options.app);
|
|
@@ -8550,7 +8587,7 @@ async function discussCommand(parsed, deps = {}) {
|
|
|
8550
8587
|
case "topics":
|
|
8551
8588
|
return discussList(ctx, parsed);
|
|
8552
8589
|
case "read":
|
|
8553
|
-
return discussRead(ctx, requireId(id, "read"));
|
|
8590
|
+
return discussRead(ctx, requireId(id, "read"), parsed);
|
|
8554
8591
|
case "post":
|
|
8555
8592
|
return discussPost(ctx, parsed);
|
|
8556
8593
|
case "reply":
|
|
@@ -10713,4 +10750,4 @@ export {
|
|
|
10713
10750
|
exitCodeFor,
|
|
10714
10751
|
runCli
|
|
10715
10752
|
};
|
|
10716
|
-
//# sourceMappingURL=chunk-
|
|
10753
|
+
//# sourceMappingURL=chunk-335ODYSF.js.map
|