@directive-run/knowledge 0.4.2 → 0.5.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Jason Comes
3
+ Copyright (c) 2026 Sizls LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -197,8 +197,8 @@ const contactForm = createModule("contact-form", {
197
197
  facts.subject !== "" &&
198
198
  facts.message.trim().length >= 10,
199
199
 
200
- canSubmit: (facts, derive) => {
201
- if (!derive.isValid) {
200
+ canSubmit: (facts, derived) => {
201
+ if (!derived.isValid) {
202
202
  return false;
203
203
  }
204
204
  if (facts.status !== "idle") {
@@ -180,10 +180,10 @@ export const dashboardLoaderModule = createModule("dashboard-loader", {
180
180
  return resources.some((r) => r.status === "loading");
181
181
  },
182
182
 
183
- combinedStatus: (facts, derive) => {
184
- const loaded = derive.loadedCount;
185
- const anyErr = derive.anyError;
186
- const anyLoad = derive.anyLoading;
183
+ combinedStatus: (facts, derived) => {
184
+ const loaded = derived.loadedCount;
185
+ const anyErr = derived.anyError;
186
+ const anyLoad = derived.anyLoading;
187
187
  const allIdle = [
188
188
  facts.profile,
189
189
  facts.preferences,
@@ -127,23 +127,23 @@ export const wizardModule = createModule("wizard", {
127
127
  return facts.plan !== "";
128
128
  },
129
129
 
130
- currentStepValid: (facts, derive) => {
130
+ currentStepValid: (facts, derived) => {
131
131
  if (facts.currentStep === 0) {
132
- return derive.step0Valid;
132
+ return derived.step0Valid;
133
133
  }
134
134
  if (facts.currentStep === 1) {
135
- return derive.step1Valid;
135
+ return derived.step1Valid;
136
136
  }
137
137
  if (facts.currentStep === 2) {
138
- return derive.step2Valid;
138
+ return derived.step2Valid;
139
139
  }
140
140
 
141
141
  return false;
142
142
  },
143
143
 
144
- canAdvance: (facts, derive) => {
144
+ canAdvance: (facts, derived) => {
145
145
  return (
146
- derive.currentStepValid && facts.currentStep < facts.totalSteps - 1
146
+ derived.currentStepValid && facts.currentStep < facts.totalSteps - 1
147
147
  );
148
148
  },
149
149
 
@@ -102,8 +102,8 @@ const newsletter = createModule("newsletter", {
102
102
 
103
103
  isValid: (facts) => EMAIL_REGEX.test(facts.email),
104
104
 
105
- canSubmit: (facts, derive) => {
106
- if (!derive.isValid) {
105
+ canSubmit: (facts, derived) => {
106
+ if (!derived.isValid) {
107
107
  return false;
108
108
  }
109
109
  if (facts.status !== "idle") {
@@ -138,7 +138,7 @@ export const permissionsModule = createModule("permissions", {
138
138
  canManageUsers: (facts) => facts.self.permissions.includes("users.manage"),
139
139
  canViewAnalytics: (facts) =>
140
140
  facts.self.permissions.includes("analytics.view"),
141
- isAdmin: (_facts, derive) => derive.canManageUsers,
141
+ isAdmin: (_facts, derived) => derived.canManageUsers,
142
142
  permissionCount: (facts) => facts.self.permissions.length,
143
143
  },
144
144
 
@@ -187,23 +187,23 @@ export const cartModule = createModule("cart", {
187
187
  return facts.self.items.length === 0;
188
188
  },
189
189
 
190
- discount: (facts, derive) => {
191
- const sub = derive.subtotal;
190
+ discount: (facts, derived) => {
191
+ const sub = derived.subtotal;
192
192
 
193
193
  return sub * (facts.self.couponDiscount / 100);
194
194
  },
195
195
 
196
- tax: (facts, derive) => {
197
- const sub = derive.subtotal;
198
- const disc = derive.discount;
196
+ tax: (facts, derived) => {
197
+ const sub = derived.subtotal;
198
+ const disc = derived.discount;
199
199
 
200
200
  return (sub - disc) * 0.08;
201
201
  },
202
202
 
203
- total: (_facts, derive) => {
204
- const sub = derive.subtotal;
205
- const disc = derive.discount;
206
- const tx = derive.tax;
203
+ total: (_facts, derived) => {
204
+ const sub = derived.subtotal;
205
+ const disc = derived.discount;
206
+ const tx = derived.tax;
207
207
 
208
208
  return sub - disc + tx;
209
209
  },
@@ -214,8 +214,8 @@ export const cartModule = createModule("cart", {
214
214
  );
215
215
  },
216
216
 
217
- freeShipping: (_facts, derive) => {
218
- const sub = derive.subtotal;
217
+ freeShipping: (_facts, derived) => {
218
+ const sub = derived.subtotal;
219
219
 
220
220
  return sub >= 75;
221
221
  },
@@ -147,10 +147,10 @@ export const sudokuGame = createModule("sudoku", {
147
147
  return findConflicts(facts.grid);
148
148
  },
149
149
 
150
- conflictIndices: (facts, derive) => {
150
+ conflictIndices: (facts, derived) => {
151
151
  const indices = new Set<number>();
152
152
  const givens = facts.givens;
153
- for (const c of derive.conflicts) {
153
+ for (const c of derived.conflicts) {
154
154
  // Only highlight player-placed cells, not givens
155
155
  if (!givens.has(c.index)) {
156
156
  indices.add(c.index);
@@ -160,8 +160,8 @@ export const sudokuGame = createModule("sudoku", {
160
160
  return indices;
161
161
  },
162
162
 
163
- hasConflicts: (_facts, derive) => {
164
- return derive.conflicts.length > 0;
163
+ hasConflicts: (_facts, derived) => {
164
+ return derived.conflicts.length > 0;
165
165
  },
166
166
 
167
167
  filledCount: (facts) => {
@@ -176,16 +176,16 @@ export const sudokuGame = createModule("sudoku", {
176
176
  return count;
177
177
  },
178
178
 
179
- progress: (_facts, derive) => {
180
- return Math.round((derive.filledCount / 81) * 100);
179
+ progress: (_facts, derived) => {
180
+ return Math.round((derived.filledCount / 81) * 100);
181
181
  },
182
182
 
183
183
  isComplete: (facts) => {
184
184
  return isBoardComplete(facts.grid);
185
185
  },
186
186
 
187
- isSolved: (_facts, derive) => {
188
- return derive.isComplete && !derive.hasConflicts;
187
+ isSolved: (_facts, derived) => {
188
+ return derived.isComplete && !derived.hasConflicts;
189
189
  },
190
190
 
191
191
  selectedPeers: (facts) => {
@@ -206,8 +206,8 @@ export const sudokuGame = createModule("sudoku", {
206
206
  return facts.grid[sel];
207
207
  },
208
208
 
209
- sameValueIndices: (facts, derive) => {
210
- const val = derive.highlightValue;
209
+ sameValueIndices: (facts, derived) => {
210
+ const val = derived.highlightValue;
211
211
  if (val === 0) {
212
212
  return new Set<number>();
213
213
  }
@@ -106,12 +106,12 @@ export const topicGuardModule = createModule("topic-guard", {
106
106
  .length;
107
107
  },
108
108
 
109
- blockRate: (facts, derive) => {
110
- const total = derive.messageCount;
109
+ blockRate: (facts, derived) => {
110
+ const total = derived.messageCount;
111
111
  if (total === 0) {
112
112
  return "0%";
113
113
  }
114
- const blocked = derive.blockedCount;
114
+ const blocked = derived.blockedCount;
115
115
  const rate = Math.round((blocked / total) * 100);
116
116
 
117
117
  return `${rate}%`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directive-run/knowledge",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Knowledge files, examples, and validation for Directive — the constraint-driven TypeScript runtime.",
5
5
  "license": "MIT",
6
6
  "author": "Jason Comes",
@@ -50,8 +50,8 @@
50
50
  "tsx": "^4.19.2",
51
51
  "typescript": "^5.7.2",
52
52
  "vitest": "^3.0.0",
53
- "@directive-run/core": "0.4.2",
54
- "@directive-run/ai": "0.4.2"
53
+ "@directive-run/core": "0.5.0",
54
+ "@directive-run/ai": "0.5.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsx scripts/generate-api-skeleton.ts && tsx scripts/extract-examples.ts && tsup",