@geraldmaron/construct 1.0.23 → 1.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 (106) hide show
  1. package/README.md +0 -2
  2. package/bin/construct +189 -207
  3. package/lib/agent-instructions/inject.mjs +25 -4
  4. package/lib/audit-rules.mjs +127 -0
  5. package/lib/audit-skills.mjs +43 -1
  6. package/lib/beads-client.mjs +9 -0
  7. package/lib/beads-optimistic.mjs +23 -71
  8. package/lib/bridges/copilot-proxy.mjs +116 -0
  9. package/lib/cli-commands.mjs +5 -1
  10. package/lib/comment-lint.mjs +1 -1
  11. package/lib/config/schema.mjs +1 -1
  12. package/lib/document-extract/docling-client.mjs +16 -6
  13. package/lib/document-extract/docling-sidecar.py +32 -2
  14. package/lib/document-extract.mjs +37 -10
  15. package/lib/document-ingest.mjs +90 -5
  16. package/lib/embed/inbox.mjs +6 -3
  17. package/lib/embed/recommendation-store.mjs +7 -289
  18. package/lib/embed/reconcile.mjs +2 -2
  19. package/lib/embed/roadmap.mjs +16 -1
  20. package/lib/engine/consolidate.mjs +160 -3
  21. package/lib/engine/contradiction-judge.mjs +71 -0
  22. package/lib/engine/contradiction.mjs +74 -0
  23. package/lib/hooks/config-protection.mjs +4 -4
  24. package/lib/hooks/session-reflect.mjs +5 -1
  25. package/lib/host-capabilities.mjs +30 -0
  26. package/lib/ingest/docling-remote.mjs +90 -0
  27. package/lib/ingest/strategy.mjs +1 -1
  28. package/lib/init-unified.mjs +9 -13
  29. package/lib/intake/git-queue.mjs +195 -0
  30. package/lib/intake/queue.mjs +9 -16
  31. package/lib/logging/rotate.mjs +18 -0
  32. package/lib/mcp/server.mjs +124 -12
  33. package/lib/mcp/tool-budget.mjs +53 -0
  34. package/lib/mcp/tools/storage.mjs +2 -3
  35. package/lib/mcp-catalog.json +4 -4
  36. package/lib/mcp-manager.mjs +59 -3
  37. package/lib/observation-store.mjs +38 -166
  38. package/lib/ollama/capability-store.mjs +78 -0
  39. package/lib/ollama/provision-context.mjs +344 -0
  40. package/lib/opencode-config.mjs +148 -0
  41. package/lib/opencode-telemetry.mjs +7 -0
  42. package/lib/orchestration/runtime.mjs +3 -2
  43. package/lib/orchestration-policy.mjs +41 -6
  44. package/lib/platforms/capabilities.mjs +100 -0
  45. package/lib/prompt-composer.js +12 -8
  46. package/lib/reconcile/agent-instructions-rewrap.mjs +8 -4
  47. package/lib/reconcile/index.mjs +0 -2
  48. package/lib/reflect/extractor.mjs +14 -1
  49. package/lib/reflect/salience.mjs +65 -0
  50. package/lib/rules-delivery.mjs +122 -0
  51. package/lib/runtime/uv-bootstrap.mjs +32 -17
  52. package/lib/service-manager.mjs +79 -259
  53. package/lib/setup.mjs +44 -425
  54. package/lib/specialists/prompt-schema.mjs +162 -0
  55. package/lib/specialists/scaffold.mjs +109 -0
  56. package/lib/status.mjs +3 -6
  57. package/lib/storage/admin.mjs +48 -325
  58. package/lib/storage/backend.mjs +10 -57
  59. package/lib/storage/embeddings-engine.mjs +19 -5
  60. package/lib/storage/hybrid-query.mjs +15 -196
  61. package/lib/storage/sync.mjs +36 -177
  62. package/lib/storage/vector-client.mjs +256 -235
  63. package/lib/strategy-store.mjs +35 -286
  64. package/lib/telemetry/beads-fallback.mjs +40 -0
  65. package/lib/telemetry/hook-calls.mjs +138 -0
  66. package/lib/worker/entrypoint.mjs +6 -14
  67. package/package.json +6 -5
  68. package/personas/construct.md +1 -1
  69. package/platforms/capabilities.json +76 -0
  70. package/platforms/claude/settings.template.json +0 -7
  71. package/platforms/opencode/sync-config.mjs +121 -25
  72. package/rules/common/neurodivergent-output.md +1 -1
  73. package/rules/web/coding-style.md +8 -0
  74. package/rules/web/design-quality.md +8 -0
  75. package/rules/web/hooks.md +8 -0
  76. package/rules/web/patterns.md +8 -0
  77. package/rules/web/performance.md +8 -0
  78. package/rules/web/security.md +8 -0
  79. package/rules/web/testing.md +8 -0
  80. package/scripts/sync-specialists.mjs +174 -40
  81. package/specialists/prompts/cx-architect.md +20 -0
  82. package/specialists/prompts/cx-qa.md +1 -1
  83. package/specialists/prompts/cx-test-automation.md +12 -0
  84. package/specialists/registry.json +0 -8
  85. package/templates/docs/construct_guide.md +1 -1
  86. package/db/schema/001_init.sql +0 -40
  87. package/db/schema/002_pgvector.sql +0 -182
  88. package/db/schema/003_intake.sql +0 -47
  89. package/db/schema/003_observation_reconciliation.sql +0 -14
  90. package/db/schema/004_recommendations.sql +0 -46
  91. package/db/schema/005_strategy.sql +0 -21
  92. package/db/schema/006_graph.sql +0 -24
  93. package/db/schema/007_tags.sql +0 -30
  94. package/db/schema/008_skill_usage.sql +0 -24
  95. package/db/schema/009_scheduler.sql +0 -14
  96. package/db/schema/010_cx_scores.sql +0 -51
  97. package/lib/intake/postgres-queue.mjs +0 -240
  98. package/lib/reconcile/postgres-namespace.mjs +0 -102
  99. package/lib/services/local-postgres.mjs +0 -15
  100. package/lib/storage/backup.mjs +0 -347
  101. package/lib/storage/migrations.mjs +0 -187
  102. package/lib/storage/postgres-backup.mjs +0 -124
  103. package/lib/storage/sql-store.mjs +0 -45
  104. package/lib/storage/store-version.mjs +0 -115
  105. package/lib/storage/unified-storage.mjs +0 -550
  106. package/lib/storage/vector-store.mjs +0 -100
