@andorra-labs/code 0.1.15 → 0.1.16

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 (100) hide show
  1. package/dist/src/agent-definitions.js +29 -6
  2. package/dist/src/agent-execution.js +4 -2
  3. package/dist/src/agent-mcp.d.ts +1 -1
  4. package/dist/src/agent-mcp.js +13 -9
  5. package/dist/src/app-server/protocol.d.ts +4 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +107 -0
  8. package/dist/src/app-server.js +893 -22
  9. package/dist/src/auth/deployment.js +2 -2
  10. package/dist/src/browser-runner.js +1 -0
  11. package/dist/src/browser-ui/style.css +3 -3
  12. package/dist/src/browser-ui/tokens.css +27 -16
  13. package/dist/src/claude-provider.js +3 -1
  14. package/dist/src/cli.js +22 -8
  15. package/dist/src/codex-errors.js +4 -1
  16. package/dist/src/command-screens.js +5 -3
  17. package/dist/src/commands.d.ts +2 -1
  18. package/dist/src/compaction-phrases.d.ts +4 -0
  19. package/dist/src/compaction-phrases.js +20 -0
  20. package/dist/src/context-compaction.js +2 -1
  21. package/dist/src/decision/DecisionManager.js +3 -2
  22. package/dist/src/decision/requestPhrases.d.ts +4 -0
  23. package/dist/src/decision/requestPhrases.js +23 -0
  24. package/dist/src/github-inbox.d.ts +55 -0
  25. package/dist/src/github-inbox.js +153 -0
  26. package/dist/src/graph-health.js +7 -3
  27. package/dist/src/graph-provider-portability.js +32 -10
  28. package/dist/src/graph-quota.d.ts +29 -2
  29. package/dist/src/graph-quota.js +68 -10
  30. package/dist/src/graph-runner.js +24 -7
  31. package/dist/src/graph-server.d.ts +1 -1
  32. package/dist/src/graph-server.js +9 -7
  33. package/dist/src/graph-ui/app.js +110 -33
  34. package/dist/src/graph-ui/controls.css +1 -0
  35. package/dist/src/graph-ui/embed.js +2 -2
  36. package/dist/src/graph-ui/icons.js +1 -0
  37. package/dist/src/graph-ui/index.html +1 -1
  38. package/dist/src/graph-ui/manager.css +1 -1
  39. package/dist/src/graph-ui/manager.js +2 -2
  40. package/dist/src/graph-ui/sidebar.js +30 -0
  41. package/dist/src/graph-ui/studio-canvas.js +26 -13
  42. package/dist/src/graph-ui/studio.css +15 -7
  43. package/dist/src/graph-ui/studio.js +11 -4
  44. package/dist/src/graph-ui/style.css +77 -45
  45. package/dist/src/graph-ui/theme.js +3 -36
  46. package/dist/src/graph-ui/tokens.css +27 -19
  47. package/dist/src/graphs.js +4 -3
  48. package/dist/src/membership.d.ts +20 -1
  49. package/dist/src/membership.js +29 -4
  50. package/dist/src/model-metadata.d.ts +1 -1
  51. package/dist/src/model-metadata.js +4 -2
  52. package/dist/src/plan-pass.d.ts +59 -0
  53. package/dist/src/plan-pass.js +165 -0
  54. package/dist/src/provider-engine.js +3 -0
  55. package/dist/src/providers.d.ts +17 -0
  56. package/dist/src/providers.js +68 -19
  57. package/dist/src/pull-request-checks.d.ts +26 -0
  58. package/dist/src/pull-request-checks.js +56 -0
  59. package/dist/src/pull-request-conversation.d.ts +134 -0
  60. package/dist/src/pull-request-conversation.js +221 -0
  61. package/dist/src/pull-request-create.d.ts +175 -0
  62. package/dist/src/pull-request-create.js +392 -0
  63. package/dist/src/pull-request-details.d.ts +242 -0
  64. package/dist/src/pull-request-details.js +614 -0
  65. package/dist/src/pull-request-edit.d.ts +23 -0
  66. package/dist/src/pull-request-edit.js +91 -0
  67. package/dist/src/pull-request-logs.d.ts +76 -0
  68. package/dist/src/pull-request-logs.js +172 -0
  69. package/dist/src/pull-request-merge.d.ts +112 -0
  70. package/dist/src/pull-request-merge.js +258 -0
  71. package/dist/src/pull-request-review.d.ts +137 -0
  72. package/dist/src/pull-request-review.js +401 -0
  73. package/dist/src/pull-requests.d.ts +43 -2
  74. package/dist/src/pull-requests.js +112 -21
  75. package/dist/src/react-runtime.js +37 -4
  76. package/dist/src/remote/engine-pool.js +16 -4
  77. package/dist/src/run-control.d.ts +10 -0
  78. package/dist/src/run-control.js +24 -0
  79. package/dist/src/run-progress.d.ts +10 -0
  80. package/dist/src/run-progress.js +122 -0
  81. package/dist/src/run-records.d.ts +2 -2
  82. package/dist/src/runtime.d.ts +5 -1
  83. package/dist/src/runtime.js +14 -2
  84. package/dist/src/subagent-run.js +1 -0
  85. package/dist/src/telemetry/capture-core.d.ts +17 -0
  86. package/dist/src/telemetry/capture-core.js +59 -1
  87. package/dist/src/telemetry/classify.d.ts +3 -1
  88. package/dist/src/telemetry/classify.js +37 -0
  89. package/dist/src/telemetry/emitter.d.ts +2 -0
  90. package/dist/src/telemetry/emitter.js +42 -5
  91. package/dist/src/telemetry/schema.d.ts +22 -0
  92. package/dist/src/telemetry/schema.js +68 -1
  93. package/dist/src/telemetry/surface.d.ts +1 -0
  94. package/dist/src/telemetry/uploader.d.ts +6 -1
  95. package/dist/src/telemetry/uploader.js +22 -3
  96. package/dist/src/terminal-ui.js +1 -1
  97. package/dist/src/transcript.js +8 -2
  98. package/dist/src/types.d.ts +7 -0
  99. package/dist/src/usage-analytics.js +18 -10
  100. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { mkdir, readdir, readFile, writeFile, rename, rm, unlink } from 'node:fs
