@engram-cli/contracts 0.1.0 → 0.1.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.
package/dist/index.d.ts CHANGED
@@ -3,4 +3,6 @@ export { MemorySourceSchema, MemoryEventTypeSchema, MemoryEventSchema, type Memo
3
3
  export { CapsuleErrorSchema, CapsuleFailedCommandSchema, CapsuleGitSchema, CapsuleManualNoteSchema, CapsuleSchema, type CapsuleError, type CapsuleFailedCommand, type CapsuleGit, type CapsuleManualNote, type Capsule, } from "./capsule.js";
4
4
  export { projectContainerTag, normalizeProjectSlug, truncateBytes, deterministicFactString, isSignalCommand, SIGNAL_COMMAND_PATTERNS, } from "./helpers.js";
5
5
  export { toMarkdown } from "./markdown.js";
6
+ export { sanitizeCapsule, type RedactionFinding, type RedactionKind, type SanitizeResult, } from "./redaction.js";
7
+ export { RedactionFindingSchema, SharePreviewRequestSchema, SharePreviewResponseSchema, ShareCreateRequestSchema, ShareRecordSchema, PublicShareSchema, ShareImportRequestSchema, ShareRevokeRequestSchema, type RedactionFindingZ, type SharePreviewRequest, type SharePreviewResponse, type ShareCreateRequest, type ShareRecord, type PublicShare, type ShareImportRequest, type ShareRevokeRequest, } from "./share.js";
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -3,3 +3,5 @@ export { MemorySourceSchema, MemoryEventTypeSchema, MemoryEventSchema, } from ".
3
3
  export { CapsuleErrorSchema, CapsuleFailedCommandSchema, CapsuleGitSchema, CapsuleManualNoteSchema, CapsuleSchema, } from "./capsule.js";
4
4
  export { projectContainerTag, normalizeProjectSlug, truncateBytes, deterministicFactString, isSignalCommand, SIGNAL_COMMAND_PATTERNS, } from "./helpers.js";
5
5
  export { toMarkdown } from "./markdown.js";
6
+ export { sanitizeCapsule, } from "./redaction.js";
7
+ export { RedactionFindingSchema, SharePreviewRequestSchema, SharePreviewResponseSchema, ShareCreateRequestSchema, ShareRecordSchema, PublicShareSchema, ShareImportRequestSchema, ShareRevokeRequestSchema, } from "./share.js";
@@ -0,0 +1,22 @@
1
+ import type { Capsule } from "./capsule.js";
2
+ export declare const RedactionFindingSchema: {
3
+ readonly field: "string";
4
+ readonly kind: "string";
5
+ readonly preview: "string";
6
+ };
7
+ export type RedactionKind = "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
8
+ export interface RedactionFinding {
9
+ field: string;
10
+ kind: RedactionKind;
11
+ preview: string;
12
+ }
13
+ export interface SanitizeResult {
14
+ capsule: Capsule;
15
+ findings: RedactionFinding[];
16
+ blocked: boolean;
17
+ blockReason?: string;
18
+ }
19
+ export declare function sanitizeCapsule(capsule: Capsule, opts?: {
20
+ projectRoot?: string;
21
+ }): SanitizeResult;
22
+ //# sourceMappingURL=redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,KAAK,GACL,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,WAAW,CAAC;AAEhB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgHD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,cAAc,CA6FhB"}
@@ -0,0 +1,187 @@
1
+ import { CAPS } from "./caps.js";
2
+ import { truncateBytes } from "./helpers.js";
3
+ export const RedactionFindingSchema = {
4
+ field: "string",
5
+ kind: "string",
6
+ preview: "string",
7
+ };
8
+ const REDACTED = "[REDACTED]";
9
+ const PATTERNS = [
10
+ { kind: "jwt", re: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g },
11
+ {
12
+ kind: "private_key",
13
+ re: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----[\s\S]*?-----END (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/g,
14
+ },
15
+ {
16
+ kind: "database_url",
17
+ re: /\b(?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?|redis):\/\/[^\s"'`]+/gi,
18
+ },
19
+ {
20
+ kind: "env_assignment",
21
+ re: /(?:^|[\s;])([A-Z][A-Z0-9_]{2,})=(?:['"]?)([^\s'"`;]{8,})\1?/gm,
22
+ },
23
+ {
24
+ kind: "cloud_credential",
25
+ re: /\b(?:sk-[A-Za-z0-9]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{20,}|AKIA[0-9A-Z]{16}|sm_[A-Za-z0-9]{20,})\b/g,
26
+ },
27
+ {
28
+ kind: "api_key",
29
+ re: /\b(?:api[_-]?key|secret|token|password|passwd|authorization)\s*[:=]\s*['"]?([A-Za-z0-9_./+=-]{12,})['"]?/gi,
30
+ },
31
+ ];
32
+ function homeDirPattern() {
33
+ const home = process.env.HOME || process.env.USERPROFILE;
34
+ if (!home || home.length < 2)
35
+ return null;
36
+ const escaped = home.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
37
+ return new RegExp(escaped, "g");
38
+ }
39
+ function redactString(value, field, findings) {
40
+ let out = value;
41
+ for (const { kind, re } of PATTERNS) {
42
+ re.lastIndex = 0;
43
+ const matches = out.match(re);
44
+ if (matches) {
45
+ for (const m of matches) {
46
+ findings.push({
47
+ field,
48
+ kind,
49
+ preview: m.length > 24 ? `${m.slice(0, 12)}…${m.slice(-4)}` : m,
50
+ });
51
+ }
52
+ out = out.replace(re, REDACTED);
53
+ }
54
+ }
55
+ const homeRe = homeDirPattern();
56
+ if (homeRe) {
57
+ if (homeRe.test(out)) {
58
+ findings.push({ field, kind: "home_path", preview: "home directory path" });
59
+ out = out.replace(homeRe, REDACTED);
60
+ }
61
+ }
62
+ return out;
63
+ }
64
+ function toProjectRelative(filePath, project) {
65
+ if (filePath === REDACTED)
66
+ return filePath;
67
+ const normalized = filePath.replace(/\\/g, "/");
68
+ const home = (process.env.HOME || process.env.USERPROFILE || "").replace(/\\/g, "/");
69
+ if (home && normalized.startsWith(home)) {
70
+ const rel = normalized.slice(home.length).replace(/^\//, "");
71
+ const idx = rel.indexOf(`/${project}/`);
72
+ if (idx >= 0)
73
+ return rel.slice(idx + project.length + 2);
74
+ const parts = rel.split("/");
75
+ if (parts.length > 2)
76
+ return parts.slice(-3).join("/");
77
+ return rel;
78
+ }
79
+ const marker = `/${project}/`;
80
+ const i = normalized.indexOf(marker);
81
+ if (i >= 0)
82
+ return normalized.slice(i + marker.length);
83
+ const base = normalized.split("/").pop();
84
+ return base ?? normalized;
85
+ }
86
+ function buildSummaryFromStructured(capsule) {
87
+ const lines = [];
88
+ if (capsule.git.branch)
89
+ lines.push(`On branch ${capsule.git.branch}.`);
90
+ if (capsule.git.last_commit)
91
+ lines.push(`Last commit: ${capsule.git.last_commit}.`);
92
+ if (capsule.recent_files.length) {
93
+ lines.push(`Recent files: ${capsule.recent_files.slice(0, 5).join(", ")}.`);
94
+ }
95
+ if (capsule.errors.length) {
96
+ const e = capsule.errors[0];
97
+ const loc = e.file_path
98
+ ? `${e.file_path}${e.line != null ? `:${e.line}` : ""}`
99
+ : "unknown";
100
+ lines.push(`Error at ${loc}: ${e.message}`);
101
+ }
102
+ if (capsule.failed_commands.length) {
103
+ const c = capsule.failed_commands[0];
104
+ lines.push(`Failed: \`${c.command}\` (exit ${c.exit_code}).`);
105
+ }
106
+ if (capsule.manual_notes.length) {
107
+ const n = capsule.manual_notes[0];
108
+ lines.push(`Note (${n.kind}): ${n.text}`);
109
+ }
110
+ if (!lines.length)
111
+ lines.push("No recent Engram context for this project.");
112
+ return truncateBytes(lines.join(" "), CAPS.summaryBytes);
113
+ }
114
+ export function sanitizeCapsule(capsule, opts) {
115
+ const findings = [];
116
+ const project = capsule.project;
117
+ const recent_files = capsule.recent_files.map((f, i) => {
118
+ const redacted = redactString(f, `recent_files[${i}]`, findings);
119
+ return toProjectRelative(redacted === REDACTED ? f : redacted, project);
120
+ });
121
+ const errors = capsule.errors.map((e, i) => ({
122
+ ...e,
123
+ message: redactString(e.message, `errors[${i}].message`, findings),
124
+ file_path: e.file_path
125
+ ? toProjectRelative(redactString(e.file_path, `errors[${i}].file_path`, findings), project)
126
+ : undefined,
127
+ }));
128
+ const failed_commands = capsule.failed_commands.map((c, i) => ({
129
+ ...c,
130
+ command: redactString(c.command, `failed_commands[${i}].command`, findings),
131
+ stderr_tail: c.stderr_tail
132
+ ? redactString(c.stderr_tail, `failed_commands[${i}].stderr_tail`, findings)
133
+ : undefined,
134
+ cwd: c.cwd
135
+ ? toProjectRelative(redactString(c.cwd, `failed_commands[${i}].cwd`, findings), project)
136
+ : undefined,
137
+ }));
138
+ const manual_notes = capsule.manual_notes.map((n, i) => ({
139
+ ...n,
140
+ text: redactString(n.text, `manual_notes[${i}].text`, findings),
141
+ file_path: n.file_path
142
+ ? toProjectRelative(redactString(n.file_path, `manual_notes[${i}].file_path`, findings), project)
143
+ : undefined,
144
+ chat_label: n.chat_label
145
+ ? redactString(n.chat_label, `manual_notes[${i}].chat_label`, findings)
146
+ : undefined,
147
+ }));
148
+ const git = {
149
+ branch: capsule.git.branch
150
+ ? redactString(capsule.git.branch, "git.branch", findings)
151
+ : undefined,
152
+ last_commit: capsule.git.last_commit
153
+ ? redactString(capsule.git.last_commit, "git.last_commit", findings)
154
+ : undefined,
155
+ };
156
+ // Scan original summary for findings (rebuilt summary uses structured fields only).
157
+ if (capsule.summary.trim()) {
158
+ redactString(capsule.summary, "summary", findings);
159
+ }
160
+ const sanitized = {
161
+ ...capsule,
162
+ recent_files,
163
+ errors,
164
+ failed_commands,
165
+ git,
166
+ manual_notes,
167
+ summary: "",
168
+ };
169
+ sanitized.summary = buildSummaryFromStructured(sanitized);
170
+ const stillSensitive = [
171
+ sanitized.summary,
172
+ ...sanitized.recent_files,
173
+ ...sanitized.errors.map((e) => e.message),
174
+ ...sanitized.failed_commands.map((c) => c.stderr_tail ?? ""),
175
+ ...sanitized.manual_notes.map((n) => n.text),
176
+ ].some((s) => /eyJ[A-Za-z0-9_-]{10,}\.|sk-[A-Za-z0-9]{20,}|ghp_[A-Za-z0-9]{20,}/.test(s));
177
+ if (stillSensitive) {
178
+ return {
179
+ capsule: sanitized,
180
+ findings,
181
+ blocked: true,
182
+ blockReason: "sanitization_incomplete",
183
+ };
184
+ }
185
+ void opts?.projectRoot;
186
+ return { capsule: sanitized, findings, blocked: false };
187
+ }
@@ -0,0 +1,889 @@
1
+ import { z } from "zod";
2
+ export declare const RedactionFindingSchema: z.ZodObject<{
3
+ field: z.ZodString;
4
+ kind: z.ZodEnum<["api_key", "jwt", "private_key", "database_url", "env_assignment", "cloud_credential", "home_path"]>;
5
+ preview: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
8
+ field: string;
9
+ preview: string;
10
+ }, {
11
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
12
+ field: string;
13
+ preview: string;
14
+ }>;
15
+ export type RedactionFindingZ = z.infer<typeof RedactionFindingSchema>;
16
+ export declare const SharePreviewRequestSchema: z.ZodObject<{
17
+ project: z.ZodString;
18
+ ide: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ project: string;
21
+ ide?: string | undefined;
22
+ }, {
23
+ project: string;
24
+ ide?: string | undefined;
25
+ }>;
26
+ export type SharePreviewRequest = z.infer<typeof SharePreviewRequestSchema>;
27
+ export declare const SharePreviewResponseSchema: z.ZodObject<{
28
+ capsule: z.ZodObject<{
29
+ capsule_id: z.ZodString;
30
+ project: z.ZodString;
31
+ created_at: z.ZodString;
32
+ source_ide: z.ZodOptional<z.ZodString>;
33
+ schema_version: z.ZodDefault<z.ZodNumber>;
34
+ summary: z.ZodString;
35
+ recent_files: z.ZodArray<z.ZodString, "many">;
36
+ errors: z.ZodArray<z.ZodObject<{
37
+ message: z.ZodString;
38
+ file_path: z.ZodOptional<z.ZodString>;
39
+ line: z.ZodOptional<z.ZodNumber>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ message: string;
42
+ file_path?: string | undefined;
43
+ line?: number | undefined;
44
+ }, {
45
+ message: string;
46
+ file_path?: string | undefined;
47
+ line?: number | undefined;
48
+ }>, "many">;
49
+ failed_commands: z.ZodArray<z.ZodObject<{
50
+ command: z.ZodString;
51
+ exit_code: z.ZodNumber;
52
+ stderr_tail: z.ZodOptional<z.ZodString>;
53
+ cwd: z.ZodOptional<z.ZodString>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ command: string;
56
+ exit_code: number;
57
+ stderr_tail?: string | undefined;
58
+ cwd?: string | undefined;
59
+ }, {
60
+ command: string;
61
+ exit_code: number;
62
+ stderr_tail?: string | undefined;
63
+ cwd?: string | undefined;
64
+ }>, "many">;
65
+ git: z.ZodObject<{
66
+ branch: z.ZodOptional<z.ZodString>;
67
+ last_commit: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ branch?: string | undefined;
70
+ last_commit?: string | undefined;
71
+ }, {
72
+ branch?: string | undefined;
73
+ last_commit?: string | undefined;
74
+ }>;
75
+ manual_notes: z.ZodArray<z.ZodObject<{
76
+ kind: z.ZodEnum<["code_selection", "clipboard", "chat_summary"]>;
77
+ text: z.ZodString;
78
+ file_path: z.ZodOptional<z.ZodString>;
79
+ chat_label: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ kind: "code_selection" | "clipboard" | "chat_summary";
82
+ text: string;
83
+ file_path?: string | undefined;
84
+ chat_label?: string | undefined;
85
+ }, {
86
+ kind: "code_selection" | "clipboard" | "chat_summary";
87
+ text: string;
88
+ file_path?: string | undefined;
89
+ chat_label?: string | undefined;
90
+ }>, "many">;
91
+ }, "strip", z.ZodTypeAny, {
92
+ capsule_id: string;
93
+ project: string;
94
+ created_at: string;
95
+ schema_version: number;
96
+ summary: string;
97
+ recent_files: string[];
98
+ errors: {
99
+ message: string;
100
+ file_path?: string | undefined;
101
+ line?: number | undefined;
102
+ }[];
103
+ failed_commands: {
104
+ command: string;
105
+ exit_code: number;
106
+ stderr_tail?: string | undefined;
107
+ cwd?: string | undefined;
108
+ }[];
109
+ git: {
110
+ branch?: string | undefined;
111
+ last_commit?: string | undefined;
112
+ };
113
+ manual_notes: {
114
+ kind: "code_selection" | "clipboard" | "chat_summary";
115
+ text: string;
116
+ file_path?: string | undefined;
117
+ chat_label?: string | undefined;
118
+ }[];
119
+ source_ide?: string | undefined;
120
+ }, {
121
+ capsule_id: string;
122
+ project: string;
123
+ created_at: string;
124
+ summary: string;
125
+ recent_files: string[];
126
+ errors: {
127
+ message: string;
128
+ file_path?: string | undefined;
129
+ line?: number | undefined;
130
+ }[];
131
+ failed_commands: {
132
+ command: string;
133
+ exit_code: number;
134
+ stderr_tail?: string | undefined;
135
+ cwd?: string | undefined;
136
+ }[];
137
+ git: {
138
+ branch?: string | undefined;
139
+ last_commit?: string | undefined;
140
+ };
141
+ manual_notes: {
142
+ kind: "code_selection" | "clipboard" | "chat_summary";
143
+ text: string;
144
+ file_path?: string | undefined;
145
+ chat_label?: string | undefined;
146
+ }[];
147
+ source_ide?: string | undefined;
148
+ schema_version?: number | undefined;
149
+ }>;
150
+ findings: z.ZodArray<z.ZodObject<{
151
+ field: z.ZodString;
152
+ kind: z.ZodEnum<["api_key", "jwt", "private_key", "database_url", "env_assignment", "cloud_credential", "home_path"]>;
153
+ preview: z.ZodString;
154
+ }, "strip", z.ZodTypeAny, {
155
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
156
+ field: string;
157
+ preview: string;
158
+ }, {
159
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
160
+ field: string;
161
+ preview: string;
162
+ }>, "many">;
163
+ blocked: z.ZodBoolean;
164
+ block_reason: z.ZodOptional<z.ZodString>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ capsule: {
167
+ capsule_id: string;
168
+ project: string;
169
+ created_at: string;
170
+ schema_version: number;
171
+ summary: string;
172
+ recent_files: string[];
173
+ errors: {
174
+ message: string;
175
+ file_path?: string | undefined;
176
+ line?: number | undefined;
177
+ }[];
178
+ failed_commands: {
179
+ command: string;
180
+ exit_code: number;
181
+ stderr_tail?: string | undefined;
182
+ cwd?: string | undefined;
183
+ }[];
184
+ git: {
185
+ branch?: string | undefined;
186
+ last_commit?: string | undefined;
187
+ };
188
+ manual_notes: {
189
+ kind: "code_selection" | "clipboard" | "chat_summary";
190
+ text: string;
191
+ file_path?: string | undefined;
192
+ chat_label?: string | undefined;
193
+ }[];
194
+ source_ide?: string | undefined;
195
+ };
196
+ findings: {
197
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
198
+ field: string;
199
+ preview: string;
200
+ }[];
201
+ blocked: boolean;
202
+ block_reason?: string | undefined;
203
+ }, {
204
+ capsule: {
205
+ capsule_id: string;
206
+ project: string;
207
+ created_at: string;
208
+ summary: string;
209
+ recent_files: string[];
210
+ errors: {
211
+ message: string;
212
+ file_path?: string | undefined;
213
+ line?: number | undefined;
214
+ }[];
215
+ failed_commands: {
216
+ command: string;
217
+ exit_code: number;
218
+ stderr_tail?: string | undefined;
219
+ cwd?: string | undefined;
220
+ }[];
221
+ git: {
222
+ branch?: string | undefined;
223
+ last_commit?: string | undefined;
224
+ };
225
+ manual_notes: {
226
+ kind: "code_selection" | "clipboard" | "chat_summary";
227
+ text: string;
228
+ file_path?: string | undefined;
229
+ chat_label?: string | undefined;
230
+ }[];
231
+ source_ide?: string | undefined;
232
+ schema_version?: number | undefined;
233
+ };
234
+ findings: {
235
+ kind: "api_key" | "jwt" | "private_key" | "database_url" | "env_assignment" | "cloud_credential" | "home_path";
236
+ field: string;
237
+ preview: string;
238
+ }[];
239
+ blocked: boolean;
240
+ block_reason?: string | undefined;
241
+ }>;
242
+ export type SharePreviewResponse = z.infer<typeof SharePreviewResponseSchema>;
243
+ export declare const ShareCreateRequestSchema: z.ZodObject<{
244
+ project_slug: z.ZodString;
245
+ capsule_snapshot: z.ZodObject<{
246
+ capsule_id: z.ZodString;
247
+ project: z.ZodString;
248
+ created_at: z.ZodString;
249
+ source_ide: z.ZodOptional<z.ZodString>;
250
+ schema_version: z.ZodDefault<z.ZodNumber>;
251
+ summary: z.ZodString;
252
+ recent_files: z.ZodArray<z.ZodString, "many">;
253
+ errors: z.ZodArray<z.ZodObject<{
254
+ message: z.ZodString;
255
+ file_path: z.ZodOptional<z.ZodString>;
256
+ line: z.ZodOptional<z.ZodNumber>;
257
+ }, "strip", z.ZodTypeAny, {
258
+ message: string;
259
+ file_path?: string | undefined;
260
+ line?: number | undefined;
261
+ }, {
262
+ message: string;
263
+ file_path?: string | undefined;
264
+ line?: number | undefined;
265
+ }>, "many">;
266
+ failed_commands: z.ZodArray<z.ZodObject<{
267
+ command: z.ZodString;
268
+ exit_code: z.ZodNumber;
269
+ stderr_tail: z.ZodOptional<z.ZodString>;
270
+ cwd: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ command: string;
273
+ exit_code: number;
274
+ stderr_tail?: string | undefined;
275
+ cwd?: string | undefined;
276
+ }, {
277
+ command: string;
278
+ exit_code: number;
279
+ stderr_tail?: string | undefined;
280
+ cwd?: string | undefined;
281
+ }>, "many">;
282
+ git: z.ZodObject<{
283
+ branch: z.ZodOptional<z.ZodString>;
284
+ last_commit: z.ZodOptional<z.ZodString>;
285
+ }, "strip", z.ZodTypeAny, {
286
+ branch?: string | undefined;
287
+ last_commit?: string | undefined;
288
+ }, {
289
+ branch?: string | undefined;
290
+ last_commit?: string | undefined;
291
+ }>;
292
+ manual_notes: z.ZodArray<z.ZodObject<{
293
+ kind: z.ZodEnum<["code_selection", "clipboard", "chat_summary"]>;
294
+ text: z.ZodString;
295
+ file_path: z.ZodOptional<z.ZodString>;
296
+ chat_label: z.ZodOptional<z.ZodString>;
297
+ }, "strip", z.ZodTypeAny, {
298
+ kind: "code_selection" | "clipboard" | "chat_summary";
299
+ text: string;
300
+ file_path?: string | undefined;
301
+ chat_label?: string | undefined;
302
+ }, {
303
+ kind: "code_selection" | "clipboard" | "chat_summary";
304
+ text: string;
305
+ file_path?: string | undefined;
306
+ chat_label?: string | undefined;
307
+ }>, "many">;
308
+ }, "strip", z.ZodTypeAny, {
309
+ capsule_id: string;
310
+ project: string;
311
+ created_at: string;
312
+ schema_version: number;
313
+ summary: string;
314
+ recent_files: string[];
315
+ errors: {
316
+ message: string;
317
+ file_path?: string | undefined;
318
+ line?: number | undefined;
319
+ }[];
320
+ failed_commands: {
321
+ command: string;
322
+ exit_code: number;
323
+ stderr_tail?: string | undefined;
324
+ cwd?: string | undefined;
325
+ }[];
326
+ git: {
327
+ branch?: string | undefined;
328
+ last_commit?: string | undefined;
329
+ };
330
+ manual_notes: {
331
+ kind: "code_selection" | "clipboard" | "chat_summary";
332
+ text: string;
333
+ file_path?: string | undefined;
334
+ chat_label?: string | undefined;
335
+ }[];
336
+ source_ide?: string | undefined;
337
+ }, {
338
+ capsule_id: string;
339
+ project: string;
340
+ created_at: string;
341
+ summary: string;
342
+ recent_files: string[];
343
+ errors: {
344
+ message: string;
345
+ file_path?: string | undefined;
346
+ line?: number | undefined;
347
+ }[];
348
+ failed_commands: {
349
+ command: string;
350
+ exit_code: number;
351
+ stderr_tail?: string | undefined;
352
+ cwd?: string | undefined;
353
+ }[];
354
+ git: {
355
+ branch?: string | undefined;
356
+ last_commit?: string | undefined;
357
+ };
358
+ manual_notes: {
359
+ kind: "code_selection" | "clipboard" | "chat_summary";
360
+ text: string;
361
+ file_path?: string | undefined;
362
+ chat_label?: string | undefined;
363
+ }[];
364
+ source_ide?: string | undefined;
365
+ schema_version?: number | undefined;
366
+ }>;
367
+ source_ide: z.ZodOptional<z.ZodString>;
368
+ expires_in_days: z.ZodDefault<z.ZodNumber>;
369
+ redaction_summary: z.ZodOptional<z.ZodObject<{
370
+ finding_count: z.ZodNumber;
371
+ kinds: z.ZodArray<z.ZodString, "many">;
372
+ }, "strip", z.ZodTypeAny, {
373
+ finding_count: number;
374
+ kinds: string[];
375
+ }, {
376
+ finding_count: number;
377
+ kinds: string[];
378
+ }>>;
379
+ }, "strip", z.ZodTypeAny, {
380
+ project_slug: string;
381
+ capsule_snapshot: {
382
+ capsule_id: string;
383
+ project: string;
384
+ created_at: string;
385
+ schema_version: number;
386
+ summary: string;
387
+ recent_files: string[];
388
+ errors: {
389
+ message: string;
390
+ file_path?: string | undefined;
391
+ line?: number | undefined;
392
+ }[];
393
+ failed_commands: {
394
+ command: string;
395
+ exit_code: number;
396
+ stderr_tail?: string | undefined;
397
+ cwd?: string | undefined;
398
+ }[];
399
+ git: {
400
+ branch?: string | undefined;
401
+ last_commit?: string | undefined;
402
+ };
403
+ manual_notes: {
404
+ kind: "code_selection" | "clipboard" | "chat_summary";
405
+ text: string;
406
+ file_path?: string | undefined;
407
+ chat_label?: string | undefined;
408
+ }[];
409
+ source_ide?: string | undefined;
410
+ };
411
+ expires_in_days: number;
412
+ source_ide?: string | undefined;
413
+ redaction_summary?: {
414
+ finding_count: number;
415
+ kinds: string[];
416
+ } | undefined;
417
+ }, {
418
+ project_slug: string;
419
+ capsule_snapshot: {
420
+ capsule_id: string;
421
+ project: string;
422
+ created_at: string;
423
+ summary: string;
424
+ recent_files: string[];
425
+ errors: {
426
+ message: string;
427
+ file_path?: string | undefined;
428
+ line?: number | undefined;
429
+ }[];
430
+ failed_commands: {
431
+ command: string;
432
+ exit_code: number;
433
+ stderr_tail?: string | undefined;
434
+ cwd?: string | undefined;
435
+ }[];
436
+ git: {
437
+ branch?: string | undefined;
438
+ last_commit?: string | undefined;
439
+ };
440
+ manual_notes: {
441
+ kind: "code_selection" | "clipboard" | "chat_summary";
442
+ text: string;
443
+ file_path?: string | undefined;
444
+ chat_label?: string | undefined;
445
+ }[];
446
+ source_ide?: string | undefined;
447
+ schema_version?: number | undefined;
448
+ };
449
+ source_ide?: string | undefined;
450
+ expires_in_days?: number | undefined;
451
+ redaction_summary?: {
452
+ finding_count: number;
453
+ kinds: string[];
454
+ } | undefined;
455
+ }>;
456
+ export type ShareCreateRequest = z.infer<typeof ShareCreateRequestSchema>;
457
+ export declare const ShareRecordSchema: z.ZodObject<{
458
+ id: z.ZodString;
459
+ project_slug: z.ZodString;
460
+ source_ide: z.ZodOptional<z.ZodNullable<z.ZodString>>;
461
+ expires_at: z.ZodString;
462
+ revoked_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
463
+ created_at: z.ZodString;
464
+ share_url: z.ZodString;
465
+ }, "strip", z.ZodTypeAny, {
466
+ created_at: string;
467
+ project_slug: string;
468
+ id: string;
469
+ expires_at: string;
470
+ share_url: string;
471
+ source_ide?: string | null | undefined;
472
+ revoked_at?: string | null | undefined;
473
+ }, {
474
+ created_at: string;
475
+ project_slug: string;
476
+ id: string;
477
+ expires_at: string;
478
+ share_url: string;
479
+ source_ide?: string | null | undefined;
480
+ revoked_at?: string | null | undefined;
481
+ }>;
482
+ export type ShareRecord = z.infer<typeof ShareRecordSchema>;
483
+ export declare const PublicShareSchema: z.ZodObject<{
484
+ project_slug: z.ZodString;
485
+ source_ide: z.ZodOptional<z.ZodNullable<z.ZodString>>;
486
+ expires_at: z.ZodString;
487
+ created_at: z.ZodString;
488
+ capsule_snapshot: z.ZodObject<{
489
+ capsule_id: z.ZodString;
490
+ project: z.ZodString;
491
+ created_at: z.ZodString;
492
+ source_ide: z.ZodOptional<z.ZodString>;
493
+ schema_version: z.ZodDefault<z.ZodNumber>;
494
+ summary: z.ZodString;
495
+ recent_files: z.ZodArray<z.ZodString, "many">;
496
+ errors: z.ZodArray<z.ZodObject<{
497
+ message: z.ZodString;
498
+ file_path: z.ZodOptional<z.ZodString>;
499
+ line: z.ZodOptional<z.ZodNumber>;
500
+ }, "strip", z.ZodTypeAny, {
501
+ message: string;
502
+ file_path?: string | undefined;
503
+ line?: number | undefined;
504
+ }, {
505
+ message: string;
506
+ file_path?: string | undefined;
507
+ line?: number | undefined;
508
+ }>, "many">;
509
+ failed_commands: z.ZodArray<z.ZodObject<{
510
+ command: z.ZodString;
511
+ exit_code: z.ZodNumber;
512
+ stderr_tail: z.ZodOptional<z.ZodString>;
513
+ cwd: z.ZodOptional<z.ZodString>;
514
+ }, "strip", z.ZodTypeAny, {
515
+ command: string;
516
+ exit_code: number;
517
+ stderr_tail?: string | undefined;
518
+ cwd?: string | undefined;
519
+ }, {
520
+ command: string;
521
+ exit_code: number;
522
+ stderr_tail?: string | undefined;
523
+ cwd?: string | undefined;
524
+ }>, "many">;
525
+ git: z.ZodObject<{
526
+ branch: z.ZodOptional<z.ZodString>;
527
+ last_commit: z.ZodOptional<z.ZodString>;
528
+ }, "strip", z.ZodTypeAny, {
529
+ branch?: string | undefined;
530
+ last_commit?: string | undefined;
531
+ }, {
532
+ branch?: string | undefined;
533
+ last_commit?: string | undefined;
534
+ }>;
535
+ manual_notes: z.ZodArray<z.ZodObject<{
536
+ kind: z.ZodEnum<["code_selection", "clipboard", "chat_summary"]>;
537
+ text: z.ZodString;
538
+ file_path: z.ZodOptional<z.ZodString>;
539
+ chat_label: z.ZodOptional<z.ZodString>;
540
+ }, "strip", z.ZodTypeAny, {
541
+ kind: "code_selection" | "clipboard" | "chat_summary";
542
+ text: string;
543
+ file_path?: string | undefined;
544
+ chat_label?: string | undefined;
545
+ }, {
546
+ kind: "code_selection" | "clipboard" | "chat_summary";
547
+ text: string;
548
+ file_path?: string | undefined;
549
+ chat_label?: string | undefined;
550
+ }>, "many">;
551
+ }, "strip", z.ZodTypeAny, {
552
+ capsule_id: string;
553
+ project: string;
554
+ created_at: string;
555
+ schema_version: number;
556
+ summary: string;
557
+ recent_files: string[];
558
+ errors: {
559
+ message: string;
560
+ file_path?: string | undefined;
561
+ line?: number | undefined;
562
+ }[];
563
+ failed_commands: {
564
+ command: string;
565
+ exit_code: number;
566
+ stderr_tail?: string | undefined;
567
+ cwd?: string | undefined;
568
+ }[];
569
+ git: {
570
+ branch?: string | undefined;
571
+ last_commit?: string | undefined;
572
+ };
573
+ manual_notes: {
574
+ kind: "code_selection" | "clipboard" | "chat_summary";
575
+ text: string;
576
+ file_path?: string | undefined;
577
+ chat_label?: string | undefined;
578
+ }[];
579
+ source_ide?: string | undefined;
580
+ }, {
581
+ capsule_id: string;
582
+ project: string;
583
+ created_at: string;
584
+ summary: string;
585
+ recent_files: string[];
586
+ errors: {
587
+ message: string;
588
+ file_path?: string | undefined;
589
+ line?: number | undefined;
590
+ }[];
591
+ failed_commands: {
592
+ command: string;
593
+ exit_code: number;
594
+ stderr_tail?: string | undefined;
595
+ cwd?: string | undefined;
596
+ }[];
597
+ git: {
598
+ branch?: string | undefined;
599
+ last_commit?: string | undefined;
600
+ };
601
+ manual_notes: {
602
+ kind: "code_selection" | "clipboard" | "chat_summary";
603
+ text: string;
604
+ file_path?: string | undefined;
605
+ chat_label?: string | undefined;
606
+ }[];
607
+ source_ide?: string | undefined;
608
+ schema_version?: number | undefined;
609
+ }>;
610
+ status: z.ZodEnum<["active", "expired", "revoked"]>;
611
+ }, "strip", z.ZodTypeAny, {
612
+ status: "active" | "expired" | "revoked";
613
+ created_at: string;
614
+ project_slug: string;
615
+ capsule_snapshot: {
616
+ capsule_id: string;
617
+ project: string;
618
+ created_at: string;
619
+ schema_version: number;
620
+ summary: string;
621
+ recent_files: string[];
622
+ errors: {
623
+ message: string;
624
+ file_path?: string | undefined;
625
+ line?: number | undefined;
626
+ }[];
627
+ failed_commands: {
628
+ command: string;
629
+ exit_code: number;
630
+ stderr_tail?: string | undefined;
631
+ cwd?: string | undefined;
632
+ }[];
633
+ git: {
634
+ branch?: string | undefined;
635
+ last_commit?: string | undefined;
636
+ };
637
+ manual_notes: {
638
+ kind: "code_selection" | "clipboard" | "chat_summary";
639
+ text: string;
640
+ file_path?: string | undefined;
641
+ chat_label?: string | undefined;
642
+ }[];
643
+ source_ide?: string | undefined;
644
+ };
645
+ expires_at: string;
646
+ source_ide?: string | null | undefined;
647
+ }, {
648
+ status: "active" | "expired" | "revoked";
649
+ created_at: string;
650
+ project_slug: string;
651
+ capsule_snapshot: {
652
+ capsule_id: string;
653
+ project: string;
654
+ created_at: string;
655
+ summary: string;
656
+ recent_files: string[];
657
+ errors: {
658
+ message: string;
659
+ file_path?: string | undefined;
660
+ line?: number | undefined;
661
+ }[];
662
+ failed_commands: {
663
+ command: string;
664
+ exit_code: number;
665
+ stderr_tail?: string | undefined;
666
+ cwd?: string | undefined;
667
+ }[];
668
+ git: {
669
+ branch?: string | undefined;
670
+ last_commit?: string | undefined;
671
+ };
672
+ manual_notes: {
673
+ kind: "code_selection" | "clipboard" | "chat_summary";
674
+ text: string;
675
+ file_path?: string | undefined;
676
+ chat_label?: string | undefined;
677
+ }[];
678
+ source_ide?: string | undefined;
679
+ schema_version?: number | undefined;
680
+ };
681
+ expires_at: string;
682
+ source_ide?: string | null | undefined;
683
+ }>;
684
+ export type PublicShare = z.infer<typeof PublicShareSchema>;
685
+ export declare const ShareImportRequestSchema: z.ZodObject<{
686
+ project: z.ZodString;
687
+ capsule: z.ZodObject<{
688
+ capsule_id: z.ZodString;
689
+ project: z.ZodString;
690
+ created_at: z.ZodString;
691
+ source_ide: z.ZodOptional<z.ZodString>;
692
+ schema_version: z.ZodDefault<z.ZodNumber>;
693
+ summary: z.ZodString;
694
+ recent_files: z.ZodArray<z.ZodString, "many">;
695
+ errors: z.ZodArray<z.ZodObject<{
696
+ message: z.ZodString;
697
+ file_path: z.ZodOptional<z.ZodString>;
698
+ line: z.ZodOptional<z.ZodNumber>;
699
+ }, "strip", z.ZodTypeAny, {
700
+ message: string;
701
+ file_path?: string | undefined;
702
+ line?: number | undefined;
703
+ }, {
704
+ message: string;
705
+ file_path?: string | undefined;
706
+ line?: number | undefined;
707
+ }>, "many">;
708
+ failed_commands: z.ZodArray<z.ZodObject<{
709
+ command: z.ZodString;
710
+ exit_code: z.ZodNumber;
711
+ stderr_tail: z.ZodOptional<z.ZodString>;
712
+ cwd: z.ZodOptional<z.ZodString>;
713
+ }, "strip", z.ZodTypeAny, {
714
+ command: string;
715
+ exit_code: number;
716
+ stderr_tail?: string | undefined;
717
+ cwd?: string | undefined;
718
+ }, {
719
+ command: string;
720
+ exit_code: number;
721
+ stderr_tail?: string | undefined;
722
+ cwd?: string | undefined;
723
+ }>, "many">;
724
+ git: z.ZodObject<{
725
+ branch: z.ZodOptional<z.ZodString>;
726
+ last_commit: z.ZodOptional<z.ZodString>;
727
+ }, "strip", z.ZodTypeAny, {
728
+ branch?: string | undefined;
729
+ last_commit?: string | undefined;
730
+ }, {
731
+ branch?: string | undefined;
732
+ last_commit?: string | undefined;
733
+ }>;
734
+ manual_notes: z.ZodArray<z.ZodObject<{
735
+ kind: z.ZodEnum<["code_selection", "clipboard", "chat_summary"]>;
736
+ text: z.ZodString;
737
+ file_path: z.ZodOptional<z.ZodString>;
738
+ chat_label: z.ZodOptional<z.ZodString>;
739
+ }, "strip", z.ZodTypeAny, {
740
+ kind: "code_selection" | "clipboard" | "chat_summary";
741
+ text: string;
742
+ file_path?: string | undefined;
743
+ chat_label?: string | undefined;
744
+ }, {
745
+ kind: "code_selection" | "clipboard" | "chat_summary";
746
+ text: string;
747
+ file_path?: string | undefined;
748
+ chat_label?: string | undefined;
749
+ }>, "many">;
750
+ }, "strip", z.ZodTypeAny, {
751
+ capsule_id: string;
752
+ project: string;
753
+ created_at: string;
754
+ schema_version: number;
755
+ summary: string;
756
+ recent_files: string[];
757
+ errors: {
758
+ message: string;
759
+ file_path?: string | undefined;
760
+ line?: number | undefined;
761
+ }[];
762
+ failed_commands: {
763
+ command: string;
764
+ exit_code: number;
765
+ stderr_tail?: string | undefined;
766
+ cwd?: string | undefined;
767
+ }[];
768
+ git: {
769
+ branch?: string | undefined;
770
+ last_commit?: string | undefined;
771
+ };
772
+ manual_notes: {
773
+ kind: "code_selection" | "clipboard" | "chat_summary";
774
+ text: string;
775
+ file_path?: string | undefined;
776
+ chat_label?: string | undefined;
777
+ }[];
778
+ source_ide?: string | undefined;
779
+ }, {
780
+ capsule_id: string;
781
+ project: string;
782
+ created_at: string;
783
+ summary: string;
784
+ recent_files: string[];
785
+ errors: {
786
+ message: string;
787
+ file_path?: string | undefined;
788
+ line?: number | undefined;
789
+ }[];
790
+ failed_commands: {
791
+ command: string;
792
+ exit_code: number;
793
+ stderr_tail?: string | undefined;
794
+ cwd?: string | undefined;
795
+ }[];
796
+ git: {
797
+ branch?: string | undefined;
798
+ last_commit?: string | undefined;
799
+ };
800
+ manual_notes: {
801
+ kind: "code_selection" | "clipboard" | "chat_summary";
802
+ text: string;
803
+ file_path?: string | undefined;
804
+ chat_label?: string | undefined;
805
+ }[];
806
+ source_ide?: string | undefined;
807
+ schema_version?: number | undefined;
808
+ }>;
809
+ overwrite: z.ZodDefault<z.ZodBoolean>;
810
+ project_root: z.ZodOptional<z.ZodString>;
811
+ }, "strip", z.ZodTypeAny, {
812
+ project: string;
813
+ capsule: {
814
+ capsule_id: string;
815
+ project: string;
816
+ created_at: string;
817
+ schema_version: number;
818
+ summary: string;
819
+ recent_files: string[];
820
+ errors: {
821
+ message: string;
822
+ file_path?: string | undefined;
823
+ line?: number | undefined;
824
+ }[];
825
+ failed_commands: {
826
+ command: string;
827
+ exit_code: number;
828
+ stderr_tail?: string | undefined;
829
+ cwd?: string | undefined;
830
+ }[];
831
+ git: {
832
+ branch?: string | undefined;
833
+ last_commit?: string | undefined;
834
+ };
835
+ manual_notes: {
836
+ kind: "code_selection" | "clipboard" | "chat_summary";
837
+ text: string;
838
+ file_path?: string | undefined;
839
+ chat_label?: string | undefined;
840
+ }[];
841
+ source_ide?: string | undefined;
842
+ };
843
+ overwrite: boolean;
844
+ project_root?: string | undefined;
845
+ }, {
846
+ project: string;
847
+ capsule: {
848
+ capsule_id: string;
849
+ project: string;
850
+ created_at: string;
851
+ summary: string;
852
+ recent_files: string[];
853
+ errors: {
854
+ message: string;
855
+ file_path?: string | undefined;
856
+ line?: number | undefined;
857
+ }[];
858
+ failed_commands: {
859
+ command: string;
860
+ exit_code: number;
861
+ stderr_tail?: string | undefined;
862
+ cwd?: string | undefined;
863
+ }[];
864
+ git: {
865
+ branch?: string | undefined;
866
+ last_commit?: string | undefined;
867
+ };
868
+ manual_notes: {
869
+ kind: "code_selection" | "clipboard" | "chat_summary";
870
+ text: string;
871
+ file_path?: string | undefined;
872
+ chat_label?: string | undefined;
873
+ }[];
874
+ source_ide?: string | undefined;
875
+ schema_version?: number | undefined;
876
+ };
877
+ overwrite?: boolean | undefined;
878
+ project_root?: string | undefined;
879
+ }>;
880
+ export type ShareImportRequest = z.infer<typeof ShareImportRequestSchema>;
881
+ export declare const ShareRevokeRequestSchema: z.ZodObject<{
882
+ id: z.ZodString;
883
+ }, "strip", z.ZodTypeAny, {
884
+ id: string;
885
+ }, {
886
+ id: string;
887
+ }>;
888
+ export type ShareRevokeRequest = z.infer<typeof ShareRevokeRequestSchema>;
889
+ //# sourceMappingURL=share.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAYjC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;EAGpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/share.js ADDED
@@ -0,0 +1,63 @@
1
+ import { z } from "zod";
2
+ import { CapsuleSchema } from "./capsule.js";
3
+ export const RedactionFindingSchema = z.object({
4
+ field: z.string(),
5
+ kind: z.enum([
6
+ "api_key",
7
+ "jwt",
8
+ "private_key",
9
+ "database_url",
10
+ "env_assignment",
11
+ "cloud_credential",
12
+ "home_path",
13
+ ]),
14
+ preview: z.string(),
15
+ });
16
+ export const SharePreviewRequestSchema = z.object({
17
+ project: z.string().min(1),
18
+ ide: z.string().optional(),
19
+ });
20
+ export const SharePreviewResponseSchema = z.object({
21
+ capsule: CapsuleSchema,
22
+ findings: z.array(RedactionFindingSchema),
23
+ blocked: z.boolean(),
24
+ block_reason: z.string().optional(),
25
+ });
26
+ export const ShareCreateRequestSchema = z.object({
27
+ project_slug: z.string().min(1),
28
+ capsule_snapshot: CapsuleSchema,
29
+ source_ide: z.string().optional(),
30
+ expires_in_days: z.number().int().min(1).max(30).default(7),
31
+ redaction_summary: z
32
+ .object({
33
+ finding_count: z.number().int().nonnegative(),
34
+ kinds: z.array(z.string()),
35
+ })
36
+ .optional(),
37
+ });
38
+ export const ShareRecordSchema = z.object({
39
+ id: z.string().uuid(),
40
+ project_slug: z.string(),
41
+ source_ide: z.string().nullable().optional(),
42
+ expires_at: z.string(),
43
+ revoked_at: z.string().nullable().optional(),
44
+ created_at: z.string(),
45
+ share_url: z.string().url(),
46
+ });
47
+ export const PublicShareSchema = z.object({
48
+ project_slug: z.string(),
49
+ source_ide: z.string().nullable().optional(),
50
+ expires_at: z.string(),
51
+ created_at: z.string(),
52
+ capsule_snapshot: CapsuleSchema,
53
+ status: z.enum(["active", "expired", "revoked"]),
54
+ });
55
+ export const ShareImportRequestSchema = z.object({
56
+ project: z.string().min(1),
57
+ capsule: CapsuleSchema,
58
+ overwrite: z.boolean().default(false),
59
+ project_root: z.string().optional(),
60
+ });
61
+ export const ShareRevokeRequestSchema = z.object({
62
+ id: z.string().uuid(),
63
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engram-cli/contracts",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared schemas and helpers for Engram",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,6 +14,7 @@
14
14
  "scripts": {
15
15
  "build": "tsc -p tsconfig.json",
16
16
  "dev": "tsc -p tsconfig.json --watch",
17
+ "test": "npm run build && node scripts/smoke-redaction.mjs",
17
18
  "prepublishOnly": "npm run build"
18
19
  },
19
20
  "dependencies": {