@plures/praxis 1.2.13 → 1.3.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 (93) hide show
  1. package/README.md +44 -0
  2. package/dist/browser/chunk-MJK3IYTJ.js +384 -0
  3. package/dist/browser/{chunk-K377RW4V.js → chunk-N63K4KWS.js} +1 -1
  4. package/dist/browser/{engine-YJZV4SLD.js → engine-YIEGSX7U.js} +1 -1
  5. package/dist/browser/index.d.ts +104 -2
  6. package/dist/browser/index.js +188 -7
  7. package/dist/browser/integrations/svelte.d.ts +2 -2
  8. package/dist/browser/integrations/svelte.js +2 -2
  9. package/dist/browser/{reactive-engine.svelte-9aS0kTa8.d.ts → reactive-engine.svelte-DjynI82A.d.ts} +139 -5
  10. package/dist/node/{chunk-PRPQO6R5.js → chunk-5JQJZADT.js} +1 -1
  11. package/dist/node/chunk-KMJWAFZV.js +389 -0
  12. package/dist/node/{chunk-5RH7UAQC.js → chunk-PTH6MD6P.js} +1 -0
  13. package/dist/node/cli/index.cjs +1553 -839
  14. package/dist/node/cli/index.js +39 -2
  15. package/dist/node/cloud/index.d.cts +1 -1
  16. package/dist/node/cloud/index.d.ts +1 -1
  17. package/dist/node/components/index.d.cts +2 -2
  18. package/dist/node/components/index.d.ts +2 -2
  19. package/dist/node/conversations-KQBXTP3N.js +596 -0
  20. package/dist/node/{engine-2DQBKBJC.js → engine-FEN5IYZ5.js} +1 -1
  21. package/dist/node/index.cjs +911 -43
  22. package/dist/node/index.d.cts +574 -7
  23. package/dist/node/index.d.ts +574 -7
  24. package/dist/node/index.js +672 -26
  25. package/dist/node/integrations/svelte.cjs +190 -3
  26. package/dist/node/integrations/svelte.d.cts +3 -3
  27. package/dist/node/integrations/svelte.d.ts +3 -3
  28. package/dist/node/integrations/svelte.js +2 -2
  29. package/dist/node/{protocol-Qek7ebBl.d.ts → protocol-DcyGMmWY.d.cts} +8 -1
  30. package/dist/node/{protocol-Qek7ebBl.d.cts → protocol-DcyGMmWY.d.ts} +8 -1
  31. package/dist/node/{reactive-engine.svelte-CRNqHlbv.d.ts → reactive-engine.svelte-Cg0Yc2Hs.d.cts} +145 -6
  32. package/dist/node/{reactive-engine.svelte-BFIZfawz.d.cts → reactive-engine.svelte-DekxqFu0.d.ts} +145 -6
  33. package/dist/node/{terminal-adapter-B-UK_Vdz.d.ts → terminal-adapter-CvIvgTo4.d.ts} +1 -1
  34. package/dist/node/{terminal-adapter-BQSIF5bf.d.cts → terminal-adapter-Db-snPJ3.d.cts} +1 -1
  35. package/dist/node/{validate-CNHUULQE.js → validate-EN3M4FUR.js} +1 -1
  36. package/dist/node/{verify-KLJRXVJS.js → verify-7VZRP2WS.js} +2 -2
  37. package/docs/BOT_UPDATE_POLICY.md +125 -0
  38. package/docs/DOGFOODING_CHECKLIST.md +254 -0
  39. package/docs/DOGFOODING_INDEX.md +169 -0
  40. package/docs/DOGFOODING_QUICK_START.md +140 -0
  41. package/docs/KNO_ENG_EXTRACTION_PLAN.md +577 -0
  42. package/docs/PLURES_TOOLS_INVENTORY.md +170 -0
  43. package/docs/README.md +12 -0
  44. package/docs/TESTING_BOT_WORKFLOWS.md +154 -0
  45. package/docs/conversations/INTEGRATION_POINTS.md +719 -0
  46. package/docs/conversations/README.md +168 -0
  47. package/docs/core/extending-praxis-core.md +604 -0
  48. package/docs/core/praxis-core-api.md +385 -0
  49. package/docs/decision-ledger/contract-index.json +2 -2
  50. package/docs/decision-ledger/decisions/2026-02-01-monorepo-organization.md +130 -0
  51. package/docs/examples/DOGFOODING_WORKFLOW_EXAMPLE.md +295 -0
  52. package/docs/examples/README.md +41 -0
  53. package/docs/workflows/pr-overlap-guard.md +50 -0
  54. package/package.json +8 -3
  55. package/src/__tests__/chronicle.test.ts +512 -0
  56. package/src/__tests__/conversations.test.ts +312 -0
  57. package/src/__tests__/edge-cases.test.ts +1 -1
  58. package/src/__tests__/engine-dx.test.ts +355 -0
  59. package/src/__tests__/engine-v2.test.ts +532 -0
  60. package/src/cli/commands/conversations.ts +252 -0
  61. package/src/cli/index.ts +73 -0
  62. package/src/conversations/README.md +230 -0
  63. package/src/conversations/candidate.schema.json +123 -0
  64. package/src/conversations/candidates.ts +114 -0
  65. package/src/conversations/capture.ts +56 -0
  66. package/src/conversations/classify.ts +110 -0
  67. package/src/conversations/conversation.schema.json +106 -0
  68. package/src/conversations/emitters/fs.ts +65 -0
  69. package/src/conversations/emitters/github.ts +115 -0
  70. package/src/conversations/gate.ts +102 -0
  71. package/src/conversations/index.ts +28 -0
  72. package/src/conversations/normalize.ts +51 -0
  73. package/src/conversations/redact.ts +57 -0
  74. package/src/conversations/types.ts +96 -0
  75. package/src/core/chronicle/chronicle.ts +227 -0
  76. package/src/core/chronicle/context.ts +80 -0
  77. package/src/core/chronicle/index.ts +53 -0
  78. package/src/core/chronicle/mcp.ts +135 -0
  79. package/src/core/chronicle/types.ts +61 -0
  80. package/src/core/completeness.ts +274 -0
  81. package/src/core/engine.ts +143 -3
  82. package/src/core/pluresdb/index.ts +22 -0
  83. package/src/core/pluresdb/store.ts +171 -8
  84. package/src/core/protocol.ts +7 -0
  85. package/src/core/rule-result.ts +130 -0
  86. package/src/core/rules.ts +24 -5
  87. package/src/core/ui-rules.ts +340 -0
  88. package/src/dsl/index.ts +6 -0
  89. package/src/index.ts +45 -0
  90. package/src/integrations/pluresdb.ts +22 -0
  91. package/src/vite/completeness-plugin.ts +72 -0
  92. package/dist/browser/chunk-VOMLVI6V.js +0 -197
  93. package/dist/node/chunk-VOMLVI6V.js +0 -197
