@private.me/xcontinuity 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/AGENTS.md +123 -0
  2. package/LICENSE.md +26 -0
  3. package/MIGRATING.md +77 -0
  4. package/README.md +601 -0
  5. package/dist/adjudicator.d.ts +75 -0
  6. package/dist/adjudicator.js +184 -0
  7. package/dist/cascade.d.ts +157 -0
  8. package/dist/cascade.js +323 -0
  9. package/dist/chronicle.d.ts +76 -0
  10. package/dist/chronicle.js +173 -0
  11. package/dist/cjs/adjudicator.js +189 -0
  12. package/dist/cjs/cascade.js +328 -0
  13. package/dist/cjs/chronicle.js +178 -0
  14. package/dist/cjs/enforcement.js +108 -0
  15. package/dist/cjs/errors.js +72 -0
  16. package/dist/cjs/index.js +108 -0
  17. package/dist/cjs/memory-runtime.js +129 -0
  18. package/dist/cjs/memory-session.js +134 -0
  19. package/dist/cjs/mission.js +178 -0
  20. package/dist/cjs/package.json +1 -0
  21. package/dist/cjs/provenance.js +192 -0
  22. package/dist/cjs/ratification.js +322 -0
  23. package/dist/cjs/reverse-xorida.js +506 -0
  24. package/dist/cjs/session.js +273 -0
  25. package/dist/cjs/state-serializer.js +300 -0
  26. package/dist/cjs/store-memory.js +33 -0
  27. package/dist/cjs/trust.js +133 -0
  28. package/dist/cjs/types.js +59 -0
  29. package/dist/enforcement.d.ts +40 -0
  30. package/dist/enforcement.js +104 -0
  31. package/dist/errors.d.ts +25 -0
  32. package/dist/errors.js +68 -0
  33. package/dist/index.d.ts +34 -0
  34. package/dist/index.js +43 -0
  35. package/dist/memory-runtime.d.ts +36 -0
  36. package/dist/memory-runtime.js +125 -0
  37. package/dist/memory-session.d.ts +38 -0
  38. package/dist/memory-session.js +97 -0
  39. package/dist/mission.d.ts +68 -0
  40. package/dist/mission.js +172 -0
  41. package/dist/provenance.d.ts +54 -0
  42. package/dist/provenance.js +182 -0
  43. package/dist/ratification.d.ts +113 -0
  44. package/dist/ratification.js +317 -0
  45. package/dist/reverse-xorida.d.ts +174 -0
  46. package/dist/reverse-xorida.js +490 -0
  47. package/dist/session.d.ts +102 -0
  48. package/dist/session.js +269 -0
  49. package/dist/state-serializer.d.ts +37 -0
  50. package/dist/state-serializer.js +294 -0
  51. package/dist/store-memory.d.ts +18 -0
  52. package/dist/store-memory.js +29 -0
  53. package/dist/trust.d.ts +76 -0
  54. package/dist/trust.js +121 -0
  55. package/dist/types.d.ts +320 -0
  56. package/dist/types.js +56 -0
  57. package/llms.txt +43 -0
  58. package/package.json +125 -0
  59. package/share1.dat +0 -0
