@andorra-labs/code 0.1.5 → 0.1.6

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 (164) hide show
  1. package/dist/src/account-presentation.js +3 -3
  2. package/dist/src/agent-execution.d.ts +2 -0
  3. package/dist/src/agent-execution.js +126 -20
  4. package/dist/src/agent-mcp.d.ts +18 -1
  5. package/dist/src/agent-mcp.js +103 -8
  6. package/dist/src/app-server/protocol.d.ts +33 -3
  7. package/dist/src/app-server/protocol.js +14 -1
  8. package/dist/src/app-server/workspace.d.ts +1 -0
  9. package/dist/src/app-server/workspace.js +7 -1
  10. package/dist/src/app-server.d.ts +115 -41
  11. package/dist/src/app-server.js +1229 -219
  12. package/dist/src/automation-runner.d.ts +9 -0
  13. package/dist/src/automation-runner.js +22 -1
  14. package/dist/src/automation-tool.js +8 -1
  15. package/dist/src/automations.js +1 -1
  16. package/dist/src/browser-captcha-tool.d.ts +54 -0
  17. package/dist/src/browser-captcha-tool.js +374 -0
  18. package/dist/src/browser-panel-tool.d.ts +7 -0
  19. package/dist/src/browser-panel-tool.js +74 -3
  20. package/dist/src/browser-runner.js +19 -4
  21. package/dist/src/browser-server.js +21 -1
  22. package/dist/src/browser-session.d.ts +16 -0
  23. package/dist/src/browser-session.js +35 -0
  24. package/dist/src/browser-ui/app.js +193 -3
  25. package/dist/src/browser-ui/style.css +15 -1
  26. package/dist/src/browser-view.d.ts +72 -4
  27. package/dist/src/browser-view.js +229 -17
  28. package/dist/src/capabilities.js +13 -2
  29. package/dist/src/capsolver.d.ts +60 -0
  30. package/dist/src/capsolver.js +101 -0
  31. package/dist/src/claude-provider.d.ts +6 -0
  32. package/dist/src/claude-provider.js +34 -3
  33. package/dist/src/cli-executable.d.ts +33 -0
  34. package/dist/src/cli-executable.js +64 -0
  35. package/dist/src/cli-process.d.ts +47 -0
  36. package/dist/src/cli-process.js +113 -0
  37. package/dist/src/cli-sign-in.d.ts +68 -0
  38. package/dist/src/cli-sign-in.js +224 -0
  39. package/dist/src/cli.js +53 -22
  40. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
  41. package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
  42. package/dist/src/coding-tools.js +44 -5
  43. package/dist/src/command-output-tap.d.ts +16 -0
  44. package/dist/src/command-output-tap.js +45 -0
  45. package/dist/src/command-screens.js +3 -3
  46. package/dist/src/commands.d.ts +10 -1
  47. package/dist/src/commands.js +7 -7
  48. package/dist/src/completion.d.ts +23 -5
  49. package/dist/src/completion.js +334 -17
  50. package/dist/src/config.d.ts +13 -0
  51. package/dist/src/config.js +28 -2
  52. package/dist/src/deadline.js +6 -0
  53. package/dist/src/extensions.d.ts +1 -0
  54. package/dist/src/extensions.js +16 -3
  55. package/dist/src/graph-provider-portability.js +2 -2
  56. package/dist/src/graph-quota.d.ts +1 -1
  57. package/dist/src/graph-quota.js +1 -1
  58. package/dist/src/graph-runner.js +35 -21
  59. package/dist/src/graph-selection.d.ts +6 -0
  60. package/dist/src/graph-selection.js +10 -0
  61. package/dist/src/graph-server.d.ts +7 -0
  62. package/dist/src/graph-server.js +61 -3
  63. package/dist/src/graph-sync.d.ts +50 -0
  64. package/dist/src/graph-sync.js +383 -12
  65. package/dist/src/graph-ui/app.js +61 -8
  66. package/dist/src/graph-ui/icons.js +1 -0
  67. package/dist/src/graph-ui/index.html +1 -1
  68. package/dist/src/graph-ui/skill-picker.js +242 -0
  69. package/dist/src/graph-ui/style.css +19 -0
  70. package/dist/src/graphs.d.ts +46 -4
  71. package/dist/src/graphs.js +152 -27
  72. package/dist/src/grok-provider.d.ts +50 -0
  73. package/dist/src/grok-provider.js +186 -0
  74. package/dist/src/handoffs.d.ts +13 -0
  75. package/dist/src/handoffs.js +31 -1
  76. package/dist/src/managed-sign-in.d.ts +38 -0
  77. package/dist/src/managed-sign-in.js +169 -0
  78. package/dist/src/markdown.d.ts +5 -0
  79. package/dist/src/markdown.js +5 -2
  80. package/dist/src/mcp.js +11 -0
  81. package/dist/src/membership.d.ts +8 -1
  82. package/dist/src/membership.js +15 -5
  83. package/dist/src/model-metadata.js +14 -2
  84. package/dist/src/model-override.d.ts +10 -0
  85. package/dist/src/model-override.js +20 -0
  86. package/dist/src/opencode-cli-provider.d.ts +122 -0
  87. package/dist/src/opencode-cli-provider.js +415 -0
  88. package/dist/src/opencode-provider.js +23 -8
  89. package/dist/src/palette.d.ts +2 -0
  90. package/dist/src/palette.js +2 -0
  91. package/dist/src/permissions.d.ts +19 -1
  92. package/dist/src/permissions.js +30 -1
  93. package/dist/src/powershell-pool.d.ts +2 -2
  94. package/dist/src/powershell-pool.js +18 -5
  95. package/dist/src/provider-connection.js +36 -0
  96. package/dist/src/provider-engine.d.ts +2 -1
  97. package/dist/src/provider-engine.js +64 -13
  98. package/dist/src/provider-import.js +6 -1
  99. package/dist/src/provider-settings.js +22 -3
  100. package/dist/src/providers.d.ts +12 -1
  101. package/dist/src/providers.js +27 -8
  102. package/dist/src/pull-requests.d.ts +111 -17
  103. package/dist/src/pull-requests.js +308 -76
  104. package/dist/src/qa/qa-authorize.js +9 -1
  105. package/dist/src/react-runtime.js +76 -5
  106. package/dist/src/remote/engine-pool.js +1 -1
  107. package/dist/src/run-progress.js +6 -1
  108. package/dist/src/run-records.d.ts +133 -27
  109. package/dist/src/run-records.js +320 -40
  110. package/dist/src/runtime.d.ts +38 -1
  111. package/dist/src/runtime.js +27 -4
  112. package/dist/src/save-lock.d.ts +11 -0
  113. package/dist/src/save-lock.js +29 -2
  114. package/dist/src/sessions.js +4 -1
  115. package/dist/src/shell.js +4 -1
  116. package/dist/src/side-panel.d.ts +1 -1
  117. package/dist/src/side-panel.js +1 -1
  118. package/dist/src/skill-commands.d.ts +2 -0
  119. package/dist/src/skill-commands.js +2 -0
  120. package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
  121. package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
  122. package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
  123. package/dist/src/skills/bundled/graph-manager/SKILL.md +97 -0
  124. package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
  125. package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
  126. package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
  127. package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
  128. package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
  129. package/dist/src/skills/bundled/provenance.json +50 -0
  130. package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
  131. package/dist/src/skills/invocable-skills.d.ts +41 -0
  132. package/dist/src/skills/invocable-skills.js +49 -0
  133. package/dist/src/skills/prompt-skills.d.ts +1 -0
  134. package/dist/src/skills/prompt-skills.js +33 -0
  135. package/dist/src/skills/runtime-skills.d.ts +4 -0
  136. package/dist/src/skills/runtime-skills.js +21 -0
  137. package/dist/src/structured-step.d.ts +55 -0
  138. package/dist/src/structured-step.js +85 -0
  139. package/dist/src/subagent-run.d.ts +1 -1
  140. package/dist/src/subagent-run.js +29 -33
  141. package/dist/src/telemetry/schema.d.ts +2 -2
  142. package/dist/src/telemetry/schema.js +3 -2
  143. package/dist/src/terminal-ui.d.ts +29 -0
  144. package/dist/src/terminal-ui.js +112 -28
  145. package/dist/src/timers.d.ts +21 -2
  146. package/dist/src/timers.js +12 -4
  147. package/dist/src/tool-names.d.ts +18 -0
  148. package/dist/src/tool-names.js +26 -0
  149. package/dist/src/tools.js +45 -11
  150. package/dist/src/trajectory.js +32 -12
  151. package/dist/src/types.d.ts +23 -0
  152. package/docs/agents/mcp-server.md +13 -1
  153. package/docs/agents/subagent-mode.md +7 -4
  154. package/docs/concepts/security.md +2 -0
  155. package/docs/getting-started/configure-providers.md +29 -2
  156. package/docs/guides/browser.md +12 -0
  157. package/docs/guides/desktop-app.md +10 -3
  158. package/docs/guides/graph-builder.md +8 -0
  159. package/docs/reference/config.md +2 -2
  160. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
  161. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
  162. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
  163. package/package.json +1 -1
  164. package/tests/permissions-test-plan.md +2 -1