@@ -1,197 +0,0 @@
1
- // src/core/protocol.ts
2
- var PRAXIS_PROTOCOL_VERSION = "1.0.0";
3
-
4
- // src/core/engine.ts
5
- function safeClone(value) {
6
- if (value === null || typeof value !== "object") {
7
- return value;
8
- }
9
- if (typeof globalThis.structuredClone === "function") {
10
- try {
11
- return globalThis.structuredClone(value);
12
- } catch {
13
- }
14
- }
15
- if (Array.isArray(value)) {
16
- return [...value];
17
- }
18
- return { ...value };
19
- }
20
- var LogicEngine = class {
21
- state;
22
- registry;
23
- constructor(options) {
24
- this.registry = options.registry;
25
- this.state = {
26
- context: options.initialContext,
27
- facts: options.initialFacts ?? [],
28
- meta: options.initialMeta ?? {},
29
- protocolVersion: PRAXIS_PROTOCOL_VERSION
30
- };
31
- }
32
- /**
33
- * Get the current state (immutable copy)
34
- */
35
- getState() {
36
- return {
37
- context: safeClone(this.state.context),
38
- facts: [...this.state.facts],
39
- meta: this.state.meta ? safeClone(this.state.meta) : void 0,
40
- protocolVersion: this.state.protocolVersion
41
- };
42
- }
43
- /**
44
- * Get the current context
45
- */
46
- getContext() {
47
- return safeClone(this.state.context);
48
- }
49
- /**
50
- * Get current facts
51
- */
52
- getFacts() {
53
- return [...this.state.facts];
54
- }
55
- /**
56
- * Process events through the engine.
57
- * Applies all registered rules and checks all registered constraints.
58
- *
59
- * @param events Events to process
60
- * @returns Result with new state and diagnostics
61
- */
62
- step(events) {
63
- const config = {
64
- ruleIds: this.registry.getRuleIds(),
65
- constraintIds: this.registry.getConstraintIds()
66
- };
67
- return this.stepWithConfig(events, config);
68
- }
69
- /**
70
- * Process events with specific rule and constraint configuration.
71
- *
72
- * @param events Events to process
73
- * @param config Step configuration
74
- * @returns Result with new state and diagnostics
75
- */
76
- stepWithConfig(events, config) {
77
- const diagnostics = [];
78
- let newState = { ...this.state };
79
- const newFacts = [];
80
- for (const ruleId of config.ruleIds) {
81
- const rule = this.registry.getRule(ruleId);
82
- if (!rule) {
83
- diagnostics.push({
84
- kind: "rule-error",
85
- message: `Rule "${ruleId}" not found in registry`,
86
- data: { ruleId }
87
- });
88
- continue;
89
- }
90
- try {
91
- const ruleFacts = rule.impl(newState, events);
92
- newFacts.push(...ruleFacts);
93
- } catch (error) {
94
- diagnostics.push({
95
- kind: "rule-error",
96
- message: `Error executing rule "${ruleId}": ${error instanceof Error ? error.message : String(error)}`,
97
- data: { ruleId, error }
98
- });
99
- }
100
- }
101
- newState = {
102
- ...newState,
103
- facts: [...newState.facts, ...newFacts]
104
- };
105
- for (const constraintId of config.constraintIds) {
106
- const constraint = this.registry.getConstraint(constraintId);
107
- if (!constraint) {
108
- diagnostics.push({
109
- kind: "constraint-violation",
110
- message: `Constraint "${constraintId}" not found in registry`,
111
- data: { constraintId }
112
- });
113
- continue;
114
- }
115
- try {
116
- const result = constraint.impl(newState);
117
- if (result === false) {
118
- diagnostics.push({
119
- kind: "constraint-violation",
120
- message: `Constraint "${constraintId}" violated`,
121
- data: { constraintId, description: constraint.description }
122
- });
123
- } else if (typeof result === "string") {
124
- diagnostics.push({
125
- kind: "constraint-violation",
126
- message: result,
127
- data: { constraintId, description: constraint.description }
128
- });
129
- }
130
- } catch (error) {
131
- diagnostics.push({
132
- kind: "constraint-violation",
133
- message: `Error checking constraint "${constraintId}": ${error instanceof Error ? error.message : String(error)}`,
134
- data: { constraintId, error }
135
- });
136
- }
137
- }
138
- this.state = newState;
139
- return {
140
- state: newState,
141
- diagnostics
142
- };
143
- }
144
- /**
145
- * Update the context directly (for exceptional cases).
146
- * Generally, context should be updated through rules.
147
- *
148
- * @param updater Function that produces new context from old context
149
- */
150
- updateContext(updater) {
151
- this.state = {
152
- ...this.state,
153
- context: updater(this.state.context)
154
- };
155
- }
156
- /**
157
- * Add facts directly (for exceptional cases).
158
- * Generally, facts should be added through rules.
159
- *
160
- * @param facts Facts to add
161
- */
162
- addFacts(facts) {
163
- this.state = {
164
- ...this.state,
165
- facts: [...this.state.facts, ...facts]
166
- };
167
- }
168
- /**
169
- * Clear all facts
170
- */
171
- clearFacts() {
172
- this.state = {
173
- ...this.state,
174
- facts: []
175
- };
176
- }
177
- /**
178
- * Reset the engine to initial state
179
- */
180
- reset(options) {
181
- this.state = {
182
- context: options.initialContext,
183
- facts: options.initialFacts ?? [],
184
- meta: options.initialMeta ?? {},
185
- protocolVersion: PRAXIS_PROTOCOL_VERSION
186
- };
187
- }
188
- };
189
- function createPraxisEngine(options) {
190
- return new LogicEngine(options);
191
- }
192
-
193
- export {
194
- PRAXIS_PROTOCOL_VERSION,
195
- LogicEngine,
196
- createPraxisEngine
197
- };
@@ -1,197 +0,0 @@
1
- // src/core/protocol.ts
2
- var PRAXIS_PROTOCOL_VERSION = "1.0.0";
3
-
4
- // src/core/engine.ts
5
- function safeClone(value) {
6
- if (value === null || typeof value !== "object") {
7
- return value;
8
- }
9
- if (typeof globalThis.structuredClone === "function") {
10
- try {
11
- return globalThis.structuredClone(value);
12
- } catch {
13
- }
14
- }
15
- if (Array.isArray(value)) {
16
- return [...value];
17
- }
18
- return { ...value };
19
- }
20
- var LogicEngine = class {
21
- state;
22
- registry;
23
- constructor(options) {
24
- this.registry = options.registry;
25
- this.state = {
26
- context: options.initialContext,
27
- facts: options.initialFacts ?? [],
28
- meta: options.initialMeta ?? {},
29
- protocolVersion: PRAXIS_PROTOCOL_VERSION
30
- };
31
- }
32
- /**
33
- * Get the current state (immutable copy)
34
- */
35
- getState() {
36
- return {
37
- context: safeClone(this.state.context),
38
- facts: [...this.state.facts],
39
- meta: this.state.meta ? safeClone(this.state.meta) : void 0,
40
- protocolVersion: this.state.protocolVersion
41
- };
42
- }
43
- /**
44
- * Get the current context
45
- */
46
- getContext() {
47
- return safeClone(this.state.context);
48
- }
49
- /**
50
- * Get current facts
51
- */
52
- getFacts() {
53
- return [...this.state.facts];
54
- }
55
- /**
56
- * Process events through the engine.
57
- * Applies all registered rules and checks all registered constraints.
58
- *
59
- * @param events Events to process
60
- * @returns Result with new state and diagnostics
61
- */
62
- step(events) {
63
- const config = {
64
- ruleIds: this.registry.getRuleIds(),
65
- constraintIds: this.registry.getConstraintIds()
66
- };
67
- return this.stepWithConfig(events, config);
68
- }
69
- /**
70
- * Process events with specific rule and constraint configuration.
71
- *
72
- * @param events Events to process
73
- * @param config Step configuration
74
- * @returns Result with new state and diagnostics
75
- */
76
- stepWithConfig(events, config) {
77
- const diagnostics = [];
78
- let newState = { ...this.state };
79
- const newFacts = [];
80
- for (const ruleId of config.ruleIds) {
81
- const rule = this.registry.getRule(ruleId);
82
- if (!rule) {
83
- diagnostics.push({
84
- kind: "rule-error",
85
- message: `Rule "${ruleId}" not found in registry`,
86
- data: { ruleId }
87
- });
88
- continue;
89
- }
90
- try {
91
- const ruleFacts = rule.impl(newState, events);
92
- newFacts.push(...ruleFacts);
93
- } catch (error) {
94
- diagnostics.push({
95
- kind: "rule-error",
96
- message: `Error executing rule "${ruleId}": ${error instanceof Error ? error.message : String(error)}`,
97
- data: { ruleId, error }
98
- });
99
- }
100
- }
101
- newState = {
102
- ...newState,
103
- facts: [...newState.facts, ...newFacts]
104
- };
105
- for (const constraintId of config.constraintIds) {
106
- const constraint = this.registry.getConstraint(constraintId);
107
- if (!constraint) {
108
- diagnostics.push({
109
- kind: "constraint-violation",
110
- message: `Constraint "${constraintId}" not found in registry`,
111
- data: { constraintId }
112
- });
113
- continue;
114
- }
115
- try {
116
- const result = constraint.impl(newState);
117
- if (result === false) {
118
- diagnostics.push({
119
- kind: "constraint-violation",
120
- message: `Constraint "${constraintId}" violated`,
121
- data: { constraintId, description: constraint.description }
122
- });
123
- } else if (typeof result === "string") {
124
- diagnostics.push({
125
- kind: "constraint-violation",
126
- message: result,
127
- data: { constraintId, description: constraint.description }
128
- });
129
- }
130
- } catch (error) {
131
- diagnostics.push({
132
- kind: "constraint-violation",
133
- message: `Error checking constraint "${constraintId}": ${error instanceof Error ? error.message : String(error)}`,
134
- data: { constraintId, error }
135
- });
136
- }
137
- }
138
- this.state = newState;
139
- return {
140
- state: newState,
141
- diagnostics
142
- };
143
- }
144
- /**
145
- * Update the context directly (for exceptional cases).
146
- * Generally, context should be updated through rules.
147
- *
148
- * @param updater Function that produces new context from old context
149
- */
150
- updateContext(updater) {
151
- this.state = {
152
- ...this.state,
153
- context: updater(this.state.context)
154
- };
155
- }
156
- /**
157
- * Add facts directly (for exceptional cases).
158
- * Generally, facts should be added through rules.
159
- *
160
- * @param facts Facts to add
161
- */
162
- addFacts(facts) {
163
- this.state = {
164
- ...this.state,
165
- facts: [...this.state.facts, ...facts]
166
- };
167
- }
168
- /**
169
- * Clear all facts
170
- */
171
- clearFacts() {
172
- this.state = {
173
- ...this.state,
174
- facts: []
175
- };
176
- }
177
- /**
178
- * Reset the engine to initial state
179
- */
180
- reset(options) {
181
- this.state = {
182
- context: options.initialContext,
183
- facts: options.initialFacts ?? [],
184
- meta: options.initialMeta ?? {},
185
- protocolVersion: PRAXIS_PROTOCOL_VERSION
186
- };
187
- }
188
- };
189
- function createPraxisEngine(options) {
190
- return new LogicEngine(options);
191
- }
192
-
193
- export {
194
- PRAXIS_PROTOCOL_VERSION,
195
- LogicEngine,
196
- createPraxisEngine
197
- };