@andorra-labs/code 0.1.17 → 0.1.19
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-jev-savings.d.ts +4 -0
- package/dist/src/account-jev-savings.js +92 -0
- package/dist/src/acp-agent.js +2 -2
- package/dist/src/agent-execution.js +441 -53
- package/dist/src/agent-mcp.js +7 -1
- package/dist/src/agent-modifiers.js +5 -7
- package/dist/src/analytics.d.ts +19 -1
- package/dist/src/analytics.js +9 -1
- package/dist/src/andorra/entry.js +15 -6
- package/dist/src/andorra/errors.js +3 -0
- package/dist/src/andorra/hosted.d.ts +8 -0
- package/dist/src/andorra/hosted.js +22 -3
- package/dist/src/andorra/streams.d.ts +49 -0
- package/dist/src/andorra/streams.js +98 -0
- package/dist/src/antigravity-acp.d.ts +28 -0
- package/dist/src/antigravity-acp.js +150 -0
- package/dist/src/antigravity-terminal.d.ts +2 -0
- package/dist/src/antigravity-terminal.js +214 -0
- package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
- package/dist/src/app-server/adaptive-routing-settings.js +69 -0
- package/dist/src/app-server/artifact.d.ts +14 -0
- package/dist/src/app-server/artifact.js +46 -0
- package/dist/src/app-server/legal-protocol.d.ts +33 -0
- package/dist/src/app-server/legal-protocol.js +16 -0
- package/dist/src/app-server/protocol.d.ts +34 -3
- package/dist/src/app-server/protocol.js +3 -1
- package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
- package/dist/src/app-server/telemetry-protocol.js +2 -0
- package/dist/src/app-server/telemetry.d.ts +38 -0
- package/dist/src/app-server/telemetry.js +163 -0
- package/dist/src/app-server/workspace.d.ts +21 -0
- package/dist/src/app-server/workspace.js +192 -10
- package/dist/src/app-server.d.ts +82 -26
- package/dist/src/app-server.js +1573 -417
- package/dist/src/attachments.d.ts +10 -0
- package/dist/src/attachments.js +102 -7
- package/dist/src/auth/AuthManager.d.ts +11 -2
- package/dist/src/auth/AuthManager.js +56 -13
- package/dist/src/auth/index.d.ts +5 -1
- package/dist/src/auth/index.js +8 -1
- package/dist/src/auth/lifecycle.d.ts +13 -0
- package/dist/src/auth/lifecycle.js +109 -0
- package/dist/src/auth/store.d.ts +1 -0
- package/dist/src/auth/store.js +12 -0
- package/dist/src/auth/types.d.ts +12 -0
- package/dist/src/automation-runner.js +2 -0
- package/dist/src/automation-service.js +7 -2
- package/dist/src/automation-tool.js +2 -1
- package/dist/src/benchmark-scores.d.ts +88 -0
- package/dist/src/benchmark-scores.js +302 -0
- package/dist/src/bridge/command.js +16 -1
- package/dist/src/bridge/control.d.ts +3 -1
- package/dist/src/bridge/control.js +9 -3
- package/dist/src/bridge/engines.d.ts +2 -0
- package/dist/src/bridge/engines.js +9 -0
- package/dist/src/bridge/github.d.ts +108 -0
- package/dist/src/bridge/github.js +378 -0
- package/dist/src/bridge/host-ops.d.ts +3 -3
- package/dist/src/bridge/host-ops.js +14 -2
- package/dist/src/bridge/host.d.ts +2 -0
- package/dist/src/bridge/host.js +70 -16
- package/dist/src/bridge/protocol.d.ts +1 -0
- package/dist/src/bridge/protocol.js +1 -0
- package/dist/src/browser-panel-tool.d.ts +12 -0
- package/dist/src/browser-panel-tool.js +30 -3
- package/dist/src/browser-runner.js +53 -62
- package/dist/src/browser-server.js +10 -4
- package/dist/src/browser-session.d.ts +14 -0
- package/dist/src/browser-session.js +57 -12
- package/dist/src/browser-view.d.ts +40 -1
- package/dist/src/browser-view.js +163 -9
- package/dist/src/browser-window-style.d.ts +27 -0
- package/dist/src/browser-window-style.js +244 -0
- package/dist/src/bug-report-attachments.d.ts +48 -0
- package/dist/src/bug-report-attachments.js +327 -0
- package/dist/src/bug-report.d.ts +23 -3
- package/dist/src/bug-report.js +72 -9
- package/dist/src/claude-provider.d.ts +1 -0
- package/dist/src/claude-provider.js +77 -36
- package/dist/src/cli.d.ts +1 -3
- package/dist/src/cli.js +245 -62
- package/dist/src/codex-provider.d.ts +1 -0
- package/dist/src/codex-provider.js +44 -8
- package/dist/src/coding-tools.d.ts +1 -0
- package/dist/src/coding-tools.js +28 -7
- package/dist/src/command-screens.d.ts +1 -1
- package/dist/src/command-screens.js +2 -2
- package/dist/src/commands.d.ts +9 -2
- package/dist/src/commands.js +69 -64
- package/dist/src/completion.js +13 -7
- package/dist/src/config.d.ts +14 -3
- package/dist/src/config.js +57 -17
- package/dist/src/context-budget.d.ts +11 -2
- package/dist/src/context-budget.js +38 -4
- package/dist/src/context-compaction.d.ts +10 -8
- package/dist/src/context-compaction.js +23 -24
- package/dist/src/deadline.js +1 -1
- package/dist/src/decision/DecisionEngine.d.ts +2 -0
- package/dist/src/decision/DecisionManager.d.ts +16 -0
- package/dist/src/decision/DecisionManager.js +75 -2
- package/dist/src/decision/applyTaskKind.d.ts +8 -0
- package/dist/src/decision/applyTaskKind.js +53 -0
- package/dist/src/decision/applyToolMenu.js +6 -2
- package/dist/src/decision/hostedPolicy.js +6 -3
- package/dist/src/decision/optimizationPolicy.d.ts +10 -0
- package/dist/src/decision/optimizationPolicy.js +23 -3
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +4 -1
- package/dist/src/decision/providers/AndorraDecisionProvider.js +29 -7
- package/dist/src/decision/providers/index.js +1 -1
- package/dist/src/decision/taskKind.d.ts +52 -0
- package/dist/src/decision/taskKind.js +76 -0
- package/dist/src/decision/toolFamilies.js +1 -1
- package/dist/src/decision/types.d.ts +3 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/efficiency.d.ts +80 -1
- package/dist/src/efficiency.js +119 -4
- package/dist/src/effort-routing.d.ts +27 -0
- package/dist/src/effort-routing.js +34 -0
- package/dist/src/evidence.d.ts +110 -0
- package/dist/src/evidence.js +195 -0
- package/dist/src/extensions.d.ts +2 -0
- package/dist/src/extensions.js +30 -20
- package/dist/src/github-app/agent-writes.d.ts +1 -1
- package/dist/src/github-app/agent-writes.js +1 -1
- package/dist/src/github-app/client.d.ts +19 -0
- package/dist/src/github-app/client.js +21 -1
- package/dist/src/github-app/event-source.d.ts +0 -5
- package/dist/src/github-app/event-source.js +1 -31
- package/dist/src/github-app/metrics.d.ts +2 -5
- package/dist/src/github-app/metrics.js +2 -14
- package/dist/src/github-app/review-loop.d.ts +5 -5
- package/dist/src/github-app/review-loop.js +1 -1
- package/dist/src/github-app/review-node.d.ts +2 -2
- package/dist/src/github-app/triggers.d.ts +3 -3
- package/dist/src/github-names.d.ts +7 -0
- package/dist/src/github-names.js +7 -0
- package/dist/src/glob-search.d.ts +1 -0
- package/dist/src/glob-search.js +3 -0
- package/dist/src/google-provider.d.ts +5 -28
- package/dist/src/google-provider.js +6 -141
- package/dist/src/graph-editor-session.d.ts +1 -0
- package/dist/src/graph-editor-session.js +2 -0
- package/dist/src/graph-health.js +3 -1
- package/dist/src/graph-preview.d.ts +2 -0
- package/dist/src/graph-preview.js +1 -0
- package/dist/src/graph-runner.js +20 -14
- package/dist/src/graph-selection.d.ts +3 -1
- package/dist/src/graph-selection.js +2 -2
- package/dist/src/graph-server.d.ts +8 -1
- package/dist/src/graph-server.js +49 -12
- package/dist/src/graph-sync.d.ts +2 -1
- package/dist/src/graph-sync.js +13 -0
- package/dist/src/graph-ui/app.js +49 -8
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graphs.d.ts +23 -1
- package/dist/src/graphs.js +58 -7
- package/dist/src/grok-provider.js +17 -14
- package/dist/src/hardened-runtime.js +39 -25
- package/dist/src/jev-savings.d.ts +4 -0
- package/dist/src/jev-savings.js +13 -0
- package/dist/src/legal/client.d.ts +25 -0
- package/dist/src/legal/client.js +47 -0
- package/dist/src/legal/command.d.ts +13 -0
- package/dist/src/legal/command.js +98 -0
- package/dist/src/legal/documents.d.ts +2 -0
- package/dist/src/legal/documents.js +14 -0
- package/dist/src/legal/gate.d.ts +13 -0
- package/dist/src/legal/gate.js +96 -0
- package/dist/src/legal/manifest.d.ts +21 -0
- package/dist/src/legal/manifest.js +23 -0
- package/dist/src/legal/receipt.d.ts +13 -0
- package/dist/src/legal/receipt.js +137 -0
- package/dist/src/legal/release.d.ts +27 -0
- package/dist/src/legal/release.js +28 -0
- package/dist/src/managed-sign-in.d.ts +0 -1
- package/dist/src/managed-sign-in.js +0 -13
- package/dist/src/membership.d.ts +27 -1
- package/dist/src/membership.js +139 -7
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.js +3 -7
- package/dist/src/model-override.d.ts +2 -1
- package/dist/src/model-override.js +9 -0
- package/dist/src/model-pool.d.ts +99 -0
- package/dist/src/model-pool.js +136 -0
- package/dist/src/model-relay/local.js +5 -0
- package/dist/src/model-relay/remote.d.ts +2 -0
- package/dist/src/model-relay/remote.js +4 -0
- package/dist/src/model-tiers.d.ts +16 -1
- package/dist/src/model-tiers.js +31 -7
- package/dist/src/opencode-cli-provider.js +59 -56
- package/dist/src/opencode-provider.js +16 -13
- package/dist/src/permissions.d.ts +5 -0
- package/dist/src/permissions.js +7 -0
- package/dist/src/plan-pass.js +2 -1
- package/dist/src/pool-scores.d.ts +45 -0
- package/dist/src/pool-scores.js +40 -0
- package/dist/src/provider-connection.js +3 -17
- package/dist/src/provider-engine.d.ts +13 -1
- package/dist/src/provider-engine.js +116 -12
- package/dist/src/provider-request-error.d.ts +8 -0
- package/dist/src/provider-request-error.js +12 -0
- package/dist/src/provider-settings.d.ts +1 -1
- package/dist/src/provider-settings.js +36 -18
- package/dist/src/provider-turn-deadline.d.ts +39 -0
- package/dist/src/provider-turn-deadline.js +139 -0
- package/dist/src/providers.d.ts +8 -9
- package/dist/src/providers.js +211 -150
- package/dist/src/pull-request-merge.d.ts +1 -8
- package/dist/src/pull-request-merge.js +0 -4
- package/dist/src/pull-requests.d.ts +83 -57
- package/dist/src/pull-requests.js +266 -225
- package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
- package/dist/src/qa/runtime/ProcessManager.js +9 -3
- package/dist/src/react-runtime.js +245 -71
- package/dist/src/reasoning-probe-cloud.d.ts +10 -0
- package/dist/src/reasoning-probe-cloud.js +209 -0
- package/dist/src/remote/engine-pool.d.ts +3 -0
- package/dist/src/remote/engine-pool.js +88 -21
- package/dist/src/remote/recovery.d.ts +6 -0
- package/dist/src/remote/recovery.js +37 -0
- package/dist/src/run-records.d.ts +13 -3
- package/dist/src/run-records.js +59 -34
- package/dist/src/runtime.d.ts +47 -2
- package/dist/src/runtime.js +33 -7
- package/dist/src/session-summary.d.ts +8 -0
- package/dist/src/session-summary.js +34 -0
- package/dist/src/sessions.d.ts +32 -0
- package/dist/src/sessions.js +65 -3
- package/dist/src/shell.js +6 -0
- package/dist/src/side-panel.js +36 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +4 -10
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
- package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
- package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/subagent-run.js +50 -50
- package/dist/src/subscription-usage.d.ts +50 -0
- package/dist/src/subscription-usage.js +92 -0
- package/dist/src/task-checkout.d.ts +157 -0
- package/dist/src/task-checkout.js +628 -0
- package/dist/src/telemetry/access.d.ts +18 -0
- package/dist/src/telemetry/access.js +43 -0
- package/dist/src/telemetry/aggregate.d.ts +18 -2
- package/dist/src/telemetry/aggregate.js +22 -9
- package/dist/src/telemetry/capture-core.d.ts +33 -14
- package/dist/src/telemetry/capture-core.js +124 -25
- package/dist/src/telemetry/capture.d.ts +3 -2
- package/dist/src/telemetry/capture.js +21 -1
- package/dist/src/telemetry/decision-capture.js +4 -0
- package/dist/src/telemetry/emitter.d.ts +6 -7
- package/dist/src/telemetry/emitter.js +124 -29
- package/dist/src/telemetry/gate.d.ts +41 -2
- package/dist/src/telemetry/gate.js +89 -4
- package/dist/src/telemetry/home.d.ts +1 -0
- package/dist/src/telemetry/home.js +20 -0
- package/dist/src/telemetry/identity.d.ts +6 -3
- package/dist/src/telemetry/identity.js +19 -6
- package/dist/src/telemetry/lifecycle.d.ts +8 -0
- package/dist/src/telemetry/lifecycle.js +76 -0
- package/dist/src/telemetry/outbox.d.ts +13 -8
- package/dist/src/telemetry/outbox.js +68 -12
- package/dist/src/telemetry/permission-command.d.ts +38 -0
- package/dist/src/telemetry/permission-command.js +208 -0
- package/dist/src/telemetry/permission.d.ts +168 -0
- package/dist/src/telemetry/permission.js +662 -0
- package/dist/src/telemetry/record-installation.d.ts +1 -0
- package/dist/src/telemetry/record-installation.js +9 -0
- package/dist/src/telemetry/region-data.d.ts +12 -0
- package/dist/src/telemetry/region-data.js +1314 -0
- package/dist/src/telemetry/region.d.ts +34 -0
- package/dist/src/telemetry/region.js +87 -0
- package/dist/src/telemetry/run-privacy.d.ts +11 -0
- package/dist/src/telemetry/run-privacy.js +165 -0
- package/dist/src/telemetry/schema.d.ts +27 -6
- package/dist/src/telemetry/schema.js +109 -14
- package/dist/src/telemetry/state.d.ts +11 -7
- package/dist/src/telemetry/state.js +39 -6
- package/dist/src/telemetry/surface.d.ts +20 -3
- package/dist/src/telemetry/surface.js +71 -15
- package/dist/src/telemetry/uploader.d.ts +6 -11
- package/dist/src/telemetry/uploader.js +72 -46
- package/dist/src/telemetry/uploads.d.ts +5 -1
- package/dist/src/telemetry/uploads.js +25 -6
- package/dist/src/telemetry/version.d.ts +5 -0
- package/dist/src/telemetry/version.js +34 -0
- package/dist/src/telemetry/workspace.d.ts +4 -1
- package/dist/src/telemetry/workspace.js +18 -3
- package/dist/src/terminal-ui.d.ts +3 -0
- package/dist/src/terminal-ui.js +48 -6
- package/dist/src/test-edit-guard.d.ts +30 -0
- package/dist/src/test-edit-guard.js +167 -2
- package/dist/src/thinking-level-detect.d.ts +13 -0
- package/dist/src/thinking-level-detect.js +52 -0
- package/dist/src/thinking-levels.d.ts +30 -0
- package/dist/src/thinking-levels.js +131 -0
- package/dist/src/timers.d.ts +3 -0
- package/dist/src/todos.d.ts +2 -1
- package/dist/src/todos.js +24 -4
- package/dist/src/tool-argument-coercion.d.ts +7 -0
- package/dist/src/tool-argument-coercion.js +49 -0
- package/dist/src/tool-catalog.d.ts +2 -2
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/tools.js +67 -22
- package/dist/src/transcript.js +3 -2
- package/dist/src/types.d.ts +48 -1
- package/dist/src/update.js +4 -0
- package/dist/src/usage-analytics.d.ts +7 -0
- package/dist/src/usage-analytics.js +85 -13
- package/dist/telemetry-consent-v1 +1 -0
- package/package.json +97 -96
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReviewCommentWrites, type GhRunner, type ReviewLoopSettings, type ReviewLoopState, type SessionPullRequest } from '../pull-requests.js';
|
|
2
2
|
import type { GitHubAppClient, GitHubCoverage } from './client.js';
|
|
3
3
|
import { type ReviewLoopEnd } from './review-post.js';
|
|
4
4
|
import { prepareReviewWorkspace, runReviewer } from './reviewer.js';
|
|
@@ -56,8 +56,8 @@ export interface ReviewLoopDependencies {
|
|
|
56
56
|
provider: string;
|
|
57
57
|
model: string;
|
|
58
58
|
} | undefined>;
|
|
59
|
-
/** Who the fixer's replies post as, for the wake's account clause (the
|
|
60
|
-
writes(sessionId: string): Promise<
|
|
59
|
+
/** Who the fixer's replies post as, for the wake's account clause (the PR writing tool?s rule). */
|
|
60
|
+
writes(sessionId: string): Promise<ReviewCommentWrites>;
|
|
61
61
|
/**
|
|
62
62
|
* Hands the fixer its wake: into a run of the session waiting in await_review in this process (`heldBy` is that
|
|
63
63
|
* run), or as a wake the timers deliver as the next turn.
|
|
@@ -128,7 +128,7 @@ export declare function reviewFixPrompt(pullRequest: SessionPullRequest, input:
|
|
|
128
128
|
reviewUrl: string;
|
|
129
129
|
inline: number;
|
|
130
130
|
summary: number;
|
|
131
|
-
writes:
|
|
131
|
+
writes: ReviewCommentWrites;
|
|
132
132
|
form?: 'chat' | 'graph';
|
|
133
133
|
}): string;
|
|
134
134
|
/**
|
|
@@ -218,7 +218,7 @@ export declare class ReviewLoopController {
|
|
|
218
218
|
* removed, and the transcript row. Also for a loop whose record went (a dismissed PR, a deleted session).
|
|
219
219
|
*/
|
|
220
220
|
ended(sessionId: string, before: ReviewLoopState, reason: ReviewLoopEnd, detail?: string): void;
|
|
221
|
-
/** At delivery: whether the fixer's wake is still wanted. The PR is read on GitHub
|
|
221
|
+
/** At delivery: whether the fixer's wake is still wanted. The PR is read on GitHub. */
|
|
222
222
|
confirmWake(sessionId: string, wakeId: string): Promise<boolean>;
|
|
223
223
|
/** The fixer's wake started (or continued) a run: that run's end, or its wait in await_review, ends the round. */
|
|
224
224
|
wakeDelivered(sessionId: string, wakeId: string, runId: string): Promise<void>;
|
|
@@ -663,7 +663,7 @@ export class ReviewLoopController {
|
|
|
663
663
|
void removePostRecord(this.deps.home, sessionId);
|
|
664
664
|
this.deps.emitLoop({ sessionId, kind: 'ended', round: before.round, rounds: before.rounds, reason, ...(detail === undefined ? {} : { detail }) });
|
|
665
665
|
}
|
|
666
|
-
/** At delivery: whether the fixer's wake is still wanted. The PR is read on GitHub
|
|
666
|
+
/** At delivery: whether the fixer's wake is still wanted. The PR is read on GitHub. */
|
|
667
667
|
async confirmWake(sessionId, wakeId) {
|
|
668
668
|
const wanted = (pullRequest) => pullRequest !== undefined && chatReviewLoopActive(pullRequest)
|
|
669
669
|
&& pullRequest.review.phase === 'fixing' && pullRequest.review.pendingReview?.wakeId === wakeId && pullRequest.review.pendingReview.runId === undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReviewNodeSettings } from '../graphs.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ReviewCommentWrites, type SessionPullRequest } from '../pull-requests.js';
|
|
3
3
|
import type { GitHubCoverage } from './client.js';
|
|
4
4
|
import { type ReviewLoopController } from './review-loop.js';
|
|
5
5
|
/**
|
|
@@ -66,7 +66,7 @@ export interface ReviewNodeDependencies {
|
|
|
66
66
|
readNow(): Promise<void>;
|
|
67
67
|
/** The PR's head on GitHub now, or undefined when it cannot be read. */
|
|
68
68
|
head(pullRequest: SessionPullRequest): Promise<string | undefined>;
|
|
69
|
-
writes(): Promise<
|
|
69
|
+
writes(): Promise<ReviewCommentWrites>;
|
|
70
70
|
/** The ids of the person's messages to the task not yet delivered: one that comes while a draft waits ends the wait. */
|
|
71
71
|
steers?(): string[];
|
|
72
72
|
bot?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReviewCommentWrites, type GhRunner, type SessionPullRequest } from '../pull-requests.js';
|
|
2
2
|
import type { GitHubAppClient, MentionNotice } from './client.js';
|
|
3
3
|
/**
|
|
4
4
|
* "@andorra-code" comment triggers (`design/specs/github-app.md`, "Phase 3"). The receiver writes a `request`
|
|
@@ -36,7 +36,7 @@ export declare const RETRY_DELAYS_MS: readonly number[];
|
|
|
36
36
|
* to stop if the comment is not theirs alone, and who the agent's answer posts as. The comment's text never
|
|
37
37
|
* enters it.
|
|
38
38
|
*/
|
|
39
|
-
export declare function mentionPrompt(notice: Pick<MentionNotice, 'actor' | 'commentUrl' | 'commentKind' | 'commentId'>, pullRequest: Pick<SessionPullRequest, 'url' | 'ghUser'>, writes:
|
|
39
|
+
export declare function mentionPrompt(notice: Pick<MentionNotice, 'actor' | 'commentUrl' | 'commentKind' | 'commentId'>, pullRequest: Pick<SessionPullRequest, 'url' | 'ghUser'>, writes: ReviewCommentWrites): string;
|
|
40
40
|
/** A definite no: the mention wakes nothing, and (unless `remember` is false) is remembered as handled. */
|
|
41
41
|
export declare class MentionRefused extends Error {
|
|
42
42
|
readonly reason: 'not-signed-in' | 'no-access' | 'not-author' | 'edited' | 'gone';
|
|
@@ -61,7 +61,7 @@ export interface MentionTriggerOptions {
|
|
|
61
61
|
/** `github.app.triggers` is not false here. */
|
|
62
62
|
enabled(): Promise<boolean>;
|
|
63
63
|
/** Who the agent's answer posts as on this session's PR (the pull_request tool's own rule), and the bot's login. */
|
|
64
|
-
writes(sessionId: string): Promise<
|
|
64
|
+
writes(sessionId: string): Promise<ReviewCommentWrites>;
|
|
65
65
|
/** Wakes the session with the prompt, as Fix with Agent does, and answers the wake's id. */
|
|
66
66
|
wake(sessionId: string, prompt: string, pullRequest: SessionPullRequest): string;
|
|
67
67
|
log?(level: 'info' | 'warn', detail: string): void;
|
|
@@ -5,4 +5,11 @@
|
|
|
5
5
|
export declare const GITHUB_OWNER_PATTERN = "[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})";
|
|
6
6
|
export declare const GITHUB_REPO_PATTERN = "(?!\\.\\.?(?![A-Za-z0-9._-]))[A-Za-z0-9._-]{1,100}";
|
|
7
7
|
export declare const GITHUB_OWNER: RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* An account that owns a repository, as Andorra's GitHub App service names it (`OWNER` in
|
|
10
|
+
* `infra/andorra-auth/github_app.py`): an Enterprise Managed User's `name_shortcode`, with its underscore and its longer
|
|
11
|
+
* length, included. Used where the service's own list is read and acted on (Cloud's repositories), not for a pull
|
|
12
|
+
* request URL. Letters, digits, `_` and `-` only, so it is always one path segment.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GITHUB_ACCOUNT: RegExp;
|
|
8
15
|
export declare const GITHUB_REPO: RegExp;
|
package/dist/src/github-names.js
CHANGED
|
@@ -5,4 +5,11 @@
|
|
|
5
5
|
export const GITHUB_OWNER_PATTERN = '[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})';
|
|
6
6
|
export const GITHUB_REPO_PATTERN = '(?!\\.\\.?(?![A-Za-z0-9._-]))[A-Za-z0-9._-]{1,100}';
|
|
7
7
|
export const GITHUB_OWNER = new RegExp(`^${GITHUB_OWNER_PATTERN}$`);
|
|
8
|
+
/**
|
|
9
|
+
* An account that owns a repository, as Andorra's GitHub App service names it (`OWNER` in
|
|
10
|
+
* `infra/andorra-auth/github_app.py`): an Enterprise Managed User's `name_shortcode`, with its underscore and its longer
|
|
11
|
+
* length, included. Used where the service's own list is read and acted on (Cloud's repositories), not for a pull
|
|
12
|
+
* request URL. Letters, digits, `_` and `-` only, so it is always one path segment.
|
|
13
|
+
*/
|
|
14
|
+
export const GITHUB_ACCOUNT = /^[A-Za-z0-9](?:[A-Za-z0-9_-]{0,62})$/;
|
|
8
15
|
export const GITHUB_REPO = new RegExp(`^${GITHUB_REPO_PATTERN}$`);
|
|
@@ -15,6 +15,7 @@ export interface GlobSearchInput {
|
|
|
15
15
|
walk(directory: string, budget: {
|
|
16
16
|
entries: number;
|
|
17
17
|
limit: number;
|
|
18
|
+
unreadable?: number;
|
|
18
19
|
}): AsyncIterable<string>;
|
|
19
20
|
/** Drops listed paths the agent may not see; paths are relative to cwd. */
|
|
20
21
|
keep?(relative: string[], cwd: string): string[];
|
package/dist/src/glob-search.js
CHANGED
|
@@ -114,6 +114,9 @@ async function listWithWalk(cwd, accept, input) {
|
|
|
114
114
|
throw error;
|
|
115
115
|
listing.incomplete = `stopped at the ${GLOB_WALK_ENTRY_LIMIT.toLocaleString('en-US')}-entry directory scan limit`;
|
|
116
116
|
}
|
|
117
|
+
if (budget.unreadable && !listing.incomplete) {
|
|
118
|
+
listing.incomplete = `${budget.unreadable.toLocaleString('en-US')} folder${budget.unreadable === 1 ? '' : 's'} could not be opened (permission denied) and ${budget.unreadable === 1 ? 'was' : 'were'} skipped`;
|
|
119
|
+
}
|
|
117
120
|
return listing;
|
|
118
121
|
}
|
|
119
122
|
/**
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ModelAdapter
|
|
1
|
+
import type { CliExecutableSpec } from './cli-executable.js';
|
|
2
|
+
import type { ModelAdapter } from './types.js';
|
|
3
3
|
export declare const GOOGLE_BASE_URL = "https://antigravity.google";
|
|
4
|
+
export declare const GOOGLE_LEGACY_MESSAGE = "Google subscriptions now use a dedicated Antigravity ACP session. Open Antigravity in Desktop or run andorra antigravity. For Gemini in an Andorra graph, add Google with an AI Studio API key.";
|
|
4
5
|
export declare const GOOGLE_EXECUTABLE: CliExecutableSpec;
|
|
5
6
|
export declare function googleEnvironment(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
captureStderr?: boolean;
|
|
9
|
-
acceptedExitCodes?: number[];
|
|
10
|
-
}
|
|
11
|
-
export type GoogleRun = (args: string[], signal: AbortSignal, options?: GoogleRunOptions) => Promise<{
|
|
12
|
-
stdout: string;
|
|
13
|
-
stderr: string;
|
|
14
|
-
}>;
|
|
15
|
-
export interface GoogleDependencies {
|
|
16
|
-
run?: GoogleRun;
|
|
17
|
-
}
|
|
18
|
-
export declare const runGoogleProcess: GoogleRun;
|
|
19
|
-
export declare function parseGoogleModels(output: string): {
|
|
20
|
-
signedIn: boolean;
|
|
21
|
-
models: string[];
|
|
22
|
-
};
|
|
23
|
-
export declare function readGoogleCatalog(signal: AbortSignal, dependencies?: GoogleDependencies): Promise<{
|
|
24
|
-
signedIn: boolean;
|
|
25
|
-
models: string[];
|
|
26
|
-
}>;
|
|
27
|
-
export declare function parseGoogleResponse(output: string, tools?: readonly Pick<ToolSchema, 'name'>[]): ModelResponse;
|
|
28
|
-
export declare function parseGoogleText(output: string): ModelResponse;
|
|
29
|
-
export declare function createGoogleAdapter(_config: {
|
|
30
|
-
model: string;
|
|
31
|
-
}, dependencies?: GoogleDependencies): ModelAdapter;
|
|
7
|
+
/** Keep saved provider IDs loadable so graphs can report how to migrate. */
|
|
8
|
+
export declare function createGoogleAdapter(): ModelAdapter;
|
|
@@ -1,153 +1,18 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { resolveCliExecutable } from './cli-executable.js';
|
|
3
|
-
import { runBoundedCli } from './cli-process.js';
|
|
4
|
-
import { allowanceInstruction, boundTextStep, parseStructuredStep, STRUCTURED_STEP_PROMPT, STRUCTURED_STEP_SCHEMA, structuredStepPrompt, TEXT_STEP_PROMPT } from './structured-step.js';
|
|
5
2
|
export const GOOGLE_BASE_URL = 'https://antigravity.google';
|
|
3
|
+
export const GOOGLE_LEGACY_MESSAGE = 'Google subscriptions now use a dedicated Antigravity ACP session. Open Antigravity in Desktop or run andorra antigravity. For Gemini in an Andorra graph, add Google with an AI Studio API key.';
|
|
6
4
|
export const GOOGLE_EXECUTABLE = {
|
|
7
5
|
names: ['agy'], overrideEnv: 'ANDORRA_AGY_PATH', homeDirectories: [join('AppData', 'Local', 'agy', 'bin'), join('.local', 'bin')],
|
|
8
|
-
installMessage: 'Install the Antigravity CLI (agy) from antigravity.google,
|
|
6
|
+
installMessage: 'Install the official Antigravity CLI (agy) from antigravity.google, then run agy acp --login.',
|
|
9
7
|
};
|
|
10
|
-
const SIGN_IN_MESSAGE = 'Sign in with Google in the Antigravity CLI (agy) on this machine, then retry the Google provider.';
|
|
11
|
-
const REQUEST_TIMEOUT_MS = 10 * 60_000;
|
|
12
|
-
const CATALOG_TIMEOUT_MS = 30_000;
|
|
13
|
-
// Strict permissions make the CLI ask before every one of its own tools, and a headless run cannot
|
|
14
|
-
// answer, so each is denied: the CLI serves as a model and Andorra runs the tools.
|
|
15
|
-
const STEP_SETTINGS = JSON.stringify({ toolPermission: 'strict', disableSlashCommands: true, allowNonWorkspaceAccess: false });
|
|
16
8
|
export function googleEnvironment(source = process.env) {
|
|
17
9
|
const env = Object.fromEntries(Object.entries(source).filter(([key]) => !/^(?:GEMINI_API_KEY$|GOOGLE_API_KEY$|GOOGLE_GENAI_|NODE_OPTIONS$)/i.test(key)));
|
|
18
10
|
return { ...env, NO_COLOR: '1' };
|
|
19
11
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return runBoundedCli(executable, () => args, signal, { env: googleEnvironment(), label: 'Antigravity CLI', ...options });
|
|
23
|
-
};
|
|
24
|
-
/** The CLI also lists models from other vendors; only Google's own are offered here. */
|
|
25
|
-
const GOOGLE_MODEL = /^gemini-[\w.-]{1,200}$/;
|
|
26
|
-
export function parseGoogleModels(output) {
|
|
27
|
-
const plain = output.replace(/\u001b\[[0-9;]*m/g, '');
|
|
28
|
-
if (/\b(?:please sign in|authentication required|not (?:authenticated|signed in|logged in))\b/i.test(plain))
|
|
29
|
-
return { signedIn: false, models: [] };
|
|
30
|
-
const models = [];
|
|
31
|
-
let listed = 0;
|
|
32
|
-
for (const line of plain.split(/\r?\n/)) {
|
|
33
|
-
const id = line.match(/^([\w.-]+)\t/)?.[1];
|
|
34
|
-
if (!id)
|
|
35
|
-
continue;
|
|
36
|
-
listed += 1;
|
|
37
|
-
if (GOOGLE_MODEL.test(id) && !models.includes(id) && models.length < 1000)
|
|
38
|
-
models.push(id);
|
|
39
|
-
}
|
|
40
|
-
return { signedIn: listed > 0, models };
|
|
41
|
-
}
|
|
42
|
-
export async function readGoogleCatalog(signal, dependencies = {}) {
|
|
43
|
-
const run = dependencies.run ?? runGoogleProcess;
|
|
44
|
-
const bounded = AbortSignal.any([signal, AbortSignal.timeout(CATALOG_TIMEOUT_MS)]);
|
|
45
|
-
const { stdout, stderr } = await run(['models'], bounded, { captureStderr: true, acceptedExitCodes: [0, 1] });
|
|
46
|
-
return parseGoogleModels(`${stdout}\n${stderr}`);
|
|
47
|
-
}
|
|
48
|
-
function frames(text) {
|
|
49
|
-
return text.split(/\r?\n/).filter(line => line.trim().startsWith('{')).map(line => {
|
|
50
|
-
try {
|
|
51
|
-
return JSON.parse(line);
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
throw new Error('Antigravity CLI returned malformed JSON');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function googleUsage(usage) {
|
|
59
|
-
if (!usage || typeof usage !== 'object')
|
|
60
|
-
return undefined;
|
|
61
|
-
const token = (name) => Number.isSafeInteger(usage[name]) && usage[name] >= 0 ? usage[name] : undefined;
|
|
62
|
-
const input = token('input_tokens');
|
|
63
|
-
const output = token('output_tokens');
|
|
64
|
-
const read = token('cache_read_tokens');
|
|
65
|
-
if (!input && !output && !read)
|
|
66
|
-
return { requests: 1 };
|
|
67
|
-
return { requests: 1,
|
|
68
|
-
...(input === undefined ? {} : { inputTokens: input + (read ?? 0) }),
|
|
69
|
-
...(output === undefined ? {} : { outputTokens: output }),
|
|
70
|
-
...(read === undefined ? {} : { cacheRead: read }) };
|
|
71
|
-
}
|
|
72
|
-
function failure(message) {
|
|
73
|
-
if (typeof message === 'string' && /\bauthenticat|\bsign in\b|\blog in\b/i.test(message))
|
|
74
|
-
return new Error(SIGN_IN_MESSAGE);
|
|
75
|
-
return new Error('Google inference failed. Check the Antigravity CLI sign-in, model access, and plan limits.');
|
|
76
|
-
}
|
|
77
|
-
function singleResult(output, attempted) {
|
|
78
|
-
const events = frames(output);
|
|
79
|
-
for (const event of events) {
|
|
80
|
-
const step = event?.event === 'step_update' ? event.step_update : undefined;
|
|
81
|
-
if (step && (step.step_type === 'tool' || step.tool_name !== undefined || step.tool_info !== undefined || step.subagent_info !== undefined))
|
|
82
|
-
throw new Error(attempted);
|
|
83
|
-
}
|
|
84
|
-
const results = events.filter(event => event?.event === 'result').map(event => event.result);
|
|
85
|
-
if (results.length !== 1 || !results[0] || typeof results[0] !== 'object')
|
|
86
|
-
throw new Error('Google did not return exactly one model result');
|
|
87
|
-
const result = results[0];
|
|
88
|
-
if (result.status !== 'SUCCESS')
|
|
89
|
-
throw failure(result.error);
|
|
90
|
-
if (Array.isArray(result.denied_actions) && result.denied_actions.length)
|
|
91
|
-
throw new Error(attempted);
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
export function parseGoogleResponse(output, tools = []) {
|
|
95
|
-
const result = singleResult(output, 'Google attempted a native tool');
|
|
96
|
-
let structured = result.structured_output;
|
|
97
|
-
if (structured === undefined && typeof result.response === 'string') {
|
|
98
|
-
try {
|
|
99
|
-
structured = JSON.parse(result.response);
|
|
100
|
-
}
|
|
101
|
-
catch { }
|
|
102
|
-
}
|
|
103
|
-
if (structured === undefined)
|
|
104
|
-
throw new Error('Google did not return a complete Andorra model step');
|
|
105
|
-
const response = parseStructuredStep(structured, tools, 'Google');
|
|
106
|
-
const usage = googleUsage(result.usage);
|
|
107
|
-
if (usage)
|
|
108
|
-
response.usage = usage;
|
|
109
|
-
return response;
|
|
110
|
-
}
|
|
111
|
-
export function parseGoogleText(output) {
|
|
112
|
-
const result = singleResult(output, 'Google attempted a tool during text generation');
|
|
113
|
-
const usage = googleUsage(result.usage);
|
|
114
|
-
return { text: typeof result.response === 'string' ? result.response.replace(/\r?\n$/, '') : '', toolCalls: [], ...(usage ? { usage } : {}) };
|
|
115
|
-
}
|
|
116
|
-
export function createGoogleAdapter(_config, dependencies = {}) {
|
|
117
|
-
const run = dependencies.run ?? runGoogleProcess;
|
|
12
|
+
/** Keep saved provider IDs loadable so graphs can report how to migrate. */
|
|
13
|
+
export function createGoogleAdapter() {
|
|
118
14
|
return {
|
|
119
|
-
async listModels(
|
|
120
|
-
|
|
121
|
-
if (!catalog.signedIn)
|
|
122
|
-
throw new Error(SIGN_IN_MESSAGE);
|
|
123
|
-
return catalog.models;
|
|
124
|
-
},
|
|
125
|
-
async generate(request) {
|
|
126
|
-
request.signal.throwIfAborted();
|
|
127
|
-
if (!GOOGLE_MODEL.test(request.model))
|
|
128
|
-
throw new Error('The Google provider runs Gemini models only. Choose a Gemini model.');
|
|
129
|
-
const auxiliary = request.maxTokens !== undefined;
|
|
130
|
-
if (auxiliary && (!Number.isSafeInteger(request.maxTokens) || request.maxTokens < 1))
|
|
131
|
-
throw new Error('Invalid auxiliary output allowance.');
|
|
132
|
-
if (auxiliary && request.tools.length)
|
|
133
|
-
throw new Error('Google cannot apply an auxiliary output allowance to tool-bearing requests.');
|
|
134
|
-
const signal = AbortSignal.any([request.signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)]);
|
|
135
|
-
const imageCount = request.messages.reduce((total, message) => total + (message.images?.length ?? 0), 0);
|
|
136
|
-
// The CLI has no system-prompt override, so the model-component instructions travel in the prompt.
|
|
137
|
-
const prompt = JSON.stringify({
|
|
138
|
-
instructions: auxiliary ? `${TEXT_STEP_PROMPT} ${allowanceInstruction(request.maxTokens)}` : STRUCTURED_STEP_PROMPT,
|
|
139
|
-
...JSON.parse(structuredStepPrompt(request)),
|
|
140
|
-
...(imageCount ? { omittedImages: `This provider cannot forward images; ${imageCount} image${imageCount === 1 ? ' was' : 's were'} omitted from the conversation.` } : {})
|
|
141
|
-
});
|
|
142
|
-
request.onRequest?.();
|
|
143
|
-
const { stdout } = await run(['--input-format', 'stream-json', '--output-format', 'stream-json', '--model', request.model,
|
|
144
|
-
'--settings', STEP_SETTINGS, '--disable-slash-commands',
|
|
145
|
-
...(auxiliary ? [] : ['--json-schema', JSON.stringify(STRUCTURED_STEP_SCHEMA)])], signal, { input: `${JSON.stringify({ event: 'user', message: { content: prompt } })}\n`, acceptedExitCodes: [0, 1] });
|
|
146
|
-
signal.throwIfAborted();
|
|
147
|
-
if (!auxiliary)
|
|
148
|
-
return parseGoogleResponse(stdout, request.tools);
|
|
149
|
-
const text = parseGoogleText(stdout);
|
|
150
|
-
return boundTextStep(text, request.maxTokens, text.usage?.outputTokens);
|
|
151
|
-
},
|
|
15
|
+
async listModels() { throw new Error(GOOGLE_LEGACY_MESSAGE); },
|
|
16
|
+
async generate() { throw new Error(GOOGLE_LEGACY_MESSAGE); },
|
|
152
17
|
};
|
|
153
18
|
}
|
|
@@ -6,6 +6,7 @@ export interface GraphEditorSessionDependencies {
|
|
|
6
6
|
startServer?: () => Promise<EditorServer>;
|
|
7
7
|
openBrowser?: (url: string, signal: AbortSignal) => Promise<void>;
|
|
8
8
|
checkMembership?: (signal?: AbortSignal) => Promise<void>;
|
|
9
|
+
checkLegal?: () => Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
export declare function createGraphEditorSession(deps?: GraphEditorSessionDependencies): {
|
|
11
12
|
open(signal?: AbortSignal, mode?: "new" | "edit"): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { requireGraphMembership } from './membership.js';
|
|
4
|
+
import { requireLegalAcceptance } from './legal/gate.js';
|
|
4
5
|
const startGraphServer = async () => (await import('./graph-server.js')).startGraphServer();
|
|
5
6
|
function openBrowser(url, signal) {
|
|
6
7
|
const command = process.platform === 'win32' ? 'rundll32.exe' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
@@ -24,6 +25,7 @@ export function createGraphEditorSession(deps = {}) {
|
|
|
24
25
|
const operation = pending.then(async () => {
|
|
25
26
|
const active = signal ? AbortSignal.any([signal, lifetime.signal]) : lifetime.signal;
|
|
26
27
|
active.throwIfAborted();
|
|
28
|
+
await (deps.checkLegal ?? requireLegalAcceptance)();
|
|
27
29
|
let created = false;
|
|
28
30
|
try {
|
|
29
31
|
if (server)
|
package/dist/src/graph-health.js
CHANGED
|
@@ -73,7 +73,9 @@ function graphModels(graph, config, session = {}, only) {
|
|
|
73
73
|
if (seen.has(key(parent)))
|
|
74
74
|
continue;
|
|
75
75
|
seen.add(key(parent));
|
|
76
|
-
|
|
76
|
+
// A node that allows spawning without a role has one more child to probe: the general subagent.
|
|
77
|
+
const general = (policy.freeform ?? 'off') === 'off' ? [] : [{ id: 'general', name: 'General subagent' }];
|
|
78
|
+
for (const role of [...(policy.roles ?? []), ...general]) {
|
|
77
79
|
const provider = policy.modelPolicy === 'specific' ? policy.provider ?? parent.provider
|
|
78
80
|
: policy.modelPolicy === 'per-role' ? role.provider ?? parent.provider : parent.provider;
|
|
79
81
|
const model = policy.modelPolicy === 'specific' ? policy.model
|
|
@@ -10,6 +10,8 @@ export interface GraphPreviewNode {
|
|
|
10
10
|
agentRole?: 'orchestrator';
|
|
11
11
|
provider?: string;
|
|
12
12
|
model?: string;
|
|
13
|
+
/** The step's own thinking level, when it sets one: a level, or 'auto' for Jev to pick. */
|
|
14
|
+
reasoningEffort?: string;
|
|
13
15
|
/** Omitted when it is exactly ['completed'], the usual single port, to keep large previews small. */
|
|
14
16
|
outcomes?: string[];
|
|
15
17
|
/** An Action's kind, which names it on its card (Run command, Run tests, Git operation). */
|
|
@@ -20,6 +20,7 @@ export function graphPreview(graph, revision, modelOf = () => undefined) {
|
|
|
20
20
|
...(node.agentRole === 'orchestrator' ? { agentRole: 'orchestrator' } : {}),
|
|
21
21
|
...(node.type === 'agent' && node.provider && !model ? { provider: node.provider } : {}),
|
|
22
22
|
...(model ? { model } : {}),
|
|
23
|
+
...(node.type === 'agent' && node.reasoningEffort ? { reasoningEffort: node.reasoningEffort } : {}),
|
|
23
24
|
...(outcomes.length === 1 && outcomes[0] === 'completed' ? {} : { outcomes }),
|
|
24
25
|
...(node.type === 'action' && node.action?.kind ? { action: node.action.kind } : {}),
|
|
25
26
|
...(node.position && Number.isFinite(node.position.x) && Number.isFinite(node.position.y) ? { position: { x: node.position.x, y: node.position.y } } : {}),
|
package/dist/src/graph-runner.js
CHANGED
|
@@ -19,12 +19,13 @@ import { memorySearchTool } from './memory/tools/memorySearchTool.js';
|
|
|
19
19
|
import { resolveEfficiency } from './efficiency.js';
|
|
20
20
|
import { collectWorkspaceFacts } from './workspace-facts.js';
|
|
21
21
|
import { MemoryManager } from './memory/MemoryManager.js';
|
|
22
|
-
import { loadConfig, resolveMemoryConfig } from './config.js';
|
|
22
|
+
import { configDirectory, loadConfig, loadFunctionalConfig, resolveMemoryConfig } from './config.js';
|
|
23
23
|
import { advertiseAvailableTools } from './tool-availability.js';
|
|
24
24
|
import { elapsedMs, monotonicNow } from './duration.js';
|
|
25
25
|
import { dashboardAdapter } from './dashboard.js';
|
|
26
26
|
import { toolBoundaryOpen } from './run-progress.js';
|
|
27
|
-
import { createRunTelemetry, mergeRunTelemetry, recordAttempt, recordErrorOnce, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
|
|
27
|
+
import { resolveTelemetryCapture, bindRunTelemetry, createRunTelemetry, mergeRunTelemetry, recordAttempt, recordErrorOnce, recordTestCommand, recordToolFailure, recordToolUse } from './telemetry/capture.js';
|
|
28
|
+
import { withTelemetryAdmission } from './telemetry/permission.js';
|
|
28
29
|
import { ProviderRequestError, runFailureCode } from './providers.js';
|
|
29
30
|
import { isTestCommandLine } from './telemetry/classify.js';
|
|
30
31
|
import { reviewNodeUnavailable } from './github-app/review-node.js';
|
|
@@ -81,11 +82,16 @@ async function isolatedRunOptions(options) {
|
|
|
81
82
|
export async function runGraph(graph, options) {
|
|
82
83
|
if (isolatedGraph(graph.id))
|
|
83
84
|
options = await isolatedRunOptions(options);
|
|
85
|
+
options = { ...options, telemetry: resolveTelemetryCapture(options.telemetry) };
|
|
84
86
|
if (options.goalCompletionVerification && !graphCanCheckGoal(graph))
|
|
85
87
|
throw new Error(GOAL_NEEDS_AGENT);
|
|
86
88
|
const removedMemorySettings = [];
|
|
87
89
|
if (!options.memory || !options.decisionManager) {
|
|
88
|
-
const
|
|
90
|
+
const home = options.telemetry ? options.telemetry.home : configDirectory();
|
|
91
|
+
const admitted = await withTelemetryAdmission({ home, signals: options.telemetry ? options.telemetry.signals : undefined }, async (admission) => ({
|
|
92
|
+
config: await (admission.lease.mode === 'out' ? loadConfig : loadFunctionalConfig)(home),
|
|
93
|
+
}), options.telemetry ? options.telemetry.lease : undefined);
|
|
94
|
+
const config = admitted?.config ?? await loadFunctionalConfig(home);
|
|
89
95
|
const memoryConfig = options.memory ? undefined : resolveMemoryConfig(config, process.env, notice => { removedMemorySettings.push(notice); });
|
|
90
96
|
options = { ...options, decisionManager: options.decisionManager ?? new DecisionManager({ config: config.decisions, onEvent: options.onEvent }), memory: options.memory ?? await MemoryManager.create({
|
|
91
97
|
config: memoryConfig, workspace: options.context.workspace, onEvent: options.onEvent, getPermissions: () => permissionMode(options.context),
|
|
@@ -193,8 +199,9 @@ export async function runGraph(graph, options) {
|
|
|
193
199
|
const result = {
|
|
194
200
|
id: options.runId ?? randomUUID(), graph: pinned, provider: options.provider, model: options.model,
|
|
195
201
|
status: 'exhausted', usage: { inputTokens: 0, outputTokens: 0, requests: 0 }, toolCalls: 0, nodeResults: {},
|
|
196
|
-
limits: { ...limits },
|
|
202
|
+
limits: { ...limits },
|
|
197
203
|
};
|
|
204
|
+
bindRunTelemetry(result, createRunTelemetry(options.telemetry));
|
|
198
205
|
const todoStore = options.todoStore ?? new TodoStore();
|
|
199
206
|
const widgetStore = options.widgetStore ?? new WidgetStore(pinned.widgets);
|
|
200
207
|
let seededPlan;
|
|
@@ -430,12 +437,11 @@ export async function runGraph(graph, options) {
|
|
|
430
437
|
target.inputTokens += delta.inputTokens;
|
|
431
438
|
target.outputTokens += delta.outputTokens;
|
|
432
439
|
target.requests += delta.requests;
|
|
433
|
-
|
|
434
|
-
if (
|
|
435
|
-
target.cacheRead =
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
target.cacheWrite = write;
|
|
440
|
+
// A figure the provider reported is kept even when it is zero: a measured zero is not an unreported one.
|
|
441
|
+
if (delta.cacheRead !== undefined || target.cacheRead !== undefined)
|
|
442
|
+
target.cacheRead = (target.cacheRead ?? 0) + (delta.cacheRead ?? 0);
|
|
443
|
+
if (delta.cacheWrite !== undefined || target.cacheWrite !== undefined)
|
|
444
|
+
target.cacheWrite = (target.cacheWrite ?? 0) + (delta.cacheWrite ?? 0);
|
|
439
445
|
if (delta.decodeMs !== undefined)
|
|
440
446
|
target.decodeMs = (target.decodeMs ?? 0) + delta.decodeMs;
|
|
441
447
|
};
|
|
@@ -552,9 +558,9 @@ export async function runGraph(graph, options) {
|
|
|
552
558
|
...options,
|
|
553
559
|
...(activation.routedModel ? { modelPinned: true } : {}),
|
|
554
560
|
adapter: instrument(options.provider, { model: options.model, adapter: options.adapter }).adapter,
|
|
555
|
-
...(options.resolveModel ? { resolveModel: async (provider, model, signal) => instrument(provider, await options.resolveModel(provider, model, signal)) } : {}),
|
|
556
|
-
...(options.getLiveModel ? { getLiveModel: async (
|
|
557
|
-
const live = await options.getLiveModel(
|
|
561
|
+
...(options.resolveModel ? { resolveModel: async (provider, model, signal, reasoningEffort) => instrument(provider, await options.resolveModel(provider, model, signal, reasoningEffort)) } : {}),
|
|
562
|
+
...(options.getLiveModel ? { getLiveModel: async (...args) => {
|
|
563
|
+
const live = await options.getLiveModel(...args);
|
|
558
564
|
return live ? { ...instrument(live.provider, live), provider: live.provider } : undefined;
|
|
559
565
|
} } : {}),
|
|
560
566
|
task: invocationTask,
|
|
@@ -1162,7 +1168,7 @@ export async function runGraph(graph, options) {
|
|
|
1162
1168
|
endOn(result, {});
|
|
1163
1169
|
else
|
|
1164
1170
|
endOn(result, {
|
|
1165
|
-
failureCode: recordErrorOnce(result.telemetry
|
|
1171
|
+
failureCode: recordErrorOnce(result.telemetry, error, runFailureCode(error)),
|
|
1166
1172
|
...(error instanceof ProviderRequestError ? { providerRequestFailed: true, ...(error.contextOverflow ? { providerOverflow: true } : {}) } : {}),
|
|
1167
1173
|
});
|
|
1168
1174
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
|
-
export declare function currentGraphSubject(
|
|
2
|
+
export declare function currentGraphSubject(options?: {
|
|
3
|
+
readOnly?: boolean;
|
|
4
|
+
}): Promise<string | undefined>;
|
|
3
5
|
export declare function identityStillHolds(declared: {
|
|
4
6
|
subject?: string;
|
|
5
7
|
signedOut?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAuthStatus } from './auth/index.js';
|
|
2
2
|
import { currentGraphSelection } from './membership.js';
|
|
3
|
-
export async function currentGraphSubject() {
|
|
4
|
-
const status = await getAuthStatus().catch(() => ({ signedIn: false, subject: undefined }));
|
|
3
|
+
export async function currentGraphSubject(options) {
|
|
4
|
+
const status = await getAuthStatus(undefined, options).catch(() => ({ signedIn: false, subject: undefined }));
|
|
5
5
|
return status.signedIn && status.subject && /^[A-Za-z0-9-]{1,128}$/.test(status.subject) ? status.subject : undefined;
|
|
6
6
|
}
|
|
7
7
|
export function identityStillHolds(declared, current) {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import type { LegalDependencies } from './legal/client.js';
|
|
1
2
|
import { type Config } from './config.js';
|
|
2
3
|
import { type Membership } from './membership.js';
|
|
3
4
|
import { GraphSync } from './graph-sync.js';
|
|
4
5
|
import { GraphManagerChat, type ManagerGraphRevision } from './graph-manager-chat.js';
|
|
5
6
|
export declare function readManagerGraphRevision(id: string, graphDirectory: string): Promise<ManagerGraphRevision | undefined>;
|
|
6
7
|
export type GraphManagerChatSession = Pick<GraphManagerChat, 'subscribe' | 'send' | 'approve' | 'answer' | 'cancel' | 'reset' | 'close'>;
|
|
7
|
-
export declare function createGraphSessionCheck(subject: string | undefined, status?: (signal?: AbortSignal
|
|
8
|
+
export declare function createGraphSessionCheck(subject: string | undefined, status?: (signal?: AbortSignal, options?: {
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}) => Promise<import("./auth/types.js").AuthStatus>, membership?: () => Promise<Membership>): () => Promise<void>;
|
|
8
11
|
export declare const EDITOR_MEMBERSHIP_TTL_MS = 30000;
|
|
9
12
|
export declare function sharedRead<T>(read: () => Promise<T>, ttlMs: number, now?: () => number): () => Promise<T>;
|
|
10
13
|
export declare function requireGraphProviders(directory?: string): Promise<Config>;
|
|
14
|
+
/** Only the authenticated desktop RPC may select an additional, exact loopback origin. */
|
|
15
|
+
export declare function graphEditorParentOrigins(value: unknown): string[];
|
|
11
16
|
export declare function startGraphServer(directory?: string, checkMembership?: () => Promise<unknown>, options?: {
|
|
17
|
+
parentOrigin?: string;
|
|
18
|
+
legal?: LegalDependencies;
|
|
12
19
|
membership?: () => Promise<Membership>;
|
|
13
20
|
sync?: GraphSync;
|
|
14
21
|
managerChat?: (directory: string, graphId: string) => GraphManagerChatSession;
|