@@ -1,100 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * lib/storage/vector-store.mjs — Local JSON vector index facade.
4
- *
5
- * Stores vector records on disk for fallback retrieval when no SQL backend is
6
- * available. The model field is metadata supplied by the caller — this module
7
- * does not embed; it only persists what the engine produces.
8
- *
9
- * Search APIs accept a pre-computed query embedding so the embedding model is
10
- * the caller's choice and there is no implicit dependency on a specific model
11
- * inside this module.
12
- */
13
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
14
- import { dirname, resolve } from 'node:path';
15
- import { scoreByEmbedding, rankByBm25 } from './embeddings.mjs';
16
- import { embedSync } from './embeddings-legacy.mjs';
17
-
18
- export function vectorStoreMode(env = process.env) {
19
- if (env.CONSTRUCT_VECTOR_URL) return 'remote';
20
- if (env.CONSTRUCT_VECTOR_INDEX_PATH) return 'local';
21
- return 'file';
22
- }
23
-
24
- export function describeVectorStore(env = process.env) {
25
- const mode = vectorStoreMode(env);
26
- return {
27
- mode,
28
- configured: mode !== 'file',
29
- sharedReady: mode === 'remote',
30
- fallbackAvailable: true,
31
- endpoint: env.CONSTRUCT_VECTOR_URL || null,
32
- indexPath: env.CONSTRUCT_VECTOR_INDEX_PATH || null,
33
- model: env.CONSTRUCT_VECTOR_MODEL || null,
34
- };
35
- }
36
-
37
- export function readLocalVectorIndex(indexPath) {
38
- const resolvedPath = resolve(String(indexPath || ''));
39
- if (!resolvedPath || !existsSync(resolvedPath)) {
40
- return { version: 1, model: null, updatedAt: null, records: [] };
41
- }
42
-
43
- try {
44
- const parsed = JSON.parse(readFileSync(resolvedPath, 'utf8'));
45
- return {
46
- version: parsed.version ?? 1,
47
- model: parsed.model || null,
48
- updatedAt: parsed.updatedAt || null,
49
- records: Array.isArray(parsed.records) ? parsed.records : [],
50
- };
51
- } catch {
52
- return { version: 1, model: null, updatedAt: null, records: [] };
53
- }
54
- }
55
-
56
- export function writeLocalVectorIndex(indexPath, records = [], { model } = {}) {
57
- const resolvedPath = resolve(String(indexPath || ''));
58
- if (!resolvedPath) throw new Error('Missing local vector index path');
59
- if (!model) throw new Error('writeLocalVectorIndex requires an explicit model id (caller must supply)');
60
- mkdirSync(dirname(resolvedPath), { recursive: true });
61
- const payload = {
62
- version: 1,
63
- model,
64
- updatedAt: new Date().toISOString(),
65
- records,
66
- };
67
- writeFileSync(resolvedPath, `${JSON.stringify(payload, null, 2)}\n`);
68
- return payload;
69
- }
70
-
71
- /**
72
- * Search the local vector index. Accepts either a query string (which is
73
- * embedded via the legacy hashing adapter inline — fast, deterministic, no
74
- * engine init) or a pre-computed query embedding for engine-aligned callers.
75
- *
76
- * The hashing path matches what `addObservation` and `syncFileStateToSql`
77
- * write to disk when no SQL backend is configured, so dimensions agree.
78
- * Callers that store engine-dim vectors should pass an explicit Float32Array.
79
- */
80
- export function searchLocalVectorIndex(indexPath, query, { limit = 10 } = {}) {
81
- const index = readLocalVectorIndex(indexPath);
82
- const queryEmbedding = typeof query === 'string'
83
- ? embedSync(query)
84
- : (query instanceof Float32Array ? Array.from(query) : (query || []));
85
- return scoreByEmbedding(index.records, queryEmbedding, { limit });
86
- }
87
-
88
- export function vectorSearchLocal(records = [], query = '', { limit = 10 } = {}) {
89
- const bm25Docs = records.map((record) => ({
90
- ...record,
91
- text: [
92
- record.title,
93
- record.summary,
94
- record.body,
95
- record.text,
96
- Array.isArray(record.tags) ? record.tags.join(' ') : '',
97
- ].filter(Boolean).join('\n'),
98
- }));
99
- return rankByBm25(bm25Docs, query, { limit });
100
- }