@@ -44,7 +44,7 @@ export declare const APP_SERVER_PROTOCOL_VERSION = 2;
44
44
  * one when a client omits it. An engine without it rebuilds a replaced entry from its own field
45
45
  * list, so a save through it silently drops the rename and every surface falls back to the id; a
46
46
  * client that can show the field must refuse the write first. */
47
- export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.name", "providers.claude", "providers.opencodeGo", "providers.discover.draft", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.steer", "run.overrideAllNodes", "run.setModel", "run.start.continueSession", "remote.owner.projects", "remote.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "browser.view.go"];
47
+ export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.name", "providers.claude", "providers.claudeAuth", "providers.grok", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "browser.view.go", "config.browser"];
48
48
  /** One client call. `params` is omitted only for calls that take no arguments. */
49
49
  export interface AppServerRequest {
50
50
  id: number | string;
@@ -103,7 +103,7 @@ export interface AppServerHostInfo {
103
103
  */
104
104
  export type AppServerErrorCode = 'invalid-request' | 'unknown-method' | 'invalid-params' | 'busy' | 'engine-busy' | 'not-found' | 'login-required' | 'auth' | 'storage' | 'network' | 'cancelled' | 'internal' | 'remote' | 'nothing-to-continue';
105
105
  /** The permission modes a project can hold, mirroring `src/permissions.ts`. */
106
- export type AppServerPermissionMode = 'read-only' | 'ask-for-approval' | 'approve-for-me' | 'full-access';
106
+ export type AppServerPermissionMode = 'read-only' | 'plan' | 'ask-for-approval' | 'approve-for-me' | 'full-access';
107
107
  /** Verified official Codex account/catalog, never its credentials or token payloads. */
108
108
  export interface AppServerProviderAuth {
109
109
  state: 'signedOut' | 'starting' | 'waiting' | 'signedIn' | 'cancelled' | 'error';
@@ -123,11 +123,30 @@ export interface AppServerProviderAuth {
123
123
  organization?: string;
124
124
  /** The Claude Console workspace a signed-in Anthropic provider's token is bound to. */
125
125
  workspace?: string;
126
+ /** A device code the person confirms on the sign-in page (Grok). Only a start answer carries it. */
127
+ userCode?: string;
128
+ /** The CLI waits for a code the sign-in page shows; submit it with providers.auth.submit. */
129
+ acceptsCode?: boolean;
130
+ /** OpenCode: the upstream providers it has connected. */
131
+ connected?: Array<{
132
+ id: string;
133
+ name: string;
134
+ }>;
135
+ /** OpenCode: the browser sign-ins it offers, by upstream provider and method index. */
136
+ signInOptions?: Array<{
137
+ providerId: string;
138
+ providerName: string;
139
+ method: number;
140
+ label: string;
141
+ connected: boolean;
142
+ }>;
143
+ /** OpenCode: the upstream provider the attempt in progress signs in to. */
144
+ signInProvider?: string;
126
145
  }
127
146
  /** One configured provider as the client may see it. API keys are never included. */
128
147
  export interface AppServerProvider {
129
148
  id: string;
130
- type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go';
149
+ type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go' | 'grok' | 'opencode';
131
150
  baseUrl: string;
132
151
  model: string;
133
152
  apiKeyEnv?: string;
@@ -214,6 +233,15 @@ export interface AppServerConfig {
214
233
  systemPromptOverride?: string | null;
215
234
  /** Days without activity before a session is archived automatically (1-30); null in a patch turns it off. */
216
235
  autoArchiveDays?: number | null;
236
+ /**
237
+ * Browser tool settings. The CapSolver key itself is never reported: `hasCapsolverKey` says one is
238
+ * saved, and `capsolverKeySource` which key the solve tool would use (the saved one wins over
239
+ * `CAPSOLVER_API_KEY`). A patch sends `{ browser: { capsolverApiKey: string | null } }`.
240
+ */
241
+ browser?: {
242
+ hasCapsolverKey: boolean;
243
+ capsolverKeySource?: 'config' | 'env';
244
+ };
217
245
  }
218
246
  export interface AppServerAccount {
219
247
  signedIn: boolean;
@@ -329,6 +357,8 @@ export interface AppServerSessionSummary {
329
357
  requests: number;
330
358
  cacheRead?: number;
331
359
  cacheWrite?: number;
360
+ localCacheInputTokens?: number;
361
+ localCacheReadTokens?: number;
332
362
  };
333
363
  }
334
364
  /** How a saved attempt ended. `succeeded` is the engine's reading of a turn that carries no status. */
@@ -77,6 +77,11 @@ export const APP_SERVER_PROTOCOL_VERSION = 2;
77
77
  // parameter and forks: the work still runs, but the session the client is showing stays behind and
78
78
  // the rail grows a duplicate-named thread, so a client that keeps one task tree sends the flag only
79
79
  // to an engine that advertises it.
80
+ // `run.start.entryHistory`: `run.start` accepts `entryHistory` with a `sessionId`, which hands the
81
+ // session's retained history to the graph's entry node whatever that node's own context policy says.
82
+ // A client sends it when the session switches to another graph, which starts from its entry node. An
83
+ // engine without it ignores the parameter, and the entry node sees the history only when its own
84
+ // policy asks for it.
80
85
  // `automations`: the engine owns persistent schedules: `automations.*` lists, creates, updates,
81
86
  // deletes and runs saved prompts, and reports the scheduler service's state, each firing as its own
82
87
  // session. An engine without it answers `unknown-method`, so a window on such an engine hides the
@@ -103,4 +108,12 @@ export const APP_SERVER_PROTOCOL_VERSION = 2;
103
108
  // engine without it answers `unknown-method`, and a client that offers steering must not fall back to
104
109
  // cancelling the run: the attempt would stop for a message this engine could only deliver by starting
105
110
  // it over.
106
- export const APP_SERVER_CAPABILITIES = ['run.start.runPermissions', 'automations', 'providers.models', 'providers.test', 'providers.test.model', 'providers.streamIdleTimeout', 'providers.modelContextWindows', 'providers.name', 'providers.claude', 'providers.opencodeGo', 'providers.discover.draft', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.steer', 'run.overrideAllNodes', 'run.setModel', 'run.start.continueSession', 'remote.owner.projects', 'remote.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', 'extensions.manage', 'extensions.resources', 'skills.invoke', 'mcp.manage', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'browser.view.go'];
111
+ // `run.setPermissions`: a live attempt changes its permission mode without restarting. Pending approvals are
112
+ // handed back to their tools to be decided again under the new mode, and the change is journaled as
113
+ // `run.permissions.changed`. An engine without it answers `unknown-method`; its running task keeps the mode it
114
+ // started with, and a client offers the pick for the next task only.
115
+ // `run.setModel.node`: `run.setModel` accepts `nodeId`, which scopes the switch to one agent node —
116
+ // and the children it delegates without a model of their own — instead of the run. An engine that
117
+ // advertises `run.setModel` but not this ignores the unknown parameter and would answer a node-scoped
118
+ // request as a whole-run one, so a client that promises one node's switch must refuse it here first.
119
+ export const APP_SERVER_CAPABILITIES = ['run.start.runPermissions', 'automations', 'providers.models', 'providers.test', 'providers.test.model', 'providers.streamIdleTimeout', 'providers.modelContextWindows', 'providers.name', 'providers.claude', 'providers.claudeAuth', 'providers.grok', 'providers.opencode', 'providers.auth.submit', 'providers.opencodeGo', 'providers.discover.draft', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.steer', 'run.overrideAllNodes', 'run.setModel', 'run.setModel.node', 'run.setPermissions', 'run.start.continueSession', 'run.start.entryHistory', 'remote.owner.projects', 'remote.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', 'extensions.manage', 'extensions.resources', 'skills.invoke', 'mcp.manage', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'browser.view.go', 'config.browser'];
@@ -236,6 +236,7 @@ export declare function summarizeMcpServer(server: McpServerConfig): string;
236
236
  /** Installed skills, plugins, and configured MCP servers. Secrets in env/headers are never included. */
237
237
  export declare function listExtensions(config: Config, signal?: AbortSignal, directory?: string): Promise<{
238
238
  skills: AppServerBundle[];
239
+ builtinSkills: AppServerBundle[];
239
240
  plugins: AppServerBundle[];
240
241
  mcpServers: {
241
242
  id: string;
@@ -6,6 +6,7 @@ import { isAbsolute, join, relative, resolve, sep } from 'node:path';
6
6
  import { runRecordPath, runRecordsDirectory, sessionHasOpenRun } from '../run-records.js';
7
7
  import { validSavedSession } from '../sessions.js';
8
8
  import { listBundles } from '../extensions.js';
9
+ import { builtinSkillEntries } from '../skills/invocable-skills.js';
9
10
  /**
10
11
  * Inspection of a workspace and of this installation's run records.
11
12
  *
@@ -1088,7 +1089,12 @@ export async function listExtensions(config, signal, directory) {
1088
1089
  listBundles('plugins', config, { signal, notices, directory }),
1089
1090
  ]);
1090
1091
  return {
1091
- skills: skills.map(map), plugins: plugins.map(map),
1092
+ skills: skills.map(map),
1093
+ // Andorra's own skills, for the composer's slash menu only: Settings lists what is installed, and
1094
+ // these can be neither removed nor turned off.
1095
+ builtinSkills: builtinSkillEntries(skills).map(skill => ({ id: skill.id, name: skill.name, description: skill.description, enabled: true, command: skill.command,
1096
+ repository: { id: 'andorra', name: 'Built-in', source: 'andorra', path: '' } })),
1097
+ plugins: plugins.map(map),
1092
1098
  mcpServers: Object.entries(config.mcpServers ?? {}).map(([id, server]) => ({
1093
1099
  id, transport: server.transport, enabled: server.enabled !== false,
1094
1100
  summary: summarizeMcpServer(server),
@@ -2,11 +2,14 @@ import { type ProviderConfig } from './providers.js';
2
2
  import { removeCodexAccount } from './codex-auth.js';
3
3
  import { CodexAccountAuth } from './codex-browser-auth.js';
4
4
  import { AnthropicConsoleAuth } from './anthropic-console-auth.js';
5
+ import { OpenCodeSignIn } from './managed-sign-in.js';
6
+ import type { CliSignIn } from './cli-sign-in.js';
5
7
  import { checkGraphModelHealth } from './graph-health.js';
6
8
  import { loadAccessibleGraph } from './membership.js';
7
9
  import { type SavedSession } from './sessions.js';
8
10
  import { type GhRunner } from './pull-requests.js';
9
11
  import { type Completion, type RunResult } from './runtime.js';
12
+ import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
10
13
  import { type AppServerErrorCode } from './app-server/protocol.js';
11
14
  /**
12
15
  * `andorra app-server --stdio`: the engine a non-TUI client drives.
@@ -29,6 +32,8 @@ declare class AppServerError extends Error {
29
32
  readonly code: AppServerErrorCode;
30
33
  constructor(code: AppServerErrorCode, message: string);
31
34
  }
35
+ type ManagedSignInService = Pick<CliSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
36
+ type OpenCodeSignInService = Pick<OpenCodeSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
32
37
  /**
33
38
  * Merge a client's provider list with the stored secrets.
34
39
  *
@@ -58,32 +63,6 @@ declare class AppServerError extends Error {
58
63
  * it — and dropping it on save would silently point a second account at the default home's sign-in.
59
64
  */
60
65
  export declare function mergeProviderSecrets(stored: ProviderConfig[], incoming: unknown[]): ProviderConfig[];
61
- /**
62
- * Whether a failed wake delivery is final for that wake.
63
- *
64
- * A delivery gets two kinds of answer. One describes the request: an unknown provider or graph, a task the
65
- * protocol will not accept, a session record that is no longer there at all, a remote workspace nothing may be
66
- * run in, a method the engine does not have. The same prompt would be refused the same way a minute from now, so
67
- * the wake is spent and the row must stop saying the session is waiting on it.
68
- *
69
- * A project folder that is not there *this moment* is not that answer. Folders come back: a checkout that has not
70
- * landed, a share that is unreachable, a directory moved and moved again. A delivery that spent the wake on the
71
- * first `ENOENT` would throw away a continuation the agent asked for, over a condition that clears. The start
72
- * refuses a missing folder as a plain filesystem failure rather than a named protocol refusal, and that is the
73
- * classification: `test/app-server.test.ts` ("a wake survives a delivery the engine could not start") takes an
74
- * owed workspace out of the world and pins the rest - the wake stays owed, the row keeps its clock, no empty
75
- * `timers.updated` says the wait is over, and the prompt arrives once the folder does.
76
- *
77
- * The other kind describes the moment, and every one of them clears: `engine-busy` and `busy` while another
78
- * task or a `workspace.checkout` holds the engine, `cancelled` from a shutdown in progress (the wake is on
79
- * disk, so the next engine process picks it up again), `storage` and `network` from inside the preparation,
80
- * and — the one that costs a prompt most easily — a raw filesystem error, because the start re-throws the save
81
- * when the session snapshot cannot be written. A deadline says the earliest a prompt may be given, not that it
82
- * may be given once, so anything that is not a refusal of the request is waited out. Unclassified failures
83
- * belong here: an error the engine never got to name is a failure of the moment, and losing the prompt the
84
- * agent asked to be woken for is the more expensive guess.
85
- */
86
- /** Exported because the table is the part a delivery must not get wrong; the protocol test pins it. */
87
66
  export declare function isFinalWakeRefusal(error: unknown): boolean;
88
67
  /**
89
68
  * The account a finished run leaves on the session turn.
@@ -114,6 +93,8 @@ export interface AppServerOptions {
114
93
  error?: NodeJS.WritableStream;
115
94
  /** Overridable so a test can answer the model preflight without reaching a provider. */
116
95
  checkGraphHealth?: typeof checkGraphModelHealth;
96
+ /** Overridable so a test can watch the code-intelligence manager's mode without starting CodeGraph. */
97
+ createCodeIntelligence?: typeof CodeIntelligenceManager.create;
117
98
  /** Overridable so a test can run a graph whose access rules it cannot meet. */
118
99
  loadGraph?: typeof loadAccessibleGraph;
119
100
  /** Provider authentication is owned here, independently of the Andorra account sign-in. */
@@ -122,6 +103,12 @@ export interface AppServerOptions {
122
103
  removeCodexAccount?: typeof removeCodexAccount;
123
104
  /** Claude Console sign-in for Anthropic providers; overridable so a test never spawns `ant`. */
124
105
  anthropicAuth?: Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel' | 'logout' | 'discard' | 'close'>;
106
+ /** Subscription sign-ins run through a vendor CLI; overridable so a test never spawns one. */
107
+ managedSignIn?: {
108
+ claude?: ManagedSignInService;
109
+ grok?: ManagedSignInService;
110
+ opencode?: OpenCodeSignInService;
111
+ };
125
112
  /** Overridable so a test can answer `gh` without reaching GitHub. */
126
113
  gh?: GhRunner;
127
114
  /** How often the pull request watcher polls; a test shortens it. */
@@ -140,14 +127,18 @@ export declare class AppServer {
140
127
  private readonly output;
141
128
  private readonly error;
142
129
  private readonly checkGraphHealth;
130
+ private readonly createCodeIntelligence;
143
131
  private readonly loadGraph;
144
132
  private readonly codexAuth;
145
133
  private readonly anthropicAuth;
134
+ private readonly claudeSignIn;
135
+ private readonly grokSignIn;
136
+ private readonly openCodeSignIn;
146
137
  /** Retires a removed provider's slot home; a seam so a test never has to spawn the Codex CLI. */
147
138
  private readonly retireCodexAccount;
148
139
  /** The `gh` the pull request settings and watcher run through. */
149
140
  private readonly gh;
150
- /** Polls the PRs whose sessions asked for Auto-fix or Auto-archive; one engine per home actually polls. */
141
+ /** Polls the PRs whose sessions asked for Auto-fix; one engine per home actually polls. */
151
142
  private readonly pullRequestWatcher;
152
143
  /** The wakes this engine armed for Auto-fix, checked against the PR record again before delivery. */
153
144
  private readonly autoFixWakes;
@@ -234,18 +225,11 @@ export declare class AppServer {
234
225
  */
235
226
  private startingSession?;
236
227
  /**
237
- * Runs whose journal sink failed mid-attempt. The journal keeps being written after the failure,
238
- * so it looks complete; this is what marks the attempt as one no resume may replay (the record
239
- * and a marker file carry it past a crash).
228
+ * Each live run's journal writer. A writer holds the events its file refused and writes them once
229
+ * appends succeed again, so it is also what knows, at finalization, whether the journal is a
230
+ * complete account (the record and a marker file carry the answer past a crash).
240
231
  */
241
- private readonly journalFailures;
242
- /**
243
- * Runs whose checkpoint sink failed mid-attempt. A checkpoint is the conversation a resume
244
- * re-enters the node with, so a run whose checkpoint could not be written is one no resume may
245
- * replay: the resume would re-enter the node from its opening task and repeat the tool calls it
246
- * had already made. The record and a marker file carry the failure past a crash.
247
- */
248
- private readonly checkpointFailures;
232
+ private readonly journals;
249
233
  /**
250
234
  * The session trajectory of the run in flight: one sanitized debug log per session
251
235
  * (`trajectories/<sessionId>.jsonl` in this home), appended by every run and resume of that
@@ -434,6 +418,13 @@ export declare class AppServer {
434
418
  private discoverModels;
435
419
  /** Local-client only. The remote engine relay deliberately does not admit these methods. */
436
420
  private providerAuth;
421
+ /**
422
+ * Subscription sign-in through a vendor CLI's own login: Claude Code, Grok, or one of OpenCode's
423
+ * upstream providers. Local-client only, like the others. Each of these logins belongs to the CLI
424
+ * on this machine rather than to one provider entry, so the draft a person is adding can sign in
425
+ * before it is saved; a providerId is accepted and ignored.
426
+ */
427
+ private managedProviderAuth;
437
428
  /**
438
429
  * Claude Console sign-in for one configured Anthropic provider. Local-client only, like Codex
439
430
  * sign-in: the remote engine relay does not admit these methods.
@@ -594,6 +585,18 @@ export declare class AppServer {
594
585
  * disagreeing about the model a node runs, because all three read this same graph.
595
586
  */
596
587
  private graphForRun;
588
+ /**
589
+ * The graph a resume replays against, with carried node switches applied before its remaining
590
+ * provider references are bound.
591
+ *
592
+ * A node moved to provider B survives provider A leaving the configuration: the carried provider
593
+ * replaces the switched node's reference before the binder validates what is left, so the
594
+ * obsolete pin cannot fail the load. The carried model travels after the bind — the binder offers
595
+ * only models a provider's configuration lists, and a live switch may have named a model the
596
+ * endpoint serves without the configuration listing it, which `resolveModel` accepted. A
597
+ * whole-run override sets every reference aside instead, so it binds nothing, as before.
598
+ */
599
+ private loadResumeGraph;
597
600
  private prepareRunValidated;
598
601
  /**
599
602
  * Name a brand-new session from its first prompt with one bounded model request.
@@ -645,6 +648,39 @@ export declare class AppServer {
645
648
  private serializeRunRecordWrite;
646
649
  /** Change the next model turn without aborting a stream or replaying tools. */
647
650
  private setRunModel;
651
+ /**
652
+ * Change the permission mode a live attempt runs under, without interrupting it.
653
+ *
654
+ * The new mode reaches the attempt through its permission control (`ActiveRun.permissionControl`): a
655
+ * tool call that has not decided yet decides under it, and every approval the attempt is waiting on
656
+ * is handed back as `policy-changed`, so its tool decides again — a prompt the new mode answers goes
657
+ * away, and one the new mode still requires is asked again. The mode is saved where the attempt read
658
+ * it from, so the next task, a resume and a terminal on the same project agree with what is running.
659
+ */
660
+ private setRunPermissions;
661
+ private applyRunPermissions;
662
+ /**
663
+ * Move a live run's control to `next` and journal the change, settling any prompt that waited
664
+ * across it. Shared by the saved switch (`run.setPermissions`) and the run-scoped plan-approval
665
+ * flip: neither re-asks a mode the run already has.
666
+ */
667
+ private switchLiveRunPermissions;
668
+ /**
669
+ * The plan-approval flip. Unlike `run.setPermissions` it is run-scoped only: approving a plan
670
+ * never rewrites the saved workspace default, so the next task plans again. The run continues in
671
+ * the workspace's saved default when that is an editing mode, and in Ask for approval otherwise.
672
+ */
673
+ private approvePlan;
674
+ /** Save a live mode where the attempt reads it from: its own record when bound, the workspace default otherwise. */
675
+ private saveRunPermissions;
676
+ /**
677
+ * Bring the workspace's code-intelligence manager, once it exists, to the mode the run holds for it.
678
+ *
679
+ * One change at a time, each reading the target when it runs, so the last one leaves the manager on
680
+ * the latest target. A manager already on the target is left alone; one whose change failed is in an
681
+ * unknown mode, so the next sync applies the target again rather than trusting it.
682
+ */
683
+ private syncCodeIntelPermissions;
648
684
  private resolveModel;
649
685
  /**
650
686
  * The client-visible configuration with the plan-aware analytics answer.
@@ -666,12 +702,15 @@ export declare class AppServer {
666
702
  private codeIntelligence;
667
703
  /** Code-intelligence events belong to the active run's stream when one is running. */
668
704
  private runEvent;
705
+ /** The journal writer of one run, created on its first event. */
706
+ private journalFor;
669
707
  /**
670
708
  * Journal first, then the client: a client that missed an event can re-read the record.
671
709
  *
672
- * `runs/` is created here rather than assumed: the terminal client creates it during startup,
673
- * and this mode returns before that code runs, so a fresh configuration home would otherwise
674
- * fail every append with ENOENT and silently produce no record at all.
710
+ * The writer creates `runs/` when the first append finds it missing: the terminal client creates
711
+ * it during startup, and this mode returns before that code runs, so a fresh configuration home
712
+ * would otherwise fail every append with ENOENT. Appends are ordered: the filesystem does not
713
+ * finish concurrent appends in the order they were started.
675
714
  */
676
715
  private recordRunEvent;
677
716
  private ensureRunRecords;
@@ -720,6 +759,8 @@ export declare class AppServer {
720
759
  * them into B's account. `graphStorageAccess` claims an unclaimed directory for a confirmed account —
721
760
  * the account the builder claims it for — and reports the ones that are still shared.
722
761
  */
762
+ /** Whether a stored graph selection names a graph whose latest revision is soft-deleted. */
763
+ private selectionIsDeleted;
723
764
  private graphDirectory;
724
765
  /**
725
766
  * Whether the account service confirms this account, paid or free.
@@ -993,6 +1034,39 @@ export declare class AppServer {
993
1034
  private nextWakeLook;
994
1035
  /** Begin a delivery pass when none is going. Called by the registry's due callback and by the check. */
995
1036
  private checkTimers;
1037
+ /**
1038
+ * Say a wake will never be delivered: drop it, publish the shorter wait list, and tell the user why.
1039
+ *
1040
+ * A wake is the agent's own reminder about work that is over or was replaced, and starting it as a new task
1041
+ * would restart that work behind the user's back. Dropping it silently would hide a promise the agent made,
1042
+ * so the reason goes out with `timers.spent` - which a window shows as a notice - and into the log.
1043
+ */
1044
+ private spendWake;
1045
+ /**
1046
+ * Spend the session's node-armed wakes that belong to an attempt in `attempts` and satisfy `spent`.
1047
+ *
1048
+ * Wakes another surface is in the middle of delivering are left alone: that delivery decides what became of
1049
+ * them. Wakes no graph node armed are never touched here.
1050
+ */
1051
+ private spendAttemptWakes;
1052
+ /**
1053
+ * Hand every due wake the live run itself armed (or an attempt that run continues) to that run, as a
1054
+ * steering message its working node reads at the next turn boundary.
1055
+ *
1056
+ * The wake is settled once the message is queued: from there the run owns it. One the run ends before
1057
+ * reading is put back on the registry by the finalizer, where the rules for a finished run decide it.
1058
+ */
1059
+ private steerDueWakes;
1060
+ /**
1061
+ * Where a node-armed wake goes once no run has the engine: the attempt to continue, a reason it is spent, or
1062
+ * a reason to wait.
1063
+ *
1064
+ * It continues only the session's newest attempt, and only when that attempt is the one that armed it or a
1065
+ * continuation of it, the attempt stopped without finishing, the user did not stop it, and the arming node
1066
+ * has not finished since the wake was armed. Anything else means the work the reminder was about is over or
1067
+ * was replaced by a newer turn, and it is spent.
1068
+ */
1069
+ private wakeContinuation;
996
1070
  /**
997
1071
  * Give every wake that has come due to the session that armed it, one run at a time.
998
1072
  *