package/AGENTS.md ADDED
@@ -0,0 +1,123 @@
1
+ # AI Agent Context -- @private.me/xcontinuity v2.1.0
2
+
3
+ This file provides guidance for AI coding assistants working on the @private.me/xcontinuity package.
4
+
5
+ ## Package Purpose
6
+
7
+ Cryptographic state continuity substrate for AI agents. Enables agents to persist, restore, and incrementally update state across sessions using XorIDA threshold sharing. The novel contribution is **Reverse-XorIDA**: exploiting XorIDA's linearity over GF(2) to perform incremental state updates at O(delta) cost instead of re-splitting entire state.
8
+
9
+ ## Standard Pattern
10
+
11
+ ```typescript
12
+ import {
13
+ SessionManager,
14
+ MemoryStateStore,
15
+ } from '@private.me/xcontinuity';
16
+
17
+ // Create a session
18
+ const store = new MemoryStateStore();
19
+ const session = await SessionManager.create({
20
+ agentId: 'agent-001',
21
+ store,
22
+ });
23
+
24
+ // Update and snapshot state
25
+ session.updateState({ key: 'value', counter: 42 });
26
+ const snap = await session.snapshot('checkpoint-1');
27
+
28
+ // Restore later
29
+ const restored = await session.restore(snap.value.stateId);
30
+ ```
31
+
32
+ ## Core Concepts
33
+
34
+ 1. **AgentState** — Flat key-value map (`Record<string, StateValue>`)
35
+ 2. **StateSnapshot** — Serialized state with SHA-256 checksum
36
+ 3. **SplitState** — XorIDA threshold shares of a snapshot
37
+ 4. **Reverse-XorIDA** — Incremental share update via GF(2) XOR of deltas
38
+ 5. **Chronicle** — Ordered state history with contradiction detection
39
+ 6. **SessionManager** — Stateful controller combining all layers
40
+ 7. **TrustStore** (v2.0.0) — Trust-annotated entries with provenance, tiers, and events
41
+ 8. **Provenance** (v2.0.0) — Ed25519 signed entries with hash chain linking
42
+ 9. **Trust Tiers** (v2.0.0) — ratified/inherited/quarantined with TTL decay
43
+ 10. **MissionGuard** (v2.0.0) — Human-anchored constraint evaluation
44
+ 11. **EnforcementLoop** (v2.0.0) — Reject/rewrite/escalate with violation tracking
45
+ 12. **Adjudicator** (v2.0.0) — Deterministic conflict resolution (policy or consensus)
46
+
47
+ ## Trust Substrate Pattern (v2.0.0)
48
+
49
+ ```typescript
50
+ import {
51
+ SessionManager, MemoryStateStore, TrustStore,
52
+ MissionAuthority, MissionGuard, EnforcementLoop,
53
+ } from '@private.me/xcontinuity';
54
+
55
+ const trustStore = new TrustStore({ defaultMaxAge: 7 * 24 * 60 * 60 * 1000 });
56
+ const authority = new MissionAuthority();
57
+ const guard = new MissionGuard(authority);
58
+ const enforcement = new EnforcementLoop(guard);
59
+
60
+ const session = SessionManager.create({
61
+ agentId: 'agent-001',
62
+ store: new MemoryStateStore(),
63
+ trustStore,
64
+ missionGuard: guard,
65
+ enforcementLoop: enforcement,
66
+ });
67
+
68
+ // Writes now go through trust substrate
69
+ session.updateState({ key: 'value' });
70
+ ```
71
+
72
+ ## Anti-Patterns
73
+
74
+ ### Don't skip Result checking
75
+ ```typescript
76
+ // WRONG
77
+ const result = await session.snapshot();
78
+ console.log(result.value); // Crashes if !result.ok
79
+
80
+ // RIGHT
81
+ const result = await session.snapshot();
82
+ if (!result.ok) { handleError(result.error); return; }
83
+ console.log(result.value);
84
+ ```
85
+
86
+ ### Don't mutate state directly
87
+ ```typescript
88
+ // WRONG
89
+ session.currentState.key = 'new'; // No effect
90
+
91
+ // RIGHT
92
+ session.updateState({ key: 'new' });
93
+ ```
94
+
95
+ ### Don't operate on closed sessions
96
+ ```typescript
97
+ // WRONG
98
+ session.close();
99
+ await session.snapshot(); // Returns error Result
100
+
101
+ // RIGHT
102
+ const snap = await session.snapshot(); // Before close
103
+ session.close();
104
+ ```
105
+
106
+ ## Testing
107
+
108
+ ```bash
109
+ pnpm --filter @private.me/xcontinuity test
110
+ ```
111
+
112
+ ## Purchase & Pricing
113
+
114
+ - Free tier: 100K operations per month free (no credit card required)
115
+ - Pro Tier: unlimited operations via subscription
116
+ - Subscribe to xcontinuity: `/subscribe?product=xcontinuity`
117
+ - See [pricing](../../docs/pricing-reference.md) for current rates
118
+ - Error structure follows structured error format with `ContinuityError` codes
119
+
120
+ ## Resources
121
+
122
+ - README: ./README.md
123
+ - Tests: `pnpm --filter @private.me/xcontinuity test`
package/LICENSE.md ADDED
@@ -0,0 +1,26 @@
1
+ # License
2
+
3
+ **Copyright © 2024-2026 Standard Clouds, Inc. All rights reserved.**
4
+
5
+ This software is proprietary and confidential. Unauthorized copying, distribution, or use of this software, via any medium, is strictly prohibited.
6
+
7
+ **Licensed under:** Proprietary
8
+ **Company:** Standard Clouds, Inc. dba PRIVATE.ME
9
+ **Registry:** Private npm registry
10
+
11
+ For licensing inquiries: contact@private.me
12
+
13
+ ## Export Control Notice
14
+
15
+ This software contains encryption technology that may be subject to U.S. export control laws (EAR 15 CFR 730-774). By downloading or using this software, you agree to comply with all applicable export laws and regulations. Export or re-export to embargoed countries or sanctioned entities is prohibited.
16
+
17
+ ## Additional Terms
18
+
19
+ By using this software, you also agree to:
20
+
21
+ - **Terms of Service**: https://private.me/terms
22
+ - **Privacy Policy**: https://private.me/privacy
23
+
24
+ ## Third-Party Dependencies
25
+
26
+ This package includes or depends upon open-source software that is subject to separate license terms. See the package.json file for a list of dependencies and their respective licenses.
package/MIGRATING.md ADDED
@@ -0,0 +1,77 @@
1
+ # Migrating to @private.me/xcontinuity v2.1.0
2
+
3
+ ## v1.x → v2.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ None — v2.0.0 is fully backward compatible with v1.x. All existing APIs continue to work unchanged.
8
+
9
+ ### New Features (opt-in)
10
+
11
+ **Trust Substrate** — 6-layer trust-annotated state management:
12
+
13
+ ```typescript
14
+ import {
15
+ SessionManager, MemoryStateStore, TrustStore,
16
+ MissionAuthority, MissionGuard, EnforcementLoop,
17
+ } from '@private.me/xcontinuity';
18
+
19
+ // v1.x code continues to work as-is:
20
+ const session = SessionManager.create({ agentId: 'agent-1', store: new MemoryStateStore() });
21
+
22
+ // v2.0.0 adds optional trust integration:
23
+ const trustStore = new TrustStore({ defaultMaxAge: 30 * 24 * 60 * 60 * 1000 });
24
+ const session2 = SessionManager.create({
25
+ agentId: 'agent-1',
26
+ store: new MemoryStateStore(),
27
+ trustStore, // opt-in
28
+ });
29
+ ```
30
+
31
+ **New modules (all optional):**
32
+ - Provenance (Ed25519 signed entries)
33
+ - Trust Tiers (ratified/inherited/quarantined)
34
+ - Adjudicator (PolicyAdjudicator, ConsensusAdjudicator)
35
+ - TrustStore (ratification, hypothesis mode)
36
+ - Mission & Enforcement (human-anchored goals)
37
+ - 7 algebraic extensions (undoDelta, branchState, etc.)
38
+
39
+ ### VERSION constant
40
+
41
+ ```typescript
42
+ import { VERSION } from '@private.me/xcontinuity';
43
+ // v1.x: '1.0.0'
44
+ // v2.0.0: '2.0.0'
45
+ ```
46
+
47
+ ## v2.0.0 → v2.1.0
48
+
49
+ ### Breaking Changes
50
+
51
+ None — v2.1.0 is fully backward compatible with v2.0.0.
52
+
53
+ ### New Features (opt-in)
54
+
55
+ **Cascade / Sub-Agent Architecture** — parent-child session hierarchies:
56
+
57
+ ```typescript
58
+ import { CascadeSession, SubAgentCoordinator } from '@private.me/xcontinuity';
59
+
60
+ const root = new CascadeSession(rootSession, trustStore);
61
+ const child = root.spawnChild('analyst', new MemoryStateStore(), {
62
+ propagation: 'inherit',
63
+ maxChildTier: 'inherited',
64
+ });
65
+ ```
66
+
67
+ **New exports:**
68
+ - `CascadeSession` — parent-child session wrapper
69
+ - `SubAgentCoordinator` — multi-agent lifecycle management
70
+ - `DEFAULT_CASCADE_POLICY` — default cascade configuration
71
+ - `DEFAULT_COORDINATOR_CONFIG` — default coordinator configuration
72
+
73
+ ### Sub-path import
74
+
75
+ ```typescript
76
+ import { CascadeSession } from '@private.me/xcontinuity/cascade';
77
+ ```