@andorra-labs/code 0.1.16 → 0.1.18
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/acp-agent.d.ts +6 -0
- package/dist/src/acp-agent.js +15 -4
- package/dist/src/agent-execution.js +108 -19
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +3 -0
- package/dist/src/agent-mcp.js +33 -1
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- package/dist/src/andorra/errors.js +3 -0
- package/dist/src/andorra/hosted.d.ts +2 -1
- package/dist/src/andorra/hosted.js +2 -1
- package/dist/src/andorra/notices.d.ts +5 -0
- package/dist/src/andorra/notices.js +7 -0
- package/dist/src/andorra/state.d.ts +3 -2
- package/dist/src/andorra/state.js +4 -4
- package/dist/src/andorra/terminal.js +7 -2
- package/dist/src/anthropic-credentials.js +2 -0
- package/dist/src/app-server/error.d.ts +5 -0
- package/dist/src/app-server/error.js +7 -0
- package/dist/src/app-server/protocol.d.ts +30 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +108 -0
- package/dist/src/app-server/workspace.js +608 -11
- package/dist/src/app-server.d.ts +390 -33
- package/dist/src/app-server.js +3033 -565
- package/dist/src/attachments.d.ts +10 -0
- package/dist/src/attachments.js +102 -7
- package/dist/src/automation-tool.js +2 -1
- package/dist/src/bridge/cloud.d.ts +27 -0
- package/dist/src/bridge/cloud.js +187 -0
- package/dist/src/bridge/command.d.ts +30 -0
- package/dist/src/bridge/command.js +359 -0
- package/dist/src/bridge/control.d.ts +70 -0
- package/dist/src/bridge/control.js +238 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -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 +9 -0
- package/dist/src/bridge/host-ops.js +139 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +543 -0
- package/dist/src/bridge/link.d.ts +38 -0
- package/dist/src/bridge/link.js +508 -0
- package/dist/src/bridge/login-link.d.ts +29 -0
- package/dist/src/bridge/login-link.js +54 -0
- package/dist/src/bridge/protocol.d.ts +136 -0
- package/dist/src/bridge/protocol.js +11 -0
- package/dist/src/bridge/store.d.ts +12 -0
- package/dist/src/bridge/store.js +61 -0
- package/dist/src/bridge/wording.d.ts +6 -0
- package/dist/src/bridge/wording.js +10 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/tokens.css +1 -1
- 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/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/cli.d.ts +1 -3
- package/dist/src/cli.js +191 -35
- package/dist/src/codex-provider.js +1 -1
- package/dist/src/coding-tools.js +24 -17
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +14 -11
- package/dist/src/commands.d.ts +15 -3
- package/dist/src/commands.js +2 -1
- package/dist/src/compaction-phrases.js +1 -1
- package/dist/src/completion.js +89 -8
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +205 -78
- package/dist/src/context-budget.js +15 -2
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/DecisionEngine.d.ts +2 -0
- package/dist/src/decision/DecisionManager.d.ts +11 -0
- package/dist/src/decision/DecisionManager.js +36 -0
- package/dist/src/decision/applyTaskKind.d.ts +8 -0
- package/dist/src/decision/applyTaskKind.js +53 -0
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/hostedPolicy.js +2 -1
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.js +12 -0
- package/dist/src/decision/requestPhrases.js +0 -1
- package/dist/src/decision/taskKind.d.ts +52 -0
- package/dist/src/decision/taskKind.js +76 -0
- package/dist/src/decision/types.d.ts +1 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/efficiency.d.ts +5 -0
- package/dist/src/efficiency.js +5 -1
- 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/file-diff.d.ts +4 -0
- package/dist/src/file-diff.js +2 -1
- package/dist/src/github-app/agent-writes.d.ts +102 -0
- package/dist/src/github-app/agent-writes.js +320 -0
- package/dist/src/github-app/client.d.ts +368 -0
- package/dist/src/github-app/client.js +830 -0
- package/dist/src/github-app/event-source.d.ts +208 -0
- package/dist/src/github-app/event-source.js +684 -0
- package/dist/src/github-app/metrics.d.ts +32 -0
- package/dist/src/github-app/metrics.js +49 -0
- package/dist/src/github-app/review-loop.d.ts +274 -0
- package/dist/src/github-app/review-loop.js +1177 -0
- package/dist/src/github-app/review-node.d.ts +81 -0
- package/dist/src/github-app/review-node.js +205 -0
- package/dist/src/github-app/review-post.d.ts +73 -0
- package/dist/src/github-app/review-post.js +139 -0
- package/dist/src/github-app/review-text.d.ts +107 -0
- package/dist/src/github-app/review-text.js +1133 -0
- package/dist/src/github-app/review-threads.d.ts +47 -0
- package/dist/src/github-app/review-threads.js +107 -0
- package/dist/src/github-app/reviewer.d.ts +121 -0
- package/dist/src/github-app/reviewer.js +598 -0
- package/dist/src/github-app/store.d.ts +59 -0
- package/dist/src/github-app/store.js +148 -0
- package/dist/src/github-app/triggers.d.ts +141 -0
- package/dist/src/github-app/triggers.js +441 -0
- package/dist/src/github-names.d.ts +15 -0
- package/dist/src/github-names.js +15 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +6 -1
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +48 -0
- package/dist/src/graph-preview.js +56 -0
- package/dist/src/graph-provider-portability.js +2 -1
- package/dist/src/graph-runner.js +65 -4
- package/dist/src/graph-server.js +7 -5
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +121 -7
- package/dist/src/graph-ui/icons.js +2 -1
- package/dist/src/graph-ui/studio.js +15 -1
- package/dist/src/graph-ui/tokens.css +1 -1
- package/dist/src/graphs.d.ts +40 -1
- package/dist/src/graphs.js +164 -15
- package/dist/src/hardened-runtime.js +32 -21
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +10 -0
- package/dist/src/membership.js +19 -4
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +6 -0
- package/dist/src/model-metadata.js +35 -15
- package/dist/src/model-override.d.ts +2 -1
- package/dist/src/model-override.js +9 -0
- package/dist/src/model-relay/local.d.ts +116 -0
- package/dist/src/model-relay/local.js +468 -0
- package/dist/src/model-relay/remote.d.ts +129 -0
- package/dist/src/model-relay/remote.js +252 -0
- package/dist/src/model-relay/runs.d.ts +34 -0
- package/dist/src/model-relay/runs.js +146 -0
- package/dist/src/model-relay/wire.d.ts +5 -0
- package/dist/src/model-relay/wire.js +5 -0
- package/dist/src/model-tiers.d.ts +3 -0
- package/dist/src/model-tiers.js +3 -3
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-engine.d.ts +13 -1
- package/dist/src/provider-engine.js +74 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +28 -2
- package/dist/src/providers.js +59 -12
- package/dist/src/pull-request-logs.d.ts +12 -1
- package/dist/src/pull-request-logs.js +14 -3
- package/dist/src/pull-requests.d.ts +338 -8
- package/dist/src/pull-requests.js +482 -53
- package/dist/src/react-runtime.js +99 -16
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +367 -90
- package/dist/src/remote/roots.d.ts +19 -0
- package/dist/src/remote/roots.js +45 -7
- package/dist/src/remote/types.d.ts +0 -44
- package/dist/src/run-control.d.ts +7 -0
- package/dist/src/run-control.js +23 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +34 -2
- package/dist/src/runtime.js +18 -2
- package/dist/src/session-changes.d.ts +35 -0
- package/dist/src/session-changes.js +194 -6
- package/dist/src/session-monitor.js +2 -1
- package/dist/src/session-reaper.d.ts +1 -1
- package/dist/src/session-reaper.js +6 -1
- package/dist/src/session-summary.d.ts +2 -1
- package/dist/src/session-summary.js +2 -1
- package/dist/src/sessions.d.ts +35 -1
- package/dist/src/sessions.js +70 -4
- package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
- package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
- package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/task-checkout.d.ts +141 -0
- package/dist/src/task-checkout.js +558 -0
- package/dist/src/telemetry/emitter.d.ts +15 -0
- package/dist/src/telemetry/emitter.js +35 -1
- package/dist/src/telemetry/schema.d.ts +25 -2
- package/dist/src/telemetry/schema.js +52 -4
- package/dist/src/telemetry/surface.d.ts +2 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/terminal-ui.d.ts +1 -0
- package/dist/src/terminal-ui.js +10 -3
- package/dist/src/test-edit-guard.d.ts +37 -0
- package/dist/src/test-edit-guard.js +216 -3
- package/dist/src/thinking-level-detect.d.ts +11 -0
- package/dist/src/thinking-level-detect.js +47 -0
- package/dist/src/thinking-levels.d.ts +30 -0
- package/dist/src/thinking-levels.js +124 -0
- package/dist/src/timers.d.ts +3 -0
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/tools.js +59 -9
- package/dist/src/transcript.js +1 -1
- package/dist/src/types.d.ts +34 -0
- package/package.json +6 -1
- package/dist/src/remote/cert.d.ts +0 -11
- package/dist/src/remote/cert.js +0 -87
- package/dist/src/remote/client.d.ts +0 -119
- package/dist/src/remote/client.js +0 -544
- package/dist/src/remote/command.d.ts +0 -4
- package/dist/src/remote/command.js +0 -194
- package/dist/src/remote/errors.d.ts +0 -11
- package/dist/src/remote/errors.js +0 -14
- package/dist/src/remote/network.d.ts +0 -22
- package/dist/src/remote/network.js +0 -102
- package/dist/src/remote/pairing.d.ts +0 -63
- package/dist/src/remote/pairing.js +0 -299
- package/dist/src/remote/pem.d.ts +0 -2
- package/dist/src/remote/pem.js +0 -7
- package/dist/src/remote/serve.d.ts +0 -68
- package/dist/src/remote/serve.js +0 -244
- package/dist/src/remote/server.d.ts +0 -21
- package/dist/src/remote/server.js +0 -406
|
@@ -6,4 +6,23 @@ export interface AuthorizedRoot {
|
|
|
6
6
|
kind: 'project' | 'share';
|
|
7
7
|
}
|
|
8
8
|
export declare function projectRootId(realPath: string): string;
|
|
9
|
+
/** Whether `path` is `folder` or lies inside it, compared by path segment (and without case on Windows). */
|
|
10
|
+
export declare function isInsideFolder(folder: string, path: string): boolean;
|
|
11
|
+
/** The folders this machine shares through `andorra bridge folders`, by real path; missing ones are left out. */
|
|
12
|
+
export declare function sharedFolders(config: Config): Promise<AuthorizedRoot[]>;
|
|
13
|
+
/**
|
|
14
|
+
* The real path of the directory at `path` when it lies inside a shared folder; `undefined` when it does not exist.
|
|
15
|
+
* Throws `outside` when the directory, or the path as written, is not inside any shared folder. Symbolic links are
|
|
16
|
+
* resolved first, so a link inside a folder that points out of it is outside.
|
|
17
|
+
*/
|
|
18
|
+
export declare function directoryInsideFolders(folders: AuthorizedRoot[], path: string): Promise<{
|
|
19
|
+
inside: true;
|
|
20
|
+
path: string;
|
|
21
|
+
} | {
|
|
22
|
+
inside: false;
|
|
23
|
+
} | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* What a desktop may reach on this machine: the shared folders, plus the configured projects whose real path lies
|
|
26
|
+
* inside one of them. With no folders shared, nothing.
|
|
27
|
+
*/
|
|
9
28
|
export declare function authorizedRoots(config: Config): Promise<AuthorizedRoot[]>;
|
package/dist/src/remote/roots.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { realpath, stat } from 'node:fs/promises';
|
|
3
|
-
import { basename } from 'node:path';
|
|
3
|
+
import { basename, isAbsolute, relative, sep } from 'node:path';
|
|
4
4
|
export function projectRootId(realPath) {
|
|
5
5
|
const canonical = process.platform === 'win32' ? realPath.toLowerCase() : realPath;
|
|
6
6
|
return `proj-${createHash('sha256').update(canonical).digest('hex').slice(0, 16)}`;
|
|
@@ -15,22 +15,60 @@ async function directoryAt(path) {
|
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
/** Whether `path` is `folder` or lies inside it, compared by path segment (and without case on Windows). */
|
|
19
|
+
export function isInsideFolder(folder, path) {
|
|
20
|
+
const fold = (value) => process.platform === 'win32' ? value.toLowerCase() : value;
|
|
21
|
+
const rel = relative(fold(folder), fold(path));
|
|
22
|
+
if (rel === '')
|
|
23
|
+
return true;
|
|
24
|
+
return !isAbsolute(rel) && rel.split(sep)[0] !== '..';
|
|
25
|
+
}
|
|
26
|
+
/** The folders this machine shares through `andorra bridge folders`, by real path; missing ones are left out. */
|
|
27
|
+
export async function sharedFolders(config) {
|
|
28
|
+
const folders = [];
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
for (const share of config.bridge?.folders ?? []) {
|
|
31
|
+
const realPath = await directoryAt(share.path);
|
|
32
|
+
if (!realPath || seen.has(realPath))
|
|
33
|
+
continue;
|
|
34
|
+
seen.add(realPath);
|
|
35
|
+
folders.push({ id: `share-${share.id}`, label: share.label?.trim() || basename(realPath) || realPath, path: realPath, kind: 'share' });
|
|
36
|
+
}
|
|
37
|
+
return folders;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The real path of the directory at `path` when it lies inside a shared folder; `undefined` when it does not exist.
|
|
41
|
+
* Throws `outside` when the directory, or the path as written, is not inside any shared folder. Symbolic links are
|
|
42
|
+
* resolved first, so a link inside a folder that points out of it is outside.
|
|
43
|
+
*/
|
|
44
|
+
export async function directoryInsideFolders(folders, path) {
|
|
45
|
+
const actual = await directoryAt(path);
|
|
46
|
+
if (actual === undefined)
|
|
47
|
+
return folders.some(folder => isInsideFolder(folder.path, path)) ? undefined : { inside: false };
|
|
48
|
+
return folders.some(folder => isInsideFolder(folder.path, actual)) ? { inside: true, path: actual } : { inside: false };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What a desktop may reach on this machine: the shared folders, plus the configured projects whose real path lies
|
|
52
|
+
* inside one of them. With no folders shared, nothing.
|
|
53
|
+
*/
|
|
18
54
|
export async function authorizedRoots(config) {
|
|
55
|
+
const folders = await sharedFolders(config);
|
|
56
|
+
if (folders.length === 0)
|
|
57
|
+
return [];
|
|
19
58
|
const roots = [];
|
|
20
59
|
const seen = new Set();
|
|
21
60
|
for (const project of config.projects ?? []) {
|
|
22
61
|
const realPath = await directoryAt(project.path);
|
|
23
|
-
if (!realPath || seen.has(realPath))
|
|
62
|
+
if (!realPath || seen.has(realPath) || !folders.some(folder => isInsideFolder(folder.path, realPath)))
|
|
24
63
|
continue;
|
|
25
64
|
seen.add(realPath);
|
|
26
65
|
roots.push({ id: projectRootId(realPath), label: project.name?.trim() || basename(realPath) || realPath, path: realPath, kind: 'project' });
|
|
27
66
|
}
|
|
28
|
-
for (const
|
|
29
|
-
|
|
30
|
-
if (!realPath || seen.has(realPath))
|
|
67
|
+
for (const folder of folders) {
|
|
68
|
+
if (seen.has(folder.path))
|
|
31
69
|
continue;
|
|
32
|
-
seen.add(
|
|
33
|
-
roots.push(
|
|
70
|
+
seen.add(folder.path);
|
|
71
|
+
roots.push(folder);
|
|
34
72
|
}
|
|
35
73
|
return roots;
|
|
36
74
|
}
|
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
export type RemoteTransport = 'https' | 'http';
|
|
2
|
-
export type RemoteGrant = 'browse' | 'full';
|
|
3
|
-
export interface RemoteDevice {
|
|
4
|
-
id: string;
|
|
5
|
-
token: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
addedAt: string;
|
|
8
|
-
lastSeenAt?: string;
|
|
9
|
-
grant?: RemoteGrant;
|
|
10
|
-
}
|
|
11
|
-
export interface RemoteInvitation {
|
|
12
|
-
token: string;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
expiresAt: string;
|
|
15
|
-
redeemedAt?: string;
|
|
16
|
-
grant?: RemoteGrant;
|
|
17
|
-
}
|
|
18
1
|
export interface RemoteShare {
|
|
19
2
|
id: string;
|
|
20
3
|
path: string;
|
|
21
4
|
label?: string;
|
|
22
5
|
}
|
|
23
|
-
export interface RemoteHosting {
|
|
24
|
-
installId?: string;
|
|
25
|
-
port?: number;
|
|
26
|
-
transport?: RemoteTransport;
|
|
27
|
-
invitation?: RemoteInvitation | null;
|
|
28
|
-
devices?: RemoteDevice[];
|
|
29
|
-
shares?: RemoteShare[];
|
|
30
|
-
}
|
|
31
|
-
export interface RemoteWorkspace {
|
|
32
|
-
id: string;
|
|
33
|
-
nickname: string;
|
|
34
|
-
hosts: string[];
|
|
35
|
-
host?: string;
|
|
36
|
-
port: number;
|
|
37
|
-
transport: RemoteTransport;
|
|
38
|
-
fingerprint: string;
|
|
39
|
-
certPem: string;
|
|
40
|
-
token: string;
|
|
41
|
-
hostname?: string;
|
|
42
|
-
platform?: string;
|
|
43
|
-
version?: string;
|
|
44
|
-
addedAt: string;
|
|
45
|
-
}
|
|
46
|
-
export interface RemoteConfig {
|
|
47
|
-
hosting?: RemoteHosting;
|
|
48
|
-
workspaces?: RemoteWorkspace[];
|
|
49
|
-
}
|
|
50
6
|
export interface ProjectEntry {
|
|
51
7
|
path: string;
|
|
52
8
|
name?: string;
|
|
@@ -5,11 +5,18 @@ export declare class RunControl {
|
|
|
5
5
|
private readonly directions;
|
|
6
6
|
private compactionPending;
|
|
7
7
|
private readonly steerListeners;
|
|
8
|
+
private budgetHolds;
|
|
9
|
+
private readonly holdListeners;
|
|
8
10
|
yolo?: boolean;
|
|
9
11
|
permissions?: import('./permissions.js').PermissionMode;
|
|
10
12
|
get isPaused(): boolean;
|
|
11
13
|
get signal(): AbortSignal;
|
|
12
14
|
get revision(): number;
|
|
15
|
+
/** Whether the run's wall-time budgets are held, for example while a model request waits for a desktop to take it. */
|
|
16
|
+
get budgetsHeld(): boolean;
|
|
17
|
+
onBudgetHold(listener: (held: boolean) => void): () => void;
|
|
18
|
+
/** Holds every budget bound to this run until the returned function is called (once; holds nest). */
|
|
19
|
+
holdBudgets(): () => void;
|
|
13
20
|
/** Whether a /compact made during the run is still waiting for an agent to act on it. */
|
|
14
21
|
get compactionRequested(): boolean;
|
|
15
22
|
/** Hands a pending /compact to the agent that will act on it; true once per request (repeats before it is taken merge). */
|
package/dist/src/run-control.js
CHANGED
|
@@ -5,11 +5,34 @@ export class RunControl {
|
|
|
5
5
|
directions = [];
|
|
6
6
|
compactionPending = false;
|
|
7
7
|
steerListeners = new Map();
|
|
8
|
+
budgetHolds = 0;
|
|
9
|
+
holdListeners = new Set();
|
|
8
10
|
yolo;
|
|
9
11
|
permissions;
|
|
10
12
|
get isPaused() { return this.paused; }
|
|
11
13
|
get signal() { return this.controller.signal; }
|
|
12
14
|
get revision() { return this.directions.length; }
|
|
15
|
+
/** Whether the run's wall-time budgets are held, for example while a model request waits for a desktop to take it. */
|
|
16
|
+
get budgetsHeld() { return this.budgetHolds > 0; }
|
|
17
|
+
onBudgetHold(listener) {
|
|
18
|
+
this.holdListeners.add(listener);
|
|
19
|
+
return () => { this.holdListeners.delete(listener); };
|
|
20
|
+
}
|
|
21
|
+
/** Holds every budget bound to this run until the returned function is called (once; holds nest). */
|
|
22
|
+
holdBudgets() {
|
|
23
|
+
if (this.budgetHolds++ === 0)
|
|
24
|
+
for (const listener of [...this.holdListeners])
|
|
25
|
+
listener(true);
|
|
26
|
+
let released = false;
|
|
27
|
+
return () => {
|
|
28
|
+
if (released)
|
|
29
|
+
return;
|
|
30
|
+
released = true;
|
|
31
|
+
if (--this.budgetHolds === 0)
|
|
32
|
+
for (const listener of [...this.holdListeners])
|
|
33
|
+
listener(false);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
13
36
|
/** Whether a /compact made during the run is still waiting for an agent to act on it. */
|
|
14
37
|
get compactionRequested() { return this.compactionPending; }
|
|
15
38
|
/** Hands a pending /compact to the agent that will act on it; true once per request (repeats before it is taken merge). */
|
|
@@ -19,12 +19,12 @@ export interface OpenRunRecord {
|
|
|
19
19
|
permissions?: string;
|
|
20
20
|
resumedFrom?: string;
|
|
21
21
|
direction?: string;
|
|
22
|
-
wake?: 'timer' | 'auto-fix' | 'fix-checks';
|
|
22
|
+
wake?: 'timer' | 'auto-fix' | 'fix-checks' | 'mention' | 'andorra-review';
|
|
23
23
|
pendingDirections?: {
|
|
24
24
|
runId: string;
|
|
25
25
|
direction: string;
|
|
26
26
|
id?: string;
|
|
27
|
-
wake?: 'timer' | 'auto-fix' | 'fix-checks';
|
|
27
|
+
wake?: 'timer' | 'auto-fix' | 'fix-checks' | 'mention' | 'andorra-review';
|
|
28
28
|
node?: string;
|
|
29
29
|
}[];
|
|
30
30
|
directionNode?: string;
|
|
@@ -106,6 +106,11 @@ export declare function sessionsWithOpenRunClaims(directory: string, sessions?:
|
|
|
106
106
|
export declare function sessionHasOpenRun(directory: string, sessionId: string, options?: {
|
|
107
107
|
ignoreRunId?: string;
|
|
108
108
|
}): Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Whether one run is still open: its claim is there and its process is live. Read only, unlike `sessionHasOpenRun`: a
|
|
111
|
+
* stale claim is left for that sweep. An unreadable claim counts as open.
|
|
112
|
+
*/
|
|
113
|
+
export declare function runIsOpen(directory: string, runId: string): Promise<boolean>;
|
|
109
114
|
export declare function sessionHasArmedWake(directory: string, sessionId: string): Promise<boolean>;
|
|
110
115
|
export declare function writeWakeClaim(directory: string, sessionId: string, timerId: string): Promise<void>;
|
|
111
116
|
export declare function clearWakeClaim(directory: string, sessionId: string, timerId: string): Promise<void>;
|
package/dist/src/run-records.js
CHANGED
|
@@ -232,7 +232,8 @@ async function markOpenRunsInterrupted(directory, onlyRunIds, skipOwnProcess = f
|
|
|
232
232
|
await unlock();
|
|
233
233
|
continue;
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const measured = plainObject(current.usage) ? undefined : await journalRunUsage(directory, runId);
|
|
236
|
+
const interrupted = { ...current, status: 'interrupted', telemetryPending: true, reason: 'the engine stopped while this run was active', endedAt: new Date().toISOString(), ...(measured === undefined ? {} : { usage: measured }) };
|
|
236
237
|
try {
|
|
237
238
|
await writeSessionSnapshot(path, JSON.stringify(interrupted, null, 2) + '\n');
|
|
238
239
|
}
|
|
@@ -461,6 +462,24 @@ export async function sessionHasOpenRun(directory, sessionId, options = {}) {
|
|
|
461
462
|
}
|
|
462
463
|
return false;
|
|
463
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Whether one run is still open: its claim is there and its process is live. Read only, unlike `sessionHasOpenRun`: a
|
|
467
|
+
* stale claim is left for that sweep. An unreadable claim counts as open.
|
|
468
|
+
*/
|
|
469
|
+
export async function runIsOpen(directory, runId) {
|
|
470
|
+
let claim;
|
|
471
|
+
try {
|
|
472
|
+
claim = JSON.parse(await readFile(runRecordPath(directory, runId, 'open-run'), 'utf8'));
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
return error.code !== 'ENOENT';
|
|
476
|
+
}
|
|
477
|
+
if (!claim || typeof claim !== 'object' || claim.runId !== runId)
|
|
478
|
+
return true;
|
|
479
|
+
if (await claimOutlivedItsRun(directory, claim))
|
|
480
|
+
return false;
|
|
481
|
+
return claimOwnerIsLive(typeof claim.pid === 'number' ? claim.pid : undefined, claim.startedAt);
|
|
482
|
+
}
|
|
464
483
|
export async function sessionHasArmedWake(directory, sessionId) {
|
|
465
484
|
const runs = runRecordsDirectory(directory);
|
|
466
485
|
let names;
|
|
@@ -674,14 +693,21 @@ async function upgradeSessionMarkers(directory, only) {
|
|
|
674
693
|
}
|
|
675
694
|
if (known && !usageFolded.has(runId)) {
|
|
676
695
|
usageFolded.add(runId);
|
|
677
|
-
foldRecordUsage(session, record.usage);
|
|
696
|
+
foldRecordUsage(session, plainObject(record.usage) ? record.usage : await journalRunUsage(directory, runId));
|
|
678
697
|
}
|
|
679
698
|
}
|
|
680
699
|
else {
|
|
681
700
|
completion.summary = INTERRUPTED_TURN_SUMMARY;
|
|
682
701
|
completion.status = 'interrupted';
|
|
683
|
-
if (known)
|
|
684
|
-
|
|
702
|
+
if (known) {
|
|
703
|
+
// No finished record carries this run's usage, so the journal's last measurement stands in for it.
|
|
704
|
+
const measured = await journalRunUsage(directory, runId);
|
|
705
|
+
if (!usageFolded.has(runId)) {
|
|
706
|
+
usageFolded.add(runId);
|
|
707
|
+
foldRecordUsage(session, measured);
|
|
708
|
+
}
|
|
709
|
+
await synthesizeInterruptedRecord(directory, runId, typeof session.id === 'string' && validSessionFile(session.id) ? session.id : undefined, measured);
|
|
710
|
+
}
|
|
685
711
|
}
|
|
686
712
|
changed += 1;
|
|
687
713
|
}
|
|
@@ -722,7 +748,46 @@ async function readRunRecord(directory, runId) {
|
|
|
722
748
|
return undefined;
|
|
723
749
|
}
|
|
724
750
|
}
|
|
725
|
-
|
|
751
|
+
/**
|
|
752
|
+
* What a run had spent when its journal stopped: the run-wide total stamped on its last recorded model
|
|
753
|
+
* completion. An engine that dies mid-run never writes the finished record that normally carries this.
|
|
754
|
+
*/
|
|
755
|
+
async function journalRunUsage(directory, runId) {
|
|
756
|
+
let lines;
|
|
757
|
+
try {
|
|
758
|
+
lines = (await readFile(runRecordPath(directory, runId, 'jsonl'), 'utf8')).split('\n');
|
|
759
|
+
}
|
|
760
|
+
catch {
|
|
761
|
+
return undefined;
|
|
762
|
+
}
|
|
763
|
+
const count = (value) => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
764
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
765
|
+
const line = lines[index];
|
|
766
|
+
if (!line.includes('"agent.model.completed"'))
|
|
767
|
+
continue;
|
|
768
|
+
let total;
|
|
769
|
+
try {
|
|
770
|
+
const event = JSON.parse(line);
|
|
771
|
+
if (event.type !== 'agent.model.completed')
|
|
772
|
+
continue;
|
|
773
|
+
total = event.data?.graphUsage;
|
|
774
|
+
}
|
|
775
|
+
catch {
|
|
776
|
+
continue;
|
|
777
|
+
}
|
|
778
|
+
if (!plainObject(total))
|
|
779
|
+
continue;
|
|
780
|
+
const stamped = total;
|
|
781
|
+
const inputTokens = count(stamped.inputTokens), outputTokens = count(stamped.outputTokens);
|
|
782
|
+
if (inputTokens === undefined || outputTokens === undefined)
|
|
783
|
+
continue;
|
|
784
|
+
const cacheRead = count(stamped.cacheRead), cacheWrite = count(stamped.cacheWrite);
|
|
785
|
+
return { requests: count(stamped.requests) ?? 0, inputTokens, outputTokens,
|
|
786
|
+
...(cacheRead === undefined ? {} : { cacheRead }), ...(cacheWrite === undefined ? {} : { cacheWrite }) };
|
|
787
|
+
}
|
|
788
|
+
return undefined;
|
|
789
|
+
}
|
|
790
|
+
async function synthesizeInterruptedRecord(directory, runId, sessionId, usage) {
|
|
726
791
|
if (await readRunRecord(directory, runId) !== undefined)
|
|
727
792
|
return;
|
|
728
793
|
await mkdir(runRecordsDirectory(directory), { recursive: true, mode: 0o700 });
|
|
@@ -737,7 +802,7 @@ async function synthesizeInterruptedRecord(directory, runId, sessionId) {
|
|
|
737
802
|
try {
|
|
738
803
|
await writeSessionSnapshot(runRecordPath(directory, runId, 'json'), JSON.stringify({
|
|
739
804
|
id: runId, status: 'interrupted', reason: 'the engine stopped before the run was recorded', startedAt,
|
|
740
|
-
...(sessionId === undefined ? {} : { sessionId }), usage: { inputTokens: 0, outputTokens: 0, requests: 0 }, toolCalls: 0,
|
|
805
|
+
...(sessionId === undefined ? {} : { sessionId }), usage: usage ?? { inputTokens: 0, outputTokens: 0, requests: 0 }, toolCalls: 0,
|
|
741
806
|
}, null, 2) + '\n');
|
|
742
807
|
}
|
|
743
808
|
catch { }
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { Message, ModelAdapter, RuntimeEvent, Tool, ToolContext, Usage } fr
|
|
|
8
8
|
import { type Limits } from './limits.js';
|
|
9
9
|
import type { DecisionManager } from './decision/DecisionManager.js';
|
|
10
10
|
import type { DecisionBatch } from './decision/types.js';
|
|
11
|
+
import type { TaskKind } from './decision/taskKind.js';
|
|
11
12
|
export declare const DEFAULT_GRAPH: Readonly<{
|
|
12
13
|
id: "default";
|
|
13
14
|
name: "Andorra Agent";
|
|
@@ -35,6 +36,9 @@ export interface Completion {
|
|
|
35
36
|
output?: Record<string, unknown>;
|
|
36
37
|
artifacts?: ArtifactRef[];
|
|
37
38
|
remaining?: string[];
|
|
39
|
+
/** The requested outcomes the agent listed, and the evidence the runtime resolved for them (phase 3). */
|
|
40
|
+
outcomes?: import('./evidence.js').RequestedOutcome[];
|
|
41
|
+
evidence?: import('./evidence.js').EvidenceItem[];
|
|
38
42
|
status?: 'running' | 'cancelled' | 'interrupted' | 'infrastructure_error' | 'exhausted' | 'needs_clarification';
|
|
39
43
|
}
|
|
40
44
|
export interface InvocationBudget {
|
|
@@ -113,15 +117,22 @@ export interface AgentContinuationState {
|
|
|
113
117
|
};
|
|
114
118
|
}
|
|
115
119
|
export declare function timerReminderText(prompt: string): string;
|
|
116
|
-
type RetainedWake = 'timer' | 'auto-fix' | 'fix-checks';
|
|
120
|
+
type RetainedWake = 'timer' | 'auto-fix' | 'fix-checks' | 'mention' | 'andorra-review';
|
|
117
121
|
export declare function wakeMessageText(wake: RetainedWake | undefined, message: string): string;
|
|
122
|
+
/**
|
|
123
|
+
* A past turn's completion as the model is given it again: the outcomes it listed and the evidence the runtime
|
|
124
|
+
* resolved stay out, since they repeat command output (untrusted text) and grow every later request.
|
|
125
|
+
*/
|
|
126
|
+
export declare function turnModelCompletion(completion: Completion): Omit<Completion, 'outcomes' | 'evidence'>;
|
|
118
127
|
export declare function turnModelTask(turn: {
|
|
119
128
|
task: string;
|
|
129
|
+
note?: string;
|
|
120
130
|
direction?: string;
|
|
121
131
|
wake?: RetainedWake;
|
|
122
132
|
attachments?: readonly UserAttachmentRef[];
|
|
123
133
|
steers?: {
|
|
124
134
|
text: string;
|
|
135
|
+
note?: string;
|
|
125
136
|
attachments?: readonly UserAttachmentRef[];
|
|
126
137
|
wake?: RetainedWake;
|
|
127
138
|
subagentId?: string;
|
|
@@ -135,8 +146,10 @@ export interface RunOptions {
|
|
|
135
146
|
efficiency?: import('./efficiency.js').EfficiencyConfig;
|
|
136
147
|
attachments?: ResolvedAttachments;
|
|
137
148
|
recoverTools?: Tool[];
|
|
149
|
+
/** `sessionModel` marks a live model that is the run's own selection, as opposed to one node's override. */
|
|
138
150
|
getLiveModel?: (nodeId: string | undefined, provider: string, model: string, signal: AbortSignal) => Promise<(ResolvedGraphModel & {
|
|
139
151
|
provider: string;
|
|
152
|
+
sessionModel?: boolean;
|
|
140
153
|
}) | undefined>;
|
|
141
154
|
task: string;
|
|
142
155
|
model: string;
|
|
@@ -171,6 +184,13 @@ export interface RunOptions {
|
|
|
171
184
|
todoList?: boolean;
|
|
172
185
|
completionPolicy?: CompletionPolicy;
|
|
173
186
|
canonicalTask?: string;
|
|
187
|
+
/** The hosted classifier's reading of this run's first message; see src/decision/taskKind.ts. */
|
|
188
|
+
taskKind?: {
|
|
189
|
+
kind: TaskKind;
|
|
190
|
+
confidence: number;
|
|
191
|
+
expectsChange: boolean;
|
|
192
|
+
note?: string;
|
|
193
|
+
};
|
|
174
194
|
completionGuard?: (completion: Completion) => string | undefined;
|
|
175
195
|
finalAnswerOutcomes?: readonly string[];
|
|
176
196
|
sessionGoal?: string;
|
|
@@ -224,6 +244,8 @@ export interface ResolvedGraphModel {
|
|
|
224
244
|
contextWindow?: number;
|
|
225
245
|
providerType?: string;
|
|
226
246
|
baseUrl?: string;
|
|
247
|
+
/** The thinking level this model's requests carry, when one applies. */
|
|
248
|
+
reasoningEffort?: string;
|
|
227
249
|
}
|
|
228
250
|
export interface GraphRunOptions extends RunOptions {
|
|
229
251
|
installedSkillClaims?: (name: string) => boolean;
|
|
@@ -250,7 +272,15 @@ export interface GraphRunOptions extends RunOptions {
|
|
|
250
272
|
modifierIteration?: number;
|
|
251
273
|
previousIterationCompletion?: Completion;
|
|
252
274
|
concurrencyBudget?: number;
|
|
253
|
-
|
|
275
|
+
/** `reasoningEffort`, when given, is the thinking level the returned model must run at in place of any saved one. */
|
|
276
|
+
resolveModel?: (id: string, model: string | undefined, signal: AbortSignal, reasoningEffort?: import('./providers.js').ReasoningEffort) => Promise<ResolvedGraphModel>;
|
|
277
|
+
/** The run's own thinking level is Auto: a node on the session model with no level of its own lets Jev pick one. */
|
|
278
|
+
sessionEffortAuto?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* A model's enabled thinking levels, lowest first; with `forAuto`, the ones Auto may pick among. Absent: every level
|
|
281
|
+
* of a provider type that takes one, and low, medium and high for Auto.
|
|
282
|
+
*/
|
|
283
|
+
thinkingLevels?: (provider: string, model: string, forAuto: boolean) => import('./providers.js').ReasoningEffort[];
|
|
254
284
|
resolveProvider?: (id: string) => ResolvedGraphModel;
|
|
255
285
|
memory?: import('./memory/MemoryManager.js').MemoryManager;
|
|
256
286
|
commandMemory?: import('./memory/LocalToolMemory.js').LocalToolMemory;
|
|
@@ -268,5 +298,7 @@ export interface GraphRunOptions extends RunOptions {
|
|
|
268
298
|
progress: import('./run-progress.js').RunProgress;
|
|
269
299
|
checkpoints?: import('./run-progress.js').RunCheckpoint[];
|
|
270
300
|
};
|
|
301
|
+
/** Runs an Andorra review node's rounds on the task's PR; without it such a node leaves through `stopped` (`unavailable`). */
|
|
302
|
+
reviewNode?: import('./github-app/review-node.js').ReviewNodeService;
|
|
271
303
|
}
|
|
272
304
|
export { runGraph } from './graph-runner.js';
|
package/dist/src/runtime.js
CHANGED
|
@@ -22,17 +22,33 @@ export function wakeMessageText(wake, message) {
|
|
|
22
22
|
// The person pressed Fix with Agent in the PR tab; the text is the engine's, built from GitHub's checks.
|
|
23
23
|
if (wake === 'fix-checks')
|
|
24
24
|
return `Sent by the user with Fix with Agent in the PR tab: ${message}`;
|
|
25
|
+
// The person mentioned the App's bot on the task's PR; the text is the engine's, and the comment is read with gh.
|
|
26
|
+
if (wake === 'mention')
|
|
27
|
+
return `Delivered for a mention on GitHub (not typed in this chat): ${message}`;
|
|
28
|
+
// The review loop posted a round with findings; the text is the engine's, and the findings are read with gh.
|
|
29
|
+
if (wake === 'andorra-review')
|
|
30
|
+
return `Delivered by Andorra review (not a message from the user): ${message}`;
|
|
25
31
|
return wake === 'timer' ? timerReminderText(message) : message;
|
|
26
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A past turn's completion as the model is given it again: the outcomes it listed and the evidence the runtime
|
|
35
|
+
* resolved stay out, since they repeat command output (untrusted text) and grow every later request.
|
|
36
|
+
*/
|
|
37
|
+
export function turnModelCompletion(completion) {
|
|
38
|
+
const { outcomes: _outcomes, evidence: _evidence, ...given } = completion;
|
|
39
|
+
return given;
|
|
40
|
+
}
|
|
27
41
|
export function turnModelTask(turn) {
|
|
28
42
|
const woken = (message) => wakeMessageText(turn.wake ?? 'timer', message);
|
|
29
|
-
const
|
|
43
|
+
const said = turn.direction === undefined
|
|
30
44
|
? (turn.wake === undefined ? turn.task : woken(turn.task))
|
|
31
45
|
: `${turn.task}\n\n${turn.wake === undefined ? `Direction given when the attempt continued: ${turn.direction}` : `Delivered when the attempt continued: ${woken(turn.direction)}`}`;
|
|
46
|
+
// The turn's note (`run.note`) was given to the agent with the message, so later turns replay it too.
|
|
47
|
+
const text = turn.note ? `${said}\n\n${turn.note}` : said;
|
|
32
48
|
// A message the user sent to a subagent was never for this agent, so it is not replayed to it.
|
|
33
49
|
const withSteers = (turn.steers ?? []).filter(steer => steer.subagentId === undefined).reduce((text, steer) => {
|
|
34
50
|
const line = steer.wake === undefined
|
|
35
|
-
? `\n\nSteering message the user sent while this attempt ran: ${steer.text}`
|
|
51
|
+
? `\n\nSteering message the user sent while this attempt ran: ${steer.text}${steer.note ? `\n\n${steer.note}` : ''}`
|
|
36
52
|
: `\n\nRead while this attempt ran: ${timerReminderText(steer.text)}`;
|
|
37
53
|
const refs = steer.attachments?.length ? `\n\n${attachmentReferenceBlock(steer.attachments, { imagesIncluded: false })}` : '';
|
|
38
54
|
return `${text}${line}${refs}`;
|
|
@@ -18,6 +18,16 @@ export interface FileWriteRecording {
|
|
|
18
18
|
export interface FileChangeRecorder {
|
|
19
19
|
beforeWrite(targets: string | readonly string[]): Promise<FileWriteRecording | undefined>;
|
|
20
20
|
}
|
|
21
|
+
export type UserWriteResult = {
|
|
22
|
+
written: true;
|
|
23
|
+
hash: string;
|
|
24
|
+
size: number;
|
|
25
|
+
changes?: AppServerSessionChanges;
|
|
26
|
+
} | {
|
|
27
|
+
written: false;
|
|
28
|
+
reason: 'changed' | 'deleted';
|
|
29
|
+
hash?: string;
|
|
30
|
+
};
|
|
21
31
|
export declare class SessionChangeStore {
|
|
22
32
|
private readonly home;
|
|
23
33
|
private readonly baselineLimit;
|
|
@@ -31,6 +41,14 @@ export declare class SessionChangeStore {
|
|
|
31
41
|
recorder(sessionId: string, workspace: string, onChange: (changes: AppServerSessionChanges) => void, onError?: (error: unknown) => void, review?: () => boolean): FileChangeRecorder;
|
|
32
42
|
private recordWrites;
|
|
33
43
|
private recordWrite;
|
|
44
|
+
/**
|
|
45
|
+
* The agent's side of a file after a write (see `agentSide`). The person's first save over the agent's work keeps the
|
|
46
|
+
* file as the save found it; their later saves change nothing. An agent write to a file the person edited keeps what
|
|
47
|
+
* it wrote, and which of the person's lines it carried over. A file only the person changed has none.
|
|
48
|
+
*/
|
|
49
|
+
private nextAgentSide;
|
|
50
|
+
/** The texts that tell the person's lines from the agent's, or undefined when the file's record cannot. */
|
|
51
|
+
private authorTexts;
|
|
34
52
|
pending(sessionId: string): Promise<AppServerSessionChanges>;
|
|
35
53
|
list(sessionId: string, maxLines?: number): Promise<AppServerSessionChanges>;
|
|
36
54
|
get(sessionId: string, relative: string, maxLines?: number): Promise<{
|
|
@@ -41,6 +59,23 @@ export declare class SessionChangeStore {
|
|
|
41
59
|
keep(sessionId: string, paths?: readonly string[]): Promise<AppServerSessionChangesKept>;
|
|
42
60
|
undo(sessionId: string, paths?: readonly string[], force?: boolean): Promise<AppServerSessionChangesUndone>;
|
|
43
61
|
private undoLocked;
|
|
62
|
+
/** The person's lines in the file now, as ranges, or undefined when they cannot be told apart. */
|
|
63
|
+
private userLinesNow;
|
|
44
64
|
private restore;
|
|
65
|
+
/**
|
|
66
|
+
* Saves a file from the Files tab, only if it still holds what the person loaded (`expectedHash`, the SHA-256 of its
|
|
67
|
+
* bytes), so a save never replaces a newer copy the agent wrote. The file is written in place (its mode, owner and
|
|
68
|
+
* links stay), under the same per-file lock the agent's writes take. With a session, the save is recorded as the
|
|
69
|
+
* person's in that session's changes: the record of the written content moves with it, so the file is not reported
|
|
70
|
+
* "changed on disk", and a file the agent never touched becomes a change of theirs.
|
|
71
|
+
*/
|
|
72
|
+
userWrite(input: {
|
|
73
|
+
sessionId?: string;
|
|
74
|
+
root: string;
|
|
75
|
+
relative: string;
|
|
76
|
+
bytes: Buffer;
|
|
77
|
+
expectedHash: string;
|
|
78
|
+
onError?: (error: unknown) => void;
|
|
79
|
+
}): Promise<UserWriteResult>;
|
|
45
80
|
remove(sessionId: string): Promise<void>;
|
|
46
81
|
}
|