@manifesto-ai/core 2.9.0 → 2.11.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 +5 -4
- package/dist/core/action-availability.d.ts +19 -1
- package/dist/core/compute.d.ts +5 -0
- package/dist/core/type-definition-utils.d.ts +18 -0
- package/dist/core/validate.d.ts +2 -0
- package/dist/core/validation-utils.d.ts +2 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +1 -18499
- package/dist/index.js.map +1 -1
- package/dist/schema/action.d.ts +4 -0
- package/dist/schema/domain.d.ts +4 -0
- package/dist/schema/field.d.ts +2 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Host -> CORE -> ComputeResult
|
|
|
37
37
|
| Execute effects | Host |
|
|
38
38
|
| Perform IO (network, filesystem) | Host |
|
|
39
39
|
| Persist snapshots | Host |
|
|
40
|
-
| Govern authority/proposals |
|
|
40
|
+
| Govern authority/proposals | `@manifesto-ai/governance` + `@manifesto-ai/lineage` |
|
|
41
41
|
| Handle UI/event bindings | SDK |
|
|
42
42
|
|
|
43
43
|
---
|
|
@@ -140,7 +140,7 @@ type Patch = { op: "set" | "unset" | "merge", path, value? };
|
|
|
140
140
|
type ComputeResult = { status, snapshot, requirements, trace };
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
> See [SPEC
|
|
143
|
+
> See [core-SPEC.md](docs/core-SPEC.md) for the current living specification.
|
|
144
144
|
|
|
145
145
|
---
|
|
146
146
|
|
|
@@ -195,8 +195,9 @@ For typical usage, see [`@manifesto-ai/sdk`](../sdk/) — the recommended entry
|
|
|
195
195
|
| Document | Purpose |
|
|
196
196
|
|----------|---------|
|
|
197
197
|
| [GUIDE.md](docs/GUIDE.md) | Step-by-step usage guide |
|
|
198
|
-
| [SPEC
|
|
199
|
-
| [
|
|
198
|
+
| [core-SPEC.md](docs/core-SPEC.md) | Current living specification |
|
|
199
|
+
| [VERSION-INDEX.md](docs/VERSION-INDEX.md) | Current and historical document map |
|
|
200
|
+
| [FDR-v1.0.0.md](docs/FDR-v1.0.0.md) | Historical design rationale |
|
|
200
201
|
|
|
201
202
|
---
|
|
202
203
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { DomainSchema } from "../schema/domain.js";
|
|
2
2
|
import type { Snapshot } from "../schema/snapshot.js";
|
|
3
|
+
import type { Intent } from "../schema/patch.js";
|
|
3
4
|
type ActionAvailabilityErrorCode = "UNKNOWN_ACTION" | "INTERNAL_ERROR" | "TYPE_MISMATCH";
|
|
5
|
+
type ActionDispatchabilityErrorCode = "UNKNOWN_ACTION" | "INTERNAL_ERROR" | "TYPE_MISMATCH";
|
|
4
6
|
export type ActionAvailabilityEvaluation = {
|
|
5
7
|
kind: "ok";
|
|
6
8
|
available: boolean;
|
|
@@ -9,6 +11,14 @@ export type ActionAvailabilityEvaluation = {
|
|
|
9
11
|
code: ActionAvailabilityErrorCode;
|
|
10
12
|
message: string;
|
|
11
13
|
};
|
|
14
|
+
export type ActionDispatchabilityEvaluation = {
|
|
15
|
+
kind: "ok";
|
|
16
|
+
dispatchable: boolean;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "error";
|
|
19
|
+
code: ActionDispatchabilityErrorCode;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
12
22
|
/**
|
|
13
23
|
* Evaluate an action's availability expression without re-entry semantics.
|
|
14
24
|
*
|
|
@@ -21,7 +31,15 @@ export declare function evaluateActionAvailability(schema: DomainSchema, snapsho
|
|
|
21
31
|
*/
|
|
22
32
|
export declare function isActionAvailable(schema: DomainSchema, snapshot: Snapshot, actionName: string): boolean;
|
|
23
33
|
/**
|
|
24
|
-
*
|
|
34
|
+
* Evaluate whether a specific bound intent is dispatchable.
|
|
35
|
+
*/
|
|
36
|
+
export declare function evaluateIntentDispatchability(schema: DomainSchema, snapshot: Snapshot, intent: Intent, timestamp?: number): ActionDispatchabilityEvaluation;
|
|
37
|
+
/**
|
|
38
|
+
* Check whether a specific bound intent is dispatchable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isIntentDispatchable(schema: DomainSchema, snapshot: Snapshot, intent: Intent): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Return all currently available actions in schema key order.
|
|
25
43
|
*/
|
|
26
44
|
export declare function getAvailableActions(schema: DomainSchema, snapshot: Snapshot): readonly string[];
|
|
27
45
|
export {};
|
package/dist/core/compute.d.ts
CHANGED
|
@@ -14,3 +14,8 @@ export declare function computeSync(schema: DomainSchema, snapshot: Snapshot, in
|
|
|
14
14
|
* Compute the result of dispatching an intent (async wrapper).
|
|
15
15
|
*/
|
|
16
16
|
export declare function compute(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): Promise<ComputeResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Validate only the caller-provided input portion of an intent.
|
|
19
|
+
* Returns an error message when the intent is malformed, or null when valid.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateIntentInput(schema: DomainSchema, intent: Intent): string | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PatchSegment } from "../schema/patch.js";
|
|
2
|
+
import type { StateSpec } from "../schema/field.js";
|
|
3
|
+
import type { TypeDefinition, TypeSpec } from "../schema/type-spec.js";
|
|
4
|
+
export type TypeValidationOptions = {
|
|
5
|
+
allowPartial?: boolean;
|
|
6
|
+
allowUndefined?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type TypeValidationResult = {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
message?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function resolveTypeDefinition(definition: TypeDefinition, types: Record<string, TypeSpec>, seenRefs?: readonly string[]): TypeDefinition | null;
|
|
13
|
+
export declare function pathExistsInTypeDefinition(definition: TypeDefinition, types: Record<string, TypeSpec>, path: string): boolean;
|
|
14
|
+
export declare function pathExistsInTypeDefinitionSegments(definition: TypeDefinition, types: Record<string, TypeSpec>, segments: readonly string[]): boolean;
|
|
15
|
+
export declare function getTypeDefinitionAtSegments(definition: TypeDefinition, types: Record<string, TypeSpec>, segments: readonly PatchSegment[]): TypeDefinition | null;
|
|
16
|
+
export declare function getStateTypeDefinitionAtSegments(state: StateSpec, types: Record<string, TypeSpec>, segments: readonly PatchSegment[]): TypeDefinition | null;
|
|
17
|
+
export declare function validateValueAgainstTypeDefinition(value: unknown, definition: TypeDefinition, types: Record<string, TypeSpec>, options?: TypeValidationOptions): TypeValidationResult;
|
|
18
|
+
export {};
|
package/dist/core/validate.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { ValidationResult } from "../schema/result.js";
|
|
|
9
9
|
* - V-004: All `call` references in FlowSpec MUST exist
|
|
10
10
|
* - V-005: FlowSpec `call` graph MUST be acyclic
|
|
11
11
|
* - V-006: ActionSpec.available expression MUST return boolean (runtime check)
|
|
12
|
+
* - V-009: ActionSpec.dispatchable expression MUST return boolean (runtime check)
|
|
13
|
+
* - V-010: Typing seams MUST align with compatibility carriers and resolve refs
|
|
12
14
|
* - V-007: ActionSpec.input MUST be valid FieldSpec (Zod handles this)
|
|
13
15
|
* - V-008: Schema hash MUST match canonical hash
|
|
14
16
|
*/
|
|
@@ -3,11 +3,12 @@ import type { FlowNode } from "../schema/flow.js";
|
|
|
3
3
|
import type { FieldSpec, StateSpec } from "../schema/field.js";
|
|
4
4
|
import type { ComputedSpec } from "../schema/computed.js";
|
|
5
5
|
import type { PatchSegment } from "../schema/patch.js";
|
|
6
|
+
import type { TypeSpec } from "../schema/type-spec.js";
|
|
6
7
|
export declare function isValidSchemaId(id: string): boolean;
|
|
7
8
|
export declare function isValidSemver(version: string): boolean;
|
|
8
9
|
export declare function collectGetPathsFromExpr(expr: ExprNode): string[];
|
|
9
10
|
export declare function collectGetPathsFromFlow(flow: FlowNode): string[];
|
|
10
|
-
export declare function pathExistsInStateSpec(state: StateSpec, path: string): boolean;
|
|
11
|
+
export declare function pathExistsInStateSpec(state: StateSpec, path: string, types?: Record<string, TypeSpec>): boolean;
|
|
11
12
|
export declare function pathExistsInComputedSpec(computed: ComputedSpec, path: string): boolean;
|
|
12
13
|
export declare function pathExistsInFieldSpec(spec: FieldSpec, path: string): boolean;
|
|
13
14
|
export declare function pathExistsInFieldSpecSegments(spec: FieldSpec, segments: readonly PatchSegment[]): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,12 +11,12 @@ import type { Intent, Patch } from "./schema/patch.js";
|
|
|
11
11
|
import type { SemanticPath } from "./schema/common.js";
|
|
12
12
|
import type { ComputeResult, ValidationResult, ExplainResult, SystemDelta } from "./schema/result.js";
|
|
13
13
|
import type { HostContext } from "./schema/host-context.js";
|
|
14
|
-
import { compute, computeSync } from "./core/compute.js";
|
|
14
|
+
import { compute, computeSync, validateIntentInput } from "./core/compute.js";
|
|
15
15
|
import { apply } from "./core/apply.js";
|
|
16
16
|
import { applySystemDelta } from "./core/system-delta.js";
|
|
17
17
|
import { validate } from "./core/validate.js";
|
|
18
18
|
import { explain } from "./core/explain.js";
|
|
19
|
-
import { getAvailableActions, isActionAvailable } from "./core/action-availability.js";
|
|
19
|
+
import { getAvailableActions, isActionAvailable, isIntentDispatchable } from "./core/action-availability.js";
|
|
20
20
|
/**
|
|
21
21
|
* ManifestoCore interface
|
|
22
22
|
*/
|
|
@@ -50,13 +50,17 @@ export interface ManifestoCore {
|
|
|
50
50
|
*/
|
|
51
51
|
explain(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): ExplainResult;
|
|
52
52
|
/**
|
|
53
|
-
* Check whether an action is currently
|
|
53
|
+
* Check whether an action is currently available for a new invocation.
|
|
54
54
|
*/
|
|
55
55
|
isActionAvailable(schema: DomainSchema, snapshot: Snapshot, actionName: string): boolean;
|
|
56
56
|
/**
|
|
57
|
-
* Return all currently
|
|
57
|
+
* Return all currently available action names.
|
|
58
58
|
*/
|
|
59
59
|
getAvailableActions(schema: DomainSchema, snapshot: Snapshot): readonly string[];
|
|
60
|
+
/**
|
|
61
|
+
* Check whether a specific bound intent is dispatchable against the current snapshot.
|
|
62
|
+
*/
|
|
63
|
+
isIntentDispatchable(schema: DomainSchema, snapshot: Snapshot, intent: Intent): boolean;
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Create a ManifestoCore instance
|
|
@@ -67,4 +71,4 @@ export * from "./utils/index.js";
|
|
|
67
71
|
export * from "./evaluator/index.js";
|
|
68
72
|
export * from "./errors.js";
|
|
69
73
|
export * from "./factories.js";
|
|
70
|
-
export { compute, computeSync, apply, applySystemDelta, validate, explain, isActionAvailable, getAvailableActions, };
|
|
74
|
+
export { compute, computeSync, validateIntentInput, apply, applySystemDelta, validate, explain, isActionAvailable, getAvailableActions, isIntentDispatchable, };
|