@victframework/runtime 0.1.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 (115) hide show
  1. package/dist/agent-governance.d.ts +285 -0
  2. package/dist/agent-governance.js +438 -0
  3. package/dist/agent-governance.js.map +1 -0
  4. package/dist/agent-registry.d.ts +103 -0
  5. package/dist/agent-registry.js +758 -0
  6. package/dist/agent-registry.js.map +1 -0
  7. package/dist/agent-types.d.ts +433 -0
  8. package/dist/agent-types.js +480 -0
  9. package/dist/agent-types.js.map +1 -0
  10. package/dist/authority.d.ts +83 -0
  11. package/dist/authority.js +170 -0
  12. package/dist/authority.js.map +1 -0
  13. package/dist/boundary-conformance.d.ts +51 -0
  14. package/dist/boundary-conformance.js +364 -0
  15. package/dist/boundary-conformance.js.map +1 -0
  16. package/dist/control-conformance.d.ts +68 -0
  17. package/dist/control-conformance.js +1131 -0
  18. package/dist/control-conformance.js.map +1 -0
  19. package/dist/control-in-memory.d.ts +257 -0
  20. package/dist/control-in-memory.js +886 -0
  21. package/dist/control-in-memory.js.map +1 -0
  22. package/dist/control-types.d.ts +1017 -0
  23. package/dist/control-types.js +779 -0
  24. package/dist/control-types.js.map +1 -0
  25. package/dist/durable-run.d.ts +73 -0
  26. package/dist/durable-run.js +262 -0
  27. package/dist/durable-run.js.map +1 -0
  28. package/dist/effect-policy.d.ts +22 -0
  29. package/dist/effect-policy.js +45 -0
  30. package/dist/effect-policy.js.map +1 -0
  31. package/dist/errors.d.ts +36 -0
  32. package/dist/errors.js +71 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/in-memory-stores.d.ts +16 -0
  35. package/dist/in-memory-stores.js +522 -0
  36. package/dist/in-memory-stores.js.map +1 -0
  37. package/dist/index.d.ts +41 -0
  38. package/dist/index.js +26 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/operator-config.d.ts +141 -0
  41. package/dist/operator-config.js +289 -0
  42. package/dist/operator-config.js.map +1 -0
  43. package/dist/orchestration-activation.d.ts +116 -0
  44. package/dist/orchestration-activation.js +223 -0
  45. package/dist/orchestration-activation.js.map +1 -0
  46. package/dist/orchestration-canary-conformance.d.ts +10 -0
  47. package/dist/orchestration-canary-conformance.js +726 -0
  48. package/dist/orchestration-canary-conformance.js.map +1 -0
  49. package/dist/orchestration-commands.d.ts +47 -0
  50. package/dist/orchestration-commands.js +538 -0
  51. package/dist/orchestration-commands.js.map +1 -0
  52. package/dist/orchestration-conformance.d.ts +59 -0
  53. package/dist/orchestration-conformance.js +594 -0
  54. package/dist/orchestration-conformance.js.map +1 -0
  55. package/dist/orchestration-driver-types.d.ts +163 -0
  56. package/dist/orchestration-driver-types.js +21 -0
  57. package/dist/orchestration-driver-types.js.map +1 -0
  58. package/dist/orchestration-driver.d.ts +48 -0
  59. package/dist/orchestration-driver.js +1030 -0
  60. package/dist/orchestration-driver.js.map +1 -0
  61. package/dist/orchestration-in-memory.d.ts +18 -0
  62. package/dist/orchestration-in-memory.js +1313 -0
  63. package/dist/orchestration-in-memory.js.map +1 -0
  64. package/dist/orchestration-join-conformance.d.ts +20 -0
  65. package/dist/orchestration-join-conformance.js +542 -0
  66. package/dist/orchestration-join-conformance.js.map +1 -0
  67. package/dist/orchestration-plan.d.ts +52 -0
  68. package/dist/orchestration-plan.js +265 -0
  69. package/dist/orchestration-plan.js.map +1 -0
  70. package/dist/orchestration-race-conformance.d.ts +35 -0
  71. package/dist/orchestration-race-conformance.js +1265 -0
  72. package/dist/orchestration-race-conformance.js.map +1 -0
  73. package/dist/orchestration-remediation-conformance.d.ts +54 -0
  74. package/dist/orchestration-remediation-conformance.js +632 -0
  75. package/dist/orchestration-remediation-conformance.js.map +1 -0
  76. package/dist/orchestration-store-types.d.ts +568 -0
  77. package/dist/orchestration-store-types.js +2 -0
  78. package/dist/orchestration-store-types.js.map +1 -0
  79. package/dist/pack-conformance.d.ts +59 -0
  80. package/dist/pack-conformance.js +222 -0
  81. package/dist/pack-conformance.js.map +1 -0
  82. package/dist/pack-install.d.ts +44 -0
  83. package/dist/pack-install.js +126 -0
  84. package/dist/pack-install.js.map +1 -0
  85. package/dist/registry.d.ts +107 -0
  86. package/dist/registry.js +481 -0
  87. package/dist/registry.js.map +1 -0
  88. package/dist/runtime.d.ts +158 -0
  89. package/dist/runtime.js +1341 -0
  90. package/dist/runtime.js.map +1 -0
  91. package/dist/serialization.d.ts +26 -0
  92. package/dist/serialization.js +162 -0
  93. package/dist/serialization.js.map +1 -0
  94. package/dist/store-conformance.d.ts +45 -0
  95. package/dist/store-conformance.js +876 -0
  96. package/dist/store-conformance.js.map +1 -0
  97. package/dist/store-errors.d.ts +49 -0
  98. package/dist/store-errors.js +48 -0
  99. package/dist/store-errors.js.map +1 -0
  100. package/dist/store-types.d.ts +331 -0
  101. package/dist/store-types.js +14 -0
  102. package/dist/store-types.js.map +1 -0
  103. package/dist/store-validation.d.ts +63 -0
  104. package/dist/store-validation.js +164 -0
  105. package/dist/store-validation.js.map +1 -0
  106. package/dist/stream-hub.d.ts +151 -0
  107. package/dist/stream-hub.js +402 -0
  108. package/dist/stream-hub.js.map +1 -0
  109. package/dist/testing.d.ts +25 -0
  110. package/dist/testing.js +19 -0
  111. package/dist/testing.js.map +1 -0
  112. package/dist/types.d.ts +221 -0
  113. package/dist/types.js +2 -0
  114. package/dist/types.js.map +1 -0
  115. package/package.json +45 -0
