@cortexkit/pi-magic-context 0.48.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/embedding-backfill-scywarbn.js +20 -0
  3. package/dist/embedding-worker-process.js +29 -0
  4. package/dist/embedding-worker.js +6 -6
  5. package/dist/historian-calibration-extension.js +30 -5
  6. package/dist/index-0j0zqb4t.js +712 -0
  7. package/dist/{index-pvm4pd5d.js → index-0rasmwm8.js} +811 -76
  8. package/dist/{index-fp37he9a.js → index-0vrkp1jq.js} +1 -1
  9. package/dist/{index-419bndtm.js → index-21v1kfs7.js} +2 -2
  10. package/dist/{index-fm3ksh5e.js → index-27jh224p.js} +4 -4
  11. package/dist/{index-98z1c1r0.js → index-28vnkyy7.js} +1231 -3018
  12. package/dist/{index-wrm4nbj7.js → index-290tzwp1.js} +1 -1
  13. package/dist/{index-603mt6nm.js → index-4gfq5t09.js} +17 -2
  14. package/dist/{index-vf38qhee.js → index-81nthk8j.js} +44 -1
  15. package/dist/{index-5jp1h0bz.js → index-b2anqqad.js} +467 -14
  16. package/dist/{index-6pgq5ns2.js → index-cyrnv16r.js} +314 -1072
  17. package/dist/index-fqb1bddn.js +4947 -0
  18. package/dist/{index-dkx0b1kt.js → index-g7hndmqm.js} +20 -29
  19. package/dist/index-gc2749rx.js +1168 -0
  20. package/dist/{index-5hd7h4rr.js → index-kjd1fj55.js} +39 -31
  21. package/dist/{index-8y5knskr.js → index-mcgehvgw.js} +93 -9
  22. package/dist/{index-r7xg4hvw.js → index-p5zesr4e.js} +26 -722
  23. package/dist/{index-9xb0axhc.js → index-r56xgha8.js} +1 -1
  24. package/dist/{index-544c0e0x.js → index-r874cgmv.js} +42 -40
  25. package/dist/{index-72bdc1bd.js → index-rd53pk0h.js} +4 -4
  26. package/dist/{index-0am8a7k1.js → index-rdtgp48t.js} +8 -6
  27. package/dist/{index-rt5jgzp1.js → index-vakawmbc.js} +160 -25
  28. package/dist/{index-f956htf3.js → index-x3dcnxh0.js} +6 -2
  29. package/dist/{index-zrr5t5a7.js → index-zh1jw8qp.js} +106 -1
  30. package/dist/index.js +2271 -1769
  31. package/dist/{logger-v3dsxdnm.js → logger-j6tecd1h.js} +1 -1
  32. package/dist/{message-index-bounded-t7vvty76.js → message-index-bounded-110sb4fm.js} +13 -12
  33. package/dist/{message-time-backfill-4ndf7hrq.js → message-time-backfill-05ppypkz.js} +2 -2
  34. package/dist/migration-worker.js +10 -9
  35. package/dist/{project-embedding-registry-jy2hmq28.js → project-embedding-registry-64t0mw8y.js} +10 -10
  36. package/dist/raw-ordinal-warmup-worker.js +4 -4
  37. package/dist/{read-session-chunk-47pjn7fz.js → read-session-chunk-rvmc25n5.js} +10 -7
  38. package/dist/{read-session-raw-yn8nawav.js → read-session-raw-npx3920c.js} +5 -3
  39. package/dist/{safe-notification-target-3c1ns931.js → safe-notification-target-vn9kpmv4.js} +2 -2
  40. package/dist/{search-42szfhwp.js → search-7z3w8pmz.js} +19 -18
  41. package/dist/{storage-tags-jym5z6yk.js → storage-tags-kjnsqbdb.js} +6 -6
  42. package/dist/subagent-entry.js +25 -23
  43. package/package.json +3 -3
  44. package/dist/embedding-backfill-bnnytehy.js +0 -20
  45. package/dist/index-bgmv2kaf.js +0 -290
  46. package/dist/index-hrf13mn3.js +0 -2388
  47. /package/dist/{index-5prbx026.js → index-2pp04pmg.js} +0 -0
