@illuminis/comprism 0.1.8 → 2.4.1

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.
Files changed (225) hide show
  1. package/out/{graph → build/machine/codemap}/read-python.js +2 -2
  2. package/out/{executor → build/machine/executor}/diagnostics.js +1 -1
  3. package/out/{executor → build/machine/executor}/hooks.js +1 -1
  4. package/out/{executor → build/machine/executor}/sandbox.js +1 -1
  5. package/out/build/machine/line/index.js +339 -0
  6. package/out/{commands/privacy.js → build/machine/runtime/home.js} +10 -19
  7. package/out/build/machine/runtime/needs.js +89 -0
  8. package/out/{lib → build/machine/runtime}/self.js +25 -3
  9. package/out/build/machine/terminal/jobs.js +67 -0
  10. package/out/build/machine/terminal/sign-in.js +212 -0
  11. package/out/build/machine/terminal/steps.js +460 -0
  12. package/out/build/machine/terminal/voice.js +136 -0
  13. package/out/build/machine/voice/record.js +286 -0
  14. package/out/cli-start.js +130 -0
  15. package/out/machine/line/index.js +339 -0
  16. package/out/machine/runtime/self.js +22 -0
  17. package/out/machine/terminal/clipboard.js +182 -0
  18. package/out/machine/terminal/jobs.js +67 -0
  19. package/out/machine/terminal/sign-in.js +212 -0
  20. package/out/machine/terminal/steps.js +460 -0
  21. package/out/machine/terminal/voice.js +136 -0
  22. package/out/machine/voice/record.js +79 -1
  23. package/out/native/dictate +0 -0
  24. package/out/server.generated.js +6 -0
  25. package/package.json +8 -40
  26. package/README.md +0 -343
  27. package/out/agent/command.d.ts +0 -157
  28. package/out/agent/command.js +0 -454
  29. package/out/agent/render.d.ts +0 -169
  30. package/out/agent/render.js +0 -689
  31. package/out/agent/session.d.ts +0 -334
  32. package/out/agent/session.js +0 -1232
  33. package/out/commands/agents.d.ts +0 -2
  34. package/out/commands/agents.js +0 -79
  35. package/out/commands/ask.d.ts +0 -1
  36. package/out/commands/ask.js +0 -222
  37. package/out/commands/codemap.d.ts +0 -2
  38. package/out/commands/codemap.js +0 -151
  39. package/out/commands/commands-thin.d.ts +0 -39
  40. package/out/commands/commands-thin.js +0 -244
  41. package/out/commands/config.d.ts +0 -1
  42. package/out/commands/config.js +0 -138
  43. package/out/commands/cost.d.ts +0 -1
  44. package/out/commands/cost.js +0 -167
  45. package/out/commands/decisionEngine.d.ts +0 -1
  46. package/out/commands/decisionEngine.js +0 -66
  47. package/out/commands/hooks.d.ts +0 -1
  48. package/out/commands/hooks.js +0 -83
  49. package/out/commands/install.d.ts +0 -206
  50. package/out/commands/install.js +0 -738
  51. package/out/commands/instructions.d.ts +0 -1
  52. package/out/commands/instructions.js +0 -113
  53. package/out/commands/integrations.d.ts +0 -3
  54. package/out/commands/integrations.js +0 -215
  55. package/out/commands/jobs.d.ts +0 -5
  56. package/out/commands/jobs.js +0 -157
  57. package/out/commands/keys.d.ts +0 -55
  58. package/out/commands/keys.js +0 -344
  59. package/out/commands/login.d.ts +0 -9
  60. package/out/commands/login.js +0 -606
  61. package/out/commands/memory.d.ts +0 -3
  62. package/out/commands/memory.js +0 -113
  63. package/out/commands/permissions.d.ts +0 -1
  64. package/out/commands/permissions.js +0 -94
  65. package/out/commands/plugins.d.ts +0 -4
  66. package/out/commands/plugins.js +0 -192
  67. package/out/commands/privacy.d.ts +0 -1
  68. package/out/commands/providerKey.d.ts +0 -32
  69. package/out/commands/providerKey.js +0 -108
  70. package/out/commands/repl.d.ts +0 -12
  71. package/out/commands/repl.js +0 -2303
  72. package/out/commands/report.d.ts +0 -39
  73. package/out/commands/report.js +0 -115
  74. package/out/commands/review.d.ts +0 -5
  75. package/out/commands/review.js +0 -223
  76. package/out/commands/sessions.d.ts +0 -23
  77. package/out/commands/sessions.js +0 -115
  78. package/out/commands/settings.d.ts +0 -23
  79. package/out/commands/settings.js +0 -153
  80. package/out/commands/skills.d.ts +0 -21
  81. package/out/commands/skills.js +0 -207
  82. package/out/commands/unattended.d.ts +0 -7
  83. package/out/commands/unattended.js +0 -351
  84. package/out/commands/update.d.ts +0 -1
  85. package/out/commands/update.js +0 -123
  86. package/out/commands/welcome.d.ts +0 -25
  87. package/out/commands/welcome.js +0 -223
  88. package/out/commands/worktrees.d.ts +0 -5
  89. package/out/commands/worktrees.js +0 -186
  90. package/out/executor/browser.d.ts +0 -14
  91. package/out/executor/diagnostics.d.ts +0 -2
  92. package/out/executor/documents.d.ts +0 -40
  93. package/out/executor/files.d.ts +0 -2
  94. package/out/executor/git.d.ts +0 -48
  95. package/out/executor/hooks.d.ts +0 -51
  96. package/out/executor/index.d.ts +0 -45
  97. package/out/executor/notebook.d.ts +0 -2
  98. package/out/executor/paths.d.ts +0 -20
  99. package/out/executor/sandbox.d.ts +0 -40
  100. package/out/executor/shell.d.ts +0 -86
  101. package/out/executor/toolservers.d.ts +0 -20
  102. package/out/executor/worktree.d.ts +0 -9
  103. package/out/graph/build.d.ts +0 -45
  104. package/out/graph/facts.d.ts +0 -47
  105. package/out/graph/files.d.ts +0 -45
  106. package/out/graph/read-locales.d.ts +0 -29
  107. package/out/graph/read-python.d.ts +0 -11
  108. package/out/graph/read-typescript.d.ts +0 -16
  109. package/out/graph/sync.d.ts +0 -66
  110. package/out/graph/sync.js +0 -242
  111. package/out/lib/attach.d.ts +0 -106
  112. package/out/lib/attach.js +0 -396
  113. package/out/lib/clipboard.d.ts +0 -23
  114. package/out/lib/commandlist.d.ts +0 -20
  115. package/out/lib/commandlist.js +0 -58
  116. package/out/lib/config.d.ts +0 -94
  117. package/out/lib/config.js +0 -197
  118. package/out/lib/connection.d.ts +0 -73
  119. package/out/lib/connection.js +0 -188
  120. package/out/lib/decision.d.ts +0 -22
  121. package/out/lib/decision.js +0 -50
  122. package/out/lib/fingerprint.d.ts +0 -25
  123. package/out/lib/fingerprint.js +0 -58
  124. package/out/lib/gateway.d.ts +0 -427
  125. package/out/lib/gateway.js +0 -226
  126. package/out/lib/history.d.ts +0 -24
  127. package/out/lib/history.js +0 -137
  128. package/out/lib/ide.d.ts +0 -19
  129. package/out/lib/ide.js +0 -131
  130. package/out/lib/keyboard.d.ts +0 -98
  131. package/out/lib/keyboard.js +0 -390
  132. package/out/lib/lastlogin.d.ts +0 -14
  133. package/out/lib/lastlogin.js +0 -105
  134. package/out/lib/machine.d.ts +0 -21
  135. package/out/lib/machine.js +0 -91
  136. package/out/lib/notify.d.ts +0 -4
  137. package/out/lib/notify.js +0 -52
  138. package/out/lib/output.d.ts +0 -48
  139. package/out/lib/output.js +0 -108
  140. package/out/lib/picker.d.ts +0 -1
  141. package/out/lib/picker.js +0 -158
  142. package/out/lib/project-ops.d.ts +0 -19
  143. package/out/lib/project-ops.js +0 -146
  144. package/out/lib/project.d.ts +0 -28
  145. package/out/lib/prompt.d.ts +0 -37
  146. package/out/lib/prompt.js +0 -142
  147. package/out/lib/queue.d.ts +0 -13
  148. package/out/lib/queue.js +0 -116
  149. package/out/lib/readiness.d.ts +0 -22
  150. package/out/lib/readiness.js +0 -207
  151. package/out/lib/self.d.ts +0 -23
  152. package/out/lib/servicecommand.d.ts +0 -14
  153. package/out/lib/servicecommand.js +0 -74
  154. package/out/lib/sessions.d.ts +0 -19
  155. package/out/lib/sessions.js +0 -221
  156. package/out/lib/startcache.d.ts +0 -13
  157. package/out/lib/startcache.js +0 -78
  158. package/out/lib/stdin.d.ts +0 -32
  159. package/out/lib/stdin.js +0 -117
  160. package/out/lib/store.d.ts +0 -40
  161. package/out/lib/store.js +0 -138
  162. package/out/lib/sync.d.ts +0 -18
  163. package/out/lib/sync.js +0 -81
  164. package/out/lib/types.d.ts +0 -417
  165. package/out/lib/types.js +0 -21
  166. package/out/lib/ui.d.ts +0 -123
  167. package/out/lib/ui.js +0 -299
  168. package/out/lib/version.d.ts +0 -23
  169. package/out/lib/version.js +0 -46
  170. package/out/lib/voice.d.ts +0 -49
  171. package/out/lib/voice.js +0 -236
  172. package/out/lib/words.d.ts +0 -20
  173. package/out/lib/words.js +0 -27
  174. package/out/machine/codemap/build.d.ts +0 -45
  175. package/out/machine/codemap/facts.d.ts +0 -47
  176. package/out/machine/codemap/files.d.ts +0 -45
  177. package/out/machine/codemap/read-locales.d.ts +0 -29
  178. package/out/machine/codemap/read-python.d.ts +0 -11
  179. package/out/machine/codemap/read-typescript.d.ts +0 -16
  180. package/out/machine/executor/browser.d.ts +0 -14
  181. package/out/machine/executor/diagnostics.d.ts +0 -2
  182. package/out/machine/executor/documents.d.ts +0 -40
  183. package/out/machine/executor/files.d.ts +0 -2
  184. package/out/machine/executor/git.d.ts +0 -48
  185. package/out/machine/executor/hooks.d.ts +0 -51
  186. package/out/machine/executor/index.d.ts +0 -45
  187. package/out/machine/executor/notebook.d.ts +0 -2
  188. package/out/machine/executor/paths.d.ts +0 -20
  189. package/out/machine/executor/sandbox.d.ts +0 -40
  190. package/out/machine/executor/shell.d.ts +0 -86
  191. package/out/machine/executor/toolservers.d.ts +0 -20
  192. package/out/machine/executor/worktree.d.ts +0 -9
  193. package/out/machine/folder/project.d.ts +0 -28
  194. package/out/machine/runtime/home.d.ts +0 -2
  195. package/out/machine/runtime/needs.d.ts +0 -30
  196. package/out/machine/runtime/self.d.ts +0 -23
  197. package/out/machine/voice/record.d.ts +0 -38
  198. package/out/postinstall.d.ts +0 -2
  199. package/out/postinstall.js +0 -120
  200. package/out/providers/anthropic.d.ts +0 -22
  201. package/out/providers/anthropic.js +0 -80
  202. package/out/providers/index.d.ts +0 -8
  203. package/out/providers/index.js +0 -84
  204. package/out/providers/openai.d.ts +0 -11
  205. package/out/providers/openai.js +0 -57
  206. package/out/thin.d.ts +0 -2
  207. package/out/thin.js +0 -855
  208. package/scripts/read_python.py +0 -270
  209. /package/out/{graph → build/machine/codemap}/build.js +0 -0
  210. /package/out/{graph → build/machine/codemap}/facts.js +0 -0
  211. /package/out/{graph → build/machine/codemap}/files.js +0 -0
  212. /package/out/{graph → build/machine/codemap}/read-locales.js +0 -0
  213. /package/out/{graph → build/machine/codemap}/read-typescript.js +0 -0
  214. /package/out/{executor → build/machine/executor}/browser.js +0 -0
  215. /package/out/{executor → build/machine/executor}/documents.js +0 -0
  216. /package/out/{executor → build/machine/executor}/files.js +0 -0
  217. /package/out/{executor → build/machine/executor}/git.js +0 -0
  218. /package/out/{executor → build/machine/executor}/index.js +0 -0
  219. /package/out/{executor → build/machine/executor}/notebook.js +0 -0
  220. /package/out/{executor → build/machine/executor}/paths.js +0 -0
  221. /package/out/{executor → build/machine/executor}/shell.js +0 -0
  222. /package/out/{executor → build/machine/executor}/toolservers.js +0 -0
  223. /package/out/{executor → build/machine/executor}/worktree.js +0 -0
  224. /package/out/{lib → build/machine/folder}/project.js +0 -0
  225. /package/out/{lib → build/machine/terminal}/clipboard.js +0 -0
