@tomflow/proflow-task-store-sqlite 0.1.0 → 0.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @tomflow/proflow-task-store-sqlite
2
+
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Real-1 final remediation and black-box release closure
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Close the Real-1 global Platform control-plane contract across every published ProFlow package. Platform CLI now owns one durable global Workspace binding with canonical identity, cross-process operation locking, cwd/`--workspace` install targeting, cross-directory instance commands, whole-instance uninstall/rebind, and deterministic npm/yarn/pnpm Workspace package-manager selection. Every package-owned install entry, including newly generated Module Template packages, delegates to the Shell-global `platform` command and fails closed when that global CLI is unavailable; Deployment Conformance and the formal test plans mechanically enforce the same rule across all 24 packages.
@@ -1,47 +1,235 @@
1
+ export declare function createBehaviorAdapter(config?: Record<string, string>): {
2
+ describe: () => {
3
+ result: {
4
+ contract: "deployment.result.v1";
5
+ ok: boolean;
6
+ status: "SUCCEEDED";
7
+ moduleRef: "task-store-sqlite";
8
+ moduleVersion: "0.1.2";
9
+ checks?: unknown[];
10
+ };
11
+ observedEffects: never[];
12
+ };
13
+ preflight: () => {
14
+ result: {
15
+ contract: "deployment.result.v1";
16
+ ok: boolean;
17
+ status: "SUCCEEDED";
18
+ moduleRef: "task-store-sqlite";
19
+ moduleVersion: "0.1.2";
20
+ checks?: unknown[];
21
+ } | {
22
+ contract: "deployment.result.v1";
23
+ ok: boolean;
24
+ status: "ACTION_REQUIRED";
25
+ moduleRef: "task-store-sqlite";
26
+ moduleVersion: "0.1.2";
27
+ actionRequired: {
28
+ action: string;
29
+ description: string;
30
+ };
31
+ checks?: unknown[];
32
+ } | {
33
+ contract: "deployment.result.v1";
34
+ ok: boolean;
35
+ status: "BLOCKED";
36
+ moduleRef: "task-store-sqlite";
37
+ moduleVersion: "0.1.2";
38
+ error: {
39
+ code: "VERIFY_FAILED";
40
+ message: string;
41
+ retryable: boolean;
42
+ };
43
+ checks?: unknown[];
44
+ };
45
+ observedEffects: never[];
46
+ };
47
+ verify: () => {
48
+ result: {
49
+ contract: "deployment.result.v1";
50
+ ok: boolean;
51
+ status: "SUCCEEDED";
52
+ moduleRef: "task-store-sqlite";
53
+ moduleVersion: "0.1.2";
54
+ checks?: unknown[];
55
+ } | {
56
+ contract: "deployment.result.v1";
57
+ ok: boolean;
58
+ status: "ACTION_REQUIRED";
59
+ moduleRef: "task-store-sqlite";
60
+ moduleVersion: "0.1.2";
61
+ actionRequired: {
62
+ action: string;
63
+ description: string;
64
+ };
65
+ checks?: unknown[];
66
+ } | {
67
+ contract: "deployment.result.v1";
68
+ ok: boolean;
69
+ status: "BLOCKED";
70
+ moduleRef: "task-store-sqlite";
71
+ moduleVersion: "0.1.2";
72
+ error: {
73
+ code: "VERIFY_FAILED";
74
+ message: string;
75
+ retryable: boolean;
76
+ };
77
+ checks?: unknown[];
78
+ };
79
+ observedEffects: never[];
80
+ };
81
+ doctor: () => {
82
+ result: {
83
+ contract: "deployment.result.v1";
84
+ ok: boolean;
85
+ status: "SUCCEEDED";
86
+ moduleRef: "task-store-sqlite";
87
+ moduleVersion: "0.1.2";
88
+ checks?: unknown[];
89
+ } | {
90
+ contract: "deployment.result.v1";
91
+ ok: boolean;
92
+ status: "ACTION_REQUIRED";
93
+ moduleRef: "task-store-sqlite";
94
+ moduleVersion: "0.1.2";
95
+ actionRequired: {
96
+ action: string;
97
+ description: string;
98
+ };
99
+ checks?: unknown[];
100
+ } | {
101
+ contract: "deployment.result.v1";
102
+ ok: boolean;
103
+ status: "BLOCKED";
104
+ moduleRef: "task-store-sqlite";
105
+ moduleVersion: "0.1.2";
106
+ error: {
107
+ code: "VERIFY_FAILED";
108
+ message: string;
109
+ retryable: boolean;
110
+ };
111
+ checks?: unknown[];
112
+ };
113
+ observedEffects: never[];
114
+ };
115
+ };
1
116
  export declare const behaviorAdapter: {
2
- readonly describe: () => {
117
+ describe: () => {
3
118
  result: {
4
- readonly contract: "deployment.result.v1";
5
- readonly ok: true;
6
- readonly status: "SUCCEEDED";
7
- readonly moduleRef: "task-store-sqlite";
8
- readonly moduleVersion: "0.1.0";
119
+ contract: "deployment.result.v1";
120
+ ok: boolean;
121
+ status: "SUCCEEDED";
122
+ moduleRef: "task-store-sqlite";
123
+ moduleVersion: "0.1.2";
124
+ checks?: unknown[];
9
125
  };
10
126
  observedEffects: never[];
11
127
  };
12
- readonly preflight: () => {
128
+ preflight: () => {
13
129
  result: {
14
- readonly contract: "deployment.result.v1";
15
- readonly ok: true;
16
- readonly status: "SUCCEEDED";
17
- readonly moduleRef: "task-store-sqlite";
18
- readonly moduleVersion: "0.1.0";
130
+ contract: "deployment.result.v1";
131
+ ok: boolean;
132
+ status: "SUCCEEDED";
133
+ moduleRef: "task-store-sqlite";
134
+ moduleVersion: "0.1.2";
135
+ checks?: unknown[];
136
+ } | {
137
+ contract: "deployment.result.v1";
138
+ ok: boolean;
139
+ status: "ACTION_REQUIRED";
140
+ moduleRef: "task-store-sqlite";
141
+ moduleVersion: "0.1.2";
142
+ actionRequired: {
143
+ action: string;
144
+ description: string;
145
+ };
146
+ checks?: unknown[];
147
+ } | {
148
+ contract: "deployment.result.v1";
149
+ ok: boolean;
150
+ status: "BLOCKED";
151
+ moduleRef: "task-store-sqlite";
152
+ moduleVersion: "0.1.2";
153
+ error: {
154
+ code: "VERIFY_FAILED";
155
+ message: string;
156
+ retryable: boolean;
157
+ };
158
+ checks?: unknown[];
19
159
  };
20
160
  observedEffects: never[];
21
161
  };
22
- readonly verify: () => {
162
+ verify: () => {
23
163
  result: {
24
164
  contract: "deployment.result.v1";
25
- ok: true;
165
+ ok: boolean;
26
166
  status: "SUCCEEDED";
27
167
  moduleRef: "task-store-sqlite";
28
- moduleVersion: "0.1.0";
29
- checks: {
30
- id: string;
31
- status: string;
168
+ moduleVersion: "0.1.2";
169
+ checks?: unknown[];
170
+ } | {
171
+ contract: "deployment.result.v1";
172
+ ok: boolean;
173
+ status: "ACTION_REQUIRED";
174
+ moduleRef: "task-store-sqlite";
175
+ moduleVersion: "0.1.2";
176
+ actionRequired: {
177
+ action: string;
178
+ description: string;
179
+ };
180
+ checks?: unknown[];
181
+ } | {
182
+ contract: "deployment.result.v1";
183
+ ok: boolean;
184
+ status: "BLOCKED";
185
+ moduleRef: "task-store-sqlite";
186
+ moduleVersion: "0.1.2";
187
+ error: {
188
+ code: "VERIFY_FAILED";
32
189
  message: string;
33
- }[];
190
+ retryable: boolean;
191
+ };
192
+ checks?: unknown[];
34
193
  };
35
194
  observedEffects: never[];
36
195
  };
37
- readonly doctor: () => {
196
+ doctor: () => {
38
197
  result: {
39
- readonly contract: "deployment.result.v1";
40
- readonly ok: true;
41
- readonly status: "SUCCEEDED";
42
- readonly moduleRef: "task-store-sqlite";
43
- readonly moduleVersion: "0.1.0";
198
+ contract: "deployment.result.v1";
199
+ ok: boolean;
200
+ status: "SUCCEEDED";
201
+ moduleRef: "task-store-sqlite";
202
+ moduleVersion: "0.1.2";
203
+ checks?: unknown[];
204
+ } | {
205
+ contract: "deployment.result.v1";
206
+ ok: boolean;
207
+ status: "ACTION_REQUIRED";
208
+ moduleRef: "task-store-sqlite";
209
+ moduleVersion: "0.1.2";
210
+ actionRequired: {
211
+ action: string;
212
+ description: string;
213
+ };
214
+ checks?: unknown[];
215
+ } | {
216
+ contract: "deployment.result.v1";
217
+ ok: boolean;
218
+ status: "BLOCKED";
219
+ moduleRef: "task-store-sqlite";
220
+ moduleVersion: "0.1.2";
221
+ error: {
222
+ code: "VERIFY_FAILED";
223
+ message: string;
224
+ retryable: boolean;
225
+ };
226
+ checks?: unknown[];
44
227
  };
45
228
  observedEffects: never[];
46
229
  };
47
230
  };
231
+ export declare function createProductionBinding(input: {
232
+ config: Record<string, string>;
233
+ }): {
234
+ behaviorAdapter: Record<string, unknown>;
235
+ };
@@ -1,26 +1,121 @@
1
+ import { existsSync } from "node:fs";
2
+ import { DatabaseSync } from "node:sqlite";
1
3
  import { descriptor } from "./descriptor.js";
2
- const result = {
4
+ const REQUIRED_TABLES = [
5
+ "schema_migrations",
6
+ "task_groups",
7
+ "tasks",
8
+ "nodes",
9
+ "task_role_bindings",
10
+ "node_execution_history",
11
+ "task_documents",
12
+ "task_messages",
13
+ "task_events",
14
+ "idempotency_records",
15
+ ];
16
+ const success = (checks) => ({
3
17
  contract: "deployment.result.v1",
4
18
  ok: true,
5
19
  status: "SUCCEEDED",
6
20
  moduleRef: descriptor.moduleRef,
7
21
  moduleVersion: descriptor.moduleVersion,
8
- };
9
- export const behaviorAdapter = {
10
- describe: () => ({ result, observedEffects: [] }),
11
- preflight: () => ({ result, observedEffects: [] }),
12
- verify: () => ({
13
- result: {
14
- ...result,
15
- checks: [
16
- {
17
- id: "sqlite-integrity-pass",
18
- status: "PASS",
19
- message: "SQLite integrity verification is available",
20
- },
21
- ],
22
+ ...(checks === undefined ? {} : { checks }),
23
+ });
24
+ const actionRequired = (description, checks) => ({
25
+ contract: "deployment.result.v1",
26
+ ok: false,
27
+ status: "ACTION_REQUIRED",
28
+ moduleRef: descriptor.moduleRef,
29
+ moduleVersion: descriptor.moduleVersion,
30
+ actionRequired: { action: "configure-task-store", description },
31
+ ...(checks === undefined ? {} : { checks }),
32
+ });
33
+ const blocked = (message, checks) => ({
34
+ contract: "deployment.result.v1",
35
+ ok: false,
36
+ status: "BLOCKED",
37
+ moduleRef: descriptor.moduleRef,
38
+ moduleVersion: descriptor.moduleVersion,
39
+ error: { code: "VERIFY_FAILED", message, retryable: true },
40
+ ...(checks === undefined ? {} : { checks }),
41
+ });
42
+ function inspect(databasePath) {
43
+ if (!databasePath)
44
+ return { ok: false, message: "databasePath is required" };
45
+ if (!existsSync(databasePath)) {
46
+ return {
47
+ ok: false,
48
+ message: `Task SQLite database does not exist at ${databasePath}`,
49
+ };
50
+ }
51
+ let database;
52
+ try {
53
+ database = new DatabaseSync(databasePath, { readOnly: true });
54
+ const integrity = database.prepare("PRAGMA integrity_check").get();
55
+ const tables = new Set(database
56
+ .prepare("SELECT name FROM sqlite_master WHERE type='table'")
57
+ .all().map((row) => row.name));
58
+ const missing = REQUIRED_TABLES.filter((table) => !tables.has(table));
59
+ if (integrity?.integrity_check !== "ok") {
60
+ return {
61
+ ok: false,
62
+ message: `SQLite integrity_check returned ${integrity?.integrity_check ?? "unknown"}`,
63
+ };
64
+ }
65
+ if (missing.length > 0) {
66
+ return {
67
+ ok: false,
68
+ message: `Task SQLite schema is missing tables: ${missing.join(", ")}`,
69
+ };
70
+ }
71
+ return {
72
+ ok: true,
73
+ message: "Task SQLite schema is present and integrity_check is ok",
74
+ };
75
+ }
76
+ catch (error) {
77
+ return {
78
+ ok: false,
79
+ message: error instanceof Error
80
+ ? error.message
81
+ : "Task SQLite reality could not be read",
82
+ };
83
+ }
84
+ finally {
85
+ database?.close();
86
+ }
87
+ }
88
+ export function createBehaviorAdapter(config = {}) {
89
+ const resultForReality = (reality, checks) => reality.ok
90
+ ? success(checks)
91
+ : config.databasePath
92
+ ? blocked(reality.message, checks)
93
+ : actionRequired(reality.message, checks);
94
+ return {
95
+ describe: () => ({ result: success(), observedEffects: [] }),
96
+ preflight: () => {
97
+ const reality = inspect(config.databasePath);
98
+ return { result: resultForReality(reality), observedEffects: [] };
99
+ },
100
+ verify: () => {
101
+ const reality = inspect(config.databasePath);
102
+ const check = {
103
+ id: "sqlite-integrity-pass",
104
+ status: reality.ok ? "PASS" : "FAIL",
105
+ message: reality.message,
106
+ };
107
+ return {
108
+ result: resultForReality(reality, [check]),
109
+ observedEffects: [],
110
+ };
111
+ },
112
+ doctor: () => {
113
+ const reality = inspect(config.databasePath);
114
+ return { result: resultForReality(reality), observedEffects: [] };
22
115
  },
23
- observedEffects: [],
24
- }),
25
- doctor: () => ({ result, observedEffects: [] }),
26
- };
116
+ };
117
+ }
118
+ export const behaviorAdapter = createBehaviorAdapter();
119
+ export function createProductionBinding(input) {
120
+ return { behaviorAdapter: createBehaviorAdapter(input.config) };
121
+ }
@@ -3,7 +3,7 @@ export declare const descriptor: {
3
3
  readonly contractVersion: "1.0.0";
4
4
  readonly moduleRef: "task-store-sqlite";
5
5
  readonly packageName: "@tomflow/proflow-task-store-sqlite";
6
- readonly moduleVersion: "0.1.0";
6
+ readonly moduleVersion: "0.1.2";
7
7
  readonly kind: "library";
8
8
  readonly templateVersion: "1.0.0";
9
9
  readonly platformCompatibility: ">=1.0.0 <2.0.0";
@@ -3,7 +3,7 @@ export const descriptor = {
3
3
  contractVersion: "1.0.0",
4
4
  moduleRef: "task-store-sqlite",
5
5
  packageName: "@tomflow/proflow-task-store-sqlite",
6
- moduleVersion: "0.1.0",
6
+ moduleVersion: "0.1.2",
7
7
  kind: "library",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-task-store-sqlite",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,11 +19,11 @@
19
19
  "self-install.mjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@tomflow/proflow-task-orchestration": "^0.1.0",
23
- "@tomflow/proflow-module-contract": "^0.1.0"
22
+ "@tomflow/proflow-module-contract": "^0.1.1",
23
+ "@tomflow/proflow-task-orchestration": "^0.1.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@tomflow/proflow-task-migration-runner": "^0.1.0"
26
+ "@tomflow/proflow-task-migration-runner": "^0.1.2"
27
27
  },
28
28
  "description": "Provides the node:sqlite store and repository adapters for Task-owned structured facts.",
29
29
  "keywords": [
@@ -3,7 +3,7 @@
3
3
  "contractVersion": "1.0.0",
4
4
  "moduleRef": "task-store-sqlite",
5
5
  "packageName": "@tomflow/proflow-task-store-sqlite",
6
- "moduleVersion": "0.1.0",
6
+ "moduleVersion": "0.1.2",
7
7
  "kind": "library",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",
package/self-install.mjs CHANGED
@@ -11,16 +11,24 @@ if (command !== "install" || rest.length > 0) {
11
11
  process.stderr.write(usage);
12
12
  process.exit(2);
13
13
  }
14
- const executable = process.platform === "win32" ? "npx.cmd" : "npx";
14
+ const executable = process.platform === "win32" ? "platform.cmd" : "platform";
15
15
  const result = spawnSync(
16
16
  executable,
17
17
  [
18
- "--yes",
19
- "@tomflow/proflow-platform-cli",
20
18
  "install",
21
19
  "@tomflow/proflow-task-store-sqlite",
20
+ "--workspace",
21
+ process.cwd(),
22
22
  ],
23
23
  { cwd: process.cwd(), env: process.env, stdio: "inherit" },
24
24
  );
25
- if (result.error) throw result.error;
25
+ if (result.error) {
26
+ if (result.error.code === "ENOENT") {
27
+ process.stderr.write(
28
+ "GLOBAL_PLATFORM_CLI_REQUIRED: install @tomflow/proflow-platform-cli globally before package-owned install\n",
29
+ );
30
+ process.exit(127);
31
+ }
32
+ throw result.error;
33
+ }
26
34
  process.exit(result.status ?? 1);