@@ -1,290 +0,0 @@
1
- // ../plugin/src/shared/harness-provider-map.ts
2
- var CANONICAL_TO_PI_PROVIDER = {
3
- openai: "openai-codex",
4
- google: "google-antigravity"
5
- };
6
- var PI_TO_CANONICAL_PROVIDER = {
7
- "openai-codex": "openai",
8
- "google-antigravity": "google"
9
- };
10
- var CANONICAL_TO_OMP_PROVIDER = {
11
- openai: "openai-codex",
12
- google: "google-antigravity",
13
- opencode: "opencode-zen"
14
- };
15
- var OMP_TO_CANONICAL_PROVIDER = {
16
- "openai-codex": "openai",
17
- "google-antigravity": "google",
18
- "opencode-zen": "opencode"
19
- };
20
- var CANONICAL_MODEL_IDENTITY_ALIASES = {
21
- "github-copilot/gpt-6-astra": "openai/gpt-6-astra"
22
- };
23
- function remapProviderPrefix(ref, map) {
24
- if (typeof ref !== "string")
25
- return ref;
26
- const slash = ref.indexOf("/");
27
- if (slash <= 0)
28
- return ref;
29
- const provider = ref.slice(0, slash);
30
- if (!Object.hasOwn(map, provider))
31
- return ref;
32
- return `${map[provider]}${ref.slice(slash)}`;
33
- }
34
- function canonicalModelIdentity(ref) {
35
- const harnessCanonical = piModelRefToCanonical(ompModelRefToCanonical(ref));
36
- return CANONICAL_MODEL_IDENTITY_ALIASES[harnessCanonical.toLowerCase()] ?? harnessCanonical;
37
- }
38
- function piModelRefToCanonical(ref) {
39
- return remapProviderPrefix(ref, PI_TO_CANONICAL_PROVIDER);
40
- }
41
- function resolveModelRefForPi(ref) {
42
- return remapProviderPrefix(piModelRefToCanonical(ref), CANONICAL_TO_PI_PROVIDER);
43
- }
44
- function modelRefLookupOrder(ref) {
45
- const canonical = piModelRefToCanonical(ompModelRefToCanonical(ref));
46
- return [
47
- ...new Set([
48
- canonical,
49
- ref,
50
- resolveModelRefForPi(canonical),
51
- resolveModelRefForOmp(canonical)
52
- ])
53
- ];
54
- }
55
- function ompModelRefToCanonical(ref) {
56
- return remapProviderPrefix(ref, OMP_TO_CANONICAL_PROVIDER);
57
- }
58
- function resolveModelRefForOmp(ref) {
59
- return remapProviderPrefix(ompModelRefToCanonical(ref), CANONICAL_TO_OMP_PROVIDER);
60
- }
61
-
62
- // ../plugin/src/shared/historian-tool-template.ts
63
- class Parser {
64
- source;
65
- pos = 0;
66
- constructor(source) {
67
- this.source = source;
68
- }
69
- error() {
70
- throw new Error(`Invalid tool expansion template at character ${this.pos + 1}`);
71
- }
72
- take(value) {
73
- if (!this.source.startsWith(value, this.pos))
74
- return false;
75
- this.pos += value.length;
76
- return true;
77
- }
78
- field() {
79
- const match = /^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.pos));
80
- if (!match)
81
- return this.error();
82
- this.pos += match[0].length;
83
- return match[0];
84
- }
85
- quoted() {
86
- const start = this.pos;
87
- if (!this.take('"'))
88
- return this.error();
89
- while (this.pos < this.source.length) {
90
- if (this.take("\\")) {
91
- this.pos++;
92
- continue;
93
- }
94
- if (this.take('"')) {
95
- try {
96
- return JSON.parse(this.source.slice(start, this.pos));
97
- } catch {
98
- return this.error();
99
- }
100
- }
101
- this.pos++;
102
- }
103
- return this.error();
104
- }
105
- integer() {
106
- const match = /^\d+/.exec(this.source.slice(this.pos));
107
- if (!match)
108
- return this.error();
109
- this.pos += match[0].length;
110
- const n = Number(match[0]);
111
- if (!Number.isSafeInteger(n))
112
- return this.error();
113
- return n;
114
- }
115
- expression(relative) {
116
- const steps = [];
117
- if (!(relative && this.take("."))) {
118
- const root = this.field();
119
- if (!relative && root !== "input" && root !== "output")
120
- return this.error();
121
- steps.push({ field: root });
122
- }
123
- while (true) {
124
- if (this.take("[")) {
125
- if (this.take("*]."))
126
- steps.push({ project: this.field() });
127
- else {
128
- const index = this.integer();
129
- if (!this.take("]"))
130
- return this.error();
131
- steps.push({ index });
132
- }
133
- } else if (this.source[this.pos] === "." && !/^\.(each\(|join\(|count(?:\.|\})|truncate\()/.test(this.source.slice(this.pos))) {
134
- this.pos++;
135
- steps.push({ field: this.field() });
136
- if (this.source[this.pos] === "(")
137
- return this.error();
138
- } else
139
- break;
140
- }
141
- const expression = { steps };
142
- if (this.take(".each(")) {
143
- if (relative)
144
- return this.error();
145
- expression.each = parseTemplate(this.quoted(), true);
146
- if (!this.take(")"))
147
- return this.error();
148
- }
149
- if (this.take(".join(")) {
150
- expression.join = this.quoted();
151
- if (!this.take(")"))
152
- return this.error();
153
- }
154
- if (this.take(".count")) {
155
- if (expression.each || expression.join !== undefined)
156
- return this.error();
157
- expression.count = true;
158
- }
159
- if (this.take(".truncate(")) {
160
- expression.cap = this.integer();
161
- if (!this.take(")"))
162
- return this.error();
163
- }
164
- if (!this.take("}"))
165
- return this.error();
166
- return expression;
167
- }
168
- template(relative) {
169
- const nodes = [];
170
- while (this.pos < this.source.length) {
171
- const next = this.source.indexOf("${", this.pos);
172
- if (next < 0) {
173
- nodes.push(this.source.slice(this.pos));
174
- break;
175
- }
176
- nodes.push(this.source.slice(this.pos, next));
177
- this.pos = next + 2;
178
- nodes.push(this.expression(relative));
179
- }
180
- return nodes;
181
- }
182
- }
183
- function parseTemplate(source, relative = false) {
184
- return new Parser(source).template(relative);
185
- }
186
- function toolTemplateError(source) {
187
- try {
188
- parseTemplate(source);
189
- return;
190
- } catch (error) {
191
- return error.message;
192
- }
193
- }
194
- var templates = new Map;
195
- function compiled(source) {
196
- if (!templates.has(source)) {
197
- try {
198
- templates.set(source, parseTemplate(source));
199
- } catch {
200
- templates.set(source, null);
201
- }
202
- }
203
- return templates.get(source) ?? null;
204
- }
205
- function oneLine(value) {
206
- return value.replace(/[\r\n\u2028\u2029]+/g, " ");
207
- }
208
- function truncate(value, cap, legacyPreview = false) {
209
- const chars = Array.from(oneLine(value));
210
- if (cap === undefined || chars.length <= cap)
211
- return chars.join("");
212
- if (legacyPreview)
213
- return `${chars.slice(0, cap).join("")}…`;
214
- let end = 0;
215
- for (let i = 0;i < Math.min(cap, chars.length); i++) {
216
- if (!".!?。!?".includes(chars[i]))
217
- continue;
218
- let next = i + 1;
219
- while (next < chars.length && `"'”’)]`.includes(chars[next]))
220
- next++;
221
- if (next <= cap && ("。!?".includes(chars[i]) || next === chars.length || /[ \t]/.test(chars[next])))
222
- end = next;
223
- }
224
- return `${end ? `${chars.slice(0, end).join("")} ` : ""}[… ${chars.length - end} more characters]`;
225
- }
226
- function scalar(value) {
227
- if (value === undefined)
228
- return "";
229
- return typeof value === "string" ? value : compactJson(value);
230
- }
231
- function compactJson(value) {
232
- if (Array.isArray(value))
233
- return `[${value.map((v) => compactJson(v)).join(",")}]`;
234
- if (value !== null && typeof value === "object")
235
- return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${compactJson(value[key])}`).join(",")}}`;
236
- return JSON.stringify(value) ?? "null";
237
- }
238
- function field(value, key) {
239
- return value !== null && typeof value === "object" && !Array.isArray(value) && Object.hasOwn(value, key) ? value[key] : undefined;
240
- }
241
- function render(nodes, root, legacyPreview) {
242
- return nodes.map((node) => {
243
- if (typeof node === "string")
244
- return node;
245
- const cap = node.cap ?? (legacyPreview ? 300 : undefined);
246
- let value = root;
247
- let list = false;
248
- for (const step of node.steps) {
249
- if ("field" in step)
250
- value = list && Array.isArray(value) ? value.map((item) => field(item, step.field)) : field(value, step.field);
251
- else if ("index" in step)
252
- value = Array.isArray(value) ? value[step.index] : undefined;
253
- else {
254
- value = Array.isArray(value) ? value.map((item) => field(item, step.project)) : undefined;
255
- list = true;
256
- }
257
- }
258
- if (node.count)
259
- return truncate(Array.isArray(value) ? String(value.length) : "", cap, legacyPreview);
260
- if (node.each || list || node.join !== undefined) {
261
- if (!Array.isArray(value))
262
- return "";
263
- const elements = value.slice(0, legacyPreview ? 10 : undefined).map((item) => truncate(node.each ? render(node.each, item, legacyPreview) : scalar(item), legacyPreview ? 300 : undefined, legacyPreview));
264
- if (legacyPreview && value.length > 10)
265
- elements.push(`… +${value.length - 10} more`);
266
- return truncate(elements.join(node.join ?? (node.each ? "; " : ", ")), cap, legacyPreview);
267
- }
268
- return truncate(scalar(value), cap, legacyPreview);
269
- }).join("");
270
- }
271
- function renderToolTemplate(source, input, output, legacyPreview = false) {
272
- const nodes = compiled(source);
273
- if (!nodes)
274
- return null;
275
- const text = typeof output === "string" ? output : output === undefined ? "" : compactJson(output);
276
- let structured = output;
277
- if (typeof output === "string") {
278
- try {
279
- const parsed = JSON.parse(output);
280
- structured = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
281
- } catch {
282
- structured = undefined;
283
- }
284
- }
285
- const root = { input, output: structured };
286
- const bareOutputNodes = nodes.map((node) => typeof node !== "string" && node.steps.length === 1 && ("field" in node.steps[0]) && node.steps[0].field === "output" && !node.each && !node.count && node.join === undefined ? truncate(text ?? "", node.cap ?? (legacyPreview ? 300 : undefined), legacyPreview) : node);
287
- return truncate(render(bareOutputNodes, root, legacyPreview), legacyPreview ? 1000 : undefined, legacyPreview);
288
- }
289
-
290
- export { canonicalModelIdentity, piModelRefToCanonical, resolveModelRefForPi, modelRefLookupOrder, ompModelRefToCanonical, resolveModelRefForOmp, toolTemplateError, renderToolTemplate };