sneakoscope 0.9.13 → 0.9.14
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 +30 -39
- package/crates/sks-core/Cargo.lock +99 -1
- package/crates/sks-core/Cargo.toml +2 -1
- package/crates/sks-core/src/main.rs +77 -43
- package/package.json +8 -5
- package/src/cli/command-registry.mjs +73 -114
- package/src/cli/feature-commands.mjs +44 -5
- package/src/cli/install-helpers.mjs +2 -2
- package/src/cli/router.mjs +2 -3
- package/src/commands/aliases.mjs +2 -0
- package/src/commands/auto-review.mjs +5 -0
- package/src/commands/autoresearch.mjs +5 -0
- package/src/commands/bootstrap.mjs +2 -0
- package/src/commands/code-structure.mjs +5 -0
- package/src/commands/codex-lb.mjs +61 -3
- package/src/commands/commands.mjs +5 -0
- package/src/commands/commit-and-push.mjs +5 -0
- package/src/commands/commit.mjs +5 -0
- package/src/commands/computer-use.mjs +31 -0
- package/src/commands/conflicts.mjs +13 -0
- package/src/commands/context7.mjs +5 -0
- package/src/commands/db.mjs +1 -1
- package/src/commands/deps.mjs +5 -0
- package/src/commands/dfix.mjs +2 -0
- package/src/commands/doctor.mjs +2 -2
- package/src/commands/dollar-commands.mjs +2 -0
- package/src/commands/eval.mjs +5 -0
- package/src/commands/fix-path.mjs +2 -0
- package/src/commands/gc.mjs +2 -0
- package/src/commands/goal.mjs +5 -0
- package/src/commands/guard.mjs +10 -0
- package/src/commands/gx.mjs +5 -0
- package/src/commands/harness.mjs +5 -0
- package/src/commands/help.mjs +3 -74
- package/src/commands/hook.mjs +8 -0
- package/src/commands/hproof.mjs +5 -0
- package/src/commands/image-ux-review.mjs +38 -0
- package/src/commands/init.mjs +2 -0
- package/src/commands/mad-sks.mjs +14 -0
- package/src/commands/memory.mjs +5 -0
- package/src/commands/openclaw.mjs +2 -0
- package/src/commands/perf.mjs +2 -2
- package/src/commands/pipeline.mjs +25 -0
- package/src/commands/postinstall.mjs +2 -0
- package/src/commands/ppt.mjs +44 -0
- package/src/commands/profile.mjs +5 -0
- package/src/commands/proof-field.mjs +5 -0
- package/src/commands/proof.mjs +22 -1
- package/src/commands/qa-loop.mjs +5 -0
- package/src/commands/quickstart.mjs +2 -0
- package/src/commands/reasoning.mjs +2 -0
- package/src/commands/recallpulse.mjs +5 -0
- package/src/commands/research.mjs +5 -0
- package/src/commands/selftest.mjs +2 -0
- package/src/commands/setup.mjs +2 -0
- package/src/commands/skill-dream.mjs +5 -0
- package/src/commands/stats.mjs +2 -0
- package/src/commands/team.mjs +2 -0
- package/src/commands/tmux.mjs +5 -0
- package/src/commands/update-check.mjs +2 -0
- package/src/commands/usage.mjs +2 -0
- package/src/commands/validate-artifacts.mjs +2 -0
- package/src/commands/versioning.mjs +16 -0
- package/src/commands/wiki.mjs +2 -2
- package/src/core/codex-lb-circuit.mjs +18 -0
- package/src/core/commands/basic-cli.mjs +315 -0
- package/src/{cli/maintenance-commands.mjs → core/commands/route-cli.mjs} +37 -37
- package/src/core/feature-fixture-runner.mjs +109 -0
- package/src/core/feature-fixtures.mjs +1 -1
- package/src/core/feature-registry.mjs +19 -7
- package/src/core/fsx.mjs +1 -1
- package/src/core/git-simple.mjs +118 -0
- package/src/core/pipeline.mjs +1 -1
- package/src/core/proof/route-finalizer-fixtures.mjs +21 -0
- package/src/core/proof/route-finalizer-policy.mjs +13 -0
- package/src/core/proof/route-finalizer.mjs +82 -0
- package/src/core/proof-field.mjs +2 -2
- package/src/core/routes.mjs +31 -1
- package/src/core/rust-accelerator.mjs +8 -3
- package/src/core/version.mjs +1 -1
- package/src/core/wiki-image/before-after-relation.mjs +1 -0
- package/src/core/wiki-image/computer-use-evidence.mjs +1 -0
- package/src/core/wiki-image/generated-review-parser.mjs +1 -0
- package/src/core/wiki-image/image-ux-evidence.mjs +1 -0
- package/src/core/wiki-image/image-voxel-ledger.mjs +10 -3
- package/src/core/wiki-image/ppt-image-evidence.mjs +1 -0
- package/src/core/wiki-image/route-image-evidence.mjs +107 -0
- package/src/cli/legacy-main.mjs +0 -4147
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fsp from 'node:fs/promises';
|
|
3
|
+
import { ensureDir, exists, packageRoot } from '../fsx.mjs';
|
|
4
|
+
import { addImageRelation, addVisualAnchor, ingestImage, missionImageLedgerPath, readImageVoxelLedger, writeImageVoxelLedger } from './image-voxel-ledger.mjs';
|
|
5
|
+
import { validateImageVoxelLedger } from './validation.mjs';
|
|
6
|
+
import { emptyImageVoxelLedger } from './image-voxel-schema.mjs';
|
|
7
|
+
|
|
8
|
+
const ONE_BY_ONE_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMB/axX7V8AAAAASUVORK5CYII=';
|
|
9
|
+
|
|
10
|
+
export async function ensureRouteImageEvidence(root = packageRoot(), {
|
|
11
|
+
missionId,
|
|
12
|
+
route,
|
|
13
|
+
mock = false,
|
|
14
|
+
requireRelation = false,
|
|
15
|
+
source = 'route-finalizer'
|
|
16
|
+
} = {}) {
|
|
17
|
+
if (!missionId) return { ok: false, status: 'blocked', issues: ['mission_id_missing'] };
|
|
18
|
+
const missionLedger = missionImageLedgerPath(root, missionId);
|
|
19
|
+
let ledger = await readImageVoxelLedger(root, await exists(missionLedger) ? missionLedger : undefined);
|
|
20
|
+
if (ledger?.mission_id !== missionId) ledger = { ...emptyImageVoxelLedger(), ...ledger, mission_id: missionId };
|
|
21
|
+
let existingValidation = validateImageVoxelLedger(ledger, { requireAnchors: true, requireRelations: requireRelation, route });
|
|
22
|
+
if (existingValidation.ok && ledger.anchors?.length) {
|
|
23
|
+
await writeImageVoxelLedger(root, ledger);
|
|
24
|
+
return { ok: true, status: 'verified_partial', ledger, validation: existingValidation, created_mock: false };
|
|
25
|
+
}
|
|
26
|
+
if (!mock) {
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
status: 'blocked',
|
|
30
|
+
issues: existingValidation.issues.length ? existingValidation.issues : ['image_voxel_anchors_missing'],
|
|
31
|
+
validation: existingValidation
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
ledger = sanitizeMissionLedger(ledger, missionId);
|
|
35
|
+
existingValidation = validateImageVoxelLedger(ledger, { requireAnchors: true, requireRelations: requireRelation, route });
|
|
36
|
+
await writeImageVoxelLedger(root, ledger);
|
|
37
|
+
const imagePath = path.join(root, '.sneakoscope', 'missions', missionId, 'visual-fixture.png');
|
|
38
|
+
await ensureDir(path.dirname(imagePath));
|
|
39
|
+
await fsp.writeFile(imagePath, Buffer.from(ONE_BY_ONE_PNG_BASE64, 'base64'));
|
|
40
|
+
await ingestImage(root, path.relative(root, imagePath), { missionId, source: `${source}:mock`, id: `${missionId}-mock-before` });
|
|
41
|
+
await ingestImage(root, path.relative(root, imagePath), { missionId, source: `${source}:mock`, id: `${missionId}-mock-after` });
|
|
42
|
+
const anchorId = `${missionId}-mock-anchor`;
|
|
43
|
+
const anchor = await addVisualAnchor(root, {
|
|
44
|
+
id: anchorId,
|
|
45
|
+
missionId,
|
|
46
|
+
imageId: `${missionId}-mock-after`,
|
|
47
|
+
bbox: [0, 0, 1, 1],
|
|
48
|
+
label: `${route || 'visual route'} mock visual anchor`,
|
|
49
|
+
source: `${source}:mock`,
|
|
50
|
+
evidencePath: `.sneakoscope/missions/${missionId}/visual-fixture.png`,
|
|
51
|
+
route,
|
|
52
|
+
trustScore: 0.5
|
|
53
|
+
});
|
|
54
|
+
let relation = null;
|
|
55
|
+
if (requireRelation) {
|
|
56
|
+
relation = await addImageRelation(root, {
|
|
57
|
+
missionId,
|
|
58
|
+
route,
|
|
59
|
+
beforeImageId: `${missionId}-mock-before`,
|
|
60
|
+
afterImageId: `${missionId}-mock-after`,
|
|
61
|
+
anchors: [anchorId],
|
|
62
|
+
status: 'verified_partial',
|
|
63
|
+
verification: 'mock-before-after-fixture'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const nextLedger = relation?.ledger || anchor.ledger;
|
|
67
|
+
const validation = validateImageVoxelLedger(nextLedger, { requireAnchors: true, requireRelations: requireRelation, route });
|
|
68
|
+
return {
|
|
69
|
+
ok: validation.ok,
|
|
70
|
+
status: validation.ok ? 'verified_partial' : 'blocked',
|
|
71
|
+
ledger: nextLedger,
|
|
72
|
+
validation,
|
|
73
|
+
created_mock: true,
|
|
74
|
+
mock: true,
|
|
75
|
+
issues: validation.issues
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function sanitizeMissionLedger(ledger = emptyImageVoxelLedger(), missionId) {
|
|
80
|
+
const marker = String(missionId || '');
|
|
81
|
+
const images = (ledger.images || []).filter((image) => {
|
|
82
|
+
const id = String(image.id || '');
|
|
83
|
+
const file = String(image.path || '');
|
|
84
|
+
return id.startsWith(`${marker}-`) || file.includes(`/missions/${marker}/`) || file.includes(`missions/${marker}/`);
|
|
85
|
+
});
|
|
86
|
+
const imageIds = new Set(images.map((image) => image.id));
|
|
87
|
+
const anchors = (ledger.anchors || []).filter((anchor) => {
|
|
88
|
+
const id = String(anchor.id || '');
|
|
89
|
+
const evidence = String(anchor.evidence_path || anchor.evidencePath || '');
|
|
90
|
+
return imageIds.has(anchor.image_id) && (id.startsWith(`${marker}-`) || evidence.includes(marker));
|
|
91
|
+
});
|
|
92
|
+
const anchorIds = new Set(anchors.map((anchor) => anchor.id));
|
|
93
|
+
const relations = (ledger.relations || []).filter((relation) => {
|
|
94
|
+
const changed = relation.changed_anchor_ids || relation.anchors || [];
|
|
95
|
+
return imageIds.has(relation.before_image_id)
|
|
96
|
+
&& imageIds.has(relation.after_image_id)
|
|
97
|
+
&& changed.every((anchorId) => anchorIds.has(anchorId));
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
...emptyImageVoxelLedger(),
|
|
101
|
+
...ledger,
|
|
102
|
+
mission_id: missionId,
|
|
103
|
+
images,
|
|
104
|
+
anchors,
|
|
105
|
+
relations
|
|
106
|
+
};
|
|
107
|
+
}
|