@davidorex/pi-context 0.29.0 → 0.31.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 +88 -0
- package/README.md +48 -21
- package/dist/block-api.d.ts +25 -3
- package/dist/block-api.d.ts.map +1 -1
- package/dist/block-api.js +17 -6
- package/dist/block-api.js.map +1 -1
- package/dist/content-hash.d.ts +13 -0
- package/dist/content-hash.d.ts.map +1 -1
- package/dist/content-hash.js +16 -0
- package/dist/content-hash.js.map +1 -1
- package/dist/context-dir.d.ts +12 -0
- package/dist/context-dir.d.ts.map +1 -1
- package/dist/context-dir.js +14 -0
- package/dist/context-dir.js.map +1 -1
- package/dist/context-sdk.d.ts +99 -4
- package/dist/context-sdk.d.ts.map +1 -1
- package/dist/context-sdk.js +183 -13
- package/dist/context-sdk.js.map +1 -1
- package/dist/context.d.ts +103 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +85 -0
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +534 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1879 -20
- package/dist/index.js.map +1 -1
- package/dist/migration-registry-loader.d.ts +16 -0
- package/dist/migration-registry-loader.d.ts.map +1 -1
- package/dist/migration-registry-loader.js +33 -0
- package/dist/migration-registry-loader.js.map +1 -1
- package/dist/ops-registry.d.ts +196 -4
- package/dist/ops-registry.d.ts.map +1 -1
- package/dist/ops-registry.js +795 -110
- package/dist/ops-registry.js.map +1 -1
- package/dist/pending-blocked-store.d.ts +83 -0
- package/dist/pending-blocked-store.d.ts.map +1 -0
- package/dist/pending-blocked-store.js +93 -0
- package/dist/pending-blocked-store.js.map +1 -0
- package/dist/read-element.d.ts +48 -0
- package/dist/read-element.d.ts.map +1 -1
- package/dist/read-element.js +88 -30
- package/dist/read-element.js.map +1 -1
- package/dist/schema-merge.d.ts +26 -0
- package/dist/schema-merge.d.ts.map +1 -0
- package/dist/schema-merge.js +176 -0
- package/dist/schema-merge.js.map +1 -0
- package/dist/write-schema-migration-tool.d.ts +2 -1
- package/dist/write-schema-migration-tool.d.ts.map +1 -1
- package/dist/write-schema-migration-tool.js +13 -10
- package/dist/write-schema-migration-tool.js.map +1 -1
- package/package.json +2 -1
- package/samples/conception.json +50 -0
- package/samples/schemas/framework-gaps.schema.json +1 -1
- package/samples/schemas/issues.schema.json +2 -2
- package/samples/schemas/layer-plans.schema.json +2 -2
- package/samples/schemas/research.schema.json +1 -1
- package/samples/schemas/work-orders.schema.json +2 -2
- package/schemas/config.schema.json +25 -1
- package/schemas/pending-blocked.schema.json +190 -0
- package/skill-narrative.md +7 -5
- package/skills/pi-context/SKILL.md +146 -8
- package/skills/pi-context/references/bundled-resources.md +2 -1
package/dist/read-element.js
CHANGED
|
@@ -47,6 +47,13 @@ export function discoverArrayKey(data) {
|
|
|
47
47
|
}
|
|
48
48
|
/** Stable, greppable footer prefix — keep in sync with consumers/tests. */
|
|
49
49
|
export const READ_ELEMENT_FOOTER_PREFIX = "[read-element:";
|
|
50
|
+
/** Module-private key for the render context — symbol-keyed, so JSON.stringify ignores it. */
|
|
51
|
+
const RENDER_CONTEXT = Symbol("read-element:render-context");
|
|
52
|
+
/** Attach render context to a ReadStructured under the private symbol (non-enumerable to JSON). */
|
|
53
|
+
function withRenderContext(s, ctx) {
|
|
54
|
+
s[RENDER_CONTEXT] = ctx;
|
|
55
|
+
return s;
|
|
56
|
+
}
|
|
50
57
|
export const DEFAULT_LIMIT = 50;
|
|
51
58
|
/**
|
|
52
59
|
* The ONE pagination implementation. Slices `arr` at offset(0)/limit(50) and
|
|
@@ -110,6 +117,27 @@ function resolveCollection(value, itemsKey) {
|
|
|
110
117
|
* (prefix `[read-element:`) since the next page is reachable via offset/limit.
|
|
111
118
|
*/
|
|
112
119
|
export function serializeForRead(value, opts = {}) {
|
|
120
|
+
const structured = structureForRead(value, opts);
|
|
121
|
+
return {
|
|
122
|
+
content: renderReadText(structured),
|
|
123
|
+
total: structured.total,
|
|
124
|
+
hasMore: structured.hasMore,
|
|
125
|
+
truncated: structured.truncated,
|
|
126
|
+
totalBytes: structured.totalBytes,
|
|
127
|
+
complete: structured.complete,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The cap / pagination / metadata computation that previously lived inside
|
|
132
|
+
* serializeForRead, returning the value UN-stringified (TASK-012 / FGAP-013).
|
|
133
|
+
* `data` is the page slice (collections) or the whole object — never stringified,
|
|
134
|
+
* never footered. The metadata fields mirror {@link ReadEnvelope}; the text-render
|
|
135
|
+
* inputs (label / offset / overCapDirective / paged / capped head) ride along
|
|
136
|
+
* under a private symbol so {@link renderReadText} can reproduce the exact prior
|
|
137
|
+
* `content` while JSON.stringify (the CLI `--json` envelope) emits only the six
|
|
138
|
+
* documented structured fields.
|
|
139
|
+
*/
|
|
140
|
+
export function structureForRead(value, opts = {}) {
|
|
113
141
|
const offset = opts.offset ?? 0;
|
|
114
142
|
const resolved = opts.whole ? { collection: false } : resolveCollection(value, opts.itemsKey);
|
|
115
143
|
let serialized;
|
|
@@ -131,56 +159,86 @@ export function serializeForRead(value, opts = {}) {
|
|
|
131
159
|
const jsonStr = JSON.stringify(serialized, null, 2);
|
|
132
160
|
const cap = truncateHead(jsonStr);
|
|
133
161
|
const label = opts.label ?? "result";
|
|
162
|
+
const renderCtx = {
|
|
163
|
+
label,
|
|
164
|
+
rawLabel: opts.label,
|
|
165
|
+
offset,
|
|
166
|
+
paged,
|
|
167
|
+
overCapDirective: opts.overCapDirective,
|
|
168
|
+
cappedContent: cap.content,
|
|
169
|
+
};
|
|
170
|
+
// Over-cap fail-closed (FGAP-089) → complete:false; under-cap → complete:true.
|
|
171
|
+
// The over-cap REFUSAL/PARTIAL *text* rendering is a renderReadText concern,
|
|
172
|
+
// but the structured `data` must ALSO fail closed: on over-cap (cap.truncated)
|
|
173
|
+
// `data` is bounded to null so the `--json` surface (which emits `data` directly
|
|
174
|
+
// via JSON.stringify, never routing through cappedContent) cannot leak the full
|
|
175
|
+
// un-truncated value past the cap, and a constrained agent never receives a
|
|
176
|
+
// truncated value dressed as complete. Under-cap (incl. paged-but-not-over-cap)
|
|
177
|
+
// keeps the full/page value unchanged. Metadata (truncated/totalBytes/total/
|
|
178
|
+
// hasMore/complete) is unaffected.
|
|
179
|
+
const complete = !cap.truncated;
|
|
180
|
+
return withRenderContext({
|
|
181
|
+
data: cap.truncated ? null : serialized,
|
|
182
|
+
total,
|
|
183
|
+
hasMore,
|
|
184
|
+
truncated: cap.truncated,
|
|
185
|
+
totalBytes: cap.totalBytes,
|
|
186
|
+
complete,
|
|
187
|
+
}, renderCtx);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Render a {@link ReadStructured} to the EXACT text serializeForRead's `content`
|
|
191
|
+
* produced before the TASK-012 split: the stringified body + the structured
|
|
192
|
+
* `[read-element:` paging footer, OR — on the over-cap fail-closed paths
|
|
193
|
+
* (FGAP-089) — the directive-only REFUSAL (no body) when a narrowing tool was
|
|
194
|
+
* named, else the head-leading marked PARTIAL. Reads its render inputs from the
|
|
195
|
+
* private symbol attached by {@link structureForRead}.
|
|
196
|
+
*/
|
|
197
|
+
export function renderReadText(s) {
|
|
198
|
+
const ctx = s[RENDER_CONTEXT];
|
|
199
|
+
// Defensive: a ReadStructured constructed without structureForRead has no
|
|
200
|
+
// render context — fall back to a plain stringify of the data.
|
|
201
|
+
if (ctx === undefined)
|
|
202
|
+
return JSON.stringify(s.data, null, 2);
|
|
203
|
+
const { label, offset, paged, overCapDirective, cappedContent } = ctx;
|
|
134
204
|
// ── FGAP-089 over-CAP fail-closed path ──────────────────────────────────
|
|
135
205
|
// When the serialized value exceeds the read cap, a partial body must NOT be
|
|
136
206
|
// returned as if it were the whole value — a constrained agent skimmed past
|
|
137
207
|
// the old trailing `[read-element: truncated …]` footer and treated a
|
|
138
|
-
// truncated catalog as complete (degraded info). So an over-cap read
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
if (
|
|
143
|
-
if (
|
|
208
|
+
// truncated catalog as complete (degraded info). So an over-cap read fails
|
|
209
|
+
// closed: either a directive-only REFUSAL (when a narrowing tool exists) or
|
|
210
|
+
// an UNMISSABLE HEAD-LEADING marked partial (edge surfaces with no finer
|
|
211
|
+
// addressing). Either way the structured `complete` is false.
|
|
212
|
+
if (s.truncated) {
|
|
213
|
+
if (overCapDirective !== undefined) {
|
|
144
214
|
// Narrowing available → DIRECTIVE ONLY, no serialized body at all.
|
|
145
|
-
const { tool, params, hint } =
|
|
215
|
+
const { tool, params, hint } = overCapDirective;
|
|
146
216
|
const paramsString = params && Object.keys(params).length > 0
|
|
147
217
|
? Object.entries(params)
|
|
148
218
|
.map(([k, v]) => `${k}=${v}`)
|
|
149
219
|
.join(" ")
|
|
150
220
|
: undefined;
|
|
151
|
-
|
|
221
|
+
return (`⚠️ READ REFUSED — this ${label} is ${s.totalBytes} bytes, over the 50KB read cap. ` +
|
|
152
222
|
`Nothing was returned (a partial read would mislead). ` +
|
|
153
|
-
`Narrow your read: call \`${tool}\`${paramsString ? ` with ${paramsString}` : ""}.${hint ? ` ${hint}` : ""}
|
|
154
|
-
return { content, total, hasMore, truncated: true, totalBytes: cap.totalBytes, complete: false };
|
|
223
|
+
`Narrow your read: call \`${tool}\`${paramsString ? ` with ${paramsString}` : ""}.${hint ? ` ${hint}` : ""}`);
|
|
155
224
|
}
|
|
156
|
-
// No finer addressing (edge case) → UNMISSABLE HEAD-LEADING marked
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// see structure, but is explicitly told it is INCOMPLETE.
|
|
160
|
-
const content = `⚠️ PARTIAL READ — this ${label} is ${cap.totalBytes} bytes, capped at 50KB, and has no finer addressing. ` +
|
|
161
|
-
`The HEAD below is INCOMPLETE — do NOT treat it as the full value:\n\n${cap.content}`;
|
|
162
|
-
return { content, total, hasMore, truncated: true, totalBytes: cap.totalBytes, complete: false };
|
|
225
|
+
// No finer addressing (edge case) → UNMISSABLE HEAD-LEADING marked partial.
|
|
226
|
+
return (`⚠️ PARTIAL READ — this ${label} is ${s.totalBytes} bytes, capped at 50KB, and has no finer addressing. ` +
|
|
227
|
+
`The HEAD below is INCOMPLETE — do NOT treat it as the full value:\n\n${cappedContent}`);
|
|
163
228
|
}
|
|
164
229
|
// ── Not over-cap: full content (a paged-but-not-truncated page is complete;
|
|
165
230
|
// `hasMore` signals further pages). Paging footer stays — paging is reachable
|
|
166
231
|
// via offset/limit, so it does not fail closed.
|
|
167
232
|
const footers = [];
|
|
168
|
-
if (paged && total !== undefined) {
|
|
233
|
+
if (paged && s.total !== undefined) {
|
|
169
234
|
// shown range is 1-based inclusive over the served slice
|
|
170
|
-
const shownCount = Array.isArray(
|
|
171
|
-
const from = total === 0 ? 0 : offset + 1;
|
|
235
|
+
const shownCount = Array.isArray(s.data) ? s.data.length : 0;
|
|
236
|
+
const from = s.total === 0 ? 0 : offset + 1;
|
|
172
237
|
const to = offset + shownCount;
|
|
173
|
-
const labelSuffix =
|
|
174
|
-
footers.push(`\n\n${READ_ELEMENT_FOOTER_PREFIX} showing ${from}-${to} of ${total} · hasMore=${hasMore}${labelSuffix} · narrow with an address]`);
|
|
238
|
+
const labelSuffix = ctx.rawLabel ? ` · ${ctx.rawLabel}` : "";
|
|
239
|
+
footers.push(`\n\n${READ_ELEMENT_FOOTER_PREFIX} showing ${from}-${to} of ${s.total} · hasMore=${s.hasMore}${labelSuffix} · narrow with an address]`);
|
|
175
240
|
}
|
|
176
|
-
return
|
|
177
|
-
content: cap.content + footers.join(""),
|
|
178
|
-
total,
|
|
179
|
-
hasMore,
|
|
180
|
-
truncated: false,
|
|
181
|
-
totalBytes: cap.totalBytes,
|
|
182
|
-
complete: true,
|
|
183
|
-
};
|
|
241
|
+
return cappedContent + footers.join("");
|
|
184
242
|
}
|
|
185
243
|
function asArrayOrSingleArray(value) {
|
|
186
244
|
if (Array.isArray(value))
|
package/dist/read-element.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-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C;gBACD,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC,IAAI,eAAe,EAAE,GAAG,EAAE,CAAC;YAC5F,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;IACtE,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** An irreconcilable 3-way disagreement at a single dotted schema path. */
|
|
2
|
+
export interface SchemaConflict {
|
|
3
|
+
/** Dotted path from the schema root (e.g. `properties.status.type`). */
|
|
4
|
+
path: string;
|
|
5
|
+
/** The value at this path in the recorded merge base. */
|
|
6
|
+
base: unknown;
|
|
7
|
+
/** The value at this path in the currently-installed (locally-edited) body. */
|
|
8
|
+
ours: unknown;
|
|
9
|
+
/** The value at this path in the catalog's current body. */
|
|
10
|
+
theirs: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Deterministic 3-way merge of three draft-07 schema bodies.
|
|
14
|
+
*
|
|
15
|
+
* @param base the recorded merge baseline body
|
|
16
|
+
* @param ours the currently-installed (locally-edited) body
|
|
17
|
+
* @param theirs the catalog's current body
|
|
18
|
+
* @returns `{ merged, conflicts }` — `merged` is the merged object (conflicting
|
|
19
|
+
* nodes left as OURS); `conflicts` is the per-path disagreement set. The
|
|
20
|
+
* caller writes `merged` only when `conflicts` is empty.
|
|
21
|
+
*/
|
|
22
|
+
export declare function mergeSchema(base: Record<string, unknown>, ours: Record<string, unknown>, theirs: Record<string, unknown>): {
|
|
23
|
+
merged: Record<string, unknown>;
|
|
24
|
+
conflicts: SchemaConflict[];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=schema-merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-merge.d.ts","sourceRoot":"","sources":["../src/schema-merge.ts"],"names":[],"mappings":"AAiBA,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC9B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,OAAO,CAAC;IACd,+EAA+E;IAC/E,IAAI,EAAE,OAAO,CAAC;IACd,4DAA4D;IAC5D,MAAM,EAAE,OAAO,CAAC;CAChB;AAkJD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,SAAS,EAAE,cAAc,EAAE,CAAA;CAAE,CAUlE"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic key/path-level draft-07 3-way schema merge (FEAT-006 T3 —
|
|
3
|
+
* TASK-036). Pure, no I/O: given the recorded merge BASE (the installed-from
|
|
4
|
+
* baseline schema body), OURS (the currently-installed, locally-edited body),
|
|
5
|
+
* and THEIRS (the catalog's current body), produce a merged body plus the set of
|
|
6
|
+
* irreconcilable per-path conflicts.
|
|
7
|
+
*
|
|
8
|
+
* Value equality throughout is canonical-JSON equality (`canonicalJson(a) ===
|
|
9
|
+
* canonicalJson(b)`) so structurally-equal-but-key-reordered values compare
|
|
10
|
+
* equal and the merge is order-insensitive + deterministic.
|
|
11
|
+
*
|
|
12
|
+
* The caller (`updateContext`) writes the merged body ONLY when the returned
|
|
13
|
+
* conflict set is empty; a non-empty conflict set means the merged body is left
|
|
14
|
+
* as OURS at the conflicting node(s) and the caller refrains from writing.
|
|
15
|
+
*/
|
|
16
|
+
import { canonicalJson } from "./content-hash.js";
|
|
17
|
+
/**
|
|
18
|
+
* Module-private absent-key sentinel. A unique object (referential identity) so
|
|
19
|
+
* no representable JSON value can collide with "this key is absent on this
|
|
20
|
+
* side"; distinct from `null`/`undefined`, both of which are legitimate present
|
|
21
|
+
* values in a JSON document.
|
|
22
|
+
*/
|
|
23
|
+
const MISSING = Symbol("schema-merge:MISSING");
|
|
24
|
+
function isMissing(v) {
|
|
25
|
+
return v === MISSING;
|
|
26
|
+
}
|
|
27
|
+
/** A plain JSON object: not MISSING, not null, not an array. */
|
|
28
|
+
function isPlainObject(v) {
|
|
29
|
+
return !isMissing(v) && typeof v === "object" && v !== null && !Array.isArray(v);
|
|
30
|
+
}
|
|
31
|
+
/** Present-and-an-array. */
|
|
32
|
+
function isArrayValue(v) {
|
|
33
|
+
return !isMissing(v) && Array.isArray(v);
|
|
34
|
+
}
|
|
35
|
+
/** Canonical-JSON value equality (both sides must be present). */
|
|
36
|
+
function valuesEqual(a, b) {
|
|
37
|
+
return canonicalJson(a) === canonicalJson(b);
|
|
38
|
+
}
|
|
39
|
+
/** `obj[key]` if the key is an own property, else MISSING. */
|
|
40
|
+
function get(obj, key) {
|
|
41
|
+
return Object.hasOwn(obj, key) ? obj[key] : MISSING;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether the node at `path` (with the present sides all arrays) is a SET-ARRAY:
|
|
45
|
+
* an array whose order/duplication is not semantically meaningful, mergeable as
|
|
46
|
+
* a set. Applies when the LAST path segment is `required` or `enum`, OR when the
|
|
47
|
+
* path's last segment is `type` (a `type` whose value is an array is a JSON
|
|
48
|
+
* Schema type-union list — set-semantic).
|
|
49
|
+
*/
|
|
50
|
+
function isSetArrayPath(path) {
|
|
51
|
+
const last = path.includes(".") ? path.slice(path.lastIndexOf(".") + 1) : path;
|
|
52
|
+
return last === "required" || last === "enum" || last === "type";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 3-way set merge honoring adds AND removes, conflict-free:
|
|
56
|
+
* result = (ours ∩ theirs) ∪ (ours \ base) ∪ (theirs \ base)
|
|
57
|
+
* Element identity is canonical-JSON. The result is returned as an array sorted
|
|
58
|
+
* by each element's canonical JSON for determinism. A MISSING base is treated as
|
|
59
|
+
* the empty set.
|
|
60
|
+
*/
|
|
61
|
+
function mergeSetArray(base, ours, theirs) {
|
|
62
|
+
const baseArr = isArrayValue(base) ? base : [];
|
|
63
|
+
const baseKeys = new Set(baseArr.map((e) => canonicalJson(e)));
|
|
64
|
+
const oursByKey = new Map();
|
|
65
|
+
for (const e of ours)
|
|
66
|
+
oursByKey.set(canonicalJson(e), e);
|
|
67
|
+
const theirsByKey = new Map();
|
|
68
|
+
for (const e of theirs)
|
|
69
|
+
theirsByKey.set(canonicalJson(e), e);
|
|
70
|
+
const resultByKey = new Map();
|
|
71
|
+
// (ours ∩ theirs): survivors present on both edited sides.
|
|
72
|
+
for (const [k, e] of oursByKey) {
|
|
73
|
+
if (theirsByKey.has(k))
|
|
74
|
+
resultByKey.set(k, e);
|
|
75
|
+
}
|
|
76
|
+
// (ours \ base): additions ours made.
|
|
77
|
+
for (const [k, e] of oursByKey) {
|
|
78
|
+
if (!baseKeys.has(k))
|
|
79
|
+
resultByKey.set(k, e);
|
|
80
|
+
}
|
|
81
|
+
// (theirs \ base): additions theirs made.
|
|
82
|
+
for (const [k, e] of theirsByKey) {
|
|
83
|
+
if (!baseKeys.has(k))
|
|
84
|
+
resultByKey.set(k, e);
|
|
85
|
+
}
|
|
86
|
+
const keys = [...resultByKey.keys()].sort();
|
|
87
|
+
return keys.map((k) => resultByKey.get(k));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Recursive 3-way merge of one node. Pushes any irreconcilable disagreement onto
|
|
91
|
+
* the shared `conflicts` array (tagged with `path`) and returns the merged value
|
|
92
|
+
* (which may be the MISSING sentinel to signal a key deletion to the parent
|
|
93
|
+
* object-merge).
|
|
94
|
+
*/
|
|
95
|
+
function merge3(base, ours, theirs, path, conflicts) {
|
|
96
|
+
const basePresent = !isMissing(base);
|
|
97
|
+
const oursPresent = !isMissing(ours);
|
|
98
|
+
const theirsPresent = !isMissing(theirs);
|
|
99
|
+
// --- Add / remove handling (at least one side MISSING) ---------------------
|
|
100
|
+
if (!(basePresent && oursPresent && theirsPresent)) {
|
|
101
|
+
const presentCount = (basePresent ? 1 : 0) + (oursPresent ? 1 : 0) + (theirsPresent ? 1 : 0);
|
|
102
|
+
if (presentCount === 0)
|
|
103
|
+
return MISSING; // (cannot occur from a present parent)
|
|
104
|
+
if (presentCount === 1) {
|
|
105
|
+
// Present on exactly one side → take that side's value.
|
|
106
|
+
return oursPresent ? ours : theirsPresent ? theirs : base;
|
|
107
|
+
}
|
|
108
|
+
// presentCount === 2: exactly one side is MISSING.
|
|
109
|
+
if (!basePresent) {
|
|
110
|
+
// Both ours + theirs added this key (base absent). Equal adds converge;
|
|
111
|
+
// differing adds conflict.
|
|
112
|
+
if (valuesEqual(ours, theirs))
|
|
113
|
+
return ours;
|
|
114
|
+
conflicts.push({ path, base: undefined, ours, theirs });
|
|
115
|
+
return ours;
|
|
116
|
+
}
|
|
117
|
+
// One of ours/theirs removed the key; the OTHER (non-base) side is present.
|
|
118
|
+
const otherPresent = oursPresent ? ours : theirs;
|
|
119
|
+
if (valuesEqual(base, otherPresent)) {
|
|
120
|
+
// The surviving side left the value unchanged vs base ⇒ honor the removal.
|
|
121
|
+
return MISSING;
|
|
122
|
+
}
|
|
123
|
+
// Delete-vs-modify: one side removed it while the other changed it → conflict.
|
|
124
|
+
conflicts.push({ path, base, ours, theirs });
|
|
125
|
+
return ours;
|
|
126
|
+
}
|
|
127
|
+
// --- All three present -----------------------------------------------------
|
|
128
|
+
// Plain-object node: recurse per key over the sorted union.
|
|
129
|
+
if (isPlainObject(base) && isPlainObject(ours) && isPlainObject(theirs)) {
|
|
130
|
+
const keys = [...new Set([...Object.keys(base), ...Object.keys(ours), ...Object.keys(theirs)])].sort();
|
|
131
|
+
const out = {};
|
|
132
|
+
for (const k of keys) {
|
|
133
|
+
const childPath = path ? `${path}.${k}` : k;
|
|
134
|
+
const merged = merge3(get(base, k), get(ours, k), get(theirs, k), childPath, conflicts);
|
|
135
|
+
if (!isMissing(merged))
|
|
136
|
+
out[k] = merged; // omit deleted keys
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
// SET-ARRAY node: required / enum / type-union list, all-three-arrays.
|
|
141
|
+
if (isSetArrayPath(path) && isArrayValue(base) && isArrayValue(ours) && isArrayValue(theirs)) {
|
|
142
|
+
return mergeSetArray(base, ours, theirs);
|
|
143
|
+
}
|
|
144
|
+
// --- Atomic 3-way (scalars; non-set arrays like allOf/anyOf/oneOf/
|
|
145
|
+
// x-lifecycle.transitions; object-vs-scalar kind mismatch) -----------------
|
|
146
|
+
if (valuesEqual(base, ours))
|
|
147
|
+
return theirs; // ours unchanged → take theirs
|
|
148
|
+
if (valuesEqual(base, theirs))
|
|
149
|
+
return ours; // theirs unchanged → take ours
|
|
150
|
+
if (valuesEqual(ours, theirs))
|
|
151
|
+
return ours; // both changed the same way → converged
|
|
152
|
+
conflicts.push({ path, base, ours, theirs });
|
|
153
|
+
return ours; // leave the conflicting node as ours
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Deterministic 3-way merge of three draft-07 schema bodies.
|
|
157
|
+
*
|
|
158
|
+
* @param base the recorded merge baseline body
|
|
159
|
+
* @param ours the currently-installed (locally-edited) body
|
|
160
|
+
* @param theirs the catalog's current body
|
|
161
|
+
* @returns `{ merged, conflicts }` — `merged` is the merged object (conflicting
|
|
162
|
+
* nodes left as OURS); `conflicts` is the per-path disagreement set. The
|
|
163
|
+
* caller writes `merged` only when `conflicts` is empty.
|
|
164
|
+
*/
|
|
165
|
+
export function mergeSchema(base, ours, theirs) {
|
|
166
|
+
const conflicts = [];
|
|
167
|
+
const merged = merge3(base, ours, theirs, "", conflicts);
|
|
168
|
+
// The top-level call is over three objects, so merge3 returns an object
|
|
169
|
+
// (never MISSING — the three roots are present plain objects in every
|
|
170
|
+
// caller path; a defensive empty-object fallback keeps the return typed).
|
|
171
|
+
return {
|
|
172
|
+
merged: isPlainObject(merged) ? merged : {},
|
|
173
|
+
conflicts,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=schema-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-merge.js","sourceRoot":"","sources":["../src/schema-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAclD;;;;;GAKG;AACH,MAAM,OAAO,GAAkB,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAG9D,SAAS,SAAS,CAAC,CAAO;IACzB,OAAO,CAAC,KAAK,OAAO,CAAC;AACtB,CAAC;AAED,gEAAgE;AAChE,SAAS,aAAa,CAAC,CAAO;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,4BAA4B;AAC5B,SAAS,YAAY,CAAC,CAAO;IAC5B,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,kEAAkE;AAClE,SAAS,WAAW,CAAC,CAAU,EAAE,CAAU;IAC1C,OAAO,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC;A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M,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,+BAA+B;IAC3E,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,wCAAwC;IACpF,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,CAAC,qCAAqC;AACnD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAC1B,IAA6B,EAC7B,IAA6B,EAC7B,MAA+B;IAE/B,MAAM,SAAS,GAAqB,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;IACzD,wEAAwE;IACxE,sEAAsE;IACtE,0EAA0E;IAC1E,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAkC,CAAC,CAAC,CAAC,EAAE;QACxE,SAAS;KACT,CAAC;AACH,CAAC"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* (no canonical-id citations) per the operator-facing string convention.
|
|
20
20
|
*/
|
|
21
21
|
import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
22
|
+
import { type DispatchContext } from "./dispatch-context.js";
|
|
22
23
|
export interface WriteSchemaMigrationParams {
|
|
23
24
|
operation: string;
|
|
24
25
|
schemaName: string;
|
|
@@ -42,5 +43,5 @@ export interface WriteSchemaMigrationParams {
|
|
|
42
43
|
* Returns an AgentToolResult naming the verb + persisted migrations.json
|
|
43
44
|
* path so the caller's content array surfaces the on-disk effect.
|
|
44
45
|
*/
|
|
45
|
-
export declare function writeSchemaMigrationExecute(cwd: string, params: WriteSchemaMigrationParams): Promise<AgentToolResult<undefined>>;
|
|
46
|
+
export declare function writeSchemaMigrationExecute(cwd: string, params: WriteSchemaMigrationParams, ctx?: DispatchContext): Promise<AgentToolResult<undefined>>;
|
|
46
47
|
//# sourceMappingURL=write-schema-migration-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-schema-migration-tool.d.ts","sourceRoot":"","sources":["../src/write-schema-migration-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"write-schema-migration-tool.d.ts","sourceRoot":"","sources":["../src/write-schema-migration-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,KAAK,eAAe,EAAkB,MAAM,uBAAuB,CAAC;AAQ7E,MAAM,WAAW,0BAA0B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAChD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,0BAA0B,EAClC,GAAG,CAAC,EAAE,eAAe,GACnB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAiGrC"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* (no canonical-id citations) per the operator-facing string convention.
|
|
20
20
|
*/
|
|
21
21
|
import { migrationsPath } from "./context-dir.js";
|
|
22
|
+
import { writerToString } from "./dispatch-context.js";
|
|
22
23
|
import { appendMigrationDecl, removeMigrationDecl, replaceMigrationDecl, } from "./migrations-store.js";
|
|
23
24
|
/**
|
|
24
25
|
* Execute body for the write-schema-migration tool. Dispatches the three
|
|
@@ -31,7 +32,7 @@ import { appendMigrationDecl, removeMigrationDecl, replaceMigrationDecl, } from
|
|
|
31
32
|
* Returns an AgentToolResult naming the verb + persisted migrations.json
|
|
32
33
|
* path so the caller's content array surfaces the on-disk effect.
|
|
33
34
|
*/
|
|
34
|
-
export async function writeSchemaMigrationExecute(cwd, params) {
|
|
35
|
+
export async function writeSchemaMigrationExecute(cwd, params, ctx) {
|
|
35
36
|
const op = params.operation;
|
|
36
37
|
if (op !== "create" && op !== "replace" && op !== "remove") {
|
|
37
38
|
throw new Error(`write-schema-migration: unknown operation '${op}' — expected create | replace | remove`);
|
|
@@ -41,13 +42,16 @@ export async function writeSchemaMigrationExecute(cwd, params) {
|
|
|
41
42
|
// has prompted the operator and — on confirm=true with a verifiable
|
|
42
43
|
// identity — stamped event.input.writer with the verified terminal-
|
|
43
44
|
// operator identity. The body trusts the writer field as-is.
|
|
44
|
-
if (!
|
|
45
|
-
throw new Error("write-schema-migration: writer
|
|
45
|
+
if (!ctx?.writer) {
|
|
46
|
+
throw new Error("write-schema-migration: a DispatchContext writer is required.");
|
|
46
47
|
}
|
|
48
|
+
// The recorded author marker derives from the contract DispatchContext: a
|
|
49
|
+
// human writer keeps its bare user (preserving the prior `params.writer.user`
|
|
50
|
+
// shape committed to migrations.json), other kinds fall back to the canonical
|
|
51
|
+
// `<kind>/<id>` string.
|
|
52
|
+
const migrationAuthor = ctx.writer.kind === "human" ? ctx.writer.user : writerToString(ctx.writer);
|
|
47
53
|
if (op === "remove") {
|
|
48
|
-
removeMigrationDecl(cwd, params.schemaName, params.fromVersion,
|
|
49
|
-
writer: { kind: "human", user: params.writer.user },
|
|
50
|
-
});
|
|
54
|
+
removeMigrationDecl(cwd, params.schemaName, params.fromVersion, ctx);
|
|
51
55
|
return {
|
|
52
56
|
details: undefined,
|
|
53
57
|
content: [
|
|
@@ -91,15 +95,14 @@ export async function writeSchemaMigrationExecute(cwd, params) {
|
|
|
91
95
|
toVersion: params.toVersion,
|
|
92
96
|
kind,
|
|
93
97
|
...(kind === "declarative-transform" ? { transform: transformBody } : {}),
|
|
94
|
-
created_by:
|
|
98
|
+
created_by: migrationAuthor,
|
|
95
99
|
created_at: new Date().toISOString(),
|
|
96
100
|
};
|
|
97
|
-
const dispatchCtx = { writer: { kind: "human", user: params.writer.user } };
|
|
98
101
|
if (op === "create") {
|
|
99
|
-
appendMigrationDecl(cwd, decl,
|
|
102
|
+
appendMigrationDecl(cwd, decl, ctx);
|
|
100
103
|
}
|
|
101
104
|
else {
|
|
102
|
-
replaceMigrationDecl(cwd, decl,
|
|
105
|
+
replaceMigrationDecl(cwd, decl, ctx);
|
|
103
106
|
}
|
|
104
107
|
const verb = op === "create" ? "created" : "replaced";
|
|
105
108
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-schema-migration-tool.js","sourceRoot":"","sources":["../src/write-schema-migration-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,mBAAmB,EAEnB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAY/B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,GAAW,EACX,MAAkC;
|
|
1
|
+
{"version":3,"file":"write-schema-migration-tool.js","sourceRoot":"","sources":["../src/write-schema-migration-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EACN,mBAAmB,EAEnB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAY/B;;;;;;;;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AC,WAAW,EAAE;KACpC,CAAC;IAEF,IAAI,EAAE,KAAK,QAAQ,EAAE,CAAC;QACrB,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACP,oBAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;IACtD,OAAO;QACN,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,2BAA2B,IAAI,IAAI,IAAI,0BAA0B,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,OAAO,cAAc,CAAC,GAAG,CAAC,EAAE;aAC/J;SACD;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@davidorex/pi-context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"exports": {
|
|
23
|
+
"./package.json": "./package.json",
|
|
23
24
|
".": {
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
26
|
"default": "./dist/index.js"
|
package/samples/conception.json
CHANGED
|
@@ -327,6 +327,20 @@
|
|
|
327
327
|
"source_kinds": ["tasks"],
|
|
328
328
|
"target_kinds": ["decisions"]
|
|
329
329
|
},
|
|
330
|
+
{
|
|
331
|
+
"canonical_id": "item_governed_by_convention",
|
|
332
|
+
"display_name": "governed by convention",
|
|
333
|
+
"category": "data_flow",
|
|
334
|
+
"source_kinds": ["decisions", "features", "tasks"],
|
|
335
|
+
"target_kinds": ["conventions"]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"canonical_id": "item_acknowledges_missing_convention",
|
|
339
|
+
"display_name": "acknowledges missing convention",
|
|
340
|
+
"category": "data_flow",
|
|
341
|
+
"source_kinds": ["decisions", "features", "tasks"],
|
|
342
|
+
"target_kinds": ["framework-gaps"]
|
|
343
|
+
},
|
|
330
344
|
{
|
|
331
345
|
"canonical_id": "item_derived_from_item",
|
|
332
346
|
"display_name": "derived from",
|
|
@@ -479,6 +493,42 @@
|
|
|
479
493
|
"forbid_target_bucket": "unknown",
|
|
480
494
|
"severity": "warning",
|
|
481
495
|
"message": "Task '{id}' is governed by a superseded or cancelled decision"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"id": "decision-articulates-convention",
|
|
499
|
+
"class": "requires-edge",
|
|
500
|
+
"block": "decisions",
|
|
501
|
+
"relation_types": [
|
|
502
|
+
"item_governed_by_convention",
|
|
503
|
+
"item_acknowledges_missing_convention"
|
|
504
|
+
],
|
|
505
|
+
"direction": "as_parent",
|
|
506
|
+
"severity": "warning",
|
|
507
|
+
"message": "Decision '{id}' articulates no governing convention — add an item_governed_by_convention edge to a convention, or an item_acknowledges_missing_convention edge to a missing-convention gap"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"id": "feature-articulates-convention",
|
|
511
|
+
"class": "requires-edge",
|
|
512
|
+
"block": "features",
|
|
513
|
+
"relation_types": [
|
|
514
|
+
"item_governed_by_convention",
|
|
515
|
+
"item_acknowledges_missing_convention"
|
|
516
|
+
],
|
|
517
|
+
"direction": "as_parent",
|
|
518
|
+
"severity": "warning",
|
|
519
|
+
"message": "Feature '{id}' articulates no governing convention — add an item_governed_by_convention edge to a convention, or an item_acknowledges_missing_convention edge to a missing-convention gap"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"id": "task-articulates-convention",
|
|
523
|
+
"class": "requires-edge",
|
|
524
|
+
"block": "tasks",
|
|
525
|
+
"relation_types": [
|
|
526
|
+
"item_governed_by_convention",
|
|
527
|
+
"item_acknowledges_missing_convention"
|
|
528
|
+
],
|
|
529
|
+
"direction": "as_parent",
|
|
530
|
+
"severity": "warning",
|
|
531
|
+
"message": "Task '{id}' articulates no governing convention — add an item_governed_by_convention edge to a convention, or an item_acknowledges_missing_convention edge to a missing-convention gap"
|
|
482
532
|
}
|
|
483
533
|
],
|
|
484
534
|
"tool_operations": [],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$id": "pi-context://schemas/framework-gaps",
|
|
4
4
|
"version": "1.1.1",
|
|
5
5
|
"title": "Framework Gaps",
|
|
6
|
-
"description": "Capability gaps in the
|
|
6
|
+
"description": "Capability gaps in the framework — pieces that must exist natively for the target artifact-ownership model to be expressible as configuration rather than hand-enactment. Each gap carries evidence (file + line references), impact, canonical engineering vocabulary for the missing capability, proposed resolution, and lifecycle state. Framework gaps are distinct from feature-level defects: they describe what the framework cannot yet express at all, not bugs in expressible functionality.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"required": [
|
|
9
9
|
"gaps"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"location": {
|
|
45
45
|
"type": "string",
|
|
46
|
-
"description": "File path + line number, e.g.
|
|
46
|
+
"description": "File path + line number, e.g. src/module/file.ts:NNN"
|
|
47
47
|
},
|
|
48
48
|
"status": {
|
|
49
49
|
"type": "string",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"package": {
|
|
76
76
|
"type": "string",
|
|
77
|
-
"description": "Which
|
|
77
|
+
"description": "Which package/module this issue touches (e.g. package-a, package-b)"
|
|
78
78
|
},
|
|
79
79
|
"source": {
|
|
80
80
|
"type": "string",
|