@aviaratech/ai-delivery 0.3.36 → 0.3.37

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 (70) hide show
  1. package/README.md +5 -6
  2. package/dist/agent.d.ts +1 -1
  3. package/dist/agent.js +1 -3
  4. package/dist/agent.js.map +2 -2
  5. package/dist/callerErrors.test.js +0 -14
  6. package/dist/callerErrors.test.js.map +2 -2
  7. package/dist/cli.js +0 -15
  8. package/dist/cli.js.map +2 -2
  9. package/dist/dispatch.d.ts +1 -1
  10. package/dist/dispatch.js +1 -15
  11. package/dist/dispatch.js.map +2 -2
  12. package/dist/fixtures/discovery.d.ts +16 -16
  13. package/dist/git.d.ts +0 -3
  14. package/dist/git.js +2 -25
  15. package/dist/git.js.map +2 -2
  16. package/dist/github/commandIdentityPolicy.js +0 -2
  17. package/dist/github/commandIdentityPolicy.js.map +2 -2
  18. package/dist/issueIntake.test.js +0 -7
  19. package/dist/issueIntake.test.js.map +2 -2
  20. package/dist/mcp/tools.d.ts +0 -36
  21. package/dist/mcp/tools.js +0 -34
  22. package/dist/mcp/tools.js.map +2 -2
  23. package/dist/pluginPackaging.test.js +0 -47
  24. package/dist/pluginPackaging.test.js.map +2 -2
  25. package/dist/pr.d.ts +0 -55
  26. package/dist/pr.js +0 -211
  27. package/dist/pr.js.map +3 -3
  28. package/dist/pr.test.js +5 -737
  29. package/dist/pr.test.js.map +3 -3
  30. package/dist/prAssociation.test.js +1 -1
  31. package/dist/prAssociation.test.js.map +2 -2
  32. package/dist/prDispatch.test.js +4 -31
  33. package/dist/prDispatch.test.js.map +2 -2
  34. package/dist/readView.d.ts +1 -0
  35. package/dist/readView.js +1 -0
  36. package/dist/readView.js.map +2 -2
  37. package/dist/readView.test.js +29 -2
  38. package/dist/readView.test.js.map +2 -2
  39. package/dist/stdoutRegression.test.js +0 -38
  40. package/dist/stdoutRegression.test.js.map +2 -2
  41. package/dist/targetPolicyRoutes.test.js +1 -32
  42. package/dist/targetPolicyRoutes.test.js.map +2 -2
  43. package/dist/targetRepositoryExecution.test.js +0 -12
  44. package/dist/targetRepositoryExecution.test.js.map +2 -2
  45. package/dist/utils/atomicJson.d.ts +0 -2
  46. package/dist/utils/atomicJson.js +0 -4
  47. package/dist/utils/atomicJson.js.map +2 -2
  48. package/dist/utils/filesystem.d.ts +0 -8
  49. package/dist/utils/filesystem.js +1 -12
  50. package/dist/utils/filesystem.js.map +2 -2
  51. package/dist/verification.d.ts +0 -35
  52. package/dist/verification.js +1 -47
  53. package/dist/verification.js.map +2 -2
  54. package/dist/version.js +24 -2
  55. package/dist/version.js.map +2 -2
  56. package/package.json +1 -1
  57. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  58. package/plugins/ai-delivery/plugin.json +1 -1
  59. package/plugins/ai-delivery/runtime/dist/cli.js +108 -115
  60. package/plugins/ai-delivery/runtime/package.json +1 -1
  61. package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +4 -4
  62. package/dist/services/deliveryAdmission.d.ts +0 -49
  63. package/dist/services/deliveryAdmission.js +0 -142
  64. package/dist/services/deliveryAdmission.js.map +0 -7
  65. package/dist/services/worktreeRegistry.d.ts +0 -342
  66. package/dist/services/worktreeRegistry.js +0 -831
  67. package/dist/services/worktreeRegistry.js.map +0 -7
  68. package/dist/worktree.d.ts +0 -16
  69. package/dist/worktree.js +0 -108
  70. package/dist/worktree.js.map +0 -7
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aviaratech/ai-delivery",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ai-delivery": "./dist/cli.js"
@@ -20,7 +20,7 @@ ai-delivery review submit --pr <pr> --head <sha> --identity <reviewer-profile> \
20
20
  # Mark it ready, check it, and merge.
21
21
  ai-delivery --repo <owner/name> pr:create --issue <n> --ready
22
22
  ai-delivery --repo <owner/name> pr:checks --pr <pr>
