@usecontextlayer/ctxe 0.5.25 → 0.5.26
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/dist/cli.mjs +224 -12
- package/dist/cli.mjs.map +1 -1
- package/package.json +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cf956fac-c4d3-5c91-ad9e-ea7595aced84")}catch(e){}}();
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as Sentry from "@sentry/node";
|
|
6
6
|
import { lstat, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -2072,7 +2072,7 @@ const $ZodEnum$1 = /*@__PURE__*/ $constructor$1("$ZodEnum", (inst, def) => {
|
|
|
2072
2072
|
return payload;
|
|
2073
2073
|
};
|
|
2074
2074
|
});
|
|
2075
|
-
const $ZodLiteral = /*@__PURE__*/ $constructor$1("$ZodLiteral", (inst, def) => {
|
|
2075
|
+
const $ZodLiteral$1 = /*@__PURE__*/ $constructor$1("$ZodLiteral", (inst, def) => {
|
|
2076
2076
|
$ZodType$1.init(inst, def);
|
|
2077
2077
|
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2078
2078
|
const values = new Set(def.values);
|
|
@@ -3231,7 +3231,7 @@ const enumProcessor$1 = (schema, _ctx, json, _params) => {
|
|
|
3231
3231
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3232
3232
|
json.enum = values;
|
|
3233
3233
|
};
|
|
3234
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3234
|
+
const literalProcessor$1 = (schema, ctx, json, _params) => {
|
|
3235
3235
|
const def = schema._zod.def;
|
|
3236
3236
|
const vals = [];
|
|
3237
3237
|
for (const val of def.values) if (val === void 0) {
|
|
@@ -4122,18 +4122,18 @@ function _enum$1(values, params) {
|
|
|
4122
4122
|
...normalizeParams$1(params)
|
|
4123
4123
|
});
|
|
4124
4124
|
}
|
|
4125
|
-
const ZodLiteral = /*@__PURE__*/ $constructor$1("ZodLiteral", (inst, def) => {
|
|
4126
|
-
$ZodLiteral.init(inst, def);
|
|
4125
|
+
const ZodLiteral$1 = /*@__PURE__*/ $constructor$1("ZodLiteral", (inst, def) => {
|
|
4126
|
+
$ZodLiteral$1.init(inst, def);
|
|
4127
4127
|
ZodType$1.init(inst, def);
|
|
4128
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
4128
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor$1(inst, ctx, json, params);
|
|
4129
4129
|
inst.values = new Set(def.values);
|
|
4130
4130
|
Object.defineProperty(inst, "value", { get() {
|
|
4131
4131
|
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4132
4132
|
return def.values[0];
|
|
4133
4133
|
} });
|
|
4134
4134
|
});
|
|
4135
|
-
function literal(value, params) {
|
|
4136
|
-
return new ZodLiteral({
|
|
4135
|
+
function literal$1(value, params) {
|
|
4136
|
+
return new ZodLiteral$1({
|
|
4137
4137
|
type: "literal",
|
|
4138
4138
|
values: Array.isArray(value) ? value : [value],
|
|
4139
4139
|
...normalizeParams$1(params)
|
|
@@ -4349,7 +4349,7 @@ function normalizedKey(event) {
|
|
|
4349
4349
|
|
|
4350
4350
|
//#endregion
|
|
4351
4351
|
//#region package.json
|
|
4352
|
-
var version$1 = "0.5.
|
|
4352
|
+
var version$1 = "0.5.26";
|
|
4353
4353
|
|
|
4354
4354
|
//#endregion
|
|
4355
4355
|
//#region sentry.ts
|
|
@@ -6347,6 +6347,98 @@ function handleIntersectionResults(result, left, right) {
|
|
|
6347
6347
|
result.value = merged.data;
|
|
6348
6348
|
return result;
|
|
6349
6349
|
}
|
|
6350
|
+
const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
|
|
6351
|
+
$ZodType.init(inst, def);
|
|
6352
|
+
const items = def.items;
|
|
6353
|
+
inst._zod.parse = (payload, ctx) => {
|
|
6354
|
+
const input = payload.value;
|
|
6355
|
+
if (!Array.isArray(input)) {
|
|
6356
|
+
payload.issues.push({
|
|
6357
|
+
input,
|
|
6358
|
+
inst,
|
|
6359
|
+
expected: "tuple",
|
|
6360
|
+
code: "invalid_type"
|
|
6361
|
+
});
|
|
6362
|
+
return payload;
|
|
6363
|
+
}
|
|
6364
|
+
payload.value = [];
|
|
6365
|
+
const proms = [];
|
|
6366
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
6367
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
6368
|
+
if (!def.rest) {
|
|
6369
|
+
if (input.length < optinStart) {
|
|
6370
|
+
payload.issues.push({
|
|
6371
|
+
code: "too_small",
|
|
6372
|
+
minimum: optinStart,
|
|
6373
|
+
inclusive: true,
|
|
6374
|
+
input,
|
|
6375
|
+
inst,
|
|
6376
|
+
origin: "array"
|
|
6377
|
+
});
|
|
6378
|
+
return payload;
|
|
6379
|
+
}
|
|
6380
|
+
if (input.length > items.length) payload.issues.push({
|
|
6381
|
+
code: "too_big",
|
|
6382
|
+
maximum: items.length,
|
|
6383
|
+
inclusive: true,
|
|
6384
|
+
input,
|
|
6385
|
+
inst,
|
|
6386
|
+
origin: "array"
|
|
6387
|
+
});
|
|
6388
|
+
}
|
|
6389
|
+
const itemResults = new Array(items.length);
|
|
6390
|
+
for (let i = 0; i < items.length; i++) {
|
|
6391
|
+
const r = items[i]._zod.run({
|
|
6392
|
+
value: input[i],
|
|
6393
|
+
issues: []
|
|
6394
|
+
}, ctx);
|
|
6395
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
6396
|
+
itemResults[i] = rr;
|
|
6397
|
+
}));
|
|
6398
|
+
else itemResults[i] = r;
|
|
6399
|
+
}
|
|
6400
|
+
if (def.rest) {
|
|
6401
|
+
let i = items.length - 1;
|
|
6402
|
+
const rest = input.slice(items.length);
|
|
6403
|
+
for (const el of rest) {
|
|
6404
|
+
i++;
|
|
6405
|
+
const result = def.rest._zod.run({
|
|
6406
|
+
value: el,
|
|
6407
|
+
issues: []
|
|
6408
|
+
}, ctx);
|
|
6409
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
6410
|
+
else handleTupleResult(result, payload, i);
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6413
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
6414
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
6415
|
+
};
|
|
6416
|
+
});
|
|
6417
|
+
function getTupleOptStart(items, key) {
|
|
6418
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
6419
|
+
return 0;
|
|
6420
|
+
}
|
|
6421
|
+
function handleTupleResult(result, final, index) {
|
|
6422
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
6423
|
+
final.value[index] = result.value;
|
|
6424
|
+
}
|
|
6425
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
6426
|
+
for (let i = 0; i < items.length; i++) {
|
|
6427
|
+
const r = itemResults[i];
|
|
6428
|
+
const isPresent = i < input.length;
|
|
6429
|
+
if (r.issues.length) {
|
|
6430
|
+
if (!isPresent && i >= optoutStart) {
|
|
6431
|
+
final.value.length = i;
|
|
6432
|
+
break;
|
|
6433
|
+
}
|
|
6434
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
6435
|
+
}
|
|
6436
|
+
final.value[i] = r.value;
|
|
6437
|
+
}
|
|
6438
|
+
for (let i = final.value.length - 1; i >= input.length; i--) if (items[i]._zod.optout === "optional" && final.value[i] === void 0) final.value.length = i;
|
|
6439
|
+
else break;
|
|
6440
|
+
return final;
|
|
6441
|
+
}
|
|
6350
6442
|
const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
6351
6443
|
$ZodType.init(inst, def);
|
|
6352
6444
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -6474,6 +6566,24 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
6474
6566
|
return payload;
|
|
6475
6567
|
};
|
|
6476
6568
|
});
|
|
6569
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
6570
|
+
$ZodType.init(inst, def);
|
|
6571
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
6572
|
+
const values = new Set(def.values);
|
|
6573
|
+
inst._zod.values = values;
|
|
6574
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
6575
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
6576
|
+
const input = payload.value;
|
|
6577
|
+
if (values.has(input)) return payload;
|
|
6578
|
+
payload.issues.push({
|
|
6579
|
+
code: "invalid_value",
|
|
6580
|
+
values: def.values,
|
|
6581
|
+
input,
|
|
6582
|
+
inst
|
|
6583
|
+
});
|
|
6584
|
+
return payload;
|
|
6585
|
+
};
|
|
6586
|
+
});
|
|
6477
6587
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
6478
6588
|
$ZodType.init(inst, def);
|
|
6479
6589
|
inst._zod.optin = "optional";
|
|
@@ -7520,6 +7630,27 @@ const enumProcessor = (schema, _ctx, json, _params) => {
|
|
|
7520
7630
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
7521
7631
|
json.enum = values;
|
|
7522
7632
|
};
|
|
7633
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
7634
|
+
const def = schema._zod.def;
|
|
7635
|
+
const vals = [];
|
|
7636
|
+
for (const val of def.values) if (val === void 0) {
|
|
7637
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
7638
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
7639
|
+
else vals.push(Number(val));
|
|
7640
|
+
else vals.push(val);
|
|
7641
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
7642
|
+
const val = vals[0];
|
|
7643
|
+
json.type = val === null ? "null" : typeof val;
|
|
7644
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
7645
|
+
else json.const = val;
|
|
7646
|
+
} else {
|
|
7647
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
7648
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
7649
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
7650
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
7651
|
+
json.enum = vals;
|
|
7652
|
+
}
|
|
7653
|
+
};
|
|
7523
7654
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
7524
7655
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
7525
7656
|
};
|
|
@@ -7602,6 +7733,44 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
7602
7733
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
7603
7734
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
7604
7735
|
};
|
|
7736
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
7737
|
+
const json = _json;
|
|
7738
|
+
const def = schema._zod.def;
|
|
7739
|
+
json.type = "array";
|
|
7740
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
7741
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
7742
|
+
const prefixItems = def.items.map((x, i) => process$1$1(x, ctx, {
|
|
7743
|
+
...params,
|
|
7744
|
+
path: [
|
|
7745
|
+
...params.path,
|
|
7746
|
+
prefixPath,
|
|
7747
|
+
i
|
|
7748
|
+
]
|
|
7749
|
+
}));
|
|
7750
|
+
const rest = def.rest ? process$1$1(def.rest, ctx, {
|
|
7751
|
+
...params,
|
|
7752
|
+
path: [
|
|
7753
|
+
...params.path,
|
|
7754
|
+
restPath,
|
|
7755
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
7756
|
+
]
|
|
7757
|
+
}) : null;
|
|
7758
|
+
if (ctx.target === "draft-2020-12") {
|
|
7759
|
+
json.prefixItems = prefixItems;
|
|
7760
|
+
if (rest) json.items = rest;
|
|
7761
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
7762
|
+
json.items = { anyOf: prefixItems };
|
|
7763
|
+
if (rest) json.items.anyOf.push(rest);
|
|
7764
|
+
json.minItems = prefixItems.length;
|
|
7765
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
7766
|
+
} else {
|
|
7767
|
+
json.items = prefixItems;
|
|
7768
|
+
if (rest) json.additionalItems = rest;
|
|
7769
|
+
}
|
|
7770
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
7771
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
7772
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
7773
|
+
};
|
|
7605
7774
|
const recordProcessor = (schema, ctx, _json, params) => {
|
|
7606
7775
|
const json = _json;
|
|
7607
7776
|
const def = schema._zod.def;
|
|
@@ -8257,6 +8426,24 @@ function intersection(left, right) {
|
|
|
8257
8426
|
right
|
|
8258
8427
|
});
|
|
8259
8428
|
}
|
|
8429
|
+
const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
|
|
8430
|
+
$ZodTuple.init(inst, def);
|
|
8431
|
+
ZodType.init(inst, def);
|
|
8432
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
8433
|
+
inst.rest = (rest) => inst.clone({
|
|
8434
|
+
...inst._zod.def,
|
|
8435
|
+
rest
|
|
8436
|
+
});
|
|
8437
|
+
});
|
|
8438
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
8439
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
8440
|
+
return new ZodTuple({
|
|
8441
|
+
type: "tuple",
|
|
8442
|
+
items,
|
|
8443
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
8444
|
+
...normalizeParams(hasRest ? _params : _paramsOrRest)
|
|
8445
|
+
});
|
|
8446
|
+
}
|
|
8260
8447
|
const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
8261
8448
|
$ZodRecord.init(inst, def);
|
|
8262
8449
|
ZodType.init(inst, def);
|
|
@@ -8315,6 +8502,23 @@ function _enum(values, params) {
|
|
|
8315
8502
|
...normalizeParams(params)
|
|
8316
8503
|
});
|
|
8317
8504
|
}
|
|
8505
|
+
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
8506
|
+
$ZodLiteral.init(inst, def);
|
|
8507
|
+
ZodType.init(inst, def);
|
|
8508
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
8509
|
+
inst.values = new Set(def.values);
|
|
8510
|
+
Object.defineProperty(inst, "value", { get() {
|
|
8511
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
8512
|
+
return def.values[0];
|
|
8513
|
+
} });
|
|
8514
|
+
});
|
|
8515
|
+
function literal(value, params) {
|
|
8516
|
+
return new ZodLiteral({
|
|
8517
|
+
type: "literal",
|
|
8518
|
+
values: Array.isArray(value) ? value : [value],
|
|
8519
|
+
...normalizeParams(params)
|
|
8520
|
+
});
|
|
8521
|
+
}
|
|
8318
8522
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
8319
8523
|
$ZodTransform.init(inst, def);
|
|
8320
8524
|
ZodType.init(inst, def);
|
|
@@ -8653,6 +8857,10 @@ strictObject({
|
|
|
8653
8857
|
render: unknown$2().describe("The render tree — a @json-render Spec. Its elements name the components and directives published under `components` and `directives` in this artifact, and those contracts govern what each element may carry. This envelope does not constrain the tree's contents.")
|
|
8654
8858
|
}).extend({ defaultWorkspaceView: boolean$2().optional().describe("Marks this view as the one a workspace opens to when no view is named in the URL. The rule spans the workspace, not this file: EXACTLY ONE of a workspace's views must set true, and both zero and several fail loud when the workspace is opened. `false` means what omitting the key means — this view is not the landing one.") });
|
|
8655
8859
|
const segmentSchema = string$4().min(1, "a repoId segment must be non-empty").refine((s) => s !== "." && s !== ".." && !s.includes("/"), { message: "a repoId segment must not be '.'/'..' or contain '/'" });
|
|
8860
|
+
const CLAUDE_INTERRUPT_MARKERS = {
|
|
8861
|
+
text: "[Request interrupted by user]",
|
|
8862
|
+
tool: "[Request interrupted by user for tool use]"
|
|
8863
|
+
};
|
|
8656
8864
|
const sessionMetaSchema = object$2({
|
|
8657
8865
|
created: string$4().nullable(),
|
|
8658
8866
|
firstPrompt: string$4().nullable(),
|
|
@@ -8665,6 +8873,10 @@ looseObject({
|
|
|
8665
8873
|
type: string$4(),
|
|
8666
8874
|
uuid: string$4().optional()
|
|
8667
8875
|
});
|
|
8876
|
+
looseObject({ content: tuple([looseObject({
|
|
8877
|
+
text: _enum(CLAUDE_INTERRUPT_MARKERS),
|
|
8878
|
+
type: literal("text")
|
|
8879
|
+
})]) });
|
|
8668
8880
|
|
|
8669
8881
|
//#endregion
|
|
8670
8882
|
//#region ../shared/dist/ctx-machine-token.mjs
|
|
@@ -67647,11 +67859,11 @@ const rateLimitEventSchema = object$3({
|
|
|
67647
67859
|
resetsAt: number$3().optional(),
|
|
67648
67860
|
status: string$5().min(1)
|
|
67649
67861
|
}),
|
|
67650
|
-
type: literal("rate_limit_event")
|
|
67862
|
+
type: literal$1("rate_limit_event")
|
|
67651
67863
|
});
|
|
67652
67864
|
const resultEventSchema = object$3({
|
|
67653
67865
|
...claudeResultSchema.shape,
|
|
67654
|
-
type: literal("result")
|
|
67866
|
+
type: literal$1("result")
|
|
67655
67867
|
});
|
|
67656
67868
|
var ClaudeStreamObserver = class {
|
|
67657
67869
|
decoder = new TextDecoder("utf-8", { fatal: false });
|
|
@@ -74635,4 +74847,4 @@ runCli().catch((error) => {
|
|
|
74635
74847
|
//#endregion
|
|
74636
74848
|
export { createProgram, resolveRepoContext, resolveRuntimePaths, runCli };
|
|
74637
74849
|
//# sourceMappingURL=cli.mjs.map
|
|
74638
|
-
//# debugId=
|
|
74850
|
+
//# debugId=cf956fac-c4d3-5c91-ad9e-ea7595aced84
|