@andorra-labs/code 0.1.9 → 0.1.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.
Files changed (96) hide show
  1. package/dist/src/agent-execution.js +20 -0
  2. package/dist/src/app-server/protocol.d.ts +108 -1
  3. package/dist/src/app-server/protocol.js +8 -1
  4. package/dist/src/app-server.d.ts +25 -0
  5. package/dist/src/app-server.js +156 -11
  6. package/dist/src/auth/index.d.ts +1 -1
  7. package/dist/src/auth/index.js +1 -1
  8. package/dist/src/auth/store.d.ts +17 -1
  9. package/dist/src/auth/store.js +25 -2
  10. package/dist/src/browser-ui/app.js +19 -19
  11. package/dist/src/browser-ui/index.html +7 -7
  12. package/dist/src/cli.js +10 -5
  13. package/dist/src/commands.d.ts +1 -1
  14. package/dist/src/commands.js +1 -1
  15. package/dist/src/completion-gates.js +1 -1
  16. package/dist/src/completion.d.ts +1 -1
  17. package/dist/src/completion.js +1 -1
  18. package/dist/src/decision/checks.js +1 -1
  19. package/dist/src/file-diff.d.ts +105 -0
  20. package/dist/src/file-diff.js +244 -0
  21. package/dist/src/graph-manager-chat.js +15 -15
  22. package/dist/src/graph-server.js +9 -9
  23. package/dist/src/graph-ui/app.js +123 -118
  24. package/dist/src/graph-ui/embed.js +9 -9
  25. package/dist/src/graph-ui/icons.js +1 -0
  26. package/dist/src/graph-ui/index.html +3 -3
  27. package/dist/src/graph-ui/manager-state.js +3 -3
  28. package/dist/src/graph-ui/manager.js +14 -14
  29. package/dist/src/graph-ui/skill-picker.js +6 -6
  30. package/dist/src/graph-ui/studio-canvas.js +15 -15
  31. package/dist/src/graph-ui/studio.js +40 -40
  32. package/dist/src/graph-ui/style.css +3 -1
  33. package/dist/src/graph-ui/theme.js +2 -2
  34. package/dist/src/graphs.d.ts +7 -1
  35. package/dist/src/graphs.js +12 -2
  36. package/dist/src/mcp.d.ts +75 -0
  37. package/dist/src/mcp.js +240 -8
  38. package/dist/src/membership-errors.js +1 -1
  39. package/dist/src/provider-keys.d.ts +5 -1
  40. package/dist/src/provider-keys.js +7 -3
  41. package/dist/src/provider-settings.d.ts +4 -1
  42. package/dist/src/provider-settings.js +46 -5
  43. package/dist/src/qa/guidance.js +6 -19
  44. package/dist/src/qa/index.d.ts +0 -2
  45. package/dist/src/qa/index.js +0 -2
  46. package/dist/src/qa/profile/QaProfile.d.ts +5 -1
  47. package/dist/src/qa/profile/QaProfile.js +6 -2
  48. package/dist/src/qa/tools.d.ts +19 -1
  49. package/dist/src/qa/tools.js +20 -145
  50. package/dist/src/react-runtime.js +13 -2
  51. package/dist/src/remote/engine-pool.js +18 -6
  52. package/dist/src/screen-selection.d.ts +38 -0
  53. package/dist/src/screen-selection.js +103 -0
  54. package/dist/src/session-changes.d.ts +117 -0
  55. package/dist/src/session-changes.js +796 -0
  56. package/dist/src/stall-recovery.d.ts +11 -0
  57. package/dist/src/stall-recovery.js +12 -0
  58. package/dist/src/telemetry/schema.d.ts +1 -1
  59. package/dist/src/telemetry/schema.js +1 -2
  60. package/dist/src/terminal-ui.d.ts +64 -20
  61. package/dist/src/terminal-ui.js +310 -80
  62. package/dist/src/tool-diff-stats.d.ts +9 -0
  63. package/dist/src/tool-diff-stats.js +20 -0
  64. package/dist/src/tool-names.d.ts +1 -1
  65. package/dist/src/tool-result-filter.js +1 -1
  66. package/dist/src/tools.js +26 -2
  67. package/dist/src/transcript.d.ts +11 -0
  68. package/dist/src/transcript.js +14 -2
  69. package/dist/src/types.d.ts +6 -0
  70. package/docs/guides/desktop-app.md +1 -1
  71. package/docs/guides/tui.md +9 -9
  72. package/package.json +1 -1
  73. package/dist/src/qa/api/http-runner.d.ts +0 -3
  74. package/dist/src/qa/api/http-runner.js +0 -47
  75. package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
  76. package/dist/src/qa/git/ChangeDetector.js +0 -177
  77. package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
  78. package/dist/src/qa/git/DiffReviewer.js +0 -115
  79. package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
  80. package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
  81. package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
  82. package/dist/src/qa/orchestrator/MergeGate.js +0 -40
  83. package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
  84. package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
  85. package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
  86. package/dist/src/qa/runners/CommandRunner.js +0 -96
  87. package/dist/src/qa/runners/TestRunner.d.ts +0 -21
  88. package/dist/src/qa/runners/TestRunner.js +0 -66
  89. package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
  90. package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
  91. package/dist/src/qa/runtime-detect.d.ts +0 -10
  92. package/dist/src/qa/runtime-detect.js +0 -72
  93. package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
  94. package/dist/src/qa/security/DependencyScanner.js +0 -167
  95. package/dist/src/qa/security/SecretScanner.d.ts +0 -3
  96. package/dist/src/qa/security/SecretScanner.js +0 -55