23
- ai-delivery --repo <owner/name> finish --issue <n> --pr <pr> --reviewed-head <sha>
23
+ gh pr merge <pr> --repo <owner/name> --squash --match-head-commit <sha>
24
24
  ```
25
25
 
26
26
  ## Rules
@@ -33,9 +33,9 @@ ai-delivery --repo <owner/name> finish --issue <n> --pr <pr> --reviewed-head <sh
33
33
  The reviewer submits that file itself.
34
34
  - **New head.** If the head changes after review, the reviewer reviews the new
35
35
  head before merge.
36
- - **Merging.** `finish` merges only when GitHub says the PR can merge at the
37
- reviewed head with its required checks green. If it refuses, fix the reason
38
- it gives. Don't merge another way.
36
+ - **Merging.** GitHub's branch rules decide when the PR can merge.
37
+ `--match-head-commit` merges only the reviewed head. If GitHub refuses, fix
38
+ the reason it gives.
39
39
  - **Unclear results.** If a command times out or its result is unclear, run
40
40
  `pr:info` before retrying, so you don't create a duplicate.
41
41
  - **Reviewer setup.** To check a reviewer App's setup without posting
@@ -1,49 +0,0 @@
1
- import { z } from 'zod';
2
- import { type LoadedDeliveryConfig, type LoadedGitHubConfig } from '../config/deliveryConfig.js';
3
- export declare const RuntimeAdmissionSchema: z.ZodObject<{
4
- admissionId: z.ZodString;
5
- capability: z.ZodObject<{
6
- cli: z.ZodNumber;
7
- mcp: z.ZodNumber;
8
- }, z.core.$strict>;
9
- cliPath: z.ZodString;
10
- cliSha256: z.ZodString;
11
- configDigest: z.ZodString;
12
- mcpLauncherPath: z.ZodString;
13
- mcpLauncherSha256: z.ZodString;
14
- packageDistSha256: z.ZodString;
15
- packageManifestSha256: z.ZodString;
16
- packageVersion: z.ZodString;
17
- pluginManifestPath: z.ZodString;
18
- pluginManifestSha256: z.ZodString;
19
- repository: z.ZodString;
20
- schemaVersion: z.ZodLiteral<"ai-delivery.runtime-admission@2">;
21
- sourceArchiveSha256: z.ZodString;
22
- sourceCommit: z.ZodString;
23
- }, z.core.$strict>;
24
- export type RuntimeAdmission = z.infer<typeof RuntimeAdmissionSchema>;
25
- export declare function fileDigest(path: string): string;
26
- export declare function directoryDigest(path: string): string;
27
- /**
28
- * An installer-owned, private, immutable admission binds the actual CLI and MCP
29
- * bytes to one source archive and the consuming repository configuration.
30
- * Neither invocation surface can refresh its own admission during a mutation.
31
- */
32
- export declare function assertDeliveryRuntimeAdmitted(input: {
33
- repoRoot: string;
34
- runtimeEntryPath?: string;
35
- personalAuth?: boolean;
36
- configuration?: LoadedDeliveryConfig | LoadedGitHubConfig;
37
- }): Promise<RuntimeAdmission>;
38
- /** @internal Shared installed-byte validation for explicit setup and lifecycle admission. */
39
- export declare function validateRuntimeAdmission(admission: RuntimeAdmission, loaded: LoadedDeliveryConfig | LoadedGitHubConfig, runtimeEntryPath?: string): RuntimeAdmission;
40
- /** @internal Build the existing schema from actual installed bytes, never caller-supplied hashes. */
41
- export declare function buildRuntimeAdmission(input: {
42
- cliPath: string;
43
- mcpLauncherPath: string;
44
- pluginManifestPath: string;
45
- packageVersion: string;
46
- sourceArchiveSha256: string;
47
- sourceCommit: string;
48
- configuration: LoadedDeliveryConfig | LoadedGitHubConfig;
49
- }): RuntimeAdmission;
@@ -1,142 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { readFileSync, readdirSync, realpathSync } from "node:fs";
3
- import { dirname, join } from "node:path";
4
- import { z } from "zod";
5
- import { loadDeliveryConfig } from "../config/deliveryConfig.js";
6
- import { assertPrivateFile } from "../delivery/common.js";
7
- import { digestValue } from "../delivery/index.js";
8
- import { DeliveryError } from "../errors.js";
9
- import { gitCommonDir, gitRoot } from "../git.js";
10
- const Sha256 = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
11
- const CAPABILITY = 2;
12
- const RuntimeAdmissionSchema = z.object({
13
- admissionId: Sha256,
14
- capability: z.object({ cli: z.number().int().positive(), mcp: z.number().int().positive() }).strict(),
15
- cliPath: z.string().min(1),
16
- cliSha256: Sha256,
17
- configDigest: Sha256,
18
- mcpLauncherPath: z.string().min(1),
19
- mcpLauncherSha256: Sha256,
20
- packageDistSha256: Sha256,
21
- packageManifestSha256: Sha256,
22
- packageVersion: z.string().min(1),
23
- pluginManifestPath: z.string().min(1),
24
- pluginManifestSha256: Sha256,
25
- repository: z.string().min(1),
26
- schemaVersion: z.literal("ai-delivery.runtime-admission@2"),
27
- sourceArchiveSha256: Sha256,
28
- sourceCommit: z.string().regex(/^[a-f0-9]{40}$/u)
29
- }).strict().superRefine((value, context) => {
30
- const { admissionId, ...content } = value;
31
- if (admissionId !== digestValue(content)) {
32
- context.addIssue({ code: "custom", message: "Runtime admission identity is invalid." });
33
- }
34
- });
35
- function fileDigest(path) {
36
- return `sha256:${createHash("sha256").update(readFileSync(path)).digest("hex")}`;
37
- }
38
- function directoryDigest(path) {
39
- const entries = [];
40
- const visit = (directory, relative) => {
41
- for (const entry of readdirSync(directory, { withFileTypes: true }).sort(
42
- (left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0
43
- )) {
44
- const child = join(directory, entry.name);
45
- const childRelative = relative ? `${relative}/${entry.name}` : entry.name;
46
- if (entry.isDirectory()) visit(child, childRelative);
47
- else if (entry.isFile()) entries.push({ path: childRelative, sha256: fileDigest(child) });
48
- else throw new DeliveryError("Runtime distribution contains an unsupported link or file type.");
49
- }
50
- };
51
- visit(path, "");
52
- if (entries.length === 0) throw new DeliveryError("Runtime distribution is empty.");
53
- return digestValue(entries);
54
- }
55
- function manifest(path) {
56
- const value = JSON.parse(readFileSync(path, "utf8"));
57
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
58
- throw new DeliveryError("Runtime package or plugin manifest is invalid.");
59
- }
60
- return value;
61
- }
62
- async function assertDeliveryRuntimeAdmitted(input) {
63
- const root = gitRoot(input.repoRoot);
64
- const loaded = input.configuration ?? await loadDeliveryConfig(root, input.personalAuth === void 0 ? {} : { personalAuth: input.personalAuth });
65
- const path = join(gitCommonDir(root), "ai-delivery", "runtime-admission.json");
66
- let admission;
67
- try {
68
- admission = RuntimeAdmissionSchema.parse(JSON.parse(assertPrivateFile(path).toString("utf8")));
69
- } catch {
70
- throw new DeliveryError(
71
- "Missing or invalid private ai-delivery runtime admission; refresh the installed binding before lifecycle mutation."
72
- );
73
- }
74
- return validateRuntimeAdmission(admission, loaded, input.runtimeEntryPath);
75
- }
76
- function validateRuntimeAdmission(admission, loaded, runtimeEntryPath) {
77
- const entry = runtimeEntryPath ?? process.argv[1];
78
- if (!entry) throw new DeliveryError("Running ai-delivery entry path is unavailable.");
79
- try {
80
- const cliPath = realpathSync(entry);
81
- const launcherPath = realpathSync(admission.mcpLauncherPath);
82
- const pluginManifestPath = realpathSync(admission.pluginManifestPath);
83
- const distPath = dirname(cliPath);
84
- const packageManifestPath = join(dirname(distPath), "package.json");
85
- const packageManifest = manifest(packageManifestPath);
86
- const pluginManifest = manifest(pluginManifestPath);
87
- const failedPredicate = cliPath !== admission.cliPath && "cliPath" || launcherPath !== admission.mcpLauncherPath && "mcpLauncherPath" || pluginManifestPath !== admission.pluginManifestPath && "pluginManifestPath" || realpathSync(join(dirname(dirname(launcherPath)), ".claude-plugin", "plugin.json")) !== pluginManifestPath && "launcherPluginManifestPath" || fileDigest(cliPath) !== admission.cliSha256 && "cliSha256" || fileDigest(launcherPath) !== admission.mcpLauncherSha256 && "mcpLauncherSha256" || fileDigest(pluginManifestPath) !== admission.pluginManifestSha256 && "pluginManifestSha256" || fileDigest(packageManifestPath) !== admission.packageManifestSha256 && "packageManifestSha256" || directoryDigest(distPath) !== admission.packageDistSha256 && "packageDistSha256" || admission.configDigest !== loaded.configDigest && "configDigest" || admission.repository !== loaded.config.repository && "repository" || admission.capability.cli !== CAPABILITY && "cliCapability" || admission.capability.mcp !== CAPABILITY && "mcpCapability" || packageManifest.name !== "@aviaratech/ai-delivery" && "packageName" || packageManifest.version !== admission.packageVersion && "packageVersion" || pluginManifest.name !== "ai-delivery" && "pluginName" || pluginManifest.packageVersion !== admission.packageVersion && "pluginPackageVersion" || pluginManifest.deliveryCapabilityVersion !== CAPABILITY && "pluginCapability";
88
- if (failedPredicate) {
89
- throw new DeliveryError(
90
- `Installed CLI/MCP source, capability or repository admission disagrees with the running delivery contract. Failed predicate: ${failedPredicate}.`
91
- );
92
- }
93
- } catch (error) {
94
- if (error instanceof DeliveryError) throw error;
95
- throw new DeliveryError("Installed CLI/MCP source or capability readback is unavailable.");
96
- }
97
- return admission;
98
- }
99
- function buildRuntimeAdmission(input) {
100
- for (const path of [input.cliPath, input.mcpLauncherPath, input.pluginManifestPath]) {
101
- if (realpathSync(path) !== path)
102
- throw new DeliveryError("Installed runtime paths must be canonical regular files.");
103
- }
104
- const dist = dirname(input.cliPath);
105
- const packagePath = join(dirname(dist), "package.json");
106
- const packageManifest = manifest(packagePath);
107
- const bin = packageManifest.bin;
108
- if (typeof bin !== "object" || bin === null || !("ai-delivery" in bin) || bin["ai-delivery"] !== "./dist/cli.js") {
109
- throw new DeliveryError("Installed package CLI entry is not the supported ai-delivery executable.");
110
- }
111
- const content = {
112
- capability: { cli: CAPABILITY, mcp: CAPABILITY },
113
- cliPath: input.cliPath,
114
- cliSha256: fileDigest(input.cliPath),
115
- configDigest: input.configuration.configDigest,
116
- mcpLauncherPath: input.mcpLauncherPath,
117
- mcpLauncherSha256: fileDigest(input.mcpLauncherPath),
118
- packageDistSha256: directoryDigest(dist),
119
- packageManifestSha256: fileDigest(packagePath),
120
- packageVersion: input.packageVersion,
121
- pluginManifestPath: input.pluginManifestPath,
122
- pluginManifestSha256: fileDigest(input.pluginManifestPath),
123
- repository: input.configuration.config.repository,
124
- schemaVersion: "ai-delivery.runtime-admission@2",
125
- sourceArchiveSha256: input.sourceArchiveSha256,
126
- sourceCommit: input.sourceCommit
127
- };
128
- return validateRuntimeAdmission(
129
- RuntimeAdmissionSchema.parse({ ...content, admissionId: digestValue(content) }),
130
- input.configuration,
131
- input.cliPath
132
- );
133
- }
134
- export {
135
- RuntimeAdmissionSchema,
136
- assertDeliveryRuntimeAdmitted,
137
- buildRuntimeAdmission,
138
- directoryDigest,
139
- fileDigest,
140
- validateRuntimeAdmission
141
- };
142
- //# sourceMappingURL=deliveryAdmission.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/services/deliveryAdmission.ts"],
4
- "sourcesContent": ["import { createHash } from 'node:crypto';\nimport { readFileSync, readdirSync, realpathSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { z } from 'zod';\n\nimport { loadDeliveryConfig, type LoadedDeliveryConfig, type LoadedGitHubConfig } from '../config/deliveryConfig.js';\nimport { assertPrivateFile } from '../delivery/common.js';\nimport { digestValue } from '../delivery/index.js';\nimport { DeliveryError } from '../errors.js';\nimport { gitCommonDir, gitRoot } from '../git.js';\n\nconst Sha256 = z.string().regex(/^sha256:[a-f0-9]{64}$/u);\nconst CAPABILITY = 2;\nexport const RuntimeAdmissionSchema = z\n .object({\n admissionId: Sha256,\n capability: z.object({ cli: z.number().int().positive(), mcp: z.number().int().positive() }).strict(),\n cliPath: z.string().min(1),\n cliSha256: Sha256,\n configDigest: Sha256,\n mcpLauncherPath: z.string().min(1),\n mcpLauncherSha256: Sha256,\n packageDistSha256: Sha256,\n packageManifestSha256: Sha256,\n packageVersion: z.string().min(1),\n pluginManifestPath: z.string().min(1),\n pluginManifestSha256: Sha256,\n repository: z.string().min(1),\n schemaVersion: z.literal('ai-delivery.runtime-admission@2'),\n sourceArchiveSha256: Sha256,\n sourceCommit: z.string().regex(/^[a-f0-9]{40}$/u),\n })\n .strict()\n .superRefine((value, context) => {\n const { admissionId, ...content } = value;\n if (admissionId !== digestValue(content)) {\n context.addIssue({ code: 'custom', message: 'Runtime admission identity is invalid.' });\n }\n });\n\nexport type RuntimeAdmission = z.infer<typeof RuntimeAdmissionSchema>;\n\nexport function fileDigest(path: string): string {\n return `sha256:${createHash('sha256').update(readFileSync(path)).digest('hex')}`;\n}\n\nexport function directoryDigest(path: string): string {\n const entries: { path: string; sha256: string }[] = [];\n const visit = (directory: string, relative: string): void => {\n for (const entry of readdirSync(directory, { withFileTypes: true }).sort((left, right) =>\n left.name < right.name ? -1 : left.name > right.name ? 1 : 0,\n )) {\n const child = join(directory, entry.name);\n const childRelative = relative ? `${relative}/${entry.name}` : entry.name;\n if (entry.isDirectory()) visit(child, childRelative);\n else if (entry.isFile()) entries.push({ path: childRelative, sha256: fileDigest(child) });\n else throw new DeliveryError('Runtime distribution contains an unsupported link or file type.');\n }\n };\n visit(path, '');\n if (entries.length === 0) throw new DeliveryError('Runtime distribution is empty.');\n return digestValue(entries);\n}\n\nfunction manifest(path: string): Record<string, unknown> {\n const value: unknown = JSON.parse(readFileSync(path, 'utf8')) as unknown;\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new DeliveryError('Runtime package or plugin manifest is invalid.');\n }\n return value as Record<string, unknown>;\n}\n\n/**\n * An installer-owned, private, immutable admission binds the actual CLI and MCP\n * bytes to one source archive and the consuming repository configuration.\n * Neither invocation surface can refresh its own admission during a mutation.\n */\nexport async function assertDeliveryRuntimeAdmitted(input: {\n repoRoot: string;\n runtimeEntryPath?: string;\n personalAuth?: boolean;\n configuration?: LoadedDeliveryConfig | LoadedGitHubConfig;\n}): Promise<RuntimeAdmission> {\n const root = gitRoot(input.repoRoot);\n const loaded =\n input.configuration ??\n (await loadDeliveryConfig(root, input.personalAuth === undefined ? {} : { personalAuth: input.personalAuth }));\n const path = join(gitCommonDir(root), 'ai-delivery', 'runtime-admission.json');\n let admission: RuntimeAdmission;\n try {\n admission = RuntimeAdmissionSchema.parse(JSON.parse(assertPrivateFile(path).toString('utf8')) as unknown);\n } catch {\n throw new DeliveryError(\n 'Missing or invalid private ai-delivery runtime admission; refresh the installed binding before lifecycle mutation.',\n );\n }\n return validateRuntimeAdmission(admission, loaded, input.runtimeEntryPath);\n}\n\n/** @internal Shared installed-byte validation for explicit setup and lifecycle admission. */\nexport function validateRuntimeAdmission(\n admission: RuntimeAdmission,\n loaded: LoadedDeliveryConfig | LoadedGitHubConfig,\n runtimeEntryPath?: string,\n): RuntimeAdmission {\n const entry = runtimeEntryPath ?? process.argv[1];\n if (!entry) throw new DeliveryError('Running ai-delivery entry path is unavailable.');\n try {\n const cliPath = realpathSync(entry);\n const launcherPath = realpathSync(admission.mcpLauncherPath);\n const pluginManifestPath = realpathSync(admission.pluginManifestPath);\n const distPath = dirname(cliPath);\n const packageManifestPath = join(dirname(distPath), 'package.json');\n const packageManifest = manifest(packageManifestPath);\n const pluginManifest = manifest(pluginManifestPath);\n // Preserve the original short-circuit order and refusal; expose only the first predicate's fixed name.\n const failedPredicate =\n (cliPath !== admission.cliPath && 'cliPath') ||\n (launcherPath !== admission.mcpLauncherPath && 'mcpLauncherPath') ||\n (pluginManifestPath !== admission.pluginManifestPath && 'pluginManifestPath') ||\n (realpathSync(join(dirname(dirname(launcherPath)), '.claude-plugin', 'plugin.json')) !== pluginManifestPath &&\n 'launcherPluginManifestPath') ||\n (fileDigest(cliPath) !== admission.cliSha256 && 'cliSha256') ||\n (fileDigest(launcherPath) !== admission.mcpLauncherSha256 && 'mcpLauncherSha256') ||\n (fileDigest(pluginManifestPath) !== admission.pluginManifestSha256 && 'pluginManifestSha256') ||\n (fileDigest(packageManifestPath) !== admission.packageManifestSha256 && 'packageManifestSha256') ||\n (directoryDigest(distPath) !== admission.packageDistSha256 && 'packageDistSha256') ||\n (admission.configDigest !== loaded.configDigest && 'configDigest') ||\n (admission.repository !== loaded.config.repository && 'repository') ||\n (admission.capability.cli !== CAPABILITY && 'cliCapability') ||\n (admission.capability.mcp !== CAPABILITY && 'mcpCapability') ||\n (packageManifest.name !== '@aviaratech/ai-delivery' && 'packageName') ||\n (packageManifest.version !== admission.packageVersion && 'packageVersion') ||\n (pluginManifest.name !== 'ai-delivery' && 'pluginName') ||\n (pluginManifest.packageVersion !== admission.packageVersion && 'pluginPackageVersion') ||\n (pluginManifest.deliveryCapabilityVersion !== CAPABILITY && 'pluginCapability');\n if (failedPredicate) {\n throw new DeliveryError(\n `Installed CLI/MCP source, capability or repository admission disagrees with the running delivery contract. Failed predicate: ${failedPredicate}.`,\n );\n }\n } catch (error) {\n if (error instanceof DeliveryError) throw error;\n throw new DeliveryError('Installed CLI/MCP source or capability readback is unavailable.');\n }\n return admission;\n}\n\n/** @internal Build the existing schema from actual installed bytes, never caller-supplied hashes. */\nexport function buildRuntimeAdmission(input: {\n cliPath: string;\n mcpLauncherPath: string;\n pluginManifestPath: string;\n packageVersion: string;\n sourceArchiveSha256: string;\n sourceCommit: string;\n configuration: LoadedDeliveryConfig | LoadedGitHubConfig;\n}): RuntimeAdmission {\n for (const path of [input.cliPath, input.mcpLauncherPath, input.pluginManifestPath]) {\n if (realpathSync(path) !== path)\n throw new DeliveryError('Installed runtime paths must be canonical regular files.');\n }\n const dist = dirname(input.cliPath);\n const packagePath = join(dirname(dist), 'package.json');\n const packageManifest = manifest(packagePath);\n const bin = packageManifest.bin;\n if (\n typeof bin !== 'object' ||\n bin === null ||\n !('ai-delivery' in bin) ||\n (bin as Record<string, unknown>)['ai-delivery'] !== './dist/cli.js'\n ) {\n throw new DeliveryError('Installed package CLI entry is not the supported ai-delivery executable.');\n }\n const content = {\n capability: { cli: CAPABILITY, mcp: CAPABILITY },\n cliPath: input.cliPath,\n cliSha256: fileDigest(input.cliPath),\n configDigest: input.configuration.configDigest,\n mcpLauncherPath: input.mcpLauncherPath,\n mcpLauncherSha256: fileDigest(input.mcpLauncherPath),\n packageDistSha256: directoryDigest(dist),\n packageManifestSha256: fileDigest(packagePath),\n packageVersion: input.packageVersion,\n pluginManifestPath: input.pluginManifestPath,\n pluginManifestSha256: fileDigest(input.pluginManifestPath),\n repository: input.configuration.config.repository,\n schemaVersion: 'ai-delivery.runtime-admission@2' as const,\n sourceArchiveSha256: input.sourceArchiveSha256,\n sourceCommit: input.sourceCommit,\n };\n return validateRuntimeAdmission(\n RuntimeAdmissionSchema.parse({ ...content, admissionId: digestValue(content) }),\n input.configuration,\n input.cliPath,\n );\n}\n"],
5
- "mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,cAAc,aAAa,oBAAoB;AACxD,SAAS,SAAS,YAAY;AAC9B,SAAS,SAAS;AAElB,SAAS,0BAA8E;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
- "names": []
7
- }
@@ -1,342 +0,0 @@
1
- import { z } from 'zod';
2
- export interface WorktreeEntry {
3
- branch: string;
4
- createdAt: string;
5
- /** Agent identity that prepared the worktree; hook-context commands (lint-guard) fall back to it. */
6
- identity?: string;
7
- issueNumber?: number;
8
- path: string;
9
- prNumber?: number;
10
- status: WorktreeStatus;
11
- type: 'issue' | 'pr' | 'standalone';
12
- updatedAt: string;
13
- }
14
- export type WorktreeStatus = 'active' | 'error' | 'merged' | 'pr-published' | 'stale';
15
- /** @internal Private exact-plan checkpoint; it is not a public transition purpose. */
16
- export declare const CommittedContinuationPlanSchema: z.ZodObject<{
17
- schemaVersion: z.ZodLiteral<"ai-delivery.committed-continuation-plan@1">;
18
- planId: z.ZodString;
19
- repository: z.ZodString;
20
- repoRoot: z.ZodString;
21
- configDigest: z.ZodString;
22
- currentRuntime: z.ZodObject<{
23
- admissionId: z.ZodString;
24
- capability: z.ZodObject<{
25
- cli: z.ZodNumber;
26
- mcp: z.ZodNumber;
27
- }, z.core.$strict>;
28
- cliPath: z.ZodString;
29
- cliSha256: z.ZodString;
30
- configDigest: z.ZodString;
31
- mcpLauncherPath: z.ZodString;
32
- mcpLauncherSha256: z.ZodString;
33
- packageDistSha256: z.ZodString;
34
- packageManifestSha256: z.ZodString;
35
- packageVersion: z.ZodString;
36
- pluginManifestPath: z.ZodString;
37
- pluginManifestSha256: z.ZodString;
38
- repository: z.ZodString;
39
- schemaVersion: z.ZodLiteral<"ai-delivery.runtime-admission@2">;
40
- sourceArchiveSha256: z.ZodString;
41
- sourceCommit: z.ZodString;
42
- }, z.core.$strict>;
43
- row: z.ZodPipe<z.ZodObject<{
44
- branch: z.ZodString;
45
- createdAt: z.ZodString;
46
- identity: z.ZodString;
47
- issueNumber: z.ZodNumber;
48
- path: z.ZodString;
49
- prNumber: z.ZodOptional<z.ZodNumber>;
50
- status: z.ZodEnum<{
51
- active: "active";
52
- error: "error";
53
- merged: "merged";
54
- "pr-published": "pr-published";
55
- stale: "stale";
56
- }>;
57
- type: z.ZodLiteral<"issue">;
58
- updatedAt: z.ZodString;
59
- }, z.core.$strict>, z.ZodTransform<{
60
- branch: string;
61
- createdAt: string;
62
- identity: string;
63
- issueNumber: number;
64
- path: string;
65
- status: "active" | "error" | "merged" | "pr-published" | "stale";
66
- type: "issue";
67
- updatedAt: string;
68
- prNumber?: number;
69
- }, {
70
- branch: string;
71
- createdAt: string;
72
- identity: string;
73
- issueNumber: number;
74
- path: string;
75
- prNumber?: number | undefined;
76
- status: "active" | "error" | "merged" | "pr-published" | "stale";
77
- type: "issue";
78
- updatedAt: string;
79
- }>>;
80
- replacement: z.ZodPipe<z.ZodObject<{
81
- branch: z.ZodString;
82
- createdAt: z.ZodString;
83
- identity: z.ZodString;
84
- issueNumber: z.ZodNumber;
85
- path: z.ZodString;
86
- prNumber: z.ZodOptional<z.ZodNumber>;
87
- status: z.ZodEnum<{
88
- active: "active";
89
- error: "error";
90
- merged: "merged";
91
- "pr-published": "pr-published";
92
- stale: "stale";
93
- }>;
94
- type: z.ZodLiteral<"issue">;
95
- updatedAt: z.ZodString;
96
- }, z.core.$strict>, z.ZodTransform<{
97
- branch: string;
98
- createdAt: string;
99
- identity: string;
100
- issueNumber: number;
101
- path: string;
102
- status: "active" | "error" | "merged" | "pr-published" | "stale";
103
- type: "issue";
104
- updatedAt: string;
105
- prNumber?: number;
106
- }, {
107
- branch: string;
108
- createdAt: string;
109
- identity: string;
110
- issueNumber: number;
111
- path: string;
112
- prNumber?: number | undefined;
113
- status: "active" | "error" | "merged" | "pr-published" | "stale";
114
- type: "issue";
115
- updatedAt: string;
116
- }>>;
117
- head: z.ZodObject<{
118
- sha: z.ZodString;
119
- tree: z.ZodString;
120
- }, z.core.$strict>;
121
- terminalHead: z.ZodObject<{
122
- sha: z.ZodString;
123
- tree: z.ZodString;
124
- }, z.core.$strict>;
125
- terminalMergeId: z.ZodString;
126
- operator: z.ZodObject<{
127
- actorLogin: z.ZodString;
128
- credentialIdentity: z.ZodString;
129
- }, z.core.$strict>;
130
- reviewerActor: z.ZodString;
131
- preserved: z.ZodArray<z.ZodObject<{
132
- path: z.ZodString;
133
- digest: z.ZodString;
134
- }, z.core.$strict>>;
135
- }, z.core.$strict>;
136
- export type CommittedContinuationPlan = z.infer<typeof CommittedContinuationPlanSchema>;
137
- declare const ContinuationIntentSchema: z.ZodObject<{
138
- schemaVersion: z.ZodLiteral<"ai-delivery.committed-continuation-intent@1">;
139
- intentId: z.ZodString;
140
- plan: z.ZodObject<{
141
- schemaVersion: z.ZodLiteral<"ai-delivery.committed-continuation-plan@1">;
142
- planId: z.ZodString;
143
- repository: z.ZodString;
144
- repoRoot: z.ZodString;
145
- configDigest: z.ZodString;
146
- currentRuntime: z.ZodObject<{
147
- admissionId: z.ZodString;
148
- capability: z.ZodObject<{
149
- cli: z.ZodNumber;
150
- mcp: z.ZodNumber;
151
- }, z.core.$strict>;
152
- cliPath: z.ZodString;
153
- cliSha256: z.ZodString;
154
- configDigest: z.ZodString;
155
- mcpLauncherPath: z.ZodString;
156
- mcpLauncherSha256: z.ZodString;
157
- packageDistSha256: z.ZodString;
158
- packageManifestSha256: z.ZodString;
159
- packageVersion: z.ZodString;
160
- pluginManifestPath: z.ZodString;
161
- pluginManifestSha256: z.ZodString;
162
- repository: z.ZodString;
163
- schemaVersion: z.ZodLiteral<"ai-delivery.runtime-admission@2">;
164
- sourceArchiveSha256: z.ZodString;
165
- sourceCommit: z.ZodString;
166
- }, z.core.$strict>;
167
- row: z.ZodPipe<z.ZodObject<{
168
- branch: z.ZodString;
169
- createdAt: z.ZodString;
170
- identity: z.ZodString;
171
- issueNumber: z.ZodNumber;
172
- path: z.ZodString;
173
- prNumber: z.ZodOptional<z.ZodNumber>;
174
- status: z.ZodEnum<{
175
- active: "active";
176
- error: "error";
177
- merged: "merged";
178
- "pr-published": "pr-published";
179
- stale: "stale";
180
- }>;
181
- type: z.ZodLiteral<"issue">;
182
- updatedAt: z.ZodString;
183
- }, z.core.$strict>, z.ZodTransform<{
184
- branch: string;
185
- createdAt: string;
186
- identity: string;
187
- issueNumber: number;
188
- path: string;
189
- status: "active" | "error" | "merged" | "pr-published" | "stale";
190
- type: "issue";
191
- updatedAt: string;
192
- prNumber?: number;
193
- }, {
194
- branch: string;
195
- createdAt: string;
196
- identity: string;
197
- issueNumber: number;
198
- path: string;
199
- prNumber?: number | undefined;
200
- status: "active" | "error" | "merged" | "pr-published" | "stale";
201
- type: "issue";
202
- updatedAt: string;
203
- }>>;
204
- replacement: z.ZodPipe<z.ZodObject<{
205
- branch: z.ZodString;
206
- createdAt: z.ZodString;
207
- identity: z.ZodString;
208
- issueNumber: z.ZodNumber;
209
- path: z.ZodString;
210
- prNumber: z.ZodOptional<z.ZodNumber>;
211
- status: z.ZodEnum<{
212
- active: "active";
213
- error: "error";
214
- merged: "merged";
215
- "pr-published": "pr-published";
216
- stale: "stale";
217
- }>;
218
- type: z.ZodLiteral<"issue">;
219
- updatedAt: z.ZodString;
220
- }, z.core.$strict>, z.ZodTransform<{
221
- branch: string;
222
- createdAt: string;
223
- identity: string;
224
- issueNumber: number;
225
- path: string;
226
- status: "active" | "error" | "merged" | "pr-published" | "stale";
227
- type: "issue";
228
- updatedAt: string;
229
- prNumber?: number;
230
- }, {
231
- branch: string;
232
- createdAt: string;
233
- identity: string;
234
- issueNumber: number;
235
- path: string;
236
- prNumber?: number | undefined;
237
- status: "active" | "error" | "merged" | "pr-published" | "stale";
238
- type: "issue";
239
- updatedAt: string;
240
- }>>;
241
- head: z.ZodObject<{
242
- sha: z.ZodString;
243
- tree: z.ZodString;
244
- }, z.core.$strict>;
245
- terminalHead: z.ZodObject<{
246
- sha: z.ZodString;
247
- tree: z.ZodString;
248
- }, z.core.$strict>;
249
- terminalMergeId: z.ZodString;
250
- operator: z.ZodObject<{
251
- actorLogin: z.ZodString;
252
- credentialIdentity: z.ZodString;
253
- }, z.core.$strict>;
254
- reviewerActor: z.ZodString;
255
- preserved: z.ZodArray<z.ZodObject<{
256
- path: z.ZodString;
257
- digest: z.ZodString;
258
- }, z.core.$strict>>;
259
- }, z.core.$strict>;
260
- authorityCommentId: z.ZodNumber;
261
- acceptanceCommentId: z.ZodNumber;
262
- }, z.core.$strict>;
263
- type ContinuationIntent = z.infer<typeof ContinuationIntentSchema>;
264
- export declare function committedContinuationPlanPath(root: string, issueNumber: number, head: string): string;
265
- /** @internal Pending intents are recoverable only by the same supported develop boundary. */
266
- export declare function pendingCommittedContinuation(issueNumber: number, root: string): ContinuationIntent | undefined;
267
- /** An immutable witness separates new rows from legacy rows in the same canonical registry. */
268
- export declare function assertAiDeliveryWorktreeOwner(entry: WorktreeEntry, root: string): void;
269
- /** Ordinary source mutations refuse a pending committed continuation. */
270
- export declare function assertIssueWorktreeTransitionAdmission(issueNumber: number, root: string, committedRecovery?: boolean): void;
271
- /** @internal New continuation checkpoints are published only while both owning locks are held. */
272
- export declare function writeCommittedContinuationCheckpoint(path: string, value: unknown): void;
273
- /** @internal One canonical row, its immutable witnesses, and the existing registry lock own this recovery. */
274
- export declare function withCommittedContinuationRegistry<T>(root: string, issueNumber: number, operation: (input: {
275
- current: WorktreeEntry;
276
- pending: ContinuationIntent | undefined;
277
- ownerWitness: {
278
- path: string;
279
- digest: string;
280
- };
281
- prepare(this: void): void;
282
- begin(this: void, plan: CommittedContinuationPlan, ids: {
283
- authorityCommentId: number;
284
- acceptanceCommentId: number;
285
- }): void;
286
- commit(this: void): void;
287
- complete(this: void): void;
288
- }) => Promise<T>): Promise<T>;
289
- /**
290
- * The only recovery transition for a worktree that remained active after its
291
- * delivery completed elsewhere. Callers must establish the terminal delivery
292
- * from GitHub and immutable receipts before invoking this locked transition.
293
- */
294
- export interface CompletedIssueWorktreeReconciliation {
295
- removeSource?: (entry: WorktreeEntry) => void;
296
- branch: string;
297
- issueNumber: number;
298
- path: string;
299
- prNumber: number;
300
- projectRoot?: string;
301
- }
302
- type IssueWorktreeDeliveryTransition = {
303
- branch: string;
304
- issueNumber: number;
305
- path: string;
306
- prNumber: number;
307
- projectRoot?: string;
308
- status: 'pr-published';
309
- } | {
310
- branch: string;
311
- issueNumber: number;
312
- path: string;
313
- projectRoot?: string;
314
- status: 'merged';
315
- };
316
- export declare function addWorktreeEntry(entry: WorktreeEntry, projectRoot?: string): Promise<void>;
317
- /** Resolve the sole canonical issue row for a provider-mutating lifecycle transition. */
318
- export declare function getIssueWorktreeStrict(issueNumber: number, projectRoot?: string): WorktreeEntry;
319
- /** Native metadata never adopts source; retain every transition and canonical registry fence. */
320
- export declare function assertNativeIssueTrackingAdmission(issueNumber: number, root: string): void;
321
- export declare function getStaleWorktrees(daysOld: number, projectRoot?: string): WorktreeEntry[];
322
- export declare function getWorktreeByIssue(issueNumber: number, projectRoot?: string): null | WorktreeEntry;
323
- export declare function getWorktreeByPR(prNumber: number, projectRoot?: string): null | WorktreeEntry;
324
- export declare function listWorktrees(projectRoot?: string): WorktreeEntry[];
325
- /**
326
- * Reads the registry for a terminal safety decision. Unlike the operational
327
- * listing helper, this fails closed if an existing registry cannot be read.
328
- */
329
- export declare function listWorktreesStrict(projectRoot?: string): WorktreeEntry[];
330
- export declare function markStaleEntries(thresholdMs: number, projectRoot?: string): Promise<number>;
331
- /** Atomically reconcile one verified terminal PR without changing its original producer identity. */
332
- export declare function reconcileCompletedIssueWorktreeDelivery(options: CompletedIssueWorktreeReconciliation): Promise<'already-reconciled' | 'reconciled'>;
333
- /** Remove one exact active standalone row without weakening registry parsing or identity checks. */
334
- export declare function removeActiveStandaloneWorktreeEntry(input: {
335
- branch: string;
336
- path: string;
337
- projectRoot: string;
338
- }): Promise<void>;
339
- export declare function removeWorktreeEntry(path: string, projectRoot?: string): Promise<boolean>;
340
- export declare function updateIssueWorktreeDelivery(options: IssueWorktreeDeliveryTransition): Promise<void>;
341
- export {};
342
- /** Current, prospective custody is separate from legacy producer/policy transitions. */