@promptframe/cli 0.1.60 → 0.1.63

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 (40) hide show
  1. package/README.md +19 -1
  2. package/dist/development-build-worker.d.ts +2 -0
  3. package/dist/development-build-worker.d.ts.map +1 -0
  4. package/dist/development-build-worker.js +184 -0
  5. package/dist/development-build-worker.js.map +1 -0
  6. package/dist/development-build.d.ts +22 -0
  7. package/dist/development-build.d.ts.map +1 -0
  8. package/dist/development-build.js +66 -0
  9. package/dist/development-build.js.map +1 -0
  10. package/dist/development-coordinator.d.ts +26 -0
  11. package/dist/development-coordinator.d.ts.map +1 -0
  12. package/dist/development-coordinator.js +114 -0
  13. package/dist/development-coordinator.js.map +1 -0
  14. package/dist/development-css.d.ts +10 -0
  15. package/dist/development-css.d.ts.map +1 -0
  16. package/dist/development-css.js +65 -0
  17. package/dist/development-css.js.map +1 -0
  18. package/dist/development-files.d.ts +6 -0
  19. package/dist/development-files.d.ts.map +1 -0
  20. package/dist/development-files.js +70 -0
  21. package/dist/development-files.js.map +1 -0
  22. package/dist/development-process.d.ts +15 -0
  23. package/dist/development-process.d.ts.map +1 -0
  24. package/dist/development-process.js +65 -0
  25. package/dist/development-process.js.map +1 -0
  26. package/dist/development-revisions.d.ts +58 -0
  27. package/dist/development-revisions.d.ts.map +1 -0
  28. package/dist/development-revisions.js +130 -0
  29. package/dist/development-revisions.js.map +1 -0
  30. package/dist/development-validation.d.ts +22 -0
  31. package/dist/development-validation.d.ts.map +1 -0
  32. package/dist/development-validation.js +122 -0
  33. package/dist/development-validation.js.map +1 -0
  34. package/dist/development-workspace.d.ts +25 -0
  35. package/dist/development-workspace.d.ts.map +1 -0
  36. package/dist/development-workspace.js +352 -0
  37. package/dist/development-workspace.js.map +1 -0
  38. package/dist/index.js +49 -0
  39. package/dist/index.js.map +1 -1
  40. package/package.json +10 -4
