@andorra-labs/code 0.1.17 → 0.1.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 (94) hide show
  1. package/dist/src/agent-execution.js +97 -11
  2. package/dist/src/andorra/errors.js +3 -0
  3. package/dist/src/app-server/protocol.d.ts +13 -2
  4. package/dist/src/app-server/protocol.js +1 -1
  5. package/dist/src/app-server/workspace.d.ts +19 -0
  6. package/dist/src/app-server/workspace.js +155 -4
  7. package/dist/src/app-server.d.ts +32 -1
  8. package/dist/src/app-server.js +622 -74
  9. package/dist/src/attachments.d.ts +10 -0
  10. package/dist/src/attachments.js +102 -7
  11. package/dist/src/automation-tool.js +2 -1
  12. package/dist/src/bridge/command.js +12 -0
  13. package/dist/src/bridge/control.d.ts +3 -1
  14. package/dist/src/bridge/control.js +7 -2
  15. package/dist/src/bridge/github.d.ts +108 -0
  16. package/dist/src/bridge/github.js +378 -0
  17. package/dist/src/bridge/host-ops.d.ts +1 -1
  18. package/dist/src/bridge/host-ops.js +11 -1
  19. package/dist/src/bridge/host.js +7 -4
  20. package/dist/src/bug-report-attachments.d.ts +48 -0
  21. package/dist/src/bug-report-attachments.js +327 -0
  22. package/dist/src/bug-report.d.ts +23 -3
  23. package/dist/src/bug-report.js +72 -9
  24. package/dist/src/cli.d.ts +1 -3
  25. package/dist/src/cli.js +10 -4
  26. package/dist/src/codex-provider.js +1 -1
  27. package/dist/src/coding-tools.js +9 -2
  28. package/dist/src/commands.d.ts +1 -1
  29. package/dist/src/commands.js +2 -1
  30. package/dist/src/completion.js +8 -4
  31. package/dist/src/config.js +3 -1
  32. package/dist/src/context-budget.js +15 -2
  33. package/dist/src/decision/DecisionEngine.d.ts +2 -0
  34. package/dist/src/decision/DecisionManager.d.ts +11 -0
  35. package/dist/src/decision/DecisionManager.js +36 -0
  36. package/dist/src/decision/applyTaskKind.d.ts +8 -0
  37. package/dist/src/decision/applyTaskKind.js +53 -0
  38. package/dist/src/decision/hostedPolicy.js +2 -1
  39. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -0
  40. package/dist/src/decision/providers/AndorraDecisionProvider.js +12 -0
  41. package/dist/src/decision/taskKind.d.ts +52 -0
  42. package/dist/src/decision/taskKind.js +76 -0
  43. package/dist/src/decision/types.d.ts +1 -1
  44. package/dist/src/default-graph.js +1 -1
  45. package/dist/src/efficiency.d.ts +5 -0
  46. package/dist/src/efficiency.js +5 -1
  47. package/dist/src/effort-routing.d.ts +27 -0
  48. package/dist/src/effort-routing.js +34 -0
  49. package/dist/src/evidence.d.ts +110 -0
  50. package/dist/src/evidence.js +195 -0
  51. package/dist/src/github-app/client.d.ts +19 -0
  52. package/dist/src/github-app/client.js +21 -1
  53. package/dist/src/github-names.d.ts +7 -0
  54. package/dist/src/github-names.js +7 -0
  55. package/dist/src/graph-preview.d.ts +2 -0
  56. package/dist/src/graph-preview.js +1 -0
  57. package/dist/src/graph-runner.js +1 -1
  58. package/dist/src/graph-server.js +4 -2
  59. package/dist/src/graph-ui/app.js +30 -0
  60. package/dist/src/graphs.d.ts +6 -0
  61. package/dist/src/graphs.js +7 -2
  62. package/dist/src/hardened-runtime.js +32 -21
  63. package/dist/src/model-health-cache.js +1 -1
  64. package/dist/src/model-override.d.ts +2 -1
  65. package/dist/src/model-override.js +9 -0
  66. package/dist/src/model-tiers.d.ts +3 -0
  67. package/dist/src/model-tiers.js +3 -3
  68. package/dist/src/provider-engine.d.ts +13 -1
  69. package/dist/src/provider-engine.js +74 -0
  70. package/dist/src/providers.d.ts +5 -0
  71. package/dist/src/providers.js +34 -8
  72. package/dist/src/pull-requests.d.ts +11 -1
  73. package/dist/src/pull-requests.js +53 -2
  74. package/dist/src/react-runtime.js +98 -15
  75. package/dist/src/remote/engine-pool.js +5 -5
  76. package/dist/src/runtime.d.ts +29 -1
  77. package/dist/src/runtime.js +8 -0
  78. package/dist/src/sessions.d.ts +24 -0
  79. package/dist/src/sessions.js +55 -2
  80. package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
  81. package/dist/src/skills/bundled/provenance.json +1 -1
  82. package/dist/src/task-checkout.d.ts +141 -0
  83. package/dist/src/task-checkout.js +558 -0
  84. package/dist/src/test-edit-guard.d.ts +30 -0
  85. package/dist/src/test-edit-guard.js +167 -2
  86. package/dist/src/thinking-level-detect.d.ts +11 -0
  87. package/dist/src/thinking-level-detect.js +47 -0
  88. package/dist/src/thinking-levels.d.ts +30 -0
  89. package/dist/src/thinking-levels.js +124 -0
  90. package/dist/src/timers.d.ts +1 -0
  91. package/dist/src/tool-catalog.js +1 -1
  92. package/dist/src/transcript.js +1 -1
  93. package/dist/src/types.d.ts +34 -0
  94. package/package.json +1 -1
