@hearsay-tools/squawk 0.19.0-pr4574.9080 → 0.19.0-pr4574.9085
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/artifacts/reports-index.js +2 -3
- package/dist/artifacts/reports-index.js.map +1 -1
- package/dist/boot.d.ts +1 -1
- package/dist/boot.js +1 -1
- package/dist/built-in-cli-commands.js +1 -1
- package/dist/built-in-cli-commands.js.map +1 -1
- package/dist/built-in-launch-parts.js +1 -1
- package/dist/built-in-launch-parts.js.map +1 -1
- package/dist/built-in-run-slots.d.ts +1 -1
- package/dist/built-in-run-slots.js +7 -3
- package/dist/built-in-run-slots.js.map +1 -1
- package/dist/delegation/results.js +4 -3
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +15 -15
- package/dist/delegation/transport.d.ts +10 -10
- package/dist/features/automations/automations-routes.d.ts +150 -150
- package/dist/features/hosts/routes.d.ts +44 -44
- package/dist/features/hosts/start-methods.d.ts +10 -5
- package/dist/features/hosts/start-methods.js +37 -29
- package/dist/features/hosts/start-methods.js.map +1 -1
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/{artifacts/resolve.js → server/file-link.js} +3 -3
- package/dist/server/file-link.js.map +1 -0
- package/dist/server/project-run-files.js +1 -1
- package/dist/server/project-run-files.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runs-routes.d.ts +668 -668
- package/dist/server/runs-routes.js +2 -2
- package/dist/server/runs-routes.js.map +1 -1
- package/dist/server/server.d.ts +34 -34
- package/dist/{artifacts/cli.js → task-files/artifact-cli.js} +2 -2
- package/dist/task-files/artifact-cli.js.map +1 -0
- package/dist/{artifacts/store.d.ts → task-files/artifact-kind.d.ts} +14 -17
- package/dist/task-files/artifact-kind.js +123 -0
- package/dist/task-files/artifact-kind.js.map +1 -0
- package/dist/task-files/kind.d.ts +55 -0
- package/dist/task-files/kind.js +68 -0
- package/dist/task-files/kind.js.map +1 -0
- package/dist/{artifacts → task-files}/lifecycle.d.ts +0 -1
- package/dist/{artifacts → task-files}/lifecycle.js +3 -28
- package/dist/task-files/lifecycle.js.map +1 -0
- package/dist/task-files/removal-slot.d.ts +3 -0
- package/dist/task-files/removal-slot.js +20 -0
- package/dist/task-files/removal-slot.js.map +1 -0
- package/dist/task-files/store.d.ts +37 -0
- package/dist/{artifacts → task-files}/store.js +150 -155
- package/dist/task-files/store.js.map +1 -0
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +4 -4
- package/dist/artifacts/cli.js.map +0 -1
- package/dist/artifacts/lifecycle.js.map +0 -1
- package/dist/artifacts/removal-slot.d.ts +0 -3
- package/dist/artifacts/removal-slot.js +0 -7
- package/dist/artifacts/removal-slot.js.map +0 -1
- package/dist/artifacts/resolve.js.map +0 -1
- package/dist/artifacts/store.js.map +0 -1
- /package/dist/{artifacts/resolve.d.ts → server/file-link.d.ts} +0 -0
- /package/dist/{artifacts/cli.d.ts → task-files/artifact-cli.d.ts} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task file kinds (spec 2026-11-30-task-file-store-and-bundled-webhooks-reports, Decision 1).
|
|
3
|
+
* A kind supplies the rules for one family of task-owned files (`folderSuffix`, size/count limits,
|
|
4
|
+
* record schema, record builder, and optional read-time computation). The kinds table follows the
|
|
5
|
+
* register -> seal -> read lifecycle of `core/registry.ts` so operations that cover every kind
|
|
6
|
+
* (starting with run-history removal) act over all registered kinds.
|
|
7
|
+
*/
|
|
8
|
+
import type { z } from 'zod';
|
|
9
|
+
/** Common fields every stored task-file record carries so the core store can validate and sort it. */
|
|
10
|
+
export interface TaskFileRecord {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly runId: string;
|
|
13
|
+
readonly createdAt: string;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly sha256: string;
|
|
16
|
+
}
|
|
17
|
+
/** Facts the store computes for a newly published file and passes to a kind's `buildRecord`. */
|
|
18
|
+
export interface TaskFileBuildInput {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly runId: string;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly sourcePath: string;
|
|
23
|
+
readonly createdAt: string;
|
|
24
|
+
readonly size: number;
|
|
25
|
+
readonly sha256: string;
|
|
26
|
+
readonly bytes: Buffer;
|
|
27
|
+
}
|
|
28
|
+
/** Per-kind capacity caps enforced by the store on publish, read, list and index scans. */
|
|
29
|
+
export interface TaskFileLimits {
|
|
30
|
+
readonly maxFileBytes: number;
|
|
31
|
+
readonly maxFiles: number;
|
|
32
|
+
readonly maxRunBytes: number;
|
|
33
|
+
}
|
|
34
|
+
/** Definition of one task-file kind. */
|
|
35
|
+
export interface TaskFileKind<TRecord extends TaskFileRecord = TaskFileRecord> {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly folderSuffix: string;
|
|
38
|
+
readonly limits: TaskFileLimits;
|
|
39
|
+
readonly recordSchema: z.ZodType<TRecord>;
|
|
40
|
+
buildRecord(input: TaskFileBuildInput): TRecord;
|
|
41
|
+
/** Content prefix bytes needed during metadata-only reads for `computeOnRead`. Defaults to 0. */
|
|
42
|
+
metadataPrefixBytes?(record: TRecord): number;
|
|
43
|
+
/** Optional read-time transform that attaches computed fields from the record and read bytes. */
|
|
44
|
+
computeOnRead?(record: TRecord, bytes: Buffer): TRecord;
|
|
45
|
+
}
|
|
46
|
+
/** Register a task file kind before sealing. Re-registering the same reference is a no-op. */
|
|
47
|
+
export declare function registerTaskFileKind<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>): void;
|
|
48
|
+
/** Close the task file kinds table at the boot boundary. */
|
|
49
|
+
export declare function sealTaskFileKinds(): void;
|
|
50
|
+
/** Whether the task file kinds table is sealed. Never throws. */
|
|
51
|
+
export declare function taskFileKindsSealed(): boolean;
|
|
52
|
+
/** Registered kinds in registration order. Throws until sealed. */
|
|
53
|
+
export declare function registeredTaskFileKinds(): TaskFileKind[];
|
|
54
|
+
/** Look up one registered kind by id. Throws until sealed. */
|
|
55
|
+
export declare function taskFileKind(id: string): TaskFileKind | undefined;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createKeyedRegistry } from '../core/registry.js';
|
|
2
|
+
const KIND_ID = /^[a-z][a-z0-9-]*$/;
|
|
3
|
+
const FOLDER_SUFFIX = /^[a-z0-9][a-z0-9-]*$/;
|
|
4
|
+
const kinds = createKeyedRegistry({
|
|
5
|
+
name: 'Task file kinds',
|
|
6
|
+
bootHint: 'register every task file kind, then call sealTaskFileKinds() at the runtime boot boundary (boot.ts), or import a testkit that seals it.',
|
|
7
|
+
});
|
|
8
|
+
const suffixes = new Map();
|
|
9
|
+
function isPositiveLimit(value) {
|
|
10
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value > 0;
|
|
11
|
+
}
|
|
12
|
+
function checkShape(kind) {
|
|
13
|
+
if (typeof kind !== 'object' || kind === null) {
|
|
14
|
+
throw new Error('Task file kinds: a kind definition must be an object.');
|
|
15
|
+
}
|
|
16
|
+
if (typeof kind.id !== 'string' || !KIND_ID.test(kind.id)) {
|
|
17
|
+
throw new Error(`Task file kinds: invalid id ${JSON.stringify(kind.id)}.`);
|
|
18
|
+
}
|
|
19
|
+
if (typeof kind.folderSuffix !== 'string' || !FOLDER_SUFFIX.test(kind.folderSuffix)) {
|
|
20
|
+
throw new Error(`Task file kinds: '${kind.id}' has an invalid folderSuffix ${JSON.stringify(kind.folderSuffix)}.`);
|
|
21
|
+
}
|
|
22
|
+
if (typeof kind.limits !== 'object' || kind.limits === null
|
|
23
|
+
|| !isPositiveLimit(kind.limits.maxFileBytes)
|
|
24
|
+
|| !isPositiveLimit(kind.limits.maxFiles)
|
|
25
|
+
|| !isPositiveLimit(kind.limits.maxRunBytes)) {
|
|
26
|
+
throw new Error(`Task file kinds: '${kind.id}' needs positive integer limits (maxFileBytes, maxFiles, maxRunBytes).`);
|
|
27
|
+
}
|
|
28
|
+
if (typeof kind.recordSchema !== 'object' || kind.recordSchema === null || typeof kind.recordSchema.parse !== 'function') {
|
|
29
|
+
throw new Error(`Task file kinds: '${kind.id}' needs a recordSchema.`);
|
|
30
|
+
}
|
|
31
|
+
if (typeof kind.buildRecord !== 'function') {
|
|
32
|
+
throw new Error(`Task file kinds: '${kind.id}' needs a buildRecord function.`);
|
|
33
|
+
}
|
|
34
|
+
if (kind.metadataPrefixBytes !== undefined && typeof kind.metadataPrefixBytes !== 'function') {
|
|
35
|
+
throw new Error(`Task file kinds: '${kind.id}' metadataPrefixBytes must be a function.`);
|
|
36
|
+
}
|
|
37
|
+
if (kind.computeOnRead !== undefined && typeof kind.computeOnRead !== 'function') {
|
|
38
|
+
throw new Error(`Task file kinds: '${kind.id}' computeOnRead must be a function.`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Register a task file kind before sealing. Re-registering the same reference is a no-op. */
|
|
42
|
+
export function registerTaskFileKind(kind) {
|
|
43
|
+
const entry = kind;
|
|
44
|
+
checkShape(entry);
|
|
45
|
+
const existing = suffixes.get(entry.folderSuffix);
|
|
46
|
+
if (existing && existing !== entry) {
|
|
47
|
+
throw new Error(`Task file kinds: conflicting folderSuffix '${entry.folderSuffix}' between '${existing.id}' and '${entry.id}'.`);
|
|
48
|
+
}
|
|
49
|
+
kinds.register(entry.id, entry);
|
|
50
|
+
suffixes.set(entry.folderSuffix, entry);
|
|
51
|
+
}
|
|
52
|
+
/** Close the task file kinds table at the boot boundary. */
|
|
53
|
+
export function sealTaskFileKinds() {
|
|
54
|
+
kinds.seal();
|
|
55
|
+
}
|
|
56
|
+
/** Whether the task file kinds table is sealed. Never throws. */
|
|
57
|
+
export function taskFileKindsSealed() {
|
|
58
|
+
return kinds.isSealed();
|
|
59
|
+
}
|
|
60
|
+
/** Registered kinds in registration order. Throws until sealed. */
|
|
61
|
+
export function registeredTaskFileKinds() {
|
|
62
|
+
return kinds.values();
|
|
63
|
+
}
|
|
64
|
+
/** Look up one registered kind by id. Throws until sealed. */
|
|
65
|
+
export function taskFileKind(id) {
|
|
66
|
+
return kinds.get(id);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kind.js","sourceRoot":"","sources":["../../src/task-files/kind.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/** Generated run-owned location; never let inherited parent session paths leak into a child. */
|
|
2
2
|
export declare function provisionArtifactDirectory(dataDir: string, runId: string): string;
|
|
3
|
-
export declare function removeArtifacts(dataDir: string, runId: string): void;
|
|
4
3
|
export declare function artifactInstructions(directory: string | undefined): string;
|
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
import { mkdirSync, realpathSync, rmSync, statSync } from 'node:fs';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
|
-
import { artifactDirectory } from './store.js';
|
|
4
1
|
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { artifactKind } from './artifact-kind.js';
|
|
3
|
+
import { provisionTaskFileDirectory } from './store.js';
|
|
5
4
|
/** Generated run-owned location; never let inherited parent session paths leak into a child. */
|
|
6
5
|
export function provisionArtifactDirectory(dataDir, runId) {
|
|
7
|
-
|
|
8
|
-
const directory = artifactDirectory(dataDir, runId);
|
|
9
|
-
const parent = dirname(directory);
|
|
10
|
-
if (realpathSync(parent) !== parent)
|
|
11
|
-
return '';
|
|
12
|
-
try {
|
|
13
|
-
mkdirSync(directory, { mode: 0o700 });
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
if (error.code !== 'EEXIST')
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
return realpathSync(directory) === directory && statSync(directory).isDirectory() ? directory : '';
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function removeArtifacts(dataDir, runId) {
|
|
26
|
-
const directory = artifactDirectory(dataDir, runId);
|
|
27
|
-
const parent = dirname(directory);
|
|
28
|
-
if (realpathSync(parent) !== parent)
|
|
29
|
-
throw Error('Artifact storage redirected');
|
|
30
|
-
// rm removes a final symlink itself, never the directory it points at.
|
|
31
|
-
rmSync(directory, { recursive: true, force: true });
|
|
6
|
+
return provisionTaskFileDirectory(artifactKind, dataDir, runId);
|
|
32
7
|
}
|
|
33
8
|
const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
34
9
|
export function artifactInstructions(directory) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/task-files/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,gGAAgG;AAChG,MAAM,UAAU,0BAA0B,CAAC,OAAe,EAAE,KAAa;IACvE,OAAO,0BAA0B,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AACvE,MAAM,UAAU,oBAAoB,CAAC,SAA6B;IAChE,IAAI,CAAC,SAAS;QAAE,OAAO,oIAAoI,CAAC;IAC5J,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC;IAClJ,OAAO,4GAA4G,OAAO,8kBAA8kB,CAAC;AAC3sB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { registeredTaskFileKinds } from './kind.js';
|
|
2
|
+
import { removeTaskFiles } from './store.js';
|
|
3
|
+
/** Removes every registered task file kind's folder for a run when its history goes. */
|
|
4
|
+
export const taskFilesRemovalCleanup = {
|
|
5
|
+
name: 'task-files',
|
|
6
|
+
removed(runId, dataDir) {
|
|
7
|
+
const failures = [];
|
|
8
|
+
for (const kind of registeredTaskFileKinds()) {
|
|
9
|
+
try {
|
|
10
|
+
removeTaskFiles(kind, dataDir, runId);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
failures.push(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (failures.length)
|
|
17
|
+
throw failures[0];
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=removal-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal-slot.js","sourceRoot":"","sources":["../../src/task-files/removal-slot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,wFAAwF;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,IAAI,EAAE,YAAY;IAClB,OAAO,CAAC,KAAK,EAAE,OAAO;QACpB,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,uBAAuB,EAAE,EAAE,CAAC;YAC7C,IAAI,CAAC;gBAAC,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAAC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAAC,CAAC;QACxF,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM;YAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { TaskFileKind, TaskFileRecord } from './kind.ts';
|
|
2
|
+
export type TaskFileIndexResult<T> = {
|
|
3
|
+
state: 'read';
|
|
4
|
+
value: T;
|
|
5
|
+
} | {
|
|
6
|
+
state: 'missing';
|
|
7
|
+
} | {
|
|
8
|
+
state: 'indeterminate';
|
|
9
|
+
error: unknown;
|
|
10
|
+
};
|
|
11
|
+
/** Resolve only the trusted data root; runs and task redirects remain forbidden. */
|
|
12
|
+
export declare function taskFileRunsRoot(dataDir: string): string;
|
|
13
|
+
/** Build the task-file directory for a kind under an already-resolved runs root. */
|
|
14
|
+
export declare function taskFileDirectoryInRunsRoot(kind: Pick<TaskFileKind, 'folderSuffix'>, runsRoot: string, runId: string): string;
|
|
15
|
+
export declare function taskFileDirectory(kind: Pick<TaskFileKind, 'folderSuffix'>, runsDataDir: string, runId: string): string;
|
|
16
|
+
/** Return the stored content file path for one entry inside a kind's run directory. */
|
|
17
|
+
export declare function taskFileContentPath(directory: string, id: string): string;
|
|
18
|
+
/** Provision a run-owned directory for a kind without following a redirected parent or folder. */
|
|
19
|
+
export declare function provisionTaskFileDirectory(kind: Pick<TaskFileKind, 'folderSuffix'>, dataDir: string, runId: string): string;
|
|
20
|
+
/** Remove a run's folder for a kind. A redirected parent throws; a missing folder is not an error. */
|
|
21
|
+
export declare function removeTaskFiles(kind: Pick<TaskFileKind, 'folderSuffix'>, dataDir: string, runId: string): void;
|
|
22
|
+
export declare function publishTaskFile<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string, source: string): Promise<TRecord>;
|
|
23
|
+
export declare function readTaskFile<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string, id: string): Promise<{
|
|
24
|
+
metadata: TRecord;
|
|
25
|
+
bytes: Buffer;
|
|
26
|
+
} | null>;
|
|
27
|
+
export declare function readTaskFileRecord<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string, id: string): Promise<TRecord | null>;
|
|
28
|
+
/** Internal index read: an I/O failure cannot prove that a published snapshot is gone. */
|
|
29
|
+
export declare function readTaskFileRecordForIndex<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string, id: string): Promise<TaskFileIndexResult<TRecord>>;
|
|
30
|
+
/** Shares the public list's validated bounded walk and per-entry reader, preserving uncertain IDs. */
|
|
31
|
+
export declare function scanTaskFilesForIndex<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string): Promise<TaskFileIndexResult<{
|
|
32
|
+
records: TRecord[];
|
|
33
|
+
indeterminate: string[];
|
|
34
|
+
}>>;
|
|
35
|
+
/** Page checks use the same validated storage components and per-file cap as the reader. */
|
|
36
|
+
export declare function checkTaskFileContentForIndex(kind: Pick<TaskFileKind, 'id' | 'folderSuffix' | 'limits'>, directory: string, runId: string, id: string, size: number): Promise<TaskFileIndexResult<boolean>>;
|
|
37
|
+
export declare function listTaskFiles<TRecord extends TaskFileRecord>(kind: TaskFileKind<TRecord>, directory: string, runId: string): Promise<TRecord[]>;
|