@andorra-labs/code 0.1.15 → 0.1.17
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-definitions.js +29 -6
- package/dist/src/agent-execution.js +15 -10
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +4 -1
- package/dist/src/agent-mcp.js +46 -10
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- 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 +22 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +89 -0
- package/dist/src/app-server/workspace.js +457 -11
- package/dist/src/app-server.d.ts +465 -32
- package/dist/src/app-server.js +3308 -517
- package/dist/src/auth/deployment.js +2 -2
- 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 +347 -0
- package/dist/src/bridge/control.d.ts +68 -0
- package/dist/src/bridge/control.js +233 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -0
- package/dist/src/bridge/host-ops.d.ts +9 -0
- package/dist/src/bridge/host-ops.js +129 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +540 -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-runner.js +1 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/style.css +3 -3
- package/dist/src/browser-ui/tokens.css +28 -17
- package/dist/src/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/claude-provider.js +3 -1
- package/dist/src/cli.js +202 -38
- package/dist/src/codex-errors.js +4 -1
- package/dist/src/coding-tools.js +15 -15
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +19 -14
- package/dist/src/commands.d.ts +14 -1
- package/dist/src/compaction-phrases.d.ts +4 -0
- package/dist/src/compaction-phrases.js +20 -0
- package/dist/src/completion.js +82 -5
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +202 -77
- package/dist/src/context-compaction.js +2 -1
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/DecisionManager.js +3 -2
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/requestPhrases.d.ts +4 -0
- package/dist/src/decision/requestPhrases.js +22 -0
- package/dist/src/default-graph.js +1 -1
- 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 +349 -0
- package/dist/src/github-app/client.js +810 -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-inbox.d.ts +55 -0
- package/dist/src/github-inbox.js +153 -0
- package/dist/src/github-names.d.ts +8 -0
- package/dist/src/github-names.js +8 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +13 -4
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +46 -0
- package/dist/src/graph-preview.js +55 -0
- package/dist/src/graph-provider-portability.js +34 -11
- package/dist/src/graph-quota.d.ts +29 -2
- package/dist/src/graph-quota.js +68 -10
- package/dist/src/graph-runner.js +88 -10
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +11 -9
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +201 -40
- package/dist/src/graph-ui/controls.css +1 -0
- package/dist/src/graph-ui/embed.js +2 -2
- package/dist/src/graph-ui/icons.js +3 -1
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/manager.css +1 -1
- package/dist/src/graph-ui/manager.js +2 -2
- package/dist/src/graph-ui/sidebar.js +30 -0
- package/dist/src/graph-ui/studio-canvas.js +26 -13
- package/dist/src/graph-ui/studio.css +15 -7
- package/dist/src/graph-ui/studio.js +26 -5
- package/dist/src/graph-ui/style.css +77 -45
- package/dist/src/graph-ui/theme.js +3 -36
- package/dist/src/graph-ui/tokens.css +28 -20
- package/dist/src/graphs.d.ts +34 -1
- package/dist/src/graphs.js +162 -17
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +30 -1
- package/dist/src/membership.js +48 -8
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +7 -1
- package/dist/src/model-metadata.js +39 -17
- 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/plan-pass.d.ts +59 -0
- package/dist/src/plan-pass.js +165 -0
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-engine.js +3 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +40 -2
- package/dist/src/providers.js +93 -23
- package/dist/src/pull-request-checks.d.ts +26 -0
- package/dist/src/pull-request-checks.js +56 -0
- package/dist/src/pull-request-conversation.d.ts +134 -0
- package/dist/src/pull-request-conversation.js +221 -0
- package/dist/src/pull-request-create.d.ts +175 -0
- package/dist/src/pull-request-create.js +392 -0
- package/dist/src/pull-request-details.d.ts +242 -0
- package/dist/src/pull-request-details.js +614 -0
- package/dist/src/pull-request-edit.d.ts +23 -0
- package/dist/src/pull-request-edit.js +91 -0
- package/dist/src/pull-request-logs.d.ts +87 -0
- package/dist/src/pull-request-logs.js +183 -0
- package/dist/src/pull-request-merge.d.ts +112 -0
- package/dist/src/pull-request-merge.js +258 -0
- package/dist/src/pull-request-review.d.ts +137 -0
- package/dist/src/pull-request-review.js +401 -0
- package/dist/src/pull-requests.d.ts +369 -8
- package/dist/src/pull-requests.js +524 -55
- package/dist/src/react-runtime.js +38 -5
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +379 -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 +17 -0
- package/dist/src/run-control.js +47 -0
- package/dist/src/run-progress.d.ts +10 -0
- package/dist/src/run-progress.js +122 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +9 -1
- package/dist/src/runtime.js +24 -4
- 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 +11 -1
- package/dist/src/sessions.js +17 -4
- 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 +2 -2
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/subagent-run.js +1 -0
- package/dist/src/telemetry/capture-core.d.ts +17 -0
- package/dist/src/telemetry/capture-core.js +59 -1
- package/dist/src/telemetry/classify.d.ts +3 -1
- package/dist/src/telemetry/classify.js +37 -0
- package/dist/src/telemetry/emitter.d.ts +17 -0
- package/dist/src/telemetry/emitter.js +76 -5
- package/dist/src/telemetry/schema.d.ts +47 -2
- package/dist/src/telemetry/schema.js +120 -5
- package/dist/src/telemetry/surface.d.ts +3 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/telemetry/uploader.d.ts +6 -1
- package/dist/src/telemetry/uploader.js +22 -3
- 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 +7 -0
- package/dist/src/test-edit-guard.js +49 -1
- package/dist/src/timers.d.ts +2 -0
- package/dist/src/tools.js +59 -9
- package/dist/src/transcript.js +8 -2
- package/dist/src/types.d.ts +7 -0
- package/dist/src/usage-analytics.js +18 -10
- 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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub account and repository names as the engine accepts them in a pull request URL (github.com only), and
|
|
3
|
+
* so in every request built from one. A repository name is never `.` or `..`, which would walk a REST path.
|
|
4
|
+
*/
|
|
5
|
+
export const GITHUB_OWNER_PATTERN = '[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})';
|
|
6
|
+
export const GITHUB_REPO_PATTERN = '(?!\\.\\.?(?![A-Za-z0-9._-]))[A-Za-z0-9._-]{1,100}';
|
|
7
|
+
export const GITHUB_OWNER = new RegExp(`^${GITHUB_OWNER_PATTERN}$`);
|
|
8
|
+
export const GITHUB_REPO = new RegExp(`^${GITHUB_REPO_PATTERN}$`);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const GLOB_LIST_LIMIT = 400000;
|
|
2
|
+
export declare const GLOB_WALK_ENTRY_LIMIT = 200000;
|
|
3
|
+
export declare const GLOB_TIME_MS = 20000;
|
|
4
|
+
export interface GlobSearchInput {
|
|
5
|
+
pattern: string;
|
|
6
|
+
/** Absolute directory the pattern is relative to. */
|
|
7
|
+
root: string;
|
|
8
|
+
limit: number;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
/** ripgrep executable, or null to use the built-in walk (restricted modes, ripgrep missing). */
|
|
11
|
+
rg: string | null;
|
|
12
|
+
/** Checks a directory against the caller's path policy and returns it resolved; throws when it is missing or refused. */
|
|
13
|
+
resolve(directory: string): Promise<string>;
|
|
14
|
+
/** The built-in recursive listing; throws "Directory scan limit reached" when the budget runs out. */
|
|
15
|
+
walk(directory: string, budget: {
|
|
16
|
+
entries: number;
|
|
17
|
+
limit: number;
|
|
18
|
+
}): AsyncIterable<string>;
|
|
19
|
+
/** Drops listed paths the agent may not see; paths are relative to cwd. */
|
|
20
|
+
keep?(relative: string[], cwd: string): string[];
|
|
21
|
+
/** Arguments placed before ripgrep's own, for a stand-in started through another program. */
|
|
22
|
+
rgPrefix?: string[];
|
|
23
|
+
timeMs?: number;
|
|
24
|
+
listLimit?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface GlobSearchResult {
|
|
27
|
+
/** Absolute paths, in listing order. */
|
|
28
|
+
matches: string[];
|
|
29
|
+
/** The result limit stopped the search, so more files may match. */
|
|
30
|
+
more: boolean;
|
|
31
|
+
/** Why the listing stopped early, when it did. */
|
|
32
|
+
incomplete?: string;
|
|
33
|
+
/** Nothing outside ignored paths matched; the matches come from files that ignore rules exclude. */
|
|
34
|
+
ignoredOnly: boolean;
|
|
35
|
+
/** Ignored files were covered too, so an empty result is not an ignore rule hiding the file. */
|
|
36
|
+
searchedIgnored: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Splits a pattern into the directory its matches must lie in and the rest. `src/**\/*.ts` can only
|
|
40
|
+
* match under `src`, so the listing starts there instead of at the workspace root. A pattern with no
|
|
41
|
+
* slash matches a file name at any depth and has no such directory.
|
|
42
|
+
*/
|
|
43
|
+
export declare function splitGlobPrefix(pattern: string): {
|
|
44
|
+
prefix: string;
|
|
45
|
+
rest: string;
|
|
46
|
+
anyDepth: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Finds files by glob. The listing starts in the directory the pattern names, leaves out what ignore
|
|
50
|
+
* rules exclude, and falls back to ignored files when nothing else matches, so a miss means the file
|
|
51
|
+
* is absent rather than hidden. A listing that stops early returns what it found and says so.
|
|
52
|
+
*/
|
|
53
|
+
export declare function globSearch(input: GlobSearchInput): Promise<GlobSearchResult>;
|
|
54
|
+
/** The text a model reads for a search: paths relative to root, then what it must know about their coverage. */
|
|
55
|
+
export declare function formatGlobResult(result: GlobSearchResult, root: string, limit: number): string;
|
|
56
|
+
/**
|
|
57
|
+
* The matches of a search for a caller that can only show a plain list of paths. Such a caller has nowhere to
|
|
58
|
+
* say that the listing stopped early, so an unfinished search fails, carrying what was found, instead of
|
|
59
|
+
* passing for a complete answer.
|
|
60
|
+
*/
|
|
61
|
+
export declare function completeGlobMatches(result: GlobSearchResult, root: string, limit: number): string[];
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
4
|
+
export const GLOB_LIST_LIMIT = 400_000;
|
|
5
|
+
export const GLOB_WALK_ENTRY_LIMIT = 200_000;
|
|
6
|
+
export const GLOB_TIME_MS = 20_000;
|
|
7
|
+
const MAGIC = /[*?[\]{}()!]/;
|
|
8
|
+
/**
|
|
9
|
+
* Splits a pattern into the directory its matches must lie in and the rest. `src/**\/*.ts` can only
|
|
10
|
+
* match under `src`, so the listing starts there instead of at the workspace root. A pattern with no
|
|
11
|
+
* slash matches a file name at any depth and has no such directory.
|
|
12
|
+
*/
|
|
13
|
+
export function splitGlobPrefix(pattern) {
|
|
14
|
+
const normal = (process.platform === 'win32' ? pattern.replace(/\\/g, '/') : pattern).replace(/^(?:\.\/)+/, '');
|
|
15
|
+
if (!normal.includes('/'))
|
|
16
|
+
return { prefix: '', rest: normal, anyDepth: true };
|
|
17
|
+
const segments = normal.split('/');
|
|
18
|
+
let literal = 0;
|
|
19
|
+
while (literal < segments.length - 1 && !MAGIC.test(segments[literal]))
|
|
20
|
+
literal++;
|
|
21
|
+
const prefix = segments.slice(0, literal).join('/') || (normal.startsWith('/') && literal > 0 ? '/' : '');
|
|
22
|
+
return { prefix, rest: segments.slice(literal).join('/'), anyDepth: false };
|
|
23
|
+
}
|
|
24
|
+
function listWithRipgrep(rg, cwd, includeIgnored, accept, input) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
// NUL-separated output: a file name may hold a newline or end in a carriage return.
|
|
27
|
+
// --no-config: a filter in the user's own ripgrep configuration would hide files with no notice.
|
|
28
|
+
const args = [...(input.rgPrefix ?? []), '--no-config', '--files', '--null', '--hidden', '--no-require-git', '--sort', 'path', '--glob', '!.git', '--glob', '!node_modules', '--glob', '!.andorracode'];
|
|
29
|
+
if (includeIgnored)
|
|
30
|
+
args.push('--no-ignore');
|
|
31
|
+
const child = spawn(rg, args, { cwd, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true });
|
|
32
|
+
const decoder = new StringDecoder('utf8');
|
|
33
|
+
const listing = { matches: [], more: false };
|
|
34
|
+
let listed = 0, settled = false, stopped = false, pending = '';
|
|
35
|
+
const stop = () => { stopped = true; if (child.exitCode === null)
|
|
36
|
+
child.kill(); };
|
|
37
|
+
const timer = setTimeout(() => { listing.incomplete = `stopped after ${(input.timeMs ?? GLOB_TIME_MS) / 1000} seconds with ${listed.toLocaleString('en-US')} files listed`; stop(); }, input.timeMs ?? GLOB_TIME_MS);
|
|
38
|
+
const onAbort = () => stop();
|
|
39
|
+
input.signal.addEventListener('abort', onAbort, { once: true });
|
|
40
|
+
const finish = (run) => {
|
|
41
|
+
if (settled)
|
|
42
|
+
return;
|
|
43
|
+
settled = true;
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
input.signal.removeEventListener('abort', onAbort);
|
|
46
|
+
run();
|
|
47
|
+
};
|
|
48
|
+
const take = (name) => {
|
|
49
|
+
if (stopped || !name)
|
|
50
|
+
return;
|
|
51
|
+
const relative = name.split(path.sep).join('/').replace(/^\.\//, '');
|
|
52
|
+
if (++listed > (input.listLimit ?? GLOB_LIST_LIMIT)) {
|
|
53
|
+
listing.incomplete = `stopped at the ${(input.listLimit ?? GLOB_LIST_LIMIT).toLocaleString('en-US')}-file listing limit`;
|
|
54
|
+
stop();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!accept(relative) || (input.keep && !input.keep([relative], cwd).length))
|
|
58
|
+
return;
|
|
59
|
+
listing.matches.push(path.join(cwd, relative));
|
|
60
|
+
if (listing.matches.length >= input.limit) {
|
|
61
|
+
listing.more = true;
|
|
62
|
+
stop();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
child.stdout.on('data', (chunk) => {
|
|
66
|
+
const parts = (pending + decoder.write(chunk)).split('\0');
|
|
67
|
+
pending = parts.pop() ?? '';
|
|
68
|
+
for (const part of parts)
|
|
69
|
+
take(part);
|
|
70
|
+
});
|
|
71
|
+
child.once('error', () => finish(() => resolve({ matches: [], more: false, failed: true })));
|
|
72
|
+
child.once('close', code => finish(() => {
|
|
73
|
+
if (input.signal.aborted) {
|
|
74
|
+
reject(input.signal.reason instanceof Error ? input.signal.reason : new Error('Operation aborted'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!stopped && code !== 0 && code !== 1) {
|
|
78
|
+
// Exit 2 covers a directory ripgrep could not read. Nothing listed means it did not run usefully;
|
|
79
|
+
// otherwise what it listed is good, but the part it skipped may hold the file.
|
|
80
|
+
if (!listed) {
|
|
81
|
+
resolve({ matches: [], more: false, failed: true });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
listing.incomplete ??= 'ripgrep could not read part of the directory tree';
|
|
85
|
+
}
|
|
86
|
+
resolve(listing);
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function listWithWalk(cwd, accept, input) {
|
|
91
|
+
const listing = { matches: [], more: false };
|
|
92
|
+
const deadline = Date.now() + (input.timeMs ?? GLOB_TIME_MS);
|
|
93
|
+
const budget = { entries: 0, limit: GLOB_WALK_ENTRY_LIMIT };
|
|
94
|
+
try {
|
|
95
|
+
for await (const name of input.walk(cwd, budget)) {
|
|
96
|
+
input.signal.throwIfAborted();
|
|
97
|
+
if (Date.now() > deadline) {
|
|
98
|
+
listing.incomplete = `stopped after ${(input.timeMs ?? GLOB_TIME_MS) / 1000} seconds with ${budget.entries.toLocaleString('en-US')} entries scanned`;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
const relative = path.relative(cwd, name).split(path.sep).join('/');
|
|
102
|
+
if (!accept(relative))
|
|
103
|
+
continue;
|
|
104
|
+
listing.matches.push(name);
|
|
105
|
+
if (listing.matches.length >= input.limit) {
|
|
106
|
+
listing.more = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
input.signal.throwIfAborted();
|
|
113
|
+
if (!(error instanceof Error) || !/^Directory scan limit reached/.test(error.message))
|
|
114
|
+
throw error;
|
|
115
|
+
listing.incomplete = `stopped at the ${GLOB_WALK_ENTRY_LIMIT.toLocaleString('en-US')}-entry directory scan limit`;
|
|
116
|
+
}
|
|
117
|
+
return listing;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Finds files by glob. The listing starts in the directory the pattern names, leaves out what ignore
|
|
121
|
+
* rules exclude, and falls back to ignored files when nothing else matches, so a miss means the file
|
|
122
|
+
* is absent rather than hidden. A listing that stops early returns what it found and says so.
|
|
123
|
+
*/
|
|
124
|
+
export async function globSearch(input) {
|
|
125
|
+
input.signal.throwIfAborted();
|
|
126
|
+
const { prefix, rest, anyDepth } = splitGlobPrefix(input.pattern);
|
|
127
|
+
let cwd = input.root;
|
|
128
|
+
if (prefix) {
|
|
129
|
+
try {
|
|
130
|
+
cwd = await input.resolve(path.resolve(input.root, prefix));
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
input.signal.throwIfAborted();
|
|
134
|
+
if (error?.code === 'ENOENT' || /ENOENT|no such file or directory/i.test(error instanceof Error ? error.message : '')) {
|
|
135
|
+
return { matches: [], more: false, ignoredOnly: false, searchedIgnored: true };
|
|
136
|
+
}
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const accept = (relative) => path.matchesGlob(relative, rest) || (anyDepth && path.matchesGlob(path.posix.basename(relative), rest));
|
|
141
|
+
if (input.rg) {
|
|
142
|
+
const tracked = await listWithRipgrep(input.rg, cwd, false, accept, input);
|
|
143
|
+
if (!tracked.failed) {
|
|
144
|
+
if (tracked.matches.length)
|
|
145
|
+
return { matches: tracked.matches, more: tracked.more, ...(tracked.incomplete ? { incomplete: tracked.incomplete } : {}), ignoredOnly: false, searchedIgnored: false };
|
|
146
|
+
const everything = await listWithRipgrep(input.rg, cwd, true, accept, input);
|
|
147
|
+
if (!everything.failed) {
|
|
148
|
+
const incomplete = everything.incomplete ?? tracked.incomplete;
|
|
149
|
+
return { matches: everything.matches, more: everything.more, ...(incomplete ? { incomplete } : {}), ignoredOnly: everything.matches.length > 0, searchedIgnored: true };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const walked = await listWithWalk(cwd, accept, input);
|
|
154
|
+
return { matches: walked.matches, more: walked.more, ...(walked.incomplete ? { incomplete: walked.incomplete } : {}), ignoredOnly: false, searchedIgnored: true };
|
|
155
|
+
}
|
|
156
|
+
/** The text a model reads for a search: paths relative to root, then what it must know about their coverage. */
|
|
157
|
+
export function formatGlobResult(result, root, limit) {
|
|
158
|
+
const shown = result.matches.map(match => path.relative(root, match).split(path.sep).join('/') || path.basename(match));
|
|
159
|
+
const notices = [];
|
|
160
|
+
if (result.more)
|
|
161
|
+
notices.push(`[${limit} results limit reached: raise head_limit or narrow the pattern]`);
|
|
162
|
+
if (result.ignoredOnly)
|
|
163
|
+
notices.push('[Only ignored files match: nothing else in the search matched, so these come from paths that .gitignore or similar rules exclude.]');
|
|
164
|
+
if (result.incomplete)
|
|
165
|
+
notices.push(`[INCOMPLETE SEARCH: ${result.incomplete}. Files that were not listed may match, so this result does not show that the file is absent. Narrow it with path, or start the pattern with a directory.]`);
|
|
166
|
+
const body = shown.length ? shown.join('\n')
|
|
167
|
+
: result.incomplete ? 'No files found in the part that was listed before the search stopped.'
|
|
168
|
+
: `No files found matching pattern${result.searchedIgnored ? '' : ' outside ignored paths'}`;
|
|
169
|
+
return notices.length ? `${body}\n\n${notices.join('\n')}` : body;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The matches of a search for a caller that can only show a plain list of paths. Such a caller has nowhere to
|
|
173
|
+
* say that the listing stopped early, so an unfinished search fails, carrying what was found, instead of
|
|
174
|
+
* passing for a complete answer.
|
|
175
|
+
*/
|
|
176
|
+
export function completeGlobMatches(result, root, limit) {
|
|
177
|
+
if (result.incomplete)
|
|
178
|
+
throw new Error(formatGlobResult(result, root, limit));
|
|
179
|
+
return result.matches;
|
|
180
|
+
}
|
package/dist/src/graph-health.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configuredContextWindow, createAdapter } from './providers.js';
|
|
1
|
+
import { configuredContextWindow, createAdapter, findProviderById, providerModelId } from './providers.js';
|
|
2
2
|
import { ANDORRA_UNAVAILABLE_MESSAGE } from './andorra/endpoint.js';
|
|
3
3
|
export function resumeModelNodes(graph, resume) {
|
|
4
4
|
if (resume === undefined)
|
|
@@ -30,7 +30,11 @@ export function resumeModelNodes(graph, resume) {
|
|
|
30
30
|
function graphModels(graph, config, session = {}, only) {
|
|
31
31
|
const references = new Map();
|
|
32
32
|
const sessionProvider = session.provider ?? config.provider;
|
|
33
|
-
|
|
33
|
+
// Each probe names the model as the provider it is sent to spells it.
|
|
34
|
+
const resolve = (provider, model) => {
|
|
35
|
+
const local = findProviderById(config.providers, provider);
|
|
36
|
+
return { provider, model: model === undefined ? local?.model ?? '(default model)' : local ? providerModelId(local, model) ?? model : model };
|
|
37
|
+
};
|
|
34
38
|
const inherited = (node) => node.provider === undefined
|
|
35
39
|
? resolve(sessionProvider, node.model ?? session.model)
|
|
36
40
|
: resolve(node.provider, node.model);
|
|
@@ -106,11 +110,16 @@ export async function checkGraphModelHealth(graph, config, signal, dependencies
|
|
|
106
110
|
if (overall?.signal.aborted)
|
|
107
111
|
return;
|
|
108
112
|
const index = next++, reference = references[index];
|
|
109
|
-
const provider = config.providers
|
|
113
|
+
const provider = findProviderById(config.providers, reference.provider);
|
|
110
114
|
if (!provider) {
|
|
111
115
|
failures[index] = { ...reference, reason: 'Provider is not configured.' };
|
|
112
116
|
continue;
|
|
113
117
|
}
|
|
118
|
+
// A relayed model is on the desktop: no probe is sent there, and its first real request shows its health.
|
|
119
|
+
if (provider.type === 'relayed') {
|
|
120
|
+
answered[index] = true;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
114
123
|
if (provider.type === 'andorra') {
|
|
115
124
|
// The client has the router's fresh answer (or asks it once now): no model request is sent to learn it again.
|
|
116
125
|
const known = await Promise.resolve(dependencies.andorra?.()).catch(() => undefined);
|
|
@@ -214,7 +223,7 @@ export async function checkSessionModelHealth(config, signal, dependencies = {})
|
|
|
214
223
|
const model = provider?.model ?? '(default model)';
|
|
215
224
|
if (!provider)
|
|
216
225
|
return { healthy: false, failures: [{ provider: config.provider, model, nodes, reason: 'Provider is not configured.' }] };
|
|
217
|
-
if (dependencies.verified?.has(provider, model))
|
|
226
|
+
if (provider.type === 'relayed' || dependencies.verified?.has(provider, model))
|
|
218
227
|
return { healthy: true, failures: [] };
|
|
219
228
|
const timeoutMs = dependencies.timeoutMs ?? 30_000;
|
|
220
229
|
// Andorra is asked once, by the probe: its refusals are sentences a model listing would not carry.
|
|
@@ -114,7 +114,7 @@ const GRAPH_ACTION_VERBS = {
|
|
|
114
114
|
andorra_graph_node_upsert: 'Set step', andorra_graph_node_patch: 'Edit step', andorra_graph_node_remove: 'Remove step',
|
|
115
115
|
andorra_graph_edge_upsert: 'Connect', andorra_graph_edge_remove: 'Remove connection', andorra_graph_patch: 'Edit graph',
|
|
116
116
|
andorra_graph_validate: 'Validate draft', andorra_graph_publish: 'Save version', andorra_graph_discard: 'Discard draft',
|
|
117
|
-
andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph',
|
|
117
|
+
andorra_graph_delete: 'Delete graph', andorra_graph_restore: 'Restore graph', andorra_graph_show: 'Show graph',
|
|
118
118
|
};
|
|
119
119
|
export function managerToolParts(name, value, openGraphId) {
|
|
120
120
|
const args = toolArguments(value);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Graph, type GraphNode } from './graphs.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the desktop app needs to draw a graph in a chat reply the way the Graph Editor draws it: each step's
|
|
4
|
+
* card (name, kind, model line, outcome ports, position) and each route. Instructions, schemas and every other
|
|
5
|
+
* setting stay out, so the preview stays small enough to travel in a tool reply.
|
|
6
|
+
*/
|
|
7
|
+
export interface GraphPreviewNode {
|
|
8
|
+
name: string;
|
|
9
|
+
type: GraphNode['type'];
|
|
10
|
+
agentRole?: 'orchestrator';
|
|
11
|
+
provider?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
/** Omitted when it is exactly ['completed'], the usual single port, to keep large previews small. */
|
|
14
|
+
outcomes?: string[];
|
|
15
|
+
/** An Action's kind, which names it on its card (Run command, Run tests, Git operation). */
|
|
16
|
+
action?: 'command' | 'tests' | 'git';
|
|
17
|
+
position?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface GraphPreview {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
/** 'draft' for an unpublished draft, otherwise the published revision shown. */
|
|
26
|
+
revision: number | 'draft';
|
|
27
|
+
/** A soft-deleted graph's revision, shown read-only. */
|
|
28
|
+
deleted?: true;
|
|
29
|
+
entry: string;
|
|
30
|
+
nodes: Record<string, GraphPreviewNode>;
|
|
31
|
+
edges: {
|
|
32
|
+
source: string;
|
|
33
|
+
outcome: string;
|
|
34
|
+
target: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
/** The ports a step's card shows, as the editor lists them (src/graph-ui/app.js `outcomes`): an Action always shows its failed port. */
|
|
38
|
+
export declare function previewOutcomes(node: GraphNode): string[];
|
|
39
|
+
/**
|
|
40
|
+
* `modelOf` names a provider's default model; called with undefined for a step that names no provider, it answers
|
|
41
|
+
* for the active one, as the editor's card does (app.js `nodeModelLabel`). A step's own provider is kept only when
|
|
42
|
+
* no model could be named, since the card shows one or the other.
|
|
43
|
+
*/
|
|
44
|
+
export declare function graphPreview(graph: Graph, revision: number | 'draft', modelOf?: (provider: string | undefined) => string | undefined): GraphPreview;
|
|
45
|
+
/** The same graph as plain text, for a host that cannot draw it: one line per route, the entry first. */
|
|
46
|
+
export declare function graphSketch(preview: GraphPreview): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { nodeOutcomes, optionalOutcomes } from './graphs.js';
|
|
2
|
+
/** The ports a step's card shows, as the editor lists them (src/graph-ui/app.js `outcomes`): an Action always shows its failed port. */
|
|
3
|
+
export function previewOutcomes(node) {
|
|
4
|
+
const outcomes = nodeOutcomes(node);
|
|
5
|
+
return [...outcomes, ...optionalOutcomes(node).filter(outcome => !outcomes.includes(outcome))];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `modelOf` names a provider's default model; called with undefined for a step that names no provider, it answers
|
|
9
|
+
* for the active one, as the editor's card does (app.js `nodeModelLabel`). A step's own provider is kept only when
|
|
10
|
+
* no model could be named, since the card shows one or the other.
|
|
11
|
+
*/
|
|
12
|
+
export function graphPreview(graph, revision, modelOf = () => undefined) {
|
|
13
|
+
const nodes = {};
|
|
14
|
+
for (const [id, node] of Object.entries(graph.nodes)) {
|
|
15
|
+
const model = node.type === 'agent' ? node.model ?? modelOf(node.provider) : undefined;
|
|
16
|
+
const outcomes = previewOutcomes(node);
|
|
17
|
+
nodes[id] = {
|
|
18
|
+
name: node.name || id,
|
|
19
|
+
type: node.type,
|
|
20
|
+
...(node.agentRole === 'orchestrator' ? { agentRole: 'orchestrator' } : {}),
|
|
21
|
+
...(node.type === 'agent' && node.provider && !model ? { provider: node.provider } : {}),
|
|
22
|
+
...(model ? { model } : {}),
|
|
23
|
+
...(outcomes.length === 1 && outcomes[0] === 'completed' ? {} : { outcomes }),
|
|
24
|
+
...(node.type === 'action' && node.action?.kind ? { action: node.action.kind } : {}),
|
|
25
|
+
...(node.position && Number.isFinite(node.position.x) && Number.isFinite(node.position.y) ? { position: { x: node.position.x, y: node.position.y } } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
id: graph.id, name: graph.name, revision, entry: graph.entry, nodes,
|
|
30
|
+
edges: graph.edges.filter(edge => Object.hasOwn(nodes, edge.source) && Object.hasOwn(nodes, edge.target))
|
|
31
|
+
.map(edge => ({ source: edge.source, outcome: edge.outcome ?? 'completed', target: edge.target })),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** The same graph as plain text, for a host that cannot draw it: one line per route, the entry first. */
|
|
35
|
+
export function graphSketch(preview) {
|
|
36
|
+
const label = (id) => {
|
|
37
|
+
const node = preview.nodes[id];
|
|
38
|
+
if (!node)
|
|
39
|
+
return id;
|
|
40
|
+
const kind = node.agentRole === 'orchestrator' ? 'orchestrator' : node.type;
|
|
41
|
+
const detail = node.model ?? node.provider;
|
|
42
|
+
return `${id} (${kind}${detail ? `, ${detail}` : ''})`;
|
|
43
|
+
};
|
|
44
|
+
const order = [preview.entry, ...Object.keys(preview.nodes).filter(id => id !== preview.entry)];
|
|
45
|
+
const lines = [`${preview.name} (${preview.id}, ${preview.revision === 'draft' ? 'draft' : `revision ${preview.revision}`}${preview.deleted ? ', deleted' : ''}), starts at ${preview.entry || '(no entry)'}`];
|
|
46
|
+
for (const id of order) {
|
|
47
|
+
for (const edge of preview.edges.filter(item => item.source === id))
|
|
48
|
+
lines.push(`${label(edge.source)} --${edge.outcome}--> ${label(edge.target)}`);
|
|
49
|
+
}
|
|
50
|
+
const routed = new Set(preview.edges.flatMap(edge => [edge.source, edge.target]));
|
|
51
|
+
for (const id of order)
|
|
52
|
+
if (!routed.has(id))
|
|
53
|
+
lines.push(`${label(id)} (no routes)`);
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PROVIDER_TYPES,
|
|
1
|
+
import { findProviderById, PROVIDER_TYPES, providerModelId } from './providers.js';
|
|
2
2
|
const profileKey = 'graphProviderProfilesV1';
|
|
3
3
|
export class GraphProviderUnavailableError extends Error {
|
|
4
4
|
constructor(message) {
|
|
@@ -51,11 +51,11 @@ export function stampGraphProviderProfiles(graph, config, selectedModels = {}) {
|
|
|
51
51
|
for (const reference of references(copy)) {
|
|
52
52
|
if (!reference.provider)
|
|
53
53
|
continue;
|
|
54
|
-
const provider = config.providers
|
|
54
|
+
const provider = findProviderById(config.providers, reference.provider);
|
|
55
55
|
if (!provider)
|
|
56
56
|
continue;
|
|
57
|
-
const selectedModel = Object.hasOwn(selectedModels, reference.provider)
|
|
58
|
-
? selectedModels[
|
|
57
|
+
const selectedModel = Object.hasOwn(selectedModels, reference.provider) ? selectedModels[reference.provider]
|
|
58
|
+
: Object.hasOwn(selectedModels, provider.id) ? selectedModels[provider.id] : undefined;
|
|
59
59
|
if (!selectedModel && Object.hasOwn(saved, reference.provider))
|
|
60
60
|
continue;
|
|
61
61
|
Object.defineProperty(saved, reference.provider, {
|
|
@@ -71,6 +71,9 @@ export function bindPortableGraphProviders(graph, config) {
|
|
|
71
71
|
const copy = structuredClone(graph);
|
|
72
72
|
const saved = profiles(copy);
|
|
73
73
|
const requirements = new Map();
|
|
74
|
+
// Subagent references without a provider of their own run on their node's provider; their model is respelled to it.
|
|
75
|
+
const inheritors = [];
|
|
76
|
+
const resolvedIds = new Map();
|
|
74
77
|
const add = (reference, inheritedModels = [], inheritsParentModel = false) => {
|
|
75
78
|
if (!reference.provider)
|
|
76
79
|
return;
|
|
@@ -100,8 +103,11 @@ export function bindPortableGraphProviders(graph, config) {
|
|
|
100
103
|
const children = policy.modelPolicy === 'per-role' ? policy.roles ?? []
|
|
101
104
|
: policy.modelPolicy === 'specific' ? [policy] : [];
|
|
102
105
|
for (const child of children) {
|
|
103
|
-
if (!child.provider && child.model)
|
|
106
|
+
if (!child.provider && child.model) {
|
|
104
107
|
inherited.push(child.model);
|
|
108
|
+
if (node.provider)
|
|
109
|
+
inheritors.push({ provider: node.provider, reference: child });
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
add(node, inherited);
|
|
@@ -118,13 +124,21 @@ export function bindPortableGraphProviders(graph, config) {
|
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
}
|
|
127
|
+
// A recorded profile is found under any spelling of its id, as the provider itself is.
|
|
128
|
+
const recorded = (id) => {
|
|
129
|
+
if (Object.hasOwn(saved, id))
|
|
130
|
+
return saved[id];
|
|
131
|
+
const matches = Object.keys(saved).filter(key => key.toLowerCase() === id.toLowerCase());
|
|
132
|
+
return matches.length === 1 ? saved[matches[0]] : undefined;
|
|
133
|
+
};
|
|
121
134
|
for (const [originalId, required] of requirements) {
|
|
122
|
-
const original =
|
|
135
|
+
const original = recorded(originalId);
|
|
123
136
|
const explicitModels = [...required.models];
|
|
124
137
|
const requiredModels = original && required.inheritsRecordedModel ? [...explicitModels, original.model] : explicitModels;
|
|
125
|
-
const offers = (provider, models) => models.every(model =>
|
|
126
|
-
|
|
127
|
-
const
|
|
138
|
+
const offers = (provider, models) => models.every(model => providerModelId(provider, model) !== undefined);
|
|
139
|
+
// A relayed provider is the desktop's own entry under its own id, whatever type the desktop saved it as.
|
|
140
|
+
const sameType = (provider) => !original || provider.type === 'relayed' || provider.type === original.type;
|
|
141
|
+
const exact = findProviderById(config.providers, originalId);
|
|
128
142
|
let resolved = exact && sameType(exact) && offers(exact, explicitModels) ? exact : undefined;
|
|
129
143
|
const exactResolved = resolved !== undefined;
|
|
130
144
|
if (!resolved && exact === undefined && original?.type === 'codex') {
|
|
@@ -144,15 +158,24 @@ export function bindPortableGraphProviders(graph, config) {
|
|
|
144
158
|
+ 'Connect the corresponding OAuth provider or configure the same provider ID and models in /providers, '
|
|
145
159
|
+ 'or start the task with a model override so every node runs on one provider.');
|
|
146
160
|
}
|
|
161
|
+
resolvedIds.set(originalId, resolved);
|
|
147
162
|
for (const tracked of required.references) {
|
|
148
163
|
tracked.reference.provider = resolved.id;
|
|
149
164
|
if (tracked.inheritsParentModel && !tracked.reference.model)
|
|
150
165
|
continue;
|
|
151
|
-
if (tracked.reference.model)
|
|
166
|
+
if (tracked.reference.model) {
|
|
167
|
+
// The request names the model as this machine's provider spells it.
|
|
168
|
+
tracked.reference.model = providerModelId(resolved, tracked.reference.model) ?? tracked.reference.model;
|
|
152
169
|
continue;
|
|
170
|
+
}
|
|
153
171
|
if (!exactResolved && original?.model)
|
|
154
|
-
tracked.reference.model = original.model;
|
|
172
|
+
tracked.reference.model = providerModelId(resolved, original.model) ?? original.model;
|
|
155
173
|
}
|
|
156
174
|
}
|
|
175
|
+
for (const { provider, reference } of inheritors) {
|
|
176
|
+
const resolved = resolvedIds.get(provider);
|
|
177
|
+
if (resolved && reference.model)
|
|
178
|
+
reference.model = providerModelId(resolved, reference.model) ?? reference.model;
|
|
179
|
+
}
|
|
157
180
|
return copy;
|
|
158
181
|
}
|
|
@@ -5,16 +5,43 @@ export declare const FREE_GRAPH_NODE_LIMIT = 3;
|
|
|
5
5
|
export declare const FREE_GRAPH_LIMIT_MESSAGE = "The free tier includes 1 custom graph. Upgrade to Premium to create more graphs.";
|
|
6
6
|
export declare const FREE_NODE_LIMIT_MESSAGE = "Free tier graphs can have up to 3 nodes, not counting Done. Upgrade to Premium for larger graphs.";
|
|
7
7
|
export declare const FREE_ORCHESTRATOR_MESSAGE = "The Orchestrator is a Premium feature. Free tier graphs can use the other agent nodes.";
|
|
8
|
-
export declare const FREE_LOCKED_GRAPH_MESSAGE = "
|
|
8
|
+
export declare const FREE_LOCKED_GRAPH_MESSAGE = "This graph is view only on the free tier. Duplicate it to make a copy you can change, or upgrade to Premium to use it.";
|
|
9
9
|
export declare function countedGraphNodes(graph: Pick<Graph, 'nodes'>): number;
|
|
10
10
|
export declare function freeTierGraphViolation(graph: Pick<Graph, 'nodes'>): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* A graph saved by a free account carries `metadata.freeTier: true`, and one saved by a Premium
|
|
13
|
+
* account carries `false`, so which plan made a graph travels with it to another machine.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isFreeTierGraph(graph: Pick<Graph, 'metadata'>): boolean;
|
|
11
16
|
export interface GraphQuota {
|
|
12
17
|
customGraphs: number;
|
|
18
|
+
/** The one graph a free account may change and run. Absent when every saved graph is view only. */
|
|
13
19
|
freeGraphId?: string;
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
/** Records that a Premium account used this graph folder, so its graphs lock when the account is later free. */
|
|
22
|
+
export declare function notePremiumGraphAccount(directory: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Which saved graph is the free account's own.
|
|
25
|
+
*
|
|
26
|
+
* It is the oldest graph that fits the free limits and either carries the free mark or is the one
|
|
27
|
+
* this folder recorded. A folder no Premium account has used, and that has recorded nothing, keeps
|
|
28
|
+
* its oldest graph that fits: that is the graph a free account owned before graphs carried a mark. `adopt`
|
|
29
|
+
* writes that choice down, so a later upgrade and downgrade does not lose it; pass it only for an
|
|
30
|
+
* account the service confirmed as free.
|
|
31
|
+
*/
|
|
32
|
+
export declare function readGraphQuota(directory: string, graphs?: Graph[], options?: {
|
|
33
|
+
adopt?: boolean;
|
|
34
|
+
}): Promise<GraphQuota>;
|
|
16
35
|
export declare function assertFreeTierSave(graph: Graph, isNew: boolean, directory: string): Promise<void>;
|
|
17
36
|
export declare function saveFreeTierGraph(graph: Graph, expectedRevision: number | null, directory: string): Promise<Graph>;
|
|
37
|
+
/**
|
|
38
|
+
* Saves for a Premium account, marking the graph as made on Premium. The account's own free graph
|
|
39
|
+
* keeps its mark while it fits the free limits, so it is still the free graph after a downgrade.
|
|
40
|
+
* Growing it past the limits gives the mark up for good, as the storage service gives up its pin:
|
|
41
|
+
* shrinking it later must not take the allowance back from the graph that replaced it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function savePremiumGraph(graph: Graph, expectedRevision: number | null, directory: string): Promise<Graph>;
|
|
44
|
+
/** The graph a free account may run: its own graph, within the free limits. Every other saved graph is view only. */
|
|
18
45
|
export declare function loadFreeTierGraph(id: string, directory: string): Promise<Graph>;
|
|
19
46
|
export declare class FreeTierLimitError extends PaidMembershipRequiredError {
|
|
20
47
|
readonly code = "FREE_TIER_LIMIT";
|