@@ -0,0 +1,221 @@
1
+ import type { GraphIssue, KernelEvent, OutputSummary, RunStatus } from '@victframework/kernel';
2
+ import type { VictError } from '@victframework/contracts';
3
+ import type { VictStores } from './store-types.js';
4
+ /**
5
+ * Stage 04: capability authoring declarations (capability context,
6
+ * capability definition, double invocation, effect/execution modes) now
7
+ * live in `@victframework/sdk`, the authoring ABI below the kernel and runtime. The
8
+ * runtime consumes them; they are re-exported here (and from the runtime
9
+ * index) for consumer convenience — `@victframework/sdk` is the single home.
10
+ */
11
+ export type { CapabilityConfigReader, CapabilityContext, CapabilityDefinition, CapabilitySecretReader, DoubleInvoke, EffectClass, ExecutionMode, } from '@victframework/sdk';
12
+ import type { ExecutionMode } from '@victframework/sdk';
13
+ /**
14
+ * How much payload data the runtime retains in stored run records.
15
+ *
16
+ * - `'none'`: retain metadata, status, trace and sanitised error only.
17
+ * - `'summary'` (default): additionally retain the safe output summary
18
+ * (shape/length/key-names, secret-like key names redacted).
19
+ * - `'full'`: additionally retain the complete validated output. Explicit
20
+ * opt-in for runtimes that legitimately need full payload history.
21
+ *
22
+ * `RunResult` returned to the caller always carries the actual validated
23
+ * output regardless of retention; retention governs *stored history* only.
24
+ *
25
+ * WARNING (full retention): selecting `'full'` makes the caller/operator
26
+ * responsible for the sensitivity, access control, minimization, and
27
+ * lifecycle of the complete output that will be persisted. Vict cannot make
28
+ * arbitrary retained payloads safe merely by labeling the mode; pair `'full'`
29
+ * with an explicit deletion/lifecycle policy and access control. Inputs are
30
+ * never stored in Stage 02, including under `'full'` retention.
31
+ */
32
+ export type PayloadRetention = 'none' | 'summary' | 'full';
33
+ export interface RunResult<T = unknown> {
34
+ readonly runId: string;
35
+ readonly graphId: string;
36
+ readonly graphVersion: string;
37
+ readonly capabilitySetVersion: string;
38
+ readonly activationVersion: string;
39
+ readonly status: RunStatus;
40
+ readonly output?: T;
41
+ readonly error?: VictError;
42
+ readonly trace: readonly KernelEvent[];
43
+ /** Safe open-wait descriptors when a durable orchestration run is waiting. */
44
+ readonly waits?: readonly {
45
+ readonly waitId: string;
46
+ readonly kind: 'signal' | 'timer';
47
+ readonly signalName?: string;
48
+ readonly dueAt?: number;
49
+ }[];
50
+ readonly steps?: number;
51
+ }
52
+ export interface RunOptions {
53
+ /** Defaults to `'normal'`. */
54
+ readonly mode?: ExecutionMode;
55
+ /** Explicit policy permissions, e.g. allowing irreversible effects in normal mode. */
56
+ readonly policy?: {
57
+ readonly allowIrreversible?: boolean;
58
+ };
59
+ readonly maxSteps?: number;
60
+ /** Streaming hook for run events. */
61
+ readonly onEvent?: (event: KernelEvent) => void;
62
+ /** Local worker-pool bound for durable orchestration runs (default 4, max 32). */
63
+ readonly concurrency?: number;
64
+ }
65
+ export interface RunNodeOptions {
66
+ readonly maxSteps?: number;
67
+ readonly onEvent?: (event: KernelEvent) => void;
68
+ }
69
+ export interface ActiveGraphInfo {
70
+ readonly id: string;
71
+ /** Topology/declaration identity. Does not identify executable semantics. */
72
+ readonly version: string;
73
+ /** Identity of the effective capability/contract bindings. */
74
+ readonly capabilitySetVersion: string;
75
+ /** Identity of the exact executable activation. */
76
+ readonly activationVersion: string;
77
+ readonly entryNodeId: string;
78
+ readonly nodeCount: number;
79
+ }
80
+ export type ActivationResult = {
81
+ readonly ok: true;
82
+ readonly graphId: string;
83
+ readonly graphVersion: string;
84
+ readonly capabilitySetVersion: string;
85
+ readonly activationVersion: string;
86
+ readonly nodeCount: number;
87
+ } | {
88
+ readonly ok: false;
89
+ readonly issues: readonly GraphIssue[];
90
+ readonly previousGraph?: ActiveGraphInfo;
91
+ };
92
+ /** Why an exact-activation restoration failed. */
93
+ export type RestorationFailureCode = 'VICT_RUNTIME_ACTIVATION_NOT_FOUND' | 'VICT_RUNTIME_ACTIVATION_MISMATCH' | 'VICT_RUNTIME_ACTIVATION_UNAVAILABLE';
94
+ /**
95
+ * Result of restoring an activation from the durable catalog.
96
+ *
97
+ * Restoration verifies availability against the current registered code:
98
+ * it never executes a capability, never chooses a “closest” revision, and
99
+ * never replaces the currently active graph on failure.
100
+ */
101
+ export type RestorationResult = {
102
+ readonly ok: true;
103
+ readonly graphId: string;
104
+ readonly graphVersion: string;
105
+ readonly capabilitySetVersion: string;
106
+ readonly activationVersion: string;
107
+ readonly nodeCount: number;
108
+ } | {
109
+ readonly ok: false;
110
+ readonly code: RestorationFailureCode;
111
+ readonly message: string;
112
+ /** Stored activation identity, when one was found. */
113
+ readonly expectedActivationVersion?: string;
114
+ /** Identity rebuilt from current code, when compilation succeeded. */
115
+ readonly actualActivationVersion?: string;
116
+ /** Safe description of what differs, for mismatches. */
117
+ readonly differences?: readonly string[];
118
+ /** Compile issues, when current code cannot compile the graph at all. */
119
+ readonly issues?: readonly GraphIssue[];
120
+ };
121
+ /**
122
+ * A stored run record (assembled view: run state plus its ordered trace).
123
+ *
124
+ * Retention policy (see `PayloadRetention`):
125
+ * - `trace` is always the safe, summarized event stream (values never).
126
+ * - `error` is always the sanitised structured error.
127
+ * - `outputSummary` (safe shape/key description) appears under `'summary'`
128
+ * and `'full'`.
129
+ * - `output` (the complete validated payload) appears ONLY under `'full'`.
130
+ * Selecting `'full'` makes the caller/operator responsible for the
131
+ * sensitivity, access control, minimization, and lifecycle of the
132
+ * complete persisted output.
133
+ */
134
+ export interface RunRecord {
135
+ readonly runId: string;
136
+ readonly graphId: string;
137
+ readonly graphVersion: string;
138
+ readonly capabilitySetVersion: string;
139
+ readonly activationVersion: string;
140
+ readonly mode: ExecutionMode;
141
+ /** Lifecycle status. `running` means nonterminal (in flight or interrupted). */
142
+ readonly status: RunStatus | 'running';
143
+ readonly startedAt: number;
144
+ readonly durationMs: number;
145
+ readonly steps: number;
146
+ readonly retention: PayloadRetention;
147
+ /** Last durable node context, when known. Never a payload value. */
148
+ readonly currentNodeId?: string | null;
149
+ /** Durable record revision; increments with every committed transition. */
150
+ readonly recordRevision: number;
151
+ readonly outputSummary?: OutputSummary;
152
+ /** Complete validated output — present only when retention is `'full'`. */
153
+ readonly output?: unknown;
154
+ /** Sanitised structured error (safe code, safe message, safe details). */
155
+ readonly error?: VictError;
156
+ readonly trace: readonly KernelEvent[];
157
+ }
158
+ export interface VictRuntimeOptions {
159
+ /** Default policy permissions applied to every run unless overridden per run. */
160
+ readonly policy?: {
161
+ readonly allowIrreversible?: boolean;
162
+ };
163
+ /**
164
+ * Stage 04 least-authority boundary: explicit permission grants plus the
165
+ * configuration/secret ports that scoped capability readers resolve
166
+ * through. Capability packs declare the names they require; anything
167
+ * undeclared or ungranted fails before the handler runs.
168
+ */
169
+ readonly authority?: {
170
+ readonly grants?: readonly string[];
171
+ readonly configuration?: {
172
+ readonly get: (name: string) => unknown;
173
+ };
174
+ readonly secrets?: {
175
+ readonly get: (name: string) => Promise<string | undefined>;
176
+ };
177
+ };
178
+ /**
179
+ * Durable activation/execution stores. Defaults to a private in-memory
180
+ * store set with identical semantics. To persist across process restarts
181
+ * inject an adapter such as `createSqliteStores()` from `@victframework/store-sqlite`.
182
+ */
183
+ readonly stores?: VictStores;
184
+ /** Clock used for run and event timestamps. Defaults to the system clock. */
185
+ readonly clock?: {
186
+ readonly now: () => number;
187
+ };
188
+ /** Identity factory for run ids. Defaults to random UUID-based ids. */
189
+ readonly ids?: {
190
+ readonly runId: () => string;
191
+ readonly errorId?: () => string;
192
+ };
193
+ readonly maxSteps?: number;
194
+ /**
195
+ * Payload retention for stored run records. Default: `'summary'`.
196
+ *
197
+ * WARNING: `'full'` persists the complete validated output of every run.
198
+ * Selecting full retention makes the caller/operator responsible for the
199
+ * sensitivity, access control, minimization, and lifecycle of the complete
200
+ * output that will be persisted. Use only with explicit intent and an
201
+ * explicit deletion/lifecycle policy.
202
+ */
203
+ readonly payloadRetention?: PayloadRetention;
204
+ /**
205
+ * Stage 03 durable orchestration options.
206
+ *
207
+ * - `concurrency`: default local worker-pool bound (default 4, max 32).
208
+ * - `operatorAuthorized`: explicit operator authorization for the bounded
209
+ * blocked-run resolution API. DENIED by default.
210
+ * - `time`: injected time port (now/delay) for deterministic tests.
211
+ * - `ownerId`: stable process/worker owner id for claim leases.
212
+ */
213
+ readonly orchestration?: {
214
+ readonly concurrency?: number;
215
+ readonly operatorAuthorized?: boolean;
216
+ readonly time?: import('./orchestration-driver-types.js').OrchestrationTimePort;
217
+ readonly ownerId?: string;
218
+ /** Claim lease duration in ms (default 30000). */
219
+ readonly leaseMs?: number;
220
+ };
221
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@victframework/runtime",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "In-process Vict runtime: capability registry, effect policy, execution modes, atomic graph activation, run traces.",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./testing": {
12
+ "types": "./dist/testing.d.ts",
13
+ "default": "./dist/testing.js"
14
+ }
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json"
23
+ },
24
+ "dependencies": {
25
+ "@victframework/contracts": "0.1.0",
26
+ "@victframework/kernel": "0.1.0",
27
+ "@victframework/sdk": "0.1.0"
28
+ },
29
+ "license": "Apache-2.0",
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/radz2291/vict-02.git",
36
+ "directory": "packages/runtime"
37
+ },
38
+ "engines": {
39
+ "node": ">=22.13.0"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/radz2291/vict-02/issues"
43
+ },
44
+ "homepage": "https://github.com/radz2291/vict-02#readme"
45
+ }