@usecontextlayer/ctxs 0.5.24 → 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 +1151 -265
- package/dist/cli.mjs.map +1 -1
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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]="706efdec-7252-5edd-aee9-ff839acf6fa2")}catch(e){}}();
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import * as Sentry from "@sentry/node";
|
|
6
6
|
import * as fs$2 from "node:fs/promises";
|
|
7
7
|
import { access, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
8
8
|
import path, { sep } from "node:path";
|
|
9
|
-
import childProcess, { execFile } from "node:child_process";
|
|
9
|
+
import childProcess, { execFile, spawn } from "node:child_process";
|
|
10
10
|
import { formatWithOptions, promisify, stripVTControlCharacters } from "node:util";
|
|
11
|
-
import { randomUUID } from "node:crypto";
|
|
11
|
+
import { randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
12
12
|
import { serve, upgradeWebSocket } from "@hono/node-server";
|
|
13
13
|
import { Hono } from "hono";
|
|
14
14
|
import { cors } from "hono/cors";
|
|
@@ -642,7 +642,7 @@ const _safeParseAsync$1 = (_Err) => async (schema, value, _ctx) => {
|
|
|
642
642
|
};
|
|
643
643
|
};
|
|
644
644
|
const safeParseAsync$4 = /* @__PURE__*/ _safeParseAsync$1($ZodRealError$1);
|
|
645
|
-
const _encode$
|
|
645
|
+
const _encode$2 = (_Err) => (schema, value, _ctx) => {
|
|
646
646
|
const ctx = _ctx ? {
|
|
647
647
|
..._ctx,
|
|
648
648
|
direction: "backward"
|
|
@@ -2082,6 +2082,98 @@ function handleIntersectionResults$1(result, left, right) {
|
|
|
2082
2082
|
result.value = merged.data;
|
|
2083
2083
|
return result;
|
|
2084
2084
|
}
|
|
2085
|
+
const $ZodTuple$1 = /*@__PURE__*/ $constructor$1("$ZodTuple", (inst, def) => {
|
|
2086
|
+
$ZodType$1.init(inst, def);
|
|
2087
|
+
const items = def.items;
|
|
2088
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2089
|
+
const input = payload.value;
|
|
2090
|
+
if (!Array.isArray(input)) {
|
|
2091
|
+
payload.issues.push({
|
|
2092
|
+
input,
|
|
2093
|
+
inst,
|
|
2094
|
+
expected: "tuple",
|
|
2095
|
+
code: "invalid_type"
|
|
2096
|
+
});
|
|
2097
|
+
return payload;
|
|
2098
|
+
}
|
|
2099
|
+
payload.value = [];
|
|
2100
|
+
const proms = [];
|
|
2101
|
+
const optinStart = getTupleOptStart$1(items, "optin");
|
|
2102
|
+
const optoutStart = getTupleOptStart$1(items, "optout");
|
|
2103
|
+
if (!def.rest) {
|
|
2104
|
+
if (input.length < optinStart) {
|
|
2105
|
+
payload.issues.push({
|
|
2106
|
+
code: "too_small",
|
|
2107
|
+
minimum: optinStart,
|
|
2108
|
+
inclusive: true,
|
|
2109
|
+
input,
|
|
2110
|
+
inst,
|
|
2111
|
+
origin: "array"
|
|
2112
|
+
});
|
|
2113
|
+
return payload;
|
|
2114
|
+
}
|
|
2115
|
+
if (input.length > items.length) payload.issues.push({
|
|
2116
|
+
code: "too_big",
|
|
2117
|
+
maximum: items.length,
|
|
2118
|
+
inclusive: true,
|
|
2119
|
+
input,
|
|
2120
|
+
inst,
|
|
2121
|
+
origin: "array"
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
const itemResults = new Array(items.length);
|
|
2125
|
+
for (let i = 0; i < items.length; i++) {
|
|
2126
|
+
const r = items[i]._zod.run({
|
|
2127
|
+
value: input[i],
|
|
2128
|
+
issues: []
|
|
2129
|
+
}, ctx);
|
|
2130
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
2131
|
+
itemResults[i] = rr;
|
|
2132
|
+
}));
|
|
2133
|
+
else itemResults[i] = r;
|
|
2134
|
+
}
|
|
2135
|
+
if (def.rest) {
|
|
2136
|
+
let i = items.length - 1;
|
|
2137
|
+
const rest = input.slice(items.length);
|
|
2138
|
+
for (const el of rest) {
|
|
2139
|
+
i++;
|
|
2140
|
+
const result = def.rest._zod.run({
|
|
2141
|
+
value: el,
|
|
2142
|
+
issues: []
|
|
2143
|
+
}, ctx);
|
|
2144
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult$1(r, payload, i)));
|
|
2145
|
+
else handleTupleResult$1(result, payload, i);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults$1(itemResults, payload, items, input, optoutStart));
|
|
2149
|
+
return handleTupleResults$1(itemResults, payload, items, input, optoutStart);
|
|
2150
|
+
};
|
|
2151
|
+
});
|
|
2152
|
+
function getTupleOptStart$1(items, key) {
|
|
2153
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
2154
|
+
return 0;
|
|
2155
|
+
}
|
|
2156
|
+
function handleTupleResult$1(result, final, index) {
|
|
2157
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
2158
|
+
final.value[index] = result.value;
|
|
2159
|
+
}
|
|
2160
|
+
function handleTupleResults$1(itemResults, final, items, input, optoutStart) {
|
|
2161
|
+
for (let i = 0; i < items.length; i++) {
|
|
2162
|
+
const r = itemResults[i];
|
|
2163
|
+
const isPresent = i < input.length;
|
|
2164
|
+
if (r.issues.length) {
|
|
2165
|
+
if (!isPresent && i >= optoutStart) {
|
|
2166
|
+
final.value.length = i;
|
|
2167
|
+
break;
|
|
2168
|
+
}
|
|
2169
|
+
final.issues.push(...prefixIssues$1(i, r.issues));
|
|
2170
|
+
}
|
|
2171
|
+
final.value[i] = r.value;
|
|
2172
|
+
}
|
|
2173
|
+
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;
|
|
2174
|
+
else break;
|
|
2175
|
+
return final;
|
|
2176
|
+
}
|
|
2085
2177
|
const $ZodRecord$1 = /*@__PURE__*/ $constructor$1("$ZodRecord", (inst, def) => {
|
|
2086
2178
|
$ZodType$1.init(inst, def);
|
|
2087
2179
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2209,7 +2301,7 @@ const $ZodEnum$1 = /*@__PURE__*/ $constructor$1("$ZodEnum", (inst, def) => {
|
|
|
2209
2301
|
return payload;
|
|
2210
2302
|
};
|
|
2211
2303
|
});
|
|
2212
|
-
const $ZodLiteral = /*@__PURE__*/ $constructor$1("$ZodLiteral", (inst, def) => {
|
|
2304
|
+
const $ZodLiteral$1 = /*@__PURE__*/ $constructor$1("$ZodLiteral", (inst, def) => {
|
|
2213
2305
|
$ZodType$1.init(inst, def);
|
|
2214
2306
|
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2215
2307
|
const values = new Set(def.values);
|
|
@@ -3425,7 +3517,7 @@ const enumProcessor$1 = (schema, _ctx, json, _params) => {
|
|
|
3425
3517
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3426
3518
|
json.enum = values;
|
|
3427
3519
|
};
|
|
3428
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3520
|
+
const literalProcessor$1 = (schema, ctx, json, _params) => {
|
|
3429
3521
|
const def = schema._zod.def;
|
|
3430
3522
|
const vals = [];
|
|
3431
3523
|
for (const val of def.values) if (val === void 0) {
|
|
@@ -3569,7 +3661,7 @@ const intersectionProcessor$1 = (schema, ctx, json, params) => {
|
|
|
3569
3661
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3570
3662
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3571
3663
|
};
|
|
3572
|
-
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
3664
|
+
const tupleProcessor$1 = (schema, ctx, _json, params) => {
|
|
3573
3665
|
const json = _json;
|
|
3574
3666
|
const def = schema._zod.def;
|
|
3575
3667
|
json.type = "array";
|
|
@@ -3729,7 +3821,7 @@ const allProcessors = {
|
|
|
3729
3821
|
unknown: unknownProcessor,
|
|
3730
3822
|
date: dateProcessor,
|
|
3731
3823
|
enum: enumProcessor$1,
|
|
3732
|
-
literal: literalProcessor,
|
|
3824
|
+
literal: literalProcessor$1,
|
|
3733
3825
|
nan: nanProcessor,
|
|
3734
3826
|
template_literal: templateLiteralProcessor,
|
|
3735
3827
|
file: fileProcessor,
|
|
@@ -3743,7 +3835,7 @@ const allProcessors = {
|
|
|
3743
3835
|
object: objectProcessor$1,
|
|
3744
3836
|
union: unionProcessor$1,
|
|
3745
3837
|
intersection: intersectionProcessor$1,
|
|
3746
|
-
tuple: tupleProcessor,
|
|
3838
|
+
tuple: tupleProcessor$1,
|
|
3747
3839
|
record: recordProcessor$1,
|
|
3748
3840
|
nullable: nullableProcessor$1,
|
|
3749
3841
|
nonoptional: nonoptionalProcessor$1,
|
|
@@ -3851,7 +3943,7 @@ const parse$3 = /* @__PURE__ */ _parse$1(ZodRealError$1);
|
|
|
3851
3943
|
const parseAsync$1 = /* @__PURE__ */ _parseAsync$1(ZodRealError$1);
|
|
3852
3944
|
const safeParse$3 = /* @__PURE__ */ _safeParse$1(ZodRealError$1);
|
|
3853
3945
|
const safeParseAsync$3 = /* @__PURE__ */ _safeParseAsync$1(ZodRealError$1);
|
|
3854
|
-
const encode$
|
|
3946
|
+
const encode$3 = /* @__PURE__ */ _encode$2(ZodRealError$1);
|
|
3855
3947
|
const decode$3 = /* @__PURE__ */ _decode$1(ZodRealError$1);
|
|
3856
3948
|
const encodeAsync$1 = /* @__PURE__ */ _encodeAsync$1(ZodRealError$1);
|
|
3857
3949
|
const decodeAsync$1 = /* @__PURE__ */ _decodeAsync$1(ZodRealError$1);
|
|
@@ -3913,7 +4005,7 @@ const ZodType$2 = /*@__PURE__*/ $constructor$1("ZodType", (inst, def) => {
|
|
|
3913
4005
|
inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
|
|
3914
4006
|
inst.safeParseAsync = async (data, params) => safeParseAsync$3(inst, data, params);
|
|
3915
4007
|
inst.spa = inst.safeParseAsync;
|
|
3916
|
-
inst.encode = (data, params) => encode$
|
|
4008
|
+
inst.encode = (data, params) => encode$3(inst, data, params);
|
|
3917
4009
|
inst.decode = (data, params) => decode$3(inst, data, params);
|
|
3918
4010
|
inst.encodeAsync = async (data, params) => encodeAsync$1(inst, data, params);
|
|
3919
4011
|
inst.decodeAsync = async (data, params) => decodeAsync$1(inst, data, params);
|
|
@@ -4418,7 +4510,7 @@ function strictObject$1(shape, params) {
|
|
|
4418
4510
|
...normalizeParams$1(params)
|
|
4419
4511
|
});
|
|
4420
4512
|
}
|
|
4421
|
-
function looseObject(shape, params) {
|
|
4513
|
+
function looseObject$1(shape, params) {
|
|
4422
4514
|
return new ZodObject$2({
|
|
4423
4515
|
type: "object",
|
|
4424
4516
|
shape,
|
|
@@ -4463,6 +4555,25 @@ function intersection$1(left, right) {
|
|
|
4463
4555
|
right
|
|
4464
4556
|
});
|
|
4465
4557
|
}
|
|
4558
|
+
const ZodTuple$2 = /*@__PURE__*/ $constructor$1("ZodTuple", (inst, def) => {
|
|
4559
|
+
$ZodTuple$1.init(inst, def);
|
|
4560
|
+
ZodType$2.init(inst, def);
|
|
4561
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor$1(inst, ctx, json, params);
|
|
4562
|
+
inst.rest = (rest) => inst.clone({
|
|
4563
|
+
...inst._zod.def,
|
|
4564
|
+
rest
|
|
4565
|
+
});
|
|
4566
|
+
});
|
|
4567
|
+
function tuple$1(items, _paramsOrRest, _params) {
|
|
4568
|
+
const hasRest = _paramsOrRest instanceof $ZodType$1;
|
|
4569
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
4570
|
+
return new ZodTuple$2({
|
|
4571
|
+
type: "tuple",
|
|
4572
|
+
items,
|
|
4573
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
4574
|
+
...normalizeParams$1(params)
|
|
4575
|
+
});
|
|
4576
|
+
}
|
|
4466
4577
|
const ZodRecord$2 = /*@__PURE__*/ $constructor$1("ZodRecord", (inst, def) => {
|
|
4467
4578
|
$ZodRecord$1.init(inst, def);
|
|
4468
4579
|
ZodType$2.init(inst, def);
|
|
@@ -4521,18 +4632,18 @@ function _enum$1(values, params) {
|
|
|
4521
4632
|
...normalizeParams$1(params)
|
|
4522
4633
|
});
|
|
4523
4634
|
}
|
|
4524
|
-
const ZodLiteral$
|
|
4525
|
-
$ZodLiteral.init(inst, def);
|
|
4635
|
+
const ZodLiteral$2 = /*@__PURE__*/ $constructor$1("ZodLiteral", (inst, def) => {
|
|
4636
|
+
$ZodLiteral$1.init(inst, def);
|
|
4526
4637
|
ZodType$2.init(inst, def);
|
|
4527
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
4638
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor$1(inst, ctx, json, params);
|
|
4528
4639
|
inst.values = new Set(def.values);
|
|
4529
4640
|
Object.defineProperty(inst, "value", { get() {
|
|
4530
4641
|
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4531
4642
|
return def.values[0];
|
|
4532
4643
|
} });
|
|
4533
4644
|
});
|
|
4534
|
-
function literal(value, params) {
|
|
4535
|
-
return new ZodLiteral$
|
|
4645
|
+
function literal$1(value, params) {
|
|
4646
|
+
return new ZodLiteral$2({
|
|
4536
4647
|
type: "literal",
|
|
4537
4648
|
values: Array.isArray(value) ? value : [value],
|
|
4538
4649
|
...normalizeParams$1(params)
|
|
@@ -4788,7 +4899,7 @@ function normalizedKey(event) {
|
|
|
4788
4899
|
|
|
4789
4900
|
//#endregion
|
|
4790
4901
|
//#region package.json
|
|
4791
|
-
var version$1 = "0.5.
|
|
4902
|
+
var version$1 = "0.5.26";
|
|
4792
4903
|
|
|
4793
4904
|
//#endregion
|
|
4794
4905
|
//#region sentry.ts
|
|
@@ -4969,6 +5080,16 @@ function createGuestMemoryProbe(readMetrics) {
|
|
|
4969
5080
|
function isNodeError(error) {
|
|
4970
5081
|
return error instanceof Error && "code" in error;
|
|
4971
5082
|
}
|
|
5083
|
+
function createSandboxDisposer(input) {
|
|
5084
|
+
let disposePromise = null;
|
|
5085
|
+
return () => {
|
|
5086
|
+
if (disposePromise === null) {
|
|
5087
|
+
input.stopMemoryProbe();
|
|
5088
|
+
disposePromise = input.stopSandbox();
|
|
5089
|
+
}
|
|
5090
|
+
return disposePromise;
|
|
5091
|
+
};
|
|
5092
|
+
}
|
|
4972
5093
|
async function ensureHostFilesystemReady(bindMounts) {
|
|
4973
5094
|
for (const mount of bindMounts) {
|
|
4974
5095
|
if (mount.hostPathBehavior === "createDir") {
|
|
@@ -5008,8 +5129,13 @@ async function bootSandbox(microsandboxLib, config) {
|
|
|
5008
5129
|
});
|
|
5009
5130
|
builder = builder.network((nb) => nb.policy(microsandboxLib.NetworkPolicy.allowAll()));
|
|
5010
5131
|
const sandbox = await builder.create();
|
|
5132
|
+
const guestMemory = createGuestMemoryProbe(() => sandbox.metrics());
|
|
5011
5133
|
return {
|
|
5012
|
-
|
|
5134
|
+
dispose: createSandboxDisposer({
|
|
5135
|
+
stopMemoryProbe: guestMemory.stop,
|
|
5136
|
+
stopSandbox: () => sandbox.stopWithTimeout(SANDBOX_STOP_TIMEOUT_MS)
|
|
5137
|
+
}),
|
|
5138
|
+
guestMemory,
|
|
5013
5139
|
sandbox
|
|
5014
5140
|
};
|
|
5015
5141
|
}
|
|
@@ -5118,7 +5244,7 @@ function guestGitEnv(input) {
|
|
|
5118
5244
|
name: input.sub
|
|
5119
5245
|
}), entries);
|
|
5120
5246
|
}
|
|
5121
|
-
const execFileAsync = promisify(execFile);
|
|
5247
|
+
const execFileAsync$1 = promisify(execFile);
|
|
5122
5248
|
const CAPTURE_AUTHOR_NAME = "contextlayer";
|
|
5123
5249
|
const CAPTURE_AUTHOR_EMAIL = "noreply@usecontextlayer.com";
|
|
5124
5250
|
const BRANCH = "main";
|
|
@@ -5281,7 +5407,7 @@ async function runGit(args, options = {}) {
|
|
|
5281
5407
|
})
|
|
5282
5408
|
};
|
|
5283
5409
|
try {
|
|
5284
|
-
const { stdout, stderr } = await execFileAsync("git", args, {
|
|
5410
|
+
const { stdout, stderr } = await execFileAsync$1("git", args, {
|
|
5285
5411
|
cwd: options.cwd,
|
|
5286
5412
|
env
|
|
5287
5413
|
});
|
|
@@ -6439,7 +6565,7 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
6439
6565
|
};
|
|
6440
6566
|
};
|
|
6441
6567
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
6442
|
-
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
6568
|
+
const _encode$1 = (_Err) => (schema, value, _ctx) => {
|
|
6443
6569
|
const ctx = _ctx ? {
|
|
6444
6570
|
..._ctx,
|
|
6445
6571
|
direction: "backward"
|
|
@@ -7622,6 +7748,98 @@ function handleIntersectionResults(result, left, right) {
|
|
|
7622
7748
|
result.value = merged.data;
|
|
7623
7749
|
return result;
|
|
7624
7750
|
}
|
|
7751
|
+
const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
|
|
7752
|
+
$ZodType.init(inst, def);
|
|
7753
|
+
const items = def.items;
|
|
7754
|
+
inst._zod.parse = (payload, ctx) => {
|
|
7755
|
+
const input = payload.value;
|
|
7756
|
+
if (!Array.isArray(input)) {
|
|
7757
|
+
payload.issues.push({
|
|
7758
|
+
input,
|
|
7759
|
+
inst,
|
|
7760
|
+
expected: "tuple",
|
|
7761
|
+
code: "invalid_type"
|
|
7762
|
+
});
|
|
7763
|
+
return payload;
|
|
7764
|
+
}
|
|
7765
|
+
payload.value = [];
|
|
7766
|
+
const proms = [];
|
|
7767
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
7768
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
7769
|
+
if (!def.rest) {
|
|
7770
|
+
if (input.length < optinStart) {
|
|
7771
|
+
payload.issues.push({
|
|
7772
|
+
code: "too_small",
|
|
7773
|
+
minimum: optinStart,
|
|
7774
|
+
inclusive: true,
|
|
7775
|
+
input,
|
|
7776
|
+
inst,
|
|
7777
|
+
origin: "array"
|
|
7778
|
+
});
|
|
7779
|
+
return payload;
|
|
7780
|
+
}
|
|
7781
|
+
if (input.length > items.length) payload.issues.push({
|
|
7782
|
+
code: "too_big",
|
|
7783
|
+
maximum: items.length,
|
|
7784
|
+
inclusive: true,
|
|
7785
|
+
input,
|
|
7786
|
+
inst,
|
|
7787
|
+
origin: "array"
|
|
7788
|
+
});
|
|
7789
|
+
}
|
|
7790
|
+
const itemResults = new Array(items.length);
|
|
7791
|
+
for (let i = 0; i < items.length; i++) {
|
|
7792
|
+
const r = items[i]._zod.run({
|
|
7793
|
+
value: input[i],
|
|
7794
|
+
issues: []
|
|
7795
|
+
}, ctx);
|
|
7796
|
+
if (r instanceof Promise) proms.push(r.then((rr) => {
|
|
7797
|
+
itemResults[i] = rr;
|
|
7798
|
+
}));
|
|
7799
|
+
else itemResults[i] = r;
|
|
7800
|
+
}
|
|
7801
|
+
if (def.rest) {
|
|
7802
|
+
let i = items.length - 1;
|
|
7803
|
+
const rest = input.slice(items.length);
|
|
7804
|
+
for (const el of rest) {
|
|
7805
|
+
i++;
|
|
7806
|
+
const result = def.rest._zod.run({
|
|
7807
|
+
value: el,
|
|
7808
|
+
issues: []
|
|
7809
|
+
}, ctx);
|
|
7810
|
+
if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
7811
|
+
else handleTupleResult(result, payload, i);
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
7815
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
7816
|
+
};
|
|
7817
|
+
});
|
|
7818
|
+
function getTupleOptStart(items, key) {
|
|
7819
|
+
for (let i = items.length - 1; i >= 0; i--) if (items[i]._zod[key] !== "optional") return i + 1;
|
|
7820
|
+
return 0;
|
|
7821
|
+
}
|
|
7822
|
+
function handleTupleResult(result, final, index) {
|
|
7823
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
7824
|
+
final.value[index] = result.value;
|
|
7825
|
+
}
|
|
7826
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
7827
|
+
for (let i = 0; i < items.length; i++) {
|
|
7828
|
+
const r = itemResults[i];
|
|
7829
|
+
const isPresent = i < input.length;
|
|
7830
|
+
if (r.issues.length) {
|
|
7831
|
+
if (!isPresent && i >= optoutStart) {
|
|
7832
|
+
final.value.length = i;
|
|
7833
|
+
break;
|
|
7834
|
+
}
|
|
7835
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
7836
|
+
}
|
|
7837
|
+
final.value[i] = r.value;
|
|
7838
|
+
}
|
|
7839
|
+
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;
|
|
7840
|
+
else break;
|
|
7841
|
+
return final;
|
|
7842
|
+
}
|
|
7625
7843
|
const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
7626
7844
|
$ZodType.init(inst, def);
|
|
7627
7845
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -7749,6 +7967,24 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
7749
7967
|
return payload;
|
|
7750
7968
|
};
|
|
7751
7969
|
});
|
|
7970
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
7971
|
+
$ZodType.init(inst, def);
|
|
7972
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
7973
|
+
const values = new Set(def.values);
|
|
7974
|
+
inst._zod.values = values;
|
|
7975
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7976
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
7977
|
+
const input = payload.value;
|
|
7978
|
+
if (values.has(input)) return payload;
|
|
7979
|
+
payload.issues.push({
|
|
7980
|
+
code: "invalid_value",
|
|
7981
|
+
values: def.values,
|
|
7982
|
+
input,
|
|
7983
|
+
inst
|
|
7984
|
+
});
|
|
7985
|
+
return payload;
|
|
7986
|
+
};
|
|
7987
|
+
});
|
|
7752
7988
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
7753
7989
|
$ZodType.init(inst, def);
|
|
7754
7990
|
inst._zod.optin = "optional";
|
|
@@ -8795,6 +9031,27 @@ const enumProcessor = (schema, _ctx, json, _params) => {
|
|
|
8795
9031
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
8796
9032
|
json.enum = values;
|
|
8797
9033
|
};
|
|
9034
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
9035
|
+
const def = schema._zod.def;
|
|
9036
|
+
const vals = [];
|
|
9037
|
+
for (const val of def.values) if (val === void 0) {
|
|
9038
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
9039
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
9040
|
+
else vals.push(Number(val));
|
|
9041
|
+
else vals.push(val);
|
|
9042
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
9043
|
+
const val = vals[0];
|
|
9044
|
+
json.type = val === null ? "null" : typeof val;
|
|
9045
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
9046
|
+
else json.const = val;
|
|
9047
|
+
} else {
|
|
9048
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
9049
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
9050
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
9051
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
9052
|
+
json.enum = vals;
|
|
9053
|
+
}
|
|
9054
|
+
};
|
|
8798
9055
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
8799
9056
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
8800
9057
|
};
|
|
@@ -8877,6 +9134,44 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
8877
9134
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
8878
9135
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
8879
9136
|
};
|
|
9137
|
+
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
9138
|
+
const json = _json;
|
|
9139
|
+
const def = schema._zod.def;
|
|
9140
|
+
json.type = "array";
|
|
9141
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
9142
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
9143
|
+
const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
|
|
9144
|
+
...params,
|
|
9145
|
+
path: [
|
|
9146
|
+
...params.path,
|
|
9147
|
+
prefixPath,
|
|
9148
|
+
i
|
|
9149
|
+
]
|
|
9150
|
+
}));
|
|
9151
|
+
const rest = def.rest ? process$1(def.rest, ctx, {
|
|
9152
|
+
...params,
|
|
9153
|
+
path: [
|
|
9154
|
+
...params.path,
|
|
9155
|
+
restPath,
|
|
9156
|
+
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
9157
|
+
]
|
|
9158
|
+
}) : null;
|
|
9159
|
+
if (ctx.target === "draft-2020-12") {
|
|
9160
|
+
json.prefixItems = prefixItems;
|
|
9161
|
+
if (rest) json.items = rest;
|
|
9162
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
9163
|
+
json.items = { anyOf: prefixItems };
|
|
9164
|
+
if (rest) json.items.anyOf.push(rest);
|
|
9165
|
+
json.minItems = prefixItems.length;
|
|
9166
|
+
if (!rest) json.maxItems = prefixItems.length;
|
|
9167
|
+
} else {
|
|
9168
|
+
json.items = prefixItems;
|
|
9169
|
+
if (rest) json.additionalItems = rest;
|
|
9170
|
+
}
|
|
9171
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
9172
|
+
if (typeof minimum === "number") json.minItems = minimum;
|
|
9173
|
+
if (typeof maximum === "number") json.maxItems = maximum;
|
|
9174
|
+
};
|
|
8880
9175
|
const recordProcessor = (schema, ctx, _json, params) => {
|
|
8881
9176
|
const json = _json;
|
|
8882
9177
|
const def = schema._zod.def;
|
|
@@ -9025,7 +9320,7 @@ const parse$2 = /* @__PURE__ */ _parse(ZodRealError);
|
|
|
9025
9320
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
9026
9321
|
const safeParse$2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
9027
9322
|
const safeParseAsync$2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
9028
|
-
const encode$
|
|
9323
|
+
const encode$2 = /* @__PURE__ */ _encode$1(ZodRealError);
|
|
9029
9324
|
const decode$2 = /* @__PURE__ */ _decode(ZodRealError);
|
|
9030
9325
|
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
9031
9326
|
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
@@ -9084,7 +9379,7 @@ const ZodType$1 = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
9084
9379
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
9085
9380
|
inst.safeParseAsync = async (data, params) => safeParseAsync$2(inst, data, params);
|
|
9086
9381
|
inst.spa = inst.safeParseAsync;
|
|
9087
|
-
inst.encode = (data, params) => encode$
|
|
9382
|
+
inst.encode = (data, params) => encode$2(inst, data, params);
|
|
9088
9383
|
inst.decode = (data, params) => decode$2(inst, data, params);
|
|
9089
9384
|
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
9090
9385
|
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
@@ -9499,6 +9794,14 @@ function strictObject(shape, params) {
|
|
|
9499
9794
|
...normalizeParams(params)
|
|
9500
9795
|
});
|
|
9501
9796
|
}
|
|
9797
|
+
function looseObject(shape, params) {
|
|
9798
|
+
return new ZodObject$1({
|
|
9799
|
+
type: "object",
|
|
9800
|
+
shape,
|
|
9801
|
+
catchall: unknown$2(),
|
|
9802
|
+
...normalizeParams(params)
|
|
9803
|
+
});
|
|
9804
|
+
}
|
|
9502
9805
|
const ZodUnion$1 = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
9503
9806
|
$ZodUnion.init(inst, def);
|
|
9504
9807
|
ZodType$1.init(inst, def);
|
|
@@ -9524,6 +9827,24 @@ function intersection(left, right) {
|
|
|
9524
9827
|
right
|
|
9525
9828
|
});
|
|
9526
9829
|
}
|
|
9830
|
+
const ZodTuple$1 = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
|
|
9831
|
+
$ZodTuple.init(inst, def);
|
|
9832
|
+
ZodType$1.init(inst, def);
|
|
9833
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
9834
|
+
inst.rest = (rest) => inst.clone({
|
|
9835
|
+
...inst._zod.def,
|
|
9836
|
+
rest
|
|
9837
|
+
});
|
|
9838
|
+
});
|
|
9839
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
9840
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
9841
|
+
return new ZodTuple$1({
|
|
9842
|
+
type: "tuple",
|
|
9843
|
+
items,
|
|
9844
|
+
rest: hasRest ? _paramsOrRest : null,
|
|
9845
|
+
...normalizeParams(hasRest ? _params : _paramsOrRest)
|
|
9846
|
+
});
|
|
9847
|
+
}
|
|
9527
9848
|
const ZodRecord$1 = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
9528
9849
|
$ZodRecord.init(inst, def);
|
|
9529
9850
|
ZodType$1.init(inst, def);
|
|
@@ -9582,6 +9903,23 @@ function _enum(values, params) {
|
|
|
9582
9903
|
...normalizeParams(params)
|
|
9583
9904
|
});
|
|
9584
9905
|
}
|
|
9906
|
+
const ZodLiteral$1 = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
9907
|
+
$ZodLiteral.init(inst, def);
|
|
9908
|
+
ZodType$1.init(inst, def);
|
|
9909
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
9910
|
+
inst.values = new Set(def.values);
|
|
9911
|
+
Object.defineProperty(inst, "value", { get() {
|
|
9912
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
9913
|
+
return def.values[0];
|
|
9914
|
+
} });
|
|
9915
|
+
});
|
|
9916
|
+
function literal(value, params) {
|
|
9917
|
+
return new ZodLiteral$1({
|
|
9918
|
+
type: "literal",
|
|
9919
|
+
values: Array.isArray(value) ? value : [value],
|
|
9920
|
+
...normalizeParams(params)
|
|
9921
|
+
});
|
|
9922
|
+
}
|
|
9585
9923
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
9586
9924
|
$ZodTransform.init(inst, def);
|
|
9587
9925
|
ZodType$1.init(inst, def);
|
|
@@ -9831,7 +10169,7 @@ function superRefine(fn, params) {
|
|
|
9831
10169
|
freshness: {
|
|
9832
10170
|
props: {
|
|
9833
10171
|
text: { $concat: ["Updated ", { $relativeDay: {
|
|
9834
|
-
|
|
10172
|
+
today: { $state: "/today" },
|
|
9835
10173
|
value: { $maxBy: {
|
|
9836
10174
|
field: "last_updated",
|
|
9837
10175
|
items: { $state: "/items" }
|
|
@@ -9931,6 +10269,10 @@ function buildRepoId$1(id) {
|
|
|
9931
10269
|
if (id.kind === "workspace" && id.owner === "slate") return `workspace/slate/${segment$1(id.workspaceId, "workspaceId")}`;
|
|
9932
10270
|
throw new Error(`Unhandled repoId variant: ${JSON.stringify(id)}`);
|
|
9933
10271
|
}
|
|
10272
|
+
const CLAUDE_INTERRUPT_MARKERS$1 = {
|
|
10273
|
+
text: "[Request interrupted by user]",
|
|
10274
|
+
tool: "[Request interrupted by user for tool use]"
|
|
10275
|
+
};
|
|
9934
10276
|
const sessionMetaSchema$1 = object$3({
|
|
9935
10277
|
created: string$4().nullable(),
|
|
9936
10278
|
firstPrompt: string$4().nullable(),
|
|
@@ -9938,6 +10280,15 @@ const sessionMetaSchema$1 = object$3({
|
|
|
9938
10280
|
sessionId: string$4()
|
|
9939
10281
|
});
|
|
9940
10282
|
record$1(string$4(), sessionMetaSchema$1);
|
|
10283
|
+
looseObject({
|
|
10284
|
+
timestamp: string$4().optional(),
|
|
10285
|
+
type: string$4(),
|
|
10286
|
+
uuid: string$4().optional()
|
|
10287
|
+
});
|
|
10288
|
+
looseObject({ content: tuple([looseObject({
|
|
10289
|
+
text: _enum(CLAUDE_INTERRUPT_MARKERS$1),
|
|
10290
|
+
type: literal("text")
|
|
10291
|
+
})]) });
|
|
9941
10292
|
async function ensureWorkspaceCheckout(workspaceId, ctx) {
|
|
9942
10293
|
const repo = await resolveRepo({
|
|
9943
10294
|
platformUrl: ctx.platformUrl,
|
|
@@ -12915,19 +13266,19 @@ let logging$1;
|
|
|
12915
13266
|
//#region ../base-schemas/dist/index.mjs
|
|
12916
13267
|
const apiKeyAuthSchema = strictObject$1({
|
|
12917
13268
|
api_key: string$5().trim().min(1),
|
|
12918
|
-
type: literal("api_key")
|
|
13269
|
+
type: literal$1("api_key")
|
|
12919
13270
|
}).meta({ title: "ApiKeyAuth" });
|
|
12920
13271
|
const authenticatedAccountRefSchema = strictObject$1({
|
|
12921
13272
|
account_id: string$5().trim().min(1),
|
|
12922
13273
|
provider_id: string$5().trim().min(1),
|
|
12923
|
-
type: literal("authenticated_account")
|
|
13274
|
+
type: literal$1("authenticated_account")
|
|
12924
13275
|
}).meta({ title: "AuthenticatedAccountRef" });
|
|
12925
13276
|
const authenticatedAccountIdentitySchema = authenticatedAccountRefSchema.omit({ type: true }).meta({ title: "AuthenticatedAccountIdentity" });
|
|
12926
|
-
const bindingAuthNoneSchema = strictObject$1({ type: literal("none") }).meta({ title: "BindingAuthNone" });
|
|
13277
|
+
const bindingAuthNoneSchema = strictObject$1({ type: literal$1("none") }).meta({ title: "BindingAuthNone" });
|
|
12927
13278
|
const clientCredentialsAuthSchema = strictObject$1({
|
|
12928
13279
|
client_id: string$5().trim().min(1),
|
|
12929
13280
|
client_secret: string$5().trim().min(1),
|
|
12930
|
-
type: literal("client_credentials")
|
|
13281
|
+
type: literal$1("client_credentials")
|
|
12931
13282
|
}).meta({ title: "ClientCredentialsAuth" });
|
|
12932
13283
|
const bindingAuthSchema = discriminatedUnion("type", [
|
|
12933
13284
|
bindingAuthNoneSchema,
|
|
@@ -12950,11 +13301,11 @@ const dagsterAllPlanBindingSchema = strictObject$1({
|
|
|
12950
13301
|
mode: modeSchema,
|
|
12951
13302
|
models: bindingModelsSchema.optional(),
|
|
12952
13303
|
plugin_id: string$5().trim().min(1)
|
|
12953
|
-
}).meta({ title: "PlanBinding" }).extend({ mode: literal("dagster") }).meta({ title: "DagsterAllPlanBinding" });
|
|
13304
|
+
}).meta({ title: "PlanBinding" }).extend({ mode: literal$1("dagster") }).meta({ title: "DagsterAllPlanBinding" });
|
|
12954
13305
|
const dagsterBindingPlanAllSchema = strictObject$1({
|
|
12955
13306
|
bindings: array$1(dagsterAllPlanBindingSchema),
|
|
12956
13307
|
generated_at: generatedAtSchema,
|
|
12957
|
-
version: literal(1)
|
|
13308
|
+
version: literal$1(1)
|
|
12958
13309
|
}).meta({ title: "DagsterBindingPlanAll" });
|
|
12959
13310
|
const dagsterPluginPlanBindingSchema = dagsterAllPlanBindingSchema.omit({
|
|
12960
13311
|
mode: true,
|
|
@@ -12963,9 +13314,9 @@ const dagsterPluginPlanBindingSchema = dagsterAllPlanBindingSchema.omit({
|
|
|
12963
13314
|
const dagsterBindingPlanPluginSchema = strictObject$1({
|
|
12964
13315
|
bindings: array$1(dagsterPluginPlanBindingSchema),
|
|
12965
13316
|
generated_at: generatedAtSchema,
|
|
12966
|
-
mode: literal("dagster"),
|
|
13317
|
+
mode: literal$1("dagster"),
|
|
12967
13318
|
plugin_id: string$5().trim().min(1),
|
|
12968
|
-
version: literal(1)
|
|
13319
|
+
version: literal$1(1)
|
|
12969
13320
|
}).meta({ title: "DagsterBindingPlanPlugin" });
|
|
12970
13321
|
const RUN_STATUSES = [
|
|
12971
13322
|
"QUEUED",
|
|
@@ -12988,16 +13339,16 @@ const bindingStateSchema = strictObject$1({
|
|
|
12988
13339
|
}).meta({ title: "BindingState" });
|
|
12989
13340
|
const bindingStateResponseSchema = strictObject$1({
|
|
12990
13341
|
bindings: record$2(string$5().uuid(), bindingStateSchema),
|
|
12991
|
-
version: literal(1)
|
|
13342
|
+
version: literal$1(1)
|
|
12992
13343
|
}).meta({ title: "BindingStateResponse" });
|
|
12993
|
-
const pluginAuthNoneSchema = strictObject$1({ type: literal("none") }).meta({ title: "PluginAuthNone" });
|
|
12994
|
-
const pluginAuthApiKeySchema = strictObject$1({ type: literal("api_key") }).meta({ title: "PluginAuthApiKey" });
|
|
12995
|
-
const pluginAuthClientCredentialsSchema = strictObject$1({ type: literal("client_credentials") }).meta({ title: "PluginAuthClientCredentials" });
|
|
13344
|
+
const pluginAuthNoneSchema = strictObject$1({ type: literal$1("none") }).meta({ title: "PluginAuthNone" });
|
|
13345
|
+
const pluginAuthApiKeySchema = strictObject$1({ type: literal$1("api_key") }).meta({ title: "PluginAuthApiKey" });
|
|
13346
|
+
const pluginAuthClientCredentialsSchema = strictObject$1({ type: literal$1("client_credentials") }).meta({ title: "PluginAuthClientCredentials" });
|
|
12996
13347
|
const pluginOAuthSchema = strictObject$1({
|
|
12997
13348
|
provider_id: string$5().trim().min(1),
|
|
12998
13349
|
requires_oauth_app_id: boolean$3().optional(),
|
|
12999
13350
|
scopes: array$1(string$5().trim().min(1)),
|
|
13000
|
-
type: literal("oauth")
|
|
13351
|
+
type: literal$1("oauth")
|
|
13001
13352
|
}).meta({ title: "PluginOAuth" });
|
|
13002
13353
|
const pluginAuthSchema = discriminatedUnion("type", [
|
|
13003
13354
|
pluginAuthNoneSchema,
|
|
@@ -13009,13 +13360,13 @@ const pluginMcpEnabledToolSchema = strictObject$1({ autoAllow: boolean$3().optio
|
|
|
13009
13360
|
const pluginMcpEnabledToolsSchema = record$2(string$5().min(1), pluginMcpEnabledToolSchema).refine((tools) => Object.keys(tools).length > 0, { message: "enabledTools must declare at least one tool" }).meta({ title: "PluginMcpEnabledTools" });
|
|
13010
13361
|
const pluginMcpHttpServerSchema = strictObject$1({
|
|
13011
13362
|
enabledTools: pluginMcpEnabledToolsSchema,
|
|
13012
|
-
type: literal("http"),
|
|
13363
|
+
type: literal$1("http"),
|
|
13013
13364
|
url: url()
|
|
13014
13365
|
}).meta({ title: "PluginMcpHttpServer" });
|
|
13015
13366
|
const pluginMcpModuleServerSchema = strictObject$1({
|
|
13016
13367
|
enabledTools: pluginMcpEnabledToolsSchema,
|
|
13017
13368
|
module: string$5().trim().min(1),
|
|
13018
|
-
type: literal("module")
|
|
13369
|
+
type: literal$1("module")
|
|
13019
13370
|
}).meta({ title: "PluginMcpModuleServer" });
|
|
13020
13371
|
const pluginMcpServerSchema = discriminatedUnion("type", [pluginMcpHttpServerSchema, pluginMcpModuleServerSchema]).meta({ title: "PluginMcpServer" });
|
|
13021
13372
|
const mcpServerNameSchema = string$5().regex(/^[a-z0-9]+(?:_[a-z0-9]+)*$/);
|
|
@@ -13300,7 +13651,7 @@ function concat(...buffers) {
|
|
|
13300
13651
|
}
|
|
13301
13652
|
return buf;
|
|
13302
13653
|
}
|
|
13303
|
-
function encode(string) {
|
|
13654
|
+
function encode$1(string) {
|
|
13304
13655
|
const bytes = new Uint8Array(string.length);
|
|
13305
13656
|
for (let i = 0; i < string.length; i++) {
|
|
13306
13657
|
const code = string.charCodeAt(i);
|
|
@@ -14021,7 +14372,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
14021
14372
|
resolvedKey = true;
|
|
14022
14373
|
}
|
|
14023
14374
|
checkKeyType(alg, key, "verify");
|
|
14024
|
-
const data = concat(jws.protected !== void 0 ? encode(jws.protected) : new Uint8Array(), encode("."), typeof jws.payload === "string" ? b64 ? encode(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
14375
|
+
const data = concat(jws.protected !== void 0 ? encode$1(jws.protected) : new Uint8Array(), encode$1("."), typeof jws.payload === "string" ? b64 ? encode$1(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
14025
14376
|
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
14026
14377
|
const k = await normalizeKey$1(key, alg);
|
|
14027
14378
|
if (!await verify(alg, k, signature, data)) throw new JWSSignatureVerificationFailed();
|
|
@@ -14636,8 +14987,135 @@ function createDevJwtVerifier() {
|
|
|
14636
14987
|
};
|
|
14637
14988
|
}
|
|
14638
14989
|
|
|
14990
|
+
//#endregion
|
|
14991
|
+
//#region ../../node_modules/.pnpm/js-base64@3.9.1/node_modules/js-base64/base64.mjs
|
|
14992
|
+
const _TD = typeof TextDecoder === "function" ? new TextDecoder("utf-8", { ignoreBOM: true }) : void 0;
|
|
14993
|
+
const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
14994
|
+
const b64chs = Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");
|
|
14995
|
+
const b64tab = ((a) => {
|
|
14996
|
+
let tab = {};
|
|
14997
|
+
a.forEach((c, i) => tab[c] = i);
|
|
14998
|
+
return tab;
|
|
14999
|
+
})(b64chs);
|
|
15000
|
+
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
15001
|
+
const _fromCC = String.fromCharCode.bind(String);
|
|
15002
|
+
const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
|
15003
|
+
const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
|
15004
|
+
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
|
15005
|
+
/**
|
|
15006
|
+
* polyfill version of `btoa`
|
|
15007
|
+
*/
|
|
15008
|
+
const btoaPolyfill = (bin) => {
|
|
15009
|
+
let u32, c0, c1, c2, asc = "";
|
|
15010
|
+
const pad = bin.length % 3;
|
|
15011
|
+
for (let i = 0; i < bin.length;) {
|
|
15012
|
+
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255) throw new TypeError("invalid character found");
|
|
15013
|
+
u32 = c0 << 16 | c1 << 8 | c2;
|
|
15014
|
+
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
|
15015
|
+
}
|
|
15016
|
+
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
|
15017
|
+
};
|
|
15018
|
+
/**
|
|
15019
|
+
* does what `window.btoa` of web browsers do.
|
|
15020
|
+
* @param {String} bin binary string
|
|
15021
|
+
* @returns {string} Base64-encoded string
|
|
15022
|
+
*/
|
|
15023
|
+
const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : btoaPolyfill;
|
|
15024
|
+
const _fromUint8Array = typeof Uint8Array.prototype.toBase64 === "function" ? (u8a) => u8a.toBase64() : (u8a) => {
|
|
15025
|
+
const maxargs = 4096;
|
|
15026
|
+
let strs = [];
|
|
15027
|
+
for (let i = 0, l = u8a.length; i < l; i += maxargs) strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
|
15028
|
+
return _btoa(strs.join(""));
|
|
15029
|
+
};
|
|
15030
|
+
const cb_utob = (c) => {
|
|
15031
|
+
if (c.length < 2) {
|
|
15032
|
+
var cc = c.charCodeAt(0);
|
|
15033
|
+
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
15034
|
+
} else {
|
|
15035
|
+
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
|
15036
|
+
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
15037
|
+
}
|
|
15038
|
+
};
|
|
15039
|
+
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
15040
|
+
/**
|
|
15041
|
+
* @deprecated should have been internal use only.
|
|
15042
|
+
* @param {string} src UTF-8 string
|
|
15043
|
+
* @returns {string} UTF-16 string
|
|
15044
|
+
*/
|
|
15045
|
+
const utob = (u) => u.replace(re_utob, cb_utob);
|
|
15046
|
+
const _encode = _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
|
15047
|
+
/**
|
|
15048
|
+
* converts a UTF-8-encoded string to a Base64 string.
|
|
15049
|
+
* @param {boolean} [urlsafe] if `true` make the result URL-safe
|
|
15050
|
+
* @returns {string} Base64 string
|
|
15051
|
+
*/
|
|
15052
|
+
const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
|
15053
|
+
/**
|
|
15054
|
+
* converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
|
|
15055
|
+
* @returns {string} Base64 string
|
|
15056
|
+
*/
|
|
15057
|
+
const encodeURI$1 = (src) => encode(src, true);
|
|
15058
|
+
/**
|
|
15059
|
+
* polyfill version of `atob`
|
|
15060
|
+
*/
|
|
15061
|
+
const atobPolyfill = (asc) => {
|
|
15062
|
+
asc = asc.replace(/\s+/g, "");
|
|
15063
|
+
if (!b64re.test(asc)) throw new TypeError("malformed base64.");
|
|
15064
|
+
asc += "==".slice(2 - (asc.length & 3));
|
|
15065
|
+
let u24, r1, r2;
|
|
15066
|
+
let binArray = [];
|
|
15067
|
+
for (let i = 0; i < asc.length;) {
|
|
15068
|
+
u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
|
|
15069
|
+
if (r1 === 64) binArray.push(_fromCC(u24 >> 16 & 255));
|
|
15070
|
+
else if (r2 === 64) binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255));
|
|
15071
|
+
else binArray.push(_fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255));
|
|
15072
|
+
}
|
|
15073
|
+
return binArray.join("");
|
|
15074
|
+
};
|
|
15075
|
+
/**
|
|
15076
|
+
* does what `window.atob` of web browsers do.
|
|
15077
|
+
* @param {String} asc Base64-encoded string
|
|
15078
|
+
* @returns {string} binary string
|
|
15079
|
+
*/
|
|
15080
|
+
const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : atobPolyfill;
|
|
15081
|
+
const _toUint8Array = typeof Uint8Array.fromBase64 === "function" ? (a) => Uint8Array.fromBase64(a) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
|
15082
|
+
|
|
14639
15083
|
//#endregion
|
|
14640
15084
|
//#region ../slate-shared/dist/index.mjs
|
|
15085
|
+
function createClaudeUserMessage(text) {
|
|
15086
|
+
return {
|
|
15087
|
+
message: {
|
|
15088
|
+
content: text,
|
|
15089
|
+
role: "user"
|
|
15090
|
+
},
|
|
15091
|
+
parent_tool_use_id: null,
|
|
15092
|
+
type: "user"
|
|
15093
|
+
};
|
|
15094
|
+
}
|
|
15095
|
+
function createClaudePromptStream() {
|
|
15096
|
+
const queue = [];
|
|
15097
|
+
let resolveNext;
|
|
15098
|
+
async function* messages() {
|
|
15099
|
+
while (true) {
|
|
15100
|
+
const buffered = queue.shift();
|
|
15101
|
+
if (buffered !== void 0) yield buffered;
|
|
15102
|
+
else yield await new Promise((resolve) => {
|
|
15103
|
+
resolveNext = resolve;
|
|
15104
|
+
});
|
|
15105
|
+
}
|
|
15106
|
+
}
|
|
15107
|
+
return {
|
|
15108
|
+
prompt: messages(),
|
|
15109
|
+
push(text) {
|
|
15110
|
+
const message = createClaudeUserMessage(text);
|
|
15111
|
+
if (resolveNext !== void 0) {
|
|
15112
|
+
const resolve = resolveNext;
|
|
15113
|
+
resolveNext = void 0;
|
|
15114
|
+
resolve(message);
|
|
15115
|
+
} else queue.push(message);
|
|
15116
|
+
}
|
|
15117
|
+
};
|
|
15118
|
+
}
|
|
14641
15119
|
const INBOX_DOCS_TREE = {
|
|
14642
15120
|
"docs/types/update.loader.js": `// docs/types/update.loader.js
|
|
14643
15121
|
export default async ({ docs, path }) => {
|
|
@@ -14781,6 +15259,8 @@ export default async ({ docs }) => {
|
|
|
14781
15259
|
},
|
|
14782
15260
|
{ sort },
|
|
14783
15261
|
)
|
|
15262
|
+
// This neutral dev fixture has no customer timezone, so its calendar day is UTC.
|
|
15263
|
+
const today = new Date().toISOString().slice(0, 10)
|
|
14784
15264
|
const items = rows.map((u) => {
|
|
14785
15265
|
const proposedTitle = u.proposed_title ?? ""
|
|
14786
15266
|
const separatorIndex = proposedTitle.indexOf(" - ")
|
|
@@ -14798,7 +15278,7 @@ export default async ({ docs }) => {
|
|
|
14798
15278
|
: proposedTitle || u.path,
|
|
14799
15279
|
}
|
|
14800
15280
|
})
|
|
14801
|
-
return { items }
|
|
15281
|
+
return { items, today }
|
|
14802
15282
|
}
|
|
14803
15283
|
`,
|
|
14804
15284
|
"docs/views/inbox.render-spec.json": `${JSON.stringify({
|
|
@@ -14808,7 +15288,7 @@ export default async ({ docs }) => {
|
|
|
14808
15288
|
freshness: {
|
|
14809
15289
|
props: {
|
|
14810
15290
|
text: { $concat: ["Updated ", { $relativeDay: {
|
|
14811
|
-
|
|
15291
|
+
today: { $state: "/today" },
|
|
14812
15292
|
value: { $maxBy: {
|
|
14813
15293
|
field: "last_updated",
|
|
14814
15294
|
items: { $state: "/items" }
|
|
@@ -14892,7 +15372,24 @@ export default async ({ docs }) => {
|
|
|
14892
15372
|
}
|
|
14893
15373
|
}, null, " ")}\n`
|
|
14894
15374
|
};
|
|
15375
|
+
const DEV_IDENTITY = {
|
|
15376
|
+
email: "joeblack@gmail.com",
|
|
15377
|
+
name: "Joe Black",
|
|
15378
|
+
sub: "user-dev"
|
|
15379
|
+
};
|
|
14895
15380
|
const docPathSchema = string$5().min(1, "a doc path must be non-empty").refine((docPath) => !docPath.startsWith("/"), { message: "a doc path must be root-relative, not absolute" }).refine((docPath) => !docPath.split("/").includes(".."), { message: "a doc path must not contain a '..' segment" });
|
|
15381
|
+
function encodeBase64UrlJson(value) {
|
|
15382
|
+
return encodeURI$1(JSON.stringify(value));
|
|
15383
|
+
}
|
|
15384
|
+
function mintUnsignedCtxToken(sub) {
|
|
15385
|
+
return `${encodeBase64UrlJson({
|
|
15386
|
+
alg: "none",
|
|
15387
|
+
typ: "JWT"
|
|
15388
|
+
})}.${encodeBase64UrlJson({
|
|
15389
|
+
aud: "ctx",
|
|
15390
|
+
sub
|
|
15391
|
+
})}.`;
|
|
15392
|
+
}
|
|
14896
15393
|
const renderSpecSchema = strictObject$1({
|
|
14897
15394
|
params: record$2(string$5().min(1), strictObject$1({ default: string$5().min(1) })).optional().describe("URL search params this surface accepts, each with its default. Resolution is `URL value ?? default`; the default is stripped back out of the URL, and an undeclared URL key is ignored. What a value MEANS — which are legal, what each expands to — is the loader's job, in JS."),
|
|
14898
15395
|
render: unknown$3().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.")
|
|
@@ -14910,6 +15407,13 @@ function buildRepoId(id) {
|
|
|
14910
15407
|
if (id.kind === "workspace" && id.owner === "slate") return `workspace/slate/${segment(id.workspaceId, "workspaceId")}`;
|
|
14911
15408
|
throw new Error(`Unhandled repoId variant: ${JSON.stringify(id)}`);
|
|
14912
15409
|
}
|
|
15410
|
+
const CLAUDE_INTERRUPT_MARKERS = {
|
|
15411
|
+
text: "[Request interrupted by user]",
|
|
15412
|
+
tool: "[Request interrupted by user for tool use]"
|
|
15413
|
+
};
|
|
15414
|
+
function isStoppedResult(message) {
|
|
15415
|
+
return message.terminal_reason === "aborted_streaming" || message.terminal_reason === "aborted_tools";
|
|
15416
|
+
}
|
|
14913
15417
|
const sessionMetaSchema = object$4({
|
|
14914
15418
|
created: string$5().nullable(),
|
|
14915
15419
|
firstPrompt: string$5().nullable(),
|
|
@@ -14917,6 +15421,44 @@ const sessionMetaSchema = object$4({
|
|
|
14917
15421
|
sessionId: string$5()
|
|
14918
15422
|
});
|
|
14919
15423
|
const claudeIndexSchema = record$2(string$5(), sessionMetaSchema);
|
|
15424
|
+
const sessionStoreEntrySchema = looseObject$1({
|
|
15425
|
+
timestamp: string$5().optional(),
|
|
15426
|
+
type: string$5(),
|
|
15427
|
+
uuid: string$5().optional()
|
|
15428
|
+
});
|
|
15429
|
+
function parseSessionStoreJsonl(jsonl, malformedEntryPolicy) {
|
|
15430
|
+
const entries = [];
|
|
15431
|
+
for (const [index, line] of jsonl.split("\n").entries()) {
|
|
15432
|
+
if (line.trim() === "") continue;
|
|
15433
|
+
try {
|
|
15434
|
+
const parsed = JSON.parse(line);
|
|
15435
|
+
entries.push(malformedEntryPolicy === "throw" ? sessionStoreEntrySchema.parse(parsed) : parsed);
|
|
15436
|
+
} catch (cause) {
|
|
15437
|
+
if (malformedEntryPolicy === "skip") continue;
|
|
15438
|
+
throw new Error(`invalid session transcript entry at line ${index + 1}`, { cause });
|
|
15439
|
+
}
|
|
15440
|
+
}
|
|
15441
|
+
return entries;
|
|
15442
|
+
}
|
|
15443
|
+
function singleSessionStore(sessionId, entries) {
|
|
15444
|
+
return {
|
|
15445
|
+
append: () => {
|
|
15446
|
+
throw new Error("singleSessionStore is read-only; append() is not supported");
|
|
15447
|
+
},
|
|
15448
|
+
listSessions: async () => [{
|
|
15449
|
+
mtime: 0,
|
|
15450
|
+
sessionId
|
|
15451
|
+
}],
|
|
15452
|
+
load: async (key) => {
|
|
15453
|
+
if (key.sessionId !== sessionId || key.subpath) return null;
|
|
15454
|
+
return entries;
|
|
15455
|
+
}
|
|
15456
|
+
};
|
|
15457
|
+
}
|
|
15458
|
+
const interruptMarkerMessageSchema = looseObject$1({ content: tuple$1([looseObject$1({
|
|
15459
|
+
text: _enum$1(CLAUDE_INTERRUPT_MARKERS),
|
|
15460
|
+
type: literal$1("text")
|
|
15461
|
+
})]) });
|
|
14920
15462
|
|
|
14921
15463
|
//#endregion
|
|
14922
15464
|
//#region ../../node_modules/.pnpm/undici@8.8.0/node_modules/undici/lib/core/symbols.js
|
|
@@ -40450,7 +40992,7 @@ const SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
|
40450
40992
|
/**
|
|
40451
40993
|
* RFC 9728 OAuth Protected Resource Metadata
|
|
40452
40994
|
*/
|
|
40453
|
-
const OAuthProtectedResourceMetadataSchema = looseObject({
|
|
40995
|
+
const OAuthProtectedResourceMetadataSchema = looseObject$1({
|
|
40454
40996
|
resource: string$5().url(),
|
|
40455
40997
|
authorization_servers: array$1(SafeUrlSchema).optional(),
|
|
40456
40998
|
jwks_uri: string$5().url().optional(),
|
|
@@ -40469,7 +41011,7 @@ const OAuthProtectedResourceMetadataSchema = looseObject({
|
|
|
40469
41011
|
/**
|
|
40470
41012
|
* RFC 8414 OAuth 2.0 Authorization Server Metadata
|
|
40471
41013
|
*/
|
|
40472
|
-
const OAuthMetadataSchema = looseObject({
|
|
41014
|
+
const OAuthMetadataSchema = looseObject$1({
|
|
40473
41015
|
issuer: string$5(),
|
|
40474
41016
|
authorization_endpoint: SafeUrlSchema,
|
|
40475
41017
|
token_endpoint: SafeUrlSchema,
|
|
@@ -40494,7 +41036,7 @@ const OAuthMetadataSchema = looseObject({
|
|
|
40494
41036
|
* OpenID Connect Discovery 1.0 Provider Metadata
|
|
40495
41037
|
* see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
|
40496
41038
|
*/
|
|
40497
|
-
const OpenIdProviderMetadataSchema = looseObject({
|
|
41039
|
+
const OpenIdProviderMetadataSchema = looseObject$1({
|
|
40498
41040
|
issuer: string$5(),
|
|
40499
41041
|
authorization_endpoint: SafeUrlSchema,
|
|
40500
41042
|
token_endpoint: SafeUrlSchema,
|
|
@@ -40563,7 +41105,7 @@ const OAuthErrorResponseSchema = object$4({
|
|
|
40563
41105
|
/**
|
|
40564
41106
|
* Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri
|
|
40565
41107
|
*/
|
|
40566
|
-
const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(literal("").transform(() => void 0));
|
|
41108
|
+
const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(literal$1("").transform(() => void 0));
|
|
40567
41109
|
/**
|
|
40568
41110
|
* RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
|
|
40569
41111
|
*/
|
|
@@ -40675,9 +41217,9 @@ const ClientAuthorizationParamsSchema = object$4({
|
|
|
40675
41217
|
redirect_uri: string$5().optional().refine((value) => value === void 0 || URL.canParse(value), { message: "redirect_uri must be a valid URL" })
|
|
40676
41218
|
});
|
|
40677
41219
|
const RequestAuthorizationParamsSchema = object$4({
|
|
40678
|
-
response_type: literal("code"),
|
|
41220
|
+
response_type: literal$1("code"),
|
|
40679
41221
|
code_challenge: string$5(),
|
|
40680
|
-
code_challenge_method: literal("S256"),
|
|
41222
|
+
code_challenge_method: literal$1("S256"),
|
|
40681
41223
|
scope: string$5().optional(),
|
|
40682
41224
|
state: string$5().optional(),
|
|
40683
41225
|
resource: url().optional()
|
|
@@ -40729,7 +41271,7 @@ const CursorSchema = string$5();
|
|
|
40729
41271
|
/**
|
|
40730
41272
|
* Task creation parameters, used to ask that the server create a task to represent a request.
|
|
40731
41273
|
*/
|
|
40732
|
-
const TaskCreationParamsSchema = looseObject({
|
|
41274
|
+
const TaskCreationParamsSchema = looseObject$1({
|
|
40733
41275
|
/**
|
|
40734
41276
|
* Requested duration in milliseconds to retain task from creation.
|
|
40735
41277
|
*/
|
|
@@ -40745,7 +41287,7 @@ const TaskMetadataSchema = object$4({ ttl: number$4().optional() });
|
|
|
40745
41287
|
* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
|
|
40746
41288
|
*/
|
|
40747
41289
|
const RelatedTaskMetadataSchema = object$4({ taskId: string$5() });
|
|
40748
|
-
const RequestMetaSchema = looseObject({
|
|
41290
|
+
const RequestMetaSchema = looseObject$1({
|
|
40749
41291
|
/**
|
|
40750
41292
|
* If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
|
|
40751
41293
|
*/
|
|
@@ -40797,7 +41339,7 @@ const NotificationSchema = object$4({
|
|
|
40797
41339
|
method: string$5(),
|
|
40798
41340
|
params: NotificationsParamsSchema.loose().optional()
|
|
40799
41341
|
});
|
|
40800
|
-
const ResultSchema = looseObject({
|
|
41342
|
+
const ResultSchema = looseObject$1({
|
|
40801
41343
|
/**
|
|
40802
41344
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
40803
41345
|
* for notes on _meta usage.
|
|
@@ -40811,7 +41353,7 @@ const RequestIdSchema = union$2([string$5(), number$4().int()]);
|
|
|
40811
41353
|
* A request that expects a response.
|
|
40812
41354
|
*/
|
|
40813
41355
|
const JSONRPCRequestSchema = object$4({
|
|
40814
|
-
jsonrpc: literal("2.0"),
|
|
41356
|
+
jsonrpc: literal$1("2.0"),
|
|
40815
41357
|
id: RequestIdSchema,
|
|
40816
41358
|
...RequestSchema.shape
|
|
40817
41359
|
}).strict();
|
|
@@ -40820,7 +41362,7 @@ const isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).succes
|
|
|
40820
41362
|
* A notification which does not expect a response.
|
|
40821
41363
|
*/
|
|
40822
41364
|
const JSONRPCNotificationSchema = object$4({
|
|
40823
|
-
jsonrpc: literal("2.0"),
|
|
41365
|
+
jsonrpc: literal$1("2.0"),
|
|
40824
41366
|
...NotificationSchema.shape
|
|
40825
41367
|
}).strict();
|
|
40826
41368
|
const isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
|
|
@@ -40828,7 +41370,7 @@ const isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(val
|
|
|
40828
41370
|
* A successful (non-error) response to a request.
|
|
40829
41371
|
*/
|
|
40830
41372
|
const JSONRPCResultResponseSchema = object$4({
|
|
40831
|
-
jsonrpc: literal("2.0"),
|
|
41373
|
+
jsonrpc: literal$1("2.0"),
|
|
40832
41374
|
id: RequestIdSchema,
|
|
40833
41375
|
result: ResultSchema
|
|
40834
41376
|
}).strict();
|
|
@@ -40857,7 +41399,7 @@ var ErrorCode;
|
|
|
40857
41399
|
* A response to a request that indicates an error occurred.
|
|
40858
41400
|
*/
|
|
40859
41401
|
const JSONRPCErrorResponseSchema = object$4({
|
|
40860
|
-
jsonrpc: literal("2.0"),
|
|
41402
|
+
jsonrpc: literal$1("2.0"),
|
|
40861
41403
|
id: RequestIdSchema.optional(),
|
|
40862
41404
|
error: object$4({
|
|
40863
41405
|
/**
|
|
@@ -40914,7 +41456,7 @@ const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
|
40914
41456
|
* A client MUST NOT attempt to cancel its `initialize` request.
|
|
40915
41457
|
*/
|
|
40916
41458
|
const CancelledNotificationSchema = NotificationSchema.extend({
|
|
40917
|
-
method: literal("notifications/cancelled"),
|
|
41459
|
+
method: literal$1("notifications/cancelled"),
|
|
40918
41460
|
params: CancelledNotificationParamsSchema
|
|
40919
41461
|
});
|
|
40920
41462
|
/**
|
|
@@ -41011,7 +41553,7 @@ const ElicitationCapabilitySchema = preprocess$1((value) => {
|
|
|
41011
41553
|
/**
|
|
41012
41554
|
* Task capabilities for clients, indicating which request types support task creation.
|
|
41013
41555
|
*/
|
|
41014
|
-
const ClientTasksCapabilitySchema = looseObject({
|
|
41556
|
+
const ClientTasksCapabilitySchema = looseObject$1({
|
|
41015
41557
|
/**
|
|
41016
41558
|
* Present if the client supports listing tasks.
|
|
41017
41559
|
*/
|
|
@@ -41023,21 +41565,21 @@ const ClientTasksCapabilitySchema = looseObject({
|
|
|
41023
41565
|
/**
|
|
41024
41566
|
* Capabilities for task creation on specific request types.
|
|
41025
41567
|
*/
|
|
41026
|
-
requests: looseObject({
|
|
41568
|
+
requests: looseObject$1({
|
|
41027
41569
|
/**
|
|
41028
41570
|
* Task support for sampling requests.
|
|
41029
41571
|
*/
|
|
41030
|
-
sampling: looseObject({ createMessage: AssertObjectSchema.optional() }).optional(),
|
|
41572
|
+
sampling: looseObject$1({ createMessage: AssertObjectSchema.optional() }).optional(),
|
|
41031
41573
|
/**
|
|
41032
41574
|
* Task support for elicitation requests.
|
|
41033
41575
|
*/
|
|
41034
|
-
elicitation: looseObject({ create: AssertObjectSchema.optional() }).optional()
|
|
41576
|
+
elicitation: looseObject$1({ create: AssertObjectSchema.optional() }).optional()
|
|
41035
41577
|
}).optional()
|
|
41036
41578
|
});
|
|
41037
41579
|
/**
|
|
41038
41580
|
* Task capabilities for servers, indicating which request types support task creation.
|
|
41039
41581
|
*/
|
|
41040
|
-
const ServerTasksCapabilitySchema = looseObject({
|
|
41582
|
+
const ServerTasksCapabilitySchema = looseObject$1({
|
|
41041
41583
|
/**
|
|
41042
41584
|
* Present if the server supports listing tasks.
|
|
41043
41585
|
*/
|
|
@@ -41049,11 +41591,11 @@ const ServerTasksCapabilitySchema = looseObject({
|
|
|
41049
41591
|
/**
|
|
41050
41592
|
* Capabilities for task creation on specific request types.
|
|
41051
41593
|
*/
|
|
41052
|
-
requests: looseObject({
|
|
41594
|
+
requests: looseObject$1({
|
|
41053
41595
|
/**
|
|
41054
41596
|
* Task support for tool requests.
|
|
41055
41597
|
*/
|
|
41056
|
-
tools: looseObject({ call: AssertObjectSchema.optional() }).optional() }).optional()
|
|
41598
|
+
tools: looseObject$1({ call: AssertObjectSchema.optional() }).optional() }).optional()
|
|
41057
41599
|
});
|
|
41058
41600
|
/**
|
|
41059
41601
|
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
|
@@ -41110,7 +41652,7 @@ const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
41110
41652
|
* This request is sent from the client to the server when it first connects, asking it to begin initialization.
|
|
41111
41653
|
*/
|
|
41112
41654
|
const InitializeRequestSchema = RequestSchema.extend({
|
|
41113
|
-
method: literal("initialize"),
|
|
41655
|
+
method: literal$1("initialize"),
|
|
41114
41656
|
params: InitializeRequestParamsSchema
|
|
41115
41657
|
});
|
|
41116
41658
|
const isInitializeRequest = (value) => InitializeRequestSchema.safeParse(value).success;
|
|
@@ -41189,7 +41731,7 @@ const InitializeResultSchema = ResultSchema.extend({
|
|
|
41189
41731
|
* This notification is sent from the client to the server after initialization has finished.
|
|
41190
41732
|
*/
|
|
41191
41733
|
const InitializedNotificationSchema = NotificationSchema.extend({
|
|
41192
|
-
method: literal("notifications/initialized"),
|
|
41734
|
+
method: literal$1("notifications/initialized"),
|
|
41193
41735
|
params: NotificationsParamsSchema.optional()
|
|
41194
41736
|
});
|
|
41195
41737
|
const isInitializedNotification = (value) => InitializedNotificationSchema.safeParse(value).success;
|
|
@@ -41197,7 +41739,7 @@ const isInitializedNotification = (value) => InitializedNotificationSchema.safeP
|
|
|
41197
41739
|
* A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
|
|
41198
41740
|
*/
|
|
41199
41741
|
const PingRequestSchema = RequestSchema.extend({
|
|
41200
|
-
method: literal("ping"),
|
|
41742
|
+
method: literal$1("ping"),
|
|
41201
41743
|
params: BaseRequestParamsSchema.optional()
|
|
41202
41744
|
});
|
|
41203
41745
|
const ProgressSchema = object$4({
|
|
@@ -41228,7 +41770,7 @@ const ProgressNotificationParamsSchema = object$4({
|
|
|
41228
41770
|
* @category notifications/progress
|
|
41229
41771
|
*/
|
|
41230
41772
|
const ProgressNotificationSchema = NotificationSchema.extend({
|
|
41231
|
-
method: literal("notifications/progress"),
|
|
41773
|
+
method: literal$1("notifications/progress"),
|
|
41232
41774
|
params: ProgressNotificationParamsSchema
|
|
41233
41775
|
});
|
|
41234
41776
|
const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
@@ -41291,14 +41833,14 @@ const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskS
|
|
|
41291
41833
|
* A notification sent when a task's status changes.
|
|
41292
41834
|
*/
|
|
41293
41835
|
const TaskStatusNotificationSchema = NotificationSchema.extend({
|
|
41294
|
-
method: literal("notifications/tasks/status"),
|
|
41836
|
+
method: literal$1("notifications/tasks/status"),
|
|
41295
41837
|
params: TaskStatusNotificationParamsSchema
|
|
41296
41838
|
});
|
|
41297
41839
|
/**
|
|
41298
41840
|
* A request to get the state of a specific task.
|
|
41299
41841
|
*/
|
|
41300
41842
|
const GetTaskRequestSchema = RequestSchema.extend({
|
|
41301
|
-
method: literal("tasks/get"),
|
|
41843
|
+
method: literal$1("tasks/get"),
|
|
41302
41844
|
params: BaseRequestParamsSchema.extend({ taskId: string$5() })
|
|
41303
41845
|
});
|
|
41304
41846
|
/**
|
|
@@ -41309,7 +41851,7 @@ const GetTaskResultSchema = ResultSchema.merge(TaskSchema);
|
|
|
41309
41851
|
* A request to get the result of a specific task.
|
|
41310
41852
|
*/
|
|
41311
41853
|
const GetTaskPayloadRequestSchema = RequestSchema.extend({
|
|
41312
|
-
method: literal("tasks/result"),
|
|
41854
|
+
method: literal$1("tasks/result"),
|
|
41313
41855
|
params: BaseRequestParamsSchema.extend({ taskId: string$5() })
|
|
41314
41856
|
});
|
|
41315
41857
|
/**
|
|
@@ -41322,7 +41864,7 @@ const GetTaskPayloadResultSchema = ResultSchema.loose();
|
|
|
41322
41864
|
/**
|
|
41323
41865
|
* A request to list tasks.
|
|
41324
41866
|
*/
|
|
41325
|
-
const ListTasksRequestSchema = PaginatedRequestSchema.extend({ method: literal("tasks/list") });
|
|
41867
|
+
const ListTasksRequestSchema = PaginatedRequestSchema.extend({ method: literal$1("tasks/list") });
|
|
41326
41868
|
/**
|
|
41327
41869
|
* The response to a tasks/list request.
|
|
41328
41870
|
*/
|
|
@@ -41331,7 +41873,7 @@ const ListTasksResultSchema = PaginatedResultSchema.extend({ tasks: array$1(Task
|
|
|
41331
41873
|
* A request to cancel a specific task.
|
|
41332
41874
|
*/
|
|
41333
41875
|
const CancelTaskRequestSchema = RequestSchema.extend({
|
|
41334
|
-
method: literal("tasks/cancel"),
|
|
41876
|
+
method: literal$1("tasks/cancel"),
|
|
41335
41877
|
params: BaseRequestParamsSchema.extend({ taskId: string$5() })
|
|
41336
41878
|
});
|
|
41337
41879
|
/**
|
|
@@ -41434,7 +41976,7 @@ const ResourceSchema = object$4({
|
|
|
41434
41976
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
41435
41977
|
* for notes on _meta usage.
|
|
41436
41978
|
*/
|
|
41437
|
-
_meta: optional$3(looseObject({}))
|
|
41979
|
+
_meta: optional$3(looseObject$1({}))
|
|
41438
41980
|
});
|
|
41439
41981
|
/**
|
|
41440
41982
|
* A template description for resources available on the server.
|
|
@@ -41464,12 +42006,12 @@ const ResourceTemplateSchema = object$4({
|
|
|
41464
42006
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
41465
42007
|
* for notes on _meta usage.
|
|
41466
42008
|
*/
|
|
41467
|
-
_meta: optional$3(looseObject({}))
|
|
42009
|
+
_meta: optional$3(looseObject$1({}))
|
|
41468
42010
|
});
|
|
41469
42011
|
/**
|
|
41470
42012
|
* Sent from the client to request a list of resources the server has.
|
|
41471
42013
|
*/
|
|
41472
|
-
const ListResourcesRequestSchema = PaginatedRequestSchema.extend({ method: literal("resources/list") });
|
|
42014
|
+
const ListResourcesRequestSchema = PaginatedRequestSchema.extend({ method: literal$1("resources/list") });
|
|
41473
42015
|
/**
|
|
41474
42016
|
* The server's response to a resources/list request from the client.
|
|
41475
42017
|
*/
|
|
@@ -41477,7 +42019,7 @@ const ListResourcesResultSchema = PaginatedResultSchema.extend({ resources: arra
|
|
|
41477
42019
|
/**
|
|
41478
42020
|
* Sent from the client to request a list of resource templates the server has.
|
|
41479
42021
|
*/
|
|
41480
|
-
const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ method: literal("resources/templates/list") });
|
|
42022
|
+
const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ method: literal$1("resources/templates/list") });
|
|
41481
42023
|
/**
|
|
41482
42024
|
* The server's response to a resources/templates/list request from the client.
|
|
41483
42025
|
*/
|
|
@@ -41497,7 +42039,7 @@ const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
|
|
|
41497
42039
|
* Sent from the client to the server, to read a specific resource URI.
|
|
41498
42040
|
*/
|
|
41499
42041
|
const ReadResourceRequestSchema = RequestSchema.extend({
|
|
41500
|
-
method: literal("resources/read"),
|
|
42042
|
+
method: literal$1("resources/read"),
|
|
41501
42043
|
params: ReadResourceRequestParamsSchema
|
|
41502
42044
|
});
|
|
41503
42045
|
/**
|
|
@@ -41508,7 +42050,7 @@ const ReadResourceResultSchema = ResultSchema.extend({ contents: array$1(union$2
|
|
|
41508
42050
|
* An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
|
|
41509
42051
|
*/
|
|
41510
42052
|
const ResourceListChangedNotificationSchema = NotificationSchema.extend({
|
|
41511
|
-
method: literal("notifications/resources/list_changed"),
|
|
42053
|
+
method: literal$1("notifications/resources/list_changed"),
|
|
41512
42054
|
params: NotificationsParamsSchema.optional()
|
|
41513
42055
|
});
|
|
41514
42056
|
const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
|
|
@@ -41516,7 +42058,7 @@ const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
|
|
|
41516
42058
|
* Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
|
|
41517
42059
|
*/
|
|
41518
42060
|
const SubscribeRequestSchema = RequestSchema.extend({
|
|
41519
|
-
method: literal("resources/subscribe"),
|
|
42061
|
+
method: literal$1("resources/subscribe"),
|
|
41520
42062
|
params: SubscribeRequestParamsSchema
|
|
41521
42063
|
});
|
|
41522
42064
|
const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
|
|
@@ -41524,7 +42066,7 @@ const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
|
|
|
41524
42066
|
* Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
|
|
41525
42067
|
*/
|
|
41526
42068
|
const UnsubscribeRequestSchema = RequestSchema.extend({
|
|
41527
|
-
method: literal("resources/unsubscribe"),
|
|
42069
|
+
method: literal$1("resources/unsubscribe"),
|
|
41528
42070
|
params: UnsubscribeRequestParamsSchema
|
|
41529
42071
|
});
|
|
41530
42072
|
/**
|
|
@@ -41539,7 +42081,7 @@ uri: string$5() });
|
|
|
41539
42081
|
* A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
|
|
41540
42082
|
*/
|
|
41541
42083
|
const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
|
|
41542
|
-
method: literal("notifications/resources/updated"),
|
|
42084
|
+
method: literal$1("notifications/resources/updated"),
|
|
41543
42085
|
params: ResourceUpdatedNotificationParamsSchema
|
|
41544
42086
|
});
|
|
41545
42087
|
/**
|
|
@@ -41577,12 +42119,12 @@ const PromptSchema = object$4({
|
|
|
41577
42119
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
41578
42120
|
* for notes on _meta usage.
|
|
41579
42121
|
*/
|
|
41580
|
-
_meta: optional$3(looseObject({}))
|
|
42122
|
+
_meta: optional$3(looseObject$1({}))
|
|
41581
42123
|
});
|
|
41582
42124
|
/**
|
|
41583
42125
|
* Sent from the client to request a list of prompts and prompt templates the server has.
|
|
41584
42126
|
*/
|
|
41585
|
-
const ListPromptsRequestSchema = PaginatedRequestSchema.extend({ method: literal("prompts/list") });
|
|
42127
|
+
const ListPromptsRequestSchema = PaginatedRequestSchema.extend({ method: literal$1("prompts/list") });
|
|
41586
42128
|
/**
|
|
41587
42129
|
* The server's response to a prompts/list request from the client.
|
|
41588
42130
|
*/
|
|
@@ -41604,14 +42146,14 @@ const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
41604
42146
|
* Used by the client to get a prompt provided by the server.
|
|
41605
42147
|
*/
|
|
41606
42148
|
const GetPromptRequestSchema = RequestSchema.extend({
|
|
41607
|
-
method: literal("prompts/get"),
|
|
42149
|
+
method: literal$1("prompts/get"),
|
|
41608
42150
|
params: GetPromptRequestParamsSchema
|
|
41609
42151
|
});
|
|
41610
42152
|
/**
|
|
41611
42153
|
* Text provided to or from an LLM.
|
|
41612
42154
|
*/
|
|
41613
42155
|
const TextContentSchema = object$4({
|
|
41614
|
-
type: literal("text"),
|
|
42156
|
+
type: literal$1("text"),
|
|
41615
42157
|
/**
|
|
41616
42158
|
* The text content of the message.
|
|
41617
42159
|
*/
|
|
@@ -41630,7 +42172,7 @@ const TextContentSchema = object$4({
|
|
|
41630
42172
|
* An image provided to or from an LLM.
|
|
41631
42173
|
*/
|
|
41632
42174
|
const ImageContentSchema = object$4({
|
|
41633
|
-
type: literal("image"),
|
|
42175
|
+
type: literal$1("image"),
|
|
41634
42176
|
/**
|
|
41635
42177
|
* The base64-encoded image data.
|
|
41636
42178
|
*/
|
|
@@ -41653,7 +42195,7 @@ const ImageContentSchema = object$4({
|
|
|
41653
42195
|
* An Audio provided to or from an LLM.
|
|
41654
42196
|
*/
|
|
41655
42197
|
const AudioContentSchema = object$4({
|
|
41656
|
-
type: literal("audio"),
|
|
42198
|
+
type: literal$1("audio"),
|
|
41657
42199
|
/**
|
|
41658
42200
|
* The base64-encoded audio data.
|
|
41659
42201
|
*/
|
|
@@ -41677,7 +42219,7 @@ const AudioContentSchema = object$4({
|
|
|
41677
42219
|
* Represents the assistant's request to use a tool.
|
|
41678
42220
|
*/
|
|
41679
42221
|
const ToolUseContentSchema = object$4({
|
|
41680
|
-
type: literal("tool_use"),
|
|
42222
|
+
type: literal$1("tool_use"),
|
|
41681
42223
|
/**
|
|
41682
42224
|
* The name of the tool to invoke.
|
|
41683
42225
|
* Must match a tool name from the request's tools array.
|
|
@@ -41703,7 +42245,7 @@ const ToolUseContentSchema = object$4({
|
|
|
41703
42245
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
41704
42246
|
*/
|
|
41705
42247
|
const EmbeddedResourceSchema = object$4({
|
|
41706
|
-
type: literal("resource"),
|
|
42248
|
+
type: literal$1("resource"),
|
|
41707
42249
|
resource: union$2([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
41708
42250
|
/**
|
|
41709
42251
|
* Optional annotations for the client.
|
|
@@ -41720,7 +42262,7 @@ const EmbeddedResourceSchema = object$4({
|
|
|
41720
42262
|
*
|
|
41721
42263
|
* Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
|
|
41722
42264
|
*/
|
|
41723
|
-
const ResourceLinkSchema = ResourceSchema.extend({ type: literal("resource_link") });
|
|
42265
|
+
const ResourceLinkSchema = ResourceSchema.extend({ type: literal$1("resource_link") });
|
|
41724
42266
|
/**
|
|
41725
42267
|
* A content block that can be used in prompts and tool results.
|
|
41726
42268
|
*/
|
|
@@ -41752,7 +42294,7 @@ const GetPromptResultSchema = ResultSchema.extend({
|
|
|
41752
42294
|
* An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
|
|
41753
42295
|
*/
|
|
41754
42296
|
const PromptListChangedNotificationSchema = NotificationSchema.extend({
|
|
41755
|
-
method: literal("notifications/prompts/list_changed"),
|
|
42297
|
+
method: literal$1("notifications/prompts/list_changed"),
|
|
41756
42298
|
params: NotificationsParamsSchema.optional()
|
|
41757
42299
|
});
|
|
41758
42300
|
/**
|
|
@@ -41836,7 +42378,7 @@ const ToolSchema = object$4({
|
|
|
41836
42378
|
* Must have type: 'object' at the root level per MCP spec.
|
|
41837
42379
|
*/
|
|
41838
42380
|
inputSchema: object$4({
|
|
41839
|
-
type: literal("object"),
|
|
42381
|
+
type: literal$1("object"),
|
|
41840
42382
|
properties: record$2(string$5(), AssertObjectSchema).optional(),
|
|
41841
42383
|
required: array$1(string$5()).optional()
|
|
41842
42384
|
}).catchall(unknown$3()),
|
|
@@ -41846,7 +42388,7 @@ const ToolSchema = object$4({
|
|
|
41846
42388
|
* Must have type: 'object' at the root level per MCP spec.
|
|
41847
42389
|
*/
|
|
41848
42390
|
outputSchema: object$4({
|
|
41849
|
-
type: literal("object"),
|
|
42391
|
+
type: literal$1("object"),
|
|
41850
42392
|
properties: record$2(string$5(), AssertObjectSchema).optional(),
|
|
41851
42393
|
required: array$1(string$5()).optional()
|
|
41852
42394
|
}).catchall(unknown$3()).optional(),
|
|
@@ -41867,7 +42409,7 @@ const ToolSchema = object$4({
|
|
|
41867
42409
|
/**
|
|
41868
42410
|
* Sent from the client to request a list of tools the server has.
|
|
41869
42411
|
*/
|
|
41870
|
-
const ListToolsRequestSchema = PaginatedRequestSchema.extend({ method: literal("tools/list") });
|
|
42412
|
+
const ListToolsRequestSchema = PaginatedRequestSchema.extend({ method: literal$1("tools/list") });
|
|
41871
42413
|
/**
|
|
41872
42414
|
* The server's response to a tools/list request from the client.
|
|
41873
42415
|
*/
|
|
@@ -41926,14 +42468,14 @@ const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
41926
42468
|
* Used by the client to invoke a tool provided by the server.
|
|
41927
42469
|
*/
|
|
41928
42470
|
const CallToolRequestSchema = RequestSchema.extend({
|
|
41929
|
-
method: literal("tools/call"),
|
|
42471
|
+
method: literal$1("tools/call"),
|
|
41930
42472
|
params: CallToolRequestParamsSchema
|
|
41931
42473
|
});
|
|
41932
42474
|
/**
|
|
41933
42475
|
* An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
|
|
41934
42476
|
*/
|
|
41935
42477
|
const ToolListChangedNotificationSchema = NotificationSchema.extend({
|
|
41936
|
-
method: literal("notifications/tools/list_changed"),
|
|
42478
|
+
method: literal$1("notifications/tools/list_changed"),
|
|
41937
42479
|
params: NotificationsParamsSchema.optional()
|
|
41938
42480
|
});
|
|
41939
42481
|
/**
|
|
@@ -41985,7 +42527,7 @@ level: LoggingLevelSchema });
|
|
|
41985
42527
|
* A request from the client to the server, to enable or adjust logging.
|
|
41986
42528
|
*/
|
|
41987
42529
|
const SetLevelRequestSchema = RequestSchema.extend({
|
|
41988
|
-
method: literal("logging/setLevel"),
|
|
42530
|
+
method: literal$1("logging/setLevel"),
|
|
41989
42531
|
params: SetLevelRequestParamsSchema
|
|
41990
42532
|
});
|
|
41991
42533
|
/**
|
|
@@ -42009,7 +42551,7 @@ const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend(
|
|
|
42009
42551
|
* Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
|
|
42010
42552
|
*/
|
|
42011
42553
|
const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
|
42012
|
-
method: literal("notifications/message"),
|
|
42554
|
+
method: literal$1("notifications/message"),
|
|
42013
42555
|
params: LoggingMessageNotificationParamsSchema
|
|
42014
42556
|
});
|
|
42015
42557
|
/**
|
|
@@ -42061,7 +42603,7 @@ mode: _enum$1([
|
|
|
42061
42603
|
* Represents the outcome of invoking a tool requested via ToolUseContent.
|
|
42062
42604
|
*/
|
|
42063
42605
|
const ToolResultContentSchema = object$4({
|
|
42064
|
-
type: literal("tool_result"),
|
|
42606
|
+
type: literal$1("tool_result"),
|
|
42065
42607
|
toolUseId: string$5().describe("The unique identifier for the corresponding tool call."),
|
|
42066
42608
|
content: array$1(ContentBlockSchema).default([]),
|
|
42067
42609
|
structuredContent: object$4({}).loose().optional(),
|
|
@@ -42157,7 +42699,7 @@ const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend
|
|
|
42157
42699
|
* A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
|
|
42158
42700
|
*/
|
|
42159
42701
|
const CreateMessageRequestSchema = RequestSchema.extend({
|
|
42160
|
-
method: literal("sampling/createMessage"),
|
|
42702
|
+
method: literal$1("sampling/createMessage"),
|
|
42161
42703
|
params: CreateMessageRequestParamsSchema
|
|
42162
42704
|
});
|
|
42163
42705
|
/**
|
|
@@ -42227,7 +42769,7 @@ const CreateMessageResultWithToolsSchema = ResultSchema.extend({
|
|
|
42227
42769
|
* Primitive schema definition for boolean fields.
|
|
42228
42770
|
*/
|
|
42229
42771
|
const BooleanSchemaSchema = object$4({
|
|
42230
|
-
type: literal("boolean"),
|
|
42772
|
+
type: literal$1("boolean"),
|
|
42231
42773
|
title: string$5().optional(),
|
|
42232
42774
|
description: string$5().optional(),
|
|
42233
42775
|
default: boolean$3().optional()
|
|
@@ -42236,7 +42778,7 @@ const BooleanSchemaSchema = object$4({
|
|
|
42236
42778
|
* Primitive schema definition for string fields.
|
|
42237
42779
|
*/
|
|
42238
42780
|
const StringSchemaSchema = object$4({
|
|
42239
|
-
type: literal("string"),
|
|
42781
|
+
type: literal$1("string"),
|
|
42240
42782
|
title: string$5().optional(),
|
|
42241
42783
|
description: string$5().optional(),
|
|
42242
42784
|
minLength: number$4().optional(),
|
|
@@ -42264,7 +42806,7 @@ const NumberSchemaSchema = object$4({
|
|
|
42264
42806
|
* Schema for single-selection enumeration without display titles for options.
|
|
42265
42807
|
*/
|
|
42266
42808
|
const UntitledSingleSelectEnumSchemaSchema = object$4({
|
|
42267
|
-
type: literal("string"),
|
|
42809
|
+
type: literal$1("string"),
|
|
42268
42810
|
title: string$5().optional(),
|
|
42269
42811
|
description: string$5().optional(),
|
|
42270
42812
|
enum: array$1(string$5()),
|
|
@@ -42274,7 +42816,7 @@ const UntitledSingleSelectEnumSchemaSchema = object$4({
|
|
|
42274
42816
|
* Schema for single-selection enumeration with display titles for each option.
|
|
42275
42817
|
*/
|
|
42276
42818
|
const TitledSingleSelectEnumSchemaSchema = object$4({
|
|
42277
|
-
type: literal("string"),
|
|
42819
|
+
type: literal$1("string"),
|
|
42278
42820
|
title: string$5().optional(),
|
|
42279
42821
|
description: string$5().optional(),
|
|
42280
42822
|
oneOf: array$1(object$4({
|
|
@@ -42288,7 +42830,7 @@ const TitledSingleSelectEnumSchemaSchema = object$4({
|
|
|
42288
42830
|
* This interface will be removed in a future version.
|
|
42289
42831
|
*/
|
|
42290
42832
|
const LegacyTitledEnumSchemaSchema = object$4({
|
|
42291
|
-
type: literal("string"),
|
|
42833
|
+
type: literal$1("string"),
|
|
42292
42834
|
title: string$5().optional(),
|
|
42293
42835
|
description: string$5().optional(),
|
|
42294
42836
|
enum: array$1(string$5()),
|
|
@@ -42300,13 +42842,13 @@ const SingleSelectEnumSchemaSchema = union$2([UntitledSingleSelectEnumSchemaSche
|
|
|
42300
42842
|
* Schema for multiple-selection enumeration without display titles for options.
|
|
42301
42843
|
*/
|
|
42302
42844
|
const UntitledMultiSelectEnumSchemaSchema = object$4({
|
|
42303
|
-
type: literal("array"),
|
|
42845
|
+
type: literal$1("array"),
|
|
42304
42846
|
title: string$5().optional(),
|
|
42305
42847
|
description: string$5().optional(),
|
|
42306
42848
|
minItems: number$4().optional(),
|
|
42307
42849
|
maxItems: number$4().optional(),
|
|
42308
42850
|
items: object$4({
|
|
42309
|
-
type: literal("string"),
|
|
42851
|
+
type: literal$1("string"),
|
|
42310
42852
|
enum: array$1(string$5())
|
|
42311
42853
|
}),
|
|
42312
42854
|
default: array$1(string$5()).optional()
|
|
@@ -42315,7 +42857,7 @@ const UntitledMultiSelectEnumSchemaSchema = object$4({
|
|
|
42315
42857
|
* Schema for multiple-selection enumeration with display titles for each option.
|
|
42316
42858
|
*/
|
|
42317
42859
|
const TitledMultiSelectEnumSchemaSchema = object$4({
|
|
42318
|
-
type: literal("array"),
|
|
42860
|
+
type: literal$1("array"),
|
|
42319
42861
|
title: string$5().optional(),
|
|
42320
42862
|
description: string$5().optional(),
|
|
42321
42863
|
minItems: number$4().optional(),
|
|
@@ -42356,7 +42898,7 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
42356
42898
|
*
|
|
42357
42899
|
* Optional for backward compatibility. Clients MUST treat missing mode as "form".
|
|
42358
42900
|
*/
|
|
42359
|
-
mode: literal("form").optional(),
|
|
42901
|
+
mode: literal$1("form").optional(),
|
|
42360
42902
|
/**
|
|
42361
42903
|
* The message to present to the user describing what information is being requested.
|
|
42362
42904
|
*/
|
|
@@ -42366,7 +42908,7 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
42366
42908
|
* Only top-level properties are allowed, without nesting.
|
|
42367
42909
|
*/
|
|
42368
42910
|
requestedSchema: object$4({
|
|
42369
|
-
type: literal("object"),
|
|
42911
|
+
type: literal$1("object"),
|
|
42370
42912
|
properties: record$2(string$5(), PrimitiveSchemaDefinitionSchema),
|
|
42371
42913
|
required: array$1(string$5()).optional()
|
|
42372
42914
|
})
|
|
@@ -42378,7 +42920,7 @@ const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
42378
42920
|
/**
|
|
42379
42921
|
* The elicitation mode.
|
|
42380
42922
|
*/
|
|
42381
|
-
mode: literal("url"),
|
|
42923
|
+
mode: literal$1("url"),
|
|
42382
42924
|
/**
|
|
42383
42925
|
* The message to present to the user explaining why the interaction is needed.
|
|
42384
42926
|
*/
|
|
@@ -42403,7 +42945,7 @@ const ElicitRequestParamsSchema = union$2([ElicitRequestFormParamsSchema, Elicit
|
|
|
42403
42945
|
* or navigate to a URL (URL mode).
|
|
42404
42946
|
*/
|
|
42405
42947
|
const ElicitRequestSchema = RequestSchema.extend({
|
|
42406
|
-
method: literal("elicitation/create"),
|
|
42948
|
+
method: literal$1("elicitation/create"),
|
|
42407
42949
|
params: ElicitRequestParamsSchema
|
|
42408
42950
|
});
|
|
42409
42951
|
/**
|
|
@@ -42422,7 +42964,7 @@ elicitationId: string$5() });
|
|
|
42422
42964
|
* @category notifications/elicitation/complete
|
|
42423
42965
|
*/
|
|
42424
42966
|
const ElicitationCompleteNotificationSchema = NotificationSchema.extend({
|
|
42425
|
-
method: literal("notifications/elicitation/complete"),
|
|
42967
|
+
method: literal$1("notifications/elicitation/complete"),
|
|
42426
42968
|
params: ElicitationCompleteNotificationParamsSchema
|
|
42427
42969
|
});
|
|
42428
42970
|
/**
|
|
@@ -42457,7 +42999,7 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
42457
42999
|
* A reference to a resource or resource template definition.
|
|
42458
43000
|
*/
|
|
42459
43001
|
const ResourceTemplateReferenceSchema = object$4({
|
|
42460
|
-
type: literal("ref/resource"),
|
|
43002
|
+
type: literal$1("ref/resource"),
|
|
42461
43003
|
/**
|
|
42462
43004
|
* The URI or URI template of the resource.
|
|
42463
43005
|
*/
|
|
@@ -42467,7 +43009,7 @@ const ResourceTemplateReferenceSchema = object$4({
|
|
|
42467
43009
|
* Identifies a prompt.
|
|
42468
43010
|
*/
|
|
42469
43011
|
const PromptReferenceSchema = object$4({
|
|
42470
|
-
type: literal("ref/prompt"),
|
|
43012
|
+
type: literal$1("ref/prompt"),
|
|
42471
43013
|
/**
|
|
42472
43014
|
* The name of the prompt or prompt template
|
|
42473
43015
|
*/
|
|
@@ -42501,7 +43043,7 @@ arguments: record$2(string$5(), string$5()).optional() }).optional()
|
|
|
42501
43043
|
* A request from the client to the server, to ask for completion options.
|
|
42502
43044
|
*/
|
|
42503
43045
|
const CompleteRequestSchema = RequestSchema.extend({
|
|
42504
|
-
method: literal("completion/complete"),
|
|
43046
|
+
method: literal$1("completion/complete"),
|
|
42505
43047
|
params: CompleteRequestParamsSchema
|
|
42506
43048
|
});
|
|
42507
43049
|
function assertCompleteRequestPrompt(request) {
|
|
@@ -42513,7 +43055,7 @@ function assertCompleteRequestResourceTemplate(request) {
|
|
|
42513
43055
|
/**
|
|
42514
43056
|
* The server's response to a completion/complete request
|
|
42515
43057
|
*/
|
|
42516
|
-
const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
|
|
43058
|
+
const CompleteResultSchema = ResultSchema.extend({ completion: looseObject$1({
|
|
42517
43059
|
/**
|
|
42518
43060
|
* An array of completion values. Must not exceed 100 items.
|
|
42519
43061
|
*/
|
|
@@ -42549,7 +43091,7 @@ const RootSchema = object$4({
|
|
|
42549
43091
|
* Sent from the server to request a list of root URIs from the client.
|
|
42550
43092
|
*/
|
|
42551
43093
|
const ListRootsRequestSchema = RequestSchema.extend({
|
|
42552
|
-
method: literal("roots/list"),
|
|
43094
|
+
method: literal$1("roots/list"),
|
|
42553
43095
|
params: BaseRequestParamsSchema.optional()
|
|
42554
43096
|
});
|
|
42555
43097
|
/**
|
|
@@ -42560,7 +43102,7 @@ const ListRootsResultSchema = ResultSchema.extend({ roots: array$1(RootSchema) }
|
|
|
42560
43102
|
* A notification from the client to the server, informing it that the list of roots has changed.
|
|
42561
43103
|
*/
|
|
42562
43104
|
const RootsListChangedNotificationSchema = NotificationSchema.extend({
|
|
42563
|
-
method: literal("notifications/roots/list_changed"),
|
|
43105
|
+
method: literal$1("notifications/roots/list_changed"),
|
|
42564
43106
|
params: NotificationsParamsSchema.optional()
|
|
42565
43107
|
});
|
|
42566
43108
|
const ClientRequestSchema = union$2([
|
|
@@ -58699,7 +59241,7 @@ const OPERATION_SET_STATUS = {
|
|
|
58699
59241
|
};
|
|
58700
59242
|
const operationSetRowSchema = object$4({
|
|
58701
59243
|
_msdyn_psserrorlog_value: string$5().nullish(),
|
|
58702
|
-
msdyn_status: literal([
|
|
59244
|
+
msdyn_status: literal$1([
|
|
58703
59245
|
19235e4,
|
|
58704
59246
|
192350001,
|
|
58705
59247
|
192350002,
|
|
@@ -58964,7 +59506,7 @@ function createScheduleApiClient(config) {
|
|
|
58964
59506
|
})
|
|
58965
59507
|
};
|
|
58966
59508
|
}
|
|
58967
|
-
const SERVER_VERSION = "0.5.
|
|
59509
|
+
const SERVER_VERSION = "0.5.26";
|
|
58968
59510
|
/** The most operations one OperationSet will carry. The service's own ceiling. */
|
|
58969
59511
|
const MAX_OPERATIONS = 200;
|
|
58970
59512
|
/**
|
|
@@ -59000,7 +59542,7 @@ const taskCreate = strictObject$1({
|
|
|
59000
59542
|
bucket: bucketRef().describe("The bucket the task goes in"),
|
|
59001
59543
|
description: string$5().optional().describe("Body text for the task, shown under its name"),
|
|
59002
59544
|
finish: instant.optional().describe("When the task is due"),
|
|
59003
|
-
kind: literal("task"),
|
|
59545
|
+
kind: literal$1("task"),
|
|
59004
59546
|
name: string$5().min(1).describe("The new task's name"),
|
|
59005
59547
|
outline_level: number$4().int().min(1).default(1).describe("1 for a top-level task. A subtask is its parent's level plus one — read the parent's msdyn_outlinelevel from the synced tables."),
|
|
59006
59548
|
parent_task: taskRef().optional().describe("Makes this a subtask of that task"),
|
|
@@ -59009,17 +59551,17 @@ const taskCreate = strictObject$1({
|
|
|
59009
59551
|
start: instant.optional().describe("When work on the task starts")
|
|
59010
59552
|
});
|
|
59011
59553
|
const bucketCreate = strictObject$1({
|
|
59012
|
-
kind: literal("bucket"),
|
|
59554
|
+
kind: literal$1("bucket"),
|
|
59013
59555
|
name: string$5().min(1).describe("The new bucket's name"),
|
|
59014
59556
|
ref: string$5().min(1).optional().describe("Name this bucket so tasks in this same submission can go into it")
|
|
59015
59557
|
});
|
|
59016
59558
|
const taskLabelCreate = strictObject$1({
|
|
59017
|
-
kind: literal("task_label"),
|
|
59559
|
+
kind: literal$1("task_label"),
|
|
59018
59560
|
label: existing("label", "msdyn_projectlabelid").describe("The label to put on the task"),
|
|
59019
59561
|
task: taskRef().describe("The task getting the label")
|
|
59020
59562
|
});
|
|
59021
59563
|
const assignmentCreate = strictObject$1({
|
|
59022
|
-
kind: literal("assignment"),
|
|
59564
|
+
kind: literal$1("assignment"),
|
|
59023
59565
|
member: existing("project team member", "msdyn_projectteamid").describe("The team member to assign, from msdyn_projectteams"),
|
|
59024
59566
|
name: string$5().min(1).describe("A label for the assignment, shown on the approval card"),
|
|
59025
59567
|
task: taskRef().describe("The task to assign. A task that has subtasks CANNOT be assigned to — the service refuses it.")
|
|
@@ -59030,7 +59572,7 @@ const taskUpdate = strictObject$1({
|
|
|
59030
59572
|
duration: number$4().optional().describe("Working days. Writing this moves the finish."),
|
|
59031
59573
|
effort: number$4().optional().describe("Hours of work"),
|
|
59032
59574
|
finish: instant.optional(),
|
|
59033
|
-
kind: literal("task"),
|
|
59575
|
+
kind: literal$1("task"),
|
|
59034
59576
|
name: string$5().min(1).optional().describe("Rename the task to this"),
|
|
59035
59577
|
parent_task: taskRef().optional(),
|
|
59036
59578
|
priority: number$4().int().min(0).max(10).optional(),
|
|
@@ -59040,25 +59582,25 @@ const taskUpdate = strictObject$1({
|
|
|
59040
59582
|
}).refine((input) => input.bucket !== void 0 || input.description !== void 0 || input.duration !== void 0 || input.effort !== void 0 || input.finish !== void 0 || input.name !== void 0 || input.parent_task !== void 0 || input.priority !== void 0 || input.progress !== void 0 || input.start !== void 0, { message: "Nothing to update — a task update needs at least one changed field." });
|
|
59041
59583
|
const bucketUpdate = strictObject$1({
|
|
59042
59584
|
bucket: bucketRef().describe("The bucket to change"),
|
|
59043
|
-
kind: literal("bucket"),
|
|
59585
|
+
kind: literal$1("bucket"),
|
|
59044
59586
|
name: string$5().min(1).describe("Rename the bucket to this")
|
|
59045
59587
|
});
|
|
59046
59588
|
const labelUpdate = strictObject$1({
|
|
59047
|
-
kind: literal("label"),
|
|
59589
|
+
kind: literal$1("label"),
|
|
59048
59590
|
label: existing("label", "msdyn_projectlabelid"),
|
|
59049
59591
|
text: string$5().describe("The label's name. A project's labels start unnamed; clearing the text retires one.")
|
|
59050
59592
|
});
|
|
59051
59593
|
const taskDelete = strictObject$1({
|
|
59052
|
-
kind: literal("task"),
|
|
59594
|
+
kind: literal$1("task"),
|
|
59053
59595
|
task: existing("task", "msdyn_projecttaskid")
|
|
59054
59596
|
});
|
|
59055
59597
|
const taskLabelDelete = strictObject$1({
|
|
59056
|
-
kind: literal("task_label"),
|
|
59598
|
+
kind: literal$1("task_label"),
|
|
59057
59599
|
link: existing("task-label link", "msdyn_projecttasktolabelid")
|
|
59058
59600
|
});
|
|
59059
59601
|
const assignmentDelete = strictObject$1({
|
|
59060
59602
|
assignment: existing("assignment", "msdyn_resourceassignmentid"),
|
|
59061
|
-
kind: literal("assignment")
|
|
59603
|
+
kind: literal$1("assignment")
|
|
59062
59604
|
});
|
|
59063
59605
|
const createOperationSchema = discriminatedUnion("kind", [
|
|
59064
59606
|
taskCreate,
|
|
@@ -95483,6 +96025,9 @@ function stemOf(relPath) {
|
|
|
95483
96025
|
function isMarkdownPath(relPath) {
|
|
95484
96026
|
return normalizeRelativePath(relPath).endsWith(".md");
|
|
95485
96027
|
}
|
|
96028
|
+
function isVisibleIndexPath(relPath) {
|
|
96029
|
+
return normalizeRelativePath(relPath).split("/").every((segment) => !segment.startsWith("."));
|
|
96030
|
+
}
|
|
95486
96031
|
function escapesIndexRoot(target) {
|
|
95487
96032
|
return normalizedPathEscapesRoot(normalizeAuthoredPath(target));
|
|
95488
96033
|
}
|
|
@@ -95559,26 +96104,6 @@ function unique(values) {
|
|
|
95559
96104
|
function uniqueSorted(values) {
|
|
95560
96105
|
return unique(values).sort(comparePath);
|
|
95561
96106
|
}
|
|
95562
|
-
function computeBacklinks(docs) {
|
|
95563
|
-
const backlinks = /* @__PURE__ */ new Map();
|
|
95564
|
-
for (const doc of docs) backlinks.set(normalizeLinkTarget(doc.path), backlinks.get(normalizeLinkTarget(doc.path)) ?? []);
|
|
95565
|
-
for (const doc of docs) {
|
|
95566
|
-
const targets = new Set([...doc.outgoingLinks, ...Object.values(doc.relationships).flat()]);
|
|
95567
|
-
for (const target of targets) {
|
|
95568
|
-
const normalized = normalizeLinkTarget(target);
|
|
95569
|
-
addBacklink(backlinks, normalized, doc.path);
|
|
95570
|
-
const resolved = resolveWikilink(normalized, docs);
|
|
95571
|
-
if (resolved) addBacklink(backlinks, normalizeLinkTarget(resolved.path), doc.path);
|
|
95572
|
-
}
|
|
95573
|
-
}
|
|
95574
|
-
for (const [target, sources] of backlinks) backlinks.set(target, sources.sort(comparePath));
|
|
95575
|
-
return backlinks;
|
|
95576
|
-
}
|
|
95577
|
-
function addBacklink(backlinks, target, source) {
|
|
95578
|
-
const sources = backlinks.get(target) ?? [];
|
|
95579
|
-
if (!sources.includes(source)) sources.push(source);
|
|
95580
|
-
backlinks.set(target, sources);
|
|
95581
|
-
}
|
|
95582
96107
|
const MDAST_OPTIONS = {
|
|
95583
96108
|
extensions: [frontmatter()],
|
|
95584
96109
|
mdastExtensions: [frontmatterFromMarkdown()]
|
|
@@ -95662,6 +96187,26 @@ function extractRelationships(frontmatter) {
|
|
|
95662
96187
|
}
|
|
95663
96188
|
return relationships;
|
|
95664
96189
|
}
|
|
96190
|
+
function computeBacklinks(docs) {
|
|
96191
|
+
const backlinks = /* @__PURE__ */ new Map();
|
|
96192
|
+
for (const doc of docs) backlinks.set(normalizeLinkTarget(doc.path), backlinks.get(normalizeLinkTarget(doc.path)) ?? []);
|
|
96193
|
+
for (const doc of docs) {
|
|
96194
|
+
const targets = new Set([...doc.outgoingLinks, ...Object.values(doc.relationships).flat()]);
|
|
96195
|
+
for (const target of targets) {
|
|
96196
|
+
const normalized = normalizeLinkTarget(target);
|
|
96197
|
+
addBacklink(backlinks, normalized, doc.path);
|
|
96198
|
+
const resolved = resolveWikilink(normalized, docs);
|
|
96199
|
+
if (resolved) addBacklink(backlinks, normalizeLinkTarget(resolved.path), doc.path);
|
|
96200
|
+
}
|
|
96201
|
+
}
|
|
96202
|
+
for (const [target, sources] of backlinks) backlinks.set(target, sources.sort(comparePath));
|
|
96203
|
+
return backlinks;
|
|
96204
|
+
}
|
|
96205
|
+
function addBacklink(backlinks, target, source) {
|
|
96206
|
+
const sources = backlinks.get(target) ?? [];
|
|
96207
|
+
if (!sources.includes(source)) sources.push(source);
|
|
96208
|
+
backlinks.set(target, sources);
|
|
96209
|
+
}
|
|
95665
96210
|
const RESERVED = new Set([
|
|
95666
96211
|
"type",
|
|
95667
96212
|
"title",
|
|
@@ -95964,7 +96509,7 @@ var Docs = class {
|
|
|
95964
96509
|
const dirents = await this.fs.readdir(absDir, { withFileTypes: true });
|
|
95965
96510
|
for (const dirent of dirents) {
|
|
95966
96511
|
const relPath = normalizeRelativePath(posixJoin(relDir, dirent.name));
|
|
95967
|
-
if (
|
|
96512
|
+
if (!isVisibleIndexPath(relPath)) continue;
|
|
95968
96513
|
if (dirent.isDirectory()) {
|
|
95969
96514
|
const child = await this.walk(this.abs(relPath), relPath);
|
|
95970
96515
|
markdownFiles.push(...child.markdownFiles);
|
|
@@ -97934,7 +98479,82 @@ function osUsername() {
|
|
|
97934
98479
|
}
|
|
97935
98480
|
|
|
97936
98481
|
//#endregion
|
|
97937
|
-
//#region ../
|
|
98482
|
+
//#region ../db-infra/dist/postgres-DrlDW_Ri.mjs
|
|
98483
|
+
const env$2 = { NODE_ENV: process.env.NODE_ENV };
|
|
98484
|
+
|
|
98485
|
+
//#endregion
|
|
98486
|
+
//#region ../db-infra/dist/ephemeral.mjs
|
|
98487
|
+
const PG_HOST = "postgres://postgres:postgres@127.0.0.1:6489";
|
|
98488
|
+
const ADMIN_URL = `${PG_HOST}/postgres`;
|
|
98489
|
+
async function createEphemeralDatabase(baseName) {
|
|
98490
|
+
const name = `${baseName}_${randomBytes(4).toString("hex")}`;
|
|
98491
|
+
const admin = src_default(ADMIN_URL, { max: 1 });
|
|
98492
|
+
try {
|
|
98493
|
+
await admin.unsafe(`CREATE DATABASE ${name}`);
|
|
98494
|
+
} finally {
|
|
98495
|
+
await admin.end();
|
|
98496
|
+
}
|
|
98497
|
+
return {
|
|
98498
|
+
async drop() {
|
|
98499
|
+
const admin2 = src_default(ADMIN_URL, { max: 1 });
|
|
98500
|
+
try {
|
|
98501
|
+
await admin2`SELECT pg_terminate_backend(pid) FROM pg_stat_activity
|
|
98502
|
+
WHERE datname = ${name} AND pid <> pg_backend_pid()`;
|
|
98503
|
+
await admin2.unsafe(`DROP DATABASE IF EXISTS ${name}`);
|
|
98504
|
+
} finally {
|
|
98505
|
+
await admin2.end();
|
|
98506
|
+
}
|
|
98507
|
+
},
|
|
98508
|
+
url: `${PG_HOST}/${name}`
|
|
98509
|
+
};
|
|
98510
|
+
}
|
|
98511
|
+
function isPerKeyMode(opts) {
|
|
98512
|
+
return opts.migrators !== void 0;
|
|
98513
|
+
}
|
|
98514
|
+
/**
|
|
98515
|
+
* A composition's whole database dance in one call: CREATE a fresh database per
|
|
98516
|
+
* base name, run the migrate step, and hand back the urls + one `dropAll`. If
|
|
98517
|
+
* ANY create or migrate fails, every database already created is dropped before
|
|
98518
|
+
* the error rethrows — a failed boot must not leak `ctx_*_<hex8>` litter.
|
|
98519
|
+
*/
|
|
98520
|
+
async function provisionEphemeralDatabases(opts) {
|
|
98521
|
+
let baseNames;
|
|
98522
|
+
let migrate;
|
|
98523
|
+
if (isPerKeyMode(opts)) {
|
|
98524
|
+
const { migrators } = opts;
|
|
98525
|
+
baseNames = Object.keys(migrators);
|
|
98526
|
+
migrate = async (urls) => {
|
|
98527
|
+
await Promise.all(Object.keys(migrators).map((baseName) => migrators[baseName](urls[baseName])));
|
|
98528
|
+
};
|
|
98529
|
+
} else ({migrate, baseNames} = opts);
|
|
98530
|
+
const settled = await Promise.allSettled(baseNames.map(async (baseName) => ({
|
|
98531
|
+
baseName,
|
|
98532
|
+
db: await createEphemeralDatabase(baseName)
|
|
98533
|
+
})));
|
|
98534
|
+
const created = settled.filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
98535
|
+
const dropAll = async () => {
|
|
98536
|
+
await Promise.all(created.map(({ db }) => db.drop()));
|
|
98537
|
+
};
|
|
98538
|
+
const failed = settled.find((r) => r.status === "rejected");
|
|
98539
|
+
if (failed) {
|
|
98540
|
+
await dropAll();
|
|
98541
|
+
throw failed.reason;
|
|
98542
|
+
}
|
|
98543
|
+
const urls = Object.fromEntries(created.map(({ baseName, db }) => [baseName, db.url]));
|
|
98544
|
+
try {
|
|
98545
|
+
await migrate(urls);
|
|
98546
|
+
} catch (err) {
|
|
98547
|
+
await dropAll();
|
|
98548
|
+
throw err;
|
|
98549
|
+
}
|
|
98550
|
+
return {
|
|
98551
|
+
dropAll,
|
|
98552
|
+
urls
|
|
98553
|
+
};
|
|
98554
|
+
}
|
|
98555
|
+
|
|
98556
|
+
//#endregion
|
|
98557
|
+
//#region ../slate-bridge/dist/platform-harness-B1E8S0il.mjs
|
|
97938
98558
|
const nonEmptyStringSchema = string$5().trim().min(1);
|
|
97939
98559
|
const portSchema = number$3().int().min(0).max(65535).default(7777);
|
|
97940
98560
|
const envSchema = object$4({
|
|
@@ -97943,7 +98563,7 @@ const envSchema = object$4({
|
|
|
97943
98563
|
CTX_PLATFORM_URL: url().default("http://127.0.0.1:3010").transform((url) => url.replace(/\/+$/, "")),
|
|
97944
98564
|
CTX_WEB_URL: url().default("http://localhost:3000").transform((url) => url.replace(/\/+$/, "")),
|
|
97945
98565
|
CTXS_BRIDGE_PORT: portSchema,
|
|
97946
|
-
CTXS_CLAUDE_IMAGE: nonEmptyStringSchema.default("ghcr.io/usecontextlayer/ctx-sandbox:0.5.
|
|
98566
|
+
CTXS_CLAUDE_IMAGE: nonEmptyStringSchema.default("ghcr.io/usecontextlayer/ctx-sandbox:0.5.26"),
|
|
97947
98567
|
CTXS_CLAUDE_MODEL: nonEmptyStringSchema.default("opus"),
|
|
97948
98568
|
CTXS_HOST_CLAUDE_JSON_PATH: nonEmptyStringSchema.default(() => path.join(os.homedir(), ".claude.json")),
|
|
97949
98569
|
NODE_ENV: _enum$1([
|
|
@@ -98362,16 +98982,9 @@ async function createClaudeMicrosandbox(options) {
|
|
|
98362
98982
|
workdir: options.hostProjectDir
|
|
98363
98983
|
});
|
|
98364
98984
|
await ensureHostFilesystemReady(bootConfig.bindMounts);
|
|
98365
|
-
const { guestMemory, sandbox } = await bootSandbox(await import("microsandbox"), bootConfig);
|
|
98366
|
-
let disposePromise = null;
|
|
98985
|
+
const { dispose, guestMemory, sandbox } = await bootSandbox(await import("microsandbox"), bootConfig);
|
|
98367
98986
|
return {
|
|
98368
|
-
dispose
|
|
98369
|
-
if (disposePromise === null) {
|
|
98370
|
-
guestMemory.stop();
|
|
98371
|
-
disposePromise = sandbox.stopWithTimeout(SANDBOX_STOP_TIMEOUT_MS);
|
|
98372
|
-
}
|
|
98373
|
-
return disposePromise;
|
|
98374
|
-
},
|
|
98987
|
+
dispose,
|
|
98375
98988
|
guestMemory: () => guestMemory.read(),
|
|
98376
98989
|
spawn: (spawnOptions) => spawnClaudeProcess(sandbox, spawnOptions)
|
|
98377
98990
|
};
|
|
@@ -98488,11 +99101,7 @@ function generateSandboxName() {
|
|
|
98488
99101
|
}
|
|
98489
99102
|
const VIEW_NAME = /^[\w-]+$/;
|
|
98490
99103
|
const EVAL_TIMEOUT_MS = 1e4;
|
|
98491
|
-
const RESERVED_STATE_KEYS = [
|
|
98492
|
-
"now",
|
|
98493
|
-
"params",
|
|
98494
|
-
"workspaceId"
|
|
98495
|
-
];
|
|
99104
|
+
const RESERVED_STATE_KEYS = ["params", "workspaceId"];
|
|
98496
99105
|
async function runWorkspaceView(opts) {
|
|
98497
99106
|
if (!VIEW_NAME.test(opts.view)) throw new Error(`views/run: invalid view name "${opts.view}"`);
|
|
98498
99107
|
return runSurfacePair({
|
|
@@ -99057,6 +99666,190 @@ async function createBridgeServer(opts) {
|
|
|
99057
99666
|
port: boundPort
|
|
99058
99667
|
};
|
|
99059
99668
|
}
|
|
99669
|
+
const REPO_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "..", "..");
|
|
99670
|
+
const EPHEMERAL_SECRETS_ENCRYPTION_KEY_HEX = "0".repeat(64);
|
|
99671
|
+
function platformEnv(extra) {
|
|
99672
|
+
const env = {
|
|
99673
|
+
...process.env,
|
|
99674
|
+
...extra
|
|
99675
|
+
};
|
|
99676
|
+
delete env.CTX_AUTH_SUB_ID;
|
|
99677
|
+
return env;
|
|
99678
|
+
}
|
|
99679
|
+
const PLATFORM_DATABASES = [
|
|
99680
|
+
"ctx_base_platform",
|
|
99681
|
+
"ctx_pggit",
|
|
99682
|
+
"ctx_secrets",
|
|
99683
|
+
"ctx_slate_platform"
|
|
99684
|
+
];
|
|
99685
|
+
function toPlatformDatabaseEnv(urls) {
|
|
99686
|
+
return {
|
|
99687
|
+
CTX_BASE_DATABASE_URL: urls.ctx_base_platform,
|
|
99688
|
+
CTX_PGGIT_DATABASE_URL: urls.ctx_pggit,
|
|
99689
|
+
CTX_SECRETS_DATABASE_URL: urls.ctx_secrets,
|
|
99690
|
+
CTX_SECRETS_ENCRYPTION_KEY: EPHEMERAL_SECRETS_ENCRYPTION_KEY_HEX,
|
|
99691
|
+
CTX_SLATE_DATABASE_URL: urls.ctx_slate_platform
|
|
99692
|
+
};
|
|
99693
|
+
}
|
|
99694
|
+
async function provisionPlatformDatabases() {
|
|
99695
|
+
const provisioned = await provisionEphemeralDatabases({
|
|
99696
|
+
baseNames: PLATFORM_DATABASES,
|
|
99697
|
+
migrate: (urls) => migrateAll(toPlatformDatabaseEnv(urls))
|
|
99698
|
+
});
|
|
99699
|
+
return {
|
|
99700
|
+
databaseEnv: toPlatformDatabaseEnv(provisioned.urls),
|
|
99701
|
+
dropAll: provisioned.dropAll
|
|
99702
|
+
};
|
|
99703
|
+
}
|
|
99704
|
+
async function migrateAll(databaseEnv) {
|
|
99705
|
+
await runToCompletion([
|
|
99706
|
+
"--filter",
|
|
99707
|
+
"@usecontextlayer/platform",
|
|
99708
|
+
"run",
|
|
99709
|
+
"db.latest"
|
|
99710
|
+
], platformEnv(databaseEnv));
|
|
99711
|
+
}
|
|
99712
|
+
function runToCompletion(args, env) {
|
|
99713
|
+
return new Promise((resolve, reject) => {
|
|
99714
|
+
const proc = spawn("pnpm", args, {
|
|
99715
|
+
cwd: REPO_ROOT,
|
|
99716
|
+
env,
|
|
99717
|
+
stdio: [
|
|
99718
|
+
"ignore",
|
|
99719
|
+
"pipe",
|
|
99720
|
+
"pipe"
|
|
99721
|
+
]
|
|
99722
|
+
});
|
|
99723
|
+
let err = "";
|
|
99724
|
+
proc.stderr?.on("data", (c) => {
|
|
99725
|
+
err += c.toString("utf-8");
|
|
99726
|
+
});
|
|
99727
|
+
proc.once("error", reject);
|
|
99728
|
+
proc.once("exit", (code) => code === 0 ? resolve() : reject(/* @__PURE__ */ new Error(`pnpm ${args.join(" ")} exited ${code}\n${err}`)));
|
|
99729
|
+
});
|
|
99730
|
+
}
|
|
99731
|
+
async function bootPlatform(databaseEnv) {
|
|
99732
|
+
const port = randomInt(2e4, 6e4);
|
|
99733
|
+
const proc = spawn("pnpm", [
|
|
99734
|
+
"--filter",
|
|
99735
|
+
"@usecontextlayer/platform",
|
|
99736
|
+
"run",
|
|
99737
|
+
"start"
|
|
99738
|
+
], {
|
|
99739
|
+
cwd: REPO_ROOT,
|
|
99740
|
+
detached: true,
|
|
99741
|
+
env: platformEnv({
|
|
99742
|
+
...databaseEnv,
|
|
99743
|
+
CTX_AUTH_SKIP_VERIFY_JWT: "true",
|
|
99744
|
+
CTX_PLATFORM_PORT: String(port)
|
|
99745
|
+
}),
|
|
99746
|
+
stdio: [
|
|
99747
|
+
"ignore",
|
|
99748
|
+
"pipe",
|
|
99749
|
+
"pipe"
|
|
99750
|
+
]
|
|
99751
|
+
});
|
|
99752
|
+
proc.stderr?.on("data", (c) => process.stderr.write(c));
|
|
99753
|
+
const exited = new Promise((resolve, reject) => {
|
|
99754
|
+
proc.once("exit", (code) => resolve(code));
|
|
99755
|
+
proc.once("error", reject);
|
|
99756
|
+
});
|
|
99757
|
+
const platformUrl = `http://127.0.0.1:${port}`;
|
|
99758
|
+
const exitedBeforeReady = exited.then((code) => {
|
|
99759
|
+
throw new Error(`platform exited before ready (code ${code})`);
|
|
99760
|
+
});
|
|
99761
|
+
await Promise.race([exitedBeforeReady, waitForHttpReady(`${platformUrl}/doc`, 3e4)]);
|
|
99762
|
+
return {
|
|
99763
|
+
close: async () => {
|
|
99764
|
+
proc.kill("SIGTERM");
|
|
99765
|
+
await exited;
|
|
99766
|
+
},
|
|
99767
|
+
platformUrl
|
|
99768
|
+
};
|
|
99769
|
+
}
|
|
99770
|
+
async function waitForHttpReady(url, timeoutMs) {
|
|
99771
|
+
const deadline = Date.now() + timeoutMs;
|
|
99772
|
+
let last;
|
|
99773
|
+
while (Date.now() < deadline) {
|
|
99774
|
+
try {
|
|
99775
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(2e3) });
|
|
99776
|
+
if (res.status < 500) return;
|
|
99777
|
+
last = /* @__PURE__ */ new Error(`HTTP ${res.status}`);
|
|
99778
|
+
} catch (e) {
|
|
99779
|
+
last = e;
|
|
99780
|
+
}
|
|
99781
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
99782
|
+
}
|
|
99783
|
+
throw new Error(`${url} not ready in ${timeoutMs}ms (last: ${last instanceof Error ? last.message : String(last)})`);
|
|
99784
|
+
}
|
|
99785
|
+
async function seedWorkspaceViaSdk(opts) {
|
|
99786
|
+
return (await new SlateAPIClient({
|
|
99787
|
+
environment: opts.platformUrl,
|
|
99788
|
+
...ctxAuthHeaders(() => Promise.resolve(opts.token))
|
|
99789
|
+
}).workspaces.createWorkspace({
|
|
99790
|
+
baseIds: opts.baseIds ?? [],
|
|
99791
|
+
model: opts.model ?? "haiku",
|
|
99792
|
+
name: opts.name ?? "capstone-test",
|
|
99793
|
+
...opts.claudeToken ? { claudeOauthTokenSecret: opts.claudeToken } : {}
|
|
99794
|
+
})).workspaceId;
|
|
99795
|
+
}
|
|
99796
|
+
strictObject$1({
|
|
99797
|
+
bases: array$1(strictObject$1({
|
|
99798
|
+
base_id: string$5().uuid(),
|
|
99799
|
+
dsn: string$5().min(1),
|
|
99800
|
+
name: string$5().min(1)
|
|
99801
|
+
})),
|
|
99802
|
+
model: string$5().min(1).nullable(),
|
|
99803
|
+
name: string$5().min(1),
|
|
99804
|
+
platform_origin: string$5().min(1),
|
|
99805
|
+
pulled_at: string$5().min(1),
|
|
99806
|
+
slug: string$5().min(1),
|
|
99807
|
+
workspace_id: string$5().uuid()
|
|
99808
|
+
});
|
|
99809
|
+
async function pushRepo(platformUrl, token, repoId, files) {
|
|
99810
|
+
const base = await mkdtemp(path.join(os.tmpdir(), "seed-push-"));
|
|
99811
|
+
try {
|
|
99812
|
+
const repo = await resolveRepo({
|
|
99813
|
+
platformUrl,
|
|
99814
|
+
repoId,
|
|
99815
|
+
token
|
|
99816
|
+
}, base);
|
|
99817
|
+
if (await remoteHead(repo.remote) !== null) await cloneRepo(repo);
|
|
99818
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
99819
|
+
await mkdir(path.join(repo.hostDir, path.dirname(rel)), { recursive: true });
|
|
99820
|
+
await writeFile(path.join(repo.hostDir, rel), content);
|
|
99821
|
+
}
|
|
99822
|
+
await pushSnapshot(repo, { message: `seed ${repoId}` });
|
|
99823
|
+
} finally {
|
|
99824
|
+
await rm(base, {
|
|
99825
|
+
force: true,
|
|
99826
|
+
recursive: true
|
|
99827
|
+
});
|
|
99828
|
+
}
|
|
99829
|
+
}
|
|
99830
|
+
async function pushDocsTree(opts) {
|
|
99831
|
+
const repoId = buildRepoId({
|
|
99832
|
+
kind: "workspace",
|
|
99833
|
+
owner: "slate",
|
|
99834
|
+
workspaceId: opts.workspaceId
|
|
99835
|
+
});
|
|
99836
|
+
await pushRepo(opts.platformUrl, opts.token, repoId, opts.files);
|
|
99837
|
+
}
|
|
99838
|
+
async function pushClaudeHome(opts) {
|
|
99839
|
+
const repoId = buildRepoId({
|
|
99840
|
+
kind: "claude",
|
|
99841
|
+
owner: "slate",
|
|
99842
|
+
userId: opts.userId,
|
|
99843
|
+
workspaceId: opts.workspaceId
|
|
99844
|
+
});
|
|
99845
|
+
await pushRepo(opts.platformUrl, opts.token, repoId, opts.files);
|
|
99846
|
+
}
|
|
99847
|
+
function turnPrompt(turn) {
|
|
99848
|
+
return typeof turn === "string" ? turn : turn.prompt;
|
|
99849
|
+
}
|
|
99850
|
+
function turnInterruptPhase(turn) {
|
|
99851
|
+
return typeof turn === "string" ? void 0 : turn.interrupt;
|
|
99852
|
+
}
|
|
99060
99853
|
const PARITY_SCENARIOS = [
|
|
99061
99854
|
{
|
|
99062
99855
|
name: "text-only",
|
|
@@ -99108,6 +99901,13 @@ const PARITY_SCENARIOS = [
|
|
|
99108
99901
|
"Summarize this conversation in one short sentence.",
|
|
99109
99902
|
"Reply with exactly one word: bye"
|
|
99110
99903
|
]
|
|
99904
|
+
},
|
|
99905
|
+
{
|
|
99906
|
+
name: "interrupted-text",
|
|
99907
|
+
turns: [{
|
|
99908
|
+
interrupt: "text",
|
|
99909
|
+
prompt: "Write a detailed 1500-word essay on the history of the bicycle. Plain prose only, no tools, no lists, no headings."
|
|
99910
|
+
}, "Reply with exactly one word: continued"]
|
|
99111
99911
|
}
|
|
99112
99912
|
];
|
|
99113
99913
|
function resolveGoldensDir() {
|
|
@@ -99120,88 +99920,116 @@ function resolveGoldensDir() {
|
|
|
99120
99920
|
dir = parent;
|
|
99121
99921
|
}
|
|
99122
99922
|
}
|
|
99923
|
+
const keychainClaudeCredentialsSchema = object$4({ claudeAiOauth: object$4({
|
|
99924
|
+
accessToken: string$5().min(1),
|
|
99925
|
+
expiresAt: number$4()
|
|
99926
|
+
}) });
|
|
99927
|
+
async function resolveClaudeHostCredential() {
|
|
99928
|
+
const exported = process.env.CLAUDE_CODE_OAUTH_TOKEN;
|
|
99929
|
+
if (exported) return {
|
|
99930
|
+
source: "env",
|
|
99931
|
+
token: exported
|
|
99932
|
+
};
|
|
99933
|
+
const raw = await readClaudeCodeCredentialsFromKeychain({ platform: process.platform });
|
|
99934
|
+
if (raw === null) throw new Error("no Claude credentials for the claude tier: export CLAUDE_CODE_OAUTH_TOKEN, or log in to Claude Code on this Mac (the keychain fallback found nothing).");
|
|
99935
|
+
const creds = keychainClaudeCredentialsSchema.parse(JSON.parse(raw));
|
|
99936
|
+
if (creds.claudeAiOauth.expiresAt <= Date.now()) throw new Error("the keychain's Claude Code token has expired: run any claude command to refresh it, or export CLAUDE_CODE_OAUTH_TOKEN.");
|
|
99937
|
+
return {
|
|
99938
|
+
expiresAt: creds.claudeAiOauth.expiresAt,
|
|
99939
|
+
source: "keychain",
|
|
99940
|
+
token: creds.claudeAiOauth.accessToken
|
|
99941
|
+
};
|
|
99942
|
+
}
|
|
99123
99943
|
|
|
99124
99944
|
//#endregion
|
|
99125
99945
|
//#region ../slate-bridge/dist/index.mjs
|
|
99946
|
+
const execFileAsync = promisify(execFile);
|
|
99126
99947
|
async function writeJsonAtomic(filePath, value) {
|
|
99127
99948
|
const tmp = `${filePath}.tmp`;
|
|
99128
99949
|
await writeFile(tmp, `${JSON.stringify(value, null, 2)}\n`);
|
|
99129
99950
|
await rename(tmp, filePath);
|
|
99130
99951
|
}
|
|
99131
|
-
|
|
99132
|
-
|
|
99133
|
-
|
|
99952
|
+
async function formatScenarioGoldens(scenarioDir) {
|
|
99953
|
+
await execFileAsync(path.join(REPO_ROOT, "node_modules", ".bin", "biome"), [
|
|
99954
|
+
"check",
|
|
99955
|
+
"--write",
|
|
99956
|
+
scenarioDir
|
|
99957
|
+
], { cwd: REPO_ROOT });
|
|
99958
|
+
}
|
|
99959
|
+
const FIRST_FRAME_BUDGET_MS = 3e5;
|
|
99960
|
+
const TURN_SILENCE_BUDGET_MS = 6e4;
|
|
99961
|
+
const KNOWN_SCENARIO_NAMES = new Set(PARITY_SCENARIOS.map((scenario) => scenario.name));
|
|
99962
|
+
const generateParityGoldensOptionsSchema = strictObject$1({ only: array$1(string$5().refine((name) => KNOWN_SCENARIO_NAMES.has(name), { error: `unknown parity scenario; expected one of: ${[...KNOWN_SCENARIO_NAMES].join(", ")}` })) });
|
|
99963
|
+
async function readFinalizedTranscript(sessionId, claudeHomeDir) {
|
|
99964
|
+
const transcriptPath = await findSessionFile(claudeHomeDir, sessionId);
|
|
99965
|
+
if (transcriptPath === null) throw new Error(`[parity] session ${sessionId}: finalized transcript is missing`);
|
|
99966
|
+
return readFile(transcriptPath, "utf-8");
|
|
99967
|
+
}
|
|
99968
|
+
async function readFinalizedHistory(sessionId, claudeHomeDir) {
|
|
99969
|
+
return getSessionMessages(sessionId, { sessionStore: singleSessionStore(sessionId, parseSessionStoreJsonl(await readFinalizedTranscript(sessionId, claudeHomeDir), "throw")) });
|
|
99970
|
+
}
|
|
99971
|
+
function transcriptRowText(row) {
|
|
99972
|
+
const message = row.message;
|
|
99973
|
+
if (typeof message !== "object" || message === null) return "";
|
|
99974
|
+
const content = message.content;
|
|
99975
|
+
if (typeof content === "string") return content;
|
|
99976
|
+
if (!Array.isArray(content)) return "";
|
|
99977
|
+
return content.map((block) => typeof block === "object" && block !== null && "text" in block ? String(block.text ?? "") : "").join("\n");
|
|
99134
99978
|
}
|
|
99135
|
-
|
|
99136
|
-
const
|
|
99137
|
-
|
|
99138
|
-
|
|
99139
|
-
|
|
99140
|
-
|
|
99141
|
-
|
|
99142
|
-
|
|
99143
|
-
|
|
99144
|
-
|
|
99145
|
-
|
|
99146
|
-
|
|
99147
|
-
|
|
99979
|
+
function assertInterruptPersisted(scenario, history) {
|
|
99980
|
+
const phases = new Set(scenario.turns.map(turnInterruptPhase).filter((phase) => phase !== void 0));
|
|
99981
|
+
for (const phase of phases) {
|
|
99982
|
+
const marker = CLAUDE_INTERRUPT_MARKERS[phase];
|
|
99983
|
+
if (!history.some((row) => transcriptRowText(row).includes(marker))) throw new Error(`[parity] scenario "${scenario.name}": declared interrupt:"${phase}" but the captured transcript carries no ${marker} row — the stream aborted without the transcript recording it`);
|
|
99984
|
+
}
|
|
99985
|
+
}
|
|
99986
|
+
function isInterruptTrigger(message, phase) {
|
|
99987
|
+
if (phase === "text") return message.type === "stream_event" && message.event.type === "content_block_delta" && message.event.delta.type === "text_delta";
|
|
99988
|
+
return message.type === "user";
|
|
99989
|
+
}
|
|
99990
|
+
function assertTurnInterruptionOutcome(scenario, turnNumber, result, expectedInterruptPhase) {
|
|
99991
|
+
const where = `[parity] scenario "${scenario.name}" turn ${turnNumber}/${scenario.turns.length}`;
|
|
99992
|
+
if (expectedInterruptPhase === void 0) {
|
|
99993
|
+
if (result.subtype !== "success") throw new Error(`${where} ended with ${result.subtype}: ${result.errors.join("; ")}`);
|
|
99994
|
+
return;
|
|
99148
99995
|
}
|
|
99149
|
-
|
|
99996
|
+
if (result.subtype === "success") throw new Error(`${where} declared interrupt:"${expectedInterruptPhase}" but ended success — the interrupt did not land`);
|
|
99997
|
+
if (!isStoppedResult(result)) throw new Error(`${where} declared interrupt:"${expectedInterruptPhase}" but ended ${result.subtype} with terminal_reason ${String(result.terminal_reason)} — that is a failure, not an interrupt`);
|
|
99150
99998
|
}
|
|
99151
|
-
async function
|
|
99999
|
+
async function captureScenarioStream(server, scenario, options) {
|
|
99152
100000
|
const ac = new AbortController();
|
|
99153
100001
|
let iter;
|
|
99154
100002
|
try {
|
|
99155
|
-
const workspaceId = crypto.randomUUID();
|
|
99156
100003
|
const sessionId = crypto.randomUUID();
|
|
99157
|
-
const url = `ws://127.0.0.1:${server.port}/bridge/workspaces/${workspaceId}/sessions/${sessionId}/wss?token=${encodeURIComponent(
|
|
99158
|
-
const
|
|
99159
|
-
|
|
99160
|
-
const pushTurn = (text) => {
|
|
99161
|
-
const msg = {
|
|
99162
|
-
message: {
|
|
99163
|
-
content: text,
|
|
99164
|
-
role: "user"
|
|
99165
|
-
},
|
|
99166
|
-
parent_tool_use_id: null,
|
|
99167
|
-
type: "user"
|
|
99168
|
-
};
|
|
99169
|
-
if (resolveNext) {
|
|
99170
|
-
const resolve = resolveNext;
|
|
99171
|
-
resolveNext = null;
|
|
99172
|
-
resolve(msg);
|
|
99173
|
-
} else queue.push(msg);
|
|
99174
|
-
};
|
|
99175
|
-
async function* promptGen() {
|
|
99176
|
-
while (true) {
|
|
99177
|
-
const buffered = queue.shift();
|
|
99178
|
-
if (buffered !== void 0) yield buffered;
|
|
99179
|
-
else yield await new Promise((resolve) => {
|
|
99180
|
-
resolveNext = resolve;
|
|
99181
|
-
});
|
|
99182
|
-
}
|
|
99183
|
-
}
|
|
99184
|
-
iter = query({
|
|
100004
|
+
const url = `ws://127.0.0.1:${server.port}/bridge/workspaces/${options.workspaceId}/sessions/${sessionId}/wss?token=${encodeURIComponent(options.ctxToken)}`;
|
|
100005
|
+
const promptStream = createClaudePromptStream();
|
|
100006
|
+
const claudeQuery = query({
|
|
99185
100007
|
abortController: ac,
|
|
99186
|
-
prompt:
|
|
100008
|
+
prompt: promptStream.prompt,
|
|
99187
100009
|
websocket: { url }
|
|
99188
100010
|
});
|
|
100011
|
+
iter = claudeQuery;
|
|
99189
100012
|
const stream = [];
|
|
99190
|
-
|
|
99191
|
-
let
|
|
99192
|
-
|
|
99193
|
-
|
|
100013
|
+
let expectedInterruptPhase;
|
|
100014
|
+
let interruptFired = false;
|
|
100015
|
+
let sentTurnCount = 0;
|
|
100016
|
+
const sendNextTurn = () => {
|
|
100017
|
+
const turn = scenario.turns[sentTurnCount];
|
|
99194
100018
|
if (turn === void 0) return false;
|
|
99195
|
-
|
|
99196
|
-
|
|
100019
|
+
promptStream.push(turnPrompt(turn));
|
|
100020
|
+
expectedInterruptPhase = turnInterruptPhase(turn);
|
|
100021
|
+
interruptFired = false;
|
|
100022
|
+
sentTurnCount += 1;
|
|
99197
100023
|
return true;
|
|
99198
100024
|
};
|
|
99199
|
-
|
|
100025
|
+
sendNextTurn();
|
|
99200
100026
|
let finished = false;
|
|
99201
100027
|
while (!finished) {
|
|
100028
|
+
const awaitingFirstFrame = stream.length === 0;
|
|
100029
|
+
const budgetMs = awaitingFirstFrame ? FIRST_FRAME_BUDGET_MS : TURN_SILENCE_BUDGET_MS;
|
|
99202
100030
|
let timer;
|
|
99203
100031
|
const stalled = new Promise((_resolve, reject) => {
|
|
99204
|
-
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`[parity] scenario "${scenario.name}": no SDK
|
|
100032
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(awaitingFirstFrame ? `[parity] scenario "${scenario.name}": no first SDK frame for ${FIRST_FRAME_BUDGET_MS}ms during guest acquisition and boot for turn ${sentTurnCount}/${scenario.turns.length} — a cold OCI image pull is a likely cause` : `[parity] scenario "${scenario.name}": no SDK frame for ${TURN_SILENCE_BUDGET_MS}ms while streaming turn ${sentTurnCount}/${scenario.turns.length} — running turn stalled or emitted no result`)), budgetMs);
|
|
99205
100033
|
});
|
|
99206
100034
|
let next;
|
|
99207
100035
|
try {
|
|
@@ -99209,55 +100037,113 @@ async function captureScenario(server, scenario, rootDir) {
|
|
|
99209
100037
|
} finally {
|
|
99210
100038
|
if (timer) clearTimeout(timer);
|
|
99211
100039
|
}
|
|
99212
|
-
if (next.done)
|
|
100040
|
+
if (next.done) throw new Error(`[parity] scenario "${scenario.name}": SDK stream ended while awaiting turn ${sentTurnCount}/${scenario.turns.length}`);
|
|
99213
100041
|
stream.push(next.value);
|
|
99214
|
-
if (
|
|
100042
|
+
if (expectedInterruptPhase !== void 0 && !interruptFired && isInterruptTrigger(next.value, expectedInterruptPhase)) {
|
|
100043
|
+
interruptFired = true;
|
|
100044
|
+
claudeQuery.interrupt();
|
|
100045
|
+
}
|
|
100046
|
+
if (next.value.type === "result") {
|
|
100047
|
+
assertTurnInterruptionOutcome(scenario, sentTurnCount, next.value, expectedInterruptPhase);
|
|
100048
|
+
if (!sendNextTurn()) finished = true;
|
|
100049
|
+
}
|
|
99215
100050
|
}
|
|
99216
100051
|
return {
|
|
99217
|
-
|
|
100052
|
+
sessionId,
|
|
99218
100053
|
stream
|
|
99219
100054
|
};
|
|
99220
100055
|
} finally {
|
|
99221
|
-
|
|
99222
|
-
|
|
100056
|
+
try {
|
|
100057
|
+
await iter?.return?.(void 0);
|
|
100058
|
+
} finally {
|
|
100059
|
+
ac.abort();
|
|
100060
|
+
}
|
|
99223
100061
|
}
|
|
99224
100062
|
}
|
|
99225
|
-
async function
|
|
99226
|
-
const
|
|
99227
|
-
|
|
99228
|
-
|
|
99229
|
-
|
|
99230
|
-
|
|
99231
|
-
}
|
|
99232
|
-
|
|
99233
|
-
|
|
99234
|
-
|
|
99235
|
-
|
|
99236
|
-
|
|
99237
|
-
scenario
|
|
99238
|
-
})));
|
|
99239
|
-
const server = await createBridgeServer({
|
|
99240
|
-
gitHostBaseDir: env$1.CTX_GIT_HOST_BASE_DIR,
|
|
99241
|
-
hostClaudeJsonPath: env$1.CTXS_HOST_CLAUDE_JSON_PATH,
|
|
99242
|
-
image: env$1.CTXS_CLAUDE_IMAGE,
|
|
99243
|
-
port: 0
|
|
100063
|
+
async function seedChatWorkspace(options) {
|
|
100064
|
+
const workspaceId = await seedWorkspaceViaSdk({
|
|
100065
|
+
claudeToken: options.claudeToken,
|
|
100066
|
+
name: options.name,
|
|
100067
|
+
platformUrl: options.platformUrl,
|
|
100068
|
+
token: options.ctxToken
|
|
100069
|
+
});
|
|
100070
|
+
await pushDocsTree({
|
|
100071
|
+
files: { "README.md": `parity scenario workspace: ${options.name}\n` },
|
|
100072
|
+
platformUrl: options.platformUrl,
|
|
100073
|
+
token: options.ctxToken,
|
|
100074
|
+
workspaceId
|
|
99244
100075
|
});
|
|
100076
|
+
await pushClaudeHome({
|
|
100077
|
+
files: { ".gitkeep": "" },
|
|
100078
|
+
platformUrl: options.platformUrl,
|
|
100079
|
+
token: options.ctxToken,
|
|
100080
|
+
userId: DEV_IDENTITY.sub,
|
|
100081
|
+
workspaceId
|
|
100082
|
+
});
|
|
100083
|
+
return workspaceId;
|
|
100084
|
+
}
|
|
100085
|
+
async function generateParityGoldens(options) {
|
|
100086
|
+
const { only: requestedScenarioNames } = generateParityGoldensOptionsSchema.parse(options);
|
|
100087
|
+
const selectedScenarios = requestedScenarioNames.length > 0 ? PARITY_SCENARIOS.filter((scenario) => requestedScenarioNames.includes(scenario.name)) : PARITY_SCENARIOS;
|
|
100088
|
+
for (const scenario of selectedScenarios) if (scenario.turns.length === 0 || scenario.turns.some((turn) => turnPrompt(turn).trim() === "")) throw new Error(`[parity] scenario "${scenario.name}" has an empty or missing turn`);
|
|
100089
|
+
const goldensDir = resolveGoldensDir();
|
|
100090
|
+
const claudeToken = (await resolveClaudeHostCredential()).token;
|
|
100091
|
+
const ctxToken = mintUnsignedCtxToken(DEV_IDENTITY.sub);
|
|
100092
|
+
const { databaseEnv, dropAll } = await provisionPlatformDatabases();
|
|
99245
100093
|
try {
|
|
99246
|
-
|
|
99247
|
-
|
|
99248
|
-
const
|
|
99249
|
-
|
|
99250
|
-
|
|
99251
|
-
|
|
99252
|
-
|
|
99253
|
-
|
|
100094
|
+
const platform = await bootPlatform(databaseEnv);
|
|
100095
|
+
try {
|
|
100096
|
+
const gitHostBaseDir = await mkdtemp(path.join(os.tmpdir(), "parity-git-host-"));
|
|
100097
|
+
try {
|
|
100098
|
+
for (const scenario of selectedScenarios) {
|
|
100099
|
+
console.log(`[parity] capturing "${scenario.name}" (${scenario.turns.length} turns)…`);
|
|
100100
|
+
const workspaceId = await seedChatWorkspace({
|
|
100101
|
+
claudeToken,
|
|
100102
|
+
ctxToken,
|
|
100103
|
+
name: `parity-${scenario.name}`,
|
|
100104
|
+
platformUrl: platform.platformUrl
|
|
100105
|
+
});
|
|
100106
|
+
const server = await createBridgeServer({
|
|
100107
|
+
gitHostBaseDir,
|
|
100108
|
+
hostClaudeJsonPath: env$1.CTXS_HOST_CLAUDE_JSON_PATH,
|
|
100109
|
+
image: env$1.CTXS_CLAUDE_IMAGE,
|
|
100110
|
+
platformUrl: platform.platformUrl,
|
|
100111
|
+
port: 0,
|
|
100112
|
+
verify: createDevJwtVerifier()
|
|
100113
|
+
});
|
|
100114
|
+
const { sessionId, stream } = await captureScenarioStream(server, scenario, {
|
|
100115
|
+
ctxToken,
|
|
100116
|
+
workspaceId
|
|
100117
|
+
}).finally(() => server.close());
|
|
100118
|
+
const history = await readFinalizedHistory(sessionId, (await resolveRepo({
|
|
100119
|
+
platformUrl: platform.platformUrl,
|
|
100120
|
+
repoId: buildRepoId({
|
|
100121
|
+
kind: "claude",
|
|
100122
|
+
owner: "slate",
|
|
100123
|
+
userId: DEV_IDENTITY.sub,
|
|
100124
|
+
workspaceId
|
|
100125
|
+
}),
|
|
100126
|
+
token: ctxToken
|
|
100127
|
+
}, gitHostBaseDir)).hostDir);
|
|
100128
|
+
assertInterruptPersisted(scenario, history);
|
|
100129
|
+
const scenarioDir = path.join(goldensDir, scenario.name);
|
|
100130
|
+
await mkdir(scenarioDir, { recursive: true });
|
|
100131
|
+
await writeJsonAtomic(path.join(scenarioDir, "stream.json"), stream);
|
|
100132
|
+
await writeJsonAtomic(path.join(scenarioDir, "history.json"), history);
|
|
100133
|
+
await formatScenarioGoldens(scenarioDir);
|
|
100134
|
+
console.log(`[parity] ${scenario.name}: stream=${stream.length} msgs, history=${history.length} rows → ${scenarioDir}`);
|
|
100135
|
+
}
|
|
100136
|
+
} finally {
|
|
100137
|
+
await rm(gitHostBaseDir, {
|
|
100138
|
+
force: true,
|
|
100139
|
+
recursive: true
|
|
100140
|
+
});
|
|
100141
|
+
}
|
|
100142
|
+
} finally {
|
|
100143
|
+
await platform.close();
|
|
99254
100144
|
}
|
|
99255
100145
|
} finally {
|
|
99256
|
-
await
|
|
99257
|
-
await Promise.all(scenarioRoots.map(({ rootDir }) => rm(rootDir, {
|
|
99258
|
-
force: true,
|
|
99259
|
-
recursive: true
|
|
99260
|
-
})));
|
|
100146
|
+
await dropAll();
|
|
99261
100147
|
}
|
|
99262
100148
|
}
|
|
99263
100149
|
|
|
@@ -103178,7 +104064,7 @@ function createProgram() {
|
|
|
103178
104064
|
program.command("bridge").description("Slate bridge commands").command("start").description("Start the slate bridge server in the foreground, bound to localhost on CTXS_BRIDGE_PORT (default 7777). Authenticates each connection's aud=ctx user token and resolves its workspace + credentials from the platform (CTX_WEB_URL verifies the token, CTX_PLATFORM_URL serves the plan + base DSN); serves the render endpoints + the per-session WebSocket that spawns claude inside a microsandbox sandbox. Blocks until SIGINT/SIGTERM.").action(async () => {
|
|
103179
104065
|
await createBridgeServer({});
|
|
103180
104066
|
});
|
|
103181
|
-
program.command("parity").description("Translator parity golden tooling (dev/maintainer)").command("generate [scenarios...]").description("Drive scripted multi-turn conversations through the real bridge + microsandbox + claude and (re)write the parity goldens consumed by slate-shared's parity test. Pass scenario names to capture only those (others keep their existing goldens); omit to regenerate all.
|
|
104067
|
+
program.command("parity").description("Translator parity golden tooling (dev/maintainer)").command("generate [scenarios...]").description("Drive scripted multi-turn conversations through the real bridge + microsandbox + claude and (re)write the parity goldens consumed by slate-shared's parity test. Pass scenario names to capture only those (others keep their existing goldens); omit to regenerate all. Consumes real Claude usage and requires local Claude auth, the microsandbox runtime, a pullable guest image, the host Claude trust file, and local dev Postgres. Never run from a gate.").action(async (scenarios) => {
|
|
103182
104068
|
await generateParityGoldens({ only: scenarios });
|
|
103183
104069
|
});
|
|
103184
104070
|
program.command("sandbox").allowUnknownOption(true).allowExcessArguments(true).argument("[command...]", "Command + args to run in the guest (default: uname -a)").requiredOption("--image <ref>", "Guest image to boot in the microVM").description("Boot a microsandbox microVM from --image, run a command inside it, print its output, and tear it down. A DB-free check that the host can boot guest microVMs (/dev/kvm in a container; HVF on macOS).").action(async (command, options) => {
|
|
@@ -103204,4 +104090,4 @@ runCli().catch((error) => {
|
|
|
103204
104090
|
//#endregion
|
|
103205
104091
|
export { createProgram, runCli };
|
|
103206
104092
|
//# sourceMappingURL=cli.mjs.map
|
|
103207
|
-
//# debugId=
|
|
104093
|
+
//# debugId=706efdec-7252-5edd-aee9-ff839acf6fa2
|