@manifesto-ai/core 2.13.0 → 5.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.
- package/README.md +45 -16
- package/dist/core/action-availability.d.ts +43 -3
- package/dist/core/apply.d.ts +10 -4
- package/dist/core/compute.d.ts +3 -3
- package/dist/core/context-validation.d.ts +11 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/errors.d.ts +3 -0
- package/dist/evaluator/context.d.ts +29 -4
- package/dist/evaluator/flow.d.ts +2 -0
- package/dist/factories.d.ts +4 -4
- package/dist/index.d.ts +18 -7
- package/dist/index.js +1 -1
- package/dist/schema/context.d.ts +17 -0
- package/dist/schema/domain.d.ts +9 -0
- package/dist/schema/flow.d.ts +46 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/patch.d.ts +5 -1
- package/dist/schema/result.d.ts +78 -6
- package/dist/schema/snapshot.d.ts +14 -1
- package/dist/schema/trace.d.ts +2 -0
- package/dist/utils/hash.d.ts +4 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/json-value.d.ts +26 -0
- package/package.json +6 -5
- package/dist/schema/host-context.d.ts +0 -11
package/dist/schema/result.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const SystemDelta: z.ZodObject<{
|
|
|
31
31
|
timestamp: z.ZodNumber;
|
|
32
32
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
33
33
|
}, z.core.$strip>>>;
|
|
34
|
-
addRequirements: z.ZodArray<z.ZodObject<{
|
|
34
|
+
addRequirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
35
|
id: z.ZodString;
|
|
36
36
|
type: z.ZodString;
|
|
37
37
|
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -41,10 +41,49 @@ export declare const SystemDelta: z.ZodObject<{
|
|
|
41
41
|
snapshotVersion: z.ZodNumber;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
43
|
createdAt: z.ZodNumber;
|
|
44
|
-
}, z.core.$strip
|
|
45
|
-
removeRequirementIds: z.ZodArray<z.ZodString
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
removeRequirementIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type SystemDelta = z.infer<typeof SystemDelta>;
|
|
48
|
+
/**
|
|
49
|
+
* NamespaceDelta - Declarative namespace transition.
|
|
50
|
+
*
|
|
51
|
+
* Patch paths are rooted at snapshot.namespaces[namespace].
|
|
52
|
+
*/
|
|
53
|
+
export declare const NamespaceDelta: z.ZodObject<{
|
|
54
|
+
namespace: z.ZodString;
|
|
55
|
+
patches: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
+
op: z.ZodLiteral<"set">;
|
|
57
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"prop">;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"index">;
|
|
62
|
+
index: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>], "kind">>;
|
|
64
|
+
value: z.ZodUnknown;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
op: z.ZodLiteral<"unset">;
|
|
67
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
+
kind: z.ZodLiteral<"prop">;
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"index">;
|
|
72
|
+
index: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>], "kind">>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
op: z.ZodLiteral<"merge">;
|
|
76
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
77
|
+
kind: z.ZodLiteral<"prop">;
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
kind: z.ZodLiteral<"index">;
|
|
81
|
+
index: z.ZodNumber;
|
|
82
|
+
}, z.core.$strip>], "kind">>;
|
|
83
|
+
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
84
|
+
}, z.core.$strip>], "op">>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type NamespaceDelta = z.infer<typeof NamespaceDelta>;
|
|
48
87
|
/**
|
|
49
88
|
* ComputeResult - Result of compute() call
|
|
50
89
|
*/
|
|
@@ -79,6 +118,39 @@ export declare const ComputeResult: z.ZodObject<{
|
|
|
79
118
|
}, z.core.$strip>], "kind">>;
|
|
80
119
|
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
81
120
|
}, z.core.$strip>], "op">>;
|
|
121
|
+
namespaceDelta: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
122
|
+
namespace: z.ZodString;
|
|
123
|
+
patches: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
124
|
+
op: z.ZodLiteral<"set">;
|
|
125
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
126
|
+
kind: z.ZodLiteral<"prop">;
|
|
127
|
+
name: z.ZodString;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"index">;
|
|
130
|
+
index: z.ZodNumber;
|
|
131
|
+
}, z.core.$strip>], "kind">>;
|
|
132
|
+
value: z.ZodUnknown;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
op: z.ZodLiteral<"unset">;
|
|
135
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
136
|
+
kind: z.ZodLiteral<"prop">;
|
|
137
|
+
name: z.ZodString;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
kind: z.ZodLiteral<"index">;
|
|
140
|
+
index: z.ZodNumber;
|
|
141
|
+
}, z.core.$strip>], "kind">>;
|
|
142
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
143
|
+
op: z.ZodLiteral<"merge">;
|
|
144
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"prop">;
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
kind: z.ZodLiteral<"index">;
|
|
149
|
+
index: z.ZodNumber;
|
|
150
|
+
}, z.core.$strip>], "kind">>;
|
|
151
|
+
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
152
|
+
}, z.core.$strip>], "op">>;
|
|
153
|
+
}, z.core.$strip>>>;
|
|
82
154
|
systemDelta: z.ZodObject<{
|
|
83
155
|
status: z.ZodOptional<z.ZodEnum<{
|
|
84
156
|
error: "error";
|
|
@@ -97,7 +169,7 @@ export declare const ComputeResult: z.ZodObject<{
|
|
|
97
169
|
timestamp: z.ZodNumber;
|
|
98
170
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
99
171
|
}, z.core.$strip>>>;
|
|
100
|
-
addRequirements: z.ZodArray<z.ZodObject<{
|
|
172
|
+
addRequirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
101
173
|
id: z.ZodString;
|
|
102
174
|
type: z.ZodString;
|
|
103
175
|
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -107,8 +179,8 @@ export declare const ComputeResult: z.ZodObject<{
|
|
|
107
179
|
snapshotVersion: z.ZodNumber;
|
|
108
180
|
}, z.core.$strip>;
|
|
109
181
|
createdAt: z.ZodNumber;
|
|
110
|
-
}, z.core.$strip
|
|
111
|
-
removeRequirementIds: z.ZodArray<z.ZodString
|
|
182
|
+
}, z.core.$strip>>>;
|
|
183
|
+
removeRequirementIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
184
|
}, z.core.$strip>;
|
|
113
185
|
trace: z.ZodObject<{
|
|
114
186
|
root: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
|
|
@@ -80,12 +80,20 @@ export declare const SnapshotMeta: z.ZodObject<{
|
|
|
80
80
|
schemaHash: z.ZodString;
|
|
81
81
|
}, z.core.$strip>;
|
|
82
82
|
export type SnapshotMeta = z.infer<typeof SnapshotMeta>;
|
|
83
|
+
/**
|
|
84
|
+
* SnapshotNamespaces - Opaque platform/runtime/tooling namespaces.
|
|
85
|
+
*
|
|
86
|
+
* Core owns only the container contract. Namespace names and nested shapes are
|
|
87
|
+
* package-owned and must not be encoded in Core's canonical Snapshot type.
|
|
88
|
+
*/
|
|
89
|
+
export declare const SnapshotNamespaces: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
90
|
+
export type SnapshotNamespaces = z.infer<typeof SnapshotNamespaces>;
|
|
83
91
|
/**
|
|
84
92
|
* Snapshot - Immutable, point-in-time representation of world state.
|
|
85
93
|
* This is the ONLY medium of communication between Core and Host.
|
|
86
94
|
*/
|
|
87
95
|
export declare const Snapshot: z.ZodObject<{
|
|
88
|
-
|
|
96
|
+
state: z.ZodUnknown;
|
|
89
97
|
computed: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
90
98
|
system: z.ZodObject<{
|
|
91
99
|
status: z.ZodEnum<{
|
|
@@ -124,9 +132,14 @@ export declare const Snapshot: z.ZodObject<{
|
|
|
124
132
|
randomSeed: z.ZodString;
|
|
125
133
|
schemaHash: z.ZodString;
|
|
126
134
|
}, z.core.$strip>;
|
|
135
|
+
namespaces: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
127
136
|
}, z.core.$strip>;
|
|
128
137
|
export type Snapshot = z.infer<typeof Snapshot>;
|
|
129
138
|
/**
|
|
130
139
|
* Create initial system state
|
|
131
140
|
*/
|
|
132
141
|
export declare function createInitialSystemState(): SystemState;
|
|
142
|
+
/**
|
|
143
|
+
* Create initial namespace container.
|
|
144
|
+
*/
|
|
145
|
+
export declare function createInitialNamespaces(): SnapshotNamespaces;
|
package/dist/schema/trace.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export declare const TraceNodeKind: z.ZodEnum<{
|
|
|
11
11
|
call: "call";
|
|
12
12
|
flow: "flow";
|
|
13
13
|
halt: "halt";
|
|
14
|
+
namespaceRead: "namespaceRead";
|
|
15
|
+
namespaceDelta: "namespaceDelta";
|
|
14
16
|
branch: "branch";
|
|
15
17
|
}>;
|
|
16
18
|
export type TraceNodeKind = z.infer<typeof TraceNodeKind>;
|
package/dist/utils/hash.d.ts
CHANGED
package/dist/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON value-domain validation for snapshot/patch write boundaries.
|
|
3
|
+
*
|
|
4
|
+
* Manifesto state is required to be JSON-serializable and canonical
|
|
5
|
+
* (constitution §2.6 "Schema-first"). Values that JSON cannot represent
|
|
6
|
+
* must be rejected at the write boundary instead of being silently
|
|
7
|
+
* dropped or coerced later by canonicalization/hashing (#480).
|
|
8
|
+
*
|
|
9
|
+
* Accepted: null, string, boolean, finite number, arrays of accepted
|
|
10
|
+
* values, and plain objects (Object.prototype or null prototype) of
|
|
11
|
+
* accepted values.
|
|
12
|
+
*
|
|
13
|
+
* Notes:
|
|
14
|
+
* - -0 is accepted. JSON canonicalization normalizes it to 0, but
|
|
15
|
+
* rejecting it would fail innocent arithmetic results (e.g. mul(0, -1)).
|
|
16
|
+
* - Shared (non-cyclic) references are accepted; JSON duplicates them.
|
|
17
|
+
*/
|
|
18
|
+
export type JsonValueViolation = {
|
|
19
|
+
readonly path: string;
|
|
20
|
+
readonly reason: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns the first JSON value-domain violation found in `value`, or null
|
|
24
|
+
* when the value is fully JSON-compatible. Pure and total: never throws.
|
|
25
|
+
*/
|
|
26
|
+
export declare function findJsonValueViolation(value: unknown, basePath?: string): JsonValueViolation | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifesto-ai/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Manifesto Core - Pure semantic calculator for deterministic state computation",
|
|
5
5
|
"author": "eggplantiny <eggplantiny@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,14 +41,15 @@
|
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vite": "^8.0.8",
|
|
43
43
|
"vitest": "^4.1.4",
|
|
44
|
-
"zod": "^4.3.6"
|
|
44
|
+
"zod": "^4.3.6",
|
|
45
|
+
"@manifesto-ai/cts-kit": "5.0.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"build": "rm -rf dist && tsup && tsc -p tsconfig.build.json --emitDeclarationOnly --declarationMap false --outDir dist",
|
|
48
49
|
"dev": "tsc --watch",
|
|
49
50
|
"clean": "rm -rf dist",
|
|
50
|
-
"lint": "
|
|
51
|
-
"test": "node ../../
|
|
52
|
-
"test:coverage": "node ../../
|
|
51
|
+
"lint": "node ../../node_modules/@biomejs/biome/bin/biome check src",
|
|
52
|
+
"test": "node ../../scripts/run-vitest.mjs run",
|
|
53
|
+
"test:coverage": "node ../../scripts/run-vitest.mjs run --coverage"
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* HostContext - Explicit host-provided inputs for determinism
|
|
4
|
-
*/
|
|
5
|
-
export declare const HostContext: z.ZodObject<{
|
|
6
|
-
now: z.ZodNumber;
|
|
7
|
-
randomSeed: z.ZodString;
|
|
8
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
9
|
-
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
export type HostContext = z.infer<typeof HostContext>;
|