@@ -9,7 +9,7 @@ This sends a bug report about **Andorra Code itself** (the terminal app, the des
9
9
  models, tools) to the Andorra team. It is not for bugs in the user's own project: if that is what they
10
10
  describe, say so and help with the project instead.
11
11
 
12
- You send the report with the `submit_bug_report` tool. The tool shows the user the exact text and sends it
12
+ You send the report with the `submit_bug_report` tool. The tool shows the user the exact report and sends it
13
13
  only when they choose **Send report**, so you never send anything they have not read.
14
14
 
15
15
  ## Before you ask anything
@@ -23,6 +23,29 @@ only when they choose **Send report**, so you never send anything they have not
23
23
  - Use what the user already told you, in this message and earlier in the conversation. Do not ask again
24
24
  for something they have said.
25
25
 
26
+ ## Which session has the problem
27
+
28
+ A report about something that went wrong in a session carries that session's graph and a compressed
29
+ trajectory, so the team can see what ran. Find out which session it is before you write anything:
30
+
31
+ 1. Call `list_bug_report_sessions`. It returns the session this conversation is in (`current`, with its
32
+ name) and the most recent other sessions, each with an id, a name and a date. It only reads this
33
+ machine; nothing is sent.
34
+ 2. Ask the user one question, with these three answers:
35
+ - **This session**, named by the name the tool gave ("This session: Fix the login redirect").
36
+ - **Another session**. Then ask which one, offering the names from `others`. If theirs is not listed,
37
+ ask for something to recognise it by and pick the match; if none matches, say so and ask whether to
38
+ send without a session.
39
+ - **Not a session problem**: a bug in the program itself, such as the app not starting, sign-in,
40
+ settings, an update or a window that will not open.
41
+ 3. Remember the answer as the `session` you pass to `submit_bug_report`: `current`, the other session's
42
+ `id`, or `none`.
43
+
44
+ Ask even when the answer looks obvious: the user may be reporting from a fresh conversation about a
45
+ session that broke earlier. Skip the question only when they have already said which session it is. If
46
+ `current` is `null`, this conversation is not saved as a session yet, so offer only another session or
47
+ "not a session problem".
48
+
26
49
  ## The interview
27
50
 
