@linkshell/host 0.4.16 → 0.4.18

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.
Files changed (51) hide show
  1. package/README.md +27 -1
  2. package/dist/host/src/drivers/acp/connection.d.ts +1 -0
  3. package/dist/host/src/drivers/acp/connection.js +6 -0
  4. package/dist/host/src/drivers/acp/connection.js.map +1 -1
  5. package/dist/host/src/drivers/acp/driver.d.ts +10 -5
  6. package/dist/host/src/drivers/acp/driver.js +51 -25
  7. package/dist/host/src/drivers/acp/driver.js.map +1 -1
  8. package/dist/host/src/drivers/acp/questions.d.ts +14 -0
  9. package/dist/host/src/drivers/acp/questions.js +114 -0
  10. package/dist/host/src/drivers/acp/questions.js.map +1 -0
  11. package/dist/host/src/drivers/claude/activity.d.ts +5 -0
  12. package/dist/host/src/drivers/claude/activity.js +80 -25
  13. package/dist/host/src/drivers/claude/activity.js.map +1 -1
  14. package/dist/host/src/drivers/claude/children.d.ts +18 -0
  15. package/dist/host/src/drivers/claude/children.js +60 -0
  16. package/dist/host/src/drivers/claude/children.js.map +1 -0
  17. package/dist/host/src/drivers/claude/driver.js +7 -2
  18. package/dist/host/src/drivers/claude/driver.js.map +1 -1
  19. package/dist/host/src/drivers/claude/tasks.d.ts +2 -2
  20. package/dist/host/src/drivers/claude/transcript.d.ts +83 -72
  21. package/dist/host/src/drivers/claude/transcript.js +27 -13
  22. package/dist/host/src/drivers/claude/transcript.js.map +1 -1
  23. package/dist/host/src/drivers/codex/attention.d.ts +7 -0
  24. package/dist/host/src/drivers/codex/attention.js +82 -0
  25. package/dist/host/src/drivers/codex/attention.js.map +1 -0
  26. package/dist/host/src/drivers/codex/driver.d.ts +2 -0
  27. package/dist/host/src/drivers/codex/driver.js +45 -2
  28. package/dist/host/src/drivers/codex/driver.js.map +1 -1
  29. package/dist/host/src/drivers/types.d.ts +2 -1
  30. package/dist/host/src/hub.d.ts +3 -1
  31. package/dist/host/src/hub.js +42 -6
  32. package/dist/host/src/hub.js.map +1 -1
  33. package/dist/host/src/screen-viewer.js +0 -5
  34. package/dist/host/src/screen-viewer.js.map +1 -1
  35. package/dist/host/tsconfig.tsbuildinfo +1 -1
  36. package/dist/wire/src/async-questions.d.ts +40 -0
  37. package/dist/wire/src/async-questions.js +66 -0
  38. package/dist/wire/src/async-questions.js.map +1 -0
  39. package/dist/wire/src/goal.d.ts +2 -2
  40. package/dist/wire/src/index.d.ts +1 -0
  41. package/dist/wire/src/index.js +1 -0
  42. package/dist/wire/src/index.js.map +1 -1
  43. package/dist/wire/src/model.d.ts +111 -84
  44. package/dist/wire/src/model.js +4 -0
  45. package/dist/wire/src/model.js.map +1 -1
  46. package/dist/wire/src/rpc.d.ts +2165 -1722
  47. package/dist/wire/src/updates.d.ts +663 -559
  48. package/dist/wire/src/updates.js +8 -1
  49. package/dist/wire/src/updates.js.map +1 -1
  50. package/dist/wire/src/workflow.d.ts +8 -8
  51. package/package.json +2 -2
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ import type { SessionUpdate } from "./updates.js";
3
+ /** A question an agent's message asks without stopping its turn; `id` is what the answer quotes. */
4
+ export declare const asyncQuestionSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ title: z.ZodString;
7
+ options: z.ZodArray<z.ZodString, "many">;
8
+ }, "strip", z.ZodTypeAny, {
9
+ options: string[];
10
+ id: string;
11
+ title: string;
12
+ }, {
13
+ options: string[];
14
+ id: string;
15
+ title: string;
16
+ }>;
17
+ export type AsyncQuestion = z.infer<typeof asyncQuestionSchema>;
18
+ /**
19
+ * The message that answers async questions, as Codex Desktop writes it: the
20
+ * agent reads it as the answer, and Desktop (and this app) shows it as one.
21
+ */
22
+ export declare function asyncQuestionReply(answers: {
23
+ question: AsyncQuestion;
24
+ answer: string;
25
+ }[]): string;
26
+ export interface QuestionReply {
27
+ /** The question's id, where the reply names it. */
28
+ id?: string;
29
+ question: string;
30
+ answer: string;
31
+ }
32
+ /**
33
+ * The answers in a reply to async questions, as Codex Desktop writes one (and shows it: each question with
34
+ * its answer). Anything that isn't exactly the envelope is not a reply.
35
+ */
36
+ export declare function questionReplies(text: string): QuestionReply[] | undefined;
37
+ /** What a message answers, by question id, if it is such a reply. */
38
+ export declare function answeredQuestions(text: string): [id: string, answer: string][];
39
+ /** Keeps attention separate from running: async questions do not stop the agent. */
40
+ export declare function updateAsyncQuestions(pending: AsyncQuestion[], update: SessionUpdate): AsyncQuestion[];
@@ -0,0 +1,66 @@
1
+ import { z } from "zod";
2
+ /** A question an agent's message asks without stopping its turn; `id` is what the answer quotes. */
3
+ export const asyncQuestionSchema = z.object({ id: z.string(), title: z.string(), options: z.array(z.string()) });
4
+ /**
5
+ * The message that answers async questions, as Codex Desktop writes it: the
6
+ * agent reads it as the answer, and Desktop (and this app) shows it as one.
7
+ */
8
+ export function asyncQuestionReply(answers) {
9
+ const entries = answers.map(({ question, answer }) => ({ questionItemId: question.id, question: question.title, answer }));
10
+ return `<send_user_message_question_reply>\n${JSON.stringify(entries)}\n</send_user_message_question_reply>\n`;
11
+ }
12
+ /**
13
+ * The answers in a reply to async questions, as Codex Desktop writes one (and shows it: each question with
14
+ * its answer). Anything that isn't exactly the envelope is not a reply.
15
+ */
16
+ export function questionReplies(text) {
17
+ const match = /^<send_user_message_question_reply>\s*([\s\S]+?)\s*<\/send_user_message_question_reply>$/.exec(text.replace(/\r\n/g, "\n").trim());
18
+ if (!match)
19
+ return undefined;
20
+ let parsed;
21
+ try {
22
+ parsed = JSON.parse(match[1]);
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ const entries = Array.isArray(parsed) ? parsed : [parsed];
28
+ if (entries.length === 0)
29
+ return undefined;
30
+ const replies = [];
31
+ for (const entry of entries) {
32
+ if (!entry || typeof entry !== "object")
33
+ return undefined;
34
+ const { questionItemId, question, answer } = entry;
35
+ if (typeof question !== "string" || typeof answer !== "string")
36
+ return undefined;
37
+ replies.push({ ...(typeof questionItemId === "string" ? { id: questionItemId } : {}), question: question.trim(), answer: answer.trim() });
38
+ }
39
+ return replies;
40
+ }
41
+ /** What a message answers, by question id, if it is such a reply. */
42
+ export function answeredQuestions(text) {
43
+ return (questionReplies(text) ?? []).flatMap((reply) => (reply.id ? [[reply.id, reply.answer]] : []));
44
+ }
45
+ /** Keeps attention separate from running: async questions do not stop the agent. */
46
+ export function updateAsyncQuestions(pending, update) {
47
+ if ("parentToolCallId" in update && update.parentToolCallId)
48
+ return pending;
49
+ if (update.sessionUpdate === "ls_async_questions")
50
+ return update.questions;
51
+ if (update.sessionUpdate === "ls_turn")
52
+ return [];
53
+ if (update.sessionUpdate === "ls_message_done" && update.role === "agent" && update.questions?.length) {
54
+ const merged = new Map(pending.map((question) => [question.id, question]));
55
+ for (const question of update.questions)
56
+ merged.set(question.id, question);
57
+ return [...merged.values()];
58
+ }
59
+ if (update.sessionUpdate === "user_message_chunk" && update.content.type === "text") {
60
+ const answered = new Set(answeredQuestions(update.content.text).map(([id]) => id));
61
+ if (answered.size)
62
+ return pending.filter((question) => !answered.has(question.id));
63
+ }
64
+ return pending;
65
+ }
66
+ //# sourceMappingURL=async-questions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-questions.js","sourceRoot":"","sources":["../../../../wire/src/async-questions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,oGAAoG;AACpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAGjH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAsD;IACvF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,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AQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,MAAM,CAAC,aAAa,KAAK,oBAAoB,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACpF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACnF,IAAI,QAAQ,CAAC,IAAI;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -9,16 +9,16 @@ export declare const sessionGoalSchema: z.ZodObject<{
9
9
  iterations: z.ZodOptional<z.ZodNumber>;
10
10
  lastReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- status: "paused" | "active" | "blocked" | "usageLimited" | "budgetLimited" | "complete";
13
12
  objective: string;
13
+ status: "active" | "paused" | "blocked" | "usageLimited" | "budgetLimited" | "complete";
14
14
  tokenBudget?: number | null | undefined;
15
15
  tokensUsed?: number | undefined;
16
16
  timeUsedSeconds?: number | undefined;
17
17
  iterations?: number | undefined;
18
18
  lastReason?: string | null | undefined;
19
19
  }, {
20
- status: "paused" | "active" | "blocked" | "usageLimited" | "budgetLimited" | "complete";
21
20
  objective: string;
21
+ status: "active" | "paused" | "blocked" | "usageLimited" | "budgetLimited" | "complete";
22
22
  tokenBudget?: number | null | undefined;
23
23
  tokensUsed?: number | undefined;
24
24
  timeUsedSeconds?: number | undefined;
@@ -10,3 +10,4 @@ export * from "./relay.js";
10
10
  export * from "./relay-client.js";
11
11
  export * from "./direct.js";
12
12
  export * from "./computer-preview.js";
13
+ export * from "./async-questions.js";
@@ -10,4 +10,5 @@ export * from "./relay.js";
10
10
  export * from "./relay-client.js";
11
11
  export * from "./direct.js";
12
12
  export * from "./computer-preview.js";
13
+ export * from "./async-questions.js";
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../wire/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../wire/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}