@illuminis/comprism 0.1.8 → 2.4.0
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/out/{graph → build/machine/codemap}/read-python.js +2 -2
- package/out/{executor → build/machine/executor}/diagnostics.js +1 -1
- package/out/{executor → build/machine/executor}/hooks.js +1 -1
- package/out/{executor → build/machine/executor}/sandbox.js +1 -1
- package/out/build/machine/line/index.js +339 -0
- package/out/{commands/privacy.js → build/machine/runtime/home.js} +10 -19
- package/out/build/machine/runtime/needs.js +89 -0
- package/out/{lib → build/machine/runtime}/self.js +25 -3
- package/out/build/machine/terminal/jobs.js +67 -0
- package/out/build/machine/terminal/sign-in.js +212 -0
- package/out/build/machine/terminal/steps.js +460 -0
- package/out/build/machine/terminal/voice.js +136 -0
- package/out/build/machine/voice/record.js +286 -0
- package/out/cli-start.js +128 -0
- package/out/machine/line/index.js +339 -0
- package/out/machine/runtime/self.js +22 -0
- package/out/machine/terminal/clipboard.js +182 -0
- package/out/machine/terminal/jobs.js +67 -0
- package/out/machine/terminal/sign-in.js +212 -0
- package/out/machine/terminal/steps.js +460 -0
- package/out/machine/terminal/voice.js +136 -0
- package/out/machine/voice/record.js +79 -1
- package/out/native/dictate +0 -0
- package/out/server.generated.js +6 -0
- package/package.json +8 -40
- package/README.md +0 -343
- package/out/agent/command.d.ts +0 -157
- package/out/agent/command.js +0 -454
- package/out/agent/render.d.ts +0 -169
- package/out/agent/render.js +0 -689
- package/out/agent/session.d.ts +0 -334
- package/out/agent/session.js +0 -1232
- package/out/commands/agents.d.ts +0 -2
- package/out/commands/agents.js +0 -79
- package/out/commands/ask.d.ts +0 -1
- package/out/commands/ask.js +0 -222
- package/out/commands/codemap.d.ts +0 -2
- package/out/commands/codemap.js +0 -151
- package/out/commands/commands-thin.d.ts +0 -39
- package/out/commands/commands-thin.js +0 -244
- package/out/commands/config.d.ts +0 -1
- package/out/commands/config.js +0 -138
- package/out/commands/cost.d.ts +0 -1
- package/out/commands/cost.js +0 -167
- package/out/commands/decisionEngine.d.ts +0 -1
- package/out/commands/decisionEngine.js +0 -66
- package/out/commands/hooks.d.ts +0 -1
- package/out/commands/hooks.js +0 -83
- package/out/commands/install.d.ts +0 -206
- package/out/commands/install.js +0 -738
- package/out/commands/instructions.d.ts +0 -1
- package/out/commands/instructions.js +0 -113
- package/out/commands/integrations.d.ts +0 -3
- package/out/commands/integrations.js +0 -215
- package/out/commands/jobs.d.ts +0 -5
- package/out/commands/jobs.js +0 -157
- package/out/commands/keys.d.ts +0 -55
- package/out/commands/keys.js +0 -344
- package/out/commands/login.d.ts +0 -9
- package/out/commands/login.js +0 -606
- package/out/commands/memory.d.ts +0 -3
- package/out/commands/memory.js +0 -113
- package/out/commands/permissions.d.ts +0 -1
- package/out/commands/permissions.js +0 -94
- package/out/commands/plugins.d.ts +0 -4
- package/out/commands/plugins.js +0 -192
- package/out/commands/privacy.d.ts +0 -1
- package/out/commands/providerKey.d.ts +0 -32
- package/out/commands/providerKey.js +0 -108
- package/out/commands/repl.d.ts +0 -12
- package/out/commands/repl.js +0 -2303
- package/out/commands/report.d.ts +0 -39
- package/out/commands/report.js +0 -115
- package/out/commands/review.d.ts +0 -5
- package/out/commands/review.js +0 -223
- package/out/commands/sessions.d.ts +0 -23
- package/out/commands/sessions.js +0 -115
- package/out/commands/settings.d.ts +0 -23
- package/out/commands/settings.js +0 -153
- package/out/commands/skills.d.ts +0 -21
- package/out/commands/skills.js +0 -207
- package/out/commands/unattended.d.ts +0 -7
- package/out/commands/unattended.js +0 -351
- package/out/commands/update.d.ts +0 -1
- package/out/commands/update.js +0 -123
- package/out/commands/welcome.d.ts +0 -25
- package/out/commands/welcome.js +0 -223
- package/out/commands/worktrees.d.ts +0 -5
- package/out/commands/worktrees.js +0 -186
- package/out/executor/browser.d.ts +0 -14
- package/out/executor/diagnostics.d.ts +0 -2
- package/out/executor/documents.d.ts +0 -40
- package/out/executor/files.d.ts +0 -2
- package/out/executor/git.d.ts +0 -48
- package/out/executor/hooks.d.ts +0 -51
- package/out/executor/index.d.ts +0 -45
- package/out/executor/notebook.d.ts +0 -2
- package/out/executor/paths.d.ts +0 -20
- package/out/executor/sandbox.d.ts +0 -40
- package/out/executor/shell.d.ts +0 -86
- package/out/executor/toolservers.d.ts +0 -20
- package/out/executor/worktree.d.ts +0 -9
- package/out/graph/build.d.ts +0 -45
- package/out/graph/facts.d.ts +0 -47
- package/out/graph/files.d.ts +0 -45
- package/out/graph/read-locales.d.ts +0 -29
- package/out/graph/read-python.d.ts +0 -11
- package/out/graph/read-typescript.d.ts +0 -16
- package/out/graph/sync.d.ts +0 -66
- package/out/graph/sync.js +0 -242
- package/out/lib/attach.d.ts +0 -106
- package/out/lib/attach.js +0 -396
- package/out/lib/clipboard.d.ts +0 -23
- package/out/lib/commandlist.d.ts +0 -20
- package/out/lib/commandlist.js +0 -58
- package/out/lib/config.d.ts +0 -94
- package/out/lib/config.js +0 -197
- package/out/lib/connection.d.ts +0 -73
- package/out/lib/connection.js +0 -188
- package/out/lib/decision.d.ts +0 -22
- package/out/lib/decision.js +0 -50
- package/out/lib/fingerprint.d.ts +0 -25
- package/out/lib/fingerprint.js +0 -58
- package/out/lib/gateway.d.ts +0 -427
- package/out/lib/gateway.js +0 -226
- package/out/lib/history.d.ts +0 -24
- package/out/lib/history.js +0 -137
- package/out/lib/ide.d.ts +0 -19
- package/out/lib/ide.js +0 -131
- package/out/lib/keyboard.d.ts +0 -98
- package/out/lib/keyboard.js +0 -390
- package/out/lib/lastlogin.d.ts +0 -14
- package/out/lib/lastlogin.js +0 -105
- package/out/lib/machine.d.ts +0 -21
- package/out/lib/machine.js +0 -91
- package/out/lib/notify.d.ts +0 -4
- package/out/lib/notify.js +0 -52
- package/out/lib/output.d.ts +0 -48
- package/out/lib/output.js +0 -108
- package/out/lib/picker.d.ts +0 -1
- package/out/lib/picker.js +0 -158
- package/out/lib/project-ops.d.ts +0 -19
- package/out/lib/project-ops.js +0 -146
- package/out/lib/project.d.ts +0 -28
- package/out/lib/prompt.d.ts +0 -37
- package/out/lib/prompt.js +0 -142
- package/out/lib/queue.d.ts +0 -13
- package/out/lib/queue.js +0 -116
- package/out/lib/readiness.d.ts +0 -22
- package/out/lib/readiness.js +0 -207
- package/out/lib/self.d.ts +0 -23
- package/out/lib/servicecommand.d.ts +0 -14
- package/out/lib/servicecommand.js +0 -74
- package/out/lib/sessions.d.ts +0 -19
- package/out/lib/sessions.js +0 -221
- package/out/lib/startcache.d.ts +0 -13
- package/out/lib/startcache.js +0 -78
- package/out/lib/stdin.d.ts +0 -32
- package/out/lib/stdin.js +0 -117
- package/out/lib/store.d.ts +0 -40
- package/out/lib/store.js +0 -138
- package/out/lib/sync.d.ts +0 -18
- package/out/lib/sync.js +0 -81
- package/out/lib/types.d.ts +0 -417
- package/out/lib/types.js +0 -21
- package/out/lib/ui.d.ts +0 -123
- package/out/lib/ui.js +0 -299
- package/out/lib/version.d.ts +0 -23
- package/out/lib/version.js +0 -46
- package/out/lib/voice.d.ts +0 -49
- package/out/lib/voice.js +0 -236
- package/out/lib/words.d.ts +0 -20
- package/out/lib/words.js +0 -27
- package/out/machine/codemap/build.d.ts +0 -45
- package/out/machine/codemap/facts.d.ts +0 -47
- package/out/machine/codemap/files.d.ts +0 -45
- package/out/machine/codemap/read-locales.d.ts +0 -29
- package/out/machine/codemap/read-python.d.ts +0 -11
- package/out/machine/codemap/read-typescript.d.ts +0 -16
- package/out/machine/executor/browser.d.ts +0 -14
- package/out/machine/executor/diagnostics.d.ts +0 -2
- package/out/machine/executor/documents.d.ts +0 -40
- package/out/machine/executor/files.d.ts +0 -2
- package/out/machine/executor/git.d.ts +0 -48
- package/out/machine/executor/hooks.d.ts +0 -51
- package/out/machine/executor/index.d.ts +0 -45
- package/out/machine/executor/notebook.d.ts +0 -2
- package/out/machine/executor/paths.d.ts +0 -20
- package/out/machine/executor/sandbox.d.ts +0 -40
- package/out/machine/executor/shell.d.ts +0 -86
- package/out/machine/executor/toolservers.d.ts +0 -20
- package/out/machine/executor/worktree.d.ts +0 -9
- package/out/machine/folder/project.d.ts +0 -28
- package/out/machine/runtime/home.d.ts +0 -2
- package/out/machine/runtime/needs.d.ts +0 -30
- package/out/machine/runtime/self.d.ts +0 -23
- package/out/machine/voice/record.d.ts +0 -38
- package/out/postinstall.d.ts +0 -2
- package/out/postinstall.js +0 -120
- package/out/providers/anthropic.d.ts +0 -22
- package/out/providers/anthropic.js +0 -80
- package/out/providers/index.d.ts +0 -8
- package/out/providers/index.js +0 -84
- package/out/providers/openai.d.ts +0 -11
- package/out/providers/openai.js +0 -57
- package/out/thin.d.ts +0 -2
- package/out/thin.js +0 -855
- package/scripts/read_python.py +0 -270
- /package/out/{graph → build/machine/codemap}/build.js +0 -0
- /package/out/{graph → build/machine/codemap}/facts.js +0 -0
- /package/out/{graph → build/machine/codemap}/files.js +0 -0
- /package/out/{graph → build/machine/codemap}/read-locales.js +0 -0
- /package/out/{graph → build/machine/codemap}/read-typescript.js +0 -0
- /package/out/{executor → build/machine/executor}/browser.js +0 -0
- /package/out/{executor → build/machine/executor}/documents.js +0 -0
- /package/out/{executor → build/machine/executor}/files.js +0 -0
- /package/out/{executor → build/machine/executor}/git.js +0 -0
- /package/out/{executor → build/machine/executor}/index.js +0 -0
- /package/out/{executor → build/machine/executor}/notebook.js +0 -0
- /package/out/{executor → build/machine/executor}/paths.js +0 -0
- /package/out/{executor → build/machine/executor}/shell.js +0 -0
- /package/out/{executor → build/machine/executor}/toolservers.js +0 -0
- /package/out/{executor → build/machine/executor}/worktree.js +0 -0
- /package/out/{lib → build/machine/folder}/project.js +0 -0
- /package/out/{lib → build/machine/terminal}/clipboard.js +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type SandboxSystem = "macOS" | "Linux";
|
|
2
|
-
/** Which sandbox this machine offers, or why none. */
|
|
3
|
-
export declare function availability(): {
|
|
4
|
-
system: SandboxSystem | null;
|
|
5
|
-
why: string;
|
|
6
|
-
};
|
|
7
|
-
/** Does this host match an allowed address: exact, or `*.example.com`. */
|
|
8
|
-
export declare function hostAllowed(host: string, allow: string[]): boolean;
|
|
9
|
-
export declare class Sandbox {
|
|
10
|
-
readonly system: SandboxSystem;
|
|
11
|
-
private readonly writable;
|
|
12
|
-
private allow;
|
|
13
|
-
private proxy;
|
|
14
|
-
private port;
|
|
15
|
-
/** Hosts refused since the last `takeBlocked`, for the result to name. */
|
|
16
|
-
private blocked;
|
|
17
|
-
constructor(system: SandboxSystem, root: string, added: string[]);
|
|
18
|
-
/** The allowed internet addresses, as the service sent them. */
|
|
19
|
-
setAllowed(allow: string[]): void;
|
|
20
|
-
/** Where the gatekeeper listens on Linux: a socket file the relay inside
|
|
21
|
-
* the sandbox connects to, and a folder for the relay's ready marks. */
|
|
22
|
-
private socketPath;
|
|
23
|
-
private marks;
|
|
24
|
-
private calls;
|
|
25
|
-
/** Start the gatekeeper. Idempotent. */
|
|
26
|
-
start(): Promise<void>;
|
|
27
|
-
close(): void;
|
|
28
|
-
/** The hosts refused since the last call. */
|
|
29
|
-
takeBlocked(): string[];
|
|
30
|
-
private profile;
|
|
31
|
-
/** The program and arguments that run `command` inside the sandbox, and
|
|
32
|
-
* the variables that send its web traffic to the gatekeeper. */
|
|
33
|
-
wrap(command: string, cwd: string): {
|
|
34
|
-
file: string;
|
|
35
|
-
args: string[];
|
|
36
|
-
env: Record<string, string>;
|
|
37
|
-
};
|
|
38
|
-
/** What was blocked, in the manual's words, or null (manual 4.12). */
|
|
39
|
-
explain(output: string, hosts: string[]): string | null;
|
|
40
|
-
}
|
package/out/executor/shell.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export interface RunResult {
|
|
2
|
-
content: string;
|
|
3
|
-
isError?: boolean;
|
|
4
|
-
summary?: string;
|
|
5
|
-
/** Counts the service turns into the action line: the lines read, the
|
|
6
|
-
* matches found and how many were left out (manual 5.3, 5.4). Numbers only;
|
|
7
|
-
* the wording is the service's. */
|
|
8
|
-
facts?: Record<string, number | string>;
|
|
9
|
-
}
|
|
10
|
-
export declare function safeEnvironment(from?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
11
|
-
/** The default time limit on a command (manual 5.12). */
|
|
12
|
-
export declare const DEFAULT_TIMEOUT_MS = 120000;
|
|
13
|
-
export declare function keptOutput(n: number): {
|
|
14
|
-
command: string;
|
|
15
|
-
text: string;
|
|
16
|
-
} | undefined;
|
|
17
|
-
export interface ShellOptions {
|
|
18
|
-
root: string;
|
|
19
|
-
cwd?: string;
|
|
20
|
-
timeoutMs?: number;
|
|
21
|
-
onOutput?: (chunk: string) => void;
|
|
22
|
-
/** Extra variables for this one command.
|
|
23
|
-
*
|
|
24
|
-
* Used by hooks, so a project's own script can read which file the agent
|
|
25
|
-
* just touched without the agent having to rewrite the script's arguments.
|
|
26
|
-
* Still filtered by `safeEnvironment`, so a hook cannot be handed a
|
|
27
|
-
* credential this way either. */
|
|
28
|
-
extraEnv?: Record<string, string>;
|
|
29
|
-
/** What the command is called in `output N`. */
|
|
30
|
-
label?: string;
|
|
31
|
-
/** Written to the command's standard input, then closed. Hooks read their
|
|
32
|
-
* details this way (manual 10.9). Absent, standard input is closed. */
|
|
33
|
-
input?: string;
|
|
34
|
-
/** The operating system's sandbox, when the service turned it on for this
|
|
35
|
-
* job (manual 4.12). Every command then runs inside it. */
|
|
36
|
-
sandbox?: import("./sandbox").Sandbox;
|
|
37
|
-
}
|
|
38
|
-
/** Run a command and wait for it.
|
|
39
|
-
*
|
|
40
|
-
* Never throws for an ordinary failure. A command that exits non-zero is a
|
|
41
|
-
* RESULT: it is usually the most useful thing that can happen, because it is
|
|
42
|
-
* how the agent learns what is wrong.
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* The shell a command runs in: the system shell on macOS and Linux, and
|
|
46
|
-
* PowerShell on Windows (manual 1.2), which is what a Windows developer types
|
|
47
|
-
* into and what the agent is told it is writing for.
|
|
48
|
-
*/
|
|
49
|
-
export declare function shellFor(command: string): [string, string[], boolean];
|
|
50
|
-
export declare function runCommand(command: string, opts: ShellOptions): Promise<RunResult>;
|
|
51
|
-
/** Run one program with its arguments as a list, and no shell in between.
|
|
52
|
-
*
|
|
53
|
-
* For commands this tool builds itself, such as git. A shell would have to be
|
|
54
|
-
* told how to quote each argument, and the quoting differs by shell: the POSIX
|
|
55
|
-
* single quotes that kept a commit message whole on macOS and Linux reached
|
|
56
|
-
* git on Windows as literal characters, so a commit read `'fix` and a branch
|
|
57
|
-
* name no longer matched. With no shell there is nothing to quote, on any
|
|
58
|
-
* system, and a model written message cannot become a second command. */
|
|
59
|
-
export declare function runProgram(file: string, args: string[], opts: ShellOptions): Promise<RunResult>;
|
|
60
|
-
/** Stop every foreground command and everything it started. */
|
|
61
|
-
export declare function stopForeground(): void;
|
|
62
|
-
export declare function startBackground(command: string, opts: ShellOptions): RunResult;
|
|
63
|
-
export declare function readOutput(id: string): RunResult;
|
|
64
|
-
/** Stop one process this tool started, and everything it started, by the
|
|
65
|
-
* number it was given. Never by name or by port (manual 5.13). */
|
|
66
|
-
export declare function stopProcess(id: string): RunResult;
|
|
67
|
-
/** What this session started and is still tracking, for `processes`. */
|
|
68
|
-
export declare function listProcesses(): Array<{
|
|
69
|
-
id: string;
|
|
70
|
-
command: string;
|
|
71
|
-
running: boolean;
|
|
72
|
-
seconds: number;
|
|
73
|
-
port?: number;
|
|
74
|
-
}>;
|
|
75
|
-
/** Everything still running, stopped, and what was stopped. Called when a
|
|
76
|
-
* session ends, so a job that started a dev server does not leave it holding
|
|
77
|
-
* a port after the person has closed the terminal (manual 5.13). */
|
|
78
|
-
export declare function stopEverything(): string[];
|
|
79
|
-
export declare function guessTestCommand(root: string): string | null;
|
|
80
|
-
export declare function runTests(opts: ShellOptions & {
|
|
81
|
-
command?: string;
|
|
82
|
-
path?: string;
|
|
83
|
-
}): Promise<RunResult & {
|
|
84
|
-
passed?: boolean;
|
|
85
|
-
command?: string;
|
|
86
|
-
}>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** The tool servers one job started, by name. */
|
|
2
|
-
export declare class ToolServers {
|
|
3
|
-
private readonly cwd;
|
|
4
|
-
private running;
|
|
5
|
-
constructor(cwd: string);
|
|
6
|
-
private server;
|
|
7
|
-
/** The server's tools, as it described them, as JSON text. */
|
|
8
|
-
list(name: string, command: string): Promise<{
|
|
9
|
-
isError: boolean;
|
|
10
|
-
content: string;
|
|
11
|
-
}>;
|
|
12
|
-
/** One call, and the text the server returned. */
|
|
13
|
-
call(name: string, command: string, tool: string, args: Record<string, unknown>): Promise<{
|
|
14
|
-
isError: boolean;
|
|
15
|
-
content: string;
|
|
16
|
-
}>;
|
|
17
|
-
/** Every server this job started, stopped. Called when the job ends. */
|
|
18
|
-
stopAll(): void;
|
|
19
|
-
get count(): number;
|
|
20
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RunResult, ShellOptions } from "./shell";
|
|
2
|
-
/** Where a copy is, by its id, or undefined. */
|
|
3
|
-
export declare function worktreePath(id: string): string | undefined;
|
|
4
|
-
export declare function openWorktree(id: string, opts: ShellOptions): Promise<RunResult>;
|
|
5
|
-
/** What the helper changed in its copy, as one diff. */
|
|
6
|
-
export declare function diffWorktree(id: string, opts: ShellOptions): Promise<RunResult>;
|
|
7
|
-
export declare function closeWorktree(id: string, opts: ShellOptions): Promise<RunResult>;
|
|
8
|
-
/** Every copy this process made, removed; for the end of a session. */
|
|
9
|
-
export declare function closeAllWorktrees(root: string): Promise<void>;
|
package/out/graph/build.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn a folder of source files into code map facts, on the machine that holds
|
|
3
|
-
* them.
|
|
4
|
-
*
|
|
5
|
-
* Reading is the only part of the map that happens here. The joining, the
|
|
6
|
-
* storing and the answering all happen in the service, because a client that
|
|
7
|
-
* joined the map would be a client holding an opinion, and because a map that
|
|
8
|
-
* lived on one laptop could not be read by the same person's editor an hour
|
|
9
|
-
* later.
|
|
10
|
-
*/
|
|
11
|
-
import type { FactSet } from "./facts";
|
|
12
|
-
import { IndexedFile } from "./files";
|
|
13
|
-
export interface ReadResult {
|
|
14
|
-
/** One entry per file successfully read. */
|
|
15
|
-
facts: Record<string, FactSet>;
|
|
16
|
-
failures: {
|
|
17
|
-
file: string;
|
|
18
|
-
reason: string;
|
|
19
|
-
}[];
|
|
20
|
-
/** Files present in the project that no reader on this machine can read. */
|
|
21
|
-
unread: {
|
|
22
|
-
python: number;
|
|
23
|
-
typescript: number;
|
|
24
|
-
};
|
|
25
|
-
seconds: number;
|
|
26
|
-
}
|
|
27
|
-
/** What this machine can read at all, said plainly and once. */
|
|
28
|
-
export declare function readers(): {
|
|
29
|
-
python: boolean;
|
|
30
|
-
typescript: boolean;
|
|
31
|
-
};
|
|
32
|
-
/** Read the named files. Everything when `rels` is absent. */
|
|
33
|
-
export declare function readFacts(root: string, rels?: string[], knownNames?: string[]): ReadResult;
|
|
34
|
-
export interface ProjectState {
|
|
35
|
-
files: IndexedFile[];
|
|
36
|
-
stamps: Record<string, string>;
|
|
37
|
-
fingerprint: {
|
|
38
|
-
hash: string;
|
|
39
|
-
files: number;
|
|
40
|
-
};
|
|
41
|
-
commit: string;
|
|
42
|
-
}
|
|
43
|
-
/** What the project looks like right now: which files, and one short string
|
|
44
|
-
* that changes the moment any of them does. Costs about ten milliseconds. */
|
|
45
|
-
export declare function projectState(root: string): ProjectState;
|
package/out/graph/facts.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The one shape both readers emit, and the only thing that ever leaves the
|
|
3
|
-
* machine.
|
|
4
|
-
*
|
|
5
|
-
* An object and a link, each carrying a file and a line. Nothing else. No file
|
|
6
|
-
* contents, no source text, no string a person wrote. That is what makes
|
|
7
|
-
* sending the map to the service a different act from sending the code: the
|
|
8
|
-
* service learns that a function called `price_of` exists at line 40 of a named
|
|
9
|
-
* file and what calls it, and it never learns what that function says.
|
|
10
|
-
*/
|
|
11
|
-
export interface GraphObject {
|
|
12
|
-
/** Unique within a project. A file is its own path; a symbol is `file::name`. */
|
|
13
|
-
id: string;
|
|
14
|
-
/** file, function, method, class, component, model, table, route. */
|
|
15
|
-
kind: string;
|
|
16
|
-
name: string;
|
|
17
|
-
file: string;
|
|
18
|
-
line: number;
|
|
19
|
-
[extra: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
export interface GraphLink {
|
|
22
|
-
from: string;
|
|
23
|
-
/** imports, defines, calls, renders, inherits, references, maps_to,
|
|
24
|
-
* handled_by, declares, calls_endpoint, browser_route. */
|
|
25
|
-
kind: string;
|
|
26
|
-
/** Set when the reader could resolve the far end itself. */
|
|
27
|
-
to?: string;
|
|
28
|
-
/** Set when it could not, and the service joins it up. */
|
|
29
|
-
to_name?: string;
|
|
30
|
-
[extra: string]: unknown;
|
|
31
|
-
}
|
|
32
|
-
export interface FactSet {
|
|
33
|
-
objects: GraphObject[];
|
|
34
|
-
links: GraphLink[];
|
|
35
|
-
/** A file that declares routers, and what each is mounted under. Python only:
|
|
36
|
-
* an endpoint's path is written relative to a router that is mounted with a
|
|
37
|
-
* prefix in a different file, and without both halves the front end and the
|
|
38
|
-
* back end never join up. */
|
|
39
|
-
routers?: {
|
|
40
|
-
prefixes: Record<string, string>;
|
|
41
|
-
mounts: {
|
|
42
|
-
target: string;
|
|
43
|
-
prefix: string;
|
|
44
|
-
line: number;
|
|
45
|
-
}[];
|
|
46
|
-
};
|
|
47
|
-
}
|
package/out/graph/files.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** How many files one project may have indexed. A ceiling, not a guess: a
|
|
2
|
-
* monorepo of forty thousand files would take minutes to read and produce a
|
|
3
|
-
* map too large to be worth sending, and half a map that claims to be whole is
|
|
4
|
-
* the failure this whole feature exists to avoid. Past this the map says
|
|
5
|
-
* plainly that it covers part of the project. */
|
|
6
|
-
export declare const MAX_FILES = 6000;
|
|
7
|
-
/** How large a single file may be before it is skipped. A generated bundle or
|
|
8
|
-
* a checked-in minified file is not code anybody navigates. */
|
|
9
|
-
export declare const MAX_FILE_BYTES = 1500000;
|
|
10
|
-
export declare const PY_EXT: Set<string>;
|
|
11
|
-
export declare const TS_EXT: Set<string>;
|
|
12
|
-
export interface IndexedFile {
|
|
13
|
-
/** Path relative to the project root, forward slashes, always. */
|
|
14
|
-
rel: string;
|
|
15
|
-
size: number;
|
|
16
|
-
mtimeMs: number;
|
|
17
|
-
lang: "python" | "typescript" | "translations";
|
|
18
|
-
}
|
|
19
|
-
/** Every file the map covers, in a stable order.
|
|
20
|
-
*
|
|
21
|
-
* Sorted, and that is not cosmetic: the fingerprint below is a hash over this
|
|
22
|
-
* list, so an unstable order would report the code had moved every time the
|
|
23
|
-
* filesystem felt like returning entries differently. */
|
|
24
|
-
export declare function indexedFiles(root: string): IndexedFile[];
|
|
25
|
-
/** One short string per file that changes whenever that file does.
|
|
26
|
-
*
|
|
27
|
-
* Size and modified time rather than a hash of the contents: reading six
|
|
28
|
-
* thousand files to find out whether any of them changed costs more than
|
|
29
|
-
* rebuilding the map. A file edited back to its original contents within the
|
|
30
|
-
* same millisecond would be missed, which is a case that does not occur in
|
|
31
|
-
* practice and is corrected by the next ordinary edit. */
|
|
32
|
-
export declare function stampOf(file: IndexedFile): string;
|
|
33
|
-
/** One short string for the whole project. Saying the code has not moved is a
|
|
34
|
-
* claim, and this is the evidence for it. */
|
|
35
|
-
export declare function fingerprint(files: IndexedFile[]): {
|
|
36
|
-
hash: string;
|
|
37
|
-
files: number;
|
|
38
|
-
};
|
|
39
|
-
/** The commit the project is standing on, when it is a repository at all.
|
|
40
|
-
*
|
|
41
|
-
* Read with a plain file read rather than by running git, because this is
|
|
42
|
-
* called at the start of every job and spawning a process there is a cost paid
|
|
43
|
-
* on work that has nothing to do with the map. A project with no git still
|
|
44
|
-
* gets a usable map; it simply cannot stamp an answer with a commit. */
|
|
45
|
-
export declare function headCommit(root: string): string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { FactSet } from "./facts";
|
|
2
|
-
/** Is this JSON file a translation file?
|
|
3
|
-
*
|
|
4
|
-
* Both conditions, not either: a `data/en.json` of sample records is not a
|
|
5
|
-
* translation file, and a `locales/schema.json` is not one either. Indexing
|
|
6
|
-
* the wrong JSON would fill the map with things nobody asked about. */
|
|
7
|
-
export declare function looksLikeTranslations(rel: string): boolean;
|
|
8
|
-
/** The language a translation file is for, from its own name. */
|
|
9
|
-
export declare function languageOf(rel: string): string;
|
|
10
|
-
interface KeyAt {
|
|
11
|
-
key: string;
|
|
12
|
-
line: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Every leaf key in a translation file, with the line it sits on.
|
|
16
|
-
*
|
|
17
|
-
* A single pass over the text, tracking strings, escapes, nesting and lines. It
|
|
18
|
-
* reads the structure rather than the values: what a translation SAYS never
|
|
19
|
-
* leaves the machine, only that the key exists and where.
|
|
20
|
-
*/
|
|
21
|
-
export declare function scanKeys(text: string): KeyAt[];
|
|
22
|
-
export declare function readLocales(root: string, rels: string[]): {
|
|
23
|
-
facts: Record<string, FactSet>;
|
|
24
|
-
failures: {
|
|
25
|
-
file: string;
|
|
26
|
-
reason: string;
|
|
27
|
-
}[];
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { FactSet } from "./facts";
|
|
2
|
-
/** Which Python this machine has, or null. Asked once per process. */
|
|
3
|
-
export declare function findPython(): string | null;
|
|
4
|
-
export declare function readPython(root: string, rels: string[]): {
|
|
5
|
-
facts: Record<string, FactSet>;
|
|
6
|
-
failures: {
|
|
7
|
-
file: string;
|
|
8
|
-
reason: string;
|
|
9
|
-
}[];
|
|
10
|
-
available: boolean;
|
|
11
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FactSet } from "./facts";
|
|
2
|
-
type Ts = any;
|
|
3
|
-
/** The TypeScript compiler, or null when this installation has none. */
|
|
4
|
-
export declare function loadCompiler(): Ts | null;
|
|
5
|
-
/** Read every named file. A file that cannot be parsed is REPORTED, never
|
|
6
|
-
* silently dropped: a map that quietly covers less than it claims is the one
|
|
7
|
-
* failure mode worth engineering against. */
|
|
8
|
-
export declare function readTypeScript(root: string, rels: string[]): {
|
|
9
|
-
facts: Record<string, FactSet>;
|
|
10
|
-
failures: {
|
|
11
|
-
file: string;
|
|
12
|
-
reason: string;
|
|
13
|
-
}[];
|
|
14
|
-
available: boolean;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
package/out/graph/sync.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export interface SyncOutcome {
|
|
2
|
-
/** Whether the service now holds a map of this project that matches disk. */
|
|
3
|
-
current: boolean;
|
|
4
|
-
/** Whether this company uses the map at all. */
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
/** What happened, in one sentence a person can read. */
|
|
7
|
-
message: string;
|
|
8
|
-
filesRead: number;
|
|
9
|
-
filesTotal: number;
|
|
10
|
-
seconds: number;
|
|
11
|
-
/** Files present that no reader on this machine could read. */
|
|
12
|
-
unread: number;
|
|
13
|
-
}
|
|
14
|
-
/** What the service holds for this project, and whether it matches disk. */
|
|
15
|
-
export declare function status(root: string, workspace: string, opts?: {
|
|
16
|
-
withStamps?: boolean;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
autoRefresh: boolean;
|
|
20
|
-
fresh: boolean;
|
|
21
|
-
hasMap: boolean;
|
|
22
|
-
held: Record<string, unknown> | null;
|
|
23
|
-
reachable: boolean;
|
|
24
|
-
stamps: Record<string, string> | null;
|
|
25
|
-
definedNames: string[];
|
|
26
|
-
}>;
|
|
27
|
-
/**
|
|
28
|
-
* Bring the map up to date, reading only the files that moved.
|
|
29
|
-
*
|
|
30
|
-
* `force` reads everything again, which is what the manual refresh does: a
|
|
31
|
-
* person asking for a rebuild has usually just had an answer they did not
|
|
32
|
-
* believe, and telling them nothing needed doing is not an answer.
|
|
33
|
-
*/
|
|
34
|
-
export declare function refresh(root: string, workspace: string, opts?: {
|
|
35
|
-
force?: boolean;
|
|
36
|
-
}): Promise<SyncOutcome>;
|
|
37
|
-
/** What was read and what was not, in one sentence an answer can carry.
|
|
38
|
-
*
|
|
39
|
-
* Said out loud rather than hidden. A map that quietly covers less than it
|
|
40
|
-
* claims is the one failure worth engineering against: the agent believes it
|
|
41
|
-
* has seen everything, and writes a confident change that misses a caller. */
|
|
42
|
-
export declare function coverageSentence(unread: {
|
|
43
|
-
python: number;
|
|
44
|
-
typescript: number;
|
|
45
|
-
}, total: number): string;
|
|
46
|
-
/** What this machine can read at all. Asked before anything else, so a person
|
|
47
|
-
* is told why their map is thin rather than left to guess. */
|
|
48
|
-
export declare function readerReport(): string;
|
|
49
|
-
/**
|
|
50
|
-
* Put ONE file back into the map, now, and wait for it.
|
|
51
|
-
*
|
|
52
|
-
* The fast path, and it exists because the slow one loses a race that matters.
|
|
53
|
-
* An agent writes a file and asks the map about it in the same step, because
|
|
54
|
-
* asking for several actions at once is what a well behaved agent does. A
|
|
55
|
-
* refresh started in the background after the write has not finished by the
|
|
56
|
-
* time the question runs, so the question reaches a map that is one file
|
|
57
|
-
* behind, and the agent is told the thing it just created does not exist.
|
|
58
|
-
*
|
|
59
|
-
* So this is awaited before the write's result goes back. One round trip: the
|
|
60
|
-
* file's facts and the workspace's new fingerprint travel together, and the
|
|
61
|
-
* service stores, stamps and rejoins in that single call.
|
|
62
|
-
*
|
|
63
|
-
* Failure is silent on purpose. A map that could not be updated must never turn
|
|
64
|
-
* a successful write into a failed one; the next check picks the file up.
|
|
65
|
-
*/
|
|
66
|
-
export declare function pushFile(root: string, workspace: string, rels: string[]): Promise<boolean>;
|
package/out/graph/sync.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.status = status;
|
|
4
|
-
exports.refresh = refresh;
|
|
5
|
-
exports.coverageSentence = coverageSentence;
|
|
6
|
-
exports.readerReport = readerReport;
|
|
7
|
-
exports.pushFile = pushFile;
|
|
8
|
-
/**
|
|
9
|
-
* Keep the service's map of this project in step with the files on disk.
|
|
10
|
-
*
|
|
11
|
-
* A map that lies is worse than no map, because the agent trusts it. So the
|
|
12
|
-
* rule here is simple and it is never bent: before the map is used, the files
|
|
13
|
-
* are checked; what moved is read again; and if it cannot be brought up to
|
|
14
|
-
* date, the agent is told so rather than being handed a confident answer from
|
|
15
|
-
* yesterday.
|
|
16
|
-
*
|
|
17
|
-
* The check costs about ten milliseconds. A full read of a seven hundred file
|
|
18
|
-
* project costs a second or two, and a partial one costs almost nothing,
|
|
19
|
-
* because only the files that actually moved are read.
|
|
20
|
-
*
|
|
21
|
-
* Nothing here decides anything. The machine reports what it has; the service
|
|
22
|
-
* says what it needs; the machine reads exactly that and sends structure back.
|
|
23
|
-
*/
|
|
24
|
-
const gateway_1 = require("../lib/gateway");
|
|
25
|
-
const build_1 = require("../machine/codemap/build");
|
|
26
|
-
const read_python_1 = require("../machine/codemap/read-python");
|
|
27
|
-
const read_typescript_1 = require("../machine/codemap/read-typescript");
|
|
28
|
-
/** How many files' facts go in one call.
|
|
29
|
-
*
|
|
30
|
-
* A whole project in one request is several megabytes and fails in the least
|
|
31
|
-
* helpful way available: the request is rejected at the edge and nothing says
|
|
32
|
-
* which part was too big. Batches also mean a project that loses its
|
|
33
|
-
* connection half way has stored half its files rather than none, and the next
|
|
34
|
-
* run reads only what is still missing.
|
|
35
|
-
*/
|
|
36
|
-
const BATCH = 120;
|
|
37
|
-
function reply(r) {
|
|
38
|
-
return (r.graph ?? {});
|
|
39
|
-
}
|
|
40
|
-
/** What the service holds for this project, and whether it matches disk. */
|
|
41
|
-
async function status(root, workspace, opts = {}) {
|
|
42
|
-
const state = (0, build_1.projectState)(root);
|
|
43
|
-
const answer = await (0, gateway_1.ask)({
|
|
44
|
-
intent: "graph", prompt: "", graphOp: "status", workspace,
|
|
45
|
-
graphPayload: {
|
|
46
|
-
fingerprint: state.fingerprint.hash,
|
|
47
|
-
// Ask for what the map holds in the same breath, when we are going to
|
|
48
|
-
// need it anyway. One round trip rather than two.
|
|
49
|
-
with_stamps: Boolean(opts.withStamps),
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
const graph = reply(answer);
|
|
53
|
-
return {
|
|
54
|
-
stamps: graph.stamps ?? null,
|
|
55
|
-
definedNames: graph.defined_names ?? [],
|
|
56
|
-
enabled: answer.granted !== false && graph.enabled !== false,
|
|
57
|
-
autoRefresh: graph.auto_refresh !== false,
|
|
58
|
-
fresh: Boolean(graph.fresh),
|
|
59
|
-
hasMap: Boolean(graph.has_map),
|
|
60
|
-
held: graph.held ?? null,
|
|
61
|
-
reachable: Boolean(answer.ok),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Bring the map up to date, reading only the files that moved.
|
|
66
|
-
*
|
|
67
|
-
* `force` reads everything again, which is what the manual refresh does: a
|
|
68
|
-
* person asking for a rebuild has usually just had an answer they did not
|
|
69
|
-
* believe, and telling them nothing needed doing is not an answer.
|
|
70
|
-
*/
|
|
71
|
-
async function refresh(root, workspace, opts = {}) {
|
|
72
|
-
const started = Date.now();
|
|
73
|
-
const state = (0, build_1.projectState)(root);
|
|
74
|
-
const blank = {
|
|
75
|
-
current: false, enabled: true, message: "", filesRead: 0,
|
|
76
|
-
filesTotal: state.files.length, seconds: 0, unread: 0,
|
|
77
|
-
};
|
|
78
|
-
const now = await status(root, workspace, { withStamps: !opts.force });
|
|
79
|
-
if (!now.enabled) {
|
|
80
|
-
return { ...blank, enabled: false, current: false, message: "Your company has the code map switched off, so nothing was read or sent." };
|
|
81
|
-
}
|
|
82
|
-
if (!now.reachable) {
|
|
83
|
-
return { ...blank, current: false, message: "The service could not be reached, so the map was left as it is. Work carries on without it." };
|
|
84
|
-
}
|
|
85
|
-
if (now.fresh && !opts.force) {
|
|
86
|
-
return { ...blank, current: true, message: `The map already matches all ${state.files.length} files in this workspace.` };
|
|
87
|
-
}
|
|
88
|
-
// What the service already holds, so only what moved is read. It came back
|
|
89
|
-
// with the status above when there was a map to describe, which is one round
|
|
90
|
-
// trip saved on every refresh; a forced rebuild asks for none of it because
|
|
91
|
-
// it is going to read everything anyway.
|
|
92
|
-
const known = opts.force ? {} : (now.stamps ?? {});
|
|
93
|
-
// What the service already knows this project defines. Used to drop calls
|
|
94
|
-
// that could never resolve, before they are sent. Absent on a project it has
|
|
95
|
-
// not joined yet, which costs size and never correctness.
|
|
96
|
-
const knownNames = now.definedNames;
|
|
97
|
-
const changed = state.files
|
|
98
|
-
.filter((f) => known[f.rel] !== state.stamps[f.rel])
|
|
99
|
-
.map((f) => f.rel);
|
|
100
|
-
const removed = Object.keys(known).filter((p) => !(p in state.stamps));
|
|
101
|
-
const read = (0, build_1.readFacts)(root, changed, knownNames);
|
|
102
|
-
const unreadTotal = read.unread.python + read.unread.typescript;
|
|
103
|
-
// Sent in batches. Each call is self contained: a connection lost half way
|
|
104
|
-
// leaves the files already sent stored, and the next run reads only the rest.
|
|
105
|
-
const paths = Object.keys(read.facts);
|
|
106
|
-
for (let i = 0; i < paths.length; i += BATCH) {
|
|
107
|
-
const slice = paths.slice(i, i + BATCH);
|
|
108
|
-
const payload = {};
|
|
109
|
-
for (const rel of slice) {
|
|
110
|
-
payload[rel] = { ...read.facts[rel], stamp: state.stamps[rel] };
|
|
111
|
-
}
|
|
112
|
-
const sent = await (0, gateway_1.ask)({
|
|
113
|
-
intent: "graph", prompt: "", graphOp: "update", workspace,
|
|
114
|
-
graphPayload: {
|
|
115
|
-
changed: payload,
|
|
116
|
-
// The removals travel with the first batch, so a project whose files
|
|
117
|
-
// were deleted stops answering questions about them immediately rather
|
|
118
|
-
// than at the end of a long upload.
|
|
119
|
-
removed: i === 0 ? removed : [],
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
if (!sent.ok) {
|
|
123
|
-
return { ...blank, current: false, seconds: read.seconds, message: "The map could not be sent in full, so it was left as it is. Work carries on without it." };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const coverage = coverageSentence(read.unread, state.files.length);
|
|
127
|
-
const done = await (0, gateway_1.ask)({
|
|
128
|
-
intent: "graph", prompt: "", graphOp: "finish", workspace,
|
|
129
|
-
graphPayload: {
|
|
130
|
-
commit: state.commit,
|
|
131
|
-
fingerprint: state.fingerprint.hash,
|
|
132
|
-
file_count: state.files.length - unreadTotal,
|
|
133
|
-
unread_files: unreadTotal,
|
|
134
|
-
coverage,
|
|
135
|
-
read_seconds: String(read.seconds),
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
const seconds = Math.round((Date.now() - started) / 100) / 10;
|
|
139
|
-
if (!done.ok) {
|
|
140
|
-
return { ...blank, current: false, seconds, message: "The files were sent but the map could not be stamped as current, so it will be read again next time." };
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
current: true,
|
|
144
|
-
enabled: true,
|
|
145
|
-
filesRead: paths.length,
|
|
146
|
-
filesTotal: state.files.length,
|
|
147
|
-
unread: unreadTotal,
|
|
148
|
-
seconds,
|
|
149
|
-
message: paths.length === state.files.length
|
|
150
|
-
? `Read all ${paths.length} files in ${seconds}s.`
|
|
151
|
-
: `Read the ${paths.length} files that changed, of ${state.files.length}, in ${seconds}s.`,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
/** What was read and what was not, in one sentence an answer can carry.
|
|
155
|
-
*
|
|
156
|
-
* Said out loud rather than hidden. A map that quietly covers less than it
|
|
157
|
-
* claims is the one failure worth engineering against: the agent believes it
|
|
158
|
-
* has seen everything, and writes a confident change that misses a caller. */
|
|
159
|
-
function coverageSentence(unread, total) {
|
|
160
|
-
const gaps = [];
|
|
161
|
-
if (unread.python) {
|
|
162
|
-
gaps.push(`${unread.python} Python files could not be read because this machine has no Python 3`);
|
|
163
|
-
}
|
|
164
|
-
if (unread.typescript) {
|
|
165
|
-
gaps.push(`${unread.typescript} TypeScript files could not be read because this installation has no TypeScript compiler`);
|
|
166
|
-
}
|
|
167
|
-
if (!gaps.length)
|
|
168
|
-
return `It covers all ${total} code files in this workspace.`;
|
|
169
|
-
return `It covers ${total - unread.python - unread.typescript} of ${total} code files: ${gaps.join("; ")}.`;
|
|
170
|
-
}
|
|
171
|
-
/** What this machine can read at all. Asked before anything else, so a person
|
|
172
|
-
* is told why their map is thin rather than left to guess. */
|
|
173
|
-
function readerReport() {
|
|
174
|
-
const python = Boolean((0, read_python_1.findPython)());
|
|
175
|
-
const typescript = Boolean((0, read_typescript_1.loadCompiler)());
|
|
176
|
-
if (python && typescript)
|
|
177
|
-
return "This machine can read Python, TypeScript and JavaScript.";
|
|
178
|
-
const missing = [];
|
|
179
|
-
if (!python)
|
|
180
|
-
missing.push("Python 3 is not on this machine, so Python files are not mapped");
|
|
181
|
-
if (!typescript)
|
|
182
|
-
missing.push("the TypeScript compiler is not installed beside this tool, so TypeScript and JavaScript files are not mapped");
|
|
183
|
-
return `Partly: ${missing.join(", and ")}.`;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Put ONE file back into the map, now, and wait for it.
|
|
187
|
-
*
|
|
188
|
-
* The fast path, and it exists because the slow one loses a race that matters.
|
|
189
|
-
* An agent writes a file and asks the map about it in the same step, because
|
|
190
|
-
* asking for several actions at once is what a well behaved agent does. A
|
|
191
|
-
* refresh started in the background after the write has not finished by the
|
|
192
|
-
* time the question runs, so the question reaches a map that is one file
|
|
193
|
-
* behind, and the agent is told the thing it just created does not exist.
|
|
194
|
-
*
|
|
195
|
-
* So this is awaited before the write's result goes back. One round trip: the
|
|
196
|
-
* file's facts and the workspace's new fingerprint travel together, and the
|
|
197
|
-
* service stores, stamps and rejoins in that single call.
|
|
198
|
-
*
|
|
199
|
-
* Failure is silent on purpose. A map that could not be updated must never turn
|
|
200
|
-
* a successful write into a failed one; the next check picks the file up.
|
|
201
|
-
*/
|
|
202
|
-
async function pushFile(root, workspace, rels) {
|
|
203
|
-
const wanted = rels.filter(Boolean);
|
|
204
|
-
if (!wanted.length)
|
|
205
|
-
return false;
|
|
206
|
-
try {
|
|
207
|
-
const state = (0, build_1.projectState)(root);
|
|
208
|
-
// Only paths the map covers. Writing a README is not a change to the map,
|
|
209
|
-
// and paying a round trip to say so would tax every write an agent makes.
|
|
210
|
-
const indexed = new Set(state.files.map((f) => f.rel));
|
|
211
|
-
const present = wanted.filter((r) => indexed.has(r));
|
|
212
|
-
const gone = wanted.filter((r) => !indexed.has(r));
|
|
213
|
-
if (!present.length && !gone.length)
|
|
214
|
-
return false;
|
|
215
|
-
const read = present.length ? (0, build_1.readFacts)(root, present) : { facts: {}, unread: { python: 0, typescript: 0 }, seconds: 0, failures: [] };
|
|
216
|
-
const changed = {};
|
|
217
|
-
for (const rel of Object.keys(read.facts)) {
|
|
218
|
-
changed[rel] = { ...read.facts[rel], stamp: state.stamps[rel] };
|
|
219
|
-
}
|
|
220
|
-
const sent = await (0, gateway_1.ask)({
|
|
221
|
-
intent: "graph", prompt: "", graphOp: "update", workspace,
|
|
222
|
-
graphPayload: {
|
|
223
|
-
changed,
|
|
224
|
-
// A file the agent deleted or moved away leaves the map in the same
|
|
225
|
-
// call, or the map keeps answering questions about something gone.
|
|
226
|
-
removed: gone,
|
|
227
|
-
// The stamp, so the service can mark the map current without a second
|
|
228
|
-
// trip. This is what makes the write and the question safe in one step.
|
|
229
|
-
commit: state.commit,
|
|
230
|
-
fingerprint: state.fingerprint.hash,
|
|
231
|
-
file_count: state.files.length,
|
|
232
|
-
unread_files: 0,
|
|
233
|
-
coverage: coverageSentence({ python: 0, typescript: 0 }, state.files.length),
|
|
234
|
-
read_seconds: String(read.seconds),
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
return Boolean(sent.ok);
|
|
238
|
-
}
|
|
239
|
-
catch {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
}
|