package/out/lib/words.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.word = word;
4
- /**
5
- * The few words the published command line tool says on its own, in one place.
6
- *
7
- * Everything about the work arrives from the service already worded (rule 17).
8
- * What is left here is what the tool must say when the service, a file or the
9
- * operating system gives it nothing to say: a refused address, a file it cannot
10
- * read, a call that failed without a reason. Same shape as the editor's
11
- * `i18n.ts` and the desktop app's `labels.js`.
12
- */
13
- const EN = {
14
- connectorNotStarted: 'the connector could not be started',
15
- addressRefused: 'the organization address was refused',
16
- fileNotFound: 'not found: {{file}}',
17
- fileNoPermission: 'cannot read {{file}}: permission denied',
18
- providerCallFailed: 'provider call failed',
19
- somethingWrong: 'something went wrong',
20
- };
21
- function word(key, vars) {
22
- let s = EN[key];
23
- if (vars)
24
- for (const [k, v] of Object.entries(vars))
25
- s = s.split(`{{${k}}}`).join(String(v));
26
- return s;
27
- }
@@ -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;
@@ -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
- }
@@ -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 {};
@@ -1,14 +0,0 @@
1
- import type { RunResult } from "./shell";
2
- /** The browser program on this machine, or null. `COMPRISM_BROWSER` wins. */
3
- export declare function findBrowser(): string | null;
4
- /** The actions this machine can offer, only when a browser is installed. */
5
- export declare const BROWSER_ACTIONS: string[];
6
- /** The browser for one job, started on first use and closed with the job. */
7
- export declare class Browser {
8
- private readonly root;
9
- private session;
10
- constructor(root: string);
11
- private page;
12
- perform(name: string, a: Record<string, unknown>): Promise<RunResult>;
13
- close(): void;
14
- }
@@ -1,2 +0,0 @@
1
- import { RunResult, ShellOptions } from "./shell";
2
- export declare function readDiagnostics(root: string, rel: string | undefined, severity: string | undefined, opts: ShellOptions): Promise<RunResult>;
@@ -1,40 +0,0 @@
1
- /**
2
- * Applying a patch, and reading a PDF.
3
- *
4
- * Specification: docs/modules/CODING_AGENT_BUILD_SPECIFICATION.md, register
5
- * items D15 (apply a patch) and D3 (read a PDF).
6
- *
7
- * Both exist for the same reason: the thing the agent needs is already in a
8
- * format somebody else chose. A patch arrives from a review or a bug report, and
9
- * a specification arrives as a PDF because that is how standards bodies publish.
10
- * Neither is worth re-typing into a form we prefer.
11
- */
12
- import { RunResult, ShellOptions } from "./shell";
13
- /**
14
- * Apply a unified diff.
15
- *
16
- * Through `git apply` rather than a parser of our own. Patch formats have
17
- * decades of edge cases in them - renames, mode changes, binary hunks, fuzzy
18
- * context - and a hand-rolled applier gets the common case right and the
19
- * interesting ones wrong, silently, in somebody's repository.
20
- *
21
- * **Checked before it is applied.** `--check` runs the whole thing and changes
22
- * nothing, so a patch that does not fit is refused whole rather than leaving
23
- * half of itself behind. That is the same property `edit_file` has and for the
24
- * same reason: a file left half changed is worse than one not changed, because
25
- * the model believes the whole change landed.
26
- */
27
- export declare function applyPatch(patch: string, opts: ShellOptions): Promise<RunResult>;
28
- /**
29
- * Read a PDF as text.
30
- *
31
- * Through whichever extractor the machine has, in order of how good the output
32
- * is: `pdftotext` keeps the layout, `mutool` is close, and Python's pypdf is
33
- * usually present on a machine that has Python at all. If none of them is
34
- * there, it says so and names one to install rather than returning nothing.
35
- *
36
- * A PDF full of scanned images produces no text, and that is reported as what it
37
- * is. Silently returning an empty document would have the model conclude the
38
- * specification is blank.
39
- */
40
- export declare function readPdf(root: string, rel: string, pages: string | undefined, opts: ShellOptions): Promise<RunResult>;
@@ -1,2 +0,0 @@
1
- import { RunResult } from "./shell";
2
- export declare function performFileAction(root: string, name: string, a: Record<string, unknown>): RunResult;
@@ -1,48 +0,0 @@
1
- /**
2
- * Reading the repository, and recording work in it.
3
- *
4
- * Specification: docs/modules/CODING_AGENT_BUILD_SPECIFICATION.md, register
5
- * items D23 to D27.
6
- *
7
- * **Pushing is the only thing here that sends anything anywhere**, and it is
8
- * the only one the server has to have allowed first. Pull requests, reviews,
9
- * checks and releases are not git operations at all: they go through GitHub's
10
- * own API, on the server, because they need the tenant's credential and that
11
- * must never be sent to a client.
12
- *
13
- * So the split is by what each thing needs. A push needs the repository, which
14
- * is here. A pull request needs the credential, which is there.
15
- *
16
- * Every command goes through `runCommand`, so the folder boundary, the trimmed
17
- * environment, the timeout and the output cap all apply here too rather than
18
- * being reimplemented for git.
19
- */
20
- import { RunResult, ShellOptions } from "./shell";
21
- export declare function gitStatus(opts: ShellOptions): Promise<RunResult>;
22
- export declare function gitDiff(opts: ShellOptions & {
23
- path?: string;
24
- staged?: boolean;
25
- }): Promise<RunResult>;
26
- export declare function gitLog(opts: ShellOptions & {
27
- path?: string;
28
- limit?: number;
29
- }): Promise<RunResult>;
30
- export declare function gitBranch(name: string, opts: ShellOptions): Promise<RunResult>;
31
- export declare function gitCommit(message: string, opts: ShellOptions & {
32
- paths?: string[];
33
- }): Promise<RunResult>;
34
- /** Send commits to the remote.
35
- *
36
- * Reached only after the server has allowed it: the branch is one the person
37
- * named for this repository, it is not a branch the project is built from, and
38
- * they have just confirmed it. This function does not re-decide any of that,
39
- * and it must not: a client that could decide whether it may publish is a
40
- * client that could grant itself permission.
41
- *
42
- * **There is no force push and there is no upstream rewrite.** Not as an
43
- * option, not behind a flag. Everything on the remote stays recoverable by
44
- * whoever is working from it.
45
- */
46
- export declare function gitPush(branch: string, opts: ShellOptions & {
47
- createRemote?: boolean;
48
- }): Promise<RunResult>;
@@ -1,51 +0,0 @@
1
- /** The settings files that can hold hooks, sent as read for `comprism hooks`. */
2
- export declare const FILES: string[];
3
- /** One hook as the service hands it over. */
4
- export interface PlannedHook {
5
- when: string;
6
- on?: string;
7
- command: string;
8
- what?: string | null;
9
- timeout_s?: number;
10
- source?: string;
11
- }
12
- /** The hooks to run around one action, in order. */
13
- export interface HookPlan {
14
- before?: PlannedHook[];
15
- after?: PlannedHook[];
16
- }
17
- /** Set inside a hook's own commands, so nothing they do runs hooks again. */
18
- export declare const IN_HOOK = "COMPRISM_IN_HOOK";
19
- export declare function insideHook(): boolean;
20
- /** The settings files present in this project, as text, for the service. */
21
- export declare function hookFiles(root: string): Record<string, string>;
22
- export interface HookContext {
23
- when: string;
24
- action?: string;
25
- args?: Record<string, unknown>;
26
- facts?: Record<string, unknown>;
27
- }
28
- export interface HookRun {
29
- hook: PlannedHook;
30
- ok: boolean;
31
- timedOut: boolean;
32
- output: string;
33
- }
34
- export interface HooksOutcome {
35
- runs: HookRun[];
36
- /** Set when a `before` hook refused the action. */
37
- refusedBy?: string;
38
- detail?: string;
39
- /** `after`, `job_start`, `job_end` and `waiting` hooks that failed. */
40
- failed: string[];
41
- }
42
- /**
43
- * Run the hooks the service named, one after another, in its order.
44
- *
45
- * Details go in as `COMPRISM_` variables and as one JSON object on standard
46
- * input. Each hook has its own time limit (30 seconds unless the service said
47
- * otherwise) and is stopped and reported when it runs over.
48
- */
49
- export declare function runHooks(root: string, hooks: PlannedHook[], ctx: HookContext): Promise<HooksOutcome>;
50
- /** One line per hook that ran, for the full view and `hooks test` (10.10). */
51
- export declare function reportLines(outcome: HooksOutcome): string[];
@@ -1,45 +0,0 @@
1
- import * as hooks from "./hooks";
2
- import { ToolServers } from "./toolservers";
3
- import { RunResult, guessTestCommand, stopEverything, stopForeground } from "./shell";
4
- export { stopEverything, stopForeground, guessTestCommand };
5
- export type { RunResult };
6
- /** Everything a machine with a shell can do. Sent to the server on hello, and
7
- * the catalog offered to the model is narrowed to it, so a client is never
8
- * told about an action it cannot perform. */
9
- export declare const NATIVE_CAPABILITIES: string[];
10
- export interface ExecutorOptions {
11
- root: string;
12
- /** Folders the person added for this job (manual 2.3). */
13
- added?: string[];
14
- /** Called with each chunk of a running command's output, so a terminal can
15
- * show it as it happens rather than in one block at the end. */
16
- onOutput?: (chunk: string) => void;
17
- }
18
- export declare class NativeExecutor {
19
- /** What this machine can do. The browser actions only where a browser is
20
- * installed (manual 10.16); the service offers them only when switched on. */
21
- readonly capabilities: string[];
22
- /** The job's browser, started on first use (10.16). */
23
- private browser?;
24
- /** Close what this job opened on the machine: its browser. */
25
- close(): void;
26
- readonly root: string;
27
- private readonly onOutput?;
28
- /** The test command, once it has been worked out or supplied. Remembered so a
29
- * job that had to be told does not have to be told again. */
30
- private testCommand?;
31
- /** Whether the last test run passed. The grading signal the whole product
32
- * rests on, kept so a session can report it when the job ends. */
33
- lastTestsPassed?: boolean;
34
- /** The operating system's sandbox, set when the service turns it on for a
35
- * job (manual 4.12). Absent, commands run with the person's own access. */
36
- sandbox?: import("./sandbox").Sandbox;
37
- constructor(opts: ExecutorOptions);
38
- /** One executor per helper copy, rooted there and nowhere else. */
39
- private readonly inCopies;
40
- /** Tool servers this job started (manual 9.10), stopped when it ends. */
41
- readonly toolServers: ToolServers;
42
- execute(name: string, a: Record<string, unknown>, plan?: hooks.HookPlan): Promise<RunResult>;
43
- private browse;
44
- private perform;
45
- }
@@ -1,2 +0,0 @@
1
- import { RunResult } from "./shell";
2
- export declare function readNotebook(root: string, path: string, includeOutput?: boolean): RunResult;
@@ -1,20 +0,0 @@
1
- export declare class OutsideWorkspace extends Error {
2
- readonly attempted: string;
3
- /** `real` is where the path actually leads, when that differs from what was
4
- * asked for: a link is refused by naming its real location (manual 2.4). */
5
- constructor(attempted: string, real?: string);
6
- }
7
- export declare function allowFolders(root: string, added: string[]): void;
8
- /** Every folder a job in `root` may touch, the project first. */
9
- export declare function allowedFolders(root: string): string[];
10
- export declare function isSecret(p: string): boolean;
11
- /**
12
- * An absolute path inside the workspace, or a refusal.
13
- *
14
- * `mustExist` is false when the caller is about to CREATE the thing. A file that
15
- * does not exist yet cannot be resolved, so the check is applied to the deepest
16
- * parent that does exist: creating `src/new/deep/file.ts` is inside the project
17
- * exactly when `src` is, and demanding the leaf exist first would make it
18
- * impossible to write a new file at all.
19
- */
20
- export declare function resolveInside(root: string, rel: string, mustExist?: boolean): string;
@@ -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
- }
@@ -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>;
@@ -1,28 +0,0 @@
1
- export interface ProjectFacts {
2
- /** The repository root, or the folder itself outside a repository. Real path. */
3
- root: string;
4
- /** Where the person was standing, relative to `root`. Empty at the root. */
5
- start: string;
6
- /** Null outside a repository, or when HEAD is not on a branch. */
7
- branch: string | null;
8
- /** Folders the person named, real paths, never the root itself. */
9
- added: string[];
10
- home: string;
11
- /** `owner/name` of the GitHub repository `origin` points at, or null. The
12
- * service needs it for pull requests, issues and CI (manual 5.18 to 5.21). */
13
- repository?: string | null;
14
- }
15
- /** `owner/name` from a GitHub remote address, in any of its spellings. */
16
- export declare function githubRepository(remote: string | null): string | null;
17
- /** A folder the person named, or the reason it cannot be used. */
18
- export declare function checkFolder(raw: string): {
19
- ok: true;
20
- path: string;
21
- } | {
22
- ok: false;
23
- why: string;
24
- };
25
- /** The project for a job started in `startDir`, with any added folders. */
26
- export declare function resolveProject(startDir: string, added?: string[]): ProjectFacts;
27
- /** The facts as the service reads them, on the job and on the session line. */
28
- export declare function asWire(p: ProjectFacts, mode?: string): Record<string, unknown>;
@@ -1,2 +0,0 @@
1
- export declare const HOME_DIR_NAME = ".comprism";
2
- export declare function homeDir(): string;