@termwright/protocol 0.2.0 → 0.3.0

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 +213 -605
  2. package/dist/action-model-BP9Znu6L.d.ts +219 -0
  3. package/dist/action-model.d.ts +3 -0
  4. package/dist/action-model.js +15 -0
  5. package/dist/action-model.js.map +1 -0
  6. package/dist/capability-graph.d.ts +90 -0
  7. package/dist/capability-graph.js +43 -0
  8. package/dist/capability-graph.js.map +1 -0
  9. package/dist/chunk-B4VUTTUE.js +59 -0
  10. package/dist/chunk-B4VUTTUE.js.map +1 -0
  11. package/dist/chunk-CZK6NNP3.js +389 -0
  12. package/dist/chunk-CZK6NNP3.js.map +1 -0
  13. package/dist/chunk-ODOJRXL6.js +84 -0
  14. package/dist/chunk-ODOJRXL6.js.map +1 -0
  15. package/dist/chunk-PUXRCPGY.js +112 -0
  16. package/dist/chunk-PUXRCPGY.js.map +1 -0
  17. package/dist/chunk-VBLS6E6U.js +1109 -0
  18. package/dist/chunk-VBLS6E6U.js.map +1 -0
  19. package/dist/chunk-ZZIYHDJ4.js +202 -0
  20. package/dist/chunk-ZZIYHDJ4.js.map +1 -0
  21. package/dist/contract-CH9gmj2Y.d.ts +746 -0
  22. package/dist/contract.d.ts +2 -0
  23. package/dist/contract.js +21 -0
  24. package/dist/contract.js.map +1 -0
  25. package/dist/index.d.ts +82 -798
  26. package/dist/index.js +1087 -766
  27. package/dist/index.js.map +1 -1
  28. package/dist/run-events.d.ts +158 -0
  29. package/dist/run-events.js +27 -0
  30. package/dist/run-events.js.map +1 -0
  31. package/dist/run-journal.d.ts +55 -0
  32. package/dist/run-journal.js +10 -0
  33. package/dist/run-journal.js.map +1 -0
  34. package/dist/run-state.d.ts +38 -0
  35. package/dist/run-state.js +19 -0
  36. package/dist/run-state.js.map +1 -0
  37. package/dist/test-provider.d.ts +22 -0
  38. package/dist/test-provider.js +32 -0
  39. package/dist/test-provider.js.map +1 -0
  40. package/package.json +33 -5
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Browser-safe identity and event envelope for one Termwright invocation.
3
+ *
4
+ * These identifiers describe orchestration, not framework semantics. Every
5
+ * kind has a distinct wire prefix, so an execution id can never be accepted as
6
+ * an attempt id merely because both happen to contain the same random bits.
7
+ */
8
+ declare const RUN_ID_KINDS: readonly ["invocation", "run", "project", "shard", "spec", "runner-task", "execution", "attempt", "session", "step", "action", "producer", "event"];
9
+ type RunIdKind = (typeof RUN_ID_KINDS)[number];
10
+ declare const runIdBrand: unique symbol;
11
+ type BrandedRunId<Kind extends RunIdKind> = string & {
12
+ readonly [runIdBrand]: Kind;
13
+ };
14
+ type InvocationId = BrandedRunId<'invocation'>;
15
+ type RunId = BrandedRunId<'run'>;
16
+ type ProjectId = BrandedRunId<'project'>;
17
+ type ShardId = BrandedRunId<'shard'>;
18
+ type SpecId = BrandedRunId<'spec'>;
19
+ type RunnerTaskId = BrandedRunId<'runner-task'>;
20
+ type ExecutionId = BrandedRunId<'execution'>;
21
+ type AttemptId = BrandedRunId<'attempt'>;
22
+ type SessionId = BrandedRunId<'session'>;
23
+ type StepId = BrandedRunId<'step'>;
24
+ type ActionId = BrandedRunId<'action'>;
25
+ type RunEventProducerId = BrandedRunId<'producer'>;
26
+ type RunEventId = BrandedRunId<'event'>;
27
+ interface RunIdByKind {
28
+ readonly invocation: InvocationId;
29
+ readonly run: RunId;
30
+ readonly project: ProjectId;
31
+ readonly shard: ShardId;
32
+ readonly spec: SpecId;
33
+ readonly 'runner-task': RunnerTaskId;
34
+ readonly execution: ExecutionId;
35
+ readonly attempt: AttemptId;
36
+ readonly session: SessionId;
37
+ readonly step: StepId;
38
+ readonly action: ActionId;
39
+ readonly producer: RunEventProducerId;
40
+ readonly event: RunEventId;
41
+ }
42
+ /** Validate and brand an id received from an untrusted or persisted source. */
43
+ declare function parseRunId<Kind extends RunIdKind>(kind: Kind, value: unknown): RunIdByKind[Kind];
44
+ /**
45
+ * Mint a collision-resistant, kind-separated id without importing Node APIs.
46
+ * `randomUUID` is injectable for deterministic tests and embedded runtimes.
47
+ */
48
+ declare function createRunId<Kind extends RunIdKind>(kind: Kind, randomUUID?: () => string): RunIdByKind[Kind];
49
+ /** Scoped issuer that detects a broken randomness source before ids escape. */
50
+ declare class RunIdFactory {
51
+ #private;
52
+ constructor(randomUUID?: () => string);
53
+ create<Kind extends RunIdKind>(kind: Kind): RunIdByKind[Kind];
54
+ }
55
+ declare const RUN_EVENT_CLASSES: readonly ["authoritative", "state", "diagnostic"];
56
+ type RunEventClass = (typeof RUN_EVENT_CLASSES)[number];
57
+ declare const RUN_EVENT_VERSION: 2;
58
+ type RunEventJson = null | boolean | number | string | readonly RunEventJson[] | {
59
+ readonly [key: string]: RunEventJson;
60
+ };
61
+ /** Hierarchical identity carried by every event. */
62
+ interface RunEventIdentity {
63
+ readonly invocationId: InvocationId;
64
+ readonly runId?: RunId;
65
+ readonly projectId?: ProjectId;
66
+ readonly shardId?: ShardId;
67
+ readonly specId?: SpecId;
68
+ readonly runnerTaskId?: RunnerTaskId;
69
+ readonly executionId?: ExecutionId;
70
+ readonly attemptId?: AttemptId;
71
+ readonly sessionId?: SessionId;
72
+ readonly stepId?: StepId;
73
+ readonly actionId?: ActionId;
74
+ }
75
+ /** Version 2 is the only accepted event shape; there is no legacy envelope. */
76
+ interface RunEvent<Type extends string = string, Payload extends RunEventJson = RunEventJson> {
77
+ readonly v: typeof RUN_EVENT_VERSION;
78
+ readonly eventId: RunEventId;
79
+ readonly producerId: RunEventProducerId;
80
+ /** Producer incarnation. A restarted producer increments this value. */
81
+ readonly epoch: number;
82
+ /** Strictly increasing within one producer incarnation. */
83
+ readonly seq: number;
84
+ readonly eventClass: RunEventClass;
85
+ readonly type: Type;
86
+ /** Milliseconds from the producer's monotonic clock. */
87
+ readonly monotonicTime: number;
88
+ /** Optional Unix epoch milliseconds, for human correlation only. */
89
+ readonly wallTime?: number;
90
+ readonly identity: RunEventIdentity;
91
+ readonly causedBy?: readonly RunEventId[];
92
+ readonly payload: Payload;
93
+ }
94
+ interface RunEventLimits {
95
+ readonly maxEventBytes: number;
96
+ readonly maxPayloadDepth: number;
97
+ readonly maxPayloadEntries: number;
98
+ readonly maxStringBytes: number;
99
+ readonly maxCauses: number;
100
+ }
101
+ declare const DEFAULT_RUN_EVENT_LIMITS: RunEventLimits;
102
+ type RunEventViolationCode = 'invalid-envelope' | 'invalid-id' | 'invalid-identity' | 'invalid-payload' | 'event-oversized' | 'event-collision' | 'epoch-regression' | 'sequence-regression' | 'monotonic-time-regression' | 'causal-cycle';
103
+ type RunEventValidationResult = {
104
+ readonly ok: true;
105
+ readonly value: RunEvent;
106
+ } | {
107
+ readonly ok: false;
108
+ readonly code: RunEventViolationCode;
109
+ readonly detail: string;
110
+ };
111
+ interface CreateRunEventInput<Type extends string, Payload extends RunEventJson> {
112
+ readonly eventId?: RunEventId;
113
+ readonly producerId: RunEventProducerId;
114
+ readonly epoch: number;
115
+ readonly seq: number;
116
+ readonly eventClass: RunEventClass;
117
+ readonly type: Type;
118
+ readonly monotonicTime: number;
119
+ readonly wallTime?: number;
120
+ readonly identity: RunEventIdentity;
121
+ readonly causedBy?: readonly RunEventId[];
122
+ readonly payload: Payload;
123
+ readonly randomUUID?: () => string;
124
+ }
125
+ interface ProduceRunEventInput<Type extends string, Payload extends RunEventJson> {
126
+ readonly eventClass: RunEventClass;
127
+ readonly type: Type;
128
+ readonly identity: RunEventIdentity;
129
+ readonly causedBy?: readonly RunEventId[];
130
+ readonly payload: Payload;
131
+ }
132
+ /**
133
+ * Producer-side constructor owning epoch, sequence, event ids and clock.
134
+ * Callers therefore cannot accidentally reuse a journal coordinate.
135
+ */
136
+ declare class RunEventProducer {
137
+ #private;
138
+ constructor(options: {
139
+ readonly producerId: RunEventProducerId;
140
+ readonly epoch: number;
141
+ readonly randomUUID?: () => string;
142
+ readonly monotonicNow?: () => number;
143
+ readonly wallNow?: () => number;
144
+ });
145
+ emit<Type extends string, Payload extends RunEventJson>(input: ProduceRunEventInput<Type, Payload>, limits?: RunEventLimits): RunEvent<Type, Payload>;
146
+ }
147
+ /** Construct and validate one deeply immutable envelope. */
148
+ declare function createRunEvent<Type extends string, Payload extends RunEventJson>(input: CreateRunEventInput<Type, Payload>, limits?: RunEventLimits): RunEvent<Type, Payload>;
149
+ /** Validate, copy and deeply freeze a single untrusted event. */
150
+ declare function validateRunEvent(value: unknown, limits?: RunEventLimits): RunEventValidationResult;
151
+ /** Stateful collision, ordering and causal-DAG validator for merged streams. */
152
+ declare class RunEventStreamValidator {
153
+ #private;
154
+ constructor(limits?: RunEventLimits);
155
+ accept(value: unknown): RunEventValidationResult;
156
+ }
157
+
158
+ export { type ActionId, type AttemptId, type CreateRunEventInput, DEFAULT_RUN_EVENT_LIMITS, type ExecutionId, type InvocationId, type ProduceRunEventInput, type ProjectId, RUN_EVENT_CLASSES, RUN_EVENT_VERSION, RUN_ID_KINDS, type RunEvent, type RunEventClass, type RunEventId, type RunEventIdentity, type RunEventJson, type RunEventLimits, RunEventProducer, type RunEventProducerId, RunEventStreamValidator, type RunEventValidationResult, type RunEventViolationCode, type RunId, type RunIdByKind, RunIdFactory, type RunIdKind, type RunnerTaskId, type SessionId, type ShardId, type SpecId, type StepId, createRunEvent, createRunId, parseRunId, validateRunEvent };
@@ -0,0 +1,27 @@
1
+ import {
2
+ DEFAULT_RUN_EVENT_LIMITS,
3
+ RUN_EVENT_CLASSES,
4
+ RUN_EVENT_VERSION,
5
+ RUN_ID_KINDS,
6
+ RunEventProducer,
7
+ RunEventStreamValidator,
8
+ RunIdFactory,
9
+ createRunEvent,
10
+ createRunId,
11
+ parseRunId,
12
+ validateRunEvent
13
+ } from "./chunk-CZK6NNP3.js";
14
+ export {
15
+ DEFAULT_RUN_EVENT_LIMITS,
16
+ RUN_EVENT_CLASSES,
17
+ RUN_EVENT_VERSION,
18
+ RUN_ID_KINDS,
19
+ RunEventProducer,
20
+ RunEventStreamValidator,
21
+ RunIdFactory,
22
+ createRunEvent,
23
+ createRunId,
24
+ parseRunId,
25
+ validateRunEvent
26
+ };
27
+ //# sourceMappingURL=run-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,55 @@
1
+ import { InvocationId, RunId, RunEventProducer, RunEventValidationResult, RunEvent } from './run-events.js';
2
+
3
+ interface RunEventJournalLimits {
4
+ /** Lossless events are rejected with backpressure at this pending count. */
5
+ readonly maxAuthoritativeEvents: number;
6
+ /** Distinct coalescing keys pending between flushes. */
7
+ readonly maxStateKeys: number;
8
+ /** Diagnostic events retained; evictions produce an explicit gap event. */
9
+ readonly maxDiagnosticEvents: number;
10
+ }
11
+ declare const DEFAULT_RUN_EVENT_JOURNAL_LIMITS: RunEventJournalLimits;
12
+ interface RunEventFlushBarrier {
13
+ readonly token: number;
14
+ readonly highWaterMark: number;
15
+ }
16
+ type RunEventJournalViolationCode = Extract<RunEventValidationResult, {
17
+ readonly ok: false;
18
+ }>['code'] | 'stale-run' | 'journal-full' | 'state-key-required' | 'invalid-barrier';
19
+ type RunEventJournalAppendResult = {
20
+ readonly ok: true;
21
+ readonly ordinal: number;
22
+ } | {
23
+ readonly ok: false;
24
+ readonly code: RunEventJournalViolationCode;
25
+ readonly detail: string;
26
+ };
27
+ /**
28
+ * In-memory ordering core used by the first-class Termwright test host.
29
+ *
30
+ * Authoritative events are never dropped. State coalescing is explicit and is
31
+ * stopped by every barrier. Diagnostics are bounded, and every eviction is
32
+ * represented by a lossless synthetic `journal.diagnostic-gap` event.
33
+ */
34
+ declare class RunEventJournal {
35
+ #private;
36
+ constructor(options: {
37
+ readonly invocationId: InvocationId;
38
+ readonly runId: RunId;
39
+ readonly gapProducer: RunEventProducer;
40
+ readonly limits?: RunEventJournalLimits;
41
+ });
42
+ append(value: unknown, options?: {
43
+ readonly stateKey?: string;
44
+ }): RunEventJournalAppendResult;
45
+ /** Seals current coalescing and diagnostic-gap groups. */
46
+ barrier(): RunEventFlushBarrier;
47
+ /**
48
+ * Deliver everything through the barrier and remove it only after the sink
49
+ * succeeds. A rejected sink leaves the exact batch available for retry.
50
+ */
51
+ flushThrough(barrier: RunEventFlushBarrier, sink: (events: readonly RunEvent[]) => void | Promise<void>): Promise<readonly RunEvent[]>;
52
+ get pending(): number;
53
+ }
54
+
55
+ export { DEFAULT_RUN_EVENT_JOURNAL_LIMITS, type RunEventFlushBarrier, RunEventJournal, type RunEventJournalAppendResult, type RunEventJournalLimits, type RunEventJournalViolationCode };
@@ -0,0 +1,10 @@
1
+ import {
2
+ DEFAULT_RUN_EVENT_JOURNAL_LIMITS,
3
+ RunEventJournal
4
+ } from "./chunk-ZZIYHDJ4.js";
5
+ import "./chunk-CZK6NNP3.js";
6
+ export {
7
+ DEFAULT_RUN_EVENT_JOURNAL_LIMITS,
8
+ RunEventJournal
9
+ };
10
+ //# sourceMappingURL=run-journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,38 @@
1
+ /** Closed first-class lifecycle vocabulary for a Termwright run. */
2
+ declare const RUN_STATES: readonly ["requested", "collecting", "scheduled", "running", "cancelling", "finalizing", "passed", "passed-with-skips", "failed", "skipped", "cancelled", "infrastructure-failed", "crashed", "incomplete", "flaky"];
3
+ type RunState = (typeof RUN_STATES)[number];
4
+ declare const TERMINAL_RUN_STATES: readonly ["passed", "passed-with-skips", "failed", "skipped", "cancelled", "infrastructure-failed", "crashed", "incomplete", "flaky"];
5
+ type TerminalRunState = (typeof TERMINAL_RUN_STATES)[number];
6
+ /** Executable transition graph; consumers must not duplicate this table. */
7
+ declare const RUN_STATE_TRANSITIONS: Readonly<{
8
+ readonly requested: readonly ["collecting", "cancelling", "infrastructure-failed"];
9
+ readonly collecting: readonly ["scheduled", "cancelling", "infrastructure-failed", "incomplete"];
10
+ readonly scheduled: readonly ["running", "cancelling", "finalizing", "infrastructure-failed", "incomplete"];
11
+ readonly running: readonly ["cancelling", "finalizing", "infrastructure-failed", "crashed", "incomplete"];
12
+ readonly cancelling: readonly ["finalizing", "cancelled", "infrastructure-failed", "incomplete"];
13
+ readonly finalizing: readonly ["passed", "passed-with-skips", "failed", "skipped", "cancelled", "infrastructure-failed", "crashed", "incomplete", "flaky"];
14
+ readonly passed: readonly [];
15
+ readonly 'passed-with-skips': readonly [];
16
+ readonly failed: readonly [];
17
+ readonly skipped: readonly [];
18
+ readonly cancelled: readonly [];
19
+ readonly 'infrastructure-failed': readonly [];
20
+ readonly crashed: readonly [];
21
+ readonly incomplete: readonly [];
22
+ readonly flaky: readonly [];
23
+ }>;
24
+ declare function isRunState(value: unknown): value is RunState;
25
+ declare function isTerminalRunState(value: RunState): value is TerminalRunState;
26
+ declare function canTransitionRunState(from: RunState, to: RunState): boolean;
27
+ type RunStateTransitionResult = {
28
+ readonly ok: true;
29
+ readonly from: RunState;
30
+ readonly to: RunState;
31
+ } | {
32
+ readonly ok: false;
33
+ readonly code: 'invalid-run-state' | 'illegal-run-transition';
34
+ readonly detail: string;
35
+ };
36
+ declare function validateRunStateTransition(from: unknown, to: unknown): RunStateTransitionResult;
37
+
38
+ export { RUN_STATES, RUN_STATE_TRANSITIONS, type RunState, type RunStateTransitionResult, TERMINAL_RUN_STATES, type TerminalRunState, canTransitionRunState, isRunState, isTerminalRunState, validateRunStateTransition };
@@ -0,0 +1,19 @@
1
+ import {
2
+ RUN_STATES,
3
+ RUN_STATE_TRANSITIONS,
4
+ TERMINAL_RUN_STATES,
5
+ canTransitionRunState,
6
+ isRunState,
7
+ isTerminalRunState,
8
+ validateRunStateTransition
9
+ } from "./chunk-ODOJRXL6.js";
10
+ export {
11
+ RUN_STATES,
12
+ RUN_STATE_TRANSITIONS,
13
+ TERMINAL_RUN_STATES,
14
+ canTransitionRunState,
15
+ isRunState,
16
+ isTerminalRunState,
17
+ validateRunStateTransition
18
+ };
19
+ //# sourceMappingURL=run-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,22 @@
1
+ /** Versioned declaration metadata shared by test providers and the native host. */
2
+ declare const TERMWRIGHT_PROVIDER_VERSION: 1;
3
+ interface TermwrightProviderMarker {
4
+ readonly id: string;
5
+ readonly version: typeof TERMWRIGHT_PROVIDER_VERSION;
6
+ }
7
+ type TermwrightProviderDeclaredMode = 'run' | 'skip' | 'todo';
8
+ interface TermwrightProviderDeclaration {
9
+ readonly mode: TermwrightProviderDeclaredMode;
10
+ readonly exclusive: boolean;
11
+ }
12
+ interface TermwrightProviderTaskMeta {
13
+ readonly termwright?: {
14
+ readonly provider?: unknown;
15
+ readonly declaration?: unknown;
16
+ };
17
+ }
18
+ declare function termwrightProvider(id: string): TermwrightProviderMarker;
19
+ declare function hasTermwrightProvider(meta: unknown): meta is TermwrightProviderTaskMeta;
20
+ declare function termwrightProviderDeclaration(meta: unknown): TermwrightProviderDeclaration | undefined;
21
+
22
+ export { TERMWRIGHT_PROVIDER_VERSION, type TermwrightProviderDeclaration, type TermwrightProviderDeclaredMode, type TermwrightProviderMarker, type TermwrightProviderTaskMeta, hasTermwrightProvider, termwrightProvider, termwrightProviderDeclaration };
@@ -0,0 +1,32 @@
1
+ // src/test-provider.ts
2
+ var TERMWRIGHT_PROVIDER_VERSION = 1;
3
+ function termwrightProvider(id) {
4
+ if (id === "") throw new TypeError("a Termwright provider id cannot be empty");
5
+ return { id, version: TERMWRIGHT_PROVIDER_VERSION };
6
+ }
7
+ function hasTermwrightProvider(meta) {
8
+ if (typeof meta !== "object" || meta === null) return false;
9
+ const termwright = meta["termwright"];
10
+ if (typeof termwright !== "object" || termwright === null) return false;
11
+ const provider = termwright["provider"];
12
+ if (typeof provider !== "object" || provider === null) return false;
13
+ const record = provider;
14
+ return record["version"] === TERMWRIGHT_PROVIDER_VERSION && typeof record["id"] === "string" && record["id"] !== "";
15
+ }
16
+ function termwrightProviderDeclaration(meta) {
17
+ if (!hasTermwrightProvider(meta)) return void 0;
18
+ const declaration = meta.termwright?.declaration;
19
+ if (typeof declaration !== "object" || declaration === null) return void 0;
20
+ const record = declaration;
21
+ const mode = record["mode"];
22
+ if (mode !== "run" && mode !== "skip" && mode !== "todo") return void 0;
23
+ if (typeof record["exclusive"] !== "boolean") return void 0;
24
+ return { mode, exclusive: record["exclusive"] };
25
+ }
26
+ export {
27
+ TERMWRIGHT_PROVIDER_VERSION,
28
+ hasTermwrightProvider,
29
+ termwrightProvider,
30
+ termwrightProviderDeclaration
31
+ };
32
+ //# sourceMappingURL=test-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/test-provider.ts"],"sourcesContent":["/** Versioned declaration metadata shared by test providers and the native host. */\n\nexport const TERMWRIGHT_PROVIDER_VERSION = 1 as const;\n\nexport interface TermwrightProviderMarker {\n readonly id: string;\n readonly version: typeof TERMWRIGHT_PROVIDER_VERSION;\n}\n\nexport type TermwrightProviderDeclaredMode = 'run' | 'skip' | 'todo';\n\nexport interface TermwrightProviderDeclaration {\n readonly mode: TermwrightProviderDeclaredMode;\n readonly exclusive: boolean;\n}\n\nexport interface TermwrightProviderTaskMeta {\n readonly termwright?: {\n readonly provider?: unknown;\n readonly declaration?: unknown;\n };\n}\n\nexport function termwrightProvider(id: string): TermwrightProviderMarker {\n if (id === '') throw new TypeError('a Termwright provider id cannot be empty');\n return { id, version: TERMWRIGHT_PROVIDER_VERSION };\n}\n\nexport function hasTermwrightProvider(meta: unknown): meta is TermwrightProviderTaskMeta {\n if (typeof meta !== 'object' || meta === null) return false;\n const termwright = (meta as Record<string, unknown>)['termwright'];\n if (typeof termwright !== 'object' || termwright === null) return false;\n const provider = (termwright as Record<string, unknown>)['provider'];\n if (typeof provider !== 'object' || provider === null) return false;\n const record = provider as Record<string, unknown>;\n return (\n record['version'] === TERMWRIGHT_PROVIDER_VERSION &&\n typeof record['id'] === 'string' &&\n record['id'] !== ''\n );\n}\n\nexport function termwrightProviderDeclaration(\n meta: unknown,\n): TermwrightProviderDeclaration | undefined {\n if (!hasTermwrightProvider(meta)) return undefined;\n const declaration = meta.termwright?.declaration;\n if (typeof declaration !== 'object' || declaration === null) return undefined;\n const record = declaration as Record<string, unknown>;\n const mode = record['mode'];\n if (mode !== 'run' && mode !== 'skip' && mode !== 'todo') return undefined;\n if (typeof record['exclusive'] !== 'boolean') return undefined;\n return { mode, exclusive: record['exclusive'] };\n}\n"],"mappings":";AAEO,IAAM,8BAA8B;AAqBpC,SAAS,mBAAmB,IAAsC;AACvE,MAAI,OAAO,GAAI,OAAM,IAAI,UAAU,0CAA0C;AAC7E,SAAO,EAAE,IAAI,SAAS,4BAA4B;AACpD;AAEO,SAAS,sBAAsB,MAAmD;AACvF,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,aAAc,KAAiC,YAAY;AACjE,MAAI,OAAO,eAAe,YAAY,eAAe,KAAM,QAAO;AAClE,QAAM,WAAY,WAAuC,UAAU;AACnE,MAAI,OAAO,aAAa,YAAY,aAAa,KAAM,QAAO;AAC9D,QAAM,SAAS;AACf,SACE,OAAO,SAAS,MAAM,+BACtB,OAAO,OAAO,IAAI,MAAM,YACxB,OAAO,IAAI,MAAM;AAErB;AAEO,SAAS,8BACd,MAC2C;AAC3C,MAAI,CAAC,sBAAsB,IAAI,EAAG,QAAO;AACzC,QAAM,cAAc,KAAK,YAAY;AACrC,MAAI,OAAO,gBAAgB,YAAY,gBAAgB,KAAM,QAAO;AACpE,QAAM,SAAS;AACf,QAAM,OAAO,OAAO,MAAM;AAC1B,MAAI,SAAS,SAAS,SAAS,UAAU,SAAS,OAAQ,QAAO;AACjE,MAAI,OAAO,OAAO,WAAW,MAAM,UAAW,QAAO;AACrD,SAAO,EAAE,MAAM,WAAW,OAAO,WAAW,EAAE;AAChD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@termwright/protocol",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "termwright semantic protocol: schemas, limits, roles, framing, handshake",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,12 +10,40 @@
10
10
  },