28
51
  Ask one question at a time, in plain words, and wait for each answer. Use `ask_user` when you have it;
@@ -35,12 +58,12 @@ otherwise ask in your reply and continue when they answer. Skip a question whose
35
58
  3. **What they expected** to happen instead.
36
59
  4. **How often and since when**, if it is not already clear: every time or sometimes, and whether it
37
60
  worked before (an update, a new setting, a different model).
38
- 5. **Anything else that helps**: which model or graph, the terminal app or the desktop app, a screenshot
61
+ 5. **Anything else that helps**: which model, the terminal app or the desktop app, a screenshot
39
62
  described in words.
40
63
 
41
64
  Stop asking once you can write a report someone else could act on. Three or four questions is usual; do
42
- not go through the list for its own sake, and do not ask for the app version or operating system (the
43
- tool attaches those).
65
+ not go through the list for its own sake, and do not ask for the app version, the operating system or
66
+ which graph ran (the tool attaches those).
44
67
 
45
68
  ## Write the report
46
69
 
@@ -50,6 +73,19 @@ tool attaches those).
50
73
  "Happened once", and what changed recently if they said.
51
74
  - `steps`: numbered steps. Leave it out if the user does not know them.
52
75
  - `expected` and `actual`: one or two sentences each.
76
+ - `session`: `current`, another session's id, or `none`, from the answer above.
77
+
78
+ The graph and the trajectory are not yours to write. When `session` names a session, the tool reads them
79
+ from that session's own record and attaches:
80
+
81
+ - **The affected graph**: the graph the session last ran, as its nodes, settings, tools and routes. The
82
+ text of each instruction and prompt is replaced by its length.
83
+ - **A compressed trajectory**: each run as a short list of steps (which node ran, which tools, how long,
84
+ retries, refused completions, how the run stopped) with the first 200 characters of each error. It
85
+ holds no prompt, no model reply, no tool arguments and no output of a tool that succeeded.
86
+
87
+ Do not paste a graph, a trajectory, a log or a transcript into `description` yourself: the attachments
88
+ are bounded and cleaned, and what you paste is not.
53
89
 
54
90
  Rules for the text:
55
91
 
@@ -65,16 +101,24 @@ Rules for the text:
65
101
 
66
102
  ## Send it
67
103
 
68
- Call `submit_bug_report` once with the fields above. Then:
104
+ Call `submit_bug_report` once with the fields above. The tool then asks the user the final question
105
+ itself: it shows the whole report, the graph and the trajectory in full when a session is attached, and
106
+ closes with how the report is used: only to debug the problem, kept in the Andorra team's private bug
107
+ tracker, and never used to train models. That confirmation is the user's decision to send or not. Do not
108
+ ask "shall I send it?" yourself before calling the tool, and do not restate or reword the assurance: the
109
+ tool's wording is the one the team stands behind. If the user asks about it, tell them exactly that and
110
+ no more; do not promise that the report is deleted, or anything else the confirmation does not say.
111
+
112
+ Then:
69
113
 
70
114
  - `sent: true`: give the user the `reference` (for example `BR-1234`) and thank them. There is no page to
71
115
  open: the tracker is private, so do not offer a link or promise a reply.
72
116
  - `sent: false` with a `userReply`: they want a change. Make it and call the tool again so they confirm
73
- the new text.
117
+ the new text. If they do not want the graph or trajectory sent, call again with `session` set to `none`.
74
118
  - `sent: false` without one: they chose not to send. Say nothing was sent and stop.
75
119
  - An error: tell the user what it said in plain words. Signed out: they sign in and run `/bug-report`
76
120
  again. Daily limit reached: say when they can send it. Service unavailable: say so; do not retry in a
77
- loop.
121
+ loop. No such session: call `list_bug_report_sessions` again and ask which one they meant.
78
122
 
79
123
  Send one report per problem. If the user describes two separate bugs, finish the first, then ask whether
80
124
  to report the second.