@@ -14,6 +14,17 @@ export declare function unavailableHistoryTools(messages: readonly Message[], av
14
14
  export declare function suspectedDroppedToolCall(response: Pick<ModelResponse, 'text' | 'toolCalls' | 'usage' | 'reasoningContent'>): boolean;
15
15
  /** The sentence telling the model which earlier tools this node lacks; empty when there are none. */
16
16
  export declare function unavailableToolsSentence(unavailable: readonly string[]): string;
17
+ /**
18
+ * The way out of a stalled turn for a node that is waiting on the user, not on more work.
19
+ *
20
+ * A reply that asks the user for something (a login, an approval, an answer) is text with no tool
21
+ * call, which is exactly what a stall looks like, and "call complete_agent when the requirements
22
+ * are finished" reads as a ban on handing off before they are. A live run asked the user to sign in
23
+ * twice, was sent back both times, and started the interactive login itself instead; the user never
24
+ * saw either request. Only an Orchestrator has `ask_user`, so every other node asks through its
25
+ * handoff: the summary is what the user reads, and their next message continues the conversation.
26
+ */
27
+ export declare const USER_BLOCKED_GUIDANCE = "The exception is work that cannot continue without the user: a question only they can answer, or a login, approval or other action only they can perform. Do not work around it or retry it. Call complete_agent alone now (with a blocked outcome if one is declared) and put the question or the exact action needed first in the summary, followed by what is done and what remains; the user reads the summary and answers in their next message.";
17
28
  /** The continuation sent after a graph-node turn that ended without a tool call or a handoff. */
18
29
  export declare function stalledTurnGuidance(input: {
19
30
  dropped: boolean;
@@ -57,6 +57,17 @@ export function unavailableToolsSentence(unavailable) {
57
57
  return '';
58
58
  return `Earlier turns in this conversation called ${list(unavailable)}, which this node does not have: a call to any of them is discarded before it runs, so reach the same goal with the tools you are offered, or hand off with complete_agent and name what blocked you.`;
59
59
  }
60
+ /**
61
+ * The way out of a stalled turn for a node that is waiting on the user, not on more work.
62
+ *
63
+ * A reply that asks the user for something (a login, an approval, an answer) is text with no tool
64
+ * call, which is exactly what a stall looks like, and "call complete_agent when the requirements
65
+ * are finished" reads as a ban on handing off before they are. A live run asked the user to sign in
66
+ * twice, was sent back both times, and started the interactive login itself instead; the user never
67
+ * saw either request. Only an Orchestrator has `ask_user`, so every other node asks through its
68
+ * handoff: the summary is what the user reads, and their next message continues the conversation.
69
+ */
70
+ export const USER_BLOCKED_GUIDANCE = 'The exception is work that cannot continue without the user: a question only they can answer, or a login, approval or other action only they can perform. Do not work around it or retry it. Call complete_agent alone now (with a blocked outcome if one is declared) and put the question or the exact action needed first in the summary, followed by what is done and what remains; the user reads the summary and answers in their next message.';
60
71
  /** The continuation sent after a graph-node turn that ended without a tool call or a handoff. */
61
72
  export function stalledTurnGuidance(input) {
62
73
  const parts = [
@@ -66,6 +77,7 @@ export function stalledTurnGuidance(input) {
66
77
  input.available.length ? `This node's tools are: ${list(input.available)}.` : '',
67
78
  unavailableToolsSentence(input.unavailable),
68
79
  'Your next response must call one of this node\'s tools. A progress update does not hand off this graph node. When its requirements and verification are finished, call complete_agent alone with the declared outcome and output.',
80
+ USER_BLOCKED_GUIDANCE,
69
81
  ];
70
82
  return parts.filter(Boolean).join(' ');
71
83
  }
@@ -35,7 +35,7 @@ export type TelemetryLanguage = typeof TELEMETRY_LANGUAGES[number];
35
35
  export declare const TELEMETRY_FRAMEWORKS: readonly ["react", "vue", "angular", "svelte", "nextjs", "nestjs", "express", "fastapi", "django", "flask", "spring", "rails", "laravel", "dotnet", "actix", "axum", "gin", "flutter", "electron", "tauri", "other"];
36
36
  export type TelemetryFramework = typeof TELEMETRY_FRAMEWORKS[number];
37
37
  /** Product-owned tool names, plus the three buckets user- or server-named tools collapse into. */
38
- export declare const TELEMETRY_TOOL_NAMES: readonly ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "PowerShell", "git_read", "read_artifact", "write_artifact", "repo_explore", "memory_search", "set_timer", "pull_request", "read_skill_resource", "ask_user", "spawn_subagent", "qa.browser", "qa.browser_session", "qa.deep", "qa.fast", "qa.inspect_project", "qa.security", "qa.status", "qa.terminal", "qa.test", "browser.panel", "browser.incognito", "browser.solve_captcha", "web_search", "mcp", "plugin", "other"];
38
+ export declare const TELEMETRY_TOOL_NAMES: readonly ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "PowerShell", "git_read", "read_artifact", "write_artifact", "repo_explore", "memory_search", "set_timer", "pull_request", "read_skill_resource", "ask_user", "spawn_subagent", "qa.browser", "qa.browser_session", "qa.terminal", "browser.panel", "browser.incognito", "browser.solve_captcha", "web_search", "mcp", "plugin", "other"];
39
39
  export type TelemetryToolName = typeof TELEMETRY_TOOL_NAMES[number];
40
40
  /**
41
41
  * Public model ids a run may name. Provider configuration accepts a user-supplied string of up to
@@ -48,8 +48,7 @@ export const TELEMETRY_TOOL_NAMES = [
48
48
  // The QA tools are product-owned names in GRAPH_TOOLS; each stays distinguishable so feature
49
49
  // usage can be attributed to it rather than to the `other` bucket. The panel browser tool
50
50
  // rides the same browser capability and stays attributable the same way.
51
- 'qa.browser', 'qa.browser_session', 'qa.deep', 'qa.fast', 'qa.inspect_project', 'qa.security',
52
- 'qa.status', 'qa.terminal', 'qa.test',
51
+ 'qa.browser', 'qa.browser_session', 'qa.terminal',
53
52
  'browser.panel', 'browser.incognito',
54
53
  'browser.solve_captcha', 'web_search',
55
54
  'mcp', 'plugin', 'other',
@@ -19,6 +19,12 @@ export interface TerminalStatus {
19
19
  inputTokens?: number;
20
20
  outputTokens?: number;
21
21
  requests?: number;
22
+ /**
23
+ * The activity is a background check (the startup graph-model check), not a task: the welcome
24
+ * card names it, but no working clock runs and the composer keeps its idle layout. Any later
25
+ * activity that does not repeat the flag clears it.
26
+ */
27
+ backgroundActivity?: boolean;
22
28
  contextWindow?: number;
23
29
  /** Input tokens reported for the most recent model request; live context-window use. */
24
30
  contextUsed?: number;
@@ -252,19 +258,20 @@ export declare class TerminalUI extends EventEmitter {
252
258
  private todoOffset;
253
259
  private todoPageSize;
254
260
  private scroll;
255
- /** Whether a run is streaming: with no prompt pending, the wheel may scroll the transcript. */
261
+ /** Whether a run is streaming. */
256
262
  private runActive;
257
263
  /**
258
- * Whether alternate scroll mode (?1007) is currently armed.
264
+ * The drag selection over the drawn frame, in screen cells.
259
265
  *
260
- * The app never takes mouse reporting, so the terminal keeps drag-to-select and its
261
- * clipboard in every state. In the alternate screen a terminal instead turns the wheel
262
- * into Up/Down sequences when alternate scroll is on — byte-identical to the arrow keys,
263
- * and on by default in Windows Terminal, VTE and iTerm2 — so the app arms that mode only
264
- * where Up/Down cannot recall history: while a screen is open, or while a run streams with
265
- * no question pending. At the resting prompt it is switched off and the wheel is inert.
266
+ * The app holds mouse reporting for the whole session so the wheel arrives as a wheel report
267
+ * and never as the Up/Down bytes that recall input history. Holding the mouse takes the drag
268
+ * away from the terminal, so the app draws the selection itself and copies it on release.
266
269
  */
267
- private alternateScroll;
270
+ private selection?;
271
+ /** The last left press, kept to recognize a double-click on the same cell. */
272
+ private lastPress?;
273
+ /** The frame as composed, before the selection highlight is laid over it. */
274
+ private frame;
268
275
  /**
269
276
  * Live reasoning preview state. `thinkingActive` marks a stream in progress; the text
270
277
  * is the bounded tail the preview renders from.
@@ -299,6 +306,17 @@ export declare class TerminalUI extends EventEmitter {
299
306
  private completion?;
300
307
  private dismissedCompletion?;
301
308
  private incoming;
309
+ /**
310
+ * Raw bytes not yet decoded to `incoming`.
311
+ *
312
+ * Legacy mouse reports are framed here, on bytes, before UTF-8 decoding: their payload
313
+ * is three value-plus-32 bytes that the decoder would buffer while an incomplete
314
+ * sequence (column 192, row 128 ends in E0 A0) and collapse when the pair forms a
315
+ * valid one (column 162, row 128 encodes as C2 A0), so no string-domain measurement
316
+ * can see a report in time without risking the keystroke that follows it.
317
+ */
318
+ private rawIncoming;
319
+ private rawTimer?;
302
320
  private pasting;
303
321
  private paste;
304
322
  private pasteQuestion?;
@@ -579,20 +597,29 @@ export declare class TerminalUI extends EventEmitter {
579
597
  /** The last nonempty line of the retained reasoning, flattened for one row. */
580
598
  private thinkingTail;
581
599
  private updateWorkingClock;
582
- /**
583
- * Recompute whether the wheel may act: alternate scroll mode is armed while a screen is
584
- * open, or while a run streams with no question pending, and off everywhere else.
585
- *
586
- * Only transitions write anything. Entering the alternate screen resets the flag first
587
- * (`start`), because that screen begins with the mode explicitly switched off.
588
- */
589
- private updateAlternateScroll;
590
600
  close(): void;
591
601
  private finishQuestion;
592
602
  private onEnd;
593
603
  private onResize;
594
604
  private onData;
595
- /** Drain the decoded stream: paste markers and ordinary keys. */
605
+ /**
606
+ * Frame legacy X10 mouse reports on the raw byte stream before UTF-8 decoding.
607
+ *
608
+ * A terminal with mouse tracking but without the SGR encoding of mode 1006 answers capture
609
+ * with ESC[M plus three raw payload bytes (button, then coordinates, each offset by
610
+ * 32). Those bytes are framed here rather than in the decoded string because decoding
611
+ * buffers an incomplete trailing sequence and collapses a complete pair into one
612
+ * character, so a string-domain match could only see a report late, consuming the
613
+ * keystroke that follows it. A report split across reads holds the buffer for the
614
+ * input burst, the same grace a lone Escape gets; a burst that elapses with an
615
+ * incomplete prefix hands the bytes to the key parser as if they were typed. Inside a
616
+ * bracketed paste the bytes are text, so once the decoded stream opens a paste the
617
+ * remainder is handed over untouched.
618
+ */
619
+ private consumeRaw;
620
+ private feedRaw;
621
+ private armRawTimer;
622
+ /** Drain the decoded stream: paste markers, SGR mouse reports and ordinary keys. */
596
623
  private consumeIncoming;
597
624
  /**
598
625
  * The effective disclosure state of one prompt box.
@@ -602,10 +629,27 @@ export declare class TerminalUI extends EventEmitter {
602
629
  * either state.
603
630
  */
604
631
  private promptExpanded;
632
+ /**
633
+ * Act on one mouse report: the wheel scrolls, and a left drag selects text on the screen.
634
+ *
635
+ * The selection lives in screen cells over the frame as drawn. Releasing the button copies
636
+ * it; the highlight stays until the next key, click or wheel tick so the reader can see what
637
+ * was taken. A press and release on one cell selects nothing, and a second press on the same
638
+ * cell within the double-click window takes the word under it. Other buttons are swallowed,
639
+ * so no click reaches the composer as text.
640
+ * @param button - the report's button code, modifiers and motion bit included.
641
+ * @param pressed - false for a release.
642
+ * @param column - 1-based screen column.
643
+ * @param row - 1-based screen row.
644
+ */
645
+ private mouse;
646
+ /** Copy the screen selection; over SSH only the terminal's clipboard is the reader's own. */
647
+ private copyScreenSelection;
648
+ /** Lay the selection highlight over a composed frame. */
649
+ private withSelection;
605
650
  /**
606
651
  * Scroll the transcript (or the active screen). Positive `direction` scrolls up (toward
607
- * older output), which is what an Up key means — typed, or sent by the wheel under
608
- * alternate scroll mode.
652
+ * older output), which is what a wheel-up report and an Up key during a run both mean.
609
653
  */
610
654
  private scrollBy;
611
655
  private normalData;