11
11
  "type": "module",
12
12
  "engines": {
13
- "node": ">=22"
13
+ "node": "^22.0.0 || ^24.0.0"
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
18
  "import": "./dist/index.js"
19
+ },
20
+ "./contract": {
21
+ "types": "./dist/contract.d.ts",
22
+ "import": "./dist/contract.js"
23
+ },
24
+ "./capability-graph": {
25
+ "types": "./dist/capability-graph.d.ts",
26
+ "import": "./dist/capability-graph.js"
27
+ },
28
+ "./action-model": {
29
+ "types": "./dist/action-model.d.ts",
30
+ "import": "./dist/action-model.js"
31
+ },
32
+ "./run-events": {
33
+ "types": "./dist/run-events.d.ts",
34
+ "import": "./dist/run-events.js"
35
+ },
36
+ "./run-journal": {
37
+ "types": "./dist/run-journal.d.ts",
38
+ "import": "./dist/run-journal.js"
39
+ },
40
+ "./run-state": {
41
+ "types": "./dist/run-state.d.ts",
42
+ "import": "./dist/run-state.js"
43
+ },
44
+ "./test-provider": {
45
+ "types": "./dist/test-provider.d.ts",
46
+ "import": "./dist/test-provider.js"
19
47
  }
20
48
  },
21
49
  "files": [
@@ -25,9 +53,9 @@
25
53
  "zod": "^4.0.0"
26
54
  },
27
55
  "scripts": {
28
- "build": "tsup src/index.ts --format esm --dts --sourcemap",
56
+ "build": "tsup src/index.ts src/contract.ts src/capability-graph.ts src/action-model.ts src/run-events.ts src/run-journal.ts src/run-state.ts src/test-provider.ts --format esm --dts --sourcemap --clean",
29
57
  "typecheck": "tsc --noEmit",
30
- "test": "vitest run",
31
- "test:hostile": "vitest run --config vitest.hostile.config.ts"
58
+ "test": "pnpm --dir ../.. test -- -- --run packages/protocol",
59
+ "test:hostile": "pnpm --dir ../.. test -- -- --run packages/protocol"
32
60
  }
33
61
  }