@@ -729,7 +729,7 @@
729
729
  {
730
730
  "source": "src/skills/bundled/bug-report/SKILL.md",
731
731
  "asset": "bug-report/SKILL.md",
732
- "sha256": "20777e7df3e9a93e2062f681069d09a090b487268cf12a2f5359f989ab809e2d"
732
+ "sha256": "f5899f2bcb3e4c2f809673e4f2f40a138da3de4d3e7fa20cf33638003d521e01"
733
733
  },
734
734
  {
735
735
  "source": "src/skills/bundled/diagram/SKILL.md",
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Where a task works, recorded on its session. A writing task in a Git repository gets its own worktree on a task
3
+ * branch, started from a commit resolved when it began; an explicit choice, a Read Only task or a folder outside Git
4
+ * works in the project's own folder. The session stays filed under its project (`workspace`); this says where its
5
+ * agent, terminal, files, changes and checks run.
6
+ */
7
+ export interface SessionCheckout {
8
+ kind: 'worktree' | 'checkout' | 'folder';
9
+ /** The folder the task works in: the worktree (plus the project's place inside the repository), or the project folder. */
10
+ path: string;
11
+ /** The machine that holds the folder. */
12
+ host: string;
13
+ /** The task's branch: the worktree's own, or the branch checked out when an in-place task began. */
14
+ branch?: string;
15
+ /** What the task started from, as chosen: `main`, `feature/billing`. */
16
+ baseBranch?: string;
17
+ /** The ref that was resolved: `origin/main`, or the local branch. */
18
+ baseRef?: string;
19
+ baseCommit?: string;
20
+ /** The worktree's top, when the project sits below the repository's top. Defaults to `path`. */
21
+ worktree?: string;
22
+ createdAt: string;
23
+ /** Set once the lead removed the worktree; the branch may still hold its commits. */
24
+ removedAt?: string;
25
+ }
26
+ export interface TaskStartPoints {
27
+ repository: boolean;
28
+ current?: string;
29
+ /** Uncommitted files (tracked and untracked) in the project's checkout. */
30
+ dirty: number;
31
+ /** The repository's default branch, when one can be found. */
32
+ defaultBranch?: string;
33
+ /** The ref a worktree from the default branch starts at: `origin/main`, or `main` with no remote. */
34
+ defaultRef?: string;
35
+ /** When the remote was last fetched. */
36
+ fetchedAt?: string;
37
+ /** Local branches other than the default and the current one. */
38
+ branches: string[];
39
+ truncated?: boolean;
40
+ }
41
+ export interface PreparedTaskCheckout {
42
+ checkout: SessionCheckout;
43
+ /** The default branch was refreshed from its remote before the commit was resolved. */
44
+ refreshed?: boolean;
45
+ /** Why it could not be. */
46
+ refreshError?: string;
47
+ /** A retry found this start's worktree already made. */
48
+ reused?: boolean;
49
+ }
50
+ export declare class TaskCheckoutError extends Error {
51
+ }
52
+ /** The repository's top and where the project folder sits in it; undefined outside a repository. */
53
+ export declare function repositoryOf(root: string): Promise<{
54
+ top: string;
55
+ prefix: string;
56
+ commonDir: string;
57
+ } | undefined>;
58
+ /** What New Task offers to start from in `root`'s repository. */
59
+ export declare function taskStartPoints(root: string): Promise<TaskStartPoints>;
60
+ /** A task branch's name from the prompt: lower case, hyphens, at most 40 characters. */
61
+ export declare function taskSlug(text: string): string;
62
+ /**
63
+ * Where task worktrees go: `~/worktrees/<project>/<slug>`, outside Andorra's home, whose files the permission rules
64
+ * protect from the agent.
65
+ */
66
+ export declare function worktreesRoot(): string;
67
+ /** The folder a project's task worktrees go in. */
68
+ export declare function worktreesFolder(root: string, under?: string): string;
69
+ /** Forgets a start's preparation, once its task has begun or it was given up. */
70
+ export declare function forgetPrepared(home: string, key: string): Promise<void>;
71
+ /** The prepared checkout a run.start names, checked to belong to `root`'s repository. */
72
+ export declare function takePrepared(home: string, root: string, key: string): Promise<SessionCheckout>;
73
+ /**
74
+ * Makes a writing task's worktree: resolves `base` to a commit (refreshing the default branch from its remote first),
75
+ * then adds a worktree on a new `task/<slug>` branch in `~/worktrees/<project>`. Names stay distinct across simultaneous
76
+ * starts. The same `key` returns the same worktree while it still stands, so a retried start reuses its preparation.
77
+ */
78
+ export declare function prepareTaskWorktree(options: {
79
+ home: string;
80
+ root: string;
81
+ base: string;
82
+ slug: string;
83
+ key: string;
84
+ worktrees?: string;
85
+ }): Promise<PreparedTaskCheckout>;
86
+ /** What an in-place task records: the project folder, and the branch and commit it began on. */
87
+ export declare function inPlaceCheckout(root: string): Promise<SessionCheckout>;
88
+ export declare function checkoutTop(checkout: SessionCheckout): string;
89
+ export type CheckoutState = {
90
+ state: 'ok';
91
+ } | {
92
+ state: 'missing' | 'moved' | 'removed' | 'other-host';
93
+ reason: string;
94
+ };
95
+ /** Whether a task's recorded worktree is still where it was, a worktree of `root`'s repository. */
96
+ export declare function checkoutState(checkout: SessionCheckout, root: string): Promise<CheckoutState>;
97
+ /** Adds the worktree back at its recorded place from the task branch, which keeps every commit the task made. */
98
+ export declare function recreateTaskWorktree(checkout: SessionCheckout, root: string): Promise<SessionCheckout>;
99
+ /** Takes a folder the lead picked as the task's moved worktree, once it is on the task branch in the same repository. */
100
+ export declare function locateTaskWorktree(checkout: SessionCheckout, root: string, picked: string): Promise<SessionCheckout>;
101
+ export interface WorktreeRemovalCheck {
102
+ /** Uncommitted and untracked files, which removing deletes. */
103
+ dirty: {
104
+ count: number;
105
+ files: string[];
106
+ };
107
+ /** Files Git ignores (node_modules, .env, build output), which removing deletes too. */
108
+ ignored: {
109
+ count: number;
110
+ files: string[];
111
+ };
112
+ /** Commits on the task branch that no remote branch and not the default branch holds. */
113
+ unmerged: {
114
+ count: number;
115
+ commits: string[];
116
+ };
117
+ /** Processes whose working folder is inside the worktree; undefined where they cannot be listed. */
118
+ processes?: {
119
+ count: number;
120
+ names: string[];
121
+ };
122
+ }
123
+ /** What removing a task's worktree would lose, and what holds it. */
124
+ export declare function inspectWorktreeRemoval(checkout: SessionCheckout, root: string): Promise<WorktreeRemovalCheck>;
125
+ export interface WorktreeRemoval {
126
+ checkout: SessionCheckout;
127
+ branchDeleted: boolean;
128
+ }
129
+ /**
130
+ * Removes a task's worktree. Refused while a process works in it, or when it holds uncommitted files the lead was not
131
+ * shown (`expectDirty` is the count they saw). The branch is deleted only when no commit would be lost; otherwise it
132
+ * stays, holding the task's commits.
133
+ */
134
+ export declare function removeTaskWorktree(checkout: SessionCheckout, root: string, options: {
135
+ expectDirty: number;
136
+ }): Promise<WorktreeRemoval>;
137
+ /** Removes a worktree a start made and never used: only while it is clean and its branch has no commit of its own. */
138
+ export declare function discardPreparedWorktree(home: string, root: string, key: string): Promise<boolean>;
139
+ export declare function validCheckout(value: unknown): value is SessionCheckout;
140
+ /** What the agent is told about a task worktree. */
141
+ export declare function worktreeInstructions(checkout: SessionCheckout | undefined): string;