@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.
- package/README.md +0 -2
- package/bin/construct +189 -207
- package/lib/agent-instructions/inject.mjs +25 -4
- package/lib/audit-rules.mjs +127 -0
- package/lib/audit-skills.mjs +43 -1
- package/lib/beads-client.mjs +9 -0
- package/lib/beads-optimistic.mjs +23 -71
- package/lib/bridges/copilot-proxy.mjs +116 -0
- package/lib/cli-commands.mjs +5 -1
- package/lib/comment-lint.mjs +1 -1
- package/lib/config/schema.mjs +1 -1
- package/lib/document-extract/docling-client.mjs +16 -6
- package/lib/document-extract/docling-sidecar.py +32 -2
- package/lib/document-extract.mjs +37 -10
- package/lib/document-ingest.mjs +90 -5
- package/lib/embed/inbox.mjs +6 -3
- package/lib/embed/recommendation-store.mjs +7 -289
- package/lib/embed/reconcile.mjs +2 -2
- package/lib/embed/roadmap.mjs +16 -1
- package/lib/engine/consolidate.mjs +160 -3
- package/lib/engine/contradiction-judge.mjs +71 -0
- package/lib/engine/contradiction.mjs +74 -0
- package/lib/hooks/config-protection.mjs +4 -4
- package/lib/hooks/session-reflect.mjs +5 -1
- package/lib/host-capabilities.mjs +30 -0
- package/lib/ingest/docling-remote.mjs +90 -0
- package/lib/ingest/strategy.mjs +1 -1
- package/lib/init-unified.mjs +9 -13
- package/lib/intake/git-queue.mjs +195 -0
- package/lib/intake/queue.mjs +9 -16
- package/lib/logging/rotate.mjs +18 -0
- package/lib/mcp/server.mjs +124 -12
- package/lib/mcp/tool-budget.mjs +53 -0
- package/lib/mcp/tools/storage.mjs +2 -3
- package/lib/mcp-catalog.json +4 -4
- package/lib/mcp-manager.mjs +59 -3
- package/lib/observation-store.mjs +38 -166
- package/lib/ollama/capability-store.mjs +78 -0
- package/lib/ollama/provision-context.mjs +344 -0
- package/lib/opencode-config.mjs +148 -0
- package/lib/opencode-telemetry.mjs +7 -0
- package/lib/orchestration/runtime.mjs +3 -2
- package/lib/orchestration-policy.mjs +41 -6
- package/lib/platforms/capabilities.mjs +100 -0
- package/lib/prompt-composer.js +12 -8
- package/lib/reconcile/agent-instructions-rewrap.mjs +8 -4
- package/lib/reconcile/index.mjs +0 -2
- package/lib/reflect/extractor.mjs +14 -1
- package/lib/reflect/salience.mjs +65 -0
- package/lib/rules-delivery.mjs +122 -0
- package/lib/runtime/uv-bootstrap.mjs +32 -17
- package/lib/service-manager.mjs +79 -259
- package/lib/setup.mjs +44 -425
- package/lib/specialists/prompt-schema.mjs +162 -0
- package/lib/specialists/scaffold.mjs +109 -0
- package/lib/status.mjs +3 -6
- package/lib/storage/admin.mjs +48 -325
- package/lib/storage/backend.mjs +10 -57
- package/lib/storage/embeddings-engine.mjs +19 -5
- package/lib/storage/hybrid-query.mjs +15 -196
- package/lib/storage/sync.mjs +36 -177
- package/lib/storage/vector-client.mjs +256 -235
- package/lib/strategy-store.mjs +35 -286
- package/lib/telemetry/beads-fallback.mjs +40 -0
- package/lib/telemetry/hook-calls.mjs +138 -0
- package/lib/worker/entrypoint.mjs +6 -14
- package/package.json +6 -5
- package/personas/construct.md +1 -1
- package/platforms/capabilities.json +76 -0
- package/platforms/claude/settings.template.json +0 -7
- package/platforms/opencode/sync-config.mjs +121 -25
- package/rules/common/neurodivergent-output.md +1 -1
- package/rules/web/coding-style.md +8 -0
- package/rules/web/design-quality.md +8 -0
- package/rules/web/hooks.md +8 -0
- package/rules/web/patterns.md +8 -0
- package/rules/web/performance.md +8 -0
- package/rules/web/security.md +8 -0
- package/rules/web/testing.md +8 -0
- package/scripts/sync-specialists.mjs +174 -40
- package/specialists/prompts/cx-architect.md +20 -0
- package/specialists/prompts/cx-qa.md +1 -1
- package/specialists/prompts/cx-test-automation.md +12 -0
- package/specialists/registry.json +0 -8
- package/templates/docs/construct_guide.md +1 -1
- package/db/schema/001_init.sql +0 -40
- package/db/schema/002_pgvector.sql +0 -182
- package/db/schema/003_intake.sql +0 -47
- package/db/schema/003_observation_reconciliation.sql +0 -14
- package/db/schema/004_recommendations.sql +0 -46
- package/db/schema/005_strategy.sql +0 -21
- package/db/schema/006_graph.sql +0 -24
- package/db/schema/007_tags.sql +0 -30
- package/db/schema/008_skill_usage.sql +0 -24
- package/db/schema/009_scheduler.sql +0 -14
- package/db/schema/010_cx_scores.sql +0 -51
- package/lib/intake/postgres-queue.mjs +0 -240
- package/lib/reconcile/postgres-namespace.mjs +0 -102
- package/lib/services/local-postgres.mjs +0 -15
- package/lib/storage/backup.mjs +0 -347
- package/lib/storage/migrations.mjs +0 -187
- package/lib/storage/postgres-backup.mjs +0 -124
- package/lib/storage/sql-store.mjs +0 -45
- package/lib/storage/store-version.mjs +0 -115
- package/lib/storage/unified-storage.mjs +0 -550
- 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
|
-
}
|