@solidnumber/cli 2.26.0 → 2.28.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/CHANGELOG.md +105 -1
- package/README.md +61 -32
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +64 -14
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/code.d.ts.map +1 -1
- package/dist/commands/code.js +13 -8
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/find.d.ts +5 -0
- package/dist/commands/find.d.ts.map +1 -1
- package/dist/commands/find.js +48 -11
- package/dist/commands/find.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +10 -6
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/map.d.ts +4 -1
- package/dist/commands/map.d.ts.map +1 -1
- package/dist/commands/map.js +11 -3
- package/dist/commands/map.js.map +1 -1
- package/dist/commands/notes.d.ts.map +1 -1
- package/dist/commands/notes.js +16 -10
- package/dist/commands/notes.js.map +1 -1
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +103 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/verbs.d.ts +24 -3
- package/dist/commands/verbs.d.ts.map +1 -1
- package/dist/commands/verbs.js +258 -9
- package/dist/commands/verbs.js.map +1 -1
- package/dist/data/cms-blocks.json +880 -305
- package/dist/lib/api-client.d.ts +15 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +116 -93
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/find-answer.d.ts +42 -0
- package/dist/lib/find-answer.d.ts.map +1 -0
- package/dist/lib/find-answer.js +59 -0
- package/dist/lib/find-answer.js.map +1 -0
- package/dist/lib/output-contract.d.ts +70 -0
- package/dist/lib/output-contract.d.ts.map +1 -0
- package/dist/lib/output-contract.js +83 -0
- package/dist/lib/output-contract.js.map +1 -0
- package/dist/lib/pull-readme.js +1 -1
- package/dist/lib/push-catalog.d.ts +46 -0
- package/dist/lib/push-catalog.d.ts.map +1 -0
- package/dist/lib/push-catalog.js +124 -0
- package/dist/lib/push-catalog.js.map +1 -0
- package/dist/lib/push-diff.d.ts +24 -0
- package/dist/lib/push-diff.d.ts.map +1 -0
- package/dist/lib/push-diff.js +58 -0
- package/dist/lib/push-diff.js.map +1 -0
- package/dist/lib/sandbox-verbs.d.ts +4 -5
- package/dist/lib/sandbox-verbs.d.ts.map +1 -1
- package/dist/lib/sandbox-verbs.js +10 -17
- package/dist/lib/sandbox-verbs.js.map +1 -1
- package/dist/lib/verb-envelope.d.ts +43 -0
- package/dist/lib/verb-envelope.d.ts.map +1 -0
- package/dist/lib/verb-envelope.js +71 -0
- package/dist/lib/verb-envelope.js.map +1 -0
- package/dist/lib/verb-snapshot.d.ts +33 -0
- package/dist/lib/verb-snapshot.d.ts.map +1 -0
- package/dist/lib/verb-snapshot.js +84 -0
- package/dist/lib/verb-snapshot.js.map +1 -0
- package/package.json +4 -2
- package/platform-docs/llms.txt +5 -5
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VERB = exports.PUSHABLE = void 0;
|
|
37
|
+
exports.diffCatalog = diffCatalog;
|
|
38
|
+
exports.readCatalogFiles = readCatalogFiles;
|
|
39
|
+
exports.mergeDiffs = mergeDiffs;
|
|
40
|
+
/**
|
|
41
|
+
* solid push for services/ and products/.
|
|
42
|
+
*
|
|
43
|
+
* ⛔ WHY. `solid pull` wrote services/ and products/ as files and `solid push` never
|
|
44
|
+
* sent them back, so the folder looked two-way and was not: someone corrected a
|
|
45
|
+
* description in a file, pushed, was told it worked, and nothing changed.
|
|
46
|
+
*
|
|
47
|
+
* What goes back, and what does not:
|
|
48
|
+
* - name / title, description, category of a file that carries its `_id` and DIFFERS
|
|
49
|
+
* from the record — through the verbs `service.update` / `product.update`, so the
|
|
50
|
+
* change is versioned and can be rolled back like any other.
|
|
51
|
+
* - ⛔ NEVER the price. A price on a two-price program has a basis (cash or card) that
|
|
52
|
+
* a file cannot state, and a wrong guess reprices the business. A changed price is
|
|
53
|
+
* reported with the verb that changes it.
|
|
54
|
+
* - A file with no `_id` is not created: creating is `service.create` /
|
|
55
|
+
* `product.create`, which need more than a pulled file holds.
|
|
56
|
+
*
|
|
57
|
+
* Pure but for reading the folder: the diff takes the remote records as an argument.
|
|
58
|
+
*/
|
|
59
|
+
const fs = __importStar(require("fs"));
|
|
60
|
+
const path = __importStar(require("path"));
|
|
61
|
+
/** file field → verb argument, per kind. */
|
|
62
|
+
exports.PUSHABLE = {
|
|
63
|
+
services: { title: 'title', description: 'description', category: 'category' },
|
|
64
|
+
products: { name: 'name', description: 'description', category: 'category' },
|
|
65
|
+
};
|
|
66
|
+
exports.VERB = {
|
|
67
|
+
services: { verb: 'service.update', idArg: 'service_id', priceVerb: 'service.update' },
|
|
68
|
+
products: { verb: 'product.update', idArg: 'product_id', priceVerb: 'product.update_pricing' },
|
|
69
|
+
};
|
|
70
|
+
const same = (a, b) => (a ?? null) === (b ?? null)
|
|
71
|
+
|| (typeof a === 'string' && typeof b === 'string' && a.trim() === b.trim());
|
|
72
|
+
function diffCatalog(kind, local, remote) {
|
|
73
|
+
const byId = new Map(remote.map((r) => [Number(r.id), r]));
|
|
74
|
+
const out = { changes: [], price_not_pushed: [], not_pushed: [] };
|
|
75
|
+
const { verb, idArg, priceVerb } = exports.VERB[kind];
|
|
76
|
+
for (const { file, data } of local) {
|
|
77
|
+
const id = Number(data?._id);
|
|
78
|
+
if (!Number.isFinite(id) || id <= 0) {
|
|
79
|
+
out.not_pushed.push({ kind, file, why: `no _id — create it with ${kind === 'services' ? 'service.create' : 'product.create'}` });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const record = byId.get(id);
|
|
83
|
+
if (!record) {
|
|
84
|
+
out.not_pushed.push({ kind, file, why: `no ${kind === 'services' ? 'service' : 'product'} with id ${id} in this business` });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const args = {};
|
|
88
|
+
const before = {};
|
|
89
|
+
for (const [field, arg] of Object.entries(exports.PUSHABLE[kind])) {
|
|
90
|
+
if (field in data && data[field] != null && !same(data[field], record[field])) {
|
|
91
|
+
args[arg] = data[field];
|
|
92
|
+
before[arg] = record[field] ?? null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(args).length) {
|
|
96
|
+
out.changes.push({ kind, file, id, verb, args: { [idArg]: id, ...args }, changed: Object.keys(args), before });
|
|
97
|
+
}
|
|
98
|
+
if ('price' in data && data.price != null && Number(data.price) !== Number(record.price)) {
|
|
99
|
+
out.price_not_pushed.push({ kind, file, id, local: data.price, remote: record.price ?? null, use: priceVerb });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
function readCatalogFiles(baseDir, kind) {
|
|
105
|
+
const dir = path.join(baseDir, kind);
|
|
106
|
+
if (!fs.existsSync(dir))
|
|
107
|
+
return [];
|
|
108
|
+
const out = [];
|
|
109
|
+
for (const file of fs.readdirSync(dir).filter((f) => f.endsWith('.json')).sort()) {
|
|
110
|
+
try {
|
|
111
|
+
out.push({ file, data: JSON.parse(fs.readFileSync(path.join(dir, file), 'utf-8')) });
|
|
112
|
+
}
|
|
113
|
+
catch { /* not JSON — not ours to push */ }
|
|
114
|
+
}
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
function mergeDiffs(...diffs) {
|
|
118
|
+
return {
|
|
119
|
+
changes: diffs.flatMap((d) => d.changes),
|
|
120
|
+
price_not_pushed: diffs.flatMap((d) => d.price_not_pushed),
|
|
121
|
+
not_pushed: diffs.flatMap((d) => d.not_pushed),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=push-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-catalog.js","sourceRoot":"","sources":["../../src/lib/push-catalog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,kCAiCC;AAED,4CAUC;AAED,gCAMC;AA5GD;;;;;;;;;;;;;;;;;;GAkBG;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CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACjF,IAAI,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QACvF,CAAC;QAAC,MAAM,CAAC,CAAC,iCAAiC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,UAAU,CAAC,GAAG,KAAoB;IAChD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACxC,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAC1D,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;KAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `solid push --dry-run` would change, field by field.
|
|
3
|
+
*
|
|
4
|
+
* ⛔ WHY. The dry run named FILES. Every file the manifest knows is listed as an update
|
|
5
|
+
* whether or not a byte differs, so "~ pages/home.json" told nobody what would happen to
|
|
6
|
+
* the page. This compares each file with the record it would overwrite and says
|
|
7
|
+
* before → after per field — and says so when a file would change nothing.
|
|
8
|
+
*
|
|
9
|
+
* Pure: the remote record is an argument.
|
|
10
|
+
*/
|
|
11
|
+
export interface FieldChange {
|
|
12
|
+
field: string;
|
|
13
|
+
before: string;
|
|
14
|
+
after: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function show(v: unknown): string;
|
|
17
|
+
export declare function pageDiff(local: Record<string, any>, remote: Record<string, any> | null): FieldChange[];
|
|
18
|
+
export declare function kbDiff(local: {
|
|
19
|
+
title?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
category?: string;
|
|
22
|
+
}, remote: Record<string, any> | null): FieldChange[];
|
|
23
|
+
export declare function lines(changes: FieldChange[], indent?: string): string[];
|
|
24
|
+
//# sourceMappingURL=push-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-diff.d.ts","sourceRoot":"","sources":["../../src/lib/push-diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAG7E,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAKvC;AAYD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,WAAW,EAAE,CAYtG;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EACnF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,WAAW,EAAE,CAYnD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,SAAa,GAAG,MAAM,EAAE,CAG3E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.show = show;
|
|
4
|
+
exports.pageDiff = pageDiff;
|
|
5
|
+
exports.kbDiff = kbDiff;
|
|
6
|
+
exports.lines = lines;
|
|
7
|
+
const CLIP = 70;
|
|
8
|
+
function show(v) {
|
|
9
|
+
if (v === null || v === undefined || v === '')
|
|
10
|
+
return '(empty)';
|
|
11
|
+
const s = typeof v === 'string' ? v : JSON.stringify(v);
|
|
12
|
+
const one = s.replace(/\s+/g, ' ').trim();
|
|
13
|
+
return one.length > CLIP ? `${one.slice(0, CLIP - 1)}…` : one;
|
|
14
|
+
}
|
|
15
|
+
const eq = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
16
|
+
function sectionSummary(layout) {
|
|
17
|
+
const sections = Array.isArray(layout?.sections) ? layout.sections : [];
|
|
18
|
+
if (!sections.length)
|
|
19
|
+
return '(no sections)';
|
|
20
|
+
return `${sections.length} section${sections.length === 1 ? '' : 's'}: ${sections.map((s) => s?.type || '?').join(', ')}`;
|
|
21
|
+
}
|
|
22
|
+
const PAGE_FIELDS = ['title', 'slug', 'meta_title', 'meta_description', 'is_published', 'is_landing_page', 'page_type'];
|
|
23
|
+
function pageDiff(local, remote) {
|
|
24
|
+
if (!remote)
|
|
25
|
+
return [{ field: '(new page)', before: '(none)', after: show(local.title || local.slug) }];
|
|
26
|
+
const out = [];
|
|
27
|
+
for (const f of PAGE_FIELDS) {
|
|
28
|
+
if (f in local && !eq(local[f], remote[f]))
|
|
29
|
+
out.push({ field: f, before: show(remote[f]), after: show(local[f]) });
|
|
30
|
+
}
|
|
31
|
+
if ('layout_json' in local && !eq(local.layout_json, remote.layout_json)) {
|
|
32
|
+
const before = sectionSummary(remote.layout_json);
|
|
33
|
+
const after = sectionSummary(local.layout_json);
|
|
34
|
+
out.push({ field: 'layout_json', before, after: before === after ? `${after} (content changed)` : after });
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function kbDiff(local, remote) {
|
|
39
|
+
if (!remote)
|
|
40
|
+
return [{ field: '(new entry)', before: '(none)', after: show(local.title) }];
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const f of ['title', 'category']) {
|
|
43
|
+
if (local[f] != null && (local[f] || '').trim() !== String(remote[f] ?? '').trim()) {
|
|
44
|
+
out.push({ field: f, before: show(remote[f]), after: show(local[f]) });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const a = (local.content || '').trim();
|
|
48
|
+
const b = String(remote.content ?? '').trim();
|
|
49
|
+
if (a !== b)
|
|
50
|
+
out.push({ field: 'content', before: `${b.length} chars: ${show(b)}`, after: `${a.length} chars: ${show(a)}` });
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function lines(changes, indent = ' ') {
|
|
54
|
+
if (!changes.length)
|
|
55
|
+
return [`${indent}(no differences — pushing it changes nothing)`];
|
|
56
|
+
return changes.map((c) => `${indent}${c.field}: ${c.before} → ${c.after}`);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=push-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-diff.js","sourceRoot":"","sources":["../../src/lib/push-diff.ts"],"names":[],"mappings":";;AAaA,oBAKC;AAYD,4BAYC;AAED,wBAaC;AAED,sBAGC;AAlDD,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,SAAgB,IAAI,CAAC,CAAU;IAC7B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,C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C,IAAI,EAAE,EAAE,CAAC;YACnF,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,IAAI,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7H,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,KAAK,CAAC,OAAsB,EAAE,MAAM,GAAG,UAAU;IAC/D,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,GAAG,MAAM,+CAA+C,CAAC,CAAC;IACvF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -43,14 +43,13 @@ export interface SandboxDiff {
|
|
|
43
43
|
assets?: SandboxPageChange[];
|
|
44
44
|
total_changes?: number;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
export declare function unwrapVerb<T = Record<string, unknown>>(data: unknown): T;
|
|
46
|
+
export { unwrapVerb } from './verb-envelope';
|
|
48
47
|
export declare function sandboxStatus(client: VerbClient): Promise<SandboxStatus>;
|
|
49
48
|
/** Writes carry `confirm: true` — running the command IS the caller's consent. */
|
|
50
|
-
export declare function sandboxFork(client: VerbClient, scope?: Record<string, boolean> | null): Promise<
|
|
49
|
+
export declare function sandboxFork(client: VerbClient, scope?: Record<string, boolean> | null): Promise<import("./verb-envelope").VerbAnswer>;
|
|
51
50
|
export declare function sandboxDiff(client: VerbClient): Promise<SandboxDiff>;
|
|
52
|
-
export declare function sandboxPromote(client: VerbClient): Promise<
|
|
53
|
-
export declare function sandboxExit(client: VerbClient): Promise<
|
|
51
|
+
export declare function sandboxPromote(client: VerbClient): Promise<import("./verb-envelope").VerbAnswer>;
|
|
52
|
+
export declare function sandboxExit(client: VerbClient): Promise<import("./verb-envelope").VerbAnswer>;
|
|
54
53
|
/** `--scope pages|data|all` → the verb's scope object. */
|
|
55
54
|
export declare function scopeFromFlag(flag: string | undefined): Record<string, boolean> | null;
|
|
56
55
|
/** The page entries of a diff, whatever server version produced it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-verbs.d.ts","sourceRoot":"","sources":["../../src/lib/sandbox-verbs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CA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AAC1D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAOtF;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB,EAAE,CAGlE;AAED,iCAAiC;AACjC,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CAkBrD;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED,eAAO,MAAM,kBAAkB,kGAC6D,CAAC"}
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
* Pure (no chalk/ora) so it is unit-testable.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.NO_SANDBOX_MESSAGE = void 0;
|
|
19
|
-
exports.unwrapVerb = unwrapVerb;
|
|
18
|
+
exports.NO_SANDBOX_MESSAGE = exports.unwrapVerb = void 0;
|
|
20
19
|
exports.sandboxStatus = sandboxStatus;
|
|
21
20
|
exports.sandboxFork = sandboxFork;
|
|
22
21
|
exports.sandboxDiff = sandboxDiff;
|
|
@@ -26,19 +25,13 @@ exports.scopeFromFlag = scopeFromFlag;
|
|
|
26
25
|
exports.pageChanges = pageChanges;
|
|
27
26
|
exports.diffLines = diffLines;
|
|
28
27
|
exports.absoluteUrl = absoluteUrl;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if ('result' in d && d.result && typeof d.result === 'object' && ('ok' in d || 'verb' in d)) {
|
|
34
|
-
return d.result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return (data ?? {});
|
|
38
|
-
}
|
|
28
|
+
// One reading for every command: lib/verb-envelope.ts.
|
|
29
|
+
var verb_envelope_1 = require("./verb-envelope");
|
|
30
|
+
Object.defineProperty(exports, "unwrapVerb", { enumerable: true, get: function () { return verb_envelope_1.unwrapVerb; } });
|
|
31
|
+
const verb_envelope_2 = require("./verb-envelope");
|
|
39
32
|
const VERB = (name) => `/api/v1/agent/sandbox/${name}`;
|
|
40
33
|
async function sandboxStatus(client) {
|
|
41
|
-
const r = unwrapVerb((await client.post(VERB('status'), {})).data);
|
|
34
|
+
const r = (0, verb_envelope_2.unwrapVerb)((await client.post(VERB('status'), {})).data);
|
|
42
35
|
return { ...r, active: Boolean(r.active) };
|
|
43
36
|
}
|
|
44
37
|
/** Writes carry `confirm: true` — running the command IS the caller's consent. */
|
|
@@ -46,17 +39,17 @@ async function sandboxFork(client, scope) {
|
|
|
46
39
|
const body = { confirm: true };
|
|
47
40
|
if (scope)
|
|
48
41
|
body.scope = scope;
|
|
49
|
-
return unwrapVerb((await client.post(VERB('fork'), body)).data);
|
|
42
|
+
return (0, verb_envelope_2.unwrapVerb)((await client.post(VERB('fork'), body)).data);
|
|
50
43
|
}
|
|
51
44
|
async function sandboxDiff(client) {
|
|
52
|
-
const r = unwrapVerb((await client.post(VERB('diff'), {})).data);
|
|
45
|
+
const r = (0, verb_envelope_2.unwrapVerb)((await client.post(VERB('diff'), {})).data);
|
|
53
46
|
return { ...r, changes: r.changes || [] };
|
|
54
47
|
}
|
|
55
48
|
async function sandboxPromote(client) {
|
|
56
|
-
return unwrapVerb((await client.post(VERB('promote'), { confirm: true })).data);
|
|
49
|
+
return (0, verb_envelope_2.unwrapVerb)((await client.post(VERB('promote'), { confirm: true })).data);
|
|
57
50
|
}
|
|
58
51
|
async function sandboxExit(client) {
|
|
59
|
-
return unwrapVerb((await client.post(VERB('exit'), { confirm: true })).data);
|
|
52
|
+
return (0, verb_envelope_2.unwrapVerb)((await client.post(VERB('exit'), { confirm: true })).data);
|
|
60
53
|
}
|
|
61
54
|
/** `--scope pages|data|all` → the verb's scope object. */
|
|
62
55
|
function scopeFromFlag(flag) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-verbs.js","sourceRoot":"","sources":["../../src/lib/sandbox-verbs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;
|
|
1
|
+
{"version":3,"file":"sandbox-verbs.js","sourceRoot":"","sources":["../../src/lib/sandbox-verbs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAwCH,sCAGC;AAGD,kCAIC;AAED,kCAGC;AAED,wCAEC;AAED,kCAEC;AAGD,sCAOC;AAGD,kCAGC;AAGD,8BAkBC;AAGD,kCAGC;AAxED,uDAAuD;AACvD,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mDAA6C;AAE7C,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,yBAAyB,IAAI,EAAE,CAAC;AAExD,KAAK,UAAU,aAAa,CAAC,MAAkB;IACpD,MAAM,CAAC,GAAG,IAAA,0BAAU,EAAgB,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClF,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AAC7C,CAAC;AAED,kFAAkF;AAC3E,KAAK,UAAU,WAAW,CAAC,MAAkB,EAAE,KAAsC;IAC1F,MAAM,IAAI,GAA4B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxD,IAAI,KAAK;QAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC9B,OAAO,IAAA,0BAAU,EAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,MAAkB;IAClD,MAAM,CAAC,GAAG,IAAA,0BAAU,EAAc,CAAC,M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,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;QACnG,CAAC;aAAM,IAAI,CAAC,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3E,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAI,CAAwC,CAAC,SAAS,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,yEAAyE;AACzE,SAAgB,WAAW,CAAC,OAAe,EAAE,CAAS;IACpD,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACtC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC;AAEY,QAAA,kBAAkB,GAC7B,0FAA0F,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One reading of what the verb surface sends back.
|
|
3
|
+
*
|
|
4
|
+
* ⛔ WHY THIS EXISTS. `POST /api/v1/agent/<namespace>/<verb>` answers in one of
|
|
5
|
+
* two shapes, and which one depends on something a command cannot see — whether
|
|
6
|
+
* the backend serves that address from its own route or from the catch-all:
|
|
7
|
+
*
|
|
8
|
+
* its own route { note_id: 7, note_type: "decision" } (bare)
|
|
9
|
+
* the catch-all { ok: true, verb: "notes.add", result: { note_id: 7 … } }
|
|
10
|
+
* { ok: false, verb: "notes.add", error: { reason, message, next } }
|
|
11
|
+
*
|
|
12
|
+
* Commands written against the bare shape read `data.upload_url` and got
|
|
13
|
+
* `undefined`. Found 2026-10-04 by a customer: `solid app publish --confirm`
|
|
14
|
+
* died with "Failed to parse URL from undefined" and `solid app get` printed
|
|
15
|
+
* "undefined undefined (offline)" for a live app — on every version since
|
|
16
|
+
* `solid app` shipped. The same mistake sat in `solid notes`, `solid code` and
|
|
17
|
+
* `solid history`. `--json` looked right throughout, because it prints the
|
|
18
|
+
* answer raw.
|
|
19
|
+
*
|
|
20
|
+
* ⛔ AND WHY THE TESTS WERE GREEN. Each command's test mocked the server with
|
|
21
|
+
* the bare shape the command expected. A fake that agrees with the code under
|
|
22
|
+
* test proves the code agrees with itself. The shapes above are copied from the
|
|
23
|
+
* backend (`controllers/ada.py::_cli_dispatch`); tests use `asDispatched()` to
|
|
24
|
+
* answer the way the server really does.
|
|
25
|
+
*
|
|
26
|
+
* Three commands had already been fixed one at a time with `data.result ?? data`,
|
|
27
|
+
* and two files carried a private helper each. This is the one reading.
|
|
28
|
+
*/
|
|
29
|
+
export type VerbAnswer = Record<string, any>;
|
|
30
|
+
/**
|
|
31
|
+
* The verb's own answer, whichever shape it arrived in.
|
|
32
|
+
*
|
|
33
|
+
* - dispatched and it worked → the `result`, unwrapped
|
|
34
|
+
* - dispatched and refused → `{ ok: false, reason, error: <message>, next, verb }`,
|
|
35
|
+
* flat, so a command prints the sentence and the way on
|
|
36
|
+
* - answered bare → unchanged
|
|
37
|
+
*/
|
|
38
|
+
export declare function unwrapVerb<T = VerbAnswer>(data: unknown): T;
|
|
39
|
+
/** For tests: the catch-all's envelope around a verb's answer, as the server sends it. */
|
|
40
|
+
export declare function asDispatched(verb: string, result: Record<string, unknown>): Record<string, unknown>;
|
|
41
|
+
/** For tests: the catch-all's refusal, as the server sends it. */
|
|
42
|
+
export declare function asRefused(verb: string, reason: string, message: string, next?: string): Record<string, unknown>;
|
|
43
|
+
//# sourceMappingURL=verb-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verb-envelope.d.ts","sourceRoot":"","sources":["../../src/lib/verb-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAM7C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,GAAG,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,CAe3D;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnG;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE/G"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* One reading of what the verb surface sends back.
|
|
4
|
+
*
|
|
5
|
+
* ⛔ WHY THIS EXISTS. `POST /api/v1/agent/<namespace>/<verb>` answers in one of
|
|
6
|
+
* two shapes, and which one depends on something a command cannot see — whether
|
|
7
|
+
* the backend serves that address from its own route or from the catch-all:
|
|
8
|
+
*
|
|
9
|
+
* its own route { note_id: 7, note_type: "decision" } (bare)
|
|
10
|
+
* the catch-all { ok: true, verb: "notes.add", result: { note_id: 7 … } }
|
|
11
|
+
* { ok: false, verb: "notes.add", error: { reason, message, next } }
|
|
12
|
+
*
|
|
13
|
+
* Commands written against the bare shape read `data.upload_url` and got
|
|
14
|
+
* `undefined`. Found 2026-10-04 by a customer: `solid app publish --confirm`
|
|
15
|
+
* died with "Failed to parse URL from undefined" and `solid app get` printed
|
|
16
|
+
* "undefined undefined (offline)" for a live app — on every version since
|
|
17
|
+
* `solid app` shipped. The same mistake sat in `solid notes`, `solid code` and
|
|
18
|
+
* `solid history`. `--json` looked right throughout, because it prints the
|
|
19
|
+
* answer raw.
|
|
20
|
+
*
|
|
21
|
+
* ⛔ AND WHY THE TESTS WERE GREEN. Each command's test mocked the server with
|
|
22
|
+
* the bare shape the command expected. A fake that agrees with the code under
|
|
23
|
+
* test proves the code agrees with itself. The shapes above are copied from the
|
|
24
|
+
* backend (`controllers/ada.py::_cli_dispatch`); tests use `asDispatched()` to
|
|
25
|
+
* answer the way the server really does.
|
|
26
|
+
*
|
|
27
|
+
* Three commands had already been fixed one at a time with `data.result ?? data`,
|
|
28
|
+
* and two files carried a private helper each. This is the one reading.
|
|
29
|
+
*/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.unwrapVerb = unwrapVerb;
|
|
32
|
+
exports.asDispatched = asDispatched;
|
|
33
|
+
exports.asRefused = asRefused;
|
|
34
|
+
function isObject(v) {
|
|
35
|
+
return !!v && typeof v === 'object' && !Array.isArray(v);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The verb's own answer, whichever shape it arrived in.
|
|
39
|
+
*
|
|
40
|
+
* - dispatched and it worked → the `result`, unwrapped
|
|
41
|
+
* - dispatched and refused → `{ ok: false, reason, error: <message>, next, verb }`,
|
|
42
|
+
* flat, so a command prints the sentence and the way on
|
|
43
|
+
* - answered bare → unchanged
|
|
44
|
+
*/
|
|
45
|
+
function unwrapVerb(data) {
|
|
46
|
+
if (!isObject(data))
|
|
47
|
+
return (data ?? {});
|
|
48
|
+
const enveloped = 'verb' in data || 'ok' in data;
|
|
49
|
+
if (enveloped && data.ok === false && isObject(data.error)) {
|
|
50
|
+
const err = data.error;
|
|
51
|
+
return {
|
|
52
|
+
ok: false,
|
|
53
|
+
...(typeof data.verb === 'string' ? { verb: data.verb } : {}),
|
|
54
|
+
...(err.reason !== undefined ? { reason: err.reason } : err.code !== undefined ? { reason: err.code } : {}),
|
|
55
|
+
error: typeof err.message === 'string' && err.message ? err.message : String(err.reason ?? err.code ?? 'refused'),
|
|
56
|
+
...(err.next !== undefined ? { next: err.next } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (enveloped && isObject(data.result))
|
|
60
|
+
return data.result;
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
/** For tests: the catch-all's envelope around a verb's answer, as the server sends it. */
|
|
64
|
+
function asDispatched(verb, result) {
|
|
65
|
+
return { ok: true, verb, result };
|
|
66
|
+
}
|
|
67
|
+
/** For tests: the catch-all's refusal, as the server sends it. */
|
|
68
|
+
function asRefused(verb, reason, message, next) {
|
|
69
|
+
return { ok: false, verb, error: { reason, message, ...(next ? { next } : {}) } };
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=verb-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verb-envelope.js","sourceRoot":"","sources":["../../src/lib/verb-envelope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;AAgBH,gCAeC;AAGD,oCAEC;AAGD,8BAEC;AArCD,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,UAAU,CAAiB,IAAa;IACtD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,IAAI,EAAE,CAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,MAAM,IAAI,IAAI,IAAI,IAAI,IA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;AACpC,CAAC;AAED,kEAAkE;AAClE,SAAgB,SAAS,CAAC,IAAY,EAAE,MAAc,EAAE,OAAe,EAAE,IAAa;IACpF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const SNAPSHOT_SCHEMA = "solid:verb-snapshot/v2";
|
|
2
|
+
export declare const SNAPSHOT_SCHEMA_V1 = "solid:verb-snapshot/v1";
|
|
3
|
+
export interface SnapshotVerb {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
input_schema?: unknown;
|
|
7
|
+
side_effects?: string;
|
|
8
|
+
status?: string;
|
|
9
|
+
undone_by?: string | null;
|
|
10
|
+
same_as?: string | null;
|
|
11
|
+
output_schema?: unknown;
|
|
12
|
+
refuses_when?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface VerbSnapshot {
|
|
15
|
+
schema: string;
|
|
16
|
+
taken_at: string;
|
|
17
|
+
etag?: string;
|
|
18
|
+
verbs: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
export declare function fingerprint(v: SnapshotVerb, schema?: string): string;
|
|
21
|
+
export declare function takeSnapshot(verbs: SnapshotVerb[], etag?: string, now?: Date, schema?: string): VerbSnapshot;
|
|
22
|
+
export declare function isSnapshot(o: unknown): o is VerbSnapshot;
|
|
23
|
+
export interface SnapshotDiff {
|
|
24
|
+
since: string;
|
|
25
|
+
added: string[];
|
|
26
|
+
removed: string[];
|
|
27
|
+
changed: string[];
|
|
28
|
+
unchanged: number;
|
|
29
|
+
/** Set when the snapshot predates v2: it cannot see a changed return shape or refusal. */
|
|
30
|
+
blind_to?: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function diffSnapshot(prev: VerbSnapshot, verbs: SnapshotVerb[]): SnapshotDiff;
|
|
33
|
+
//# sourceMappingURL=verb-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verb-snapshot.d.ts","sourceRoot":"","sources":["../../src/lib/verb-snapshot.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AACD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAYD,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,GAAE,MAAwB,GAAG,MAAM,CAWrF;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAa,EAAE,MAAM,GAAE,MAAwB,GACvF,YAAY,CAId;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAIxD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,YAAY,CAgBpF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SNAPSHOT_SCHEMA_V1 = exports.SNAPSHOT_SCHEMA = void 0;
|
|
4
|
+
exports.fingerprint = fingerprint;
|
|
5
|
+
exports.takeSnapshot = takeSnapshot;
|
|
6
|
+
exports.isSnapshot = isSnapshot;
|
|
7
|
+
exports.diffSnapshot = diffSnapshot;
|
|
8
|
+
/**
|
|
9
|
+
* "What changed since I last looked?" for the verb catalog.
|
|
10
|
+
*
|
|
11
|
+
* ⛔ WHY A SNAPSHOT AND NOT A DATE. The catalog carries no per-verb timestamp — a verb is
|
|
12
|
+
* code, and the registry is rebuilt on every release — so "changed since <date>" cannot be
|
|
13
|
+
* answered honestly by anyone. What CAN be answered exactly is "changed since the catalog
|
|
14
|
+
* you were holding": the agent keeps a snapshot (name → fingerprint, ~40 KB), hands it
|
|
15
|
+
* back, and gets the names that were added, removed or changed. No local cache file for
|
|
16
|
+
* the CLI to keep, so nothing here can go stale behind the agent's back.
|
|
17
|
+
*
|
|
18
|
+
* The fingerprint covers what an agent decides on: description, inputs, side effects,
|
|
19
|
+
* status, how it is undone, what it is an alias of — and, from v2, what it returns and
|
|
20
|
+
* what it refuses on. Pure.
|
|
21
|
+
*
|
|
22
|
+
* ⛔ v1 SNAPSHOTS STILL DIFF CORRECTLY. v1 left `output_schema` and `refuses_when` out, so
|
|
23
|
+
* a verb whose return shape changed read as unchanged. Adding them changes every
|
|
24
|
+
* fingerprint, and a v1 file compared against v2 fingerprints would report the whole
|
|
25
|
+
* catalog as changed. So a snapshot is always compared with the fingerprint of its own
|
|
26
|
+
* schema, and the reply says to take a new one.
|
|
27
|
+
*/
|
|
28
|
+
const crypto_1 = require("crypto");
|
|
29
|
+
exports.SNAPSHOT_SCHEMA = 'solid:verb-snapshot/v2';
|
|
30
|
+
exports.SNAPSHOT_SCHEMA_V1 = 'solid:verb-snapshot/v1';
|
|
31
|
+
/** Keys sorted at every level, so the same verb always prints the same. */
|
|
32
|
+
function canonical(o) {
|
|
33
|
+
if (Array.isArray(o))
|
|
34
|
+
return o.map(canonical);
|
|
35
|
+
if (o && typeof o === 'object') {
|
|
36
|
+
return Object.fromEntries(Object.entries(o)
|
|
37
|
+
.sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, canonical(v)]));
|
|
38
|
+
}
|
|
39
|
+
return o;
|
|
40
|
+
}
|
|
41
|
+
function fingerprint(v, schema = exports.SNAPSHOT_SCHEMA) {
|
|
42
|
+
const basis = {
|
|
43
|
+
d: v.description || '', i: v.input_schema ?? null, s: v.side_effects || '',
|
|
44
|
+
st: v.status || 'active', u: v.undone_by ?? null, a: v.same_as ?? null,
|
|
45
|
+
};
|
|
46
|
+
if (schema !== exports.SNAPSHOT_SCHEMA_V1) {
|
|
47
|
+
basis.o = v.output_schema ?? null;
|
|
48
|
+
// An empty list and an absent one are the same answer: it refuses on nothing declared.
|
|
49
|
+
basis.r = Array.isArray(v.refuses_when) && v.refuses_when.length ? v.refuses_when : null;
|
|
50
|
+
}
|
|
51
|
+
return (0, crypto_1.createHash)('sha1').update(JSON.stringify(canonical(basis))).digest('hex').slice(0, 12);
|
|
52
|
+
}
|
|
53
|
+
function takeSnapshot(verbs, etag, now = new Date(), schema = exports.SNAPSHOT_SCHEMA) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const v of [...verbs].sort((a, b) => a.name.localeCompare(b.name)))
|
|
56
|
+
out[v.name] = fingerprint(v, schema);
|
|
57
|
+
return { schema, taken_at: now.toISOString(), ...(etag ? { etag } : {}), verbs: out };
|
|
58
|
+
}
|
|
59
|
+
function isSnapshot(o) {
|
|
60
|
+
const schema = o?.schema;
|
|
61
|
+
return !!o && typeof o === 'object' && (schema === exports.SNAPSHOT_SCHEMA || schema === exports.SNAPSHOT_SCHEMA_V1)
|
|
62
|
+
&& typeof o.verbs === 'object' && o.verbs !== null;
|
|
63
|
+
}
|
|
64
|
+
function diffSnapshot(prev, verbs) {
|
|
65
|
+
// Compared with the fingerprint of the snapshot's OWN schema — see the header.
|
|
66
|
+
const now = takeSnapshot(verbs, undefined, new Date(), prev.schema).verbs;
|
|
67
|
+
const added = [];
|
|
68
|
+
const changed = [];
|
|
69
|
+
let unchanged = 0;
|
|
70
|
+
for (const [name, fp] of Object.entries(now)) {
|
|
71
|
+
if (!(name in prev.verbs))
|
|
72
|
+
added.push(name);
|
|
73
|
+
else if (prev.verbs[name] !== fp)
|
|
74
|
+
changed.push(name);
|
|
75
|
+
else
|
|
76
|
+
unchanged++;
|
|
77
|
+
}
|
|
78
|
+
const removed = Object.keys(prev.verbs).filter((n) => !(n in now)).sort();
|
|
79
|
+
return {
|
|
80
|
+
since: prev.taken_at, added, removed, changed, unchanged,
|
|
81
|
+
...(prev.schema === exports.SNAPSHOT_SCHEMA_V1 ? { blind_to: ['output_schema', 'refuses_when'] } : {}),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=verb-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verb-snapshot.js","sourceRoot":"","sources":["../../src/lib/verb-snapshot.ts"],"names":[],"mappings":";;;AAqDA,kCAWC;AAED,oCAMC;AAED,gCAIC;AAYD,oCAgBC;AA1GD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mCAAoC;AAEvB,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAoB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Be There — the system that answers, books, and takes payment when you can't. CLI + SDK + MCP tools for SMBs, agencies, and AI agents. solid clone plumber → working business in 30 seconds.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -45,10 +45,12 @@
|
|
|
45
45
|
"test:tarball": "bash scripts/test-tarball.sh",
|
|
46
46
|
"verify:deps": "node scripts/verify-runtime-deps.mjs",
|
|
47
47
|
"postpublish": "node scripts/bump-installers.mjs",
|
|
48
|
-
"prepublishOnly": "npm run check:release && npm run check:changelog && npm run build && npm test && npm run test:contracts && npm run test:security && npm run audit:prod && npm run verify:deps && npm run check:counts",
|
|
48
|
+
"prepublishOnly": "npm run check:release && npm run check:changelog && npm run build && npm test && npm run test:contracts && npm run test:security && npm run audit:prod && npm run verify:deps && npm run check:counts && npm run check:blocks",
|
|
49
49
|
"postinstall": "node -e \"try{if(!process.env.CI)console.log('\\n Solid# CLI installed. Get started: solid setup\\n')}catch(e){}\"",
|
|
50
50
|
"sync:counts": "ts-node scripts/sync-counts.ts",
|
|
51
51
|
"check:counts": "ts-node scripts/sync-counts.ts --check",
|
|
52
|
+
"sync:blocks": "ts-node scripts/sync-block-schema.ts",
|
|
53
|
+
"check:blocks": "ts-node scripts/sync-block-schema.ts --check",
|
|
52
54
|
"check:release": "node scripts/check-release-drift.mjs",
|
|
53
55
|
"check:changelog": "node scripts/changelog.mjs --check",
|
|
54
56
|
"eval": "node scripts/eval-suite/run.mjs",
|