@@ -0,0 +1,70 @@
1
+ import { constants, closeSync, fstatSync, lstatSync, openSync, readSync, realpathSync } from 'node:fs';
2
+ import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
3
+ import { DevelopmentContents } from './development-revisions.js';
4
+ /** Capture declared workspace inputs, never a live path for a compiler to reopen.
5
+ * Generated output and node_modules are not discovered by this reader. The
6
+ * workspace consumer supplies the complete, bounded source/dependency list. */
7
+ export function captureDevelopmentFiles(root, paths, limits) {
8
+ // Reuse the content contract before performing any file I/O. These empty
9
+ // bytes only validate names/count/options; they are never published.
10
+ const names = new DevelopmentContents(paths.map(path => ({ path, bytes: new Uint8Array() })), limits)
11
+ .readFiles().map(file => file.path);
12
+ const base = realpathSync(root);
13
+ const files = [];
14
+ let total = 0;
15
+ for (const name of names) {
16
+ const file = resolve(base, ...name.split('/'));
17
+ const withinRoot = () => {
18
+ const local = relative(base, realpathSync(file));
19
+ if (!local || local === '..' || local.startsWith(`..${sep}`) || isAbsolute(local)) {
20
+ throw new Error('development.capture.outside_root');
21
+ }
22
+ // Source links, including directory links, are explicit errors. A
23
+ // workspace alias resolves to declared real source paths before capture.
24
+ for (let part = file; part !== base; part = dirname(part)) {
25
+ const entry = lstatSync(part);
26
+ if (entry.isSymbolicLink())
27
+ throw new Error('development.capture.symlink');
28
+ if (part === file && !entry.isFile())
29
+ throw new Error('development.capture.not_file');
30
+ }
31
+ };
32
+ withinRoot();
33
+ // NONBLOCK also bounds a replacement by a FIFO between lstat and open.
34
+ // fstat below still requires a regular file before any bytes are read.
35
+ const descriptor = openSync(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
36
+ try {
37
+ const before = fstatSync(descriptor, { bigint: true });
38
+ if (!before.isFile())
39
+ throw new Error('development.capture.not_file');
40
+ const remaining = limits.maximumBytes - total;
41
+ if (before.size > BigInt(remaining))
42
+ throw new Error('development.contents.byte_limit');
43
+ // Read at most the observed size plus one probe byte. A concurrently
44
+ // growing file cannot cause an unbounded readFile allocation.
45
+ const bytes = Buffer.alloc(Number(before.size) + 1);
46
+ let used = 0;
47
+ while (used < bytes.length) {
48
+ const count = readSync(descriptor, bytes, used, bytes.length - used, null);
49
+ if (!count)
50
+ break;
51
+ used += count;
52
+ }
53
+ const after = fstatSync(descriptor, { bigint: true });
54
+ withinRoot();
55
+ const current = lstatSync(file, { bigint: true });
56
+ if (used !== Number(before.size) || ['dev', 'ino', 'size', 'mtimeNs', 'ctimeNs'].some(key => {
57
+ const field = key;
58
+ return before[field] !== after[field] || after[field] !== current[field];
59
+ }))
60
+ throw new Error('development.capture.changed_during_read');
61
+ total += used;
62
+ files.push({ path: name, bytes: bytes.subarray(0, used) });
63
+ }
64
+ finally {
65
+ closeSync(descriptor);
66
+ }
67
+ }
68
+ return new DevelopmentContents(files, limits);
69
+ }
70
+ //# sourceMappingURL=development-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-files.js","sourceRoot":"","sources":["../src/development-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,4BAA4B,CAAC;AAEzF;;+EAE+E;AAC/E,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,KAAwB,EACxB,MAAyB;IAEzB,yEAAyE;IACzE,qEAAqE;IACrE,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;SAClG,SAAS,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CA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AAE;gBAC1F,MAAM,KAAK,GAAG,GAAqD,CAAC;gBACpE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3E,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC/D,KAAK,IAAI,IAAI,CAAC;YACd,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;gBAAS,CAAC;YAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare class DevelopmentProcessError extends Error {
2
+ readonly code: string;
3
+ readonly diagnosticCode?: string | undefined;
4
+ constructor(code: string, diagnosticCode?: string | undefined);
5
+ }
6
+ /** A bounded compiler/checker process, never a component execution sandbox. */
7
+ export declare function runDevelopmentProcess(options: {
8
+ worker: string;
9
+ cwd: string;
10
+ input: string;
11
+ timeoutMs: number;
12
+ maximumOutputBytes: number;
13
+ signal?: AbortSignal;
14
+ }): Promise<string>;
15
+ //# sourceMappingURL=development-process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-process.d.ts","sourceRoot":"","sources":["../src/development-process.ts"],"names":[],"mappings":"AAEA,qBAAa,uBAAwB,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM;gBAA9C,IAAI,EAAE,MAAM,EAAW,cAAc,CAAC,EAAE,MAAM,YAAA;CAGpE;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAC9D,kBAAkB,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
@@ -0,0 +1,65 @@
1
+ import { spawn } from 'node:child_process';
2
+ export class DevelopmentProcessError extends Error {
3
+ code;
4
+ diagnosticCode;
5
+ constructor(code, diagnosticCode) {
6
+ super(code);
7
+ this.code = code;
8
+ this.diagnosticCode = diagnosticCode;
9
+ this.name = 'DevelopmentProcessError';
10
+ }
11
+ }
12
+ /** A bounded compiler/checker process, never a component execution sandbox. */
13
+ export function runDevelopmentProcess(options) {
14
+ options.signal?.throwIfAborted();
15
+ return new Promise((resolve, reject) => {
16
+ const child = spawn(process.execPath, [options.worker], {
17
+ cwd: options.cwd, stdio: ['pipe', 'pipe', 'pipe'],
18
+ env: { NO_COLOR: '1', NODE_ENV: 'development',
19
+ ...(process.platform === 'win32' && process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}) },
20
+ });
21
+ let failed = false, firstError, total = 0;
22
+ const stdout = [], stderr = [];
23
+ const fail = (error) => {
24
+ if (!failed) {
25
+ failed = true;
26
+ firstError = error;
27
+ }
28
+ child.kill('SIGKILL');
29
+ };
30
+ const receive = (target, chunk) => {
31
+ total += chunk.length;
32
+ if (total > options.maximumOutputBytes)
33
+ return fail(new DevelopmentProcessError('development.build.output_limit'));
34
+ target.push(chunk);
35
+ };
36
+ child.stdout.on('data', chunk => receive(stdout, chunk));
37
+ child.stderr.on('data', chunk => receive(stderr, chunk));
38
+ child.stdin.on('error', error => { if (!failed)
39
+ fail(error); });
40
+ child.once('error', fail);
41
+ const abort = () => fail(options.signal.reason);
42
+ options.signal?.addEventListener('abort', abort, { once: true });
43
+ const timeout = setTimeout(() => fail(new DevelopmentProcessError('development.build.timeout')), options.timeoutMs);
44
+ child.once('close', code => {
45
+ clearTimeout(timeout);
46
+ options.signal?.removeEventListener('abort', abort);
47
+ if (failed)
48
+ return reject(firstError);
49
+ if (code === 0)
50
+ return resolve(Buffer.concat(stdout).toString('utf8'));
51
+ let diagnosticCode;
52
+ try {
53
+ const parsed = JSON.parse(Buffer.concat(stderr).toString('utf8'));
54
+ if (typeof parsed.code === 'string' && /^development\.[a-z0-9_.]{1,180}$/u.test(parsed.code))
55
+ diagnosticCode = parsed.code;
56
+ }
57
+ catch { /* Raw compiler paths/output are not public diagnostics. */ }
58
+ reject(new DevelopmentProcessError('development.build.rejected', diagnosticCode));
59
+ });
60
+ child.stdin.end(options.input);
61
+ if (options.signal?.aborted)
62
+ abort();
63
+ });
64
+ }
65
+ //# sourceMappingURL=development-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-process.js","sourceRoot":"","sources":["../src/development-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC3B;IAAuB;IAA5C,YAAqB,IAAY,EAAW,cAAuB;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC;QADO,SAAI,GAAJ,IAAI,CAAQ;QAAW,mBAAc,GAAd,cAAc,CAAS;QACpD,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACrD,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,qBAAqB,CAAC,OAGrC;IACC,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACtD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,M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I,CAAC;YAC7H,CAAC;YAAC,MAAM,CAAC,CAAC,2DAA2D,CAAC,CAAC;YACvE,MAAM,CAAC,IAAI,uBAAuB,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;YAAE,KAAK,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,58 @@
1
+ export interface DevelopmentFile {
2
+ path: string;
3
+ bytes: Uint8Array;
4
+ }
5
+ export interface DevelopmentLimits {
6
+ maximumFiles: number;
7
+ maximumBytes: number;
8
+ }
9
+ /** A private copy of one complete input set, including declared dependencies. */
10
+ export declare class DevelopmentContents {
11
+ #private;
12
+ readonly revision: string;
13
+ readonly byteLength: number;
14
+ constructor(files: readonly DevelopmentFile[], limits: DevelopmentLimits);
15
+ /** Consumers receive independent bytes; the checked capture remains immutable. */
16
+ readFiles(): DevelopmentFile[];
17
+ }
18
+ export interface DevelopmentCheck {
19
+ readonly moduleId: string;
20
+ readonly sourceRevision: string;
21
+ readonly sequence: number;
22
+ }
23
+ export interface CheckedDevelopmentModule {
24
+ readonly moduleId: string;
25
+ readonly sourceRevision: string;
26
+ readonly checkerKey: string;
27
+ readonly artifacts: DevelopmentContents;
28
+ }
29
+ export interface DevelopmentModuleState {
30
+ readonly moduleId: string;
31
+ /** Absent if current inputs cannot be captured; lastChecked stays explicit. */
32
+ readonly sourceRevision?: string;
33
+ readonly status: 'checking' | 'checked' | 'failed';
34
+ readonly diagnostic?: string;
35
+ /** Passed checks, not an assertion that a Player has loaded this revision. */
36
+ readonly lastChecked?: CheckedDevelopmentModule;
37
+ }
38
+ /**
39
+ * Adoption only. The caller captures dependencies, runs the common checks/build,
40
+ * and recaptures current inputs before publish/reject. Watcher events alone do
41
+ * not authorize a revision. This helper never executes component code.
42
+ */
43
+ export declare class DevelopmentRevisionGate {
44
+ #private;
45
+ constructor(options: {
46
+ checkerKey: string;
47
+ maximumModules: number;
48
+ });
49
+ begin(moduleId: string, source: DevelopmentContents): DevelopmentCheck;
50
+ invalidate(moduleId: string, diagnostic: string): void;
51
+ private assertIdentity;
52
+ publish(check: DevelopmentCheck, current: DevelopmentContents, artifacts: DevelopmentContents): boolean;
53
+ reject(check: DevelopmentCheck, current: DevelopmentContents, diagnostic: string): boolean;
54
+ state(moduleId: string): DevelopmentModuleState | undefined;
55
+ remove(moduleId: string): void;
56
+ private currentCheck;
57
+ }
58
+ //# sourceMappingURL=development-revisions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-revisions.d.ts","sourceRoot":"","sources":["../src/development-revisions.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,iFAAiF;AACjF,qBAAa,mBAAmB;;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAGhB,KAAK,EAAE,SAAS,eAAe,EAAE,EAAE,MAAM,EAAE,iBAAiB;IAqCxE,kFAAkF;IAClF,SAAS,IAAI,eAAe,EAAE;CAG/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;CACzC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACjD;AAED;;;;GAIG;AACH,qBAAa,uBAAuB;;gBAMtB,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE;IASnE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,gBAAgB;IAWtE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAStD,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO;IAUvG,MAAM,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAQ1F,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAI3D,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK9B,OAAO,CAAC,YAAY;CAUrB"}
@@ -0,0 +1,130 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { posix } from 'node:path';
3
+ /** A private copy of one complete input set, including declared dependencies. */
4
+ export class DevelopmentContents {
5
+ revision;
6
+ byteLength;
7
+ #files;
8
+ constructor(files, limits) {
9
+ if (!Number.isSafeInteger(limits.maximumFiles) || limits.maximumFiles < 1
10
+ || !Number.isSafeInteger(limits.maximumBytes) || limits.maximumBytes < 1) {
11
+ throw new Error('development.contents.invalid_limits');
12
+ }
13
+ if (!files.length || files.length > limits.maximumFiles) {
14
+ throw new Error('development.contents.file_count');
15
+ }
16
+ const names = new Set();
17
+ let total = 0;
18
+ const captured = files.map(file => {
19
+ const name = file.path;
20
+ if (!name || name.length > 1024 || name.includes('\\') || name.includes('\0')
21
+ || posix.isAbsolute(name) || posix.normalize(name) !== name
22
+ || name.split('/').some(part => part === '.' || part === '..' || !part)
23
+ || names.has(name)) {
24
+ throw new Error('development.contents.invalid_path');
25
+ }
26
+ names.add(name);
27
+ if (!(file.bytes instanceof Uint8Array) || file.bytes.byteLength > limits.maximumBytes - total) {
28
+ throw new Error('development.contents.byte_limit');
29
+ }
30
+ total += file.bytes.byteLength;
31
+ // Copy now: a caller's Buffer must not change what was checked later.
32
+ return { path: name, bytes: Buffer.from(file.bytes) };
33
+ }).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
34
+ const hash = createHash('sha256').update('promptframe-development-contents/v1\0');
35
+ this.#files = Object.freeze(captured.map(file => {
36
+ hash.update(`${Buffer.byteLength(file.path)}:`).update(file.path)
37
+ .update(`${file.bytes.length}:`).update(file.bytes);
38
+ return Object.freeze({ path: file.path, base64: file.bytes.toString('base64') });
39
+ }));
40
+ this.revision = `sha256:${hash.digest('hex')}`;
41
+ this.byteLength = total;
42
+ Object.freeze(this);
43
+ }
44
+ /** Consumers receive independent bytes; the checked capture remains immutable. */
45
+ readFiles() {
46
+ return this.#files.map(file => ({ path: file.path, bytes: Buffer.from(file.base64, 'base64') }));
47
+ }
48
+ }
49
+ /**
50
+ * Adoption only. The caller captures dependencies, runs the common checks/build,
51
+ * and recaptures current inputs before publish/reject. Watcher events alone do
52
+ * not authorize a revision. This helper never executes component code.
53
+ */
54
+ export class DevelopmentRevisionGate {
55
+ #states = new Map();
56
+ #checkerKey;
57
+ #maximumModules;
58
+ #sequence = 0;
59
+ constructor(options) {
60
+ if (!options.checkerKey.trim() || options.checkerKey.length > 512
61
+ || !Number.isSafeInteger(options.maximumModules) || options.maximumModules < 1) {
62
+ throw new Error('development.registry.invalid_options');
63
+ }
64
+ this.#checkerKey = options.checkerKey;
65
+ this.#maximumModules = options.maximumModules;
66
+ }
67
+ begin(moduleId, source) {
68
+ this.assertIdentity(moduleId);
69
+ const previous = this.#states.get(moduleId);
70
+ const check = Object.freeze({ moduleId, sourceRevision: source.revision, sequence: ++this.#sequence });
71
+ this.#states.set(moduleId, { check, state: Object.freeze({
72
+ moduleId, sourceRevision: source.revision, status: 'checking',
73
+ ...(previous?.state.lastChecked ? { lastChecked: previous.state.lastChecked } : {}),
74
+ }) });
75
+ return check;
76
+ }
77
+ invalidate(moduleId, diagnostic) {
78
+ this.assertIdentity(moduleId);
79
+ const previous = this.#states.get(moduleId);
80
+ this.#states.set(moduleId, { state: Object.freeze({ moduleId, status: 'failed',
81
+ diagnostic: diagnostic.slice(0, 1024) || 'development.capture.failed',
82
+ ...(previous?.state.lastChecked ? { lastChecked: previous.state.lastChecked } : {}),
83
+ }) });
84
+ }
85
+ assertIdentity(moduleId) {
86
+ if (!moduleId.trim() || moduleId.length > 256 || /[\u0000-\u001f]/.test(moduleId)) {
87
+ throw new Error('development.module.invalid_identity');
88
+ }
89
+ if (!this.#states.has(moduleId) && this.#states.size >= this.#maximumModules) {
90
+ throw new Error('development.registry.module_limit');
91
+ }
92
+ }
93
+ publish(check, current, artifacts) {
94
+ const entry = this.currentCheck(check, current);
95
+ if (!entry)
96
+ return false;
97
+ const lastChecked = Object.freeze({ moduleId: check.moduleId,
98
+ sourceRevision: check.sourceRevision, checkerKey: this.#checkerKey, artifacts });
99
+ entry.state = Object.freeze({ moduleId: check.moduleId,
100
+ sourceRevision: check.sourceRevision, status: 'checked', lastChecked });
101
+ return true;
102
+ }
103
+ reject(check, current, diagnostic) {
104
+ const entry = this.currentCheck(check, current);
105
+ if (!entry)
106
+ return false;
107
+ entry.state = Object.freeze({ ...entry.state, status: 'failed',
108
+ diagnostic: diagnostic.slice(0, 1024) || 'development.check.failed' });
109
+ return true;
110
+ }
111
+ state(moduleId) {
112
+ return this.#states.get(moduleId)?.state;
113
+ }
114
+ remove(moduleId) {
115
+ // A late completion retains its old token and cannot recreate this entry.
116
+ this.#states.delete(moduleId);
117
+ }
118
+ currentCheck(check, current) {
119
+ const entry = this.#states.get(check.moduleId);
120
+ if (!entry || entry.check !== check || entry.state.status !== 'checking')
121
+ return undefined;
122
+ if (current.revision !== check.sourceRevision) {
123
+ // Even a missed final filesystem notification cannot publish old bytes.
124
+ this.begin(check.moduleId, current);
125
+ return undefined;
126
+ }
127
+ return entry;
128
+ }
129
+ }
130
+ //# sourceMappingURL=development-revisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-revisions.js","sourceRoot":"","sources":["../src/development-revisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAYlC,iFAAiF;AACjF,MAAM,OAAO,mBAAmB;IACrB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,MAAM,CAA4D;IAE3E,YAAY,KAAiC,EAAE,MAAyB;QACtE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC;eACpE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC3E,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,C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G,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,UAAU;YAAE,OAAO,SAAS,CAAC;QAC3F,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC;YAC9C,wEAAwE;YACxE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { DevelopmentContents } from './development-revisions.js';
2
+ export interface DevelopmentValidationReceipt {
3
+ readonly sourceRevision: string;
4
+ readonly securityPolicyVersion: string;
5
+ readonly securityPolicyDigest: string;
6
+ readonly securityEvaluatorMode: 'ast';
7
+ readonly checkedRuleIds: readonly string[];
8
+ }
9
+ export declare class DevelopmentValidationError extends Error {
10
+ readonly code: string;
11
+ readonly diagnosticCode?: string | undefined;
12
+ constructor(code: string, diagnosticCode?: string | undefined);
13
+ }
14
+ /** The ordinary CLI validates a private materialization of the capture. It
15
+ * never reopens the live workspace, runs package scripts, or grants a platform
16
+ * admission. The caller must still build these bytes, recapture and publish. */
17
+ export declare function validateDevelopmentContents(contents: DevelopmentContents, options?: {
18
+ temporaryParent?: string;
19
+ timeoutMs?: number;
20
+ signal?: AbortSignal;
21
+ }): Promise<DevelopmentValidationReceipt>;
22
+ //# sourceMappingURL=development-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-validation.d.ts","sourceRoot":"","sources":["../src/development-validation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,qBAAqB,EAAE,KAAK,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM;gBAA9C,IAAI,EAAE,MAAM,EAAW,cAAc,CAAC,EAAE,MAAM,YAAA;CAGpE;AAED;;gFAEgF;AAChF,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACnF,OAAO,CAAC,4BAA4B,CAAC,CA0CvC"}
@@ -0,0 +1,122 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
3
+ import { tmpdir } from 'node:os';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ export class DevelopmentValidationError extends Error {
7
+ code;
8
+ diagnosticCode;
9
+ constructor(code, diagnosticCode) {
10
+ super(code);
11
+ this.code = code;
12
+ this.diagnosticCode = diagnosticCode;
13
+ this.name = 'DevelopmentValidationError';
14
+ }
15
+ }
16
+ /** The ordinary CLI validates a private materialization of the capture. It
17
+ * never reopens the live workspace, runs package scripts, or grants a platform
18
+ * admission. The caller must still build these bytes, recapture and publish. */
19
+ export async function validateDevelopmentContents(contents, options = {}) {
20
+ const timeoutMs = options.timeoutMs ?? 30_000;
21
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 120_000) {
22
+ throw new DevelopmentValidationError('development.validation.invalid_timeout');
23
+ }
24
+ options.signal?.throwIfAborted();
25
+ const files = contents.readFiles();
26
+ for (const file of files) {
27
+ if (file.path.split('/').some(part => ['node_modules', 'dist', '.git', '.component-packages', '.promptframe'].includes(part))) {
28
+ throw new DevelopmentValidationError('development.validation.excluded_input');
29
+ }
30
+ }
31
+ const directory = await mkdtemp(join(options.temporaryParent ?? tmpdir(), 'promptframe-check-'));
32
+ let hadFailure = false;
33
+ try {
34
+ for (const file of files) {
35
+ options.signal?.throwIfAborted();
36
+ const path = join(directory, ...file.path.split('/'));
37
+ await mkdir(dirname(path), { recursive: true });
38
+ await writeFile(path, file.bytes, { flag: 'wx', mode: 0o400 });
39
+ }
40
+ const result = await runCapturedValidation(directory, timeoutMs, options.signal);
41
+ const output = JSON.parse(result);
42
+ if (output.command !== 'validate' || output.securityEvaluatorMode !== 'ast'
43
+ || typeof output.securityPolicyVersion !== 'string' || typeof output.securityPolicyDigest !== 'string'
44
+ || !Array.isArray(output.checkedRuleIds) || !output.checkedRuleIds.every(rule => typeof rule === 'string')) {
45
+ throw new DevelopmentValidationError('development.validation.invalid_receipt');
46
+ }
47
+ return Object.freeze({ sourceRevision: contents.revision,
48
+ securityPolicyVersion: output.securityPolicyVersion, securityPolicyDigest: output.securityPolicyDigest,
49
+ securityEvaluatorMode: 'ast', checkedRuleIds: Object.freeze([...output.checkedRuleIds]) });
50
+ }
51
+ catch (error) {
52
+ hadFailure = true;
53
+ throw error;
54
+ }
55
+ finally {
56
+ // runCapturedValidation waits for actual child close, also after abort or
57
+ // timeout. Its reader cannot outlive this private input directory.
58
+ try {
59
+ await rm(directory, { recursive: true, force: true });
60
+ }
61
+ catch (error) {
62
+ if (!hadFailure)
63
+ throw error;
64
+ process.stderr.write(JSON.stringify({ code: 'development.validation.cleanup_failed', directory }) + '\n');
65
+ }
66
+ }
67
+ }
68
+ function runCapturedValidation(directory, timeoutMs, signal) {
69
+ signal?.throwIfAborted();
70
+ return new Promise((resolve, reject) => {
71
+ const child = spawn(process.execPath, [fileURLToPath(new URL('./index.js', import.meta.url)), 'validate', directory, '--json'], {
72
+ cwd: directory, stdio: ['ignore', 'pipe', 'pipe'],
73
+ // Validation is local. Neither endpoint/auth configuration nor arbitrary
74
+ // Node preload options from the host belong in this subprocess.
75
+ env: { NO_COLOR: '1', ...(process.platform === 'win32' && process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}) },
76
+ });
77
+ let firstError, failed = false, total = 0;
78
+ const stdout = [], stderr = [];
79
+ const fail = (error) => {
80
+ if (!failed) {
81
+ failed = true;
82
+ firstError = error;
83
+ }
84
+ child.kill('SIGKILL');
85
+ };
86
+ const receive = (target, chunk) => {
87
+ total += chunk.length;
88
+ if (total > 512 * 1024)
89
+ return fail(new DevelopmentValidationError('development.validation.output_limit'));
90
+ target.push(chunk);
91
+ };
92
+ child.stdout.on('data', chunk => receive(stdout, chunk));
93
+ child.stderr.on('data', chunk => receive(stderr, chunk));
94
+ const abort = () => fail(signal.reason);
95
+ signal?.addEventListener('abort', abort, { once: true });
96
+ const timeout = setTimeout(() => fail(new DevelopmentValidationError('development.validation.timeout')), timeoutMs);
97
+ child.once('error', error => { if (!failed) {
98
+ failed = true;
99
+ firstError = error;
100
+ } });
101
+ child.once('close', code => {
102
+ clearTimeout(timeout);
103
+ signal?.removeEventListener('abort', abort);
104
+ if (failed)
105
+ return reject(firstError);
106
+ if (code === 0)
107
+ return resolve(Buffer.concat(stdout).toString('utf8'));
108
+ let diagnosticCode;
109
+ try {
110
+ const output = JSON.parse(Buffer.concat(stderr).toString('utf8'));
111
+ const candidate = output.diagnostic?.code;
112
+ if (typeof candidate === 'string' && /^[a-z0-9_]+(?:\.[a-z0-9_]+)+$/u.test(candidate) && candidate.length <= 256)
113
+ diagnosticCode = candidate;
114
+ }
115
+ catch { /* Unstructured child output is not a diagnostic contract. */ }
116
+ reject(new DevelopmentValidationError('development.validation.rejected', diagnosticCode));
117
+ });
118
+ if (signal?.aborted)
119
+ abort();
120
+ });
121
+ }
122
+ //# sourceMappingURL=development-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-validation.js","sourceRoot":"","sources":["../src/development-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAWzC,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC9B;IAAuB;IAA5C,YAAqB,IAAY,EAAW,cAAuB;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC;QADO,SAAI,GAAJ,IAAI,CAAQ;QAAW,mBAAc,GAAd,cAAc,CAAS;QACpD,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IACxD,CAAC;CACF;AAED;;gFAEgF;AAChF,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,QAA6B,EAC7B,UAAkF,EAAE;IAEpF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,OAAO,EAAE,CAAC;QAC7E,MAAM,IAAI,0BAA0B,CAAC,wCAAwC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAA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UAAU,EAAE,IAAI,CAAC;gBAC1C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,IAAI,GAAG;oBAAE,cAAc,GAAG,SAAS,CAAC;YAC/I,CAAC;YAAC,MAAM,CAAC,CAAC,6DAA6D,CAAC,CAAC;YACzE,MAAM,CAAC,IAAI,0BAA0B,CAAC,iCAAiC,EAAE,cAAc,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;QACH,IAAI,MAAM,EAAE,OAAO;YAAE,KAAK,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { DevelopmentContents } from './development-revisions.js';
2
+ export interface DevelopmentWorkspaceModule {
3
+ id: string;
4
+ path: string;
5
+ }
6
+ /** One capture includes the module and its real shared pnpm lock bytes. Source
7
+ * aliases/parent imports remain explicitly unsupported by the common policy. */
8
+ export declare function captureDevelopmentModule(root: string, module: DevelopmentWorkspaceModule): DevelopmentContents;
9
+ /** A single root Vite watcher plus a closed HTTP surface. Vite's raw-source,
10
+ * HTML, /@fs, HMR and plugin/config serving middleware is never attached. */
11
+ export declare function startDevelopmentWorkspace(options: {
12
+ root: string;
13
+ modules: readonly DevelopmentWorkspaceModule[];
14
+ studioOrigin: string;
15
+ host?: '127.0.0.1' | '::1';
16
+ port?: number;
17
+ }): Promise<Readonly<{
18
+ connectionId: string;
19
+ url: `http://${string}`;
20
+ studioOrigin: string;
21
+ credential: string;
22
+ expiresAt: string;
23
+ close(): Promise<void>;
24
+ }>>;
25
+ //# sourceMappingURL=development-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-workspace.d.ts","sourceRoot":"","sources":["../src/development-workspace.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKjE,MAAM,WAAW,0BAA0B;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAExE;gFACgF;AAChF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,0BAA0B,GAAG,mBAAmB,CAuD9G;AAED;6EAC6E;AAC7E,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IACnF,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC3C;;;;;;;IAsMA"}