@manifesto-ai/sdk 2.1.0 โ 2.2.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 +27 -107
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,133 +1,53 @@
|
|
|
1
1
|
# @manifesto-ai/sdk
|
|
2
2
|
|
|
3
|
-
> Thin
|
|
3
|
+
> Thin direct-dispatch entry point for Manifesto applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@manifesto-ai/sdk` is the default package for applications that start with `createManifesto()`. It stays thin and only re-exports the governed world assembly surface needed for explicit composition.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## What This Package Owns
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- `createManifesto()`
|
|
10
|
+
- `dispatchAsync()`
|
|
11
|
+
- `defineOps()`
|
|
12
|
+
- typed operation helpers
|
|
13
|
+
- thin world re-exports for `createWorld()` and `createInMemoryWorldStore()`
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
Application Code
|
|
13
|
-
|
|
|
14
|
-
v
|
|
15
|
-
SDK (createManifesto, defineOps, re-exports)
|
|
16
|
-
|
|
|
17
|
-
v
|
|
18
|
-
Compiler / Host / Core
|
|
19
|
-
+
|
|
20
|
-
optional World integration
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
The SDK owns exactly one concept: `createManifesto()`. Everything else is either a small SDK utility (`defineOps`) or a re-export from protocol packages. Legacy app-package facade APIs are retired in v1.0.0. Governance and lineage remain explicit integrations through `@manifesto-ai/world`.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
15
|
+
## When to Use It
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
pnpm add @manifesto-ai/sdk
|
|
31
|
-
```
|
|
17
|
+
Use the SDK when you want:
|
|
32
18
|
|
|
33
|
-
|
|
19
|
+
- the shortest path to direct-dispatch execution
|
|
20
|
+
- subscriptions and snapshot reads without manual governed wiring
|
|
21
|
+
- thin access to the governed world assembler, while keeping full governance and lineage APIs in `@manifesto-ai/world`
|
|
34
22
|
|
|
35
|
-
##
|
|
23
|
+
## Direct Dispatch
|
|
36
24
|
|
|
37
25
|
```typescript
|
|
38
|
-
import { createManifesto,
|
|
26
|
+
import { createIntent, createManifesto, dispatchAsync } from "@manifesto-ai/sdk";
|
|
39
27
|
|
|
40
28
|
const manifesto = createManifesto({
|
|
41
29
|
schema: counterSchema,
|
|
42
30
|
effects: {},
|
|
43
31
|
});
|
|
44
32
|
|
|
45
|
-
manifesto
|
|
46
|
-
console.log(snapshot?.data.count);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
manifesto.dispatch(createIntent("increment", "intent-1"));
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Main Exports
|
|
55
|
-
|
|
56
|
-
### SDK-Owned
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
function createManifesto(config: ManifestoConfig): ManifestoInstance;
|
|
60
|
-
function defineOps<TData>(): TypedOps<TData>;
|
|
33
|
+
await dispatchAsync(manifesto, createIntent("increment", "intent-1"));
|
|
61
34
|
```
|
|
62
35
|
|
|
63
|
-
|
|
36
|
+
## Governed Composition
|
|
64
37
|
|
|
65
38
|
```typescript
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
getSnapshot(): Snapshot;
|
|
71
|
-
dispose(): void;
|
|
72
|
-
}
|
|
39
|
+
import {
|
|
40
|
+
createInMemoryWorldStore,
|
|
41
|
+
createWorld,
|
|
42
|
+
} from "@manifesto-ai/sdk";
|
|
73
43
|
```
|
|
74
44
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
type ManifestoEvent =
|
|
79
|
-
| "dispatch:completed"
|
|
80
|
-
| "dispatch:rejected"
|
|
81
|
-
| "dispatch:failed";
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
`dispatch()` is enqueue-only. Observe results through `subscribe()` for state changes or `on()` for per-intent telemetry.
|
|
85
|
-
|
|
86
|
-
### Re-Exported Protocol Surface
|
|
87
|
-
|
|
88
|
-
SDK re-exports selected protocol types and factories from:
|
|
89
|
-
|
|
90
|
-
- `@manifesto-ai/core`
|
|
91
|
-
- `@manifesto-ai/world`
|
|
92
|
-
- `@manifesto-ai/host` (types)
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Relationship with Other Packages
|
|
97
|
-
|
|
98
|
-
| Relationship | Package | How |
|
|
99
|
-
|--------------|---------|-----|
|
|
100
|
-
| Uses | `@manifesto-ai/core` | Schema and expression types |
|
|
101
|
-
| Uses | `@manifesto-ai/host` | Effect execution and compute loop |
|
|
102
|
-
| Re-exports | `@manifesto-ai/world` | World protocol types and store factory for explicit governance integration |
|
|
103
|
-
| Uses | `@manifesto-ai/compiler` | MEL โ DomainSchema compilation |
|
|
104
|
-
| Retired predecessor | `@manifesto-ai/runtime` | Absorbed into `createManifesto()` per ADR-010 |
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## Migration Notes
|
|
109
|
-
|
|
110
|
-
Older app-package code usually maps to three current patterns:
|
|
111
|
-
|
|
112
|
-
- use `createManifesto({ schema, effects })` as the public entry point
|
|
113
|
-
- create intents explicitly with `createIntent(...)`
|
|
114
|
-
- treat `dispatch()` as enqueue-only and observe completion through `dispatch:*` events or a small `dispatchAsync()` helper
|
|
115
|
-
|
|
116
|
-
For migration details, see:
|
|
117
|
-
- [Migrate App to SDK](../../docs/guides/migrate-app-to-sdk.md)
|
|
118
|
-
- [sdk-SPEC-v1.0.0.md](docs/sdk-SPEC-v1.0.0.md)
|
|
119
|
-
- [ADR-010](../../docs/internals/adr/010-major-hard-cut.md)
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Documentation
|
|
124
|
-
|
|
125
|
-
- [sdk-SPEC-v1.0.0.md](docs/sdk-SPEC-v1.0.0.md)
|
|
126
|
-
- [VERSION-INDEX.md](docs/VERSION-INDEX.md)
|
|
127
|
-
- [ADR-010](../../docs/internals/adr/010-major-hard-cut.md)
|
|
45
|
+
These are the thin re-exports from top-level `@manifesto-ai/world`.
|
|
128
46
|
|
|
129
|
-
|
|
47
|
+
For the full governed surface, including `createGovernanceService()`, `createLineageService()`, and `createGovernanceEventDispatcher()`, import `@manifesto-ai/world` directly.
|
|
130
48
|
|
|
131
|
-
##
|
|
49
|
+
## Docs
|
|
132
50
|
|
|
133
|
-
[
|
|
51
|
+
- [SDK Guide](docs/GUIDE.md)
|
|
52
|
+
- [SDK Specification](docs/sdk-SPEC-v2.0.0.md)
|
|
53
|
+
- [VERSION-INDEX](docs/VERSION-INDEX.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DomainSchema, Snapshot as Snapshot$1, Patch, Intent, SetPatch, UnsetPatch, MergePatch } from '@manifesto-ai/core';
|
|
2
2
|
export { ComputeResult, Snapshot as CoreSnapshot, DomainSchema, ErrorValue, Intent, MergePatch, Patch, Requirement, SetPatch, TraceGraph, UnsetPatch, createCore, createIntent, createSnapshot } from '@manifesto-ai/core';
|
|
3
3
|
export { HostOptions, HostResult } from '@manifesto-ai/host';
|
|
4
|
-
export {
|
|
4
|
+
export { CommitCapableWorldStore, CoordinatorSealGenesisParams, CoordinatorSealNextParams, GovernanceEventDispatcher, SealResult, WorldConfig, WorldCoordinator, WorldInstance, WriteSet, createInMemoryWorldStore, createWorld } from '@manifesto-ai/world';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* SDK package identity and SPEC version metadata.
|
|
@@ -9,16 +9,16 @@ export { WorldStore, createMemoryWorldStore } from '@manifesto-ai/world';
|
|
|
9
9
|
*/
|
|
10
10
|
type SdkManifest = {
|
|
11
11
|
readonly name: '@manifesto-ai/sdk';
|
|
12
|
-
readonly specVersion: '
|
|
12
|
+
readonly specVersion: '2.0.0';
|
|
13
13
|
readonly phase: 'released';
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* SDK
|
|
17
|
+
* SDK v2.0.0 Public Types
|
|
18
18
|
*
|
|
19
19
|
* Defines ManifestoInstance, ManifestoConfig, event types, and supporting types.
|
|
20
20
|
*
|
|
21
|
-
* @see SDK SPEC
|
|
21
|
+
* @see SDK SPEC v2.0.0
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ type SdkManifest = {
|
|
|
28
28
|
* Core's Snapshot uses `data: unknown`. This overlay provides type-safe
|
|
29
29
|
* access to domain data via the generic parameter T.
|
|
30
30
|
*
|
|
31
|
-
* @see SDK SPEC
|
|
31
|
+
* @see SDK SPEC v2.0.0
|
|
32
32
|
*/
|
|
33
33
|
type Snapshot<T = unknown> = Omit<Snapshot$1, "data"> & {
|
|
34
34
|
data: T;
|
|
@@ -52,7 +52,7 @@ type EffectHandler = (params: unknown, ctx: EffectContext) => Promise<readonly P
|
|
|
52
52
|
/**
|
|
53
53
|
* Configuration for createManifesto().
|
|
54
54
|
*
|
|
55
|
-
* @see SDK SPEC
|
|
55
|
+
* @see SDK SPEC v2.0.0
|
|
56
56
|
*/
|
|
57
57
|
interface ManifestoConfig<T = unknown> {
|
|
58
58
|
/**
|
|
@@ -90,7 +90,7 @@ type Unsubscribe = () => void;
|
|
|
90
90
|
*
|
|
91
91
|
* 5 methods, no more.
|
|
92
92
|
*
|
|
93
|
-
* @see SDK SPEC
|
|
93
|
+
* @see SDK SPEC v2.0.0
|
|
94
94
|
*/
|
|
95
95
|
interface ManifestoInstance<T = unknown> {
|
|
96
96
|
/**
|
package/dist/index.js
CHANGED
|
@@ -570,7 +570,10 @@ function defineOps() {
|
|
|
570
570
|
|
|
571
571
|
// src/index.ts
|
|
572
572
|
import { createIntent, createSnapshot, createCore } from "@manifesto-ai/core";
|
|
573
|
-
import {
|
|
573
|
+
import {
|
|
574
|
+
createInMemoryWorldStore,
|
|
575
|
+
createWorld
|
|
576
|
+
} from "@manifesto-ai/world";
|
|
574
577
|
export {
|
|
575
578
|
CompileError,
|
|
576
579
|
DispatchRejectedError,
|
|
@@ -578,10 +581,11 @@ export {
|
|
|
578
581
|
ManifestoError,
|
|
579
582
|
ReservedEffectError,
|
|
580
583
|
createCore,
|
|
584
|
+
createInMemoryWorldStore,
|
|
581
585
|
createIntent,
|
|
582
586
|
createManifesto,
|
|
583
|
-
createMemoryWorldStore,
|
|
584
587
|
createSnapshot,
|
|
588
|
+
createWorld,
|
|
585
589
|
defineOps,
|
|
586
590
|
dispatchAsync
|
|
587
591
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/create-manifesto.ts","../src/errors.ts","../src/dispatch-async.ts","../src/typed-ops.ts","../src/index.ts"],"sourcesContent":["/**\n * createManifesto() Factory\n *\n * The sole SDK-owned concept. Creates a ManifestoInstance that composes\n * the four protocol axes (Core, Host, World, Compiler) into a single handle.\n *\n * @see SDK SPEC v1.0.0 ยง5\n * @see ADR-010\n * @module\n */\n\nimport {\n createHost,\n type ManifestoHost,\n type EffectHandler as HostEffectHandler,\n type EffectContext as HostEffectContext,\n} from \"@manifesto-ai/host\";\nimport {\n type DomainSchema,\n type Patch,\n type Snapshot as CoreSnapshot,\n type Intent,\n semanticPathToPatchPath,\n extractDefaults,\n} from \"@manifesto-ai/core\";\nimport { compileMelDomain } from \"@manifesto-ai/compiler\";\n\nimport type {\n Snapshot,\n ManifestoConfig,\n ManifestoInstance,\n ManifestoEvent,\n ManifestoEventMap,\n EffectHandler,\n Selector,\n Unsubscribe,\n} from \"./types.js\";\nimport { ReservedEffectError, DisposedError, ManifestoError, CompileError } from \"./errors.js\";\n\n// =============================================================================\n// Constants\n// =============================================================================\n\n/** Reserved effect type used by the compiler for $system.* references. */\nconst RESERVED_EFFECT_TYPE = \"system.get\";\n\n/** Reserved namespace prefix for system actions. */\nconst RESERVED_NAMESPACE_PREFIX = \"system.\";\n\n// =============================================================================\n// createManifesto() โ SDK SPEC v1.0.0 ยง5\n// =============================================================================\n\n/**\n * Create a ManifestoInstance.\n *\n * This is the sole entry point for SDK consumers. It composes the protocol\n * axes (Core via Host, Host, World, Compiler) into a single handle with\n * 5 methods: dispatch, subscribe, on, getSnapshot, dispose.\n *\n * @see SDK-FACTORY-1 through SDK-FACTORY-5\n * @see SDK-INV-1 through SDK-INV-6\n */\nexport function createManifesto<T = unknown>(\n config: ManifestoConfig<T>,\n): ManifestoInstance<T> {\n // โโโ INV-3: Schema resolution โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const schema = resolveSchema(config.schema);\n\n // โโโ INV-4: Reserved effect protection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n if (RESERVED_EFFECT_TYPE in config.effects) {\n throw new ReservedEffectError(RESERVED_EFFECT_TYPE);\n }\n\n // Validate no user actions use reserved namespace\n validateReservedNamespaces(schema);\n\n // โโโ INV-5: Host creation + effect registration โโโโโโโโโโโโโโโโโโโโโโโโ\n const host = createInternalHost(schema, config.effects, config.snapshot);\n\n // โโโ State holder (closure-captured) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n // Host always initializes with a snapshot (initialData defaults to {})\n let currentSnapshot: CoreSnapshot = host.getSnapshot()!;\n\n // โโโ Subscription store โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const subscribers = new Set<Subscriber<unknown>>();\n\n // โโโ Event channel (telemetry) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const eventListeners = new Map<ManifestoEvent, Set<(payload: ManifestoEventMap<T>[ManifestoEvent]) => void>>();\n\n // โโโ Serial dispatch queue (SDK-INV-5) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n let dispatchQueue: Promise<void> = Promise.resolve();\n\n // โโโ Disposed flag โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n let disposed = false;\n\n // โโโ Guard function โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const guard = config.guard ?? null;\n\n // =========================================================================\n // dispatch() โ SDK-DISPATCH-1~4\n // =========================================================================\n\n function dispatch(intent: Intent): void {\n // SDK-DISPATCH-4\n if (disposed) {\n throw new DisposedError();\n }\n\n // SDK-DISPATCH-2: Enrich with intentId if not provided\n const enrichedIntent: Intent = intent.intentId\n ? intent\n : { ...intent, intentId: generateIntentId() };\n\n // SDK-DISPATCH-1, SDK-DISPATCH-3: Enqueue for serial processing\n const prev = dispatchQueue;\n dispatchQueue = prev\n .catch(() => {}) // Previous failure doesn't block queue\n .then(() => processIntent(enrichedIntent));\n // Tail always resolves\n dispatchQueue = dispatchQueue.catch(() => {});\n }\n\n /**\n * Process a single intent through the Host dispatch cycle.\n */\n async function processIntent(intent: Intent): Promise<void> {\n // SDK-DISPOSE-1: Do not process queued intents after dispose\n if (disposed) return;\n\n // SDK-INV-5: Guard evaluates against current snapshot at dequeue time\n if (guard) {\n try {\n // SDK-SNAP-IMMUTABLE: Prevent guard from mutating internal state\n const allowed = guard(intent, Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>);\n if (!allowed) {\n emitEvent(\"dispatch:rejected\", {\n intentId: intent.intentId,\n intent,\n reason: \"Guard rejected the intent\",\n });\n return;\n }\n } catch (error) {\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n return;\n }\n }\n\n try {\n const result = await host.dispatch(intent);\n\n if (result.status === \"error\") {\n currentSnapshot = result.snapshot;\n notifySubscribers();\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: result.error ?? new ManifestoError(\"HOST_ERROR\", \"Host dispatch failed\"),\n });\n return;\n }\n\n // Update state\n currentSnapshot = result.snapshot;\n\n // SDK-INV-1: notify subscribers at terminal snapshot only\n notifySubscribers();\n\n emitEvent(\"dispatch:completed\", {\n intentId: intent.intentId,\n intent,\n snapshot: result.snapshot as Snapshot<T>,\n });\n } catch (error) {\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n\n // =========================================================================\n // subscribe() โ SDK-SUB-1~4\n // =========================================================================\n\n function subscribe<R>(\n selector: Selector<T, R>,\n listener: (value: R) => void,\n ): Unsubscribe {\n if (disposed) return () => {};\n\n const sub: Subscriber<R> = {\n selector: selector as Selector<unknown, R>,\n listener,\n lastValue: selector(currentSnapshot as Snapshot<T>),\n initialized: true,\n };\n\n subscribers.add(sub as Subscriber<unknown>);\n\n return () => {\n subscribers.delete(sub as Subscriber<unknown>);\n };\n }\n\n // =========================================================================\n // on() โ SDK-EVENT-1~3, SDK-INV-2\n // =========================================================================\n\n function on<K extends ManifestoEvent>(\n event: K,\n handler: (payload: ManifestoEventMap<T>[K]) => void,\n ): Unsubscribe {\n if (disposed) return () => {};\n\n let listeners = eventListeners.get(event);\n if (!listeners) {\n listeners = new Set();\n eventListeners.set(event, listeners as Set<(payload: ManifestoEventMap<T>[ManifestoEvent]) => void>);\n }\n listeners.add(handler as (payload: ManifestoEventMap<T>[ManifestoEvent]) => void);\n\n return () => {\n listeners!.delete(handler as (payload: ManifestoEventMap<T>[ManifestoEvent]) => void);\n };\n }\n\n // =========================================================================\n // getSnapshot() โ SDK-SNAP-1\n // =========================================================================\n\n function getSnapshot(): Snapshot<T> {\n // SDK-SNAP-IMMUTABLE: Return a frozen copy to prevent external mutation\n // that would bypass the patch/apply pipeline.\n return Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>;\n }\n\n // =========================================================================\n // dispose() โ SDK-DISPOSE-1~3\n // =========================================================================\n\n function dispose(): void {\n if (disposed) return;\n disposed = true;\n\n // Release all resources\n subscribers.clear();\n eventListeners.clear();\n }\n\n // =========================================================================\n // Internal helpers\n // =========================================================================\n\n /** Notify all subscribers with current snapshot (SDK-INV-1). */\n function notifySubscribers(): void {\n // SDK-SNAP-IMMUTABLE: Pass a frozen clone to selectors so that neither\n // selector nor listener can mutate internal state.\n const frozenSnap = Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>;\n for (const sub of subscribers) {\n const selected = (sub.selector as Selector<T, unknown>)(frozenSnap);\n\n // Selector-based change detection (SDK-SUB-4)\n if (sub.initialized && Object.is(sub.lastValue, selected)) {\n continue;\n }\n\n sub.lastValue = selected;\n sub.initialized = true;\n sub.listener(selected);\n }\n }\n\n /** Emit an event to the telemetry channel. */\n function emitEvent<K extends ManifestoEvent>(\n event: K,\n payload: ManifestoEventMap<T>[K],\n ): void {\n const listeners = eventListeners.get(event);\n if (!listeners) return;\n for (const handler of listeners) {\n try {\n handler(payload);\n } catch {\n // Event handlers must not break the dispatch loop\n }\n }\n }\n\n // =========================================================================\n // Return ManifestoInstance\n // =========================================================================\n\n return { dispatch, subscribe, on, getSnapshot, dispose };\n}\n\n// =============================================================================\n// Schema Resolution (INV-3)\n// =============================================================================\n\n/**\n * Resolve schema from DomainSchema or MEL text string.\n * Injects platform namespaces ($host, $mel).\n */\nfunction resolveSchema(schema: DomainSchema | string): DomainSchema {\n let domainSchema: DomainSchema;\n\n if (typeof schema === \"string\") {\n const result = compileMelDomain(schema, { mode: \"domain\" });\n\n if (result.errors.length > 0) {\n const formatted = result.errors.map((d) => {\n const loc = d.location;\n const header = loc && (loc.start.line > 0 || loc.start.column > 0)\n ? `[${d.code}] ${d.message} (${loc.start.line}:${loc.start.column})`\n : `[${d.code}] ${d.message}`;\n\n if (!loc || loc.start.line === 0) return header;\n\n const sourceLines = schema.split(\"\\n\");\n const lineContent = sourceLines[loc.start.line - 1];\n if (!lineContent) return header;\n\n const lineNumStr = String(loc.start.line).padStart(4, \" \");\n const underlineLen = Math.max(1,\n loc.end.line === loc.start.line\n ? Math.min(loc.end.column - loc.start.column, lineContent.length - loc.start.column + 1)\n : 1);\n const padding = \" \".repeat(lineNumStr.length + 3 + loc.start.column - 1);\n return `${header}\\n${lineNumStr} | ${lineContent}\\n${padding}${\"^\".repeat(underlineLen)}`;\n }).join(\"\\n\\n\");\n\n throw new CompileError(\n result.errors,\n `MEL compilation failed:\\n${formatted}`,\n );\n }\n\n if (!result.schema) {\n throw new ManifestoError(\n \"COMPILE_ERROR\",\n \"MEL compilation produced no schema\",\n );\n }\n\n domainSchema = result.schema as DomainSchema;\n } else {\n domainSchema = schema;\n }\n\n return withPlatformNamespaces(domainSchema);\n}\n\n// =============================================================================\n// Platform Namespace Injection (INV-3)\n// =============================================================================\n\n/**\n * Inject $host and $mel platform namespaces into schema.\n * Absorbed from runtime/src/schema/schema-manager.ts.\n */\nfunction withPlatformNamespaces(schema: DomainSchema): DomainSchema {\n const fields = { ...schema.state.fields };\n let changed = false;\n\n // $host namespace\n if (!fields.$host) {\n fields.$host = {\n type: \"object\",\n required: false,\n default: {},\n };\n changed = true;\n } else if (fields.$host.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$host' must be an object field\",\n );\n } else if (fields.$host.default === undefined) {\n fields.$host = { ...fields.$host, default: {} };\n changed = true;\n }\n\n // $mel namespace with guards.intent structure\n if (!fields.$mel) {\n fields.$mel = {\n type: \"object\",\n required: false,\n default: { guards: { intent: {} } },\n fields: {\n guards: {\n type: \"object\",\n required: false,\n default: { intent: {} },\n fields: {\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n },\n },\n };\n changed = true;\n } else if (fields.$mel.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel' must be an object field\",\n );\n } else {\n let nextMel = fields.$mel;\n if (nextMel.default === undefined) {\n nextMel = { ...nextMel, default: { guards: { intent: {} } } };\n changed = true;\n }\n\n const melFields = nextMel.fields ?? {};\n const guardsField = melFields.guards;\n\n if (!guardsField) {\n nextMel = {\n ...nextMel,\n fields: {\n ...melFields,\n guards: {\n type: \"object\",\n required: false,\n default: { intent: {} },\n fields: {\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n },\n },\n };\n changed = true;\n } else if (guardsField.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel.guards' must be an object field\",\n );\n } else {\n let nextGuards = guardsField;\n if (guardsField.default === undefined) {\n nextGuards = { ...nextGuards, default: { intent: {} } };\n changed = true;\n }\n\n const guardFields = nextGuards.fields ?? {};\n const intentField = guardFields.intent;\n\n if (!intentField) {\n nextGuards = {\n ...nextGuards,\n fields: {\n ...guardFields,\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n };\n changed = true;\n } else if (intentField.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel.guards.intent' must be an object field\",\n );\n } else if (intentField.default === undefined) {\n nextGuards = {\n ...nextGuards,\n fields: {\n ...guardFields,\n intent: { ...intentField, default: {} },\n },\n };\n changed = true;\n }\n\n if (nextGuards !== guardsField) {\n nextMel = {\n ...nextMel,\n fields: {\n ...melFields,\n guards: nextGuards,\n },\n };\n }\n }\n\n if (nextMel !== fields.$mel) {\n fields.$mel = nextMel;\n changed = true;\n }\n }\n\n if (!changed) return schema;\n\n return {\n ...schema,\n state: {\n ...schema.state,\n fields,\n },\n };\n}\n\n// =============================================================================\n// Reserved Namespace Validation\n// =============================================================================\n\nfunction validateReservedNamespaces(schema: DomainSchema): void {\n const actions = schema.actions || {};\n for (const actionType of Object.keys(actions)) {\n if (actionType.startsWith(RESERVED_NAMESPACE_PREFIX)) {\n throw new ManifestoError(\n \"RESERVED_NAMESPACE\",\n `Action type \"${actionType}\" uses reserved namespace prefix \"${RESERVED_NAMESPACE_PREFIX}\"`,\n );\n }\n }\n}\n\n// =============================================================================\n// Internal Host Creation (INV-5)\n// Absorbed from runtime/src/execution/internal-host.ts\n// =============================================================================\n\nfunction createInternalHost(\n schema: DomainSchema,\n effects: Record<string, EffectHandler>,\n initialSnapshot?: Snapshot,\n): ManifestoHost {\n const host = createHost(schema, {\n initialData: initialSnapshot?.data ?? extractDefaults(schema.state),\n });\n\n // P1-1: When restoring from a persisted snapshot, use host.reset() to\n // hydrate the full canonical Snapshot (meta, system, input) rather than\n // only forwarding data via initialData which resets meta.version to 0.\n if (initialSnapshot) {\n host.reset(initialSnapshot);\n }\n\n // Register reserved system.get handler (compiler-internal, CRITICAL)\n host.registerEffect(RESERVED_EFFECT_TYPE, async (\n _type: string,\n params: Record<string, unknown>,\n ctx: HostEffectContext,\n ): Promise<Patch[]> => {\n const { patches } = executeSystemGet(params, ctx.snapshot);\n return patches;\n });\n\n // Register user effects, adapting 2-param โ 3-param signature\n for (const [effectType, appHandler] of Object.entries(effects)) {\n const hostHandler: HostEffectHandler = async (\n _type: string,\n params: Record<string, unknown>,\n ctx: HostEffectContext,\n ): Promise<Patch[]> => {\n const appCtx = { snapshot: ctx.snapshot };\n const patches = await appHandler(params, appCtx);\n return patches as Patch[];\n };\n\n host.registerEffect(effectType, hostHandler);\n }\n\n return host;\n}\n\n// =============================================================================\n// system.get Effect Implementation\n// Absorbed from runtime/src/execution/system-get.ts\n// =============================================================================\n\ninterface SystemGetReadParams {\n path: string;\n target?: string;\n}\n\ninterface SystemGetGenerateParams {\n key: string;\n into: string;\n}\n\ntype SystemGetParams = SystemGetReadParams | SystemGetGenerateParams;\n\nfunction isGenerateParams(params: unknown): params is SystemGetGenerateParams {\n return (\n typeof params === \"object\" &&\n params !== null &&\n \"key\" in params &&\n \"into\" in params\n );\n}\n\nfunction generateSystemValue(key: string): unknown {\n switch (key) {\n case \"uuid\":\n return generateUUID();\n case \"timestamp\":\n case \"time.now\":\n return Date.now();\n case \"isoTimestamp\":\n return new Date().toISOString();\n default:\n return null;\n }\n}\n\nfunction generateUUID(): string {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nfunction executeSystemGet(\n params: unknown,\n snapshot: Snapshot,\n): { patches: Patch[] } {\n if (isGenerateParams(params)) {\n const value = generateSystemValue(params.key);\n const patches: Patch[] = [{\n op: \"set\",\n path: normalizeTargetPath(params.into),\n value,\n }];\n return { patches };\n }\n\n // Read mode\n const { path, target } = params as SystemGetReadParams;\n const result = resolvePathValue(path, snapshot);\n\n const patches: Patch[] = [];\n if (target) {\n patches.push({\n op: \"set\",\n path: normalizeTargetPath(target),\n value: result.value,\n });\n }\n\n return { patches };\n}\n\nfunction normalizePath(path: string): string {\n if (path.startsWith(\"/\")) {\n return path.slice(1).replace(/\\//g, \".\");\n }\n return path;\n}\n\nfunction normalizeTargetPath(path: string): Patch[\"path\"] {\n const normalized = normalizePath(path);\n const withoutDataRoot = normalized.startsWith(\"data.\")\n ? normalized.slice(\"data.\".length)\n : normalized;\n return semanticPathToPatchPath(withoutDataRoot);\n}\n\nfunction resolvePathValue(\n path: string,\n snapshot: Snapshot,\n): { value: unknown; found: boolean } {\n const normalized = normalizePath(path);\n const parts = normalized.split(\".\");\n\n if (parts.length === 0) {\n return { value: undefined, found: false };\n }\n\n const root = parts[0];\n const rest = parts.slice(1);\n\n let current: unknown;\n\n switch (root) {\n case \"data\":\n current = snapshot.data;\n break;\n case \"computed\":\n current = snapshot.computed;\n break;\n case \"system\":\n current = snapshot.system;\n break;\n case \"meta\":\n current = snapshot.meta;\n break;\n default:\n current = snapshot.data;\n rest.unshift(root);\n }\n\n for (const part of rest) {\n if (current === null || current === undefined) {\n return { value: undefined, found: false };\n }\n if (typeof current !== \"object\") {\n return { value: undefined, found: false };\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n return { value: current, found: current !== undefined };\n}\n\n// =============================================================================\n// Subscriber Type (internal)\n// =============================================================================\n\ninterface Subscriber<R> {\n selector: Selector<unknown, R>;\n listener: (value: R) => void;\n lastValue: R | undefined;\n initialized: boolean;\n}\n\n// =============================================================================\n// Intent ID Generation (SDK-DISPATCH-2, SDK-INV-6)\n// =============================================================================\n\nfunction generateIntentId(): string {\n return generateUUID();\n}\n","/**\n * SDK v1.0.0 Error Types\n *\n * @see SDK SPEC v1.0.0 ยง12\n * @see SDK-ERR-1, SDK-ERR-2, SDK-ERR-3\n * @module\n */\n\n// =============================================================================\n// Base Error\n// =============================================================================\n\n/**\n * Base error for all SDK errors.\n *\n * @see SDK-ERR-1\n */\nexport class ManifestoError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ManifestoError\";\n this.code = code;\n }\n}\n\n// =============================================================================\n// Reserved Effect Error\n// =============================================================================\n\n/**\n * Thrown when user effects attempt to override reserved effect types (e.g. system.get).\n *\n * @see SDK-ERR-2, SDK-INV-4\n */\nexport class ReservedEffectError extends ManifestoError {\n readonly effectType: string;\n\n constructor(effectType: string) {\n super(\n \"RESERVED_EFFECT\",\n `Effect type \"${effectType}\" is reserved and cannot be overridden`,\n );\n this.name = \"ReservedEffectError\";\n this.effectType = effectType;\n }\n}\n\n// =============================================================================\n// Disposed Error\n// =============================================================================\n\n// =============================================================================\n// Compile Error\n// =============================================================================\n\n/**\n * Thrown when MEL compilation fails. Exposes full diagnostic info.\n *\n * @see SDK-ERR-4\n */\nexport class CompileError extends ManifestoError {\n readonly diagnostics: readonly CompileDiagnostic[];\n\n constructor(diagnostics: readonly CompileDiagnostic[], formattedMessage: string) {\n super(\"COMPILE_ERROR\", formattedMessage);\n this.name = \"CompileError\";\n this.diagnostics = diagnostics;\n }\n}\n\n/**\n * Minimal diagnostic shape exposed by SDK.\n * Matches @manifesto-ai/compiler Diagnostic but avoids hard dependency.\n */\nexport interface CompileDiagnostic {\n readonly severity: \"error\" | \"warning\" | \"info\";\n readonly code: string;\n readonly message: string;\n readonly location: {\n readonly start: { readonly line: number; readonly column: number; readonly offset: number };\n readonly end: { readonly line: number; readonly column: number; readonly offset: number };\n };\n readonly source?: string;\n readonly suggestion?: string;\n}\n\n// =============================================================================\n// Disposed Error\n// =============================================================================\n\n/**\n * Thrown when dispatch is called on a disposed instance.\n *\n * @see SDK-ERR-3, SDK-DISPATCH-4\n */\nexport class DisposedError extends ManifestoError {\n constructor() {\n super(\"DISPOSED\", \"Cannot dispatch on a disposed ManifestoInstance\");\n this.name = \"DisposedError\";\n }\n}\n","/**\n * dispatchAsync() โ Non-normative convenience utility\n *\n * Promise-based wrapper around dispatch() + on().\n * Resolves when the intent reaches a terminal state.\n *\n * @see SDK SPEC v1.0.0 ยง14.3\n * @module\n */\n\nimport type { Intent } from \"@manifesto-ai/core\";\nimport type { Snapshot, ManifestoInstance } from \"./types.js\";\n\n/**\n * Error thrown when an intent is rejected by a guard.\n */\nexport class DispatchRejectedError extends Error {\n readonly code = \"DISPATCH_REJECTED\";\n readonly intentId: string;\n\n constructor(intentId: string, reason?: string) {\n super(reason ?? \"Intent was rejected by guard\");\n this.name = \"DispatchRejectedError\";\n this.intentId = intentId;\n }\n}\n\n/**\n * Dispatch an intent and wait for it to complete.\n *\n * - Resolves with the terminal Snapshot on `dispatch:completed`\n * - Rejects with the error on `dispatch:failed`\n * - Rejects with DispatchRejectedError on `dispatch:rejected`\n *\n * This is a convenience utility derived entirely from `dispatch` + `on`.\n * It does NOT violate the \"one owned concept\" rule.\n *\n * @see SDK SPEC v1.0.0 ยง14.3\n */\nexport function dispatchAsync<T = unknown>(\n instance: ManifestoInstance<T>,\n intent: Intent,\n): Promise<Snapshot<T>> {\n const intentId = intent.intentId ?? generateId();\n const enriched: Intent = intent.intentId ? intent : { ...intent, intentId };\n\n return new Promise((resolve, reject) => {\n const cleanup = () => {\n unsubCompleted();\n unsubFailed();\n unsubRejected();\n };\n\n const unsubCompleted = instance.on(\"dispatch:completed\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n resolve(e.snapshot);\n }\n });\n\n const unsubFailed = instance.on(\"dispatch:failed\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n reject(e.error ?? new Error(\"Dispatch failed\"));\n }\n });\n\n const unsubRejected = instance.on(\"dispatch:rejected\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n reject(new DispatchRejectedError(intentId, e.reason));\n }\n });\n\n instance.dispatch(enriched);\n });\n}\n\nfunction generateId(): string {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n","import { semanticPathToPatchPath } from \"@manifesto-ai/core\";\nimport type { SetPatch, UnsetPatch, MergePatch } from \"@manifesto-ai/core\";\n\n// ============================================================================\n// Type-Level Path Utilities\n// ============================================================================\n\n/**\n * Depth counter for recursive type operations.\n * Prevents infinite recursion in TypeScript's type system.\n *\n * Usage: Prev[4] = 3, Prev[3] = 2, ... Prev[0] = never\n */\ntype Prev = [never, 0, 1, 2, 3, 4];\n\n/**\n * Extract all valid dot-separated paths from a data type.\n *\n * - Object keys become path segments\n * - Nested objects generate dot-separated paths (e.g. \"user.name\")\n * - Arrays, primitives, and Record<string, T> are leaf nodes\n * (Record sub-paths are not supported by Core's path resolution)\n * - Limited to 3 levels of nesting to avoid TS recursion limits\n * (root key + 3 nested levels = max 4 path segments)\n *\n * @example\n * type State = { user: { name: string; age: number }; count: number };\n * type P = DataPaths<State>;\n * // \"user\" | \"user.name\" | \"user.age\" | \"count\"\n */\nexport type DataPaths<T, D extends number = 3> = [D] extends [never]\n ? never\n : T extends Record<string, unknown>\n ? T extends unknown[]\n ? never\n : {\n [K in keyof T & string]:\n | K\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : string extends keyof NonNullable<T[K]>\n ? never // Record<string, T> โ dynamic keys not resolved by Core\n : `${K}.${DataPaths<NonNullable<T[K]>, Prev[D]>}`\n : never);\n }[keyof T & string]\n : never;\n\n/**\n * Resolve the value type at a dot-separated path.\n *\n * @example\n * type State = { user: { name: string } };\n * type V = ValueAt<State, \"user.name\">; // string\n * type U = ValueAt<State, \"user\">; // { name: string }\n */\nexport type ValueAt<T, P extends string> = P extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? ValueAt<NonNullable<T[K]>, Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n/**\n * Paths that resolve to plain object types (valid targets for merge).\n * Arrays and primitives are excluded since merge performs shallow object merge.\n *\n * @example\n * type State = { user: { name: string }; tags: string[]; count: number };\n * type M = ObjectPaths<State>;\n * // \"user\" (tags and count excluded - not plain objects)\n */\nexport type ObjectPaths<T, D extends number = 3> = [D] extends [never]\n ? never\n : T extends Record<string, unknown>\n ? T extends unknown[]\n ? never\n : {\n [K in keyof T & string]:\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : K\n : never)\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : string extends keyof NonNullable<T[K]>\n ? never // Record<string, T> โ don't recurse into dynamic keys\n : `${K}.${ObjectPaths<NonNullable<T[K]>, Prev[D]>}`\n : never);\n }[keyof T & string]\n : never;\n\n// ============================================================================\n// TypedOps Interface\n// ============================================================================\n\n/**\n * Type-safe patch operations builder.\n *\n * Provides IDE autocomplete for state paths and compile-time type checking\n * for patch values. All methods return standard Patch objects compatible\n * with Core's apply() function.\n * System mutation convenience APIs are intentionally excluded.\n *\n * @typeParam TData - The shape of domain state (snapshot.data)\n */\nexport interface TypedOps<TData extends Record<string, unknown>> {\n /**\n * Create a set patch โ replace value at path (create if missing).\n *\n * @example\n * ops.set('count', 5);\n * ops.set('user.name', 'Alice');\n */\n set<P extends DataPaths<TData>>(path: P, value: Exclude<ValueAt<TData, P>, undefined>): SetPatch;\n\n /**\n * Create an unset patch โ remove property at path.\n *\n * @example\n * ops.unset('temporaryField');\n */\n unset<P extends DataPaths<TData>>(path: P): UnsetPatch;\n\n /**\n * Create a merge patch โ shallow merge at object path.\n * Only valid for paths that resolve to plain object types.\n *\n * @example\n * ops.merge('user', { name: 'Bob' });\n */\n merge<P extends ObjectPaths<TData>>(\n path: P,\n value: { [K in keyof ValueAt<TData, P>]?: Exclude<ValueAt<TData, P>[K], undefined> },\n ): MergePatch;\n\n /**\n * Raw (untyped) patch creation โ escape hatch for dynamic paths\n * or platform namespace ($*) targets.\n */\n raw: {\n set(path: string, value: unknown): SetPatch;\n unset(path: string): UnsetPatch;\n merge(path: string, value: Record<string, unknown>): MergePatch;\n };\n}\n\n// ============================================================================\n// Factory\n// ============================================================================\n\n/**\n * Create a type-safe patch operations builder.\n *\n * Injects the domain state type to enable:\n * - IDE autocomplete on all valid state paths\n * - Compile-time type checking of patch values\n * - Merge restricted to object-typed paths\n *\n * @typeParam TData - The shape of domain state (snapshot.data)\n *\n * @example\n * type State = {\n * count: number;\n * user: { name: string; age: number };\n * tags: string[];\n * };\n *\n * const ops = defineOps<State>();\n *\n * ops.set('count', 5); // OK โ value: number\n * ops.set('user.name', 'Alice'); // OK โ value: string\n * ops.set('count', 'hello'); // TS error โ expected number\n * ops.merge('user', { name: 'B' }); // OK โ partial object merge\n * ops.unset('tags'); // OK\n *\n * // Escape hatch for dynamic / platform paths\n * ops.raw.set('$host.custom', { key: 'value' });\n */\nexport function defineOps<\n TData extends Record<string, unknown>,\n>(): TypedOps<TData> {\n const toPatchPath = (path: string) => semanticPathToPatchPath(path);\n\n return {\n set(path: string, value: unknown): SetPatch {\n return { op: \"set\", path: toPatchPath(path), value };\n },\n unset(path: string): UnsetPatch {\n return { op: \"unset\", path: toPatchPath(path) };\n },\n merge(path: string, value: unknown): MergePatch {\n return { op: \"merge\", path: toPatchPath(path), value: value as Record<string, unknown> };\n },\n raw: {\n set(path: string, value: unknown): SetPatch {\n return { op: \"set\", path: toPatchPath(path), value };\n },\n unset(path: string): UnsetPatch {\n return { op: \"unset\", path: toPatchPath(path) };\n },\n merge(path: string, value: Record<string, unknown>): MergePatch {\n return { op: \"merge\", path: toPatchPath(path), value };\n },\n },\n };\n}\n","/**\n * @manifesto-ai/sdk v1.0.0\n *\n * Protocol-first SDK โ thin composition layer over the Manifesto protocol stack.\n * The SDK owns one concept: createManifesto().\n *\n * @see sdk-SPEC-v1.0.0.md\n * @see ADR-010\n * @packageDocumentation\n */\n\nexport type { SdkManifest } from \"./manifest.js\";\n\n// =============================================================================\n// SDK-Owned Exports\n// =============================================================================\n\nexport { createManifesto } from \"./create-manifesto.js\";\nexport { dispatchAsync, DispatchRejectedError } from \"./dispatch-async.js\";\n\nexport type {\n Snapshot,\n ManifestoInstance,\n ManifestoConfig,\n ManifestoEvent,\n ManifestoEventMap,\n ManifestoEventPayload,\n EffectContext,\n EffectHandler,\n Selector,\n Unsubscribe,\n} from \"./types.js\";\n\nexport {\n ManifestoError,\n ReservedEffectError,\n DisposedError,\n CompileError,\n} from \"./errors.js\";\n\nexport type { CompileDiagnostic } from \"./errors.js\";\n\n// =============================================================================\n// Typed Patch Operations (SDK-owned utility)\n// =============================================================================\n\nexport { defineOps } from \"./typed-ops.js\";\nexport type { TypedOps, DataPaths, ValueAt, ObjectPaths } from \"./typed-ops.js\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/core (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type {\n DomainSchema,\n Snapshot as CoreSnapshot,\n Patch,\n SetPatch,\n UnsetPatch,\n MergePatch,\n Intent,\n ComputeResult,\n Requirement,\n ErrorValue,\n TraceGraph,\n} from \"@manifesto-ai/core\";\n\nexport { createIntent, createSnapshot, createCore } from \"@manifesto-ai/core\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/host (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type { HostResult, HostOptions } from \"@manifesto-ai/host\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/world (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type { WorldStore } from \"@manifesto-ai/world\";\nexport { createMemoryWorldStore } from \"@manifesto-ai/world\";\n"],"mappings":";AAWA;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;;;ACR1B,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAC/B;AAAA,EAET,YAAY,MAAc,SAAiB,SAAwB;AACjE,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;AAWO,IAAM,sBAAN,cAAkC,eAAe;AAAA,EAC7C;AAAA,EAET,YAAY,YAAoB;AAC9B;AAAA,MACE;AAAA,MACA,gBAAgB,UAAU;AAAA,IAC5B;AACA,SAAK,OAAO;AACZ,SAAK,aAAa;AAAA,EACpB;AACF;AAeO,IAAM,eAAN,cAA2B,eAAe;AAAA,EACtC;AAAA,EAET,YAAY,aAA2C,kBAA0B;AAC/E,UAAM,iBAAiB,gBAAgB;AACvC,SAAK,OAAO;AACZ,SAAK,cAAc;AAAA,EACrB;AACF;AA2BO,IAAM,gBAAN,cAA4B,eAAe;AAAA,EAChD,cAAc;AACZ,UAAM,YAAY,iDAAiD;AACnE,SAAK,OAAO;AAAA,EACd;AACF;;;AD1DA,IAAM,uBAAuB;AAG7B,IAAM,4BAA4B;AAgB3B,SAAS,gBACd,QACsB;AAEtB,QAAM,SAAS,cAAc,OAAO,MAAM;AAG1C,MAAI,wBAAwB,OAAO,SAAS;AAC1C,UAAM,IAAI,oBAAoB,oBAAoB;AAAA,EACpD;AAGA,6BAA2B,MAAM;AAGjC,QAAM,OAAO,mBAAmB,QAAQ,OAAO,SAAS,OAAO,QAAQ;AAIvE,MAAI,kBAAgC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AAqB;AAC5B,MAAI,OAAO,WAAW,eAAe,OAAO,YAAY;AACtD,WAAO,OAAO,WAAW;AAAA,EAC3B;AACA,SAAO,uCAAuC,QAAQ,SAAS,CAAC,MAAM;AACpE,UAAM,IAAK,KAAK,OAAO,IAAI,KAAM;AACjC,UAAM,IAAI,MAAM,MAAM,IAAK,IAAI,IAAO;AACtC,WAAO,EAAE,SAAS,EAAE;AAAA,EACtB,CAAC;AACH;;;ACvFA,SAAS,2BAAAC,gCAA+B;AAsLjC,SAAS,YAEK;AACnB,QAAM,cAAc,CAAC,SAAiBA,yBAAwB,IAAI;AAElE,SAAO;AAAA,IACL,IAAI,MAAc,OAA0B;AAC1C,aAAO,EAAE,IAAI,OAAO,MAAM,YAAY,IAAI,GAAG,MAAM;AAAA,IACrD;AAAA,IACA,MAAM,MAA0B;AAC9B,aAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,EAAE;AAAA,IAChD;AAAA,IACA,MAAM,MAAc,OAA4B;AAC9C,aAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,GAAG,MAAwC;AAAA,IACzF;AAAA,IACA,KAAK;AAAA,MACH,IAAI,MAAc,OAA0B;AAC1C,eAAO,EAAE,IAAI,OAAO,MAAM,YAAY,IAAI,GAAG,MAAM;AAAA,MACrD;AAAA,MACA,MAAM,MAA0B;AAC9B,eAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,EAAE;AAAA,MAChD;AAAA,MACA,MAAM,MAAc,OAA4C;AAC9D,eAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,GAAG,MAAM;AAAA,MACvD;AAAA,IACF;AAAA,EACF;AACF;;;AC9IA,SAAS,cAAc,gBAAgB,kBAAkB;AAazD,SAAS,8BAA8B;","names":["patches","semanticPathToPatchPath"]}
|
|
1
|
+
{"version":3,"sources":["../src/create-manifesto.ts","../src/errors.ts","../src/dispatch-async.ts","../src/typed-ops.ts","../src/index.ts"],"sourcesContent":["/**\n * createManifesto() Factory\n *\n * The sole SDK-owned concept. Creates a ManifestoInstance that composes\n * the four protocol axes (Core, Host, World, Compiler) into a single handle.\n *\n * @see SDK SPEC v1.0.0 ยง5\n * @see ADR-010\n * @module\n */\n\nimport {\n createHost,\n type ManifestoHost,\n type EffectHandler as HostEffectHandler,\n type EffectContext as HostEffectContext,\n} from \"@manifesto-ai/host\";\nimport {\n type DomainSchema,\n type Patch,\n type Snapshot as CoreSnapshot,\n type Intent,\n semanticPathToPatchPath,\n extractDefaults,\n} from \"@manifesto-ai/core\";\nimport { compileMelDomain } from \"@manifesto-ai/compiler\";\n\nimport type {\n Snapshot,\n ManifestoConfig,\n ManifestoInstance,\n ManifestoEvent,\n ManifestoEventMap,\n EffectHandler,\n Selector,\n Unsubscribe,\n} from \"./types.js\";\nimport { ReservedEffectError, DisposedError, ManifestoError, CompileError } from \"./errors.js\";\n\n// =============================================================================\n// Constants\n// =============================================================================\n\n/** Reserved effect type used by the compiler for $system.* references. */\nconst RESERVED_EFFECT_TYPE = \"system.get\";\n\n/** Reserved namespace prefix for system actions. */\nconst RESERVED_NAMESPACE_PREFIX = \"system.\";\n\n// =============================================================================\n// createManifesto() โ SDK SPEC v1.0.0 ยง5\n// =============================================================================\n\n/**\n * Create a ManifestoInstance.\n *\n * This is the sole entry point for SDK consumers. It composes the protocol\n * axes (Core via Host, Host, World, Compiler) into a single handle with\n * 5 methods: dispatch, subscribe, on, getSnapshot, dispose.\n *\n * @see SDK-FACTORY-1 through SDK-FACTORY-5\n * @see SDK-INV-1 through SDK-INV-6\n */\nexport function createManifesto<T = unknown>(\n config: ManifestoConfig<T>,\n): ManifestoInstance<T> {\n // โโโ INV-3: Schema resolution โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const schema = resolveSchema(config.schema);\n\n // โโโ INV-4: Reserved effect protection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n if (RESERVED_EFFECT_TYPE in config.effects) {\n throw new ReservedEffectError(RESERVED_EFFECT_TYPE);\n }\n\n // Validate no user actions use reserved namespace\n validateReservedNamespaces(schema);\n\n // โโโ INV-5: Host creation + effect registration โโโโโโโโโโโโโโโโโโโโโโโโ\n const host = createInternalHost(schema, config.effects, config.snapshot);\n\n // โโโ State holder (closure-captured) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n // Host always initializes with a snapshot (initialData defaults to {})\n let currentSnapshot: CoreSnapshot = host.getSnapshot()!;\n\n // โโโ Subscription store โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const subscribers = new Set<Subscriber<unknown>>();\n\n // โโโ Event channel (telemetry) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const eventListeners = new Map<ManifestoEvent, Set<(payload: ManifestoEventMap<T>[ManifestoEvent]) => void>>();\n\n // โโโ Serial dispatch queue (SDK-INV-5) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n let dispatchQueue: Promise<void> = Promise.resolve();\n\n // โโโ Disposed flag โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n let disposed = false;\n\n // โโโ Guard function โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n const guard = config.guard ?? null;\n\n // =========================================================================\n // dispatch() โ SDK-DISPATCH-1~4\n // =========================================================================\n\n function dispatch(intent: Intent): void {\n // SDK-DISPATCH-4\n if (disposed) {\n throw new DisposedError();\n }\n\n // SDK-DISPATCH-2: Enrich with intentId if not provided\n const enrichedIntent: Intent = intent.intentId\n ? intent\n : { ...intent, intentId: generateIntentId() };\n\n // SDK-DISPATCH-1, SDK-DISPATCH-3: Enqueue for serial processing\n const prev = dispatchQueue;\n dispatchQueue = prev\n .catch(() => {}) // Previous failure doesn't block queue\n .then(() => processIntent(enrichedIntent));\n // Tail always resolves\n dispatchQueue = dispatchQueue.catch(() => {});\n }\n\n /**\n * Process a single intent through the Host dispatch cycle.\n */\n async function processIntent(intent: Intent): Promise<void> {\n // SDK-DISPOSE-1: Do not process queued intents after dispose\n if (disposed) return;\n\n // SDK-INV-5: Guard evaluates against current snapshot at dequeue time\n if (guard) {\n try {\n // SDK-SNAP-IMMUTABLE: Prevent guard from mutating internal state\n const allowed = guard(intent, Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>);\n if (!allowed) {\n emitEvent(\"dispatch:rejected\", {\n intentId: intent.intentId,\n intent,\n reason: \"Guard rejected the intent\",\n });\n return;\n }\n } catch (error) {\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n return;\n }\n }\n\n try {\n const result = await host.dispatch(intent);\n\n if (result.status === \"error\") {\n currentSnapshot = result.snapshot;\n notifySubscribers();\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: result.error ?? new ManifestoError(\"HOST_ERROR\", \"Host dispatch failed\"),\n });\n return;\n }\n\n // Update state\n currentSnapshot = result.snapshot;\n\n // SDK-INV-1: notify subscribers at terminal snapshot only\n notifySubscribers();\n\n emitEvent(\"dispatch:completed\", {\n intentId: intent.intentId,\n intent,\n snapshot: result.snapshot as Snapshot<T>,\n });\n } catch (error) {\n emitEvent(\"dispatch:failed\", {\n intentId: intent.intentId,\n intent,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n\n // =========================================================================\n // subscribe() โ SDK-SUB-1~4\n // =========================================================================\n\n function subscribe<R>(\n selector: Selector<T, R>,\n listener: (value: R) => void,\n ): Unsubscribe {\n if (disposed) return () => {};\n\n const sub: Subscriber<R> = {\n selector: selector as Selector<unknown, R>,\n listener,\n lastValue: selector(currentSnapshot as Snapshot<T>),\n initialized: true,\n };\n\n subscribers.add(sub as Subscriber<unknown>);\n\n return () => {\n subscribers.delete(sub as Subscriber<unknown>);\n };\n }\n\n // =========================================================================\n // on() โ SDK-EVENT-1~3, SDK-INV-2\n // =========================================================================\n\n function on<K extends ManifestoEvent>(\n event: K,\n handler: (payload: ManifestoEventMap<T>[K]) => void,\n ): Unsubscribe {\n if (disposed) return () => {};\n\n let listeners = eventListeners.get(event);\n if (!listeners) {\n listeners = new Set();\n eventListeners.set(event, listeners as Set<(payload: ManifestoEventMap<T>[ManifestoEvent]) => void>);\n }\n listeners.add(handler as (payload: ManifestoEventMap<T>[ManifestoEvent]) => void);\n\n return () => {\n listeners!.delete(handler as (payload: ManifestoEventMap<T>[ManifestoEvent]) => void);\n };\n }\n\n // =========================================================================\n // getSnapshot() โ SDK-SNAP-1\n // =========================================================================\n\n function getSnapshot(): Snapshot<T> {\n // SDK-SNAP-IMMUTABLE: Return a frozen copy to prevent external mutation\n // that would bypass the patch/apply pipeline.\n return Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>;\n }\n\n // =========================================================================\n // dispose() โ SDK-DISPOSE-1~3\n // =========================================================================\n\n function dispose(): void {\n if (disposed) return;\n disposed = true;\n\n // Release all resources\n subscribers.clear();\n eventListeners.clear();\n }\n\n // =========================================================================\n // Internal helpers\n // =========================================================================\n\n /** Notify all subscribers with current snapshot (SDK-INV-1). */\n function notifySubscribers(): void {\n // SDK-SNAP-IMMUTABLE: Pass a frozen clone to selectors so that neither\n // selector nor listener can mutate internal state.\n const frozenSnap = Object.freeze(structuredClone(currentSnapshot)) as Snapshot<T>;\n for (const sub of subscribers) {\n const selected = (sub.selector as Selector<T, unknown>)(frozenSnap);\n\n // Selector-based change detection (SDK-SUB-4)\n if (sub.initialized && Object.is(sub.lastValue, selected)) {\n continue;\n }\n\n sub.lastValue = selected;\n sub.initialized = true;\n sub.listener(selected);\n }\n }\n\n /** Emit an event to the telemetry channel. */\n function emitEvent<K extends ManifestoEvent>(\n event: K,\n payload: ManifestoEventMap<T>[K],\n ): void {\n const listeners = eventListeners.get(event);\n if (!listeners) return;\n for (const handler of listeners) {\n try {\n handler(payload);\n } catch {\n // Event handlers must not break the dispatch loop\n }\n }\n }\n\n // =========================================================================\n // Return ManifestoInstance\n // =========================================================================\n\n return { dispatch, subscribe, on, getSnapshot, dispose };\n}\n\n// =============================================================================\n// Schema Resolution (INV-3)\n// =============================================================================\n\n/**\n * Resolve schema from DomainSchema or MEL text string.\n * Injects platform namespaces ($host, $mel).\n */\nfunction resolveSchema(schema: DomainSchema | string): DomainSchema {\n let domainSchema: DomainSchema;\n\n if (typeof schema === \"string\") {\n const result = compileMelDomain(schema, { mode: \"domain\" });\n\n if (result.errors.length > 0) {\n const formatted = result.errors.map((d) => {\n const loc = d.location;\n const header = loc && (loc.start.line > 0 || loc.start.column > 0)\n ? `[${d.code}] ${d.message} (${loc.start.line}:${loc.start.column})`\n : `[${d.code}] ${d.message}`;\n\n if (!loc || loc.start.line === 0) return header;\n\n const sourceLines = schema.split(\"\\n\");\n const lineContent = sourceLines[loc.start.line - 1];\n if (!lineContent) return header;\n\n const lineNumStr = String(loc.start.line).padStart(4, \" \");\n const underlineLen = Math.max(1,\n loc.end.line === loc.start.line\n ? Math.min(loc.end.column - loc.start.column, lineContent.length - loc.start.column + 1)\n : 1);\n const padding = \" \".repeat(lineNumStr.length + 3 + loc.start.column - 1);\n return `${header}\\n${lineNumStr} | ${lineContent}\\n${padding}${\"^\".repeat(underlineLen)}`;\n }).join(\"\\n\\n\");\n\n throw new CompileError(\n result.errors,\n `MEL compilation failed:\\n${formatted}`,\n );\n }\n\n if (!result.schema) {\n throw new ManifestoError(\n \"COMPILE_ERROR\",\n \"MEL compilation produced no schema\",\n );\n }\n\n domainSchema = result.schema as DomainSchema;\n } else {\n domainSchema = schema;\n }\n\n return withPlatformNamespaces(domainSchema);\n}\n\n// =============================================================================\n// Platform Namespace Injection (INV-3)\n// =============================================================================\n\n/**\n * Inject $host and $mel platform namespaces into schema.\n * Absorbed from runtime/src/schema/schema-manager.ts.\n */\nfunction withPlatformNamespaces(schema: DomainSchema): DomainSchema {\n const fields = { ...schema.state.fields };\n let changed = false;\n\n // $host namespace\n if (!fields.$host) {\n fields.$host = {\n type: \"object\",\n required: false,\n default: {},\n };\n changed = true;\n } else if (fields.$host.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$host' must be an object field\",\n );\n } else if (fields.$host.default === undefined) {\n fields.$host = { ...fields.$host, default: {} };\n changed = true;\n }\n\n // $mel namespace with guards.intent structure\n if (!fields.$mel) {\n fields.$mel = {\n type: \"object\",\n required: false,\n default: { guards: { intent: {} } },\n fields: {\n guards: {\n type: \"object\",\n required: false,\n default: { intent: {} },\n fields: {\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n },\n },\n };\n changed = true;\n } else if (fields.$mel.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel' must be an object field\",\n );\n } else {\n let nextMel = fields.$mel;\n if (nextMel.default === undefined) {\n nextMel = { ...nextMel, default: { guards: { intent: {} } } };\n changed = true;\n }\n\n const melFields = nextMel.fields ?? {};\n const guardsField = melFields.guards;\n\n if (!guardsField) {\n nextMel = {\n ...nextMel,\n fields: {\n ...melFields,\n guards: {\n type: \"object\",\n required: false,\n default: { intent: {} },\n fields: {\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n },\n },\n };\n changed = true;\n } else if (guardsField.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel.guards' must be an object field\",\n );\n } else {\n let nextGuards = guardsField;\n if (guardsField.default === undefined) {\n nextGuards = { ...nextGuards, default: { intent: {} } };\n changed = true;\n }\n\n const guardFields = nextGuards.fields ?? {};\n const intentField = guardFields.intent;\n\n if (!intentField) {\n nextGuards = {\n ...nextGuards,\n fields: {\n ...guardFields,\n intent: {\n type: \"object\",\n required: false,\n default: {},\n },\n },\n };\n changed = true;\n } else if (intentField.type !== \"object\") {\n throw new ManifestoError(\n \"SCHEMA_ERROR\",\n \"Reserved namespace '$mel.guards.intent' must be an object field\",\n );\n } else if (intentField.default === undefined) {\n nextGuards = {\n ...nextGuards,\n fields: {\n ...guardFields,\n intent: { ...intentField, default: {} },\n },\n };\n changed = true;\n }\n\n if (nextGuards !== guardsField) {\n nextMel = {\n ...nextMel,\n fields: {\n ...melFields,\n guards: nextGuards,\n },\n };\n }\n }\n\n if (nextMel !== fields.$mel) {\n fields.$mel = nextMel;\n changed = true;\n }\n }\n\n if (!changed) return schema;\n\n return {\n ...schema,\n state: {\n ...schema.state,\n fields,\n },\n };\n}\n\n// =============================================================================\n// Reserved Namespace Validation\n// =============================================================================\n\nfunction validateReservedNamespaces(schema: DomainSchema): void {\n const actions = schema.actions || {};\n for (const actionType of Object.keys(actions)) {\n if (actionType.startsWith(RESERVED_NAMESPACE_PREFIX)) {\n throw new ManifestoError(\n \"RESERVED_NAMESPACE\",\n `Action type \"${actionType}\" uses reserved namespace prefix \"${RESERVED_NAMESPACE_PREFIX}\"`,\n );\n }\n }\n}\n\n// =============================================================================\n// Internal Host Creation (INV-5)\n// Absorbed from runtime/src/execution/internal-host.ts\n// =============================================================================\n\nfunction createInternalHost(\n schema: DomainSchema,\n effects: Record<string, EffectHandler>,\n initialSnapshot?: Snapshot,\n): ManifestoHost {\n const host = createHost(schema, {\n initialData: initialSnapshot?.data ?? extractDefaults(schema.state),\n });\n\n // P1-1: When restoring from a persisted snapshot, use host.reset() to\n // hydrate the full canonical Snapshot (meta, system, input) rather than\n // only forwarding data via initialData which resets meta.version to 0.\n if (initialSnapshot) {\n host.reset(initialSnapshot);\n }\n\n // Register reserved system.get handler (compiler-internal, CRITICAL)\n host.registerEffect(RESERVED_EFFECT_TYPE, async (\n _type: string,\n params: Record<string, unknown>,\n ctx: HostEffectContext,\n ): Promise<Patch[]> => {\n const { patches } = executeSystemGet(params, ctx.snapshot);\n return patches;\n });\n\n // Register user effects, adapting 2-param โ 3-param signature\n for (const [effectType, appHandler] of Object.entries(effects)) {\n const hostHandler: HostEffectHandler = async (\n _type: string,\n params: Record<string, unknown>,\n ctx: HostEffectContext,\n ): Promise<Patch[]> => {\n const appCtx = { snapshot: ctx.snapshot };\n const patches = await appHandler(params, appCtx);\n return patches as Patch[];\n };\n\n host.registerEffect(effectType, hostHandler);\n }\n\n return host;\n}\n\n// =============================================================================\n// system.get Effect Implementation\n// Absorbed from runtime/src/execution/system-get.ts\n// =============================================================================\n\ninterface SystemGetReadParams {\n path: string;\n target?: string;\n}\n\ninterface SystemGetGenerateParams {\n key: string;\n into: string;\n}\n\ntype SystemGetParams = SystemGetReadParams | SystemGetGenerateParams;\n\nfunction isGenerateParams(params: unknown): params is SystemGetGenerateParams {\n return (\n typeof params === \"object\" &&\n params !== null &&\n \"key\" in params &&\n \"into\" in params\n );\n}\n\nfunction generateSystemValue(key: string): unknown {\n switch (key) {\n case \"uuid\":\n return generateUUID();\n case \"timestamp\":\n case \"time.now\":\n return Date.now();\n case \"isoTimestamp\":\n return new Date().toISOString();\n default:\n return null;\n }\n}\n\nfunction generateUUID(): string {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nfunction executeSystemGet(\n params: unknown,\n snapshot: Snapshot,\n): { patches: Patch[] } {\n if (isGenerateParams(params)) {\n const value = generateSystemValue(params.key);\n const patches: Patch[] = [{\n op: \"set\",\n path: normalizeTargetPath(params.into),\n value,\n }];\n return { patches };\n }\n\n // Read mode\n const { path, target } = params as SystemGetReadParams;\n const result = resolvePathValue(path, snapshot);\n\n const patches: Patch[] = [];\n if (target) {\n patches.push({\n op: \"set\",\n path: normalizeTargetPath(target),\n value: result.value,\n });\n }\n\n return { patches };\n}\n\nfunction normalizePath(path: string): string {\n if (path.startsWith(\"/\")) {\n return path.slice(1).replace(/\\//g, \".\");\n }\n return path;\n}\n\nfunction normalizeTargetPath(path: string): Patch[\"path\"] {\n const normalized = normalizePath(path);\n const withoutDataRoot = normalized.startsWith(\"data.\")\n ? normalized.slice(\"data.\".length)\n : normalized;\n return semanticPathToPatchPath(withoutDataRoot);\n}\n\nfunction resolvePathValue(\n path: string,\n snapshot: Snapshot,\n): { value: unknown; found: boolean } {\n const normalized = normalizePath(path);\n const parts = normalized.split(\".\");\n\n if (parts.length === 0) {\n return { value: undefined, found: false };\n }\n\n const root = parts[0];\n const rest = parts.slice(1);\n\n let current: unknown;\n\n switch (root) {\n case \"data\":\n current = snapshot.data;\n break;\n case \"computed\":\n current = snapshot.computed;\n break;\n case \"system\":\n current = snapshot.system;\n break;\n case \"meta\":\n current = snapshot.meta;\n break;\n default:\n current = snapshot.data;\n rest.unshift(root);\n }\n\n for (const part of rest) {\n if (current === null || current === undefined) {\n return { value: undefined, found: false };\n }\n if (typeof current !== \"object\") {\n return { value: undefined, found: false };\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n return { value: current, found: current !== undefined };\n}\n\n// =============================================================================\n// Subscriber Type (internal)\n// =============================================================================\n\ninterface Subscriber<R> {\n selector: Selector<unknown, R>;\n listener: (value: R) => void;\n lastValue: R | undefined;\n initialized: boolean;\n}\n\n// =============================================================================\n// Intent ID Generation (SDK-DISPATCH-2, SDK-INV-6)\n// =============================================================================\n\nfunction generateIntentId(): string {\n return generateUUID();\n}\n","/**\n * SDK v1.0.0 Error Types\n *\n * @see SDK SPEC v1.0.0 ยง12\n * @see SDK-ERR-1, SDK-ERR-2, SDK-ERR-3\n * @module\n */\n\n// =============================================================================\n// Base Error\n// =============================================================================\n\n/**\n * Base error for all SDK errors.\n *\n * @see SDK-ERR-1\n */\nexport class ManifestoError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ManifestoError\";\n this.code = code;\n }\n}\n\n// =============================================================================\n// Reserved Effect Error\n// =============================================================================\n\n/**\n * Thrown when user effects attempt to override reserved effect types (e.g. system.get).\n *\n * @see SDK-ERR-2, SDK-INV-4\n */\nexport class ReservedEffectError extends ManifestoError {\n readonly effectType: string;\n\n constructor(effectType: string) {\n super(\n \"RESERVED_EFFECT\",\n `Effect type \"${effectType}\" is reserved and cannot be overridden`,\n );\n this.name = \"ReservedEffectError\";\n this.effectType = effectType;\n }\n}\n\n// =============================================================================\n// Disposed Error\n// =============================================================================\n\n// =============================================================================\n// Compile Error\n// =============================================================================\n\n/**\n * Thrown when MEL compilation fails. Exposes full diagnostic info.\n *\n * @see SDK-ERR-4\n */\nexport class CompileError extends ManifestoError {\n readonly diagnostics: readonly CompileDiagnostic[];\n\n constructor(diagnostics: readonly CompileDiagnostic[], formattedMessage: string) {\n super(\"COMPILE_ERROR\", formattedMessage);\n this.name = \"CompileError\";\n this.diagnostics = diagnostics;\n }\n}\n\n/**\n * Minimal diagnostic shape exposed by SDK.\n * Matches @manifesto-ai/compiler Diagnostic but avoids hard dependency.\n */\nexport interface CompileDiagnostic {\n readonly severity: \"error\" | \"warning\" | \"info\";\n readonly code: string;\n readonly message: string;\n readonly location: {\n readonly start: { readonly line: number; readonly column: number; readonly offset: number };\n readonly end: { readonly line: number; readonly column: number; readonly offset: number };\n };\n readonly source?: string;\n readonly suggestion?: string;\n}\n\n// =============================================================================\n// Disposed Error\n// =============================================================================\n\n/**\n * Thrown when dispatch is called on a disposed instance.\n *\n * @see SDK-ERR-3, SDK-DISPATCH-4\n */\nexport class DisposedError extends ManifestoError {\n constructor() {\n super(\"DISPOSED\", \"Cannot dispatch on a disposed ManifestoInstance\");\n this.name = \"DisposedError\";\n }\n}\n","/**\n * dispatchAsync() โ Non-normative convenience utility\n *\n * Promise-based wrapper around dispatch() + on().\n * Resolves when the intent reaches a terminal state.\n *\n * @see SDK SPEC v1.0.0 ยง14.3\n * @module\n */\n\nimport type { Intent } from \"@manifesto-ai/core\";\nimport type { Snapshot, ManifestoInstance } from \"./types.js\";\n\n/**\n * Error thrown when an intent is rejected by a guard.\n */\nexport class DispatchRejectedError extends Error {\n readonly code = \"DISPATCH_REJECTED\";\n readonly intentId: string;\n\n constructor(intentId: string, reason?: string) {\n super(reason ?? \"Intent was rejected by guard\");\n this.name = \"DispatchRejectedError\";\n this.intentId = intentId;\n }\n}\n\n/**\n * Dispatch an intent and wait for it to complete.\n *\n * - Resolves with the terminal Snapshot on `dispatch:completed`\n * - Rejects with the error on `dispatch:failed`\n * - Rejects with DispatchRejectedError on `dispatch:rejected`\n *\n * This is a convenience utility derived entirely from `dispatch` + `on`.\n * It does NOT violate the \"one owned concept\" rule.\n *\n * @see SDK SPEC v1.0.0 ยง14.3\n */\nexport function dispatchAsync<T = unknown>(\n instance: ManifestoInstance<T>,\n intent: Intent,\n): Promise<Snapshot<T>> {\n const intentId = intent.intentId ?? generateId();\n const enriched: Intent = intent.intentId ? intent : { ...intent, intentId };\n\n return new Promise((resolve, reject) => {\n const cleanup = () => {\n unsubCompleted();\n unsubFailed();\n unsubRejected();\n };\n\n const unsubCompleted = instance.on(\"dispatch:completed\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n resolve(e.snapshot);\n }\n });\n\n const unsubFailed = instance.on(\"dispatch:failed\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n reject(e.error ?? new Error(\"Dispatch failed\"));\n }\n });\n\n const unsubRejected = instance.on(\"dispatch:rejected\", (e) => {\n if (e.intentId === intentId) {\n cleanup();\n reject(new DispatchRejectedError(intentId, e.reason));\n }\n });\n\n instance.dispatch(enriched);\n });\n}\n\nfunction generateId(): string {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n","import { semanticPathToPatchPath } from \"@manifesto-ai/core\";\nimport type { SetPatch, UnsetPatch, MergePatch } from \"@manifesto-ai/core\";\n\n// ============================================================================\n// Type-Level Path Utilities\n// ============================================================================\n\n/**\n * Depth counter for recursive type operations.\n * Prevents infinite recursion in TypeScript's type system.\n *\n * Usage: Prev[4] = 3, Prev[3] = 2, ... Prev[0] = never\n */\ntype Prev = [never, 0, 1, 2, 3, 4];\n\n/**\n * Extract all valid dot-separated paths from a data type.\n *\n * - Object keys become path segments\n * - Nested objects generate dot-separated paths (e.g. \"user.name\")\n * - Arrays, primitives, and Record<string, T> are leaf nodes\n * (Record sub-paths are not supported by Core's path resolution)\n * - Limited to 3 levels of nesting to avoid TS recursion limits\n * (root key + 3 nested levels = max 4 path segments)\n *\n * @example\n * type State = { user: { name: string; age: number }; count: number };\n * type P = DataPaths<State>;\n * // \"user\" | \"user.name\" | \"user.age\" | \"count\"\n */\nexport type DataPaths<T, D extends number = 3> = [D] extends [never]\n ? never\n : T extends Record<string, unknown>\n ? T extends unknown[]\n ? never\n : {\n [K in keyof T & string]:\n | K\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : string extends keyof NonNullable<T[K]>\n ? never // Record<string, T> โ dynamic keys not resolved by Core\n : `${K}.${DataPaths<NonNullable<T[K]>, Prev[D]>}`\n : never);\n }[keyof T & string]\n : never;\n\n/**\n * Resolve the value type at a dot-separated path.\n *\n * @example\n * type State = { user: { name: string } };\n * type V = ValueAt<State, \"user.name\">; // string\n * type U = ValueAt<State, \"user\">; // { name: string }\n */\nexport type ValueAt<T, P extends string> = P extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? ValueAt<NonNullable<T[K]>, Rest>\n : never\n : P extends keyof T\n ? T[P]\n : never;\n\n/**\n * Paths that resolve to plain object types (valid targets for merge).\n * Arrays and primitives are excluded since merge performs shallow object merge.\n *\n * @example\n * type State = { user: { name: string }; tags: string[]; count: number };\n * type M = ObjectPaths<State>;\n * // \"user\" (tags and count excluded - not plain objects)\n */\nexport type ObjectPaths<T, D extends number = 3> = [D] extends [never]\n ? never\n : T extends Record<string, unknown>\n ? T extends unknown[]\n ? never\n : {\n [K in keyof T & string]:\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : K\n : never)\n | (NonNullable<T[K]> extends Record<string, unknown>\n ? NonNullable<T[K]> extends unknown[]\n ? never\n : string extends keyof NonNullable<T[K]>\n ? never // Record<string, T> โ don't recurse into dynamic keys\n : `${K}.${ObjectPaths<NonNullable<T[K]>, Prev[D]>}`\n : never);\n }[keyof T & string]\n : never;\n\n// ============================================================================\n// TypedOps Interface\n// ============================================================================\n\n/**\n * Type-safe patch operations builder.\n *\n * Provides IDE autocomplete for state paths and compile-time type checking\n * for patch values. All methods return standard Patch objects compatible\n * with Core's apply() function.\n * System mutation convenience APIs are intentionally excluded.\n *\n * @typeParam TData - The shape of domain state (snapshot.data)\n */\nexport interface TypedOps<TData extends Record<string, unknown>> {\n /**\n * Create a set patch โ replace value at path (create if missing).\n *\n * @example\n * ops.set('count', 5);\n * ops.set('user.name', 'Alice');\n */\n set<P extends DataPaths<TData>>(path: P, value: Exclude<ValueAt<TData, P>, undefined>): SetPatch;\n\n /**\n * Create an unset patch โ remove property at path.\n *\n * @example\n * ops.unset('temporaryField');\n */\n unset<P extends DataPaths<TData>>(path: P): UnsetPatch;\n\n /**\n * Create a merge patch โ shallow merge at object path.\n * Only valid for paths that resolve to plain object types.\n *\n * @example\n * ops.merge('user', { name: 'Bob' });\n */\n merge<P extends ObjectPaths<TData>>(\n path: P,\n value: { [K in keyof ValueAt<TData, P>]?: Exclude<ValueAt<TData, P>[K], undefined> },\n ): MergePatch;\n\n /**\n * Raw (untyped) patch creation โ escape hatch for dynamic paths\n * or platform namespace ($*) targets.\n */\n raw: {\n set(path: string, value: unknown): SetPatch;\n unset(path: string): UnsetPatch;\n merge(path: string, value: Record<string, unknown>): MergePatch;\n };\n}\n\n// ============================================================================\n// Factory\n// ============================================================================\n\n/**\n * Create a type-safe patch operations builder.\n *\n * Injects the domain state type to enable:\n * - IDE autocomplete on all valid state paths\n * - Compile-time type checking of patch values\n * - Merge restricted to object-typed paths\n *\n * @typeParam TData - The shape of domain state (snapshot.data)\n *\n * @example\n * type State = {\n * count: number;\n * user: { name: string; age: number };\n * tags: string[];\n * };\n *\n * const ops = defineOps<State>();\n *\n * ops.set('count', 5); // OK โ value: number\n * ops.set('user.name', 'Alice'); // OK โ value: string\n * ops.set('count', 'hello'); // TS error โ expected number\n * ops.merge('user', { name: 'B' }); // OK โ partial object merge\n * ops.unset('tags'); // OK\n *\n * // Escape hatch for dynamic / platform paths\n * ops.raw.set('$host.custom', { key: 'value' });\n */\nexport function defineOps<\n TData extends Record<string, unknown>,\n>(): TypedOps<TData> {\n const toPatchPath = (path: string) => semanticPathToPatchPath(path);\n\n return {\n set(path: string, value: unknown): SetPatch {\n return { op: \"set\", path: toPatchPath(path), value };\n },\n unset(path: string): UnsetPatch {\n return { op: \"unset\", path: toPatchPath(path) };\n },\n merge(path: string, value: unknown): MergePatch {\n return { op: \"merge\", path: toPatchPath(path), value: value as Record<string, unknown> };\n },\n raw: {\n set(path: string, value: unknown): SetPatch {\n return { op: \"set\", path: toPatchPath(path), value };\n },\n unset(path: string): UnsetPatch {\n return { op: \"unset\", path: toPatchPath(path) };\n },\n merge(path: string, value: Record<string, unknown>): MergePatch {\n return { op: \"merge\", path: toPatchPath(path), value };\n },\n },\n };\n}\n","/**\n * @manifesto-ai/sdk v2.0.0\n *\n * Protocol-first SDK โ thin composition layer over the Manifesto protocol stack.\n * The SDK owns one concept: createManifesto().\n *\n * @see sdk-SPEC-v2.0.0.md\n * @see ADR-010\n * @packageDocumentation\n */\n\nexport type { SdkManifest } from \"./manifest.js\";\n\n// =============================================================================\n// SDK-Owned Exports\n// =============================================================================\n\nexport { createManifesto } from \"./create-manifesto.js\";\nexport { dispatchAsync, DispatchRejectedError } from \"./dispatch-async.js\";\n\nexport type {\n Snapshot,\n ManifestoInstance,\n ManifestoConfig,\n ManifestoEvent,\n ManifestoEventMap,\n ManifestoEventPayload,\n EffectContext,\n EffectHandler,\n Selector,\n Unsubscribe,\n} from \"./types.js\";\n\nexport {\n ManifestoError,\n ReservedEffectError,\n DisposedError,\n CompileError,\n} from \"./errors.js\";\n\nexport type { CompileDiagnostic } from \"./errors.js\";\n\n// =============================================================================\n// Typed Patch Operations (SDK-owned utility)\n// =============================================================================\n\nexport { defineOps } from \"./typed-ops.js\";\nexport type { TypedOps, DataPaths, ValueAt, ObjectPaths } from \"./typed-ops.js\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/core (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type {\n DomainSchema,\n Snapshot as CoreSnapshot,\n Patch,\n SetPatch,\n UnsetPatch,\n MergePatch,\n Intent,\n ComputeResult,\n Requirement,\n ErrorValue,\n TraceGraph,\n} from \"@manifesto-ai/core\";\n\nexport { createIntent, createSnapshot, createCore } from \"@manifesto-ai/core\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/host (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type { HostResult, HostOptions } from \"@manifesto-ai/host\";\n\n// =============================================================================\n// Protocol Re-exports โ @manifesto-ai/world (SDK-REEXPORT-1)\n// =============================================================================\n\nexport type {\n CommitCapableWorldStore,\n CoordinatorSealGenesisParams,\n CoordinatorSealNextParams,\n GovernanceEventDispatcher,\n SealResult,\n WorldConfig,\n WorldCoordinator,\n WorldInstance,\n WriteSet,\n} from \"@manifesto-ai/world\";\nexport {\n createInMemoryWorldStore,\n createWorld,\n} from \"@manifesto-ai/world\";\n"],"mappings":";AAWA;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EAKE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;;;ACR1B,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAC/B;AAAA,EAET,YAAY,MAAc,SAAiB,SAAwB;AACjE,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;AAWO,IAAM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AAM,MAA0B;AAC9B,aAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,EAAE;AAAA,IAChD;AAAA,IACA,MAAM,MAAc,OAA4B;AAC9C,aAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,GAAG,MAAwC;AAAA,IACzF;AAAA,IACA,KAAK;AAAA,MACH,IAAI,MAAc,OAA0B;AAC1C,eAAO,EAAE,IAAI,OAAO,MAAM,YAAY,IAAI,GAAG,MAAM;AAAA,MACrD;AAAA,MACA,MAAM,MAA0B;AAC9B,eAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,EAAE;AAAA,MAChD;AAAA,MACA,MAAM,MAAc,OAA4C;AAC9D,eAAO,EAAE,IAAI,SAAS,MAAM,YAAY,IAAI,GAAG,MAAM;AAAA,MACvD;AAAA,IACF;AAAA,EACF;AACF;;;AC9IA,SAAS,cAAc,gBAAgB,kBAAkB;AAuBzD;AAAA,EACE;AAAA,EACA;AAAA,OACK;","names":["patches","semanticPathToPatchPath"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifesto-ai/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Manifesto SDK - Public API for the semantic layer",
|
|
5
5
|
"author": "eggplantiny <eggplantiny@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@manifesto-ai/core": "2.7.1",
|
|
39
|
-
"@manifesto-ai/host": "2.3.
|
|
40
|
-
"@manifesto-ai/world": "
|
|
41
|
-
"@manifesto-ai/compiler": "1.8.
|
|
39
|
+
"@manifesto-ai/host": "2.3.5",
|
|
40
|
+
"@manifesto-ai/world": "3.0.0",
|
|
41
|
+
"@manifesto-ai/compiler": "1.8.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^5.9.3",
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"build": "tsup",
|
|
50
50
|
"dev": "tsc --watch",
|
|
51
51
|
"clean": "rm -rf dist",
|
|
52
|
-
"
|
|
52
|
+
"lint": "echo 'lint not configured'",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:coverage": "vitest run --coverage"
|
|
53
55
|
}
|
|
54
56
|
}
|