@phyzess/pappra 0.0.0-stage → 0.1.0-beta.2

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 (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/THIRD_PARTY_NOTICES.md +16 -0
  4. package/assets/integrations/skills/pappra/SKILL.md +68 -0
  5. package/assets/integrations/skills/pappra/references/hosts.md +30 -0
  6. package/assets/integrations/skills/pappra/references/lifecycle.md +37 -0
  7. package/assets/integrations/skills/pappra/references/operations.md +14 -0
  8. package/assets/manifest.json +4 -0
  9. package/dist/app/collaboration.d.ts +170 -0
  10. package/dist/app/collaboration.js +1650 -0
  11. package/dist/app/doctor.d.ts +9 -0
  12. package/dist/app/doctor.js +1030 -0
  13. package/dist/app/init.d.ts +143 -0
  14. package/dist/app/init.js +1111 -0
  15. package/dist/cli/commands/code.d.ts +16 -0
  16. package/dist/cli/commands/code.js +127 -0
  17. package/dist/cli/commands/collaboration.d.ts +13 -0
  18. package/dist/cli/commands/collaboration.js +186 -0
  19. package/dist/cli/commands/continuity.d.ts +29 -0
  20. package/dist/cli/commands/continuity.js +133 -0
  21. package/dist/cli/commands/docs.d.ts +11 -0
  22. package/dist/cli/commands/docs.js +133 -0
  23. package/dist/cli/commands/doctor.d.ts +14 -0
  24. package/dist/cli/commands/doctor.js +57 -0
  25. package/dist/cli/commands/host.d.ts +13 -0
  26. package/dist/cli/commands/host.js +125 -0
  27. package/dist/cli/commands/init.d.ts +51 -0
  28. package/dist/cli/commands/init.js +668 -0
  29. package/dist/cli/main.d.ts +2 -0
  30. package/dist/cli/main.js +10 -0
  31. package/dist/cli/output.d.ts +4 -0
  32. package/dist/cli/output.js +1 -0
  33. package/dist/cli/run.d.ts +2 -0
  34. package/dist/cli/run.js +597 -0
  35. package/dist/code/budget.d.ts +14 -0
  36. package/dist/code/budget.js +39 -0
  37. package/dist/code/exec.d.ts +23 -0
  38. package/dist/code/exec.js +133 -0
  39. package/dist/code/identity.d.ts +13 -0
  40. package/dist/code/identity.js +214 -0
  41. package/dist/code/index.d.ts +6 -0
  42. package/dist/code/index.js +3 -0
  43. package/dist/code/providers/codegraph.d.ts +59 -0
  44. package/dist/code/providers/codegraph.js +567 -0
  45. package/dist/code/registration.d.ts +9 -0
  46. package/dist/code/registration.js +293 -0
  47. package/dist/code/service.d.ts +53 -0
  48. package/dist/code/service.js +633 -0
  49. package/dist/code/text.d.ts +3 -0
  50. package/dist/code/text.js +202 -0
  51. package/dist/collab/admission.d.ts +450 -0
  52. package/dist/collab/admission.js +797 -0
  53. package/dist/collab/canonical.d.ts +26 -0
  54. package/dist/collab/canonical.js +136 -0
  55. package/dist/collab/contracts.d.ts +73 -0
  56. package/dist/collab/contracts.js +76 -0
  57. package/dist/collab/envelope.d.ts +52 -0
  58. package/dist/collab/envelope.js +241 -0
  59. package/dist/collab/fingerprint.d.ts +7 -0
  60. package/dist/collab/fingerprint.js +58 -0
  61. package/dist/collab/handoff.d.ts +350 -0
  62. package/dist/collab/handoff.js +513 -0
  63. package/dist/collab/index.d.ts +9 -0
  64. package/dist/collab/index.js +8 -0
  65. package/dist/collab/lifecycle.d.ts +449 -0
  66. package/dist/collab/lifecycle.js +534 -0
  67. package/dist/collab/messages.d.ts +148 -0
  68. package/dist/collab/messages.js +583 -0
  69. package/dist/collab/notify.d.ts +47 -0
  70. package/dist/collab/notify.js +140 -0
  71. package/dist/collab/preflight.d.ts +31 -0
  72. package/dist/collab/preflight.js +271 -0
  73. package/dist/collab/resources.d.ts +119 -0
  74. package/dist/collab/resources.js +451 -0
  75. package/dist/collab/store.d.ts +143 -0
  76. package/dist/collab/store.js +606 -0
  77. package/dist/collab/types.d.ts +354 -0
  78. package/dist/collab/types.js +1 -0
  79. package/dist/collab/validation.d.ts +10 -0
  80. package/dist/collab/validation.js +303 -0
  81. package/dist/continuity/context.d.ts +24 -0
  82. package/dist/continuity/context.js +179 -0
  83. package/dist/continuity/index.d.ts +3 -0
  84. package/dist/continuity/index.js +1 -0
  85. package/dist/continuity/paths.d.ts +37 -0
  86. package/dist/continuity/paths.js +258 -0
  87. package/dist/continuity/service.d.ts +59 -0
  88. package/dist/continuity/service.js +1258 -0
  89. package/dist/hosts/claude/native.d.ts +79 -0
  90. package/dist/hosts/claude/native.js +853 -0
  91. package/dist/hosts/codex/native.d.ts +345 -0
  92. package/dist/hosts/codex/native.js +1528 -0
  93. package/dist/hosts/codex/protocol.d.ts +51 -0
  94. package/dist/hosts/codex/protocol.js +42 -0
  95. package/dist/hosts/detect.d.ts +28 -0
  96. package/dist/hosts/detect.js +73 -0
  97. package/dist/hosts/index.d.ts +10 -0
  98. package/dist/hosts/index.js +10 -0
  99. package/dist/hosts/integration/bundle.d.ts +16 -0
  100. package/dist/hosts/integration/bundle.js +81 -0
  101. package/dist/hosts/integration/hook-entry.d.ts +1 -0
  102. package/dist/hosts/integration/hook-entry.js +68 -0
  103. package/dist/hosts/integration/hook.d.ts +32 -0
  104. package/dist/hosts/integration/hook.js +781 -0
  105. package/dist/hosts/integration/pi-extension-runtime.d.ts +18 -0
  106. package/dist/hosts/integration/pi-extension-runtime.js +89 -0
  107. package/dist/hosts/integration/pi-template.d.ts +3 -0
  108. package/dist/hosts/integration/pi-template.js +5 -0
  109. package/dist/hosts/integration/service.d.ts +41 -0
  110. package/dist/hosts/integration/service.js +1381 -0
  111. package/dist/hosts/integration/support.d.ts +36 -0
  112. package/dist/hosts/integration/support.js +41 -0
  113. package/dist/hosts/integration/templates.d.ts +22 -0
  114. package/dist/hosts/integration/templates.js +70 -0
  115. package/dist/hosts/pi/protocol.d.ts +22 -0
  116. package/dist/hosts/pi/protocol.js +28 -0
  117. package/dist/hosts/pi/query-result.d.ts +22 -0
  118. package/dist/hosts/pi/query-result.js +710 -0
  119. package/dist/hosts/pi/rpc.d.ts +937 -0
  120. package/dist/hosts/pi/rpc.js +1621 -0
  121. package/dist/hosts/pilot.d.ts +485 -0
  122. package/dist/hosts/pilot.js +593 -0
  123. package/dist/index.d.ts +5 -0
  124. package/dist/index.js +4 -0
  125. package/dist/infra/fs.d.ts +27 -0
  126. package/dist/infra/fs.js +130 -0
  127. package/dist/infra/git.d.ts +60 -0
  128. package/dist/infra/git.js +358 -0
  129. package/dist/infra/owned-process-group.d.ts +173 -0
  130. package/dist/infra/owned-process-group.js +571 -0
  131. package/dist/install/apply.d.ts +65 -0
  132. package/dist/install/apply.js +663 -0
  133. package/dist/install/index.d.ts +5 -0
  134. package/dist/install/index.js +5 -0
  135. package/dist/install/ownership.d.ts +85 -0
  136. package/dist/install/ownership.js +430 -0
  137. package/dist/install/plan.d.ts +39 -0
  138. package/dist/install/plan.js +97 -0
  139. package/dist/install/rollback.d.ts +18 -0
  140. package/dist/install/rollback.js +544 -0
  141. package/dist/install/runtime.d.ts +76 -0
  142. package/dist/install/runtime.js +1145 -0
  143. package/dist/knowledge/catalog.d.ts +47 -0
  144. package/dist/knowledge/catalog.js +308 -0
  145. package/dist/knowledge/context.d.ts +28 -0
  146. package/dist/knowledge/context.js +61 -0
  147. package/dist/knowledge/index.d.ts +3 -0
  148. package/dist/knowledge/index.js +1 -0
  149. package/dist/knowledge/journal.d.ts +16 -0
  150. package/dist/knowledge/journal.js +109 -0
  151. package/dist/knowledge/lifecycle.d.ts +8 -0
  152. package/dist/knowledge/lifecycle.js +1001 -0
  153. package/dist/knowledge/paths.d.ts +37 -0
  154. package/dist/knowledge/paths.js +236 -0
  155. package/dist/knowledge/refs.d.ts +36 -0
  156. package/dist/knowledge/refs.js +267 -0
  157. package/dist/knowledge/service.d.ts +21 -0
  158. package/dist/knowledge/service.js +393 -0
  159. package/dist/knowledge/types.d.ts +171 -0
  160. package/dist/knowledge/types.js +1 -0
  161. package/dist/knowledge/write.d.ts +8 -0
  162. package/dist/knowledge/write.js +1223 -0
  163. package/dist/package-info.d.ts +6 -0
  164. package/dist/package-info.js +19 -0
  165. package/dist/schemas/code.d.ts +377 -0
  166. package/dist/schemas/code.js +145 -0
  167. package/dist/schemas/collaboration.d.ts +115 -0
  168. package/dist/schemas/collaboration.js +106 -0
  169. package/dist/schemas/continuity.d.ts +315 -0
  170. package/dist/schemas/continuity.js +199 -0
  171. package/dist/schemas/diagnostics.d.ts +28 -0
  172. package/dist/schemas/diagnostics.js +27 -0
  173. package/dist/schemas/doctor.d.ts +157 -0
  174. package/dist/schemas/doctor.js +75 -0
  175. package/dist/schemas/document.d.ts +644 -0
  176. package/dist/schemas/document.js +296 -0
  177. package/dist/schemas/errors.d.ts +177 -0
  178. package/dist/schemas/errors.js +176 -0
  179. package/dist/schemas/evidence.d.ts +24 -0
  180. package/dist/schemas/evidence.js +16 -0
  181. package/dist/schemas/host.d.ts +436 -0
  182. package/dist/schemas/host.js +201 -0
  183. package/dist/schemas/index.d.ts +15 -0
  184. package/dist/schemas/index.js +15 -0
  185. package/dist/schemas/init.d.ts +121 -0
  186. package/dist/schemas/init.js +94 -0
  187. package/dist/schemas/install.d.ts +213 -0
  188. package/dist/schemas/install.js +139 -0
  189. package/dist/schemas/machine.d.ts +43 -0
  190. package/dist/schemas/machine.js +96 -0
  191. package/dist/schemas/outcome.d.ts +23 -0
  192. package/dist/schemas/outcome.js +17 -0
  193. package/dist/schemas/paths.d.ts +19 -0
  194. package/dist/schemas/paths.js +63 -0
  195. package/dist/schemas/workspace.d.ts +120 -0
  196. package/dist/schemas/workspace.js +201 -0
  197. package/dist/workspace/config-file.d.ts +36 -0
  198. package/dist/workspace/config-file.js +237 -0
  199. package/dist/workspace/config.d.ts +28 -0
  200. package/dist/workspace/config.js +79 -0
  201. package/dist/workspace/discover.d.ts +34 -0
  202. package/dist/workspace/discover.js +195 -0
  203. package/dist/workspace/documents.d.ts +21 -0
  204. package/dist/workspace/documents.js +395 -0
  205. package/dist/workspace/ignore.d.ts +10 -0
  206. package/dist/workspace/ignore.js +48 -0
  207. package/dist/workspace/index.d.ts +7 -0
  208. package/dist/workspace/index.js +3 -0
  209. package/dist/workspace/repositories.d.ts +24 -0
  210. package/dist/workspace/repositories.js +411 -0
  211. package/dist/workspace/resolve.d.ts +24 -0
  212. package/dist/workspace/resolve.js +268 -0
  213. package/dist/workspace/types.d.ts +71 -0
  214. package/dist/workspace/types.js +1 -0
  215. package/dist/workspace/validation.d.ts +18 -0
  216. package/dist/workspace/validation.js +197 -0
  217. package/package.json +105 -4
  218. package/skills/pappra/SKILL.md +68 -0
  219. package/skills/pappra/references/hosts.md +30 -0
  220. package/skills/pappra/references/lifecycle.md +37 -0
  221. package/skills/pappra/references/operations.md +14 -0
@@ -0,0 +1,121 @@
1
+ import { z } from 'zod';
2
+ import { type Diagnostic } from './diagnostics.js';
3
+ export declare const INIT_CHOICES_SCHEMA = "pappra/init-choices/1";
4
+ export declare const INIT_PLAN_SCHEMA = "pappra/init-plan/1";
5
+ export declare const initRepositoryChoiceSchema: z.ZodObject<{
6
+ path: z.ZodString;
7
+ id: z.ZodOptional<z.ZodString>;
8
+ access: z.ZodEnum<{
9
+ read: "read";
10
+ write: "write";
11
+ }>;
12
+ }, z.core.$strict>;
13
+ /**
14
+ * High-level, UI-independent init selections. Candidate validation IDs refer
15
+ * to WorkspaceDiscovery.validationCandidates; repository paths refer to
16
+ * discovered checkout keys.
17
+ */
18
+ export declare const initChoicesSchema: z.ZodObject<{
19
+ schema: z.ZodLiteral<"pappra/init-choices/1">;
20
+ name: z.ZodOptional<z.ZodString>;
21
+ workspaceId: z.ZodOptional<z.ZodUUID>;
22
+ repositories: z.ZodArray<z.ZodObject<{
23
+ path: z.ZodString;
24
+ id: z.ZodOptional<z.ZodString>;
25
+ access: z.ZodEnum<{
26
+ read: "read";
27
+ write: "write";
28
+ }>;
29
+ }, z.core.$strict>>;
30
+ knowledge: z.ZodObject<{
31
+ sources: z.ZodArray<z.ZodString>;
32
+ newDocuments: z.ZodString;
33
+ taskVisibility: z.ZodEnum<{
34
+ private: "private";
35
+ shared: "shared";
36
+ }>;
37
+ }, z.core.$strict>;
38
+ code: z.ZodObject<{
39
+ graph: z.ZodEnum<{
40
+ codegraph: "codegraph";
41
+ none: "none";
42
+ }>;
43
+ symbols: z.ZodEnum<{
44
+ auto: "auto";
45
+ none: "none";
46
+ serena: "serena";
47
+ }>;
48
+ prepare: z.ZodEnum<{
49
+ manual: "manual";
50
+ "on-demand": "on-demand";
51
+ }>;
52
+ }, z.core.$strict>;
53
+ validation: z.ZodArray<z.ZodString>;
54
+ excludes: z.ZodArray<z.ZodString>;
55
+ hosts: z.ZodArray<z.ZodEnum<{
56
+ claude: "claude";
57
+ codex: "codex";
58
+ pi: "pi";
59
+ }>>;
60
+ }, z.core.$strict>;
61
+ export declare const plannedFileChangeSchema: z.ZodObject<{
62
+ path: z.ZodString;
63
+ operation: z.ZodEnum<{
64
+ create: "create";
65
+ merge: "merge";
66
+ "replace-managed": "replace-managed";
67
+ }>;
68
+ expectedBeforeDigest: z.ZodNullable<z.ZodString>;
69
+ nextDigest: z.ZodString;
70
+ backupRequired: z.ZodBoolean;
71
+ owner: z.ZodLiteral<"pappra">;
72
+ }, z.core.$strict>;
73
+ export declare const initExternalActionSchema: z.ZodObject<{
74
+ kind: z.ZodEnum<{
75
+ "install-provider": "install-provider";
76
+ "install-runtime": "install-runtime";
77
+ "prepare-index": "prepare-index";
78
+ }>;
79
+ target: z.ZodString;
80
+ version: z.ZodNullable<z.ZodString>;
81
+ }, z.core.$strict>;
82
+ export declare const initPlanSchema: z.ZodObject<{
83
+ schema: z.ZodLiteral<"pappra/init-plan/1">;
84
+ planId: z.ZodUUID;
85
+ workspaceRoot: z.ZodString;
86
+ discoveredAt: z.ZodISODateTime;
87
+ configurationDigest: z.ZodString;
88
+ files: z.ZodArray<z.ZodObject<{
89
+ path: z.ZodString;
90
+ operation: z.ZodEnum<{
91
+ create: "create";
92
+ merge: "merge";
93
+ "replace-managed": "replace-managed";
94
+ }>;
95
+ expectedBeforeDigest: z.ZodNullable<z.ZodString>;
96
+ nextDigest: z.ZodString;
97
+ backupRequired: z.ZodBoolean;
98
+ owner: z.ZodLiteral<"pappra">;
99
+ }, z.core.$strict>>;
100
+ externalActions: z.ZodArray<z.ZodObject<{
101
+ kind: z.ZodEnum<{
102
+ "install-provider": "install-provider";
103
+ "install-runtime": "install-runtime";
104
+ "prepare-index": "prepare-index";
105
+ }>;
106
+ target: z.ZodString;
107
+ version: z.ZodNullable<z.ZodString>;
108
+ }, z.core.$strict>>;
109
+ }, z.core.$strict>;
110
+ export type InitChoices = z.infer<typeof initChoicesSchema>;
111
+ export type InitRepositoryChoice = z.infer<typeof initRepositoryChoiceSchema>;
112
+ export type InitPlan = z.infer<typeof initPlanSchema>;
113
+ export type InitExternalAction = z.infer<typeof initExternalActionSchema>;
114
+ export type PlannedFileChange = z.infer<typeof plannedFileChangeSchema>;
115
+ export type PlannedFileOperation = PlannedFileChange['operation'];
116
+ export interface InitChoicesParseResult {
117
+ readonly value: InitChoices | null;
118
+ readonly diagnostics: readonly Diagnostic[];
119
+ }
120
+ /** Decodes external --config input without applying defaults or partial data. */
121
+ export declare function parseInitChoices(value: unknown, source: string): InitChoicesParseResult;
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ import { createDiagnostic, pointer } from './diagnostics.js';
3
+ import { diagnosticCodes } from './errors.js';
4
+ import { hostSchema } from './machine.js';
5
+ import { workspaceCodeSchema, workspaceKnowledgeSchema } from './workspace.js';
6
+ export const INIT_CHOICES_SCHEMA = 'pappra/init-choices/1';
7
+ export const INIT_PLAN_SCHEMA = 'pappra/init-plan/1';
8
+ const identifierSchema = z
9
+ .string()
10
+ .min(1)
11
+ .max(64)
12
+ .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
13
+ const digestSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/);
14
+ export const initRepositoryChoiceSchema = z.strictObject({
15
+ /** Discovered repository key: workspace-relative path or external:<id>. */
16
+ path: z.string().min(1).max(2048),
17
+ id: identifierSchema.optional(),
18
+ access: z.enum(['read', 'write']),
19
+ });
20
+ /**
21
+ * High-level, UI-independent init selections. Candidate validation IDs refer
22
+ * to WorkspaceDiscovery.validationCandidates; repository paths refer to
23
+ * discovered checkout keys.
24
+ */
25
+ export const initChoicesSchema = z.strictObject({
26
+ schema: z.literal(INIT_CHOICES_SCHEMA),
27
+ name: z.string().min(1).max(200).optional(),
28
+ workspaceId: z.uuid().optional(),
29
+ repositories: z.array(initRepositoryChoiceSchema).max(128),
30
+ knowledge: workspaceKnowledgeSchema,
31
+ code: workspaceCodeSchema,
32
+ validation: z.array(z.string().min(1).max(1024)).max(128),
33
+ excludes: z.array(z.string().min(1).max(2048)).max(128),
34
+ hosts: z.array(hostSchema).max(16),
35
+ });
36
+ export const plannedFileChangeSchema = z.strictObject({
37
+ path: z.string().min(1).max(2048),
38
+ operation: z.enum(['create', 'merge', 'replace-managed']),
39
+ expectedBeforeDigest: digestSchema.nullable(),
40
+ nextDigest: digestSchema,
41
+ backupRequired: z.boolean(),
42
+ owner: z.literal('pappra'),
43
+ });
44
+ export const initExternalActionSchema = z.strictObject({
45
+ kind: z.enum(['install-runtime', 'install-provider', 'prepare-index']),
46
+ target: z.string().min(1).max(256),
47
+ version: z.string().min(1).max(256).nullable(),
48
+ });
49
+ export const initPlanSchema = z.strictObject({
50
+ schema: z.literal(INIT_PLAN_SCHEMA),
51
+ planId: z.uuid(),
52
+ workspaceRoot: z.string().min(1).max(4096),
53
+ discoveredAt: z.iso.datetime({ offset: true }),
54
+ configurationDigest: digestSchema,
55
+ files: z.array(plannedFileChangeSchema).max(256),
56
+ externalActions: z.array(initExternalActionSchema).max(128),
57
+ });
58
+ function issuePointer(path) {
59
+ return path.length === 0
60
+ ? null
61
+ : pointer(...path.map((segment) => String(segment)));
62
+ }
63
+ /** Decodes external --config input without applying defaults or partial data. */
64
+ export function parseInitChoices(value, source) {
65
+ const parsed = initChoicesSchema.safeParse(value);
66
+ if (parsed.success)
67
+ return { value: parsed.data, diagnostics: [] };
68
+ const diagnostics = [];
69
+ for (const issue of parsed.error.issues) {
70
+ if (issue.code === 'unrecognized_keys') {
71
+ const base = issuePointer(issue.path);
72
+ for (const key of issue.keys) {
73
+ diagnostics.push(createDiagnostic({
74
+ code: diagnosticCodes.initInvalidInput,
75
+ severity: 'error',
76
+ message: `Unknown init selection key "${key}".`,
77
+ source,
78
+ pointer: `${base === null ? '' : base}/${key.replaceAll('~', '~0').replaceAll('/', '~1')}`,
79
+ hint: 'Remove the key; init choices do not accept arbitrary extensions.',
80
+ }));
81
+ }
82
+ continue;
83
+ }
84
+ diagnostics.push(createDiagnostic({
85
+ code: diagnosticCodes.initInvalidInput,
86
+ severity: 'error',
87
+ message: issue.message,
88
+ source,
89
+ pointer: issuePointer(issue.path),
90
+ hint: 'Use pappra/init-choices/1 fields and values; Pappra does not coerce selections.',
91
+ }));
92
+ }
93
+ return { value: null, diagnostics };
94
+ }
@@ -0,0 +1,213 @@
1
+ import { z } from 'zod';
2
+ export declare const RUNTIME_MANIFEST_SCHEMA = "pappra/runtime-manifest/1";
3
+ export declare const WORKSPACE_MANIFEST_SCHEMA = "pappra/install-manifest/1";
4
+ export declare const INSTALL_JOURNAL_SCHEMA = "pappra/install-journal/1";
5
+ export declare const LOCK_SCHEMA = "pappra/install-lock/1";
6
+ export declare const fileIdentitySchema: z.ZodObject<{
7
+ dev: z.ZodNumber;
8
+ ino: z.ZodNumber;
9
+ }, z.core.$strict>;
10
+ export declare const installLockSchema: z.ZodObject<{
11
+ schema: z.ZodLiteral<"pappra/install-lock/1">;
12
+ token: z.ZodUUID;
13
+ operation: z.ZodEnum<{
14
+ "apply-workspace-files": "apply-workspace-files";
15
+ "install-runtime": "install-runtime";
16
+ "remove-runtime": "remove-runtime";
17
+ "rollback-workspace-files": "rollback-workspace-files";
18
+ "uninstall-workspace-files": "uninstall-workspace-files";
19
+ "update-machine-runtime": "update-machine-runtime";
20
+ }>;
21
+ target: z.ZodString;
22
+ pid: z.ZodNumber;
23
+ createdAt: z.ZodISODateTime;
24
+ }, z.core.$strict>;
25
+ export type InstallLock = z.infer<typeof installLockSchema>;
26
+ export declare const runtimeSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
27
+ kind: z.ZodLiteral<"version">;
28
+ packageName: z.ZodString;
29
+ version: z.ZodString;
30
+ ref: z.ZodString;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ kind: z.ZodLiteral<"tarball">;
33
+ packageName: z.ZodString;
34
+ version: z.ZodString;
35
+ path: z.ZodString;
36
+ digest: z.ZodString;
37
+ }, z.core.$strict>], "kind">;
38
+ export type RuntimeSource = z.infer<typeof runtimeSourceSchema>;
39
+ export declare const runtimeManifestSchema: z.ZodObject<{
40
+ schema: z.ZodLiteral<"pappra/runtime-manifest/1">;
41
+ installId: z.ZodUUID;
42
+ packageName: z.ZodString;
43
+ runtimeVersion: z.ZodString;
44
+ runtimeRoot: z.ZodString;
45
+ executable: z.ZodString;
46
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ kind: z.ZodLiteral<"version">;
48
+ packageName: z.ZodString;
49
+ version: z.ZodString;
50
+ ref: z.ZodString;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ kind: z.ZodLiteral<"tarball">;
53
+ packageName: z.ZodString;
54
+ version: z.ZodString;
55
+ path: z.ZodString;
56
+ digest: z.ZodString;
57
+ }, z.core.$strict>], "kind">;
58
+ packageDigest: z.ZodString;
59
+ smoke: z.ZodObject<{
60
+ argv: z.ZodArray<z.ZodString>;
61
+ exitCode: z.ZodNumber;
62
+ stdoutDigest: z.ZodString;
63
+ }, z.core.$strict>;
64
+ verifiedAt: z.ZodISODateTime;
65
+ }, z.core.$strict>;
66
+ export type RuntimeManifest = z.infer<typeof runtimeManifestSchema>;
67
+ export declare const journalStatusSchema: z.ZodEnum<{
68
+ applied: "applied";
69
+ applying: "applying";
70
+ prepared: "prepared";
71
+ "rollback-required": "rollback-required";
72
+ "rolled-back": "rolled-back";
73
+ verified: "verified";
74
+ }>;
75
+ export type JournalStatus = z.infer<typeof journalStatusSchema>;
76
+ export declare const journalStepSchema: z.ZodObject<{
77
+ name: z.ZodString;
78
+ status: z.ZodEnum<{
79
+ failed: "failed";
80
+ ok: "ok";
81
+ }>;
82
+ at: z.ZodISODateTime;
83
+ detail: z.ZodNullable<z.ZodString>;
84
+ }, z.core.$strict>;
85
+ export declare const journalEntrySchema: z.ZodObject<{
86
+ path: z.ZodString;
87
+ status: z.ZodEnum<{
88
+ created: "created";
89
+ pending: "pending";
90
+ removed: "removed";
91
+ residual: "residual";
92
+ verified: "verified";
93
+ }>;
94
+ digest: z.ZodString;
95
+ identity: z.ZodNullable<z.ZodObject<{
96
+ dev: z.ZodNumber;
97
+ ino: z.ZodNumber;
98
+ }, z.core.$strict>>;
99
+ backupRef: z.ZodNullable<z.ZodString>;
100
+ backupDigest: z.ZodNullable<z.ZodString>;
101
+ detail: z.ZodNullable<z.ZodString>;
102
+ }, z.core.$strict>;
103
+ export declare const installJournalSchema: z.ZodObject<{
104
+ schema: z.ZodLiteral<"pappra/install-journal/1">;
105
+ installId: z.ZodUUID;
106
+ operation: z.ZodEnum<{
107
+ "apply-workspace-files": "apply-workspace-files";
108
+ "install-runtime": "install-runtime";
109
+ "remove-runtime": "remove-runtime";
110
+ "rollback-workspace-files": "rollback-workspace-files";
111
+ "uninstall-workspace-files": "uninstall-workspace-files";
112
+ "update-machine-runtime": "update-machine-runtime";
113
+ }>;
114
+ target: z.ZodString;
115
+ workspaceRoot: z.ZodNullable<z.ZodString>;
116
+ runtimeVersion: z.ZodNullable<z.ZodString>;
117
+ status: z.ZodEnum<{
118
+ applied: "applied";
119
+ applying: "applying";
120
+ prepared: "prepared";
121
+ "rollback-required": "rollback-required";
122
+ "rolled-back": "rolled-back";
123
+ verified: "verified";
124
+ }>;
125
+ createdAt: z.ZodISODateTime;
126
+ updatedAt: z.ZodISODateTime;
127
+ steps: z.ZodArray<z.ZodObject<{
128
+ name: z.ZodString;
129
+ status: z.ZodEnum<{
130
+ failed: "failed";
131
+ ok: "ok";
132
+ }>;
133
+ at: z.ZodISODateTime;
134
+ detail: z.ZodNullable<z.ZodString>;
135
+ }, z.core.$strict>>;
136
+ entries: z.ZodArray<z.ZodObject<{
137
+ path: z.ZodString;
138
+ status: z.ZodEnum<{
139
+ created: "created";
140
+ pending: "pending";
141
+ removed: "removed";
142
+ residual: "residual";
143
+ verified: "verified";
144
+ }>;
145
+ digest: z.ZodString;
146
+ identity: z.ZodNullable<z.ZodObject<{
147
+ dev: z.ZodNumber;
148
+ ino: z.ZodNumber;
149
+ }, z.core.$strict>>;
150
+ backupRef: z.ZodNullable<z.ZodString>;
151
+ backupDigest: z.ZodNullable<z.ZodString>;
152
+ detail: z.ZodNullable<z.ZodString>;
153
+ }, z.core.$strict>>;
154
+ residuals: z.ZodArray<z.ZodString>;
155
+ manifestRef: z.ZodNullable<z.ZodString>;
156
+ }, z.core.$strict>;
157
+ export type InstallJournal = z.infer<typeof installJournalSchema>;
158
+ export declare const managedFileEntrySchema: z.ZodObject<{
159
+ path: z.ZodString;
160
+ installId: z.ZodUUID;
161
+ operation: z.ZodEnum<{
162
+ create: "create";
163
+ "replace-managed": "replace-managed";
164
+ }>;
165
+ beforeDigest: z.ZodNullable<z.ZodString>;
166
+ afterDigest: z.ZodString;
167
+ backupRef: z.ZodNullable<z.ZodString>;
168
+ backupDigest: z.ZodNullable<z.ZodString>;
169
+ identity: z.ZodObject<{
170
+ dev: z.ZodNumber;
171
+ ino: z.ZodNumber;
172
+ }, z.core.$strict>;
173
+ owner: z.ZodLiteral<"pappra">;
174
+ verifiedAt: z.ZodISODateTime;
175
+ }, z.core.$strict>;
176
+ export type ManagedFileEntry = z.infer<typeof managedFileEntrySchema>;
177
+ export declare const workspaceInstallManifestSchema: z.ZodObject<{
178
+ schema: z.ZodLiteral<"pappra/install-manifest/1">;
179
+ workspaceRoot: z.ZodString;
180
+ rootIdentity: z.ZodObject<{
181
+ dev: z.ZodNumber;
182
+ ino: z.ZodNumber;
183
+ }, z.core.$strict>;
184
+ entries: z.ZodArray<z.ZodObject<{
185
+ path: z.ZodString;
186
+ installId: z.ZodUUID;
187
+ operation: z.ZodEnum<{
188
+ create: "create";
189
+ "replace-managed": "replace-managed";
190
+ }>;
191
+ beforeDigest: z.ZodNullable<z.ZodString>;
192
+ afterDigest: z.ZodString;
193
+ backupRef: z.ZodNullable<z.ZodString>;
194
+ backupDigest: z.ZodNullable<z.ZodString>;
195
+ identity: z.ZodObject<{
196
+ dev: z.ZodNumber;
197
+ ino: z.ZodNumber;
198
+ }, z.core.$strict>;
199
+ owner: z.ZodLiteral<"pappra">;
200
+ verifiedAt: z.ZodISODateTime;
201
+ }, z.core.$strict>>;
202
+ createdAt: z.ZodISODateTime;
203
+ updatedAt: z.ZodISODateTime;
204
+ }, z.core.$strict>;
205
+ export type WorkspaceInstallManifest = z.infer<typeof workspaceInstallManifestSchema>;
206
+ export declare const runtimePackageManifestSchema: z.ZodObject<{
207
+ name: z.ZodString;
208
+ version: z.ZodString;
209
+ bin: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
210
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
211
+ scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
212
+ }, z.core.$strip>;
213
+ export type RuntimePackageManifest = z.infer<typeof runtimePackageManifestSchema>;
@@ -0,0 +1,139 @@
1
+ import { z } from 'zod';
2
+ export const RUNTIME_MANIFEST_SCHEMA = 'pappra/runtime-manifest/1';
3
+ export const WORKSPACE_MANIFEST_SCHEMA = 'pappra/install-manifest/1';
4
+ export const INSTALL_JOURNAL_SCHEMA = 'pappra/install-journal/1';
5
+ export const LOCK_SCHEMA = 'pappra/install-lock/1';
6
+ const digestSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/);
7
+ const versionSchema = z
8
+ .string()
9
+ .min(1)
10
+ .max(128)
11
+ .regex(/^[0-9A-Za-z][0-9A-Za-z0-9._+-]*$/);
12
+ const pathSchema = z.string().min(1).max(4096);
13
+ export const fileIdentitySchema = z.strictObject({
14
+ dev: z.number().int().nonnegative(),
15
+ ino: z.number().int().nonnegative(),
16
+ });
17
+ export const installLockSchema = z.strictObject({
18
+ schema: z.literal(LOCK_SCHEMA),
19
+ token: z.uuid(),
20
+ operation: z.enum([
21
+ 'install-runtime',
22
+ 'apply-workspace-files',
23
+ 'rollback-workspace-files',
24
+ 'uninstall-workspace-files',
25
+ 'remove-runtime',
26
+ 'update-machine-runtime',
27
+ ]),
28
+ target: z.string().min(1).max(4096),
29
+ pid: z.number().int().positive(),
30
+ createdAt: z.iso.datetime({ offset: true }),
31
+ });
32
+ export const runtimeSourceSchema = z.discriminatedUnion('kind', [
33
+ z.strictObject({
34
+ kind: z.literal('version'),
35
+ packageName: z.string().min(1).max(256),
36
+ version: versionSchema,
37
+ ref: z.string().min(1).max(512),
38
+ }),
39
+ z.strictObject({
40
+ kind: z.literal('tarball'),
41
+ packageName: z.string().min(1).max(256),
42
+ version: versionSchema,
43
+ path: pathSchema,
44
+ digest: digestSchema,
45
+ }),
46
+ ]);
47
+ export const runtimeManifestSchema = z.strictObject({
48
+ schema: z.literal(RUNTIME_MANIFEST_SCHEMA),
49
+ installId: z.uuid(),
50
+ packageName: z.string().min(1).max(256),
51
+ runtimeVersion: versionSchema,
52
+ runtimeRoot: pathSchema,
53
+ executable: pathSchema,
54
+ source: runtimeSourceSchema,
55
+ packageDigest: digestSchema,
56
+ smoke: z.strictObject({
57
+ argv: z.array(z.string().max(4096)).max(16),
58
+ exitCode: z.number().int(),
59
+ stdoutDigest: digestSchema,
60
+ }),
61
+ verifiedAt: z.iso.datetime({ offset: true }),
62
+ });
63
+ export const journalStatusSchema = z.enum([
64
+ 'prepared',
65
+ 'applying',
66
+ 'applied',
67
+ 'verified',
68
+ 'rollback-required',
69
+ 'rolled-back',
70
+ ]);
71
+ export const journalStepSchema = z.strictObject({
72
+ name: z.string().min(1).max(256),
73
+ status: z.enum(['ok', 'failed']),
74
+ at: z.iso.datetime({ offset: true }),
75
+ detail: z.string().max(4096).nullable(),
76
+ });
77
+ export const journalEntrySchema = z.strictObject({
78
+ path: z.string().min(1).max(2048),
79
+ status: z.enum(['pending', 'created', 'verified', 'removed', 'residual']),
80
+ digest: digestSchema,
81
+ identity: fileIdentitySchema.nullable(),
82
+ backupRef: z.string().min(1).max(4096).nullable(),
83
+ backupDigest: digestSchema.nullable(),
84
+ detail: z.string().max(4096).nullable(),
85
+ });
86
+ export const installJournalSchema = z.strictObject({
87
+ schema: z.literal(INSTALL_JOURNAL_SCHEMA),
88
+ installId: z.uuid(),
89
+ operation: z.enum([
90
+ 'install-runtime',
91
+ 'apply-workspace-files',
92
+ 'rollback-workspace-files',
93
+ 'uninstall-workspace-files',
94
+ 'remove-runtime',
95
+ 'update-machine-runtime',
96
+ ]),
97
+ target: z.string().min(1).max(4096),
98
+ workspaceRoot: pathSchema.nullable(),
99
+ runtimeVersion: versionSchema.nullable(),
100
+ status: journalStatusSchema,
101
+ createdAt: z.iso.datetime({ offset: true }),
102
+ updatedAt: z.iso.datetime({ offset: true }),
103
+ steps: z.array(journalStepSchema).max(256),
104
+ entries: z.array(journalEntrySchema).max(256),
105
+ residuals: z.array(z.string().min(1).max(2048)).max(256),
106
+ manifestRef: z.string().max(4096).nullable(),
107
+ });
108
+ export const managedFileEntrySchema = z.strictObject({
109
+ path: z.string().min(1).max(2048),
110
+ installId: z.uuid(),
111
+ operation: z.enum(['create', 'replace-managed']),
112
+ beforeDigest: digestSchema.nullable(),
113
+ afterDigest: digestSchema,
114
+ backupRef: z.string().min(1).max(4096).nullable(),
115
+ backupDigest: digestSchema.nullable(),
116
+ identity: fileIdentitySchema,
117
+ owner: z.literal('pappra'),
118
+ verifiedAt: z.iso.datetime({ offset: true }),
119
+ });
120
+ export const workspaceInstallManifestSchema = z.strictObject({
121
+ schema: z.literal(WORKSPACE_MANIFEST_SCHEMA),
122
+ workspaceRoot: pathSchema,
123
+ rootIdentity: fileIdentitySchema,
124
+ entries: z.array(managedFileEntrySchema).max(512),
125
+ createdAt: z.iso.datetime({ offset: true }),
126
+ updatedAt: z.iso.datetime({ offset: true }),
127
+ });
128
+ export const runtimePackageManifestSchema = z.object({
129
+ name: z.string().min(1).max(256),
130
+ version: versionSchema,
131
+ bin: z
132
+ .union([
133
+ z.string().min(1).max(2048),
134
+ z.record(z.string().min(1).max(256), z.string().min(1).max(2048)),
135
+ ])
136
+ .optional(),
137
+ dependencies: z.record(z.string(), z.string()).optional(),
138
+ scripts: z.record(z.string(), z.string()).optional(),
139
+ });
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { type Diagnostic } from './diagnostics.js';
3
+ export declare const MACHINE_SCHEMA = "pappra/machine/1";
4
+ export declare const hostSchema: z.ZodEnum<{
5
+ claude: "claude";
6
+ codex: "codex";
7
+ pi: "pi";
8
+ }>;
9
+ export declare const externalRepositoryMappingSchema: z.ZodObject<{
10
+ id: z.ZodString;
11
+ path: z.ZodString;
12
+ }, z.core.$strict>;
13
+ export declare const runtimeLocationSchema: z.ZodObject<{
14
+ version: z.ZodString;
15
+ executable: z.ZodString;
16
+ verifiedAt: z.ZodISODateTime;
17
+ }, z.core.$strict>;
18
+ export declare const machineConfigSchema: z.ZodObject<{
19
+ schema: z.ZodLiteral<"pappra/machine/1">;
20
+ workspaceRealpath: z.ZodString;
21
+ checkoutId: z.ZodUUID;
22
+ externalRepositories: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ path: z.ZodString;
25
+ }, z.core.$strict>>;
26
+ selectedHosts: z.ZodArray<z.ZodEnum<{
27
+ claude: "claude";
28
+ codex: "codex";
29
+ pi: "pi";
30
+ }>>;
31
+ runtime: z.ZodNullable<z.ZodObject<{
32
+ version: z.ZodString;
33
+ executable: z.ZodString;
34
+ verifiedAt: z.ZodISODateTime;
35
+ }, z.core.$strict>>;
36
+ }, z.core.$strict>;
37
+ export type MachineConfig = z.infer<typeof machineConfigSchema>;
38
+ export type ExternalRepositoryMapping = z.infer<typeof externalRepositoryMappingSchema>;
39
+ export type RuntimeLocation = z.infer<typeof runtimeLocationSchema>;
40
+ export interface MachineConfigSemanticOptions {
41
+ readonly configPath: string;
42
+ }
43
+ export declare function validateMachineConfigSemantics(config: MachineConfig, options: MachineConfigSemanticOptions): readonly Diagnostic[];