@andorra-labs/code 0.1.4 → 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.
- package/dist/src/account-presentation.js +3 -3
- package/dist/src/agent-execution.d.ts +2 -0
- package/dist/src/agent-execution.js +126 -20
- package/dist/src/agent-mcp.d.ts +18 -1
- package/dist/src/agent-mcp.js +103 -8
- package/dist/src/app-server/protocol.d.ts +33 -3
- package/dist/src/app-server/protocol.js +14 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +7 -1
- package/dist/src/app-server.d.ts +115 -41
- package/dist/src/app-server.js +1229 -219
- package/dist/src/automation-runner.d.ts +9 -0
- package/dist/src/automation-runner.js +22 -1
- package/dist/src/automation-tool.js +8 -1
- package/dist/src/automations.js +1 -1
- package/dist/src/browser-captcha-tool.d.ts +54 -0
- package/dist/src/browser-captcha-tool.js +374 -0
- package/dist/src/browser-panel-tool.d.ts +7 -0
- package/dist/src/browser-panel-tool.js +74 -3
- package/dist/src/browser-runner.js +19 -4
- package/dist/src/browser-server.js +21 -1
- package/dist/src/browser-session.d.ts +16 -0
- package/dist/src/browser-session.js +35 -0
- package/dist/src/browser-ui/app.js +193 -3
- package/dist/src/browser-ui/style.css +15 -1
- package/dist/src/browser-view.d.ts +72 -4
- package/dist/src/browser-view.js +229 -17
- package/dist/src/capabilities.js +13 -2
- package/dist/src/capsolver.d.ts +60 -0
- package/dist/src/capsolver.js +101 -0
- package/dist/src/claude-provider.d.ts +6 -0
- package/dist/src/claude-provider.js +34 -3
- package/dist/src/cli-executable.d.ts +33 -0
- package/dist/src/cli-executable.js +64 -0
- package/dist/src/cli-process.d.ts +47 -0
- package/dist/src/cli-process.js +113 -0
- package/dist/src/cli-sign-in.d.ts +68 -0
- package/dist/src/cli-sign-in.js +224 -0
- package/dist/src/cli.js +54 -23
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
- package/dist/src/coding-tools.js +44 -5
- package/dist/src/command-output-tap.d.ts +16 -0
- package/dist/src/command-output-tap.js +45 -0
- package/dist/src/command-screens.js +3 -3
- package/dist/src/commands.d.ts +10 -1
- package/dist/src/commands.js +7 -7
- package/dist/src/completion.d.ts +23 -5
- package/dist/src/completion.js +334 -17
- package/dist/src/config.d.ts +13 -0
- package/dist/src/config.js +28 -2
- package/dist/src/deadline.js +6 -0
- package/dist/src/extensions.d.ts +1 -0
- package/dist/src/extensions.js +16 -3
- package/dist/src/graph-provider-portability.js +2 -2
- package/dist/src/graph-quota.d.ts +1 -1
- package/dist/src/graph-quota.js +1 -1
- package/dist/src/graph-runner.js +35 -21
- package/dist/src/graph-selection.d.ts +6 -0
- package/dist/src/graph-selection.js +10 -0
- package/dist/src/graph-server.d.ts +7 -0
- package/dist/src/graph-server.js +61 -3
- package/dist/src/graph-sync.d.ts +50 -0
- package/dist/src/graph-sync.js +383 -12
- package/dist/src/graph-ui/app.js +61 -8
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/skill-picker.js +242 -0
- package/dist/src/graph-ui/style.css +19 -0
- package/dist/src/graphs.d.ts +46 -4
- package/dist/src/graphs.js +152 -27
- package/dist/src/grok-provider.d.ts +50 -0
- package/dist/src/grok-provider.js +186 -0
- package/dist/src/handoffs.d.ts +13 -0
- package/dist/src/handoffs.js +31 -1
- package/dist/src/managed-sign-in.d.ts +38 -0
- package/dist/src/managed-sign-in.js +169 -0
- package/dist/src/markdown.d.ts +5 -0
- package/dist/src/markdown.js +5 -2
- package/dist/src/mcp.js +11 -0
- package/dist/src/membership.d.ts +8 -1
- package/dist/src/membership.js +15 -5
- package/dist/src/model-metadata.js +14 -2
- package/dist/src/model-override.d.ts +10 -0
- package/dist/src/model-override.js +20 -0
- package/dist/src/opencode-cli-provider.d.ts +122 -0
- package/dist/src/opencode-cli-provider.js +415 -0
- package/dist/src/opencode-provider.js +23 -8
- package/dist/src/palette.d.ts +2 -0
- package/dist/src/palette.js +2 -0
- package/dist/src/permissions.d.ts +19 -1
- package/dist/src/permissions.js +30 -1
- package/dist/src/powershell-pool.d.ts +2 -2
- package/dist/src/powershell-pool.js +18 -5
- package/dist/src/provider-connection.js +36 -0
- package/dist/src/provider-engine.d.ts +2 -1
- package/dist/src/provider-engine.js +64 -13
- package/dist/src/provider-import.js +6 -1
- package/dist/src/provider-settings.js +22 -3
- package/dist/src/providers.d.ts +12 -1
- package/dist/src/providers.js +27 -8
- package/dist/src/pull-requests.d.ts +111 -17
- package/dist/src/pull-requests.js +308 -76
- package/dist/src/qa/qa-authorize.js +9 -1
- package/dist/src/react-runtime.js +76 -5
- package/dist/src/remote/engine-pool.js +1 -1
- package/dist/src/run-progress.js +6 -1
- package/dist/src/run-records.d.ts +133 -27
- package/dist/src/run-records.js +320 -40
- package/dist/src/runtime.d.ts +38 -1
- package/dist/src/runtime.js +27 -4
- package/dist/src/save-lock.d.ts +11 -0
- package/dist/src/save-lock.js +29 -2
- package/dist/src/sessions.js +4 -1
- package/dist/src/shell.js +4 -1
- package/dist/src/side-panel.d.ts +1 -1
- package/dist/src/side-panel.js +1 -1
- package/dist/src/skill-commands.d.ts +2 -0
- package/dist/src/skill-commands.js +2 -0
- package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
- package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
- package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +97 -0
- package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
- package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
- package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
- package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
- package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
- package/dist/src/skills/bundled/provenance.json +50 -0
- package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
- package/dist/src/skills/invocable-skills.d.ts +41 -0
- package/dist/src/skills/invocable-skills.js +49 -0
- package/dist/src/skills/prompt-skills.d.ts +1 -0
- package/dist/src/skills/prompt-skills.js +33 -0
- package/dist/src/skills/runtime-skills.d.ts +4 -0
- package/dist/src/skills/runtime-skills.js +21 -0
- package/dist/src/structured-step.d.ts +55 -0
- package/dist/src/structured-step.js +85 -0
- package/dist/src/subagent-run.d.ts +1 -1
- package/dist/src/subagent-run.js +29 -33
- package/dist/src/telemetry/schema.d.ts +2 -2
- package/dist/src/telemetry/schema.js +3 -2
- package/dist/src/terminal-ui.d.ts +29 -0
- package/dist/src/terminal-ui.js +112 -28
- package/dist/src/timers.d.ts +21 -2
- package/dist/src/timers.js +12 -4
- package/dist/src/tool-names.d.ts +18 -0
- package/dist/src/tool-names.js +26 -0
- package/dist/src/tools.js +45 -11
- package/dist/src/trajectory.js +32 -12
- package/dist/src/types.d.ts +23 -0
- package/dist/src/update.d.ts +26 -16
- package/dist/src/update.js +232 -275
- package/docs/agents/install-for-agents.md +15 -24
- package/docs/agents/mcp-server.md +13 -1
- package/docs/agents/subagent-mode.md +7 -4
- package/docs/concepts/security.md +2 -0
- package/docs/getting-started/README.md +14 -6
- package/docs/getting-started/configure-providers.md +29 -2
- package/docs/guides/README.md +1 -1
- package/docs/guides/browser.md +12 -0
- package/docs/guides/desktop-app.md +45 -9
- package/docs/guides/graph-builder.md +8 -0
- package/docs/guides/update.md +37 -16
- package/docs/reference/cli.md +1 -1
- package/docs/reference/config.md +2 -2
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
- package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
- package/package.json +1 -1
- package/tests/permissions-test-plan.md +2 -1
package/dist/src/providers.js
CHANGED
|
@@ -3,9 +3,25 @@ import { COMPLETION_TOOL } from './completion.js';
|
|
|
3
3
|
import { createCodexAdapter } from './codex-provider.js';
|
|
4
4
|
import { createClaudeAdapter } from './claude-provider.js';
|
|
5
5
|
import { createOpenCodeAdapter } from './opencode-provider.js';
|
|
6
|
+
import { createGrokAdapter } from './grok-provider.js';
|
|
7
|
+
import { createOpenCodeCliAdapter } from './opencode-cli-provider.js';
|
|
6
8
|
import { providerAuthHeaders } from './anthropic-credentials.js';
|
|
7
9
|
import { generateEngineResponse, isEngineContextOverflow } from './provider-engine.js';
|
|
8
10
|
export const REASONING_EFFORTS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
11
|
+
/** Every provider type a configuration may name. */
|
|
12
|
+
export const PROVIDER_TYPES = ['openai-compatible', 'anthropic', 'codex', 'claude', 'opencode-go', 'grok', 'opencode'];
|
|
13
|
+
/**
|
|
14
|
+
* Types that run through a vendor CLI's own sign-in on this machine instead of a key Andorra holds.
|
|
15
|
+
*
|
|
16
|
+
* They carry no credential fields, use a fixed marker base URL, and bound each request themselves,
|
|
17
|
+
* so configuration rejects key and timeout overrides on them rather than silently ignoring them.
|
|
18
|
+
*/
|
|
19
|
+
export const SIGN_IN_PROVIDER_TYPES = ['codex', 'claude', 'grok', 'opencode'];
|
|
20
|
+
export function isSignInProviderType(type) {
|
|
21
|
+
return SIGN_IN_PROVIDER_TYPES.includes(type);
|
|
22
|
+
}
|
|
23
|
+
/** The product name messages use for a sign-in type. */
|
|
24
|
+
const SIGN_IN_PRODUCT = { codex: 'Codex', claude: 'Claude', grok: 'Grok', opencode: 'OpenCode' };
|
|
9
25
|
/**
|
|
10
26
|
* Inactivity bound for inference, and wall-clock bound for other HTTP requests,
|
|
11
27
|
* in milliseconds, when a provider does not configure its own.
|
|
@@ -42,10 +58,8 @@ export function assertRequestTimeout(provider) {
|
|
|
42
58
|
const value = provider.requestTimeoutMs;
|
|
43
59
|
if (value === undefined)
|
|
44
60
|
return;
|
|
45
|
-
if (provider.type
|
|
46
|
-
throw new Error(
|
|
47
|
-
if (provider.type === 'claude')
|
|
48
|
-
throw new Error('Claude providers bound each request at ten minutes; requestTimeoutMs is not supported');
|
|
61
|
+
if (isSignInProviderType(provider.type))
|
|
62
|
+
throw new Error(`${SIGN_IN_PRODUCT[provider.type]} providers bound each request at ten minutes; requestTimeoutMs is not supported`);
|
|
49
63
|
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value > MAX_REQUEST_TIMEOUT_MS) {
|
|
50
64
|
throw new Error(`Provider requestTimeoutMs must be 0 (no timeout) or an integer of milliseconds up to ${MAX_REQUEST_TIMEOUT_MS}`);
|
|
51
65
|
}
|
|
@@ -64,10 +78,8 @@ export function assertStreamIdleTimeout(provider) {
|
|
|
64
78
|
const value = provider.streamIdleTimeoutMs;
|
|
65
79
|
if (value === undefined)
|
|
66
80
|
return;
|
|
67
|
-
if (provider.type
|
|
68
|
-
throw new Error(
|
|
69
|
-
if (provider.type === 'claude')
|
|
70
|
-
throw new Error('Claude providers bound each request at ten minutes; streamIdleTimeoutMs is not supported');
|
|
81
|
+
if (isSignInProviderType(provider.type))
|
|
82
|
+
throw new Error(`${SIGN_IN_PRODUCT[provider.type]} providers bound each request at ten minutes; streamIdleTimeoutMs is not supported`);
|
|
71
83
|
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value > MAX_REQUEST_TIMEOUT_MS) {
|
|
72
84
|
throw new Error(`Provider streamIdleTimeoutMs must be 0 (no bound) or an integer of milliseconds up to ${MAX_REQUEST_TIMEOUT_MS}`);
|
|
73
85
|
}
|
|
@@ -255,6 +267,9 @@ export function assertProviderCredentials(provider) {
|
|
|
255
267
|
if (provider.type === 'claude' && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
256
268
|
throw new Error('Claude providers use Claude Code sign-in; API key overrides are not supported.');
|
|
257
269
|
}
|
|
270
|
+
if ((provider.type === 'grok' || provider.type === 'opencode') && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
271
|
+
throw new Error(`${SIGN_IN_PRODUCT[provider.type]} providers use their CLI sign-in; API key overrides are not supported.`);
|
|
272
|
+
}
|
|
258
273
|
if (provider.apiKey !== undefined && (typeof provider.apiKey !== 'string' || !/^[\x21-\x7e]+$/.test(provider.apiKey))) {
|
|
259
274
|
throw new Error('API key must be nonempty and contain no whitespace or control characters.');
|
|
260
275
|
}
|
|
@@ -836,6 +851,10 @@ export function createAdapter(config) {
|
|
|
836
851
|
return createCodexAdapter(config);
|
|
837
852
|
if (config.type === 'claude')
|
|
838
853
|
return createClaudeAdapter(config);
|
|
854
|
+
if (config.type === 'grok')
|
|
855
|
+
return createGrokAdapter(config);
|
|
856
|
+
if (config.type === 'opencode')
|
|
857
|
+
return createOpenCodeCliAdapter(config);
|
|
839
858
|
if (config.type === 'opencode-go')
|
|
840
859
|
return createOpenCodeAdapter(config);
|
|
841
860
|
let base;
|
|
@@ -13,9 +13,9 @@ export interface SessionPullRequest {
|
|
|
13
13
|
number: number;
|
|
14
14
|
title?: string;
|
|
15
15
|
state: PullRequestState;
|
|
16
|
+
/** Wake the session when review comments arrive. Never on for a merged or closed PR: it switches itself off. */
|
|
16
17
|
autoFix: boolean;
|
|
17
18
|
mergeWhenReady: boolean;
|
|
18
|
-
autoArchive: boolean;
|
|
19
19
|
/** When the PR was attached: a top-level comment older than this was never the session's to answer. */
|
|
20
20
|
attachedAt: string;
|
|
21
21
|
/** The newest review comment Auto-fix has already handed to the agent. */
|
|
@@ -30,16 +30,24 @@ export interface SessionPullRequest {
|
|
|
30
30
|
};
|
|
31
31
|
/** The selections of the run that attached or last configured the PR, so an Auto-fix run continues under them. */
|
|
32
32
|
carry?: WakeCarry;
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/** The signed-in `gh` account that can read this PR; every call for it runs as this account. */
|
|
34
|
+
ghUser?: string;
|
|
35
|
+
/** Why the watcher last could not read this PR; cleared by the next successful read. */
|
|
36
|
+
watchError?: string;
|
|
35
37
|
updatedAt: string;
|
|
36
38
|
}
|
|
37
39
|
export type PullRequestState = 'open' | 'draft' | 'merged' | 'closed';
|
|
40
|
+
/** Whether GitHub is done with the PR: once merged or closed there is nothing left to fix, merge or convert. */
|
|
41
|
+
export declare const isFinishedPullRequest: (state: PullRequestState) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A merged or closed PR with Auto-fix switched off and its pending wake forgotten: there is nothing left to fix, so
|
|
44
|
+
* the setting stops on its own instead of staying on for a PR that can no longer change. An open PR is unchanged.
|
|
45
|
+
*/
|
|
46
|
+
export declare function settleFinishedPullRequest(pullRequest: SessionPullRequest): SessionPullRequest;
|
|
38
47
|
/** The settings a caller may change; `draft` converts the PR to a draft or marks it ready. */
|
|
39
48
|
export interface PullRequestSettings {
|
|
40
49
|
autoFix?: boolean;
|
|
41
50
|
mergeWhenReady?: boolean;
|
|
42
|
-
autoArchive?: boolean;
|
|
43
51
|
draft?: boolean;
|
|
44
52
|
}
|
|
45
53
|
export interface PullRequestRef {
|
|
@@ -62,15 +70,71 @@ export declare function listPullRequests(home: string): Promise<{
|
|
|
62
70
|
pullRequest: SessionPullRequest;
|
|
63
71
|
}[]>;
|
|
64
72
|
export declare function withPullRequest<T>(home: string, sessionId: string, work: () => Promise<T>): Promise<T>;
|
|
65
|
-
/**
|
|
66
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Runs `gh` with the given arguments and resolves to its stdout; a nonzero exit rejects with its stderr.
|
|
75
|
+
* With `user`, the command runs as that signed-in account, whichever one `gh` has active.
|
|
76
|
+
*/
|
|
77
|
+
export type GhRunner = (args: readonly string[], options?: {
|
|
78
|
+
user?: string;
|
|
79
|
+
}) => Promise<string>;
|
|
80
|
+
/** Runs one `gh` command in the given environment and resolves to its stdout. */
|
|
81
|
+
export type GhExec = (args: readonly string[], env: NodeJS.ProcessEnv) => Promise<string>;
|
|
82
|
+
export declare function createGhRunner(exec?: GhExec): GhRunner;
|
|
67
83
|
export declare const runGh: GhRunner;
|
|
68
|
-
/** The PR's title, state and auto-merge as GitHub reports them
|
|
69
|
-
export
|
|
84
|
+
/** The PR's title, state and auto-merge as GitHub reports them. */
|
|
85
|
+
export interface PullRequestView {
|
|
70
86
|
title: string;
|
|
71
87
|
state: PullRequestState;
|
|
72
88
|
autoMerge: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** The PR's title, state and auto-merge as GitHub reports them now, read as `user` when given. */
|
|
91
|
+
export declare function viewPullRequest(gh: GhRunner, url: string, user?: string): Promise<PullRequestView>;
|
|
92
|
+
/** The signed-in github.com accounts `gh` can use, the active one first. */
|
|
93
|
+
export declare function ghAccounts(gh: GhRunner): Promise<string[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Whether a `gh` failure says the account cannot see the PR (or has no usable token, including a saved account that
|
|
96
|
+
* was signed out), rather than an outage. A rate limit answers 403 too, but it is an outage: the account may well
|
|
97
|
+
* see the PR once the limit lifts.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isGhAccessError(error: unknown): boolean;
|
|
100
|
+
/** Whether a `gh auth status` failure means this `gh` cannot list accounts at all (an older gh without `--json`). */
|
|
101
|
+
export declare function isGhListingUnsupported(error: unknown): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The first signed-in account that can read the PR, with what it read; `undefined` when none can, or when `gh`
|
|
104
|
+
* cannot list accounts at all (an older gh). The active account is tried first, so a PR it can read never switches
|
|
105
|
+
* accounts. A failure that is not about access (an outage, including a listing that fails for any other reason or
|
|
106
|
+
* answers something that is not JSON) is thrown: it does not mean nobody can read the PR. `undefined` means either
|
|
107
|
+
* nobody can read it or `gh` cannot list accounts, so callers that must tell those apart use
|
|
108
|
+
* `readPullRequestAsAnyAccount`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function findPullRequestAccount(gh: GhRunner, url: string): Promise<{
|
|
111
|
+
user: string;
|
|
112
|
+
seen: PullRequestView;
|
|
113
|
+
} | undefined>;
|
|
114
|
+
/**
|
|
115
|
+
* Read a PR as whichever signed-in account can see it: when a PR is attached, and when the watcher must detect the
|
|
116
|
+
* account again. `ghUser` names the account that read it whenever `gh` can list accounts; without a list the
|
|
117
|
+
* environment's account is asked. Callers record "no account can read it" ONLY on `unreadable`, which means every
|
|
118
|
+
* listed account (or, without a list, the environment's) was refused. A result with only `failed` is an outage (the
|
|
119
|
+
* error that stopped the detection), or a `gh` that cannot list accounts and whose environment read also failed for
|
|
120
|
+
* a reason other than access; the PR is then tracked as open until the watcher reads it.
|
|
121
|
+
*/
|
|
122
|
+
export declare function readPullRequestAsAnyAccount(gh: GhRunner, url: string): Promise<{
|
|
123
|
+
seen?: PullRequestView;
|
|
124
|
+
ghUser?: string;
|
|
125
|
+
unreadable?: true;
|
|
126
|
+
failed?: unknown;
|
|
73
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* `gh` bound to the account saved on the record, or the active account when none is saved. The bound runner must
|
|
130
|
+
* never be passed to `ghAccounts` or `findPullRequestAccount`: with a token injected, `gh auth status` reports
|
|
131
|
+
* only that token's account.
|
|
132
|
+
*/
|
|
133
|
+
export declare function ghFor(gh: GhRunner, pullRequest: {
|
|
134
|
+
ghUser?: string;
|
|
135
|
+
}): GhRunner;
|
|
136
|
+
/** What the Pull request row says when no signed-in account can read the PR. */
|
|
137
|
+
export declare const noAccountMessage: (url: string) => string;
|
|
74
138
|
/** A freshly attached PR with every setting off. */
|
|
75
139
|
export declare function newPullRequest(ref: PullRequestRef, now?: Date): SessionPullRequest;
|
|
76
140
|
/**
|
|
@@ -85,6 +149,16 @@ export declare function newPullRequest(ref: PullRequestRef, now?: Date): Session
|
|
|
85
149
|
* that was skipped because the stored flag already said "off" would leave the PR merging against the user's word.
|
|
86
150
|
*/
|
|
87
151
|
export declare function applyPullRequestSettings(gh: GhRunner, current: SessionPullRequest, changes: PullRequestSettings, now?: Date): Promise<SessionPullRequest>;
|
|
152
|
+
/**
|
|
153
|
+
* Apply settings as the record's account, and when that account can no longer see the PR (signed out, access
|
|
154
|
+
* removed), find one that can, keep it on the result, and apply once more. The watcher only re-detects the PRs it
|
|
155
|
+
* polls, so this is how a menu change recovers for a PR with Auto-fix off. Any other failure, or
|
|
156
|
+
* a re-detection that finds the same account or nobody, throws the original error; an outage while re-detecting is
|
|
157
|
+
* named as such, with the access error as its cause. The retry cannot apply a GitHub-side change twice, because
|
|
158
|
+
* `applyPullRequestSettings` re-decides each change against a fresh `pr view`, so a step that succeeded before the
|
|
159
|
+
* access error is skipped on the second attempt.
|
|
160
|
+
*/
|
|
161
|
+
export declare function applyPullRequestSettingsAsReadableAccount(gh: GhRunner, current: SessionPullRequest, changes: PullRequestSettings, now?: Date): Promise<SessionPullRequest>;
|
|
88
162
|
/** A session's pull request as its run's `pull_request` tool reaches it; bound to that session by the engine. */
|
|
89
163
|
export interface PullRequestControl {
|
|
90
164
|
status(): Promise<SessionPullRequest | undefined>;
|
|
@@ -122,6 +196,8 @@ export declare function newReviewComments(gh: GhRunner, pullRequest: SessionPull
|
|
|
122
196
|
/**
|
|
123
197
|
* The prompt Auto-fix delivers. It names the PR and how much is new, never the comments themselves: their text
|
|
124
198
|
* is third-party content, and the agent reads it through `gh` as tool output rather than as the user's words.
|
|
199
|
+
* When the PR is read as a saved account, the prompt names it (the engine's own record, not third-party text) and
|
|
200
|
+
* says how to run `gh` as it: the agent's shell runs as the active keyring account, which may not see the PR.
|
|
125
201
|
*/
|
|
126
202
|
export declare function autoFixPrompt(pullRequest: SessionPullRequest, found: {
|
|
127
203
|
threads: number;
|
|
@@ -148,8 +224,6 @@ export interface PullRequestWatcherOptions {
|
|
|
148
224
|
intervalMs?: number;
|
|
149
225
|
/** A PR's stored state changed. */
|
|
150
226
|
onUpdated: (sessionId: string, pullRequest: SessionPullRequest) => void;
|
|
151
|
-
/** File the session away; `false` (a run is active) or a rejection is retried on the next poll. */
|
|
152
|
-
archive: (sessionId: string) => Promise<boolean>;
|
|
153
227
|
/** Arm an Auto-fix prompt for the session, continuing under `carry`; returns the wake's id. */
|
|
154
228
|
wake: (sessionId: string, prompt: string, carry: WakeCarry | undefined) => string;
|
|
155
229
|
/** Whether this engine still holds the wake `id`, armed and not yet delivered. */
|
|
@@ -158,10 +232,13 @@ export interface PullRequestWatcherOptions {
|
|
|
158
232
|
/** Overridable for tests; defaults to the home's exclusive watcher lease. */
|
|
159
233
|
claim?: () => Promise<boolean>;
|
|
160
234
|
}
|
|
161
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* Whether a PR still needs the watcher: an unfinished PR until GitHub calls it finished, so the card's state chip
|
|
237
|
+
* never goes stale. A merged or closed PR never does.
|
|
238
|
+
*/
|
|
162
239
|
export declare function pullRequestNeedsWatch(pullRequest: SessionPullRequest): boolean;
|
|
163
240
|
/**
|
|
164
|
-
* Polls
|
|
241
|
+
* Polls every unfinished PR, and wakes the agent for new review comments on the ones with Auto-fix on.
|
|
165
242
|
*
|
|
166
243
|
* The timer is unref'd and every poll is serialized: a slow `gh` never stacks a second poll on the first.
|
|
167
244
|
*/
|
|
@@ -177,15 +254,32 @@ export declare class PullRequestWatcher {
|
|
|
177
254
|
/** One pass over every watched PR. Public so a test (or a just-changed setting) can run one now. */
|
|
178
255
|
poll(): Promise<void>;
|
|
179
256
|
private pass;
|
|
257
|
+
/**
|
|
258
|
+
* The PR as GitHub reports it, read as the record's account (the active one when none is saved). An account that
|
|
259
|
+
* cannot see it is replaced by one that can (`account`: the login to save, or `null` to clear a stale one when only
|
|
260
|
+
* the environment's account could read it; absent: no change). When no signed-in account can, the record says so,
|
|
261
|
+
* once, and this poll skips the PR. Any other failure (an outage, a rate limit) is thrown to the pass, which logs it.
|
|
262
|
+
*/
|
|
263
|
+
private read;
|
|
180
264
|
private check;
|
|
181
265
|
}
|
|
182
266
|
/**
|
|
183
|
-
* Whether an Auto-fix wake should
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
267
|
+
* Whether an Auto-fix wake should be delivered now, decided at delivery rather than at arming, with GitHub asked
|
|
268
|
+
* first.
|
|
269
|
+
*
|
|
270
|
+
* The PR can be dismissed, replaced or switched off while the wake waits out a busy engine, from this engine or
|
|
271
|
+
* another, and a prompt telling the agent to fix and push must not outlive the user's word that it should stop. Nor
|
|
272
|
+
* is the record's state enough: a PR merged or closed by hand on GitHub is only seen at the watcher's next poll, so
|
|
273
|
+
* GitHub is read every time instead of trusting the record.
|
|
274
|
+
*
|
|
275
|
+
* `deliver` is true only when the PR is open on GitHub and the record still asks for this wake. A finished PR is
|
|
276
|
+
* saved as GitHub reports it, with Auto-fix switched off, and returned as `pullRequest` for the caller to publish.
|
|
277
|
+
* A failed read throws: the caller keeps the wake and asks again later rather than sending it unconfirmed.
|
|
187
278
|
*/
|
|
188
|
-
export declare function
|
|
279
|
+
export declare function confirmAutoFixWake(home: string, gh: GhRunner, sessionId: string, wakeId: string): Promise<{
|
|
280
|
+
deliver: boolean;
|
|
281
|
+
pullRequest?: SessionPullRequest;
|
|
282
|
+
}>;
|
|
189
283
|
/** Forget the pending Auto-fix wake on a record that keeps the PR (Auto-fix switched off). */
|
|
190
284
|
export declare function withoutPendingFix(pullRequest: SessionPullRequest): SessionPullRequest;
|
|
191
285
|
/**
|