@andorra-labs/code 0.1.18 → 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 +347 -45
- 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/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 +23 -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 +3 -1
- package/dist/src/app-server/workspace.js +39 -8
- package/dist/src/app-server.d.ts +50 -25
- package/dist/src/app-server.js +1008 -400
- 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/benchmark-scores.d.ts +88 -0
- package/dist/src/benchmark-scores.js +302 -0
- package/dist/src/bridge/command.js +4 -1
- package/dist/src/bridge/control.js +2 -1
- package/dist/src/bridge/engines.d.ts +2 -0
- package/dist/src/bridge/engines.js +9 -0
- package/dist/src/bridge/host-ops.d.ts +2 -2
- package/dist/src/bridge/host-ops.js +4 -2
- package/dist/src/bridge/host.d.ts +2 -0
- package/dist/src/bridge/host.js +63 -12
- 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/claude-provider.d.ts +1 -0
- package/dist/src/claude-provider.js +77 -36
- package/dist/src/cli.js +235 -58
- package/dist/src/codex-provider.d.ts +1 -0
- package/dist/src/codex-provider.js +43 -7
- package/dist/src/coding-tools.d.ts +1 -0
- package/dist/src/coding-tools.js +19 -5
- package/dist/src/command-screens.d.ts +1 -1
- package/dist/src/command-screens.js +2 -2
- package/dist/src/commands.d.ts +8 -1
- package/dist/src/commands.js +67 -63
- package/dist/src/completion.js +5 -3
- package/dist/src/config.d.ts +14 -3
- package/dist/src/config.js +54 -16
- package/dist/src/context-budget.d.ts +11 -2
- package/dist/src/context-budget.js +23 -2
- 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/DecisionManager.d.ts +5 -0
- package/dist/src/decision/DecisionManager.js +39 -2
- package/dist/src/decision/applyToolMenu.js +6 -2
- package/dist/src/decision/hostedPolicy.js +6 -4
- 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 +2 -1
- package/dist/src/decision/providers/AndorraDecisionProvider.js +17 -7
- package/dist/src/decision/providers/index.js +1 -1
- package/dist/src/decision/toolFamilies.js +1 -1
- package/dist/src/decision/types.d.ts +2 -0
- package/dist/src/efficiency.d.ts +75 -1
- package/dist/src/efficiency.js +114 -3
- 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/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/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-runner.js +19 -13
- 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 +45 -10
- package/dist/src/graph-sync.d.ts +2 -1
- package/dist/src/graph-sync.js +13 -0
- package/dist/src/graph-ui/app.js +19 -8
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graphs.d.ts +17 -1
- package/dist/src/graphs.js +51 -5
- package/dist/src/grok-provider.js +17 -14
- package/dist/src/hardened-runtime.js +7 -4
- 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-metadata.js +3 -7
- 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 +13 -1
- package/dist/src/model-tiers.js +28 -4
- 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.js +42 -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 +3 -9
- package/dist/src/providers.js +181 -146
- 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 +82 -66
- package/dist/src/pull-requests.js +266 -276
- 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 +147 -56
- 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 +85 -18
- 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 +18 -1
- package/dist/src/runtime.js +25 -7
- package/dist/src/session-summary.d.ts +8 -0
- package/dist/src/session-summary.js +34 -0
- package/dist/src/sessions.d.ts +8 -0
- package/dist/src/sessions.js +12 -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/graph-manager/SKILL.md +2 -2
- package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
- package/dist/src/skills/bundled/provenance.json +2 -2
- 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 +20 -4
- package/dist/src/task-checkout.js +78 -8
- 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/thinking-level-detect.d.ts +3 -1
- package/dist/src/thinking-level-detect.js +8 -3
- package/dist/src/thinking-levels.d.ts +1 -1
- package/dist/src/thinking-levels.js +11 -4
- package/dist/src/timers.d.ts +2 -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/tools.js +67 -22
- package/dist/src/transcript.js +2 -1
- package/dist/src/types.d.ts +14 -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
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { configDirectory } from '../config.js';
|
|
2
|
+
import { LEGAL_MANIFEST } from './manifest.js';
|
|
3
|
+
import { legalStatus, acceptLegal } from './gate.js';
|
|
4
|
+
import { legalDocument, legalPlainText } from './documents.js';
|
|
5
|
+
export const LEGAL_HELP = 'Usage: andorra legal status | andorra legal view terms|privacy | andorra legal accept\nAcceptance is separate from telemetry permission. No unattended acceptance flag exists.';
|
|
6
|
+
export function legalNotice(scope) {
|
|
7
|
+
const m = LEGAL_MANIFEST;
|
|
8
|
+
return `Review Andorra policies (staged release; effective December 16, 2026).\n${m.wording.terms}\n${m.wording.privacy}\n${m.wording.age}\n${m.wording.separation}\nTerms: andorra legal view terms (https://andorracode.com${m.documents.terms.path})\nPrivacy: andorra legal view privacy (https://andorracode.com${m.documents.privacy.path})\nRelease: ${m.releaseId}\n${scope === 'account' ? 'This confirmation is for the signed-in account; a server save is required.' : 'Signed-out acceptance is saved only on this installation.'}\nEarlier documents apply until the approved cutover and required acceptance; this records no training consent.`;
|
|
9
|
+
}
|
|
10
|
+
export async function executeLegalCommand(args, home = configDirectory(), io = {}, deps = {}) {
|
|
11
|
+
if (args.length === 2 && args[0] === 'view' && ['terms', 'privacy'].includes(args[1]))
|
|
12
|
+
return { code: 0, text: legalPlainText(await legalDocument(args[1])) };
|
|
13
|
+
if (args.length !== 1 || !['status', 'accept'].includes(args[0]))
|
|
14
|
+
return { code: args.includes('--help') ? 0 : 1, text: LEGAL_HELP };
|
|
15
|
+
const status = await legalStatus(home, deps, true);
|
|
16
|
+
if (args[0] === 'status')
|
|
17
|
+
return { code: 0, text: JSON.stringify(status, null, 2) };
|
|
18
|
+
if (status.scope === 'unavailable' || (status.scope === 'account' && status.server === 'unavailable' && !status.accepted))
|
|
19
|
+
return { code: 3, text: `Account/policy acceptance unavailable: ${status.problem ?? 'Reconnect and retry andorra legal status, then andorra legal accept.'} No new receipt was saved. Sign-out and privacy controls remain available.` };
|
|
20
|
+
if (!io.interactive || !io.ask)
|
|
21
|
+
return { code: 3, text: 'Policy acceptance requires a terminal. Run andorra legal accept interactively; protocol input is never read.' };
|
|
22
|
+
const answer = await io.ask(legalNotice(status.scope)).catch(() => undefined);
|
|
23
|
+
if (answer !== 'accept')
|
|
24
|
+
return { code: 3, text: 'Acceptance cancelled. No new receipt was saved. Help, policies, sign-out and privacy controls remain available.' };
|
|
25
|
+
try {
|
|
26
|
+
const saved = await acceptLegal({ releaseId: LEGAL_MANIFEST.releaseId, expectedSubject: status.subject ?? null, confirmed: true }, home, deps);
|
|
27
|
+
if (!saved.accepted)
|
|
28
|
+
return { code: 3, text: `Acceptance not confirmed: ${saved.problem ?? 'retry legal status/accept for the current account'}. Privacy controls remain available.` };
|
|
29
|
+
return { code: 0, text: `Acceptance saved (${saved.scope}). Privacy choices remain separate. Release ${saved.manifest.releaseId}. Staged evidence is not activation; effective December 16, 2026 only at the approved cutover.` };
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return { code: 3, text: `Acceptance not confirmed: ${error instanceof Error ? error.message : 'save unavailable'}. Retry legal status/accept; privacy controls remain available.` };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Fresh TTY action only. Drain Node and OS type-ahead before arming; EOF/Escape/Ctrl+C never accept. */
|
|
36
|
+
export function terminalLegalChoice() {
|
|
37
|
+
const interactive = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
38
|
+
return { interactive, ask: async (notice) => {
|
|
39
|
+
if (!interactive || process.stdin.readableEnded || process.stdin.destroyed)
|
|
40
|
+
return undefined;
|
|
41
|
+
const input = process.stdin, raw = input.isRaw, flowing = input.readableFlowing;
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
let value = '', settled = false, armed = false;
|
|
44
|
+
let ready;
|
|
45
|
+
const done = (answer) => {
|
|
46
|
+
if (settled)
|
|
47
|
+
return;
|
|
48
|
+
settled = true;
|
|
49
|
+
clearTimeout(ready);
|
|
50
|
+
input.removeListener('data', data);
|
|
51
|
+
input.removeListener('end', end);
|
|
52
|
+
input.removeListener('error', end);
|
|
53
|
+
process.removeListener('SIGINT', end);
|
|
54
|
+
process.removeListener('SIGTERM', end);
|
|
55
|
+
input.setRawMode(raw);
|
|
56
|
+
if (flowing !== true)
|
|
57
|
+
input.pause();
|
|
58
|
+
process.stdout.write('\n');
|
|
59
|
+
resolve(answer);
|
|
60
|
+
};
|
|
61
|
+
const end = () => done();
|
|
62
|
+
const data = (chunk) => {
|
|
63
|
+
for (const char of chunk.toString()) {
|
|
64
|
+
if (['\u001b', '\u0003', '\u0004'].includes(char)) {
|
|
65
|
+
done();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!armed)
|
|
69
|
+
continue;
|
|
70
|
+
if (char === '\r' || char === '\n') {
|
|
71
|
+
done(value);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (char === '\u007f' || char === '\b') {
|
|
75
|
+
value = value.slice(0, -1);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (value.length >= 32 || char < ' ') {
|
|
79
|
+
done();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
value += char;
|
|
83
|
+
process.stdout.write(char);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
input.on('data', data);
|
|
87
|
+
input.once('end', end);
|
|
88
|
+
input.once('error', end);
|
|
89
|
+
process.once('SIGINT', end);
|
|
90
|
+
process.once('SIGTERM', end);
|
|
91
|
+
input.setRawMode(true);
|
|
92
|
+
while (input.read() !== null) { /* unarmed */ }
|
|
93
|
+
input.resume();
|
|
94
|
+
process.stdout.write(notice + '\n');
|
|
95
|
+
ready = setTimeout(() => { while (input.read() !== null) { /* unarmed */ } armed = true; process.stdout.write('Type accept to confirm all statements, or cancel to leave: '); }, 100);
|
|
96
|
+
});
|
|
97
|
+
} };
|
|
98
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { LEGAL_MANIFEST } from './manifest.js';
|
|
4
|
+
export async function legalDocument(kind) {
|
|
5
|
+
if (!['terms', 'privacy'].includes(kind))
|
|
6
|
+
throw new Error('Choose terms or privacy');
|
|
7
|
+
const html = await readFile(new URL(`../../legal/2026-12-16/${kind}.html`, import.meta.url), 'utf8');
|
|
8
|
+
if (createHash('sha256').update(html).digest('hex') !== LEGAL_MANIFEST.documents[kind].sha256)
|
|
9
|
+
throw new Error('Bundled legal document digest mismatch; update this installation.');
|
|
10
|
+
return html;
|
|
11
|
+
}
|
|
12
|
+
export function legalPlainText(html) {
|
|
13
|
+
return html.replace(/<[^>]+>/g, '\n').replace(/"/g, '"').replace(/'|'/g, "'").replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n{3,}/g, '\n\n').trim();
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LegalSurface } from './manifest.js';
|
|
2
|
+
import { type LegalDependencies } from './client.js';
|
|
3
|
+
import type { LegalStatus, LegalAcceptParams } from '../app-server/legal-protocol.js';
|
|
4
|
+
export declare class LegalAcceptanceRequired extends Error {
|
|
5
|
+
readonly code = "legal-acceptance-required";
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function legalStatus(home?: string, deps?: LegalDependencies, refreshServer?: boolean): Promise<LegalStatus>;
|
|
9
|
+
export declare function acceptLegal(params: LegalAcceptParams, home?: string, deps?: LegalDependencies, surface?: LegalSurface): Promise<LegalStatus>;
|
|
10
|
+
/** Policy acceptance is not asked for in this release: the documents are drafts and the gate is switched off. */
|
|
11
|
+
export declare const LEGAL_ACCEPTANCE_REQUIRED = false;
|
|
12
|
+
export declare function requireLegalAcceptance(home?: string, deps?: LegalDependencies): Promise<void>;
|
|
13
|
+
export { legalMethodRequiresAcceptance } from '../app-server/legal-protocol.js';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { configDirectory } from '../config.js';
|
|
2
|
+
import { LEGAL_MANIFEST, acceptancePayload } from './manifest.js';
|
|
3
|
+
import { readLocalReceipt, readAccountReceipt, saveLocalReceipt, cacheAccountReceipt } from './receipt.js';
|
|
4
|
+
import { acceptanceRequest, legalAuthStatus, legalClientVersion } from './client.js';
|
|
5
|
+
export class LegalAcceptanceRequired extends Error {
|
|
6
|
+
code = 'legal-acceptance-required';
|
|
7
|
+
constructor(message = 'Policy acceptance required. Run andorra legal accept in a terminal, or review the desktop policy dialog. Help, andorra legal status/view, login/logout and privacy controls remain available.') { super(message); }
|
|
8
|
+
}
|
|
9
|
+
const releaseStatus = { stage: LEGAL_MANIFEST.stage, effectiveAt: LEGAL_MANIFEST.effectiveAt, mode: 'not-checked', effective: null };
|
|
10
|
+
export async function legalStatus(home = configDirectory(), deps = {}, refreshServer = false) {
|
|
11
|
+
const base = { manifest: LEGAL_MANIFEST, activation: releaseStatus, accepted: false, hostedAccepted: false, server: 'not-checked' };
|
|
12
|
+
// Account changes invalidate every result, including cached success. Preserve the caller's refresh
|
|
13
|
+
// intent on each retry and bound churn rather than recursively dropping into a cached-only read.
|
|
14
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
15
|
+
try {
|
|
16
|
+
const auth = await legalAuthStatus(deps);
|
|
17
|
+
if (auth.signedIn && !auth.subject)
|
|
18
|
+
throw new Error('Account identity unavailable');
|
|
19
|
+
const subject = auth.signedIn ? auth.subject : undefined;
|
|
20
|
+
if (!subject) {
|
|
21
|
+
const receipt = await readLocalReceipt(home);
|
|
22
|
+
if ((await legalAuthStatus(deps)).signedIn)
|
|
23
|
+
continue;
|
|
24
|
+
return { ...base, scope: 'local', accepted: !!receipt, ...(receipt ? { receipt } : {}) };
|
|
25
|
+
}
|
|
26
|
+
const receipt = await readAccountReceipt(home, subject);
|
|
27
|
+
const afterRead = await legalAuthStatus(deps);
|
|
28
|
+
if (!afterRead.signedIn || afterRead.subject !== subject)
|
|
29
|
+
continue;
|
|
30
|
+
const cached = { ...base, scope: 'account', subject, accepted: !!receipt, ...(receipt ? { receipt } : {}) };
|
|
31
|
+
if (!refreshServer)
|
|
32
|
+
return cached;
|
|
33
|
+
try {
|
|
34
|
+
const result = await acceptanceRequest(subject, undefined, deps);
|
|
35
|
+
const current = await legalAuthStatus(deps);
|
|
36
|
+
if (!current.signedIn || current.subject !== subject)
|
|
37
|
+
continue;
|
|
38
|
+
if (result.receipt)
|
|
39
|
+
await cacheAccountReceipt(home, subject, result.receipt);
|
|
40
|
+
const afterCache = await legalAuthStatus(deps);
|
|
41
|
+
if (!afterCache.signedIn || afterCache.subject !== subject)
|
|
42
|
+
continue;
|
|
43
|
+
return { ...cached, activation: result.activation, accepted: result.accepted, hostedAccepted: result.accepted, server: 'confirmed', receipt: result.receipt };
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const current = await legalAuthStatus(deps);
|
|
47
|
+
if (!current.signedIn || current.subject !== subject)
|
|
48
|
+
continue;
|
|
49
|
+
return { ...cached, server: 'unavailable', problem: error instanceof Error ? error.message : 'Account acceptance unavailable' };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return { ...base, scope: 'unavailable', problem: error instanceof Error ? error.message : 'Acceptance state unavailable' };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { ...base, scope: 'unavailable', server: 'unavailable', problem: 'Account changed repeatedly while checking policy acceptance. Stop switching accounts and retry legal status/accept for the current account.' };
|
|
57
|
+
}
|
|
58
|
+
export async function acceptLegal(params, home = configDirectory(), deps = {}, surface = 'cli') {
|
|
59
|
+
if (params.confirmed !== true)
|
|
60
|
+
throw new Error('An affirmative acceptance action is required.');
|
|
61
|
+
if (params.releaseId !== LEGAL_MANIFEST.releaseId)
|
|
62
|
+
throw new Error('Legal documents changed; review again.');
|
|
63
|
+
const auth = await legalAuthStatus(deps);
|
|
64
|
+
const subject = auth.signedIn ? auth.subject : undefined;
|
|
65
|
+
if ((auth.signedIn && !subject) || (subject ?? null) !== params.expectedSubject)
|
|
66
|
+
throw new Error('Account changed; review acceptance again.');
|
|
67
|
+
const payload = acceptancePayload(surface, await legalClientVersion());
|
|
68
|
+
if (subject) {
|
|
69
|
+
const result = await acceptanceRequest(subject, payload, deps);
|
|
70
|
+
const current = await legalAuthStatus(deps);
|
|
71
|
+
if (!current.signedIn || current.subject !== subject)
|
|
72
|
+
throw new Error('Account changed; review acceptance again.');
|
|
73
|
+
if (!result.receipt)
|
|
74
|
+
throw new Error('Acceptance not saved; hosted features remain blocked.');
|
|
75
|
+
await cacheAccountReceipt(home, subject, result.receipt);
|
|
76
|
+
const afterCache = await legalAuthStatus(deps);
|
|
77
|
+
if (!afterCache.signedIn || afterCache.subject !== subject)
|
|
78
|
+
throw new Error('Account changed; review acceptance again.');
|
|
79
|
+
return { manifest: LEGAL_MANIFEST, activation: result.activation, scope: 'account', subject, receipt: result.receipt, accepted: true, hostedAccepted: true, server: 'confirmed' };
|
|
80
|
+
}
|
|
81
|
+
await saveLocalReceipt(home, payload);
|
|
82
|
+
const current = await legalAuthStatus(deps);
|
|
83
|
+
if (current.signedIn)
|
|
84
|
+
throw new Error('Account changed; only a signed-out local receipt was saved. Review again for your account.');
|
|
85
|
+
return legalStatus(home, deps);
|
|
86
|
+
}
|
|
87
|
+
/** Policy acceptance is not asked for in this release: the documents are drafts and the gate is switched off. */
|
|
88
|
+
export const LEGAL_ACCEPTANCE_REQUIRED = false;
|
|
89
|
+
export async function requireLegalAcceptance(home = configDirectory(), deps = {}) {
|
|
90
|
+
if (!LEGAL_ACCEPTANCE_REQUIRED)
|
|
91
|
+
return;
|
|
92
|
+
const status = await legalStatus(home, deps);
|
|
93
|
+
if (!status.accepted)
|
|
94
|
+
throw new LegalAcceptanceRequired(status.problem ? `Policy acceptance unavailable: ${status.problem} Run andorra legal status, then andorra legal accept; privacy controls remain available.` : undefined);
|
|
95
|
+
}
|
|
96
|
+
export { legalMethodRequiresAcceptance } from '../app-server/legal-protocol.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LEGAL_MANIFEST } from './release.js';
|
|
2
|
+
export { LEGAL_MANIFEST };
|
|
3
|
+
export declare const LEGAL_ACCEPTANCE_CAPABILITY = "legal.acceptance.v1";
|
|
4
|
+
export type LegalSurface = 'cli' | 'desktop' | 'website';
|
|
5
|
+
export interface LegalAcceptancePayload {
|
|
6
|
+
releaseId: string;
|
|
7
|
+
documents: Record<'terms' | 'privacy', {
|
|
8
|
+
version: string;
|
|
9
|
+
sha256: string;
|
|
10
|
+
}>;
|
|
11
|
+
wordingVersion: string;
|
|
12
|
+
action: 'accept';
|
|
13
|
+
termsAccepted: true;
|
|
14
|
+
privacyAcknowledged: true;
|
|
15
|
+
ageConfirmed: true;
|
|
16
|
+
surface: LegalSurface;
|
|
17
|
+
clientVersion: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function legalEvidence(): LegalAcceptancePayload['documents'];
|
|
20
|
+
export declare function acceptancePayload(surface: LegalSurface, clientVersion: string): LegalAcceptancePayload;
|
|
21
|
+
export declare function payloadMatches(value: unknown): value is LegalAcceptancePayload;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LEGAL_MANIFEST } from './release.js';
|
|
2
|
+
export { LEGAL_MANIFEST };
|
|
3
|
+
export const LEGAL_ACCEPTANCE_CAPABILITY = 'legal.acceptance.v1';
|
|
4
|
+
export function legalEvidence() {
|
|
5
|
+
return Object.fromEntries(Object.entries(LEGAL_MANIFEST.documents).map(([kind, doc]) => [kind, { version: doc.version, sha256: doc.sha256 }]));
|
|
6
|
+
}
|
|
7
|
+
export function acceptancePayload(surface, clientVersion) {
|
|
8
|
+
return { releaseId: LEGAL_MANIFEST.releaseId, documents: legalEvidence(), wordingVersion: LEGAL_MANIFEST.wording.version,
|
|
9
|
+
action: 'accept', termsAccepted: true, privacyAcknowledged: true, ageConfirmed: true, surface, clientVersion };
|
|
10
|
+
}
|
|
11
|
+
export function payloadMatches(value) {
|
|
12
|
+
if (!value || typeof value !== 'object')
|
|
13
|
+
return false;
|
|
14
|
+
const v = value;
|
|
15
|
+
return v.releaseId === LEGAL_MANIFEST.releaseId && v.wordingVersion === LEGAL_MANIFEST.wording.version
|
|
16
|
+
&& ['terms', 'privacy'].every(kind => {
|
|
17
|
+
const key = kind;
|
|
18
|
+
const d = v.documents?.[key];
|
|
19
|
+
return d?.version === LEGAL_MANIFEST.documents[key].version && d?.sha256 === LEGAL_MANIFEST.documents[key].sha256;
|
|
20
|
+
})
|
|
21
|
+
&& v.action === 'accept' && v.termsAccepted === true && v.privacyAcknowledged === true && v.ageConfirmed === true
|
|
22
|
+
&& ['cli', 'desktop', 'website'].includes(v.surface) && typeof v.clientVersion === 'string' && /^[A-Za-z0-9.+_-]{1,64}$/.test(v.clientVersion);
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LegalAcceptancePayload } from './manifest.js';
|
|
2
|
+
export interface LegalReceipt extends LegalAcceptancePayload {
|
|
3
|
+
schemaVersion: 1;
|
|
4
|
+
acceptedAt: string;
|
|
5
|
+
scope?: 'local';
|
|
6
|
+
subject?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function receiptMatches(value: unknown, subject?: string): value is LegalReceipt;
|
|
9
|
+
export declare const readLocalReceipt: (home: string) => Promise<LegalReceipt | undefined>;
|
|
10
|
+
/** Display/local-use cache only: never passed as proof to the account service. */
|
|
11
|
+
export declare const readAccountReceipt: (home: string, subject: string) => Promise<LegalReceipt | undefined>;
|
|
12
|
+
export declare function saveLocalReceipt(home: string, payload: LegalAcceptancePayload): Promise<LegalReceipt>;
|
|
13
|
+
export declare function cacheAccountReceipt(home: string, subject: string, receipt: unknown): Promise<LegalReceipt>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { lstat, mkdir, open, link, rename, unlink } from 'node:fs/promises';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { withAuthLock } from '../auth/lock.js';
|
|
6
|
+
import { LEGAL_MANIFEST, payloadMatches } from './manifest.js';
|
|
7
|
+
export function receiptMatches(value, subject) {
|
|
8
|
+
if (!payloadMatches(value))
|
|
9
|
+
return false;
|
|
10
|
+
const v = value;
|
|
11
|
+
return v.schemaVersion === 1 && typeof v.acceptedAt === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(v.acceptedAt)
|
|
12
|
+
&& Number.isFinite(Date.parse(v.acceptedAt)) && (subject === undefined ? v.scope === 'local' && v.subject === undefined : v.subject === subject && v.scope === undefined);
|
|
13
|
+
}
|
|
14
|
+
async function receiptPath(home, subject, create = false) {
|
|
15
|
+
// The configured root may itself be a link. Never follow privacy/receipt entries below it.
|
|
16
|
+
const dirs = [join(home, 'legal'), join(home, 'legal', subject === undefined ? 'local' : 'accounts')];
|
|
17
|
+
if (create)
|
|
18
|
+
await mkdir(home, { recursive: true, mode: 0o700 });
|
|
19
|
+
for (const dir of dirs) {
|
|
20
|
+
if (create)
|
|
21
|
+
await mkdir(dir, { mode: 0o700 }).catch(error => { if (error.code !== 'EEXIST')
|
|
22
|
+
throw error; });
|
|
23
|
+
const s = await lstat(dir);
|
|
24
|
+
if (!s.isDirectory() || s.isSymbolicLink() || !privateOwner(s))
|
|
25
|
+
throw new Error(`Legal receipt directory is unsafe: ${dir}`);
|
|
26
|
+
}
|
|
27
|
+
const account = subject === undefined ? '' : createHash('sha256').update(subject).digest('hex') + '-';
|
|
28
|
+
return join(dirs[1], account + LEGAL_MANIFEST.releaseId + '.json');
|
|
29
|
+
}
|
|
30
|
+
async function readReceipt(home, subject) {
|
|
31
|
+
try {
|
|
32
|
+
const path = await receiptPath(home, subject);
|
|
33
|
+
const entry = await lstat(path);
|
|
34
|
+
if (!entry.isFile() || entry.isSymbolicLink())
|
|
35
|
+
return undefined;
|
|
36
|
+
const handle = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
37
|
+
try {
|
|
38
|
+
const st = await handle.stat();
|
|
39
|
+
if (!st.isFile() || !privateOwner(st) || st.size > 8192)
|
|
40
|
+
return undefined;
|
|
41
|
+
const buffer = Buffer.alloc(8193);
|
|
42
|
+
let bytesRead = 0;
|
|
43
|
+
for (;;) {
|
|
44
|
+
const part = await handle.read(buffer, bytesRead, buffer.length - bytesRead, null);
|
|
45
|
+
bytesRead += part.bytesRead;
|
|
46
|
+
if (!part.bytesRead || bytesRead > 8192)
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (bytesRead > 8192)
|
|
50
|
+
return undefined;
|
|
51
|
+
const v = JSON.parse(buffer.subarray(0, bytesRead).toString());
|
|
52
|
+
return receiptMatches(v, subject) ? v : undefined;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
await handle.close();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof SyntaxError || ['ENOENT', 'ELOOP'].includes(error.code ?? ''))
|
|
60
|
+
return undefined;
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const readLocalReceipt = (home) => readReceipt(home);
|
|
65
|
+
/** Display/local-use cache only: never passed as proof to the account service. */
|
|
66
|
+
export const readAccountReceipt = (home, subject) => readReceipt(home, subject);
|
|
67
|
+
async function appendReceipt(home, receipt, subject) {
|
|
68
|
+
// Reuse the existing OS-owned auth lifecycle lock: dead writers release it automatically, and
|
|
69
|
+
// cooperating retries cannot quarantine another writer's newly published valid evidence.
|
|
70
|
+
return withAuthLock(async () => {
|
|
71
|
+
const path = await receiptPath(home, subject, true);
|
|
72
|
+
const prior = await readReceipt(home, subject);
|
|
73
|
+
if (prior)
|
|
74
|
+
return prior; // First valid evidence is immutable, including its original timestamp.
|
|
75
|
+
try {
|
|
76
|
+
const entry = await lstat(path);
|
|
77
|
+
if (!entry.isFile() || entry.isSymbolicLink() || !privateOwner(entry))
|
|
78
|
+
throw new Error(`Unsafe legal receipt entry: ${path}. Remove the unsafe entry explicitly; no acceptance was saved.`);
|
|
79
|
+
const quarantine = `${path}.invalid-${randomUUID()}`;
|
|
80
|
+
await rename(path, quarantine);
|
|
81
|
+
throw new Error(`Invalid legal receipt quarantined at ${quarantine}. No acceptance was saved; retry explicit acceptance to create fresh evidence (or refresh account status to recover the server receipt).`);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
if (error.code !== 'ENOENT')
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
88
|
+
try {
|
|
89
|
+
const file = await open(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
|
|
90
|
+
try {
|
|
91
|
+
await file.writeFile(JSON.stringify(receipt) + '\n');
|
|
92
|
+
await file.sync();
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
await file.close();
|
|
96
|
+
}
|
|
97
|
+
// Publish only complete, synced bytes, without replacing an existing entry. An interrupted
|
|
98
|
+
// write leaves an inert uniquely named temp file, never a torn published receipt.
|
|
99
|
+
try {
|
|
100
|
+
await link(temporary, path);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error.code !== 'EEXIST')
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
if (process.platform !== 'win32') {
|
|
107
|
+
const directory = await open(dirname(path), constants.O_RDONLY);
|
|
108
|
+
try {
|
|
109
|
+
await directory.sync();
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
await directory.close();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const saved = await readReceipt(home, subject);
|
|
116
|
+
if (!saved)
|
|
117
|
+
throw new Error(`Legal receipt readback failed at ${path}; acceptance was not confirmed. Retry explicitly.`);
|
|
118
|
+
return saved;
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
await unlink(temporary).catch(() => { });
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function privateOwner(info) {
|
|
126
|
+
return process.platform === 'win32' || ((info.mode & 0o077) === 0 && (!process.getuid || info.uid === process.getuid()));
|
|
127
|
+
}
|
|
128
|
+
export async function saveLocalReceipt(home, payload) {
|
|
129
|
+
if (!payloadMatches(payload))
|
|
130
|
+
throw new Error('Legal documents changed; review again.');
|
|
131
|
+
return appendReceipt(home, { schemaVersion: 1, ...payload, scope: 'local', acceptedAt: new Date().toISOString() });
|
|
132
|
+
}
|
|
133
|
+
export async function cacheAccountReceipt(home, subject, receipt) {
|
|
134
|
+
if (!receiptMatches(receipt, subject))
|
|
135
|
+
throw new Error('Invalid authenticated acceptance response');
|
|
136
|
+
return appendReceipt(home, receipt, subject);
|
|
137
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const LEGAL_MANIFEST: {
|
|
2
|
+
readonly schemaVersion: 1;
|
|
3
|
+
readonly stage: "staged";
|
|
4
|
+
readonly effectiveAt: "2026-12-16T00:00:00Z";
|
|
5
|
+
readonly documents: {
|
|
6
|
+
readonly terms: {
|
|
7
|
+
readonly version: "2026-12-16";
|
|
8
|
+
readonly sha256: "7acadb8013e240e591c30420a66201e99f315ed336bd9d77722e18a67c554fd8";
|
|
9
|
+
readonly path: "/legal/2026-12-16/terms.html";
|
|
10
|
+
readonly title: "Terms of Use";
|
|
11
|
+
};
|
|
12
|
+
readonly privacy: {
|
|
13
|
+
readonly version: "2026-12-16";
|
|
14
|
+
readonly sha256: "ccbee20c94aacb74d27e829f9477bba3bd9f6a0a6d02946d6be6ff62d742a8a2";
|
|
15
|
+
readonly path: "/legal/2026-12-16/privacy.html";
|
|
16
|
+
readonly title: "Privacy Policy";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly wording: {
|
|
20
|
+
readonly version: "2026-12-16.1";
|
|
21
|
+
readonly terms: "I agree to the Terms of Use, including the US arbitration agreement and class-action waiver.";
|
|
22
|
+
readonly privacy: "I have read the Privacy Policy.";
|
|
23
|
+
readonly age: "I am 18 or older and have legal capacity to agree to the Terms of Use.";
|
|
24
|
+
readonly separation: "Acknowledging the Privacy Policy is not consent to telemetry. Any required privacy choices remain separate.";
|
|
25
|
+
};
|
|
26
|
+
readonly releaseId: "526f3988c8b9e5e17ee40c3600b378d6e4817e68f20cd19e51a3cfde8c9be223";
|
|
27
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Generated by website scripts/export-legal.mjs; staged, not activation approval.
|
|
2
|
+
export const LEGAL_MANIFEST = {
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"stage": "staged",
|
|
5
|
+
"effectiveAt": "2026-12-16T00:00:00Z",
|
|
6
|
+
"documents": {
|
|
7
|
+
"terms": {
|
|
8
|
+
"version": "2026-12-16",
|
|
9
|
+
"sha256": "7acadb8013e240e591c30420a66201e99f315ed336bd9d77722e18a67c554fd8",
|
|
10
|
+
"path": "/legal/2026-12-16/terms.html",
|
|
11
|
+
"title": "Terms of Use"
|
|
12
|
+
},
|
|
13
|
+
"privacy": {
|
|
14
|
+
"version": "2026-12-16",
|
|
15
|
+
"sha256": "ccbee20c94aacb74d27e829f9477bba3bd9f6a0a6d02946d6be6ff62d742a8a2",
|
|
16
|
+
"path": "/legal/2026-12-16/privacy.html",
|
|
17
|
+
"title": "Privacy Policy"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"wording": {
|
|
21
|
+
"version": "2026-12-16.1",
|
|
22
|
+
"terms": "I agree to the Terms of Use, including the US arbitration agreement and class-action waiver.",
|
|
23
|
+
"privacy": "I have read the Privacy Policy.",
|
|
24
|
+
"age": "I am 18 or older and have legal capacity to agree to the Terms of Use.",
|
|
25
|
+
"separation": "Acknowledging the Privacy Policy is not consent to telemetry. Any required privacy choices remain separate."
|
|
26
|
+
},
|
|
27
|
+
"releaseId": "526f3988c8b9e5e17ee40c3600b378d6e4817e68f20cd19e51a3cfde8c9be223"
|
|
28
|
+
};
|
|
@@ -2,7 +2,6 @@ import { CliSignIn, type ManagedSignInState } from './cli-sign-in.js';
|
|
|
2
2
|
import { type OpenCodeServerLike, type OpenCodeSignInOption } from './opencode-cli-provider.js';
|
|
3
3
|
export declare function claudeSignIn(): CliSignIn;
|
|
4
4
|
export declare function grokSignIn(): CliSignIn;
|
|
5
|
-
export declare function googleSignIn(): CliSignIn;
|
|
6
5
|
export interface OpenCodeSignInState extends ManagedSignInState {
|
|
7
6
|
connected?: {
|
|
8
7
|
id: string;
|
|
@@ -2,7 +2,6 @@ import { resolveCliExecutable } from './cli-executable.js';
|
|
|
2
2
|
import { CliSignIn } from './cli-sign-in.js';
|
|
3
3
|
import { claudeEnvironment, readClaudeSignIn } from './claude-provider.js';
|
|
4
4
|
import { resolveClaudeExecutable } from './claude-executable.js';
|
|
5
|
-
import { GOOGLE_EXECUTABLE, googleEnvironment, readGoogleCatalog } from './google-provider.js';
|
|
6
5
|
import { GROK_EXECUTABLE, grokEnvironment, readGrokCatalog } from './grok-provider.js';
|
|
7
6
|
import { authorizeOpenCode, completeOpenCode, listOpenCodeSignIns, readOpenCodeCatalog, sharedOpenCodeServer, signOutOpenCode, } from './opencode-cli-provider.js';
|
|
8
7
|
export function claudeSignIn() {
|
|
@@ -29,18 +28,6 @@ export function grokSignIn() {
|
|
|
29
28
|
deviceCode: true,
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
|
-
export function googleSignIn() {
|
|
33
|
-
return new CliSignIn({
|
|
34
|
-
product: 'Google',
|
|
35
|
-
resolveExecutable: () => resolveCliExecutable(GOOGLE_EXECUTABLE),
|
|
36
|
-
env: () => googleEnvironment(),
|
|
37
|
-
loginArgs: ['acp', '--login'],
|
|
38
|
-
signOutHint: 'The Antigravity CLI signs out only from inside it: run agy in a terminal, type /logout, then refresh here.',
|
|
39
|
-
status: signal => readGoogleCatalog(signal),
|
|
40
|
-
pageHosts: ['accounts.google.com'],
|
|
41
|
-
acceptsCode: true,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
31
|
export class OpenCodeSignIn {
|
|
45
32
|
server;
|
|
46
33
|
attempt;
|
package/dist/src/membership.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type Graph } from './graphs.js';
|
|
2
2
|
import { readOfflinePlan } from './plan-pass.js';
|
|
3
3
|
import type { TelemetryPlan } from './telemetry/schema.js';
|
|
4
|
+
import { type TelemetryPermissionInput } from './telemetry/permission.js';
|
|
4
5
|
export declare const SOFTWARE_ENGINEER_HARNESS: Graph;
|
|
5
6
|
export declare const RETIRED_ANDORRA_SELECTION = ":andorra";
|
|
6
7
|
export declare function currentGraphSelection(id: string): string;
|
|
7
8
|
export type MembershipFailureReason = 'tls' | 'dns' | 'network';
|
|
8
|
-
export type MembershipTier = 'free' | 'legacy' | 'paid';
|
|
9
|
+
export type MembershipTier = 'free' | 'legacy' | 'paid' | 'plus' | 'ultra' | 'max';
|
|
9
10
|
export declare const MEMBERSHIP_TIERS: readonly MembershipTier[];
|
|
10
11
|
export declare function windowFields(result: Record<string, unknown>): Pick<Membership, 'fairUse' | 'windowDays' | 'windowDecisionLimit' | 'windowDecisionUsed' | 'windowDecisionResetsAt'>;
|
|
11
12
|
export interface Membership {
|
|
@@ -20,6 +21,9 @@ export interface Membership {
|
|
|
20
21
|
dailyDecisionUsed?: number;
|
|
21
22
|
dailyDecisionResetsAt?: string;
|
|
22
23
|
decisionsSinceRollout?: number;
|
|
24
|
+
jevSavingsGeneration?: string;
|
|
25
|
+
/** The operator switch that lets signed-out users get Jev is on; set by `withAnonymousJev`. */
|
|
26
|
+
anonymousJev?: true;
|
|
23
27
|
/**
|
|
24
28
|
* The rolling allowance: Free accounts get `windowDecisionLimit` decisions per `windowDays` UTC days;
|
|
25
29
|
* Legacy accounts are unlimited under fair use (`fairUse`), with a daily and a window cap.
|
|
@@ -51,6 +55,8 @@ export interface MembershipDependencies {
|
|
|
51
55
|
apiBaseUrl(): string;
|
|
52
56
|
fetch: typeof globalThis.fetch;
|
|
53
57
|
recordPlan?: (answer: PlanConfirmation, home?: string) => Promise<void>;
|
|
58
|
+
/** Inject complete signals in tests rather than depending on the test machine's location. */
|
|
59
|
+
telemetrySignals?: TelemetryPermissionInput['signals'];
|
|
54
60
|
/** Keeps the signed pass an answer carried, for use while the service is unreachable. */
|
|
55
61
|
storePass?: (pass: unknown, subject: string, home: string, serverTime: number | undefined, plan: {
|
|
56
62
|
paid: boolean;
|
|
@@ -72,6 +78,26 @@ export declare function createGraphMembership(deps: {
|
|
|
72
78
|
readPlan?: typeof readOfflinePlan;
|
|
73
79
|
}): (signal?: AbortSignal, home?: string) => Promise<Membership>;
|
|
74
80
|
export declare const getGraphMembership: (signal?: AbortSignal, home?: string) => Promise<Membership>;
|
|
81
|
+
/** Clears the in-memory switch answer; the stored answer on disk stands. For tests. */
|
|
82
|
+
export declare function resetAnonymousJevCache(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the service currently serves Jev to users who are not signed in.
|
|
85
|
+
*
|
|
86
|
+
* An operator switch (`config#jev-guest` in the account service) is served on an unauthenticated
|
|
87
|
+
* route, so the answer carries no account and is safe to ask before any sign-in. The answer is kept
|
|
88
|
+
* for four hours on disk in the config directory — shared by every process on the machine — so the
|
|
89
|
+
* switch is asked over the network at most once per machine per four hours, never once per call;
|
|
90
|
+
* this process also keeps the answer in memory for a minute so it does not re-read the file. A
|
|
91
|
+
* read, parse or shape failure reads as off and is retried after a minute, without extending the
|
|
92
|
+
* stored answer: a network outage must not cost a user four hours.
|
|
93
|
+
*/
|
|
94
|
+
export declare function anonymousJevAllowed(signal?: AbortSignal, home?: string): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* The membership a decision policy should see. While the service allows signed-out Jev, a signed-out
|
|
97
|
+
* answer is marked `anonymousJev`, which turns the hosted provider back on without an account: no
|
|
98
|
+
* plan, no limits, no savings sync. A signed-in answer is returned unchanged.
|
|
99
|
+
*/
|
|
100
|
+
export declare function withAnonymousJev(membership: Membership, signal?: AbortSignal, home?: string): Promise<Membership>;
|
|
75
101
|
export declare function requirePaidMembership(signal?: AbortSignal): Promise<void>;
|
|
76
102
|
export declare function requireGraphMembership(signal?: AbortSignal): Promise<void>;
|
|
77
103
|
export declare function readGraphMembership(signal?: AbortSignal): Promise<Membership>;
|