3
3
  import { join } from 'node:path';
4
4
  import { validateSchema } from './handoffs.js';
5
5
  import { configDirectory } from './config.js';
6
+ import { findProviderById, providerModelId } from './providers.js';
6
7
  import { acquireSaveLock, archiveUnpublishedSnapshot, SaveLockBusyError } from './save-lock.js';
7
8
  import { GraphConflictError, validateGraph, createOrchestratorNode, nodeOutcomes } from './graphs.js';
8
9
  const base = { filesystem: 'read-write', shell: 'allowed', git: 'write', github: 'pull-request', browser: 'playwright', deployment: 'none' };
@@ -210,20 +211,42 @@ export function parseAgentExport(input) {
210
211
  return { name: agent.name.trim(), description: agent.description ?? '', node: structuredClone(agent.node) };
211
212
  }
212
213
  function adoptModelProfiles(node, providers, defaultProvider) {
213
- const known = (id) => id !== undefined && providers.some(p => p.id === id);
214
- const forget = (ref) => { if (ref.provider !== undefined && !known(ref.provider)) {
214
+ // Ids and models are matched without regard to case and kept in this machine's spelling.
215
+ const known = (id) => findProviderById(providers, id) !== undefined;
216
+ const forget = (ref) => { if (ref.provider === undefined)
217
+ return; const local = findProviderById(providers, ref.provider); if (local)
218
+ ref.provider = local.id;
219
+ else {
215
220
  delete ref.provider;
216
221
  delete ref.model;
217
222
  } };
218
223
  const offers = (ref, inherited) => {
219
- const profile = providers.find(p => p.id === (ref.provider ?? inherited));
220
- if (ref.model !== undefined && (!profile || ![profile.model, ...(profile.models ?? [])].includes(ref.model)))
224
+ const profile = findProviderById(providers, ref.provider ?? inherited);
225
+ if (ref.model === undefined)
226
+ return;
227
+ const local = profile ? providerModelId({ model: profile.model ?? '', models: profile.models }, ref.model) : undefined;
228
+ if (local === undefined)
221
229
  delete ref.model;
230
+ else
231
+ ref.model = local;
232
+ };
233
+ const respell = (ref, inherited) => {
234
+ const profile = findProviderById(providers, ref.provider ?? inherited);
235
+ const local = profile && ref.model !== undefined ? providerModelId({ model: profile.model ?? '', models: profile.models }, ref.model) : undefined;
236
+ if (local !== undefined)
237
+ ref.model = local;
222
238
  };
223
239
  forget(node);
240
+ respell(node, defaultProvider);
224
241
  const retry = node.retry;
225
- if (record(retry) && record(retry.fallback) && !known(retry.fallback.provider))
226
- delete retry.fallback;
242
+ if (record(retry) && record(retry.fallback)) {
243
+ if (!known(retry.fallback.provider))
244
+ delete retry.fallback;
245
+ else {
246
+ forget(retry.fallback);
247
+ respell(retry.fallback, undefined);
248
+ }
249
+ }
227
250
  const inherited = node.provider ?? defaultProvider;
228
251
  const subagents = node.subagents;
229
252
  if (!record(subagents))
@@ -368,7 +368,9 @@ export async function executeAgentNode(node, options) {
368
368
  let provider = configuredProvider, resolved = await resolve(provider, configuredModel);
369
369
  if (!resolved)
370
370
  throw new Error(`Unknown provider ${provider}. Run andorra and open /providers first.`);
371
- let model = configured.model ?? resolved.model;
371
+ // The resolved model is the provider's own spelling of the configured one when they differ only in case.
372
+ const spelled = (wanted, got) => wanted !== undefined && wanted.toLowerCase() === got.toLowerCase() ? got : wanted ?? got;
373
+ let model = spelled(configured.model, resolved.model);
372
374
  let fallbackAttempt = parentFallback;
373
375
  const orchestratorCompletionGuard = () => {
374
376
  if (!clarified)
@@ -1555,7 +1557,7 @@ export async function executeAgentNode(node, options) {
1555
1557
  resolved = await resolve(provider, configured.retry.fallback.model);
1556
1558
  if (!resolved)
1557
1559
  throw new Error(`Unknown fallback provider: ${provider}`);
1558
- model = configured.retry.fallback.model ?? resolved.model;
1560
+ model = spelled(configured.retry.fallback.model, resolved.model);
1559
1561
  }
1560
1562
  }
1561
1563
  researchResults.set(result, observedResearch);
@@ -1,7 +1,7 @@
1
1
  import { loadConfig } from './config.js';
2
2
  import { GraphSync } from './graph-sync.js';
3
3
  import { getAuthStatus } from './auth/index.js';
4
- import { getMembership } from './membership.js';
4
+ import { type getMembership } from './membership.js';
5
5
  import { type GraphNode } from './graphs.js';
6
6
  import { SessionStore } from './sessions.js';
7
7
  import { type SubagentProviderListing } from './subagent-run.js';
@@ -10,9 +10,9 @@ import { graphStorageDirectory } from './graph-account.js';
10
10
  import { GraphSync } from './graph-sync.js';
11
11
  import { stampGraphProviderProfiles } from './graph-provider-portability.js';
12
12
  import { getAuthStatus } from './auth/index.js';
13
- import { getMembership, PaidMembershipRequiredError } from './membership.js';
14
- import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_LIMIT_MESSAGE, FreeTierLimitError, readGraphQuota, saveFreeTierGraph } from './graph-quota.js';
15
- import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, optionalOutcomes, saveGraph, validateGraph, withoutDeletedGraphs } from './graphs.js';
13
+ import { getGraphMembership, PaidMembershipRequiredError } from './membership.js';
14
+ import { FREE_GRAPH_LIMIT_MESSAGE, FREE_LOCKED_GRAPH_MESSAGE, FreeTierLimitError, notePremiumGraphAccount, readGraphQuota, saveFreeTierGraph, savePremiumGraph } from './graph-quota.js';
15
+ import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, optionalOutcomes, validateGraph, withoutDeletedGraphs } from './graphs.js';
16
16
  import { getAgentSession, listAgentProjects, queryAgentSessions, scanAgentSessions, SessionQueryError } from './session-monitor.js';
17
17
  import { AutomationStore } from './automations.js';
18
18
  import { canonicalWorkspace, MAX_SUBAGENT_TASK_CHARS, SubagentInvalidArgumentError, SubagentProviderNotSetError, SubagentRunInProgressError, SubagentRunner, SubagentSelectionError } from './subagent-run.js';
@@ -67,7 +67,7 @@ export const GRAPH_AGENT_GUIDE = [
67
67
  'Ask the user in chat first; confirm must repeat the id. Every revision stays stored; the graph leaves listings and new runs refuse it.',
68
68
  'Sessions that already ran it keep resuming. andorra_graphs_list {includeDeleted:true} lists deleted graphs with deleted=true.',
69
69
  'andorra_graph_restore {id, expectedRevision} publishes the next revision without the marker.',
70
- 'A deleted graph still counts toward a free account\'s one custom graph, so a free account restores it rather than replacing it.',
70
+ 'A free account\'s own graph still counts as its one custom graph while deleted, so a free account restores it rather than replacing it. The other graphs a free account holds are view only: they can be read, but not edited, deleted or restored.',
71
71
  'DEFAULT_GRAPH: the bundled Default graph cannot be deleted.',
72
72
  '',
73
73
  '## Project visibility',
@@ -336,7 +336,7 @@ export class AgentMcpBackend {
336
336
  throw new AgentMcpError('AUTH_REQUIRED', 'Sign in to your Andorra Code account to edit graphs.');
337
337
  if (!/^[A-Za-z0-9-]{1,128}$/.test(before.subject))
338
338
  throw new AgentMcpError('AUTH_REQUIRED', 'The signed-in account has an invalid graph storage identity. Sign in again.');
339
- const membership = await (this.options.membershipStatus ?? getMembership)();
339
+ const membership = await (this.options.membershipStatus ?? getGraphMembership)();
340
340
  if (!membership.paid && !membership.subject)
341
341
  throw PaidMembershipRequiredError.for(membership);
342
342
  if (!membership.subject || membership.subject !== before.subject)
@@ -348,6 +348,8 @@ export class AgentMcpBackend {
348
348
  const confirmed = await authStatus();
349
349
  if (!confirmed.signedIn || confirmed.subject !== membership.subject)
350
350
  throw new AgentMcpError('AUTH_CHANGED', 'Account changed while opening graph storage. Retry graph access with the current account.');
351
+ if (membership.paid)
352
+ await notePremiumGraphAccount(directory);
351
353
  access = { directory, subject: membership.subject, free: !membership.paid };
352
354
  }
353
355
  const key = access.directory + '\0' + (access.subject ?? '');
@@ -462,7 +464,7 @@ export class AgentMcpBackend {
462
464
  const next = { ...latest, metadata };
463
465
  beforeSave?.();
464
466
  const saved = freshAccess.free ? await saveFreeTierGraph(next, latest.revision, access.directory)
465
- : await saveGraph(next, latest.revision, access.directory);
467
+ : await savePremiumGraph(next, latest.revision, access.directory);
466
468
  if (deleting)
467
469
  for (const [key, draft] of this.drafts)
468
470
  if (draft.graph.id === id && draft.directory === access.directory)
@@ -470,7 +472,7 @@ export class AgentMcpBackend {
470
472
  void this.sync?.sync();
471
473
  const note = 'Revision saved locally. Cloud synchronization may still be pending.';
472
474
  return deleting
473
- ? { id, revision: saved.revision, deletedAt, note: freshAccess.free ? note + ' A deleted graph still counts as this free account\'s one custom graph; restore it to use it again.' : note }
475
+ ? { id, revision: saved.revision, deletedAt, note: freshAccess.free ? note + ' This graph still counts as this free account\'s one custom graph while deleted; restore it to use it again.' : note }
474
476
  : { id, revision: saved.revision, note };
475
477
  }
476
478
  async readGraph(id, directory, revision) {
@@ -777,6 +779,8 @@ export class AgentMcpBackend {
777
779
  const latest = await this.readGraph(id, access.directory);
778
780
  if (isDeletedGraph(latest))
779
781
  throw new AgentMcpError('GRAPH_DELETED', 'Graph ' + id + ' is deleted. Restore it with andorra_graph_restore before editing it.');
782
+ if (access.free && (await readGraphQuota(access.directory, undefined, { adopt: true })).freeGraphId !== id)
783
+ throw new FreeTierLimitError(FREE_LOCKED_GRAPH_MESSAGE);
780
784
  graph = migrateGraphForEditor(latest, { addOrchestrator: !access.free });
781
785
  expectedRevision = graph.revision;
782
786
  }
@@ -792,7 +796,7 @@ export class AgentMcpBackend {
792
796
  if (error.code !== 'ENOENT')
793
797
  throw error;
794
798
  }
795
- if (access.free && (await readGraphQuota(access.directory)).customGraphs >= FREE_CUSTOM_GRAPH_LIMIT)
799
+ if (access.free && (await readGraphQuota(access.directory, undefined, { adopt: true })).freeGraphId !== undefined)
796
800
  throw new FreeTierLimitError(FREE_GRAPH_LIMIT_MESSAGE);
797
801
  graph = { schemaVersion: 3, id, name: nameValue, revision: 0, entry: '', nodes: {}, edges: [] };
798
802
  expectedRevision = null;
@@ -906,7 +910,7 @@ export class AgentMcpBackend {
906
910
  throw new AgentMcpError('VALIDATION_FAILED', 'Graph exceeds 512 KiB after portable provider identities are recorded.');
907
911
  beforeSave?.();
908
912
  const saved = finalAccess.free ? await saveFreeTierGraph(stamped, draft.expectedRevision, access.directory)
909
- : await saveGraph(stamped, draft.expectedRevision, access.directory);
913
+ : await savePremiumGraph(stamped, draft.expectedRevision, access.directory);
910
914
  await this.sync?.reviveGraph(saved.id);
911
915
  draft.graph = saved;
912
916
  draft.expectedRevision = saved.revision;
@@ -1,5 +1,5 @@
1
1
  export declare const APP_SERVER_PROTOCOL_VERSION = 2;
2
- 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.google", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.detectSignIns", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "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", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.codeIntel", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "browser.view.go", "config.browser", "config.webSearch", "background.tasks", "workspace.warm", "browser.cookies.firefox", "browser.extensions", "sessions.compact", "sessions.goal", "sessions.changes", "run.current", "sessions.jev", "providers.andorra", "graphs.visibility"];
2
+ 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.google", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.detectSignIns", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "run.resume.compact", "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", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "sessions.usage.hourly", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.codeIntel", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "sessions.pullRequest.details", "sessions.pullRequest.review", "sessions.pullRequest.review.teams", "sessions.pullRequest.merge", "sessions.pullRequest.create", "sessions.pullRequest.conversation", "sessions.pullRequest.suggestions", "sessions.pullRequest.checkLogs", "sessions.pullRequest.edit", "sessions.pullRequest.mergeQueue", "sessions.pullRequest.merge.bypass", "sessions.pullRequest.create.fork", "sessions.pullRequest.attach", "pullRequests.reviewRequests", "issues.list", "browser.view.go", "config.browser", "config.webSearch", "background.tasks", "workspace.warm", "browser.cookies.firefox", "browser.extensions", "sessions.compact", "sessions.goal", "sessions.changes", "run.current", "sessions.jev", "providers.andorra", "graphs.visibility"];
3
3
  export interface AppServerRequest {
4
4
  id: number | string;
5
5
  method: string;
@@ -238,6 +238,7 @@ export interface AppServerUsageAnalytics {
238
238
  unreadable: number;
239
239
  };
240
240
  filesScanned: number;
241
+ /** 1 is the rolling last 24 hours, whose `days` rows are UTC hours keyed "YYYY-MM-DDTHH"; otherwise UTC dates. */
241
242
  windowDays: number;
242
243
  }
243
244
  export interface AppServerFileDiffLine {
@@ -350,11 +351,13 @@ export interface AppServerRunSummary {
350
351
  task?: string;
351
352
  sessionId?: string;
352
353
  }
354
+ /** `locked` marks a graph a free account can view, export and duplicate but not change or run. */
353
355
  export interface AppServerGraphSummary {
354
356
  id: string;
355
357
  name: string;
356
358
  revision: number;
357
359
  preset: boolean;
360
+ locked?: boolean;
358
361
  updatedAt?: string;
359
362
  }
360
363
  export interface AppServerTreeEntry {
@@ -1,2 +1,2 @@
1
1
  export const APP_SERVER_PROTOCOL_VERSION = 2;
2
- 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.google', 'providers.opencode', 'providers.auth.submit', 'providers.opencodeGo', 'providers.discover.draft', 'providers.detectSignIns', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.resume.model', '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', 'mcp.edit', 'mcp.status', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.codeIntel', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'browser.view.go', 'config.browser', 'config.webSearch', 'background.tasks', 'workspace.warm', 'browser.cookies.firefox', 'browser.extensions', 'sessions.compact', 'sessions.goal', 'sessions.changes', 'run.current', 'sessions.jev', 'providers.andorra', 'graphs.visibility'];
2
+ 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.google', 'providers.opencode', 'providers.auth.submit', 'providers.opencodeGo', 'providers.discover.draft', 'providers.detectSignIns', 'providers.codexAuth', 'providers.codexAuth.logout', 'providers.codexAccounts', 'providers.anthropicConsole', 'run.resume.direction', 'run.resume.model', 'run.resume.compact', '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', 'mcp.edit', 'mcp.status', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'sessions.usage.hourly', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.codeIntel', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', 'sessions.pullRequest.details', 'sessions.pullRequest.review', 'sessions.pullRequest.review.teams', 'sessions.pullRequest.merge', 'sessions.pullRequest.create', 'sessions.pullRequest.conversation', 'sessions.pullRequest.suggestions', 'sessions.pullRequest.checkLogs', 'sessions.pullRequest.edit', 'sessions.pullRequest.mergeQueue', 'sessions.pullRequest.merge.bypass', 'sessions.pullRequest.create.fork', 'sessions.pullRequest.attach', 'pullRequests.reviewRequests', 'issues.list', 'browser.view.go', 'config.browser', 'config.webSearch', 'background.tasks', 'workspace.warm', 'browser.cookies.firefox', 'browser.extensions', 'sessions.compact', 'sessions.goal', 'sessions.changes', 'run.current', 'sessions.jev', 'providers.andorra', 'graphs.visibility'];
@@ -9,6 +9,7 @@ import type { CliSignIn } from './cli-sign-in.js';
9
9
  import { checkGraphModelHealth } from './graph-health.js';
10
10
  import { loadAccessibleGraph } from './membership.js';
11
11
  import { type SavedSession } from './sessions.js';
12
+ import { type GitRunner } from './pull-request-create.js';
12
13
  import { type GhRunner } from './pull-requests.js';
13
14
  import { type Completion, type RunResult } from './runtime.js';
14
15
  import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
@@ -44,6 +45,8 @@ export interface AppServerOptions {
44
45
  };
45
46
  signInProbes?: Partial<SignInProbes>;
46
47
  gh?: GhRunner;
48
+ /** The git a task's folder answers to, for opening a pull request from it (tests pass a fake). */
49
+ git?: (folder: string) => GitRunner;
47
50
  pullRequestPollMs?: number;
48
51
  hostedCheck?: HostedMonitorOptions['check'];
49
52
  hostedNow?: () => number;
@@ -72,9 +75,13 @@ export declare class AppServer {
72
75
  private readonly detectedSignIns;
73
76
  private readonly retireCodexAccount;
74
77
  private readonly gh;
78
+ private readonly git;
75
79
  private readonly pullRequestWatcher;
80
+ private readonly pullRequestReader;
76
81
  private readonly sessionChanges;
77
82
  private readonly autoFixWakes;
83
+ /** Wakes the PR tab's Fix with Agent armed: delivered as the person's request, not as a timer. */
84
+ private readonly fixWakes;
78
85
  private readonly reviewWaiters;
79
86
  private readonly reviewWaitsStarting;
80
87
  private readonly graphSync;
@@ -339,6 +346,106 @@ export declare class AppServer {
339
346
  private attachPullRequest;
340
347
  private updatePullRequest;
341
348
  private dismissPullRequest;
349
+ /**
350
+ * The PR tab's read of a task's pull request: branches, author, mergeability, description, commits,
351
+ * checks and reviews, through the account that can read it. Answers come from a short cache (see
352
+ * PullRequestReader); a failed read keeps the last good answer and says why it is not current.
353
+ */
354
+ private pullRequestDetails;
355
+ private pullRequestFiles;
356
+ private storedPullRequest;
357
+ /**
358
+ * The task's pull request for a write. `url`, when the tab sends it, is the PR the person looked at;
359
+ * a write for a PR the task no longer has is refused rather than applied to its new one.
360
+ */
361
+ private pullRequestToWrite;
362
+ /** The PR tab's review state: unresolved and resolved threads, which files the person viewed, and who is asked to review. */
363
+ private pullRequestReview;
364
+ /** A write's answer, with the review state read again at once so the tab shows what GitHub now holds. */
365
+ private afterReviewWrite;
366
+ /** Posts a review (comment, approve or request changes) with its line comments, as the account the person confirmed. */
367
+ private submitPullRequestReview;
368
+ /** Replies to a review thread, or resolves or reopens it. */
369
+ private pullRequestThread;
370
+ /** Marks a file viewed or not viewed for the person, as on github.com. Nobody is notified, so the state is not read again. */
371
+ private markPullRequestFileViewed;
372
+ /** Re-runs the failed jobs of GitHub Actions runs behind this PR's failed checks, as read last. */
373
+ private rerunPullRequestChecks;
374
+ /** Asks people to review the PR, or withdraws requests. */
375
+ private requestPullRequestReviewers;
376
+ /** Puts what a merge-side write changed on the stored record at once, so the sidebar and the tab show it; the watcher then confirms it. */
377
+ private recordPullRequestChange;
378
+ /** A merge-side write's answer, with the merge state read again so the tab shows what GitHub now holds. */
379
+ private afterMergeWrite;
380
+ /**
381
+ * Merges the task's PR now, or sets it to merge when ready (GitHub's auto-merge), with the method and
382
+ * commit message the person chose, at the head commit they read. Deleting the head branch afterwards
383
+ * is said separately: the merge has happened even when that fails.
384
+ */
385
+ private mergeSessionPullRequest;
386
+ /** Brings the PR's branch up to date with its base on GitHub (GitHub's "Update branch"), by a merge commit or a rebase. */
387
+ private updateSessionPullRequestBranch;
388
+ /** Marks a draft ready for review (GitHub then asks its reviewers), or converts the PR back to a draft. */
389
+ private readySessionPullRequest;
390
+ /**
391
+ * What Create Pull Request would open from the task's folder: its branch, commits and repository, the
392
+ * account that can push, and a drafted title and body; or why there is nothing to open (`blocked`).
393
+ */
394
+ private sessionPullRequestDraft;
395
+ /**
396
+ * Opens a pull request from the task's folder as the account the person confirmed, pushing the branch
397
+ * first when GitHub lacks it, and attaches it to the task (or attaches the one already open for the
398
+ * branch, with `attach`). The watcher then follows it like any other.
399
+ */
400
+ private createSessionPullRequest;
401
+ /** Where a comment the tab may change sits in the review read: a timeline comment, a review's text, or a comment in a thread. */
402
+ private static commentIn;
403
+ /** Posts a comment on the PR's conversation, or edits or deletes one of the person's comments. */
404
+ private pullRequestComment;
405
+ /** Adds or takes back one of GitHub's reactions on the PR, a comment or a review. Nobody is notified, so it acts at once. */
406
+ private pullRequestReact;
407
+ /**
408
+ * Commits a reviewer's suggestion to the PR's branch on GitHub, as GitHub's "Commit suggestion" does,
409
+ * at the head the person read (GitHub refuses when the file changed since). The task's folder is then
410
+ * brought up to the new commit when it sits on that branch at the old head; otherwise the answer says
411
+ * it is behind.
412
+ */
413
+ private applyPullRequestSuggestion;
414
+ /**
415
+ * Brings the task's folder up to a commit made on GitHub from the tab, when the folder sits on that
416
+ * branch at the commit before it: a fetch as the confirmed account and a fast-forward, never a merge
417
+ * of anything else. `behind` when it cannot (other commits, or local changes in the way).
418
+ */
419
+ private catchUpFolder;
420
+ /** An excerpt of a failed GitHub Actions job's log, for a check of this PR's head. */
421
+ private pullRequestCheckLog;
422
+ /**
423
+ * Hands the PR's failed checks to the task's agent ("Fix with Agent"): a prompt naming them and how to
424
+ * read their logs, delivered like a self-wake (into the running turn, or as the next one). The checks
425
+ * come from the engine's own read, never from text the tab sends.
426
+ */
427
+ private fixPullRequestChecks;
428
+ /** Changes the PR's title, description, labels or assignees, as the account the person confirmed. */
429
+ private editSessionPullRequest;
430
+ /** Closes the PR (with a comment first, when the person wrote one) or reopens it. Its branch stays. */
431
+ private setSessionPullRequestState;
432
+ /** Takes the PR out of its base's merge queue. */
433
+ private dequeueSessionPullRequest;
434
+ /** Attaches a GitHub pull request to a task (Review Requests' "Review in New Task"); the watcher then follows it. */
435
+ private attachSessionPullRequest;
436
+ private reviewRequestsRead;
437
+ /**
438
+ * The open pull requests that ask a signed-in account for its review, each with the task it is attached
439
+ * to, if one. Read at most once a minute (a refresh: every 5 seconds), backed off on a rate limit.
440
+ */
441
+ private pullRequestReviewRequests;
442
+ /** The open issues of a project folder's GitHub repository (its `origin`), to start a task from one. */
443
+ private listWorkspaceIssues;
444
+ /**
445
+ * Keeps the sidebar's checks mark in step with what the tab just read from GitHub (never a cached
446
+ * answer), and asks the watcher to catch up on a state it has not seen.
447
+ */
448
+ private syncPullRequestRecord;
342
449
  private cancelAutoFixWake;
343
450
  private pullRequestControl;
344
451
  private wakeForPullRequest;