@clawos-dev/clawd 0.2.269 → 0.2.271

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.cjs CHANGED
@@ -450,8 +450,8 @@ var init_parseUtil = __esm({
450
450
  init_errors();
451
451
  init_en();
452
452
  makeIssue = (params) => {
453
- const { data, path: path76, errorMaps, issueData } = params;
454
- const fullPath = [...path76, ...issueData.path || []];
453
+ const { data, path: path77, errorMaps, issueData } = params;
454
+ const fullPath = [...path77, ...issueData.path || []];
455
455
  const fullIssue = {
456
456
  ...issueData,
457
457
  path: fullPath
@@ -762,11 +762,11 @@ var init_types = __esm({
762
762
  init_parseUtil();
763
763
  init_util();
764
764
  ParseInputLazyPath = class {
765
- constructor(parent, value, path76, key) {
765
+ constructor(parent, value, path77, key) {
766
766
  this._cachedPath = [];
767
767
  this.parent = parent;
768
768
  this.data = value;
769
- this._path = path76;
769
+ this._path = path77;
770
770
  this._key = key;
771
771
  }
772
772
  get path() {
@@ -4149,6 +4149,1626 @@ var init_zod = __esm({
4149
4149
  }
4150
4150
  });
4151
4151
 
4152
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
4153
+ var ignoreOverride, defaultOptions, getDefaultOptions;
4154
+ var init_Options = __esm({
4155
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js"() {
4156
+ "use strict";
4157
+ ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
4158
+ defaultOptions = {
4159
+ name: void 0,
4160
+ $refStrategy: "root",
4161
+ basePath: ["#"],
4162
+ effectStrategy: "input",
4163
+ pipeStrategy: "all",
4164
+ dateStrategy: "format:date-time",
4165
+ mapStrategy: "entries",
4166
+ removeAdditionalStrategy: "passthrough",
4167
+ allowedAdditionalProperties: true,
4168
+ rejectedAdditionalProperties: false,
4169
+ definitionPath: "definitions",
4170
+ target: "jsonSchema7",
4171
+ strictUnions: false,
4172
+ definitions: {},
4173
+ errorMessages: false,
4174
+ markdownDescription: false,
4175
+ patternStrategy: "escape",
4176
+ applyRegexFlags: false,
4177
+ emailStrategy: "format:email",
4178
+ base64Strategy: "contentEncoding:base64",
4179
+ nameStrategy: "ref",
4180
+ openAiAnyTypeName: "OpenAiAnyType"
4181
+ };
4182
+ getDefaultOptions = (options) => typeof options === "string" ? {
4183
+ ...defaultOptions,
4184
+ name: options
4185
+ } : {
4186
+ ...defaultOptions,
4187
+ ...options
4188
+ };
4189
+ }
4190
+ });
4191
+
4192
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
4193
+ var getRefs;
4194
+ var init_Refs = __esm({
4195
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js"() {
4196
+ "use strict";
4197
+ init_Options();
4198
+ getRefs = (options) => {
4199
+ const _options = getDefaultOptions(options);
4200
+ const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
4201
+ return {
4202
+ ..._options,
4203
+ flags: { hasReferencedOpenAiAnyType: false },
4204
+ currentPath,
4205
+ propertyPath: void 0,
4206
+ seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
4207
+ def._def,
4208
+ {
4209
+ def: def._def,
4210
+ path: [..._options.basePath, _options.definitionPath, name],
4211
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
4212
+ jsonSchema: void 0
4213
+ }
4214
+ ]))
4215
+ };
4216
+ };
4217
+ }
4218
+ });
4219
+
4220
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
4221
+ function addErrorMessage(res, key, errorMessage, refs) {
4222
+ if (!refs?.errorMessages)
4223
+ return;
4224
+ if (errorMessage) {
4225
+ res.errorMessage = {
4226
+ ...res.errorMessage,
4227
+ [key]: errorMessage
4228
+ };
4229
+ }
4230
+ }
4231
+ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
4232
+ res[key] = value;
4233
+ addErrorMessage(res, key, errorMessage, refs);
4234
+ }
4235
+ var init_errorMessages = __esm({
4236
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js"() {
4237
+ "use strict";
4238
+ }
4239
+ });
4240
+
4241
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
4242
+ var getRelativePath;
4243
+ var init_getRelativePath = __esm({
4244
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js"() {
4245
+ "use strict";
4246
+ getRelativePath = (pathA, pathB) => {
4247
+ let i = 0;
4248
+ for (; i < pathA.length && i < pathB.length; i++) {
4249
+ if (pathA[i] !== pathB[i])
4250
+ break;
4251
+ }
4252
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
4253
+ };
4254
+ }
4255
+ });
4256
+
4257
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/index.js
4258
+ var init_v3 = __esm({
4259
+ "../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/index.js"() {
4260
+ "use strict";
4261
+ init_external();
4262
+ }
4263
+ });
4264
+
4265
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
4266
+ function parseAnyDef(refs) {
4267
+ if (refs.target !== "openAi") {
4268
+ return {};
4269
+ }
4270
+ const anyDefinitionPath = [
4271
+ ...refs.basePath,
4272
+ refs.definitionPath,
4273
+ refs.openAiAnyTypeName
4274
+ ];
4275
+ refs.flags.hasReferencedOpenAiAnyType = true;
4276
+ return {
4277
+ $ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
4278
+ };
4279
+ }
4280
+ var init_any = __esm({
4281
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js"() {
4282
+ "use strict";
4283
+ init_getRelativePath();
4284
+ }
4285
+ });
4286
+
4287
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
4288
+ function parseArrayDef(def, refs) {
4289
+ const res = {
4290
+ type: "array"
4291
+ };
4292
+ if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
4293
+ res.items = parseDef(def.type._def, {
4294
+ ...refs,
4295
+ currentPath: [...refs.currentPath, "items"]
4296
+ });
4297
+ }
4298
+ if (def.minLength) {
4299
+ setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
4300
+ }
4301
+ if (def.maxLength) {
4302
+ setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
4303
+ }
4304
+ if (def.exactLength) {
4305
+ setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
4306
+ setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
4307
+ }
4308
+ return res;
4309
+ }
4310
+ var init_array = __esm({
4311
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js"() {
4312
+ "use strict";
4313
+ init_v3();
4314
+ init_errorMessages();
4315
+ init_parseDef();
4316
+ }
4317
+ });
4318
+
4319
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
4320
+ function parseBigintDef(def, refs) {
4321
+ const res = {
4322
+ type: "integer",
4323
+ format: "int64"
4324
+ };
4325
+ if (!def.checks)
4326
+ return res;
4327
+ for (const check of def.checks) {
4328
+ switch (check.kind) {
4329
+ case "min":
4330
+ if (refs.target === "jsonSchema7") {
4331
+ if (check.inclusive) {
4332
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
4333
+ } else {
4334
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
4335
+ }
4336
+ } else {
4337
+ if (!check.inclusive) {
4338
+ res.exclusiveMinimum = true;
4339
+ }
4340
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
4341
+ }
4342
+ break;
4343
+ case "max":
4344
+ if (refs.target === "jsonSchema7") {
4345
+ if (check.inclusive) {
4346
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
4347
+ } else {
4348
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
4349
+ }
4350
+ } else {
4351
+ if (!check.inclusive) {
4352
+ res.exclusiveMaximum = true;
4353
+ }
4354
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
4355
+ }
4356
+ break;
4357
+ case "multipleOf":
4358
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
4359
+ break;
4360
+ }
4361
+ }
4362
+ return res;
4363
+ }
4364
+ var init_bigint = __esm({
4365
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js"() {
4366
+ "use strict";
4367
+ init_errorMessages();
4368
+ }
4369
+ });
4370
+
4371
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
4372
+ function parseBooleanDef() {
4373
+ return {
4374
+ type: "boolean"
4375
+ };
4376
+ }
4377
+ var init_boolean = __esm({
4378
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js"() {
4379
+ "use strict";
4380
+ }
4381
+ });
4382
+
4383
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
4384
+ function parseBrandedDef(_def, refs) {
4385
+ return parseDef(_def.type._def, refs);
4386
+ }
4387
+ var init_branded = __esm({
4388
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js"() {
4389
+ "use strict";
4390
+ init_parseDef();
4391
+ }
4392
+ });
4393
+
4394
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
4395
+ var parseCatchDef;
4396
+ var init_catch = __esm({
4397
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js"() {
4398
+ "use strict";
4399
+ init_parseDef();
4400
+ parseCatchDef = (def, refs) => {
4401
+ return parseDef(def.innerType._def, refs);
4402
+ };
4403
+ }
4404
+ });
4405
+
4406
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
4407
+ function parseDateDef(def, refs, overrideDateStrategy) {
4408
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
4409
+ if (Array.isArray(strategy)) {
4410
+ return {
4411
+ anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
4412
+ };
4413
+ }
4414
+ switch (strategy) {
4415
+ case "string":
4416
+ case "format:date-time":
4417
+ return {
4418
+ type: "string",
4419
+ format: "date-time"
4420
+ };
4421
+ case "format:date":
4422
+ return {
4423
+ type: "string",
4424
+ format: "date"
4425
+ };
4426
+ case "integer":
4427
+ return integerDateParser(def, refs);
4428
+ }
4429
+ }
4430
+ var integerDateParser;
4431
+ var init_date = __esm({
4432
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js"() {
4433
+ "use strict";
4434
+ init_errorMessages();
4435
+ integerDateParser = (def, refs) => {
4436
+ const res = {
4437
+ type: "integer",
4438
+ format: "unix-time"
4439
+ };
4440
+ if (refs.target === "openApi3") {
4441
+ return res;
4442
+ }
4443
+ for (const check of def.checks) {
4444
+ switch (check.kind) {
4445
+ case "min":
4446
+ setResponseValueAndErrors(
4447
+ res,
4448
+ "minimum",
4449
+ check.value,
4450
+ // This is in milliseconds
4451
+ check.message,
4452
+ refs
4453
+ );
4454
+ break;
4455
+ case "max":
4456
+ setResponseValueAndErrors(
4457
+ res,
4458
+ "maximum",
4459
+ check.value,
4460
+ // This is in milliseconds
4461
+ check.message,
4462
+ refs
4463
+ );
4464
+ break;
4465
+ }
4466
+ }
4467
+ return res;
4468
+ };
4469
+ }
4470
+ });
4471
+
4472
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
4473
+ function parseDefaultDef(_def, refs) {
4474
+ return {
4475
+ ...parseDef(_def.innerType._def, refs),
4476
+ default: _def.defaultValue()
4477
+ };
4478
+ }
4479
+ var init_default = __esm({
4480
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js"() {
4481
+ "use strict";
4482
+ init_parseDef();
4483
+ }
4484
+ });
4485
+
4486
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
4487
+ function parseEffectsDef(_def, refs) {
4488
+ return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
4489
+ }
4490
+ var init_effects = __esm({
4491
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js"() {
4492
+ "use strict";
4493
+ init_parseDef();
4494
+ init_any();
4495
+ }
4496
+ });
4497
+
4498
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
4499
+ function parseEnumDef(def) {
4500
+ return {
4501
+ type: "string",
4502
+ enum: Array.from(def.values)
4503
+ };
4504
+ }
4505
+ var init_enum = __esm({
4506
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js"() {
4507
+ "use strict";
4508
+ }
4509
+ });
4510
+
4511
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
4512
+ function parseIntersectionDef(def, refs) {
4513
+ const allOf = [
4514
+ parseDef(def.left._def, {
4515
+ ...refs,
4516
+ currentPath: [...refs.currentPath, "allOf", "0"]
4517
+ }),
4518
+ parseDef(def.right._def, {
4519
+ ...refs,
4520
+ currentPath: [...refs.currentPath, "allOf", "1"]
4521
+ })
4522
+ ].filter((x) => !!x);
4523
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
4524
+ const mergedAllOf = [];
4525
+ allOf.forEach((schema) => {
4526
+ if (isJsonSchema7AllOfType(schema)) {
4527
+ mergedAllOf.push(...schema.allOf);
4528
+ if (schema.unevaluatedProperties === void 0) {
4529
+ unevaluatedProperties = void 0;
4530
+ }
4531
+ } else {
4532
+ let nestedSchema = schema;
4533
+ if ("additionalProperties" in schema && schema.additionalProperties === false) {
4534
+ const { additionalProperties, ...rest } = schema;
4535
+ nestedSchema = rest;
4536
+ } else {
4537
+ unevaluatedProperties = void 0;
4538
+ }
4539
+ mergedAllOf.push(nestedSchema);
4540
+ }
4541
+ });
4542
+ return mergedAllOf.length ? {
4543
+ allOf: mergedAllOf,
4544
+ ...unevaluatedProperties
4545
+ } : void 0;
4546
+ }
4547
+ var isJsonSchema7AllOfType;
4548
+ var init_intersection = __esm({
4549
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js"() {
4550
+ "use strict";
4551
+ init_parseDef();
4552
+ isJsonSchema7AllOfType = (type) => {
4553
+ if ("type" in type && type.type === "string")
4554
+ return false;
4555
+ return "allOf" in type;
4556
+ };
4557
+ }
4558
+ });
4559
+
4560
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
4561
+ function parseLiteralDef(def, refs) {
4562
+ const parsedType = typeof def.value;
4563
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
4564
+ return {
4565
+ type: Array.isArray(def.value) ? "array" : "object"
4566
+ };
4567
+ }
4568
+ if (refs.target === "openApi3") {
4569
+ return {
4570
+ type: parsedType === "bigint" ? "integer" : parsedType,
4571
+ enum: [def.value]
4572
+ };
4573
+ }
4574
+ return {
4575
+ type: parsedType === "bigint" ? "integer" : parsedType,
4576
+ const: def.value
4577
+ };
4578
+ }
4579
+ var init_literal = __esm({
4580
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js"() {
4581
+ "use strict";
4582
+ }
4583
+ });
4584
+
4585
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
4586
+ function parseStringDef(def, refs) {
4587
+ const res = {
4588
+ type: "string"
4589
+ };
4590
+ if (def.checks) {
4591
+ for (const check of def.checks) {
4592
+ switch (check.kind) {
4593
+ case "min":
4594
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
4595
+ break;
4596
+ case "max":
4597
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
4598
+ break;
4599
+ case "email":
4600
+ switch (refs.emailStrategy) {
4601
+ case "format:email":
4602
+ addFormat(res, "email", check.message, refs);
4603
+ break;
4604
+ case "format:idn-email":
4605
+ addFormat(res, "idn-email", check.message, refs);
4606
+ break;
4607
+ case "pattern:zod":
4608
+ addPattern(res, zodPatterns.email, check.message, refs);
4609
+ break;
4610
+ }
4611
+ break;
4612
+ case "url":
4613
+ addFormat(res, "uri", check.message, refs);
4614
+ break;
4615
+ case "uuid":
4616
+ addFormat(res, "uuid", check.message, refs);
4617
+ break;
4618
+ case "regex":
4619
+ addPattern(res, check.regex, check.message, refs);
4620
+ break;
4621
+ case "cuid":
4622
+ addPattern(res, zodPatterns.cuid, check.message, refs);
4623
+ break;
4624
+ case "cuid2":
4625
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
4626
+ break;
4627
+ case "startsWith":
4628
+ addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
4629
+ break;
4630
+ case "endsWith":
4631
+ addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
4632
+ break;
4633
+ case "datetime":
4634
+ addFormat(res, "date-time", check.message, refs);
4635
+ break;
4636
+ case "date":
4637
+ addFormat(res, "date", check.message, refs);
4638
+ break;
4639
+ case "time":
4640
+ addFormat(res, "time", check.message, refs);
4641
+ break;
4642
+ case "duration":
4643
+ addFormat(res, "duration", check.message, refs);
4644
+ break;
4645
+ case "length":
4646
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
4647
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
4648
+ break;
4649
+ case "includes": {
4650
+ addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
4651
+ break;
4652
+ }
4653
+ case "ip": {
4654
+ if (check.version !== "v6") {
4655
+ addFormat(res, "ipv4", check.message, refs);
4656
+ }
4657
+ if (check.version !== "v4") {
4658
+ addFormat(res, "ipv6", check.message, refs);
4659
+ }
4660
+ break;
4661
+ }
4662
+ case "base64url":
4663
+ addPattern(res, zodPatterns.base64url, check.message, refs);
4664
+ break;
4665
+ case "jwt":
4666
+ addPattern(res, zodPatterns.jwt, check.message, refs);
4667
+ break;
4668
+ case "cidr": {
4669
+ if (check.version !== "v6") {
4670
+ addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
4671
+ }
4672
+ if (check.version !== "v4") {
4673
+ addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
4674
+ }
4675
+ break;
4676
+ }
4677
+ case "emoji":
4678
+ addPattern(res, zodPatterns.emoji(), check.message, refs);
4679
+ break;
4680
+ case "ulid": {
4681
+ addPattern(res, zodPatterns.ulid, check.message, refs);
4682
+ break;
4683
+ }
4684
+ case "base64": {
4685
+ switch (refs.base64Strategy) {
4686
+ case "format:binary": {
4687
+ addFormat(res, "binary", check.message, refs);
4688
+ break;
4689
+ }
4690
+ case "contentEncoding:base64": {
4691
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
4692
+ break;
4693
+ }
4694
+ case "pattern:zod": {
4695
+ addPattern(res, zodPatterns.base64, check.message, refs);
4696
+ break;
4697
+ }
4698
+ }
4699
+ break;
4700
+ }
4701
+ case "nanoid": {
4702
+ addPattern(res, zodPatterns.nanoid, check.message, refs);
4703
+ }
4704
+ case "toLowerCase":
4705
+ case "toUpperCase":
4706
+ case "trim":
4707
+ break;
4708
+ default:
4709
+ /* @__PURE__ */ ((_2) => {
4710
+ })(check);
4711
+ }
4712
+ }
4713
+ }
4714
+ return res;
4715
+ }
4716
+ function escapeLiteralCheckValue(literal, refs) {
4717
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
4718
+ }
4719
+ function escapeNonAlphaNumeric(source) {
4720
+ let result = "";
4721
+ for (let i = 0; i < source.length; i++) {
4722
+ if (!ALPHA_NUMERIC.has(source[i])) {
4723
+ result += "\\";
4724
+ }
4725
+ result += source[i];
4726
+ }
4727
+ return result;
4728
+ }
4729
+ function addFormat(schema, value, message, refs) {
4730
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
4731
+ if (!schema.anyOf) {
4732
+ schema.anyOf = [];
4733
+ }
4734
+ if (schema.format) {
4735
+ schema.anyOf.push({
4736
+ format: schema.format,
4737
+ ...schema.errorMessage && refs.errorMessages && {
4738
+ errorMessage: { format: schema.errorMessage.format }
4739
+ }
4740
+ });
4741
+ delete schema.format;
4742
+ if (schema.errorMessage) {
4743
+ delete schema.errorMessage.format;
4744
+ if (Object.keys(schema.errorMessage).length === 0) {
4745
+ delete schema.errorMessage;
4746
+ }
4747
+ }
4748
+ }
4749
+ schema.anyOf.push({
4750
+ format: value,
4751
+ ...message && refs.errorMessages && { errorMessage: { format: message } }
4752
+ });
4753
+ } else {
4754
+ setResponseValueAndErrors(schema, "format", value, message, refs);
4755
+ }
4756
+ }
4757
+ function addPattern(schema, regex, message, refs) {
4758
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
4759
+ if (!schema.allOf) {
4760
+ schema.allOf = [];
4761
+ }
4762
+ if (schema.pattern) {
4763
+ schema.allOf.push({
4764
+ pattern: schema.pattern,
4765
+ ...schema.errorMessage && refs.errorMessages && {
4766
+ errorMessage: { pattern: schema.errorMessage.pattern }
4767
+ }
4768
+ });
4769
+ delete schema.pattern;
4770
+ if (schema.errorMessage) {
4771
+ delete schema.errorMessage.pattern;
4772
+ if (Object.keys(schema.errorMessage).length === 0) {
4773
+ delete schema.errorMessage;
4774
+ }
4775
+ }
4776
+ }
4777
+ schema.allOf.push({
4778
+ pattern: stringifyRegExpWithFlags(regex, refs),
4779
+ ...message && refs.errorMessages && { errorMessage: { pattern: message } }
4780
+ });
4781
+ } else {
4782
+ setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
4783
+ }
4784
+ }
4785
+ function stringifyRegExpWithFlags(regex, refs) {
4786
+ if (!refs.applyRegexFlags || !regex.flags) {
4787
+ return regex.source;
4788
+ }
4789
+ const flags = {
4790
+ i: regex.flags.includes("i"),
4791
+ m: regex.flags.includes("m"),
4792
+ s: regex.flags.includes("s")
4793
+ // `.` matches newlines
4794
+ };
4795
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
4796
+ let pattern = "";
4797
+ let isEscaped = false;
4798
+ let inCharGroup = false;
4799
+ let inCharRange = false;
4800
+ for (let i = 0; i < source.length; i++) {
4801
+ if (isEscaped) {
4802
+ pattern += source[i];
4803
+ isEscaped = false;
4804
+ continue;
4805
+ }
4806
+ if (flags.i) {
4807
+ if (inCharGroup) {
4808
+ if (source[i].match(/[a-z]/)) {
4809
+ if (inCharRange) {
4810
+ pattern += source[i];
4811
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
4812
+ inCharRange = false;
4813
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
4814
+ pattern += source[i];
4815
+ inCharRange = true;
4816
+ } else {
4817
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
4818
+ }
4819
+ continue;
4820
+ }
4821
+ } else if (source[i].match(/[a-z]/)) {
4822
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
4823
+ continue;
4824
+ }
4825
+ }
4826
+ if (flags.m) {
4827
+ if (source[i] === "^") {
4828
+ pattern += `(^|(?<=[\r
4829
+ ]))`;
4830
+ continue;
4831
+ } else if (source[i] === "$") {
4832
+ pattern += `($|(?=[\r
4833
+ ]))`;
4834
+ continue;
4835
+ }
4836
+ }
4837
+ if (flags.s && source[i] === ".") {
4838
+ pattern += inCharGroup ? `${source[i]}\r
4839
+ ` : `[${source[i]}\r
4840
+ ]`;
4841
+ continue;
4842
+ }
4843
+ pattern += source[i];
4844
+ if (source[i] === "\\") {
4845
+ isEscaped = true;
4846
+ } else if (inCharGroup && source[i] === "]") {
4847
+ inCharGroup = false;
4848
+ } else if (!inCharGroup && source[i] === "[") {
4849
+ inCharGroup = true;
4850
+ }
4851
+ }
4852
+ try {
4853
+ new RegExp(pattern);
4854
+ } catch {
4855
+ console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
4856
+ return regex.source;
4857
+ }
4858
+ return pattern;
4859
+ }
4860
+ var emojiRegex2, zodPatterns, ALPHA_NUMERIC;
4861
+ var init_string = __esm({
4862
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js"() {
4863
+ "use strict";
4864
+ init_errorMessages();
4865
+ emojiRegex2 = void 0;
4866
+ zodPatterns = {
4867
+ /**
4868
+ * `c` was changed to `[cC]` to replicate /i flag
4869
+ */
4870
+ cuid: /^[cC][^\s-]{8,}$/,
4871
+ cuid2: /^[0-9a-z]+$/,
4872
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
4873
+ /**
4874
+ * `a-z` was added to replicate /i flag
4875
+ */
4876
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
4877
+ /**
4878
+ * Constructed a valid Unicode RegExp
4879
+ *
4880
+ * Lazily instantiate since this type of regex isn't supported
4881
+ * in all envs (e.g. React Native).
4882
+ *
4883
+ * See:
4884
+ * https://github.com/colinhacks/zod/issues/2433
4885
+ * Fix in Zod:
4886
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
4887
+ */
4888
+ emoji: () => {
4889
+ if (emojiRegex2 === void 0) {
4890
+ emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
4891
+ }
4892
+ return emojiRegex2;
4893
+ },
4894
+ /**
4895
+ * Unused
4896
+ */
4897
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
4898
+ /**
4899
+ * Unused
4900
+ */
4901
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
4902
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
4903
+ /**
4904
+ * Unused
4905
+ */
4906
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
4907
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
4908
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
4909
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
4910
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
4911
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
4912
+ };
4913
+ ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
4914
+ }
4915
+ });
4916
+
4917
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
4918
+ function parseRecordDef(def, refs) {
4919
+ if (refs.target === "openAi") {
4920
+ console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
4921
+ }
4922
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
4923
+ return {
4924
+ type: "object",
4925
+ required: def.keyType._def.values,
4926
+ properties: def.keyType._def.values.reduce((acc, key) => ({
4927
+ ...acc,
4928
+ [key]: parseDef(def.valueType._def, {
4929
+ ...refs,
4930
+ currentPath: [...refs.currentPath, "properties", key]
4931
+ }) ?? parseAnyDef(refs)
4932
+ }), {}),
4933
+ additionalProperties: refs.rejectedAdditionalProperties
4934
+ };
4935
+ }
4936
+ const schema = {
4937
+ type: "object",
4938
+ additionalProperties: parseDef(def.valueType._def, {
4939
+ ...refs,
4940
+ currentPath: [...refs.currentPath, "additionalProperties"]
4941
+ }) ?? refs.allowedAdditionalProperties
4942
+ };
4943
+ if (refs.target === "openApi3") {
4944
+ return schema;
4945
+ }
4946
+ if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
4947
+ const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
4948
+ return {
4949
+ ...schema,
4950
+ propertyNames: keyType
4951
+ };
4952
+ } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
4953
+ return {
4954
+ ...schema,
4955
+ propertyNames: {
4956
+ enum: def.keyType._def.values
4957
+ }
4958
+ };
4959
+ } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
4960
+ const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
4961
+ return {
4962
+ ...schema,
4963
+ propertyNames: keyType
4964
+ };
4965
+ }
4966
+ return schema;
4967
+ }
4968
+ var init_record = __esm({
4969
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js"() {
4970
+ "use strict";
4971
+ init_v3();
4972
+ init_parseDef();
4973
+ init_string();
4974
+ init_branded();
4975
+ init_any();
4976
+ }
4977
+ });
4978
+
4979
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
4980
+ function parseMapDef(def, refs) {
4981
+ if (refs.mapStrategy === "record") {
4982
+ return parseRecordDef(def, refs);
4983
+ }
4984
+ const keys = parseDef(def.keyType._def, {
4985
+ ...refs,
4986
+ currentPath: [...refs.currentPath, "items", "items", "0"]
4987
+ }) || parseAnyDef(refs);
4988
+ const values = parseDef(def.valueType._def, {
4989
+ ...refs,
4990
+ currentPath: [...refs.currentPath, "items", "items", "1"]
4991
+ }) || parseAnyDef(refs);
4992
+ return {
4993
+ type: "array",
4994
+ maxItems: 125,
4995
+ items: {
4996
+ type: "array",
4997
+ items: [keys, values],
4998
+ minItems: 2,
4999
+ maxItems: 2
5000
+ }
5001
+ };
5002
+ }
5003
+ var init_map = __esm({
5004
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js"() {
5005
+ "use strict";
5006
+ init_parseDef();
5007
+ init_record();
5008
+ init_any();
5009
+ }
5010
+ });
5011
+
5012
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
5013
+ function parseNativeEnumDef(def) {
5014
+ const object = def.values;
5015
+ const actualKeys = Object.keys(def.values).filter((key) => {
5016
+ return typeof object[object[key]] !== "number";
5017
+ });
5018
+ const actualValues = actualKeys.map((key) => object[key]);
5019
+ const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
5020
+ return {
5021
+ type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
5022
+ enum: actualValues
5023
+ };
5024
+ }
5025
+ var init_nativeEnum = __esm({
5026
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js"() {
5027
+ "use strict";
5028
+ }
5029
+ });
5030
+
5031
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
5032
+ function parseNeverDef(refs) {
5033
+ return refs.target === "openAi" ? void 0 : {
5034
+ not: parseAnyDef({
5035
+ ...refs,
5036
+ currentPath: [...refs.currentPath, "not"]
5037
+ })
5038
+ };
5039
+ }
5040
+ var init_never = __esm({
5041
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js"() {
5042
+ "use strict";
5043
+ init_any();
5044
+ }
5045
+ });
5046
+
5047
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
5048
+ function parseNullDef(refs) {
5049
+ return refs.target === "openApi3" ? {
5050
+ enum: ["null"],
5051
+ nullable: true
5052
+ } : {
5053
+ type: "null"
5054
+ };
5055
+ }
5056
+ var init_null = __esm({
5057
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js"() {
5058
+ "use strict";
5059
+ }
5060
+ });
5061
+
5062
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
5063
+ function parseUnionDef(def, refs) {
5064
+ if (refs.target === "openApi3")
5065
+ return asAnyOf(def, refs);
5066
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
5067
+ if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
5068
+ const types = options.reduce((types2, x) => {
5069
+ const type = primitiveMappings[x._def.typeName];
5070
+ return type && !types2.includes(type) ? [...types2, type] : types2;
5071
+ }, []);
5072
+ return {
5073
+ type: types.length > 1 ? types : types[0]
5074
+ };
5075
+ } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
5076
+ const types = options.reduce((acc, x) => {
5077
+ const type = typeof x._def.value;
5078
+ switch (type) {
5079
+ case "string":
5080
+ case "number":
5081
+ case "boolean":
5082
+ return [...acc, type];
5083
+ case "bigint":
5084
+ return [...acc, "integer"];
5085
+ case "object":
5086
+ if (x._def.value === null)
5087
+ return [...acc, "null"];
5088
+ case "symbol":
5089
+ case "undefined":
5090
+ case "function":
5091
+ default:
5092
+ return acc;
5093
+ }
5094
+ }, []);
5095
+ if (types.length === options.length) {
5096
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
5097
+ return {
5098
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
5099
+ enum: options.reduce((acc, x) => {
5100
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
5101
+ }, [])
5102
+ };
5103
+ }
5104
+ } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
5105
+ return {
5106
+ type: "string",
5107
+ enum: options.reduce((acc, x) => [
5108
+ ...acc,
5109
+ ...x._def.values.filter((x2) => !acc.includes(x2))
5110
+ ], [])
5111
+ };
5112
+ }
5113
+ return asAnyOf(def, refs);
5114
+ }
5115
+ var primitiveMappings, asAnyOf;
5116
+ var init_union = __esm({
5117
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js"() {
5118
+ "use strict";
5119
+ init_parseDef();
5120
+ primitiveMappings = {
5121
+ ZodString: "string",
5122
+ ZodNumber: "number",
5123
+ ZodBigInt: "integer",
5124
+ ZodBoolean: "boolean",
5125
+ ZodNull: "null"
5126
+ };
5127
+ asAnyOf = (def, refs) => {
5128
+ const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
5129
+ ...refs,
5130
+ currentPath: [...refs.currentPath, "anyOf", `${i}`]
5131
+ })).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
5132
+ return anyOf.length ? { anyOf } : void 0;
5133
+ };
5134
+ }
5135
+ });
5136
+
5137
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
5138
+ function parseNullableDef(def, refs) {
5139
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
5140
+ if (refs.target === "openApi3") {
5141
+ return {
5142
+ type: primitiveMappings[def.innerType._def.typeName],
5143
+ nullable: true
5144
+ };
5145
+ }
5146
+ return {
5147
+ type: [
5148
+ primitiveMappings[def.innerType._def.typeName],
5149
+ "null"
5150
+ ]
5151
+ };
5152
+ }
5153
+ if (refs.target === "openApi3") {
5154
+ const base2 = parseDef(def.innerType._def, {
5155
+ ...refs,
5156
+ currentPath: [...refs.currentPath]
5157
+ });
5158
+ if (base2 && "$ref" in base2)
5159
+ return { allOf: [base2], nullable: true };
5160
+ return base2 && { ...base2, nullable: true };
5161
+ }
5162
+ const base = parseDef(def.innerType._def, {
5163
+ ...refs,
5164
+ currentPath: [...refs.currentPath, "anyOf", "0"]
5165
+ });
5166
+ return base && { anyOf: [base, { type: "null" }] };
5167
+ }
5168
+ var init_nullable = __esm({
5169
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js"() {
5170
+ "use strict";
5171
+ init_parseDef();
5172
+ init_union();
5173
+ }
5174
+ });
5175
+
5176
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
5177
+ function parseNumberDef(def, refs) {
5178
+ const res = {
5179
+ type: "number"
5180
+ };
5181
+ if (!def.checks)
5182
+ return res;
5183
+ for (const check of def.checks) {
5184
+ switch (check.kind) {
5185
+ case "int":
5186
+ res.type = "integer";
5187
+ addErrorMessage(res, "type", check.message, refs);
5188
+ break;
5189
+ case "min":
5190
+ if (refs.target === "jsonSchema7") {
5191
+ if (check.inclusive) {
5192
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
5193
+ } else {
5194
+ setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
5195
+ }
5196
+ } else {
5197
+ if (!check.inclusive) {
5198
+ res.exclusiveMinimum = true;
5199
+ }
5200
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
5201
+ }
5202
+ break;
5203
+ case "max":
5204
+ if (refs.target === "jsonSchema7") {
5205
+ if (check.inclusive) {
5206
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
5207
+ } else {
5208
+ setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
5209
+ }
5210
+ } else {
5211
+ if (!check.inclusive) {
5212
+ res.exclusiveMaximum = true;
5213
+ }
5214
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
5215
+ }
5216
+ break;
5217
+ case "multipleOf":
5218
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
5219
+ break;
5220
+ }
5221
+ }
5222
+ return res;
5223
+ }
5224
+ var init_number = __esm({
5225
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js"() {
5226
+ "use strict";
5227
+ init_errorMessages();
5228
+ }
5229
+ });
5230
+
5231
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
5232
+ function parseObjectDef(def, refs) {
5233
+ const forceOptionalIntoNullable = refs.target === "openAi";
5234
+ const result = {
5235
+ type: "object",
5236
+ properties: {}
5237
+ };
5238
+ const required = [];
5239
+ const shape = def.shape();
5240
+ for (const propName in shape) {
5241
+ let propDef = shape[propName];
5242
+ if (propDef === void 0 || propDef._def === void 0) {
5243
+ continue;
5244
+ }
5245
+ let propOptional = safeIsOptional(propDef);
5246
+ if (propOptional && forceOptionalIntoNullable) {
5247
+ if (propDef._def.typeName === "ZodOptional") {
5248
+ propDef = propDef._def.innerType;
5249
+ }
5250
+ if (!propDef.isNullable()) {
5251
+ propDef = propDef.nullable();
5252
+ }
5253
+ propOptional = false;
5254
+ }
5255
+ const parsedDef = parseDef(propDef._def, {
5256
+ ...refs,
5257
+ currentPath: [...refs.currentPath, "properties", propName],
5258
+ propertyPath: [...refs.currentPath, "properties", propName]
5259
+ });
5260
+ if (parsedDef === void 0) {
5261
+ continue;
5262
+ }
5263
+ result.properties[propName] = parsedDef;
5264
+ if (!propOptional) {
5265
+ required.push(propName);
5266
+ }
5267
+ }
5268
+ if (required.length) {
5269
+ result.required = required;
5270
+ }
5271
+ const additionalProperties = decideAdditionalProperties(def, refs);
5272
+ if (additionalProperties !== void 0) {
5273
+ result.additionalProperties = additionalProperties;
5274
+ }
5275
+ return result;
5276
+ }
5277
+ function decideAdditionalProperties(def, refs) {
5278
+ if (def.catchall._def.typeName !== "ZodNever") {
5279
+ return parseDef(def.catchall._def, {
5280
+ ...refs,
5281
+ currentPath: [...refs.currentPath, "additionalProperties"]
5282
+ });
5283
+ }
5284
+ switch (def.unknownKeys) {
5285
+ case "passthrough":
5286
+ return refs.allowedAdditionalProperties;
5287
+ case "strict":
5288
+ return refs.rejectedAdditionalProperties;
5289
+ case "strip":
5290
+ return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
5291
+ }
5292
+ }
5293
+ function safeIsOptional(schema) {
5294
+ try {
5295
+ return schema.isOptional();
5296
+ } catch {
5297
+ return true;
5298
+ }
5299
+ }
5300
+ var init_object = __esm({
5301
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js"() {
5302
+ "use strict";
5303
+ init_parseDef();
5304
+ }
5305
+ });
5306
+
5307
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
5308
+ var parseOptionalDef;
5309
+ var init_optional = __esm({
5310
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js"() {
5311
+ "use strict";
5312
+ init_parseDef();
5313
+ init_any();
5314
+ parseOptionalDef = (def, refs) => {
5315
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
5316
+ return parseDef(def.innerType._def, refs);
5317
+ }
5318
+ const innerSchema = parseDef(def.innerType._def, {
5319
+ ...refs,
5320
+ currentPath: [...refs.currentPath, "anyOf", "1"]
5321
+ });
5322
+ return innerSchema ? {
5323
+ anyOf: [
5324
+ {
5325
+ not: parseAnyDef(refs)
5326
+ },
5327
+ innerSchema
5328
+ ]
5329
+ } : parseAnyDef(refs);
5330
+ };
5331
+ }
5332
+ });
5333
+
5334
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
5335
+ var parsePipelineDef;
5336
+ var init_pipeline = __esm({
5337
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js"() {
5338
+ "use strict";
5339
+ init_parseDef();
5340
+ parsePipelineDef = (def, refs) => {
5341
+ if (refs.pipeStrategy === "input") {
5342
+ return parseDef(def.in._def, refs);
5343
+ } else if (refs.pipeStrategy === "output") {
5344
+ return parseDef(def.out._def, refs);
5345
+ }
5346
+ const a = parseDef(def.in._def, {
5347
+ ...refs,
5348
+ currentPath: [...refs.currentPath, "allOf", "0"]
5349
+ });
5350
+ const b2 = parseDef(def.out._def, {
5351
+ ...refs,
5352
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
5353
+ });
5354
+ return {
5355
+ allOf: [a, b2].filter((x) => x !== void 0)
5356
+ };
5357
+ };
5358
+ }
5359
+ });
5360
+
5361
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
5362
+ function parsePromiseDef(def, refs) {
5363
+ return parseDef(def.type._def, refs);
5364
+ }
5365
+ var init_promise = __esm({
5366
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js"() {
5367
+ "use strict";
5368
+ init_parseDef();
5369
+ }
5370
+ });
5371
+
5372
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
5373
+ function parseSetDef(def, refs) {
5374
+ const items = parseDef(def.valueType._def, {
5375
+ ...refs,
5376
+ currentPath: [...refs.currentPath, "items"]
5377
+ });
5378
+ const schema = {
5379
+ type: "array",
5380
+ uniqueItems: true,
5381
+ items
5382
+ };
5383
+ if (def.minSize) {
5384
+ setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
5385
+ }
5386
+ if (def.maxSize) {
5387
+ setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
5388
+ }
5389
+ return schema;
5390
+ }
5391
+ var init_set = __esm({
5392
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js"() {
5393
+ "use strict";
5394
+ init_errorMessages();
5395
+ init_parseDef();
5396
+ }
5397
+ });
5398
+
5399
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
5400
+ function parseTupleDef(def, refs) {
5401
+ if (def.rest) {
5402
+ return {
5403
+ type: "array",
5404
+ minItems: def.items.length,
5405
+ items: def.items.map((x, i) => parseDef(x._def, {
5406
+ ...refs,
5407
+ currentPath: [...refs.currentPath, "items", `${i}`]
5408
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
5409
+ additionalItems: parseDef(def.rest._def, {
5410
+ ...refs,
5411
+ currentPath: [...refs.currentPath, "additionalItems"]
5412
+ })
5413
+ };
5414
+ } else {
5415
+ return {
5416
+ type: "array",
5417
+ minItems: def.items.length,
5418
+ maxItems: def.items.length,
5419
+ items: def.items.map((x, i) => parseDef(x._def, {
5420
+ ...refs,
5421
+ currentPath: [...refs.currentPath, "items", `${i}`]
5422
+ })).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
5423
+ };
5424
+ }
5425
+ }
5426
+ var init_tuple = __esm({
5427
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js"() {
5428
+ "use strict";
5429
+ init_parseDef();
5430
+ }
5431
+ });
5432
+
5433
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
5434
+ function parseUndefinedDef(refs) {
5435
+ return {
5436
+ not: parseAnyDef(refs)
5437
+ };
5438
+ }
5439
+ var init_undefined = __esm({
5440
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js"() {
5441
+ "use strict";
5442
+ init_any();
5443
+ }
5444
+ });
5445
+
5446
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
5447
+ function parseUnknownDef(refs) {
5448
+ return parseAnyDef(refs);
5449
+ }
5450
+ var init_unknown = __esm({
5451
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js"() {
5452
+ "use strict";
5453
+ init_any();
5454
+ }
5455
+ });
5456
+
5457
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
5458
+ var parseReadonlyDef;
5459
+ var init_readonly = __esm({
5460
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js"() {
5461
+ "use strict";
5462
+ init_parseDef();
5463
+ parseReadonlyDef = (def, refs) => {
5464
+ return parseDef(def.innerType._def, refs);
5465
+ };
5466
+ }
5467
+ });
5468
+
5469
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
5470
+ var selectParser;
5471
+ var init_selectParser = __esm({
5472
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js"() {
5473
+ "use strict";
5474
+ init_v3();
5475
+ init_any();
5476
+ init_array();
5477
+ init_bigint();
5478
+ init_boolean();
5479
+ init_branded();
5480
+ init_catch();
5481
+ init_date();
5482
+ init_default();
5483
+ init_effects();
5484
+ init_enum();
5485
+ init_intersection();
5486
+ init_literal();
5487
+ init_map();
5488
+ init_nativeEnum();
5489
+ init_never();
5490
+ init_null();
5491
+ init_nullable();
5492
+ init_number();
5493
+ init_object();
5494
+ init_optional();
5495
+ init_pipeline();
5496
+ init_promise();
5497
+ init_record();
5498
+ init_set();
5499
+ init_string();
5500
+ init_tuple();
5501
+ init_undefined();
5502
+ init_union();
5503
+ init_unknown();
5504
+ init_readonly();
5505
+ selectParser = (def, typeName, refs) => {
5506
+ switch (typeName) {
5507
+ case ZodFirstPartyTypeKind.ZodString:
5508
+ return parseStringDef(def, refs);
5509
+ case ZodFirstPartyTypeKind.ZodNumber:
5510
+ return parseNumberDef(def, refs);
5511
+ case ZodFirstPartyTypeKind.ZodObject:
5512
+ return parseObjectDef(def, refs);
5513
+ case ZodFirstPartyTypeKind.ZodBigInt:
5514
+ return parseBigintDef(def, refs);
5515
+ case ZodFirstPartyTypeKind.ZodBoolean:
5516
+ return parseBooleanDef();
5517
+ case ZodFirstPartyTypeKind.ZodDate:
5518
+ return parseDateDef(def, refs);
5519
+ case ZodFirstPartyTypeKind.ZodUndefined:
5520
+ return parseUndefinedDef(refs);
5521
+ case ZodFirstPartyTypeKind.ZodNull:
5522
+ return parseNullDef(refs);
5523
+ case ZodFirstPartyTypeKind.ZodArray:
5524
+ return parseArrayDef(def, refs);
5525
+ case ZodFirstPartyTypeKind.ZodUnion:
5526
+ case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
5527
+ return parseUnionDef(def, refs);
5528
+ case ZodFirstPartyTypeKind.ZodIntersection:
5529
+ return parseIntersectionDef(def, refs);
5530
+ case ZodFirstPartyTypeKind.ZodTuple:
5531
+ return parseTupleDef(def, refs);
5532
+ case ZodFirstPartyTypeKind.ZodRecord:
5533
+ return parseRecordDef(def, refs);
5534
+ case ZodFirstPartyTypeKind.ZodLiteral:
5535
+ return parseLiteralDef(def, refs);
5536
+ case ZodFirstPartyTypeKind.ZodEnum:
5537
+ return parseEnumDef(def);
5538
+ case ZodFirstPartyTypeKind.ZodNativeEnum:
5539
+ return parseNativeEnumDef(def);
5540
+ case ZodFirstPartyTypeKind.ZodNullable:
5541
+ return parseNullableDef(def, refs);
5542
+ case ZodFirstPartyTypeKind.ZodOptional:
5543
+ return parseOptionalDef(def, refs);
5544
+ case ZodFirstPartyTypeKind.ZodMap:
5545
+ return parseMapDef(def, refs);
5546
+ case ZodFirstPartyTypeKind.ZodSet:
5547
+ return parseSetDef(def, refs);
5548
+ case ZodFirstPartyTypeKind.ZodLazy:
5549
+ return () => def.getter()._def;
5550
+ case ZodFirstPartyTypeKind.ZodPromise:
5551
+ return parsePromiseDef(def, refs);
5552
+ case ZodFirstPartyTypeKind.ZodNaN:
5553
+ case ZodFirstPartyTypeKind.ZodNever:
5554
+ return parseNeverDef(refs);
5555
+ case ZodFirstPartyTypeKind.ZodEffects:
5556
+ return parseEffectsDef(def, refs);
5557
+ case ZodFirstPartyTypeKind.ZodAny:
5558
+ return parseAnyDef(refs);
5559
+ case ZodFirstPartyTypeKind.ZodUnknown:
5560
+ return parseUnknownDef(refs);
5561
+ case ZodFirstPartyTypeKind.ZodDefault:
5562
+ return parseDefaultDef(def, refs);
5563
+ case ZodFirstPartyTypeKind.ZodBranded:
5564
+ return parseBrandedDef(def, refs);
5565
+ case ZodFirstPartyTypeKind.ZodReadonly:
5566
+ return parseReadonlyDef(def, refs);
5567
+ case ZodFirstPartyTypeKind.ZodCatch:
5568
+ return parseCatchDef(def, refs);
5569
+ case ZodFirstPartyTypeKind.ZodPipeline:
5570
+ return parsePipelineDef(def, refs);
5571
+ case ZodFirstPartyTypeKind.ZodFunction:
5572
+ case ZodFirstPartyTypeKind.ZodVoid:
5573
+ case ZodFirstPartyTypeKind.ZodSymbol:
5574
+ return void 0;
5575
+ default:
5576
+ return /* @__PURE__ */ ((_2) => void 0)(typeName);
5577
+ }
5578
+ };
5579
+ }
5580
+ });
5581
+
5582
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
5583
+ function parseDef(def, refs, forceResolution = false) {
5584
+ const seenItem = refs.seen.get(def);
5585
+ if (refs.override) {
5586
+ const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
5587
+ if (overrideResult !== ignoreOverride) {
5588
+ return overrideResult;
5589
+ }
5590
+ }
5591
+ if (seenItem && !forceResolution) {
5592
+ const seenSchema = get$ref(seenItem, refs);
5593
+ if (seenSchema !== void 0) {
5594
+ return seenSchema;
5595
+ }
5596
+ }
5597
+ const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
5598
+ refs.seen.set(def, newItem);
5599
+ const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
5600
+ const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
5601
+ if (jsonSchema) {
5602
+ addMeta(def, refs, jsonSchema);
5603
+ }
5604
+ if (refs.postProcess) {
5605
+ const postProcessResult = refs.postProcess(jsonSchema, def, refs);
5606
+ newItem.jsonSchema = jsonSchema;
5607
+ return postProcessResult;
5608
+ }
5609
+ newItem.jsonSchema = jsonSchema;
5610
+ return jsonSchema;
5611
+ }
5612
+ var get$ref, addMeta;
5613
+ var init_parseDef = __esm({
5614
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js"() {
5615
+ "use strict";
5616
+ init_Options();
5617
+ init_selectParser();
5618
+ init_getRelativePath();
5619
+ init_any();
5620
+ get$ref = (item, refs) => {
5621
+ switch (refs.$refStrategy) {
5622
+ case "root":
5623
+ return { $ref: item.path.join("/") };
5624
+ case "relative":
5625
+ return { $ref: getRelativePath(refs.currentPath, item.path) };
5626
+ case "none":
5627
+ case "seen": {
5628
+ if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
5629
+ console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
5630
+ return parseAnyDef(refs);
5631
+ }
5632
+ return refs.$refStrategy === "seen" ? parseAnyDef(refs) : void 0;
5633
+ }
5634
+ }
5635
+ };
5636
+ addMeta = (def, refs, jsonSchema) => {
5637
+ if (def.description) {
5638
+ jsonSchema.description = def.description;
5639
+ if (refs.markdownDescription) {
5640
+ jsonSchema.markdownDescription = def.description;
5641
+ }
5642
+ }
5643
+ return jsonSchema;
5644
+ };
5645
+ }
5646
+ });
5647
+
5648
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseTypes.js
5649
+ var init_parseTypes = __esm({
5650
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseTypes.js"() {
5651
+ "use strict";
5652
+ }
5653
+ });
5654
+
5655
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
5656
+ var zodToJsonSchema;
5657
+ var init_zodToJsonSchema = __esm({
5658
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js"() {
5659
+ "use strict";
5660
+ init_parseDef();
5661
+ init_Refs();
5662
+ init_any();
5663
+ zodToJsonSchema = (schema, options) => {
5664
+ const refs = getRefs(options);
5665
+ let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
5666
+ ...acc,
5667
+ [name2]: parseDef(schema2._def, {
5668
+ ...refs,
5669
+ currentPath: [...refs.basePath, refs.definitionPath, name2]
5670
+ }, true) ?? parseAnyDef(refs)
5671
+ }), {}) : void 0;
5672
+ const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
5673
+ const main2 = parseDef(schema._def, name === void 0 ? refs : {
5674
+ ...refs,
5675
+ currentPath: [...refs.basePath, refs.definitionPath, name]
5676
+ }, false) ?? parseAnyDef(refs);
5677
+ const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
5678
+ if (title !== void 0) {
5679
+ main2.title = title;
5680
+ }
5681
+ if (refs.flags.hasReferencedOpenAiAnyType) {
5682
+ if (!definitions) {
5683
+ definitions = {};
5684
+ }
5685
+ if (!definitions[refs.openAiAnyTypeName]) {
5686
+ definitions[refs.openAiAnyTypeName] = {
5687
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
5688
+ type: ["string", "number", "integer", "boolean", "array", "null"],
5689
+ items: {
5690
+ $ref: refs.$refStrategy === "relative" ? "1" : [
5691
+ ...refs.basePath,
5692
+ refs.definitionPath,
5693
+ refs.openAiAnyTypeName
5694
+ ].join("/")
5695
+ }
5696
+ };
5697
+ }
5698
+ }
5699
+ const combined = name === void 0 ? definitions ? {
5700
+ ...main2,
5701
+ [refs.definitionPath]: definitions
5702
+ } : main2 : {
5703
+ $ref: [
5704
+ ...refs.$refStrategy === "relative" ? [] : refs.basePath,
5705
+ refs.definitionPath,
5706
+ name
5707
+ ].join("/"),
5708
+ [refs.definitionPath]: {
5709
+ ...definitions,
5710
+ [name]: main2
5711
+ }
5712
+ };
5713
+ if (refs.target === "jsonSchema7") {
5714
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
5715
+ } else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
5716
+ combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
5717
+ }
5718
+ if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
5719
+ console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
5720
+ }
5721
+ return combined;
5722
+ };
5723
+ }
5724
+ });
5725
+
5726
+ // ../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
5727
+ var init_esm = __esm({
5728
+ "../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js"() {
5729
+ "use strict";
5730
+ init_Options();
5731
+ init_Refs();
5732
+ init_errorMessages();
5733
+ init_getRelativePath();
5734
+ init_parseDef();
5735
+ init_parseTypes();
5736
+ init_any();
5737
+ init_array();
5738
+ init_bigint();
5739
+ init_boolean();
5740
+ init_branded();
5741
+ init_catch();
5742
+ init_date();
5743
+ init_default();
5744
+ init_effects();
5745
+ init_enum();
5746
+ init_intersection();
5747
+ init_literal();
5748
+ init_map();
5749
+ init_nativeEnum();
5750
+ init_never();
5751
+ init_null();
5752
+ init_nullable();
5753
+ init_number();
5754
+ init_object();
5755
+ init_optional();
5756
+ init_pipeline();
5757
+ init_promise();
5758
+ init_readonly();
5759
+ init_record();
5760
+ init_set();
5761
+ init_string();
5762
+ init_tuple();
5763
+ init_undefined();
5764
+ init_union();
5765
+ init_unknown();
5766
+ init_selectParser();
5767
+ init_zodToJsonSchema();
5768
+ init_zodToJsonSchema();
5769
+ }
5770
+ });
5771
+
4152
5772
  // ../protocol/src/attachment-schemas.ts
4153
5773
  var TOKEN_ROLES, GROUP_FILE_SOURCES, GroupFileEntrySchema, AttachmentSignUrlArgs, AttachmentSignUrlResponseSchema, AttachmentGroupAddArgs, AttachmentGroupAddResponseSchema, AttachmentGroupRemoveArgs, AttachmentGroupRemoveResponseSchema, AttachmentGroupListArgs, AttachmentGroupListResponseSchema, AttachmentUploadResponseSchema;
4154
5774
  var init_attachment_schemas = __esm({
@@ -4534,11 +6154,12 @@ var init_feishu_auth = __esm({
4534
6154
  });
4535
6155
 
4536
6156
  // ../protocol/src/dispatch.ts
4537
- var DispatchOutcomeSchema, DispatchRunArgsSchema, DispatchCompleteArgsSchema, DISPATCH_STATUSES, DispatchStatusSchema, DispatchRecordSchema, DispatchListArgsSchema, DispatchListResultSchema, DispatchGetArgsSchema, DispatchGetOkSchema;
6157
+ var EXTERNAL_DISPATCH_SOURCE, DispatchOutcomeSchema, DispatchRunArgsSchema, DispatchCompleteArgsSchema, DISPATCH_STATUSES, DispatchStatusSchema, DispatchRecordSchema, DispatchListArgsSchema, DispatchListResultSchema, DispatchGetArgsSchema, DispatchGetOkSchema;
4538
6158
  var init_dispatch = __esm({
4539
6159
  "../protocol/src/dispatch.ts"() {
4540
6160
  "use strict";
4541
6161
  init_zod();
6162
+ EXTERNAL_DISPATCH_SOURCE = "external-agent";
4542
6163
  DispatchOutcomeSchema = external_exports.discriminatedUnion("kind", [
4543
6164
  external_exports.object({
4544
6165
  kind: external_exports.literal("success"),
@@ -5153,7 +6774,7 @@ var init_principal = __esm({
5153
6774
  });
5154
6775
 
5155
6776
  // ../protocol/src/schemas.ts
5156
- var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, ToolFeaturesSchema, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionListArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionInterruptArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionCurrentTurnSenderArgs, SessionSubscribeArgs, SessionPinArgs, PeerSessionUpsertArgs, PeerSessionUpsertResponseSchema, PeerSessionRemoveArgs, PeerSessionRemoveResponseSchema, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, CancelQuestionArgs, CancelQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelReadyEventSchema, TunnelExitedEventSchema, TunnelUnavailableEventSchema, InfoRunningSessionSchema, InfoResponseSchema, PROJECT_PORT_MIN, PROJECT_PORT_MAX, projectNameRegex, DEFAULT_DEV_COMMAND, ProjectMetadataSchema, PROJECT_STAGE_VALUES, ProjectStageSchema, ProjectWithStatusSchema, ListProjectsArgsSchema, ListProjectsResultSchema, GetProjectArgsSchema, GetProjectResultSchema, CreateProjectArgsSchema, CreateProjectResultSchema, DeleteProjectArgsSchema, DeleteProjectResultSchema, UpdateProjectPortArgsSchema, UpdateProjectPortResultSchema, SetProdUrlArgsSchema, SetProdUrlResultSchema, StartDevServerArgsSchema, StartDevServerResultSchema, ASSISTANT_REPORTABLE_STAGES, ReportStageArgsSchema, ReportStageResultSchema, StopDevServerArgsSchema, StopDevServerResultSchema, AppBuilderProjectUpdatedEventSchema, PublishArgsSchema, PublishResultSchema, DismissPublishJobArgsSchema, DismissPublishJobResultSchema, AppBuilderPublishProgressEventSchema, AppBuilderPublishFailedEventSchema;
6777
+ var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, ToolFeaturesSchema, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionListArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionInterruptArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionCurrentTurnSenderArgs, SessionSubscribeArgs, SessionPinArgs, PeerSessionUpsertArgs, PeerSessionUpsertResponseSchema, PeerSessionRemoveArgs, PeerSessionRemoveResponseSchema, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, CancelQuestionArgs, CancelQuestionResponseSchema, ClientInfoSchema, AuthRequestFrameSchema, AuthOkFrameSchema, DeviceConnectionEntrySchema, DeviceConnectionsResponseSchema, TunnelReadyEventSchema, TunnelExitedEventSchema, TunnelUnavailableEventSchema, InfoRunningSessionSchema, InfoResponseSchema, PROJECT_PORT_MIN, PROJECT_PORT_MAX, projectNameRegex, DEFAULT_DEV_COMMAND, ProjectMetadataSchema, PROJECT_STAGE_VALUES, ProjectStageSchema, ProjectWithStatusSchema, ListProjectsArgsSchema, ListProjectsResultSchema, GetProjectArgsSchema, GetProjectResultSchema, CreateProjectArgsSchema, CreateProjectResultSchema, DeleteProjectArgsSchema, DeleteProjectResultSchema, UpdateProjectPortArgsSchema, UpdateProjectPortResultSchema, SetProdUrlArgsSchema, SetProdUrlResultSchema, StartDevServerArgsSchema, StartDevServerResultSchema, ASSISTANT_REPORTABLE_STAGES, ReportStageArgsSchema, ReportStageResultSchema, StopDevServerArgsSchema, StopDevServerResultSchema, AppBuilderProjectUpdatedEventSchema, PublishArgsSchema, PublishResultSchema, DismissPublishJobArgsSchema, DismissPublishJobResultSchema, AppBuilderPublishProgressEventSchema, AppBuilderPublishFailedEventSchema;
5157
6778
  var init_schemas = __esm({
5158
6779
  "../protocol/src/schemas.ts"() {
5159
6780
  "use strict";
@@ -5845,6 +7466,13 @@ var init_schemas = __esm({
5845
7466
  toolUseId: external_exports.string().min(1)
5846
7467
  });
5847
7468
  CancelQuestionResponseSchema = external_exports.object({ ok: external_exports.literal(true) });
7469
+ ClientInfoSchema = external_exports.object({
7470
+ name: external_exports.string().min(1),
7471
+ version: external_exports.string().min(1),
7472
+ instanceId: external_exports.string().min(1),
7473
+ /** 自报设备名(如 os.hostname()),展示用非身份;trim 后截断 64 字符 */
7474
+ deviceLabel: external_exports.string().transform((s) => s.trim().slice(0, 64)).optional()
7475
+ });
5848
7476
  AuthRequestFrameSchema = external_exports.object({
5849
7477
  type: external_exports.literal("auth"),
5850
7478
  token: external_exports.string().min(1),
@@ -5865,17 +7493,23 @@ var init_schemas = __esm({
5865
7493
  * 'clawd-mobile-android' / ...),宽容未知值(将来加新客户端不动 schema)。
5866
7494
  * instanceId:客户端首启生成 UUID 并本地持久化——区分同种类多实例(多手机/多 desktop 同连)。
5867
7495
  */
5868
- clientInfo: external_exports.object({
5869
- name: external_exports.string().min(1),
5870
- version: external_exports.string().min(1),
5871
- instanceId: external_exports.string().min(1)
5872
- }).optional()
7496
+ clientInfo: ClientInfoSchema.optional()
5873
7497
  });
5874
7498
  AuthOkFrameSchema = external_exports.object({
5875
7499
  type: external_exports.literal("auth:ok"),
5876
7500
  version: external_exports.string().min(1).optional(),
5877
7501
  protocolVersion: external_exports.number().int().nonnegative().optional()
5878
7502
  });
7503
+ DeviceConnectionEntrySchema = external_exports.object({
7504
+ clientId: external_exports.string().min(1),
7505
+ connectedAt: external_exports.number().int().nonnegative(),
7506
+ self: external_exports.boolean(),
7507
+ clientInfo: ClientInfoSchema.optional()
7508
+ });
7509
+ DeviceConnectionsResponseSchema = external_exports.object({
7510
+ type: external_exports.literal("device:connections:ok"),
7511
+ connections: external_exports.array(DeviceConnectionEntrySchema)
7512
+ });
5879
7513
  TunnelReadyEventSchema = external_exports.object({
5880
7514
  type: external_exports.literal("tunnel:ready"),
5881
7515
  url: external_exports.string().min(1),
@@ -6116,21 +7750,28 @@ var init_schemas = __esm({
6116
7750
  });
6117
7751
 
6118
7752
  // ../protocol/src/methods.ts
7753
+ function isMethodName(name) {
7754
+ return METHOD_NAMES.includes(name);
7755
+ }
7756
+ function methodArgsSchema(method) {
7757
+ const doc = METHOD_DOCS[method];
7758
+ if (!doc.args) return null;
7759
+ const base = zodToJsonSchema(doc.args, { $refStrategy: "none" });
7760
+ return doc.argsConstraints ? { ...base, ...doc.argsConstraints } : base;
7761
+ }
6119
7762
  function methodArgFields(method) {
6120
- let schema = METHOD_DOCS[method].args;
7763
+ const schema = methodArgsSchema(method);
6121
7764
  if (!schema) return null;
6122
- for (let i = 0; i < 5 && schema && !schema.shape; i += 1) {
6123
- schema = schema._def?.schema;
6124
- }
6125
- const shape = schema?.shape;
6126
- if (!shape) return null;
6127
- return Object.entries(shape).map(([name, def]) => ({ name, required: !def.isOptional() }));
7765
+ const props = schema.properties ?? {};
7766
+ const required = new Set(schema.required ?? []);
7767
+ return Object.keys(props).map((name) => ({ name, required: required.has(name) }));
6128
7768
  }
6129
- var NO_ARGS, METHOD_DOCS, METHOD_NAMES, RPC_METHOD_STATUSES, RpcMethodStatusSchema, RpcMethodInfoSchema, MetaMethodsResultSchema;
7769
+ var NO_ARGS, MetaMethodsArgs, METHOD_DOCS, METHOD_NAMES, RPC_METHOD_STATUSES, RpcMethodStatusSchema, RpcMethodInfoSchema, MetaMethodsResultSchema;
6130
7770
  var init_methods = __esm({
6131
7771
  "../protocol/src/methods.ts"() {
6132
7772
  "use strict";
6133
7773
  init_zod();
7774
+ init_esm();
6134
7775
  init_attachment_schemas();
6135
7776
  init_contact_handshake();
6136
7777
  init_contact_remote_access();
@@ -6144,10 +7785,16 @@ var init_methods = __esm({
6144
7785
  init_persona_schemas();
6145
7786
  init_schemas();
6146
7787
  NO_ARGS = external_exports.object({});
7788
+ MetaMethodsArgs = external_exports.object({
7789
+ method: external_exports.string().min(1).optional()
7790
+ });
6147
7791
  METHOD_DOCS = {
6148
7792
  "session:create": {
6149
- summary: "\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u62C9\u8D77 tool \u8FDB\u7A0B\uFF08claude / codex\uFF09\u3002**cwd \u4E0E ownerPersonaId \u81F3\u5C11\u4F20\u4E00\u4E2A**\uFF08\u5E26 ownerPersonaId \u65F6 cwd \u7531 daemon \u6D3E\u751F\uFF09\u2014\u2014\u8FD9\u6761\u4E92\u65A5\u7EA6\u675F\u662F schema \u7684 refine\uFF0C\u53CD\u5C04\u4E0D\u51FA\u6765",
6150
- args: SessionCreateArgs
7793
+ summary: "\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u62C9\u8D77 tool \u8FDB\u7A0B\uFF08claude / codex\uFF09\u3002**cwd \u4E0E ownerPersonaId \u81F3\u5C11\u4F20\u4E00\u4E2A**\uFF08\u5E26 ownerPersonaId \u65F6 cwd \u7531 daemon \u6D3E\u751F\uFF09",
7794
+ args: SessionCreateArgs,
7795
+ argsConstraints: {
7796
+ anyOf: [{ required: ["cwd"] }, { required: ["ownerPersonaId"] }]
7797
+ }
6151
7798
  },
6152
7799
  "session:list": {
6153
7800
  summary: "\u5217\u51FA\u5F53\u524D\u8EAB\u4EFD\u53EF\u89C1\u7684\u4F1A\u8BDD\uFF08owner \u5168\u91CF\uFF1Bguest \u9650\u88AB\u6388\u6743 persona\uFF09",
@@ -6355,7 +8002,11 @@ var init_methods = __esm({
6355
8002
  },
6356
8003
  "personaDispatch:run": {
6357
8004
  summary: "\u628A\u4EFB\u52A1\u59D4\u6D3E\u7ED9\u53E6\u4E00\u4E2A persona\uFF08\u53EF\u8DE8\u8BBE\u5907\uFF09\uFF0C\u5F02\u6B65\u79D2\u56DE { dispatchId }\u3002targetPersona \u4E0E dispatchId **\u81F3\u5C11\u7ED9\u4E00\u4E2A**\uFF08\u524D\u8005\u65B0\u5F00\u3001\u540E\u8005\u7EED\u6D3E\uFF09\uFF1BdispatchId \u4E0E targetDeviceId **\u4E92\u65A5**",
6358
- args: DispatchRunArgsSchema
8005
+ args: DispatchRunArgsSchema,
8006
+ argsConstraints: {
8007
+ anyOf: [{ required: ["targetPersona"] }, { required: ["dispatchId"] }],
8008
+ not: { required: ["dispatchId", "targetDeviceId"] }
8009
+ }
6359
8010
  },
6360
8011
  "personaDispatch:complete": {
6361
8012
  summary: '\u88AB\u59D4\u6D3E\u65B9\u56DE\u62A5\u7ED3\u679C\uFF1A\u5199\u53F0\u8D26\u5E76\u628A\u7ED3\u679C\u6295\u9012\u56DE\u53D1\u8D77\u65B9\u4F1A\u8BDD\u3002outcome \u662F { kind:"success", text, filePaths? } \u6216 { kind:"failure", reason } \u4E8C\u9009\u4E00',
@@ -6451,8 +8102,8 @@ var init_methods = __esm({
6451
8102
  args: NO_ARGS
6452
8103
  },
6453
8104
  "meta:methods": {
6454
- summary: "RPC \u81EA\u7701\uFF1A\u8FD4\u56DE METHOD_NAMES \u5168\u96C6 + **\u5BF9\u672C\u8FDE\u63A5**\u7684\u53EF\u8C03\u7528\u6027\u4E09\u6001\uFF08allowed / conditional / denied\uFF09+ \u6BCF\u6761\u7684\u8BF4\u660E\u3002agent \u4FA7 clawd-rpc \u7684 list tool \u662F\u552F\u4E00\u6D88\u8D39\u65B9",
6455
- args: NO_ARGS
8105
+ summary: "RPC \u81EA\u7701\uFF1A\u8FD4\u56DE METHOD_NAMES \u5168\u96C6 + **\u5BF9\u672C\u8FDE\u63A5**\u7684\u53EF\u8C03\u7528\u6027\u4E09\u6001\uFF08allowed / conditional / denied\uFF09+ \u6BCF\u6761\u7684\u8BF4\u660E\u3002\u4F20 method \u5219\u53EA\u8FD4\u90A3\u4E00\u6761\uFF0C\u5E76\u989D\u5916\u5E26\u5B8C\u6574 args JSON Schema\u3002agent \u4FA7 clawd-rpc \u7684 list tool \u662F\u552F\u4E00\u6D88\u8D39\u65B9",
8106
+ args: MetaMethodsArgs
6456
8107
  },
6457
8108
  "extension.list": {
6458
8109
  summary: "\u5217\u51FA\u5DF2\u5B89\u88C5\u7684 extension",
@@ -6518,6 +8169,10 @@ var init_methods = __esm({
6518
8169
  summary: "\u8FDE\u63A5\u76EE\u6807\u8BBE\u5907\uFF1A\u6362 aud \u7ED1\u5B9A\u7684\u7B7E\u540D token \u5E76\u8D70 contact:handshake \u5EFA\u8054\u3002owner-only",
6519
8170
  args: DeviceConnectArgsSchema
6520
8171
  },
8172
+ "device:connections": {
8173
+ summary: '\u5217\u51FA\u672C daemon \u5F53\u524D\u6240\u6709 owner WS \u8FDE\u63A5\uFF08\u672C\u673A UI / \u624B\u673A / \u7B2C\u4E8C\u53F0\u684C\u9762\uFF09+ \u5404\u81EA clientInfo\u3002owner-only\uFF1Bguest \u8FDE\u63A5\u4E0D\u5728\u5217\uFF08\u4E0D\u662F"\u6211\u7684\u8BBE\u5907"\u4E14\u4E0D\u5411 UI \u6CC4\u9732 guest \u4FE1\u606F\uFF09',
8174
+ args: NO_ARGS
8175
+ },
6521
8176
  "appBuilder:listProjects": {
6522
8177
  summary: "\u5217\u51FA app-builder project\uFF08\u542B dev server \u72B6\u6001\uFF09",
6523
8178
  args: ListProjectsArgsSchema
@@ -6577,6 +8232,11 @@ var init_methods = __esm({
6577
8232
  * `null` = 该 method 还没有中央 zod schema(欠账,见 RpcMethodDoc),调用方需自行试探。
6578
8233
  */
6579
8234
  args: external_exports.array(external_exports.object({ name: external_exports.string(), required: external_exports.boolean() })).nullable(),
8235
+ /**
8236
+ * 完整 args JSON Schema(draft-07),来自 {@link methodArgsSchema}。
8237
+ * **只在按 method 单查时下发**——全量目录带上 105 份 schema 会吃掉消费方一大块 context。
8238
+ */
8239
+ argsSchema: external_exports.record(external_exports.unknown()).optional(),
6580
8240
  /**
6581
8241
  * `denied` 必带:daemon error code(`UNAUTHORIZED` / `FEISHU_LOGIN_REQUIRED` /
6582
8242
  * `METHOD_NOT_IMPLEMENTED`)。`conditional` 必带:谁来做二次校验。
@@ -7008,8 +8668,8 @@ var require_req = __commonJS({
7008
8668
  if (req.originalUrl) {
7009
8669
  _req.url = req.originalUrl;
7010
8670
  } else {
7011
- const path76 = req.path;
7012
- _req.url = typeof path76 === "string" ? path76 : req.url ? req.url.path || req.url : void 0;
8671
+ const path77 = req.path;
8672
+ _req.url = typeof path77 === "string" ? path77 : req.url ? req.url.path || req.url : void 0;
7013
8673
  }
7014
8674
  if (req.query) {
7015
8675
  _req.query = req.query;
@@ -7174,14 +8834,14 @@ var require_redact = __commonJS({
7174
8834
  }
7175
8835
  return obj;
7176
8836
  }
7177
- function parsePath(path76) {
8837
+ function parsePath(path77) {
7178
8838
  const parts = [];
7179
8839
  let current = "";
7180
8840
  let inBrackets = false;
7181
8841
  let inQuotes = false;
7182
8842
  let quoteChar = "";
7183
- for (let i = 0; i < path76.length; i++) {
7184
- const char = path76[i];
8843
+ for (let i = 0; i < path77.length; i++) {
8844
+ const char = path77[i];
7185
8845
  if (!inBrackets && char === ".") {
7186
8846
  if (current) {
7187
8847
  parts.push(current);
@@ -7312,10 +8972,10 @@ var require_redact = __commonJS({
7312
8972
  return current;
7313
8973
  }
7314
8974
  function redactPaths(obj, paths, censor, remove = false) {
7315
- for (const path76 of paths) {
7316
- const parts = parsePath(path76);
8975
+ for (const path77 of paths) {
8976
+ const parts = parsePath(path77);
7317
8977
  if (parts.includes("*")) {
7318
- redactWildcardPath(obj, parts, censor, path76, remove);
8978
+ redactWildcardPath(obj, parts, censor, path77, remove);
7319
8979
  } else {
7320
8980
  if (remove) {
7321
8981
  removeKey(obj, parts);
@@ -7400,8 +9060,8 @@ var require_redact = __commonJS({
7400
9060
  }
7401
9061
  } else {
7402
9062
  if (afterWildcard.includes("*")) {
7403
- const wrappedCensor = typeof censor === "function" ? (value, path76) => {
7404
- const fullPath = [...pathArray.slice(0, pathLength), ...path76];
9063
+ const wrappedCensor = typeof censor === "function" ? (value, path77) => {
9064
+ const fullPath = [...pathArray.slice(0, pathLength), ...path77];
7405
9065
  return censor(value, fullPath);
7406
9066
  } : censor;
7407
9067
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -7436,8 +9096,8 @@ var require_redact = __commonJS({
7436
9096
  return null;
7437
9097
  }
7438
9098
  const pathStructure = /* @__PURE__ */ new Map();
7439
- for (const path76 of pathsToClone) {
7440
- const parts = parsePath(path76);
9099
+ for (const path77 of pathsToClone) {
9100
+ const parts = parsePath(path77);
7441
9101
  let current = pathStructure;
7442
9102
  for (let i = 0; i < parts.length; i++) {
7443
9103
  const part = parts[i];
@@ -7489,24 +9149,24 @@ var require_redact = __commonJS({
7489
9149
  }
7490
9150
  return cloneSelectively(obj, pathStructure);
7491
9151
  }
7492
- function validatePath(path76) {
7493
- if (typeof path76 !== "string") {
9152
+ function validatePath(path77) {
9153
+ if (typeof path77 !== "string") {
7494
9154
  throw new Error("Paths must be (non-empty) strings");
7495
9155
  }
7496
- if (path76 === "") {
9156
+ if (path77 === "") {
7497
9157
  throw new Error("Invalid redaction path ()");
7498
9158
  }
7499
- if (path76.includes("..")) {
7500
- throw new Error(`Invalid redaction path (${path76})`);
9159
+ if (path77.includes("..")) {
9160
+ throw new Error(`Invalid redaction path (${path77})`);
7501
9161
  }
7502
- if (path76.includes(",")) {
7503
- throw new Error(`Invalid redaction path (${path76})`);
9162
+ if (path77.includes(",")) {
9163
+ throw new Error(`Invalid redaction path (${path77})`);
7504
9164
  }
7505
9165
  let bracketCount = 0;
7506
9166
  let inQuotes = false;
7507
9167
  let quoteChar = "";
7508
- for (let i = 0; i < path76.length; i++) {
7509
- const char = path76[i];
9168
+ for (let i = 0; i < path77.length; i++) {
9169
+ const char = path77[i];
7510
9170
  if ((char === '"' || char === "'") && bracketCount > 0) {
7511
9171
  if (!inQuotes) {
7512
9172
  inQuotes = true;
@@ -7520,20 +9180,20 @@ var require_redact = __commonJS({
7520
9180
  } else if (char === "]" && !inQuotes) {
7521
9181
  bracketCount--;
7522
9182
  if (bracketCount < 0) {
7523
- throw new Error(`Invalid redaction path (${path76})`);
9183
+ throw new Error(`Invalid redaction path (${path77})`);
7524
9184
  }
7525
9185
  }
7526
9186
  }
7527
9187
  if (bracketCount !== 0) {
7528
- throw new Error(`Invalid redaction path (${path76})`);
9188
+ throw new Error(`Invalid redaction path (${path77})`);
7529
9189
  }
7530
9190
  }
7531
9191
  function validatePaths(paths) {
7532
9192
  if (!Array.isArray(paths)) {
7533
9193
  throw new TypeError("paths must be an array");
7534
9194
  }
7535
- for (const path76 of paths) {
7536
- validatePath(path76);
9195
+ for (const path77 of paths) {
9196
+ validatePath(path77);
7537
9197
  }
7538
9198
  }
7539
9199
  function slowRedact(options = {}) {
@@ -7701,8 +9361,8 @@ var require_redaction = __commonJS({
7701
9361
  if (shape[k2] === null) {
7702
9362
  o[k2] = (value) => topCensor(value, [k2]);
7703
9363
  } else {
7704
- const wrappedCensor = typeof censor === "function" ? (value, path76) => {
7705
- return censor(value, [k2, ...path76]);
9364
+ const wrappedCensor = typeof censor === "function" ? (value, path77) => {
9365
+ return censor(value, [k2, ...path77]);
7706
9366
  } : censor;
7707
9367
  o[k2] = Redact({
7708
9368
  paths: shape[k2],
@@ -7923,7 +9583,7 @@ var require_sonic_boom = __commonJS({
7923
9583
  var fs67 = require("fs");
7924
9584
  var EventEmitter3 = require("events");
7925
9585
  var inherits = require("util").inherits;
7926
- var path76 = require("path");
9586
+ var path77 = require("path");
7927
9587
  var sleep2 = require_atomic_sleep();
7928
9588
  var assert = require("assert");
7929
9589
  var BUSY_WRITE_TIMEOUT = 100;
@@ -7977,7 +9637,7 @@ var require_sonic_boom = __commonJS({
7977
9637
  const mode = sonic.mode;
7978
9638
  if (sonic.sync) {
7979
9639
  try {
7980
- if (sonic.mkdir) fs67.mkdirSync(path76.dirname(file), { recursive: true });
9640
+ if (sonic.mkdir) fs67.mkdirSync(path77.dirname(file), { recursive: true });
7981
9641
  const fd = fs67.openSync(file, flags, mode);
7982
9642
  fileOpened(null, fd);
7983
9643
  } catch (err) {
@@ -7985,7 +9645,7 @@ var require_sonic_boom = __commonJS({
7985
9645
  throw err;
7986
9646
  }
7987
9647
  } else if (sonic.mkdir) {
7988
- fs67.mkdir(path76.dirname(file), { recursive: true }, (err) => {
9648
+ fs67.mkdir(path77.dirname(file), { recursive: true }, (err) => {
7989
9649
  if (err) return fileOpened(err);
7990
9650
  fs67.open(file, flags, mode, fileOpened);
7991
9651
  });
@@ -9534,7 +11194,7 @@ var require_tools = __commonJS({
9534
11194
  stream.flushSync();
9535
11195
  }
9536
11196
  }
9537
- function createArgsNormalizer(defaultOptions) {
11197
+ function createArgsNormalizer(defaultOptions2) {
9538
11198
  return function normalizeArgs(instance, caller, opts = {}, stream) {
9539
11199
  if (typeof opts === "string") {
9540
11200
  stream = buildSafeSonicBoom({ dest: opts });
@@ -9560,9 +11220,9 @@ var require_tools = __commonJS({
9560
11220
  }
9561
11221
  stream = transport({ caller, ...opts.transport, levels: customLevels });
9562
11222
  }
9563
- opts = Object.assign({}, defaultOptions, opts);
9564
- opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
9565
- opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
11223
+ opts = Object.assign({}, defaultOptions2, opts);
11224
+ opts.serializers = Object.assign({}, defaultOptions2.serializers, opts.serializers);
11225
+ opts.formatters = Object.assign({}, defaultOptions2.formatters, opts.formatters);
9566
11226
  if (opts.prettyPrint) {
9567
11227
  throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
9568
11228
  }
@@ -10894,7 +12554,7 @@ var require_pino = __commonJS({
10894
12554
  var { pid } = process;
10895
12555
  var hostname = os24.hostname();
10896
12556
  var defaultErrorSerializer = stdSerializers.err;
10897
- var defaultOptions = {
12557
+ var defaultOptions2 = {
10898
12558
  level: "info",
10899
12559
  levelComparison: SORTING_ORDER.ASC,
10900
12560
  levels: DEFAULT_LEVELS,
@@ -10926,7 +12586,7 @@ var require_pino = __commonJS({
10926
12586
  depthLimit: 5,
10927
12587
  edgeLimit: 100
10928
12588
  };
10929
- var normalize = createArgsNormalizer(defaultOptions);
12589
+ var normalize = createArgsNormalizer(defaultOptions2);
10930
12590
  var serializers = Object.assign(/* @__PURE__ */ Object.create(null), stdSerializers);
10931
12591
  function pino2(...args) {
10932
12592
  const instance = {};
@@ -11616,11 +13276,11 @@ var init_lib = __esm({
11616
13276
  }
11617
13277
  }
11618
13278
  },
11619
- addToPath: function addToPath(path76, added, removed, oldPosInc, options) {
11620
- var last = path76.lastComponent;
13279
+ addToPath: function addToPath(path77, added, removed, oldPosInc, options) {
13280
+ var last = path77.lastComponent;
11621
13281
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
11622
13282
  return {
11623
- oldPos: path76.oldPos + oldPosInc,
13283
+ oldPos: path77.oldPos + oldPosInc,
11624
13284
  lastComponent: {
11625
13285
  count: last.count + 1,
11626
13286
  added,
@@ -11630,7 +13290,7 @@ var init_lib = __esm({
11630
13290
  };
11631
13291
  } else {
11632
13292
  return {
11633
- oldPos: path76.oldPos + oldPosInc,
13293
+ oldPos: path77.oldPos + oldPosInc,
11634
13294
  lastComponent: {
11635
13295
  count: 1,
11636
13296
  added,
@@ -12139,10 +13799,10 @@ function attachmentToHistoryMessage(o, ts) {
12139
13799
  const memories = raw.map((m2) => {
12140
13800
  if (!m2 || typeof m2 !== "object") return null;
12141
13801
  const rec3 = m2;
12142
- const path76 = typeof rec3.path === "string" ? rec3.path : null;
13802
+ const path77 = typeof rec3.path === "string" ? rec3.path : null;
12143
13803
  const content = typeof rec3.content === "string" ? rec3.content : null;
12144
- if (!path76 || content == null) return null;
12145
- const entry = { path: path76, content };
13804
+ if (!path77 || content == null) return null;
13805
+ const entry = { path: path77, content };
12146
13806
  if (typeof rec3.mtimeMs === "number") entry.mtimeMs = rec3.mtimeMs;
12147
13807
  return entry;
12148
13808
  }).filter((m2) => m2 !== null);
@@ -12945,10 +14605,10 @@ function parseAttachment(obj) {
12945
14605
  const memories = raw.map((m2) => {
12946
14606
  if (!m2 || typeof m2 !== "object") return null;
12947
14607
  const rec3 = m2;
12948
- const path76 = typeof rec3.path === "string" ? rec3.path : null;
14608
+ const path77 = typeof rec3.path === "string" ? rec3.path : null;
12949
14609
  const content = typeof rec3.content === "string" ? rec3.content : null;
12950
- if (!path76 || content == null) return null;
12951
- const out = { path: path76, content };
14610
+ if (!path77 || content == null) return null;
14611
+ const out = { path: path77, content };
12952
14612
  if (typeof rec3.mtimeMs === "number") out.mtimeMs = rec3.mtimeMs;
12953
14613
  return out;
12954
14614
  }).filter((m2) => m2 !== null);
@@ -33917,8 +35577,8 @@ var require_utils = __commonJS({
33917
35577
  var result = transform[inputType][outputType](input);
33918
35578
  return result;
33919
35579
  };
33920
- exports2.resolve = function(path76) {
33921
- var parts = path76.split("/");
35580
+ exports2.resolve = function(path77) {
35581
+ var parts = path77.split("/");
33922
35582
  var result = [];
33923
35583
  for (var index = 0; index < parts.length; index++) {
33924
35584
  var part = parts[index];
@@ -39771,18 +41431,18 @@ var require_object = __commonJS({
39771
41431
  var object = new ZipObject(name, zipObjectContent, o);
39772
41432
  this.files[name] = object;
39773
41433
  };
39774
- var parentFolder = function(path76) {
39775
- if (path76.slice(-1) === "/") {
39776
- path76 = path76.substring(0, path76.length - 1);
41434
+ var parentFolder = function(path77) {
41435
+ if (path77.slice(-1) === "/") {
41436
+ path77 = path77.substring(0, path77.length - 1);
39777
41437
  }
39778
- var lastSlash = path76.lastIndexOf("/");
39779
- return lastSlash > 0 ? path76.substring(0, lastSlash) : "";
41438
+ var lastSlash = path77.lastIndexOf("/");
41439
+ return lastSlash > 0 ? path77.substring(0, lastSlash) : "";
39780
41440
  };
39781
- var forceTrailingSlash = function(path76) {
39782
- if (path76.slice(-1) !== "/") {
39783
- path76 += "/";
41441
+ var forceTrailingSlash = function(path77) {
41442
+ if (path77.slice(-1) !== "/") {
41443
+ path77 += "/";
39784
41444
  }
39785
- return path76;
41445
+ return path77;
39786
41446
  };
39787
41447
  var folderAdd = function(name, createFolders) {
39788
41448
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -40784,7 +42444,7 @@ var require_lib3 = __commonJS({
40784
42444
  // src/run-case/recorder.ts
40785
42445
  function startRunCaseRecorder(opts) {
40786
42446
  const now = opts.now ?? Date.now;
40787
- const dir = import_node_path63.default.dirname(opts.recordPath);
42447
+ const dir = import_node_path64.default.dirname(opts.recordPath);
40788
42448
  let stream = null;
40789
42449
  let closing = false;
40790
42450
  let closedSettled = false;
@@ -40824,12 +42484,12 @@ function startRunCaseRecorder(opts) {
40824
42484
  };
40825
42485
  return { tap, close, closed };
40826
42486
  }
40827
- var import_node_fs48, import_node_path63;
42487
+ var import_node_fs48, import_node_path64;
40828
42488
  var init_recorder = __esm({
40829
42489
  "src/run-case/recorder.ts"() {
40830
42490
  "use strict";
40831
42491
  import_node_fs48 = __toESM(require("fs"), 1);
40832
- import_node_path63 = __toESM(require("path"), 1);
42492
+ import_node_path64 = __toESM(require("path"), 1);
40833
42493
  }
40834
42494
  });
40835
42495
 
@@ -40872,7 +42532,7 @@ var init_wire = __esm({
40872
42532
  // src/run-case/controller.ts
40873
42533
  async function runController(opts) {
40874
42534
  const now = opts.now ?? Date.now;
40875
- const cwd = opts.cwd ?? (0, import_node_fs49.mkdtempSync)(import_node_path64.default.join(import_node_os23.default.tmpdir(), "clawd-runcase-"));
42535
+ const cwd = opts.cwd ?? (0, import_node_fs49.mkdtempSync)(import_node_path65.default.join(import_node_os23.default.tmpdir(), "clawd-runcase-"));
40876
42536
  const ownsCwd = opts.cwd === void 0;
40877
42537
  const recorder = startRunCaseRecorder({ recordPath: opts.record, now });
40878
42538
  const spawnCtx = { cwd };
@@ -41039,13 +42699,13 @@ async function runController(opts) {
41039
42699
  }
41040
42700
  return exitCode ?? 0;
41041
42701
  }
41042
- var import_node_fs49, import_node_os23, import_node_path64;
42702
+ var import_node_fs49, import_node_os23, import_node_path65;
41043
42703
  var init_controller = __esm({
41044
42704
  "src/run-case/controller.ts"() {
41045
42705
  "use strict";
41046
42706
  import_node_fs49 = require("fs");
41047
42707
  import_node_os23 = __toESM(require("os"), 1);
41048
- import_node_path64 = __toESM(require("path"), 1);
42708
+ import_node_path65 = __toESM(require("path"), 1);
41049
42709
  init_claude();
41050
42710
  init_stdout_splitter();
41051
42711
  init_permission_stdio();
@@ -41320,7 +42980,7 @@ Env (advanced):
41320
42980
  `;
41321
42981
 
41322
42982
  // src/index.ts
41323
- var import_node_path62 = __toESM(require("path"), 1);
42983
+ var import_node_path63 = __toESM(require("path"), 1);
41324
42984
  var import_node_fs47 = __toESM(require("fs"), 1);
41325
42985
  var import_node_os22 = __toESM(require("os"), 1);
41326
42986
 
@@ -47248,8 +48908,8 @@ function turnStartInput(text) {
47248
48908
  const items = [];
47249
48909
  let leftover = text;
47250
48910
  for (const m2 of text.matchAll(SKILL_RE)) {
47251
- const [marker, name, path76] = m2;
47252
- items.push({ type: "skill", name, path: path76 });
48911
+ const [marker, name, path77] = m2;
48912
+ items.push({ type: "skill", name, path: path77 });
47253
48913
  leftover = leftover.replace(marker, "");
47254
48914
  }
47255
48915
  for (const m2 of text.matchAll(ATTACHMENT_RE2)) {
@@ -49174,9 +50834,24 @@ function writeRpcToolMcpConfig(args) {
49174
50834
  return cfgPath;
49175
50835
  }
49176
50836
 
50837
+ // src/dispatch/source-transcript.ts
50838
+ var import_node_path25 = __toESM(require("path"), 1);
50839
+ init_claude_history();
50840
+ var NO_SOURCE_TRANSCRIPT = "(no transcript yet \u2014 operate from the task description alone)";
50841
+ function resolveSourceJsonlPath(sourceFile, home) {
50842
+ if (!sourceFile?.toolSessionId) return NO_SOURCE_TRANSCRIPT;
50843
+ return import_node_path25.default.join(
50844
+ home,
50845
+ ".claude",
50846
+ "projects",
50847
+ cwdToHashDir(sourceFile.cwd),
50848
+ `${sourceFile.toolSessionId}.jsonl`
50849
+ );
50850
+ }
50851
+
49177
50852
  // src/shift/store.ts
49178
50853
  var import_promises2 = __toESM(require("fs/promises"), 1);
49179
- var import_node_path25 = __toESM(require("path"), 1);
50854
+ var import_node_path26 = __toESM(require("path"), 1);
49180
50855
  var import_node_crypto6 = require("crypto");
49181
50856
 
49182
50857
  // src/shift/schedule.ts
@@ -49251,7 +50926,7 @@ function createShiftStore(deps) {
49251
50926
  flushTimer = null;
49252
50927
  }
49253
50928
  const content = { version: 1, shifts };
49254
- await import_promises2.default.mkdir(import_node_path25.default.dirname(deps.filePath), { recursive: true });
50929
+ await import_promises2.default.mkdir(import_node_path26.default.dirname(deps.filePath), { recursive: true });
49255
50930
  const tmp = `${deps.filePath}.tmp-${deps.now()}-${Math.floor(Math.random() * 1e6)}`;
49256
50931
  await import_promises2.default.writeFile(tmp, JSON.stringify(content, null, 2), "utf8");
49257
50932
  await import_promises2.default.rename(tmp, deps.filePath);
@@ -49678,7 +51353,14 @@ function buildPersonaDispatchHandlers(deps) {
49678
51353
  const { personaDispatchManager: mgr, spawnB, logger } = deps;
49679
51354
  const run = async (frame, _client, ctx) => {
49680
51355
  const { type: _t, requestId: _r, ...rest } = frame;
49681
- const sourceSessionId = typeof rest.sessionId === "string" ? rest.sessionId : void 0;
51356
+ const rawSessionId = typeof rest.sessionId === "string" && rest.sessionId.length > 0 ? rest.sessionId : void 0;
51357
+ const sourceSessionId = rawSessionId ?? EXTERNAL_DISPATCH_SOURCE;
51358
+ if (!rawSessionId) {
51359
+ logger?.warn("dispatch.run.external-source", {
51360
+ targetPersona: typeof rest.targetPersona === "string" ? rest.targetPersona : void 0,
51361
+ sourceSessionId
51362
+ });
51363
+ }
49682
51364
  const args = DispatchRunArgsSchema.parse(rest);
49683
51365
  if (args.model !== void 0) {
49684
51366
  const targetPersona2 = args.targetPersona ?? (args.dispatchId ? deps.store.get(args.dispatchId)?.targetPersonaId : void 0);
@@ -49698,11 +51380,6 @@ function buildPersonaDispatchHandlers(deps) {
49698
51380
  "follow-up dispatch cannot be initiated by a guest"
49699
51381
  );
49700
51382
  }
49701
- if (!sourceSessionId) {
49702
- throw new Error(
49703
- "personaDispatch:run requires sessionId in the request body"
49704
- );
49705
- }
49706
51383
  const rec3 = deps.store.get(args.dispatchId);
49707
51384
  if (!rec3) {
49708
51385
  throw new ClawdError(ERROR_CODES.INVALID_PARAM, `dispatch not found: ${args.dispatchId}`);
@@ -49771,11 +51448,6 @@ function buildPersonaDispatchHandlers(deps) {
49771
51448
  if (!deps.forwardToPeer) {
49772
51449
  throw new Error("cross-device dispatch not wired (forwardToPeer missing)");
49773
51450
  }
49774
- if (!sourceSessionId) {
49775
- throw new Error(
49776
- "personaDispatch:run requires sessionId in the request body"
49777
- );
49778
- }
49779
51451
  const { dispatchId: dispatchId2 } = mgr.start({
49780
51452
  sourceSessionId,
49781
51453
  targetPersona,
@@ -49844,11 +51516,6 @@ function buildPersonaDispatchHandlers(deps) {
49844
51516
  response: { type: "personaDispatch:run:ok", dispatchId: dispatchId2 }
49845
51517
  };
49846
51518
  }
49847
- if (!sourceSessionId) {
49848
- throw new Error(
49849
- "personaDispatch:run requires sessionId in the request body"
49850
- );
49851
- }
49852
51519
  const { dispatchId } = mgr.start({
49853
51520
  sourceSessionId,
49854
51521
  targetPersona,
@@ -50271,7 +51938,7 @@ var CodexHistoryReader = class {
50271
51938
 
50272
51939
  // src/tools/codex-skills.ts
50273
51940
  var import_node_child_process7 = require("child_process");
50274
- var import_node_path26 = __toESM(require("path"), 1);
51941
+ var import_node_path27 = __toESM(require("path"), 1);
50275
51942
  var DEFAULT_TIMEOUT_MS3 = 8e3;
50276
51943
  function str3(v2) {
50277
51944
  return typeof v2 === "string" ? v2 : void 0;
@@ -50287,13 +51954,13 @@ function mapSkillsListResponse(res) {
50287
51954
  const r = s ?? {};
50288
51955
  const name = str3(r.name);
50289
51956
  if (!name) continue;
50290
- const path76 = str3(r.path);
51957
+ const path77 = str3(r.path);
50291
51958
  const description = str3(r.description);
50292
51959
  const isPlugin = name.includes(":");
50293
51960
  out.push({
50294
51961
  name,
50295
51962
  source: isPlugin ? "plugin" : "project",
50296
- ...path76 ? { path: path76 } : {},
51963
+ ...path77 ? { path: path77 } : {},
50297
51964
  ...description ? { description } : {},
50298
51965
  ...isPlugin ? { plugin: name.split(":")[0] } : {}
50299
51966
  });
@@ -50323,7 +51990,7 @@ async function listCodexSkills(cwd, deps = {}) {
50323
51990
  })(),
50324
51991
  timeout
50325
51992
  ]);
50326
- void client.request("skills/extraRoots/set", { extraRoots: [import_node_path26.default.join(cwd, ".claude", "skills")] }).catch(() => void 0);
51993
+ void client.request("skills/extraRoots/set", { extraRoots: [import_node_path27.default.join(cwd, ".claude", "skills")] }).catch(() => void 0);
50327
51994
  const res = await Promise.race([client.request("skills/list", { cwds: [cwd] }), timeout]);
50328
51995
  return mapSkillsListResponse(res);
50329
51996
  } finally {
@@ -50335,14 +52002,14 @@ async function listCodexSkills(cwd, deps = {}) {
50335
52002
  // src/workspace/browser.ts
50336
52003
  var import_node_fs26 = __toESM(require("fs"), 1);
50337
52004
  var import_node_os8 = __toESM(require("os"), 1);
50338
- var import_node_path27 = __toESM(require("path"), 1);
52005
+ var import_node_path28 = __toESM(require("path"), 1);
50339
52006
  init_protocol();
50340
52007
  var MAX_FILE_BYTES = 2 * 1024 * 1024;
50341
52008
  function resolveInsideCwd(cwd, subpath) {
50342
- const absCwd = import_node_path27.default.resolve(cwd);
50343
- const joined = import_node_path27.default.resolve(absCwd, subpath ?? ".");
50344
- const rel = import_node_path27.default.relative(absCwd, joined);
50345
- if (rel.startsWith("..") || import_node_path27.default.isAbsolute(rel)) {
52009
+ const absCwd = import_node_path28.default.resolve(cwd);
52010
+ const joined = import_node_path28.default.resolve(absCwd, subpath ?? ".");
52011
+ const rel = import_node_path28.default.relative(absCwd, joined);
52012
+ if (rel.startsWith("..") || import_node_path28.default.isAbsolute(rel)) {
50346
52013
  throw new ClawdError(ERROR_CODES.INVALID_PATH, `path escapes cwd: ${subpath}`);
50347
52014
  }
50348
52015
  return joined;
@@ -50373,7 +52040,7 @@ var WorkspaceBrowser = class {
50373
52040
  mtime: ""
50374
52041
  };
50375
52042
  try {
50376
- const st = import_node_fs26.default.statSync(import_node_path27.default.join(full, d.name));
52043
+ const st = import_node_fs26.default.statSync(import_node_path28.default.join(full, d.name));
50377
52044
  entry.mtime = new Date(st.mtimeMs).toISOString();
50378
52045
  if (d.isFile()) entry.size = st.size;
50379
52046
  } catch {
@@ -50420,7 +52087,7 @@ var WorkspaceBrowser = class {
50420
52087
  // src/skills/agents-scanner.ts
50421
52088
  var import_node_fs27 = __toESM(require("fs"), 1);
50422
52089
  var import_node_os9 = __toESM(require("os"), 1);
50423
- var import_node_path28 = __toESM(require("path"), 1);
52090
+ var import_node_path29 = __toESM(require("path"), 1);
50424
52091
  var DEFAULT_POLICY_DIR_DARWIN = "/Library/Application Support/ClaudeCode/.claude/agents";
50425
52092
  function isDirLikeSync2(p2) {
50426
52093
  try {
@@ -50458,10 +52125,10 @@ function scanAgentsDir(dir, source, seen, out) {
50458
52125
  }
50459
52126
  for (const ent of entries) {
50460
52127
  if (!ent.name.endsWith(".md")) continue;
50461
- if (!ent.isFile() && !(ent.isSymbolicLink() && fileExistsSync(import_node_path28.default.join(dir, ent.name)))) {
52128
+ if (!ent.isFile() && !(ent.isSymbolicLink() && fileExistsSync(import_node_path29.default.join(dir, ent.name)))) {
50462
52129
  continue;
50463
52130
  }
50464
- const filePath = import_node_path28.default.join(dir, ent.name);
52131
+ const filePath = import_node_path29.default.join(dir, ent.name);
50465
52132
  const baseName = ent.name.replace(/\.md$/, "");
50466
52133
  if (seen.has(baseName)) continue;
50467
52134
  seen.add(baseName);
@@ -50484,7 +52151,7 @@ function scanPluginAgentsTree(root, pluginName, seen, out) {
50484
52151
  return;
50485
52152
  }
50486
52153
  for (const ent of entries) {
50487
- const childPath = import_node_path28.default.join(dir, ent.name);
52154
+ const childPath = import_node_path29.default.join(dir, ent.name);
50488
52155
  if (ent.isDirectory() || ent.isSymbolicLink() && isDirLikeSync2(childPath)) {
50489
52156
  walk2(childPath, [...namespaces, ent.name]);
50490
52157
  continue;
@@ -50509,9 +52176,9 @@ function scanPluginAgentsTree(root, pluginName, seen, out) {
50509
52176
  walk2(root, []);
50510
52177
  }
50511
52178
  function readInstalledPlugins2(home) {
50512
- const pluginsDir = import_node_path28.default.join(home, ".claude", "plugins");
50513
- const v2 = import_node_path28.default.join(pluginsDir, "installed_plugins_v2.json");
50514
- const v1 = import_node_path28.default.join(pluginsDir, "installed_plugins.json");
52179
+ const pluginsDir = import_node_path29.default.join(home, ".claude", "plugins");
52180
+ const v2 = import_node_path29.default.join(pluginsDir, "installed_plugins_v2.json");
52181
+ const v1 = import_node_path29.default.join(pluginsDir, "installed_plugins.json");
50515
52182
  let raw = null;
50516
52183
  for (const candidate of [v2, v1]) {
50517
52184
  try {
@@ -50540,19 +52207,19 @@ function readInstalledPlugins2(home) {
50540
52207
  return out;
50541
52208
  }
50542
52209
  function walkUpProjectAgentsDirs(startCwd, home, seen, out) {
50543
- let cur = import_node_path28.default.resolve(startCwd);
50544
- const fsRoot = import_node_path28.default.parse(cur).root;
52210
+ let cur = import_node_path29.default.resolve(startCwd);
52211
+ const fsRoot = import_node_path29.default.parse(cur).root;
50545
52212
  while (true) {
50546
- scanAgentsDir(import_node_path28.default.join(cur, ".claude", "agents"), "project", seen, out);
52213
+ scanAgentsDir(import_node_path29.default.join(cur, ".claude", "agents"), "project", seen, out);
50547
52214
  let hasGit = false;
50548
52215
  try {
50549
- hasGit = import_node_fs27.default.existsSync(import_node_path28.default.join(cur, ".git"));
52216
+ hasGit = import_node_fs27.default.existsSync(import_node_path29.default.join(cur, ".git"));
50550
52217
  } catch {
50551
52218
  }
50552
52219
  if (hasGit) return;
50553
52220
  if (cur === home) return;
50554
52221
  if (cur === fsRoot) return;
50555
- const parent = import_node_path28.default.dirname(cur);
52222
+ const parent = import_node_path29.default.dirname(cur);
50556
52223
  if (parent === cur) return;
50557
52224
  cur = parent;
50558
52225
  }
@@ -50587,7 +52254,7 @@ var AgentsScanner = class {
50587
52254
  }
50588
52255
  const fsBlock = [];
50589
52256
  scanAgentsDir(
50590
- import_node_path28.default.join(this.home, ".claude", "agents"),
52257
+ import_node_path29.default.join(this.home, ".claude", "agents"),
50591
52258
  "global",
50592
52259
  seen,
50593
52260
  fsBlock
@@ -50601,7 +52268,7 @@ var AgentsScanner = class {
50601
52268
  ...this.extraPluginRoots
50602
52269
  ];
50603
52270
  for (const { name, root } of plugins) {
50604
- const agentsRoot = import_node_path28.default.join(root, "agents");
52271
+ const agentsRoot = import_node_path29.default.join(root, "agents");
50605
52272
  scanPluginAgentsTree(agentsRoot, name, seen, fsBlock);
50606
52273
  }
50607
52274
  return [...builtinBlock, ...fsBlock];
@@ -50611,13 +52278,13 @@ var AgentsScanner = class {
50611
52278
  // src/observer/session-observer.ts
50612
52279
  var import_node_fs29 = __toESM(require("fs"), 1);
50613
52280
  var import_node_os11 = __toESM(require("os"), 1);
50614
- var import_node_path30 = __toESM(require("path"), 1);
52281
+ var import_node_path31 = __toESM(require("path"), 1);
50615
52282
  init_claude_history();
50616
52283
 
50617
52284
  // src/observer/subagent-meta-observer.ts
50618
52285
  var import_node_fs28 = __toESM(require("fs"), 1);
50619
52286
  var import_node_os10 = __toESM(require("os"), 1);
50620
- var import_node_path29 = __toESM(require("path"), 1);
52287
+ var import_node_path30 = __toESM(require("path"), 1);
50621
52288
  init_claude_history();
50622
52289
  var META_RE = /^agent-([A-Za-z0-9_-]+)\.meta\.json$/;
50623
52290
  var SubagentMetaObserver = class {
@@ -50630,7 +52297,7 @@ var SubagentMetaObserver = class {
50630
52297
  watches = /* @__PURE__ */ new Map();
50631
52298
  // public for spec only:测试直接拼路径写假 meta.json;生产 start() 内部自己解析
50632
52299
  resolveSubagentDir(cwd, toolSessionId) {
50633
- return import_node_path29.default.join(
52300
+ return import_node_path30.default.join(
50634
52301
  this.home,
50635
52302
  ".claude",
50636
52303
  "projects",
@@ -50686,7 +52353,7 @@ var SubagentMetaObserver = class {
50686
52353
  if (!m2) return;
50687
52354
  const agentId = m2[1];
50688
52355
  if (w2.emitted.has(agentId)) return;
50689
- const file = import_node_path29.default.join(w2.dirPath, name);
52356
+ const file = import_node_path30.default.join(w2.dirPath, name);
50690
52357
  let raw;
50691
52358
  try {
50692
52359
  raw = import_node_fs28.default.readFileSync(file, "utf8");
@@ -50746,7 +52413,7 @@ var SessionObserver = class {
50746
52413
  metaObserver;
50747
52414
  resolveJsonlPath(cwd, toolSessionId, override) {
50748
52415
  if (override) return override;
50749
- return import_node_path30.default.join(this.home, ".claude", "projects", cwdToHashDir(cwd), `${toolSessionId}.jsonl`);
52416
+ return import_node_path31.default.join(this.home, ".claude", "projects", cwdToHashDir(cwd), `${toolSessionId}.jsonl`);
50750
52417
  }
50751
52418
  start(args) {
50752
52419
  this.stop(args.sessionId);
@@ -50772,10 +52439,10 @@ var SessionObserver = class {
50772
52439
  lastDeriveMs: 0
50773
52440
  };
50774
52441
  try {
50775
- import_node_fs29.default.mkdirSync(import_node_path30.default.dirname(filePath), { recursive: true });
52442
+ import_node_fs29.default.mkdirSync(import_node_path31.default.dirname(filePath), { recursive: true });
50776
52443
  } catch {
50777
52444
  }
50778
- w2.watcher = import_node_fs29.default.watch(import_node_path30.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
52445
+ w2.watcher = import_node_fs29.default.watch(import_node_path31.default.dirname(filePath), { persistent: false }, (_event, changedName) => {
50779
52446
  if (!changedName || !w2.filePath.endsWith(changedName)) return;
50780
52447
  this.poll(w2);
50781
52448
  });
@@ -50872,7 +52539,7 @@ var SessionObserver = class {
50872
52539
  const now = Date.now();
50873
52540
  if (now - w2.lastRelocateScanMs < 1e3) return;
50874
52541
  w2.lastRelocateScanMs = now;
50875
- const projectsRoot = import_node_path30.default.join(this.home, ".claude", "projects");
52542
+ const projectsRoot = import_node_path31.default.join(this.home, ".claude", "projects");
50876
52543
  const found = findTranscriptByToolSessionId(projectsRoot, w2.toolSessionId);
50877
52544
  if (!found || found === w2.filePath) return;
50878
52545
  try {
@@ -50881,7 +52548,7 @@ var SessionObserver = class {
50881
52548
  }
50882
52549
  w2.filePath = found;
50883
52550
  try {
50884
- w2.watcher = import_node_fs29.default.watch(import_node_path30.default.dirname(found), { persistent: false }, (_event, changedName) => {
52551
+ w2.watcher = import_node_fs29.default.watch(import_node_path31.default.dirname(found), { persistent: false }, (_event, changedName) => {
50885
52552
  if (!changedName || !w2.filePath.endsWith(changedName)) return;
50886
52553
  this.poll(w2);
50887
52554
  });
@@ -51310,7 +52977,7 @@ var LocalWsServer = class {
51310
52977
  } catch {
51311
52978
  }
51312
52979
  }, this.pingIntervalMs);
51313
- this.clients.set(id, { handle, ws: socket, pingTimer, ctx: null });
52980
+ this.clients.set(id, { handle, ws: socket, pingTimer, ctx: null, connectedAt: Date.now() });
51314
52981
  this.logger?.info("client connected", { clientId: id, total: this.clients.size, remoteAddress });
51315
52982
  const authGate = this.opts.authGate;
51316
52983
  let authed = true;
@@ -51435,6 +53102,18 @@ var LocalWsServer = class {
51435
53102
  clientCount() {
51436
53103
  return this.clients.size;
51437
53104
  }
53105
+ // device:connections 数据源:owner 连接快照。
53106
+ // principal.kind==='guest'(connect/visitor 票种)不列——不是"我的设备",也不向 UI
53107
+ // 泄露 guest 信息;ctx===null 是 noAuth localhost 路径(dispatcher 按 owner fallback
53108
+ // 处理),视作 owner 列入。
53109
+ listOwnerConnections() {
53110
+ const out = [];
53111
+ for (const [id, c] of this.clients) {
53112
+ if (c.ctx && c.ctx.principal.kind !== "owner") continue;
53113
+ out.push({ clientId: id, connectedAt: c.connectedAt, clientInfo: c.ctx?.clientInfo });
53114
+ }
53115
+ return out.sort((a, b2) => a.connectedAt - b2.connectedAt);
53116
+ }
51438
53117
  };
51439
53118
  function addSubscription(client, sessionId) {
51440
53119
  const cur = client.subscribedSessions.get(sessionId) ?? 0;
@@ -51665,7 +53344,7 @@ async function authenticate(token, deps) {
51665
53344
 
51666
53345
  // src/legacy-cleanup.ts
51667
53346
  var fs34 = __toESM(require("fs/promises"), 1);
51668
- var path35 = __toESM(require("path"), 1);
53347
+ var path36 = __toESM(require("path"), 1);
51669
53348
  var LEGACY_FILES = [
51670
53349
  "personal-capability.json",
51671
53350
  "received-capabilities.json",
@@ -51674,7 +53353,7 @@ var LEGACY_FILES = [
51674
53353
  async function cleanupLegacyCapabilityFiles(dataDir, logger) {
51675
53354
  const removed = [];
51676
53355
  for (const name of LEGACY_FILES) {
51677
- const p2 = path35.join(dataDir, name);
53356
+ const p2 = path36.join(dataDir, name);
51678
53357
  try {
51679
53358
  await fs34.unlink(p2);
51680
53359
  removed.push(name);
@@ -51689,7 +53368,7 @@ async function cleanupLegacyCapabilityFiles(dataDir, logger) {
51689
53368
 
51690
53369
  // src/inbox/inbox-store.ts
51691
53370
  var fs35 = __toESM(require("fs"), 1);
51692
- var path36 = __toESM(require("path"), 1);
53371
+ var path37 = __toESM(require("path"), 1);
51693
53372
  var INBOX_SUBDIR = "inbox";
51694
53373
  var InboxStore = class {
51695
53374
  constructor(dataDir) {
@@ -51787,10 +53466,10 @@ var InboxStore = class {
51787
53466
  }
51788
53467
  }
51789
53468
  dirPath() {
51790
- return path36.join(this.dataDir, INBOX_SUBDIR);
53469
+ return path37.join(this.dataDir, INBOX_SUBDIR);
51791
53470
  }
51792
53471
  filePath(peerDeviceId) {
51793
- return path36.join(this.dirPath(), `${peerDeviceId}.jsonl`);
53472
+ return path37.join(this.dirPath(), `${peerDeviceId}.jsonl`);
51794
53473
  }
51795
53474
  };
51796
53475
  function parseAllLines(raw) {
@@ -51879,7 +53558,7 @@ var InboxManager = class {
51879
53558
 
51880
53559
  // src/state/contact-store.ts
51881
53560
  var fs36 = __toESM(require("fs"), 1);
51882
- var path37 = __toESM(require("path"), 1);
53561
+ var path38 = __toESM(require("path"), 1);
51883
53562
  var FILE_NAME = "contacts.json";
51884
53563
  var ContactStore = class {
51885
53564
  constructor(dataDir) {
@@ -51889,7 +53568,7 @@ var ContactStore = class {
51889
53568
  contacts = /* @__PURE__ */ new Map();
51890
53569
  load() {
51891
53570
  this.contacts.clear();
51892
- const file = path37.join(this.dataDir, FILE_NAME);
53571
+ const file = path38.join(this.dataDir, FILE_NAME);
51893
53572
  let raw;
51894
53573
  try {
51895
53574
  raw = fs36.readFileSync(file, "utf8");
@@ -51961,7 +53640,7 @@ var ContactStore = class {
51961
53640
  return true;
51962
53641
  }
51963
53642
  flush() {
51964
- const file = path37.join(this.dataDir, FILE_NAME);
53643
+ const file = path38.join(this.dataDir, FILE_NAME);
51965
53644
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
51966
53645
  const content = JSON.stringify(
51967
53646
  { contacts: Array.from(this.contacts.values()) },
@@ -52083,52 +53762,52 @@ async function connectRemote(args) {
52083
53762
 
52084
53763
  // src/migrations/2026-05-20-flatten-sessions.ts
52085
53764
  var fs37 = __toESM(require("fs"), 1);
52086
- var path38 = __toESM(require("path"), 1);
53765
+ var path39 = __toESM(require("path"), 1);
52087
53766
  var MIGRATION_FLAG_NAME = ".migration.v1.done";
52088
53767
  function migrateFlattenSessions(opts) {
52089
53768
  const dataDir = opts.dataDir;
52090
53769
  const now = opts.now ?? Date.now;
52091
- const sessionsDir = path38.join(dataDir, "sessions");
52092
- const flagPath = path38.join(sessionsDir, MIGRATION_FLAG_NAME);
53770
+ const sessionsDir = path39.join(dataDir, "sessions");
53771
+ const flagPath = path39.join(sessionsDir, MIGRATION_FLAG_NAME);
52093
53772
  if (existsSync3(flagPath)) {
52094
53773
  return { skipped: true, flagWritten: false, movedBare: 0, movedVmOwner: 0, archivedListener: 0 };
52095
53774
  }
52096
53775
  let movedBare = 0;
52097
53776
  let movedVmOwner = 0;
52098
53777
  let archivedListener = 0;
52099
- const defaultDir = path38.join(sessionsDir, "default");
53778
+ const defaultDir = path39.join(sessionsDir, "default");
52100
53779
  if (existsSync3(defaultDir)) {
52101
53780
  for (const entry of readdirSafe(defaultDir)) {
52102
53781
  if (!entry.endsWith(".json")) continue;
52103
- const src = path38.join(defaultDir, entry);
52104
- const dst = path38.join(sessionsDir, entry);
53782
+ const src = path39.join(defaultDir, entry);
53783
+ const dst = path39.join(sessionsDir, entry);
52105
53784
  fs37.renameSync(src, dst);
52106
53785
  movedBare += 1;
52107
53786
  }
52108
53787
  rmdirIfEmpty(defaultDir);
52109
53788
  }
52110
53789
  for (const pid of readdirSafe(sessionsDir)) {
52111
- const personaDir = path38.join(sessionsDir, pid);
53790
+ const personaDir = path39.join(sessionsDir, pid);
52112
53791
  if (!isDir(personaDir)) continue;
52113
53792
  if (pid === "default") continue;
52114
- const ownerSrc = path38.join(personaDir, "owner");
53793
+ const ownerSrc = path39.join(personaDir, "owner");
52115
53794
  if (existsSync3(ownerSrc) && isDir(ownerSrc)) {
52116
- const ownerDst = path38.join(dataDir, "personas", pid, ".clawd", "sessions", "owner");
53795
+ const ownerDst = path39.join(dataDir, "personas", pid, ".clawd", "sessions", "owner");
52117
53796
  fs37.mkdirSync(ownerDst, { recursive: true });
52118
53797
  for (const file of readdirSafe(ownerSrc)) {
52119
53798
  if (!file.endsWith(".json")) continue;
52120
- fs37.renameSync(path38.join(ownerSrc, file), path38.join(ownerDst, file));
53799
+ fs37.renameSync(path39.join(ownerSrc, file), path39.join(ownerDst, file));
52121
53800
  movedVmOwner += 1;
52122
53801
  }
52123
53802
  rmdirIfEmpty(ownerSrc);
52124
53803
  }
52125
- const listenerSrc = path38.join(personaDir, "listener");
53804
+ const listenerSrc = path39.join(personaDir, "listener");
52126
53805
  if (existsSync3(listenerSrc) && isDir(listenerSrc)) {
52127
- const archiveDst = path38.join(dataDir, ".legacy", `listener-${pid}`);
53806
+ const archiveDst = path39.join(dataDir, ".legacy", `listener-${pid}`);
52128
53807
  fs37.mkdirSync(archiveDst, { recursive: true });
52129
53808
  for (const file of readdirSafe(listenerSrc)) {
52130
53809
  if (!file.endsWith(".json")) continue;
52131
- fs37.renameSync(path38.join(listenerSrc, file), path38.join(archiveDst, file));
53810
+ fs37.renameSync(path39.join(listenerSrc, file), path39.join(archiveDst, file));
52132
53811
  archivedListener += 1;
52133
53812
  }
52134
53813
  rmdirIfEmpty(listenerSrc);
@@ -52176,10 +53855,10 @@ function rmdirIfEmpty(p2) {
52176
53855
 
52177
53856
  // src/transport/http-router.ts
52178
53857
  var import_node_fs31 = __toESM(require("fs"), 1);
52179
- var import_node_path34 = __toESM(require("path"), 1);
53858
+ var import_node_path35 = __toESM(require("path"), 1);
52180
53859
 
52181
53860
  // src/attachment/mime.ts
52182
- var import_node_path31 = __toESM(require("path"), 1);
53861
+ var import_node_path32 = __toESM(require("path"), 1);
52183
53862
  var TEXT_PLAIN = "text/plain; charset=utf-8";
52184
53863
  var EXT_TO_NATIVE_MIME = {
52185
53864
  // 图片
@@ -52286,7 +53965,7 @@ var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
52286
53965
  ".mk"
52287
53966
  ]);
52288
53967
  function lookupMime(filePathOrName) {
52289
- const ext = import_node_path31.default.extname(filePathOrName).toLowerCase();
53968
+ const ext = import_node_path32.default.extname(filePathOrName).toLowerCase();
52290
53969
  if (EXT_TO_NATIVE_MIME[ext]) return EXT_TO_NATIVE_MIME[ext];
52291
53970
  if (TEXT_EXTENSIONS.has(ext)) return TEXT_PLAIN;
52292
53971
  return "application/octet-stream";
@@ -52357,7 +54036,7 @@ function verifySignedUrl(secret, absPath, eRaw, s, now = Date.now) {
52357
54036
 
52358
54037
  // src/attachment/upload.ts
52359
54038
  var import_node_fs30 = __toESM(require("fs"), 1);
52360
- var import_node_path32 = __toESM(require("path"), 1);
54039
+ var import_node_path33 = __toESM(require("path"), 1);
52361
54040
  var import_node_crypto8 = __toESM(require("crypto"), 1);
52362
54041
  var import_promises3 = require("stream/promises");
52363
54042
  var UploadError = class extends Error {
@@ -52369,14 +54048,14 @@ var UploadError = class extends Error {
52369
54048
  code;
52370
54049
  };
52371
54050
  function assertValidFileName(fileName) {
52372
- if (fileName.length === 0 || fileName === "." || fileName === ".." || fileName.startsWith(".") || fileName.includes("/") || fileName.includes("\\") || fileName !== import_node_path32.default.basename(fileName)) {
54051
+ if (fileName.length === 0 || fileName === "." || fileName === ".." || fileName.startsWith(".") || fileName.includes("/") || fileName.includes("\\") || fileName !== import_node_path33.default.basename(fileName)) {
52373
54052
  throw new UploadError("INVALID_FILENAME", `fileName must be a plain basename, got: ${fileName}`);
52374
54053
  }
52375
54054
  }
52376
54055
  var HASH_PREFIX_LEN = 16;
52377
54056
  async function writeUploadedAttachment(args) {
52378
54057
  assertValidFileName(args.fileName);
52379
- const attachmentsRoot = import_node_path32.default.join(args.sessionDir, ".attachments");
54058
+ const attachmentsRoot = import_node_path33.default.join(args.sessionDir, ".attachments");
52380
54059
  try {
52381
54060
  import_node_fs30.default.mkdirSync(attachmentsRoot, { recursive: true });
52382
54061
  } catch (err) {
@@ -52384,7 +54063,7 @@ async function writeUploadedAttachment(args) {
52384
54063
  }
52385
54064
  const hasher = import_node_crypto8.default.createHash("sha256");
52386
54065
  let actualSize = 0;
52387
- const tmpPath = import_node_path32.default.join(
54066
+ const tmpPath = import_node_path33.default.join(
52388
54067
  attachmentsRoot,
52389
54068
  `.upload-${process.pid}-${Date.now()}-${import_node_crypto8.default.randomBytes(4).toString("hex")}`
52390
54069
  );
@@ -52419,7 +54098,7 @@ async function writeUploadedAttachment(args) {
52419
54098
  );
52420
54099
  }
52421
54100
  const attachmentId = hasher.digest("hex").slice(0, HASH_PREFIX_LEN);
52422
- const hashDir = import_node_path32.default.join(attachmentsRoot, attachmentId);
54101
+ const hashDir = import_node_path33.default.join(attachmentsRoot, attachmentId);
52423
54102
  let finalFileName;
52424
54103
  let hashDirExists = false;
52425
54104
  try {
@@ -52437,7 +54116,7 @@ async function writeUploadedAttachment(args) {
52437
54116
  try {
52438
54117
  import_node_fs30.default.mkdirSync(hashDir, { recursive: true });
52439
54118
  finalFileName = args.fileName;
52440
- import_node_fs30.default.renameSync(tmpPath, import_node_path32.default.join(hashDir, finalFileName));
54119
+ import_node_fs30.default.renameSync(tmpPath, import_node_path33.default.join(hashDir, finalFileName));
52441
54120
  } catch (err) {
52442
54121
  try {
52443
54122
  import_node_fs30.default.unlinkSync(tmpPath);
@@ -52446,8 +54125,8 @@ async function writeUploadedAttachment(args) {
52446
54125
  throw new UploadError("STORAGE_ERROR", `rename failed: ${err.message}`);
52447
54126
  }
52448
54127
  }
52449
- const absPath = import_node_path32.default.join(hashDir, finalFileName);
52450
- const relPath = import_node_path32.default.relative(args.sessionDir, absPath);
54128
+ const absPath = import_node_path33.default.join(hashDir, finalFileName);
54129
+ const relPath = import_node_path33.default.relative(args.sessionDir, absPath);
52451
54130
  args.groupFileStore.upsert(args.scope, args.sessionId, {
52452
54131
  relPath: absPath,
52453
54132
  // 存绝对路径,与现有 agent 入清单的形态一致(attachment.ts:144 双形态兼容)
@@ -52461,7 +54140,7 @@ async function writeUploadedAttachment(args) {
52461
54140
 
52462
54141
  // src/extension/import.ts
52463
54142
  var import_promises4 = __toESM(require("fs/promises"), 1);
52464
- var import_node_path33 = __toESM(require("path"), 1);
54143
+ var import_node_path34 = __toESM(require("path"), 1);
52465
54144
  var import_node_os12 = __toESM(require("os"), 1);
52466
54145
  var import_jszip = __toESM(require_lib3(), 1);
52467
54146
  var ImportError = class extends Error {
@@ -52479,7 +54158,7 @@ async function importZip(buf, root) {
52479
54158
  throw new ImportError("ZIP_INVALID", `failed to load zip: ${e.message}`);
52480
54159
  }
52481
54160
  for (const name of Object.keys(zip.files)) {
52482
- if (name.includes("..") || name.startsWith("/") || import_node_path33.default.isAbsolute(name)) {
54161
+ if (name.includes("..") || name.startsWith("/") || import_node_path34.default.isAbsolute(name)) {
52483
54162
  throw new ImportError("ZIP_INVALID", `unsafe zip entry path: ${name}`);
52484
54163
  }
52485
54164
  }
@@ -52512,7 +54191,7 @@ async function importZip(buf, root) {
52512
54191
  );
52513
54192
  }
52514
54193
  }
52515
- const destDir = import_node_path33.default.join(root, manifest.id);
54194
+ const destDir = import_node_path34.default.join(root, manifest.id);
52516
54195
  let destExists = false;
52517
54196
  try {
52518
54197
  await import_promises4.default.access(destDir);
@@ -52522,15 +54201,15 @@ async function importZip(buf, root) {
52522
54201
  if (destExists) {
52523
54202
  throw new ImportError("ALREADY_EXISTS", `extension ${manifest.id} already installed`);
52524
54203
  }
52525
- const stage = await import_promises4.default.mkdtemp(import_node_path33.default.join(import_node_os12.default.tmpdir(), `clawd-ext-stage-${manifest.id}-`));
54204
+ const stage = await import_promises4.default.mkdtemp(import_node_path34.default.join(import_node_os12.default.tmpdir(), `clawd-ext-stage-${manifest.id}-`));
52526
54205
  try {
52527
54206
  for (const [name, entry] of Object.entries(zip.files)) {
52528
- const dest = import_node_path33.default.join(stage, name);
54207
+ const dest = import_node_path34.default.join(stage, name);
52529
54208
  if (entry.dir) {
52530
54209
  await import_promises4.default.mkdir(dest, { recursive: true });
52531
54210
  continue;
52532
54211
  }
52533
- await import_promises4.default.mkdir(import_node_path33.default.dirname(dest), { recursive: true });
54212
+ await import_promises4.default.mkdir(import_node_path34.default.dirname(dest), { recursive: true });
52534
54213
  const content = await entry.async("nodebuffer");
52535
54214
  await import_promises4.default.writeFile(dest, content);
52536
54215
  }
@@ -52560,7 +54239,7 @@ var SHARE_UI_ASSET_MIME = {
52560
54239
  ".wasm": "application/wasm"
52561
54240
  };
52562
54241
  function shareUiAssetMime(filePath) {
52563
- const ext = import_node_path34.default.extname(filePath).toLowerCase();
54242
+ const ext = import_node_path35.default.extname(filePath).toLowerCase();
52564
54243
  return SHARE_UI_ASSET_MIME[ext] ?? lookupMime(filePath);
52565
54244
  }
52566
54245
  var AUTHED_RPC_ROUTE_PREFIX = "/rpc/";
@@ -52641,7 +54320,7 @@ function isValidUploadFileName(fileName) {
52641
54320
  if (fileName === "." || fileName === "..") return false;
52642
54321
  if (fileName.startsWith(".")) return false;
52643
54322
  if (fileName.includes("/") || fileName.includes("\\")) return false;
52644
- return fileName === import_node_path34.default.basename(fileName);
54323
+ return fileName === import_node_path35.default.basename(fileName);
52645
54324
  }
52646
54325
  function createHttpRouter(deps) {
52647
54326
  return async (req, res) => {
@@ -52858,7 +54537,7 @@ function createHttpRouter(deps) {
52858
54537
  sendHtml(res, statusByCode[r.code], loader.renderErrorHtml(r.code, msgByCode[r.code]));
52859
54538
  return true;
52860
54539
  }
52861
- sendHtml(res, 200, loader.renderViewerHtml(import_node_path34.default.basename(r.absPath)));
54540
+ sendHtml(res, 200, loader.renderViewerHtml(import_node_path35.default.basename(r.absPath)));
52862
54541
  return true;
52863
54542
  }
52864
54543
  const ctx = deps.authResolver.resolveFromHeader(
@@ -52979,7 +54658,7 @@ function createHttpRouter(deps) {
52979
54658
  return true;
52980
54659
  }
52981
54660
  let absPath;
52982
- if (import_node_path34.default.isAbsolute(pathParam)) {
54661
+ if (import_node_path35.default.isAbsolute(pathParam)) {
52983
54662
  absPath = pathParam;
52984
54663
  } else if (deps.sessionStore) {
52985
54664
  const file = deps.sessionStore.read(sid);
@@ -52987,7 +54666,7 @@ function createHttpRouter(deps) {
52987
54666
  sendJson(res, 404, { code: "NOT_FOUND", message: `session ${sid} not found` });
52988
54667
  return true;
52989
54668
  }
52990
- absPath = import_node_path34.default.join(file.cwd, pathParam);
54669
+ absPath = import_node_path35.default.join(file.cwd, pathParam);
52991
54670
  } else {
52992
54671
  sendJson(res, 501, withCtx(ctx, { code: "NOT_IMPLEMENTED", message: "sessionStore not wired" }));
52993
54672
  return true;
@@ -53089,7 +54768,7 @@ function streamFile(res, absPath, logger) {
53089
54768
  return;
53090
54769
  }
53091
54770
  const mime = lookupMime(absPath);
53092
- const basename = import_node_path34.default.basename(absPath);
54771
+ const basename = import_node_path35.default.basename(absPath);
53093
54772
  res.writeHead(200, {
53094
54773
  "Content-Type": mime,
53095
54774
  "Content-Length": String(stat.size),
@@ -53107,7 +54786,7 @@ function streamFile(res, absPath, logger) {
53107
54786
 
53108
54787
  // src/attachment/gc.ts
53109
54788
  var import_node_fs32 = __toESM(require("fs"), 1);
53110
- var import_node_path35 = __toESM(require("path"), 1);
54789
+ var import_node_path36 = __toESM(require("path"), 1);
53111
54790
  var DEFAULT_TTL_MS = 30 * 24 * 3600 * 1e3;
53112
54791
  function runAttachmentGc(args) {
53113
54792
  const now = (args.now ?? Date.now)();
@@ -53116,17 +54795,17 @@ function runAttachmentGc(args) {
53116
54795
  for (const { scope, sessionId } of args.sessionScopes) {
53117
54796
  for (const entry of args.groupFileStore.list(scope, sessionId)) {
53118
54797
  if (entry.stale) continue;
53119
- if (import_node_path35.default.isAbsolute(entry.relPath)) liveAbs.add(entry.relPath);
54798
+ if (import_node_path36.default.isAbsolute(entry.relPath)) liveAbs.add(entry.relPath);
53120
54799
  }
53121
54800
  }
53122
54801
  for (const { scope, sessionId } of args.sessionScopes) {
53123
- const sessionDir = args.getSessionCwd?.(sessionId) ?? import_node_path35.default.join(
54802
+ const sessionDir = args.getSessionCwd?.(sessionId) ?? import_node_path36.default.join(
53124
54803
  args.dataDir,
53125
54804
  "sessions",
53126
54805
  ...scopeSubPath(scope).map(safeFileName),
53127
54806
  safeFileName(sessionId)
53128
54807
  );
53129
- const attRoot = import_node_path35.default.join(sessionDir, ".attachments");
54808
+ const attRoot = import_node_path36.default.join(sessionDir, ".attachments");
53130
54809
  let hashDirs;
53131
54810
  try {
53132
54811
  hashDirs = import_node_fs32.default.readdirSync(attRoot);
@@ -53136,7 +54815,7 @@ function runAttachmentGc(args) {
53136
54815
  continue;
53137
54816
  }
53138
54817
  for (const hashDir of hashDirs) {
53139
- const hashDirAbs = import_node_path35.default.join(attRoot, hashDir);
54818
+ const hashDirAbs = import_node_path36.default.join(attRoot, hashDir);
53140
54819
  let files;
53141
54820
  try {
53142
54821
  files = import_node_fs32.default.readdirSync(hashDirAbs);
@@ -53144,7 +54823,7 @@ function runAttachmentGc(args) {
53144
54823
  continue;
53145
54824
  }
53146
54825
  for (const name of files) {
53147
- const file = import_node_path35.default.join(hashDirAbs, name);
54826
+ const file = import_node_path36.default.join(hashDirAbs, name);
53148
54827
  let stat;
53149
54828
  try {
53150
54829
  stat = import_node_fs32.default.statSync(file);
@@ -53175,7 +54854,7 @@ function runAttachmentGc(args) {
53175
54854
 
53176
54855
  // src/attachment/group.ts
53177
54856
  var import_node_fs33 = __toESM(require("fs"), 1);
53178
- var import_node_path36 = __toESM(require("path"), 1);
54857
+ var import_node_path37 = __toESM(require("path"), 1);
53179
54858
  var import_node_crypto9 = __toESM(require("crypto"), 1);
53180
54859
  init_protocol();
53181
54860
  var GroupFileStore = class {
@@ -53187,11 +54866,11 @@ var GroupFileStore = class {
53187
54866
  this.logger = opts.logger;
53188
54867
  }
53189
54868
  rootForScope(scope) {
53190
- return import_node_path36.default.join(this.dataDir, "sessions", ...scopeSubPath(scope).map(safeFileName));
54869
+ return import_node_path37.default.join(this.dataDir, "sessions", ...scopeSubPath(scope).map(safeFileName));
53191
54870
  }
53192
54871
  /** 与 SessionStore.filePath 平级,扩展名 .group-files.json */
53193
54872
  filePath(scope, sessionId) {
53194
- return import_node_path36.default.join(this.rootForScope(scope), `${safeFileName(sessionId)}.group-files.json`);
54873
+ return import_node_path37.default.join(this.rootForScope(scope), `${safeFileName(sessionId)}.group-files.json`);
53195
54874
  }
53196
54875
  cacheKey(scope, sessionId) {
53197
54876
  return scope.kind === "default" ? `default::${sessionId}` : `persona:${scope.personaId}:${scope.mode}::${sessionId}`;
@@ -53226,7 +54905,7 @@ var GroupFileStore = class {
53226
54905
  }
53227
54906
  writeFile(scope, sessionId, entries) {
53228
54907
  const file = this.filePath(scope, sessionId);
53229
- import_node_fs33.default.mkdirSync(import_node_path36.default.dirname(file), { recursive: true });
54908
+ import_node_fs33.default.mkdirSync(import_node_path37.default.dirname(file), { recursive: true });
53230
54909
  const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
53231
54910
  import_node_fs33.default.writeFileSync(tmp, JSON.stringify(entries, null, 2), { mode: 384 });
53232
54911
  import_node_fs33.default.renameSync(tmp, file);
@@ -53316,9 +54995,9 @@ var GroupFileStore = class {
53316
54995
 
53317
54996
  // src/discovery/state-file.ts
53318
54997
  var import_node_fs34 = __toESM(require("fs"), 1);
53319
- var import_node_path37 = __toESM(require("path"), 1);
54998
+ var import_node_path38 = __toESM(require("path"), 1);
53320
54999
  function defaultStateFilePath(dataDir) {
53321
- return import_node_path37.default.join(dataDir, "state.json");
55000
+ return import_node_path38.default.join(dataDir, "state.json");
53322
55001
  }
53323
55002
  function isPidAlive(pid) {
53324
55003
  if (!Number.isFinite(pid) || pid <= 0) return false;
@@ -53354,7 +55033,7 @@ var StateFileManager = class {
53354
55033
  return { status: "stale", existing };
53355
55034
  }
53356
55035
  write(state) {
53357
- import_node_fs34.default.mkdirSync(import_node_path37.default.dirname(this.file), { recursive: true });
55036
+ import_node_fs34.default.mkdirSync(import_node_path38.default.dirname(this.file), { recursive: true });
53358
55037
  const tmp = `${this.file}.tmp.${process.pid}.${Date.now()}`;
53359
55038
  import_node_fs34.default.writeFileSync(tmp, JSON.stringify(state, null, 2), { mode: 384 });
53360
55039
  import_node_fs34.default.renameSync(tmp, this.file);
@@ -53382,13 +55061,13 @@ function readSpawnedByDesktopFromEnv(env = process.env) {
53382
55061
 
53383
55062
  // src/tunnel/tunnel-manager.ts
53384
55063
  var import_node_fs38 = __toESM(require("fs"), 1);
53385
- var import_node_path41 = __toESM(require("path"), 1);
55064
+ var import_node_path42 = __toESM(require("path"), 1);
53386
55065
  var import_node_crypto10 = __toESM(require("crypto"), 1);
53387
55066
  var import_node_child_process10 = require("child_process");
53388
55067
 
53389
55068
  // src/tunnel/tunnel-store.ts
53390
55069
  var import_node_fs35 = __toESM(require("fs"), 1);
53391
- var import_node_path38 = __toESM(require("path"), 1);
55070
+ var import_node_path39 = __toESM(require("path"), 1);
53392
55071
  var TunnelStore = class {
53393
55072
  constructor(filePath) {
53394
55073
  this.filePath = filePath;
@@ -53407,7 +55086,7 @@ var TunnelStore = class {
53407
55086
  }
53408
55087
  }
53409
55088
  async set(v2) {
53410
- const dir = import_node_path38.default.dirname(this.filePath);
55089
+ const dir = import_node_path39.default.dirname(this.filePath);
53411
55090
  await import_node_fs35.default.promises.mkdir(dir, { recursive: true });
53412
55091
  const data = JSON.stringify(v2, null, 2);
53413
55092
  const tmp = `${this.filePath}.tmp.${process.pid}.${Date.now()}`;
@@ -53519,7 +55198,7 @@ function escape(v2) {
53519
55198
  // src/tunnel/frpc-binary.ts
53520
55199
  var import_node_fs36 = __toESM(require("fs"), 1);
53521
55200
  var import_node_os13 = __toESM(require("os"), 1);
53522
- var import_node_path39 = __toESM(require("path"), 1);
55201
+ var import_node_path40 = __toESM(require("path"), 1);
53523
55202
  var import_node_child_process8 = require("child_process");
53524
55203
  var import_node_stream3 = require("stream");
53525
55204
  var import_promises5 = require("stream/promises");
@@ -53558,13 +55237,13 @@ async function ensureFrpcBinary(opts) {
53558
55237
  }
53559
55238
  const version2 = opts.version ?? FRPC_VERSION;
53560
55239
  const platform = opts.platform ?? detectPlatform();
53561
- const binDir = import_node_path39.default.join(opts.dataDir, "bin");
55240
+ const binDir = import_node_path40.default.join(opts.dataDir, "bin");
53562
55241
  import_node_fs36.default.mkdirSync(binDir, { recursive: true });
53563
55242
  cleanupStaleArtifacts(binDir);
53564
- const stableBin = import_node_path39.default.join(binDir, "frpc");
55243
+ const stableBin = import_node_path40.default.join(binDir, "frpc");
53565
55244
  if (import_node_fs36.default.existsSync(stableBin)) return stableBin;
53566
55245
  const partialBin = `${stableBin}.partial`;
53567
- const tarballPath = import_node_path39.default.join(binDir, `frp_${version2}_${platform.os}_${platform.arch}.tar.gz.partial`);
55246
+ const tarballPath = import_node_path40.default.join(binDir, `frp_${version2}_${platform.os}_${platform.arch}.tar.gz.partial`);
53568
55247
  try {
53569
55248
  const url = frpcDownloadUrl(version2, platform);
53570
55249
  await downloadToFile(url, tarballPath, opts.fetchImpl);
@@ -53590,7 +55269,7 @@ function cleanupStaleArtifacts(binDir) {
53590
55269
  }
53591
55270
  for (const name of entries) {
53592
55271
  if (name.endsWith(".partial") || name.startsWith("extract-")) {
53593
- const full = import_node_path39.default.join(binDir, name);
55272
+ const full = import_node_path40.default.join(binDir, name);
53594
55273
  try {
53595
55274
  import_node_fs36.default.rmSync(full, { recursive: true, force: true });
53596
55275
  } catch {
@@ -53616,7 +55295,7 @@ async function downloadToFile(url, dest, fetchImpl) {
53616
55295
  await (0, import_promises5.pipeline)(nodeStream, out);
53617
55296
  }
53618
55297
  async function extractFrpcFromTarball(tarball, binDir, version2, platform, destBin) {
53619
- const work = import_node_path39.default.join(binDir, `extract-${process.pid}-${Date.now()}`);
55298
+ const work = import_node_path40.default.join(binDir, `extract-${process.pid}-${Date.now()}`);
53620
55299
  import_node_fs36.default.mkdirSync(work, { recursive: true });
53621
55300
  try {
53622
55301
  await new Promise((resolve6, reject) => {
@@ -53625,7 +55304,7 @@ async function extractFrpcFromTarball(tarball, binDir, version2, platform, destB
53625
55304
  proc.on("exit", (code) => code === 0 ? resolve6() : reject(new Error(`tar exited ${code}`)));
53626
55305
  });
53627
55306
  const dirName = `frp_${version2}_${platform.os}_${platform.arch}`;
53628
- const src = import_node_path39.default.join(work, dirName, "frpc");
55307
+ const src = import_node_path40.default.join(work, dirName, "frpc");
53629
55308
  if (!import_node_fs36.default.existsSync(src)) {
53630
55309
  throw new Error(`frpc not found inside tarball at ${src}`);
53631
55310
  }
@@ -53637,10 +55316,10 @@ async function extractFrpcFromTarball(tarball, binDir, version2, platform, destB
53637
55316
 
53638
55317
  // src/tunnel/frpc-process.ts
53639
55318
  var import_node_fs37 = __toESM(require("fs"), 1);
53640
- var import_node_path40 = __toESM(require("path"), 1);
55319
+ var import_node_path41 = __toESM(require("path"), 1);
53641
55320
  var import_node_child_process9 = require("child_process");
53642
55321
  function frpcPidFilePath(dataDir) {
53643
- return import_node_path40.default.join(dataDir, "frpc.pid");
55322
+ return import_node_path41.default.join(dataDir, "frpc.pid");
53644
55323
  }
53645
55324
  function writeFrpcPid(dataDir, pid) {
53646
55325
  try {
@@ -53682,7 +55361,7 @@ function defaultSleep2(ms) {
53682
55361
  }
53683
55362
  async function killStaleFrpc(deps) {
53684
55363
  const pidFile = frpcPidFilePath(deps.dataDir);
53685
- const tomlPath = import_node_path40.default.join(deps.dataDir, "frpc.toml");
55364
+ const tomlPath = import_node_path41.default.join(deps.dataDir, "frpc.toml");
53686
55365
  const readPidFile = deps.readPidFileImpl ?? defaultReadPidFile;
53687
55366
  const isAlive = deps.isPidAliveImpl ?? defaultIsPidAlive;
53688
55367
  const killPid = deps.killPidImpl ?? defaultKillPid;
@@ -53754,7 +55433,7 @@ var DEFAULT_TUNNEL_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
53754
55433
  var TunnelManager = class {
53755
55434
  constructor(deps) {
53756
55435
  this.deps = deps;
53757
- this.store = deps.store ?? new TunnelStore(import_node_path41.default.join(deps.dataDir, "tunnel.json"));
55436
+ this.store = deps.store ?? new TunnelStore(import_node_path42.default.join(deps.dataDir, "tunnel.json"));
53758
55437
  this.ttlMs = deps.ttlMs ?? DEFAULT_TUNNEL_TTL_MS;
53759
55438
  this.startupTimeoutMs = deps.startupTimeoutMs ?? 15e3;
53760
55439
  }
@@ -53881,7 +55560,7 @@ var TunnelManager = class {
53881
55560
  dataDir: this.deps.dataDir,
53882
55561
  override: this.deps.frpcBinaryOverride ?? void 0
53883
55562
  });
53884
- const tomlPath = import_node_path41.default.join(this.deps.dataDir, "frpc.toml");
55563
+ const tomlPath = import_node_path42.default.join(this.deps.dataDir, "frpc.toml");
53885
55564
  const proxyName = `clawd-${t.subdomain}-${localPort}-${import_node_crypto10.default.randomBytes(3).toString("hex")}`;
53886
55565
  const toml = buildFrpcToml({
53887
55566
  serverAddr: t.frpsHost,
@@ -53896,9 +55575,9 @@ var TunnelManager = class {
53896
55575
  const proc = (this.deps.spawnImpl ?? import_node_child_process10.spawn)(frpcBin, ["-c", tomlPath], {
53897
55576
  stdio: ["ignore", "pipe", "pipe"]
53898
55577
  });
53899
- const logDir = import_node_path41.default.join(this.deps.dataDir, "log");
55578
+ const logDir = import_node_path42.default.join(this.deps.dataDir, "log");
53900
55579
  import_node_fs38.default.mkdirSync(logDir, { recursive: true });
53901
- const logFilePath = import_node_path41.default.join(logDir, "frpc.log");
55580
+ const logFilePath = import_node_path42.default.join(logDir, "frpc.log");
53902
55581
  const logStream = import_node_fs38.default.createWriteStream(logFilePath, { flags: "a", mode: 384 });
53903
55582
  logStream.on("error", () => {
53904
55583
  });
@@ -53982,15 +55661,15 @@ async function waitForFrpcReady(proc, timeoutMs) {
53982
55661
 
53983
55662
  // src/tunnel/device-key.ts
53984
55663
  var import_node_os14 = __toESM(require("os"), 1);
53985
- var import_node_path42 = __toESM(require("path"), 1);
55664
+ var import_node_path43 = __toESM(require("path"), 1);
53986
55665
  var import_node_crypto11 = __toESM(require("crypto"), 1);
53987
55666
  var DERIVE_SALT = "clawd-tunnel-device-v1";
53988
55667
  function deriveStableDeviceKey(opts = {}) {
53989
55668
  const hostname = opts.hostname ?? import_node_os14.default.hostname();
53990
55669
  const uid = opts.uid ?? (typeof import_node_os14.default.userInfo === "function" ? import_node_os14.default.userInfo().uid : 0);
53991
55670
  const home = opts.home ?? import_node_os14.default.homedir();
53992
- const defaultDataDir = import_node_path42.default.resolve(import_node_path42.default.join(home, ".clawd"));
53993
- const normalizedDataDir = opts.dataDir ? import_node_path42.default.resolve(opts.dataDir) : null;
55671
+ const defaultDataDir = import_node_path43.default.resolve(import_node_path43.default.join(home, ".clawd"));
55672
+ const normalizedDataDir = opts.dataDir ? import_node_path43.default.resolve(opts.dataDir) : null;
53994
55673
  const isDefaultDir = normalizedDataDir == null || normalizedDataDir === defaultDataDir;
53995
55674
  const input = isDefaultDir ? `${hostname}::${uid}` : `${hostname}::${uid}::${normalizedDataDir}`;
53996
55675
  return import_node_crypto11.default.createHmac("sha256", DERIVE_SALT).update(input).digest("hex").slice(0, 32);
@@ -53998,11 +55677,11 @@ function deriveStableDeviceKey(opts = {}) {
53998
55677
 
53999
55678
  // src/auth-store.ts
54000
55679
  var import_node_fs39 = __toESM(require("fs"), 1);
54001
- var import_node_path43 = __toESM(require("path"), 1);
55680
+ var import_node_path44 = __toESM(require("path"), 1);
54002
55681
  var import_node_crypto12 = __toESM(require("crypto"), 1);
54003
55682
  var AUTH_FILE_NAME = "auth.json";
54004
55683
  function authFilePath(dataDir) {
54005
- return import_node_path43.default.join(dataDir, AUTH_FILE_NAME);
55684
+ return import_node_path44.default.join(dataDir, AUTH_FILE_NAME);
54006
55685
  }
54007
55686
  function loadOrCreateAuthFile(opts) {
54008
55687
  const file = authFilePath(opts.dataDir);
@@ -54054,7 +55733,7 @@ function readAuthFile(file) {
54054
55733
  }
54055
55734
  }
54056
55735
  function writeAuthFile(file, content) {
54057
- import_node_fs39.default.mkdirSync(import_node_path43.default.dirname(file), { recursive: true });
55736
+ import_node_fs39.default.mkdirSync(import_node_path44.default.dirname(file), { recursive: true });
54058
55737
  import_node_fs39.default.writeFileSync(file, JSON.stringify(content, null, 2), { mode: 384 });
54059
55738
  try {
54060
55739
  import_node_fs39.default.chmodSync(file, 384);
@@ -54065,11 +55744,11 @@ function writeAuthFile(file, content) {
54065
55744
  // src/owner-profile.ts
54066
55745
  var import_node_fs40 = __toESM(require("fs"), 1);
54067
55746
  var import_node_os15 = __toESM(require("os"), 1);
54068
- var import_node_path44 = __toESM(require("path"), 1);
55747
+ var import_node_path45 = __toESM(require("path"), 1);
54069
55748
  var PROFILE_FILENAME = "profile.json";
54070
55749
  function loadOwnerDisplayName(dataDir) {
54071
55750
  const fallback = import_node_os15.default.userInfo().username;
54072
- const profilePath = import_node_path44.default.join(dataDir, PROFILE_FILENAME);
55751
+ const profilePath = import_node_path45.default.join(dataDir, PROFILE_FILENAME);
54073
55752
  let raw;
54074
55753
  try {
54075
55754
  raw = import_node_fs40.default.readFileSync(profilePath, "utf8");
@@ -54096,12 +55775,12 @@ function loadOwnerDisplayName(dataDir) {
54096
55775
 
54097
55776
  // src/feishu-auth/owner-identity-store.ts
54098
55777
  var import_node_fs41 = __toESM(require("fs"), 1);
54099
- var import_node_path45 = __toESM(require("path"), 1);
55778
+ var import_node_path46 = __toESM(require("path"), 1);
54100
55779
  var OWNER_IDENTITY_FILE_NAME = "owner-identity.json";
54101
55780
  var OwnerIdentityStore = class {
54102
55781
  file;
54103
55782
  constructor(dataDir) {
54104
- this.file = import_node_path45.default.join(dataDir, OWNER_IDENTITY_FILE_NAME);
55783
+ this.file = import_node_path46.default.join(dataDir, OWNER_IDENTITY_FILE_NAME);
54105
55784
  }
54106
55785
  read() {
54107
55786
  let raw;
@@ -54134,7 +55813,7 @@ var OwnerIdentityStore = class {
54134
55813
  };
54135
55814
  }
54136
55815
  write(record) {
54137
- import_node_fs41.default.mkdirSync(import_node_path45.default.dirname(this.file), { recursive: true });
55816
+ import_node_fs41.default.mkdirSync(import_node_path46.default.dirname(this.file), { recursive: true });
54138
55817
  import_node_fs41.default.writeFileSync(this.file, JSON.stringify(record, null, 2), { mode: 384 });
54139
55818
  try {
54140
55819
  import_node_fs41.default.chmodSync(this.file, 384);
@@ -54280,9 +55959,9 @@ var CentralClientError = class extends Error {
54280
55959
  code;
54281
55960
  cause;
54282
55961
  };
54283
- async function centralRequest(opts, path76, init) {
55962
+ async function centralRequest(opts, path77, init) {
54284
55963
  const f = opts.fetchImpl ?? globalThis.fetch;
54285
- const url = `${opts.api.replace(/\/+$/, "")}${path76}`;
55964
+ const url = `${opts.api.replace(/\/+$/, "")}${path77}`;
54286
55965
  const ctrl = new AbortController();
54287
55966
  const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 15e3);
54288
55967
  let res;
@@ -54477,7 +56156,7 @@ function verifyConnectToken(args) {
54477
56156
 
54478
56157
  // src/feishu-auth/server-key.ts
54479
56158
  var fs51 = __toESM(require("fs"), 1);
54480
- var path54 = __toESM(require("path"), 1);
56159
+ var path55 = __toESM(require("path"), 1);
54481
56160
  var FILE_NAME2 = "server-signing-key.json";
54482
56161
  var ServerKeyStore = class {
54483
56162
  constructor(dataDir) {
@@ -54485,7 +56164,7 @@ var ServerKeyStore = class {
54485
56164
  }
54486
56165
  dataDir;
54487
56166
  filePath() {
54488
- return path54.join(this.dataDir, FILE_NAME2);
56167
+ return path55.join(this.dataDir, FILE_NAME2);
54489
56168
  }
54490
56169
  /** 读缓存的公钥;无缓存 / 损坏 → null(调用方决定是否触发拉取) */
54491
56170
  read() {
@@ -54525,7 +56204,7 @@ init_protocol();
54525
56204
  // src/session/fork.ts
54526
56205
  var import_node_fs42 = __toESM(require("fs"), 1);
54527
56206
  var import_node_os16 = __toESM(require("os"), 1);
54528
- var import_node_path46 = __toESM(require("path"), 1);
56207
+ var import_node_path47 = __toESM(require("path"), 1);
54529
56208
  init_claude_history();
54530
56209
  function readJsonlEntries(file) {
54531
56210
  const raw = import_node_fs42.default.readFileSync(file, "utf8");
@@ -54541,19 +56220,19 @@ function readJsonlEntries(file) {
54541
56220
  return out;
54542
56221
  }
54543
56222
  function forkSession(input) {
54544
- const baseDir = input.baseDir ?? import_node_path46.default.join(import_node_os16.default.homedir(), ".claude");
54545
- let projectDir = import_node_path46.default.join(baseDir, "projects", cwdToHashDir(input.cwd));
54546
- let sourceFile = import_node_path46.default.join(projectDir, `${input.toolSessionId}.jsonl`);
56223
+ const baseDir = input.baseDir ?? import_node_path47.default.join(import_node_os16.default.homedir(), ".claude");
56224
+ let projectDir = import_node_path47.default.join(baseDir, "projects", cwdToHashDir(input.cwd));
56225
+ let sourceFile = import_node_path47.default.join(projectDir, `${input.toolSessionId}.jsonl`);
54547
56226
  if (!import_node_fs42.default.existsSync(sourceFile)) {
54548
56227
  const found = findTranscriptByToolSessionId(
54549
- import_node_path46.default.join(baseDir, "projects"),
56228
+ import_node_path47.default.join(baseDir, "projects"),
54550
56229
  input.toolSessionId
54551
56230
  );
54552
56231
  if (!found) {
54553
56232
  throw new Error(`fork: source transcript not found: ${sourceFile}`);
54554
56233
  }
54555
56234
  sourceFile = found;
54556
- projectDir = import_node_path46.default.dirname(found);
56235
+ projectDir = import_node_path47.default.dirname(found);
54557
56236
  }
54558
56237
  const entries = readJsonlEntries(sourceFile);
54559
56238
  const mainEntries = entries.filter((e) => e.isSidechain !== true);
@@ -54582,7 +56261,7 @@ function forkSession(input) {
54582
56261
  }
54583
56262
  forkedLines.push(JSON.stringify(forked));
54584
56263
  }
54585
- const forkedFilePath = import_node_path46.default.join(projectDir, `${forkedToolSessionId}.jsonl`);
56264
+ const forkedFilePath = import_node_path47.default.join(projectDir, `${forkedToolSessionId}.jsonl`);
54586
56265
  import_node_fs42.default.mkdirSync(projectDir, { recursive: true });
54587
56266
  import_node_fs42.default.writeFileSync(forkedFilePath, forkedLines.join("\n") + "\n", { mode: 384 });
54588
56267
  return { forkedToolSessionId, forkedFilePath };
@@ -55001,7 +56680,7 @@ function buildPermissionHandlers(deps) {
55001
56680
  }
55002
56681
 
55003
56682
  // src/handlers/history.ts
55004
- var path57 = __toESM(require("path"), 1);
56683
+ var path58 = __toESM(require("path"), 1);
55005
56684
  init_protocol();
55006
56685
 
55007
56686
  // src/session/recent-dirs.ts
@@ -55019,7 +56698,7 @@ function listRecentDirs(store, limit = 50) {
55019
56698
  }
55020
56699
 
55021
56700
  // src/permission/persona-paths.ts
55022
- var path56 = __toESM(require("path"), 1);
56701
+ var path57 = __toESM(require("path"), 1);
55023
56702
  function getAllowedPersonaIds(grants, action) {
55024
56703
  const ids = /* @__PURE__ */ new Set();
55025
56704
  for (const g2 of grants) {
@@ -55032,42 +56711,42 @@ function getAllowedPersonaIds(grants, action) {
55032
56711
  return ids;
55033
56712
  }
55034
56713
  function isGuestPathAllowed(grants, absPath, personaRoot, action = "read", userWorkDir) {
55035
- const target = path56.resolve(absPath);
56714
+ const target = path57.resolve(absPath);
55036
56715
  if (userWorkDir) {
55037
- const u = path56.resolve(userWorkDir);
55038
- const usep = u.endsWith(path56.sep) ? "" : path56.sep;
56716
+ const u = path57.resolve(userWorkDir);
56717
+ const usep = u.endsWith(path57.sep) ? "" : path57.sep;
55039
56718
  if (target === u || target.startsWith(u + usep)) return true;
55040
56719
  }
55041
- const root = path56.resolve(personaRoot);
55042
- const sep3 = root.endsWith(path56.sep) ? "" : path56.sep;
56720
+ const root = path57.resolve(personaRoot);
56721
+ const sep3 = root.endsWith(path57.sep) ? "" : path57.sep;
55043
56722
  if (!target.startsWith(root + sep3)) return false;
55044
- const rel = path56.relative(root, target);
56723
+ const rel = path57.relative(root, target);
55045
56724
  if (!rel || rel.startsWith("..")) return false;
55046
- const personaId2 = rel.split(path56.sep)[0];
56725
+ const personaId2 = rel.split(path57.sep)[0];
55047
56726
  if (!personaId2) return false;
55048
56727
  const allowed = getAllowedPersonaIds(grants, action);
55049
56728
  if (allowed === "*") return true;
55050
56729
  return allowed.has(personaId2);
55051
56730
  }
55052
56731
  function personaIdFromPath(absPath, personaRoot) {
55053
- const root = path56.resolve(personaRoot);
55054
- const target = path56.resolve(absPath);
55055
- const sep3 = root.endsWith(path56.sep) ? "" : path56.sep;
56732
+ const root = path57.resolve(personaRoot);
56733
+ const target = path57.resolve(absPath);
56734
+ const sep3 = root.endsWith(path57.sep) ? "" : path57.sep;
55056
56735
  if (!target.startsWith(root + sep3)) return null;
55057
- const rel = path56.relative(root, target);
56736
+ const rel = path57.relative(root, target);
55058
56737
  if (!rel || rel.startsWith("..")) return null;
55059
- const id = rel.split(path56.sep)[0];
56738
+ const id = rel.split(path57.sep)[0];
55060
56739
  return id || null;
55061
56740
  }
55062
56741
  function isPathWithin(dir, absPath) {
55063
- const d = path56.resolve(dir);
55064
- const t = path56.resolve(absPath);
55065
- const sep3 = d.endsWith(path56.sep) ? "" : path56.sep;
56742
+ const d = path57.resolve(dir);
56743
+ const t = path57.resolve(absPath);
56744
+ const sep3 = d.endsWith(path57.sep) ? "" : path57.sep;
55066
56745
  return t === d || t.startsWith(d + sep3);
55067
56746
  }
55068
56747
  function isPathInGuestBoundary(personaRoot, personaId2, userWorkDir, absPath) {
55069
56748
  if (userWorkDir && isPathWithin(userWorkDir, absPath)) return true;
55070
- return personaIdFromPath(path56.resolve(absPath), personaRoot) === personaId2;
56749
+ return personaIdFromPath(path57.resolve(absPath), personaRoot) === personaId2;
55071
56750
  }
55072
56751
 
55073
56752
  // src/handlers/history.ts
@@ -55119,7 +56798,7 @@ function buildHistoryHandlers(deps) {
55119
56798
  if (!pid) return false;
55120
56799
  return isGuestPathAllowed(
55121
56800
  ctx.grants,
55122
- path57.join(personaRoot, pid),
56801
+ path58.join(personaRoot, pid),
55123
56802
  personaRoot,
55124
56803
  "read",
55125
56804
  userWorkDir
@@ -55131,7 +56810,7 @@ function buildHistoryHandlers(deps) {
55131
56810
  };
55132
56811
  const list = async (frame, _client, ctx) => {
55133
56812
  const args = HistoryListArgs.parse(frame);
55134
- assertGuestPath(ctx, path57.resolve(args.projectPath), personaRoot, "history:list", usersRoot);
56813
+ assertGuestPath(ctx, path58.resolve(args.projectPath), personaRoot, "history:list", usersRoot);
55135
56814
  const sessions = await history.listSessions(args);
55136
56815
  return { response: { type: "history:list", sessions } };
55137
56816
  };
@@ -55164,13 +56843,13 @@ function buildHistoryHandlers(deps) {
55164
56843
  };
55165
56844
  const subagents = async (frame, _client, ctx) => {
55166
56845
  const args = HistorySubagentsArgs.parse(frame);
55167
- assertGuestPath(ctx, path57.resolve(args.cwd), personaRoot, "history:subagents", usersRoot);
56846
+ assertGuestPath(ctx, path58.resolve(args.cwd), personaRoot, "history:subagents", usersRoot);
55168
56847
  const subs = await history.listSubagents(args);
55169
56848
  return { response: { type: "history:subagents", subagents: subs } };
55170
56849
  };
55171
56850
  const subagentRead = async (frame, _client, ctx) => {
55172
56851
  const args = HistorySubagentReadArgs.parse(frame);
55173
- assertGuestPath(ctx, path57.resolve(args.cwd), personaRoot, "history:subagent-read", usersRoot);
56852
+ assertGuestPath(ctx, path58.resolve(args.cwd), personaRoot, "history:subagent-read", usersRoot);
55174
56853
  const res = await history.readSubagent(args);
55175
56854
  return { response: { type: "history:subagent-read", ...res } };
55176
56855
  };
@@ -55179,7 +56858,7 @@ function buildHistoryHandlers(deps) {
55179
56858
  if (ctx?.principal.kind === "guest" && personaRoot) {
55180
56859
  const userWorkDir = usersRoot ? deriveUserWorkDir(ctx.principal.id, usersRoot) : void 0;
55181
56860
  const filtered = dirs.filter(
55182
- (d) => isGuestPathAllowed(ctx.grants, path57.resolve(d.cwd), personaRoot, "read", userWorkDir)
56861
+ (d) => isGuestPathAllowed(ctx.grants, path58.resolve(d.cwd), personaRoot, "read", userWorkDir)
55183
56862
  );
55184
56863
  return { response: { type: "history:recentDirs", dirs: filtered } };
55185
56864
  }
@@ -55196,7 +56875,7 @@ function buildHistoryHandlers(deps) {
55196
56875
  }
55197
56876
 
55198
56877
  // src/handlers/workspace.ts
55199
- var path58 = __toESM(require("path"), 1);
56878
+ var path59 = __toESM(require("path"), 1);
55200
56879
  var os16 = __toESM(require("os"), 1);
55201
56880
  init_protocol();
55202
56881
  init_protocol();
@@ -55238,22 +56917,22 @@ function buildWorkspaceHandlers(deps) {
55238
56917
  const args = WorkspaceListArgs.parse(frame);
55239
56918
  const isGuest = ctx?.principal.kind === "guest";
55240
56919
  const fallbackCwd = isGuest && personaRoot ? personaRoot : os16.homedir();
55241
- const resolvedCwd = path58.resolve(args.cwd ?? fallbackCwd);
55242
- const target = args.path ? path58.resolve(resolvedCwd, args.path) : resolvedCwd;
56920
+ const resolvedCwd = path59.resolve(args.cwd ?? fallbackCwd);
56921
+ const target = args.path ? path59.resolve(resolvedCwd, args.path) : resolvedCwd;
55243
56922
  assertGuestPath2(ctx, target, personaRoot, "workspace:list", usersRoot);
55244
56923
  const res = workspace.list({ ...args, cwd: resolvedCwd });
55245
56924
  return { response: { type: "workspace:list", ...res } };
55246
56925
  };
55247
56926
  const read = async (frame, _client, ctx) => {
55248
56927
  const args = WorkspaceReadArgs.parse(frame);
55249
- const target = path58.isAbsolute(args.path) ? path58.resolve(args.path) : path58.resolve(args.cwd, args.path);
56928
+ const target = path59.isAbsolute(args.path) ? path59.resolve(args.path) : path59.resolve(args.cwd, args.path);
55250
56929
  assertGuestPath2(ctx, target, personaRoot, "workspace:read", usersRoot);
55251
56930
  const res = workspace.read(args);
55252
56931
  return { response: { type: "workspace:read", ...res } };
55253
56932
  };
55254
56933
  const skillsList = async (frame, _client, ctx) => {
55255
56934
  const args = SkillsListArgs.parse(frame);
55256
- const cwdAbs = path58.resolve(args.cwd);
56935
+ const cwdAbs = path59.resolve(args.cwd);
55257
56936
  assertGuestPath2(ctx, cwdAbs, personaRoot, "skills:list", usersRoot);
55258
56937
  const list2 = await getSkillsForTool(args.tool ?? "claude", cwdAbs);
55259
56938
  if (ctx?.principal.kind === "guest" && personaRoot) {
@@ -55265,7 +56944,7 @@ function buildWorkspaceHandlers(deps) {
55265
56944
  };
55266
56945
  const agentsList = async (frame, _client, ctx) => {
55267
56946
  const args = AgentsListArgs.parse(frame);
55268
- const cwdAbs = path58.resolve(args.cwd);
56947
+ const cwdAbs = path59.resolve(args.cwd);
55269
56948
  assertGuestPath2(ctx, cwdAbs, personaRoot, "agents:list", usersRoot);
55270
56949
  if (args.tool === "codex") {
55271
56950
  return { response: { type: "agents:list", agents: [] } };
@@ -55287,18 +56966,18 @@ function buildWorkspaceHandlers(deps) {
55287
56966
  }
55288
56967
 
55289
56968
  // src/handlers/git.ts
55290
- var path60 = __toESM(require("path"), 1);
56969
+ var path61 = __toESM(require("path"), 1);
55291
56970
  init_protocol();
55292
56971
  init_protocol();
55293
56972
 
55294
56973
  // src/workspace/git.ts
55295
56974
  var import_node_child_process11 = require("child_process");
55296
56975
  var import_node_fs43 = __toESM(require("fs"), 1);
55297
- var import_node_path47 = __toESM(require("path"), 1);
56976
+ var import_node_path48 = __toESM(require("path"), 1);
55298
56977
  var import_node_util = require("util");
55299
56978
  var pexec = (0, import_node_util.promisify)(import_node_child_process11.execFile);
55300
56979
  function normalizePath(p2) {
55301
- const resolved = import_node_path47.default.resolve(p2);
56980
+ const resolved = import_node_path48.default.resolve(p2);
55302
56981
  try {
55303
56982
  return import_node_fs43.default.realpathSync(resolved);
55304
56983
  } catch {
@@ -55374,7 +57053,7 @@ async function listGitBranches(cwd) {
55374
57053
  function assertGuestCwd(ctx, cwd, personaRoot, method, usersRoot) {
55375
57054
  if (!ctx || ctx.principal.kind !== "guest" || !personaRoot) return;
55376
57055
  const userWorkDir = usersRoot ? deriveUserWorkDir(ctx.principal.id, usersRoot) : void 0;
55377
- if (!isGuestPathAllowed(ctx.grants, path60.resolve(cwd), personaRoot, "read", userWorkDir)) {
57056
+ if (!isGuestPathAllowed(ctx.grants, path61.resolve(cwd), personaRoot, "read", userWorkDir)) {
55378
57057
  throw new ClawdError(
55379
57058
  ERROR_CODES.UNAUTHORIZED,
55380
57059
  `guest ${ctx.principal.id} cannot ${method} cwd ${cwd}`
@@ -55978,9 +57657,20 @@ function buildDeviceHandlers(deps) {
55978
57657
  }
55979
57658
  }
55980
57659
  };
57660
+ const connections = async (_frame, client, ctx) => {
57661
+ ensureOwner3(ctx);
57662
+ const entries = deps.listOwnerConnections();
57663
+ return {
57664
+ response: {
57665
+ type: "device:connections:ok",
57666
+ connections: entries.map((e) => ({ ...e, self: e.clientId === client.id }))
57667
+ }
57668
+ };
57669
+ };
55981
57670
  return {
55982
57671
  "device:list": list,
55983
- "device:connect": connect
57672
+ "device:connect": connect,
57673
+ "device:connections": connections
55984
57674
  };
55985
57675
  }
55986
57676
 
@@ -56164,6 +57854,7 @@ var METHOD_GRANT_MAP = {
56164
57854
  // 设备目录 / 连接都是 owner 本机操作(用 owner 的 ttcJwt 找中心 server),guest 不可调
56165
57855
  "device:list": ADMIN_ANY,
56166
57856
  "device:connect": ADMIN_ANY,
57857
+ "device:connections": ADMIN_ANY,
56167
57858
  // ---- app-builder Project picker(spec 2026-06-01-app-builder-project-picker-design) ----
56168
57859
  // owner-only:picker UI 给 owner 管理本机 build 中的 project(fs + 端口分配)。
56169
57860
  // 即使 persona-app-builder 是 PreinstalledPersona,project 管理也属本机 owner 行为,
@@ -56222,21 +57913,21 @@ function computeMethodAccess(args) {
56222
57913
  }
56223
57914
 
56224
57915
  // src/version.ts
56225
- var version = "0.2.269".length > 0 ? "0.2.269" : "dev";
57916
+ var version = "0.2.271".length > 0 ? "0.2.271" : "dev";
56226
57917
 
56227
57918
  // src/cli-probe/probe.ts
56228
57919
  var fs54 = __toESM(require("fs"), 1);
56229
- var path61 = __toESM(require("path"), 1);
57920
+ var path62 = __toESM(require("path"), 1);
56230
57921
  var PKG_NAME = "@clawos-dev/clawd";
56231
57922
  var BIN_NAME = "clawd";
56232
57923
  var MAX_PARENT_HOPS = 5;
56233
57924
  function probeGlobalCli(pathEnv) {
56234
57925
  if (!pathEnv) return null;
56235
- for (const dir of pathEnv.split(path61.delimiter)) {
57926
+ for (const dir of pathEnv.split(path62.delimiter)) {
56236
57927
  if (!dir) continue;
56237
57928
  let real;
56238
57929
  try {
56239
- real = fs54.realpathSync(path61.join(dir, BIN_NAME));
57930
+ real = fs54.realpathSync(path62.join(dir, BIN_NAME));
56240
57931
  } catch {
56241
57932
  continue;
56242
57933
  }
@@ -56246,15 +57937,15 @@ function probeGlobalCli(pathEnv) {
56246
57937
  return null;
56247
57938
  }
56248
57939
  function readOwnPackageVersion(entryPath) {
56249
- let dir = path61.dirname(entryPath);
57940
+ let dir = path62.dirname(entryPath);
56250
57941
  for (let i = 0; i < MAX_PARENT_HOPS; i++) {
56251
57942
  try {
56252
- const raw = fs54.readFileSync(path61.join(dir, "package.json"), "utf8");
57943
+ const raw = fs54.readFileSync(path62.join(dir, "package.json"), "utf8");
56253
57944
  const pkg = JSON.parse(raw);
56254
57945
  if (pkg.name !== PKG_NAME) return null;
56255
57946
  return typeof pkg.version === "string" && pkg.version ? pkg.version : null;
56256
57947
  } catch {
56257
- const parent = path61.dirname(dir);
57948
+ const parent = path62.dirname(dir);
56258
57949
  if (parent === dir) return null;
56259
57950
  dir = parent;
56260
57951
  }
@@ -56314,17 +58005,28 @@ function buildMetaHandlers(deps) {
56314
58005
  };
56315
58006
  }
56316
58007
  function buildMetaMethodsHandler(deps) {
56317
- return async (_frame, _client, ctx) => {
58008
+ return async (frame, _client, ctx) => {
56318
58009
  const grants = ctx?.grants ?? [];
56319
- const methods = METHOD_NAMES.map(
56320
- (method) => computeMethodAccess({
56321
- method,
56322
- grants,
56323
- feishuActive: deps.feishuActive(),
56324
- isImplemented: deps.isImplemented
56325
- })
56326
- );
56327
- return { response: { type: "meta:methods", methods } };
58010
+ const { method } = MetaMethodsArgs.parse(frame);
58011
+ const compute = (m2) => computeMethodAccess({
58012
+ method: m2,
58013
+ grants,
58014
+ feishuActive: deps.feishuActive(),
58015
+ isImplemented: deps.isImplemented
58016
+ });
58017
+ if (method !== void 0) {
58018
+ if (!isMethodName(method)) {
58019
+ throw new ClawdError(ERROR_CODES.INVALID_PARAM, `unknown method: ${method}`);
58020
+ }
58021
+ const argsSchema = methodArgsSchema(method);
58022
+ return {
58023
+ response: {
58024
+ type: "meta:methods",
58025
+ methods: [{ ...compute(method), ...argsSchema ? { argsSchema } : {} }]
58026
+ }
58027
+ };
58028
+ }
58029
+ return { response: { type: "meta:methods", methods: METHOD_NAMES.map(compute) } };
56328
58030
  };
56329
58031
  }
56330
58032
 
@@ -56401,7 +58103,7 @@ function buildPersonaHandlers(deps) {
56401
58103
  }
56402
58104
 
56403
58105
  // src/handlers/attachment.ts
56404
- var import_node_path48 = __toESM(require("path"), 1);
58106
+ var import_node_path49 = __toESM(require("path"), 1);
56405
58107
  init_protocol();
56406
58108
  init_protocol();
56407
58109
  var DEFAULT_TTL_SECONDS = 24 * 3600;
@@ -56481,12 +58183,12 @@ function buildAttachmentHandlers(deps) {
56481
58183
  `session ${args.sessionId} scope unresolved`
56482
58184
  );
56483
58185
  }
56484
- const cwdAbs = import_node_path48.default.resolve(sessionFile.cwd);
56485
- const candidateAbs = import_node_path48.default.isAbsolute(args.relPath) ? import_node_path48.default.resolve(args.relPath) : import_node_path48.default.resolve(cwdAbs, args.relPath);
58186
+ const cwdAbs = import_node_path49.default.resolve(sessionFile.cwd);
58187
+ const candidateAbs = import_node_path49.default.isAbsolute(args.relPath) ? import_node_path49.default.resolve(args.relPath) : import_node_path49.default.resolve(cwdAbs, args.relPath);
56486
58188
  guardAttachmentPath(ctx, args.sessionId, candidateAbs, "attachment.signUrl", "group-acl");
56487
58189
  const entries = deps.groupFileStore.list(scope, args.sessionId);
56488
58190
  const entry = entries.find((e) => {
56489
- const storedAbs = import_node_path48.default.isAbsolute(e.relPath) ? import_node_path48.default.resolve(e.relPath) : import_node_path48.default.resolve(cwdAbs, e.relPath);
58191
+ const storedAbs = import_node_path49.default.isAbsolute(e.relPath) ? import_node_path49.default.resolve(e.relPath) : import_node_path49.default.resolve(cwdAbs, e.relPath);
56490
58192
  return storedAbs === candidateAbs && !e.stale;
56491
58193
  });
56492
58194
  if (!entry) {
@@ -56511,7 +58213,7 @@ function buildAttachmentHandlers(deps) {
56511
58213
  if (!ctx || ctx.principal.kind !== "guest" || !deps.personaRoot || !deps.sessionStore) return;
56512
58214
  const f = deps.sessionStore.read(sessionId);
56513
58215
  if (!f) return;
56514
- assertGuestAttachmentPath(ctx, import_node_path48.default.resolve(f.cwd), deps.personaRoot, method, deps.usersRoot);
58216
+ assertGuestAttachmentPath(ctx, import_node_path49.default.resolve(f.cwd), deps.personaRoot, method, deps.usersRoot);
56515
58217
  }
56516
58218
  const groupAdd = async (frame, _client, ctx) => {
56517
58219
  if (!deps.groupFileStore || !deps.getSessionScope) {
@@ -56526,8 +58228,8 @@ function buildAttachmentHandlers(deps) {
56526
58228
  if (!scope) {
56527
58229
  throw new ClawdError(ERROR_CODES.VALIDATION_ERROR, `session ${args.sessionId} not found`);
56528
58230
  }
56529
- const cwdAbs = import_node_path48.default.resolve(deps.sessionStore?.read(args.sessionId)?.cwd ?? ".");
56530
- const candidateAbs = import_node_path48.default.isAbsolute(args.relPath) ? import_node_path48.default.resolve(args.relPath) : import_node_path48.default.resolve(cwdAbs, args.relPath);
58231
+ const cwdAbs = import_node_path49.default.resolve(deps.sessionStore?.read(args.sessionId)?.cwd ?? ".");
58232
+ const candidateAbs = import_node_path49.default.isAbsolute(args.relPath) ? import_node_path49.default.resolve(args.relPath) : import_node_path49.default.resolve(cwdAbs, args.relPath);
56531
58233
  guardAttachmentPath(ctx, args.sessionId, candidateAbs, "attachment.groupAdd", "cwd-subtree");
56532
58234
  const from = args.origin === "agent" ? "agent" : ctx?.principal.kind === "owner" ? "owner" : "agent";
56533
58235
  const size = 0;
@@ -56586,19 +58288,19 @@ function buildAttachmentHandlers(deps) {
56586
58288
 
56587
58289
  // src/handlers/extension.ts
56588
58290
  var import_promises9 = __toESM(require("fs/promises"), 1);
56589
- var import_node_path53 = __toESM(require("path"), 1);
58291
+ var import_node_path54 = __toESM(require("path"), 1);
56590
58292
  init_protocol();
56591
58293
 
56592
58294
  // src/extension/bundle-zip.ts
56593
58295
  var import_promises6 = __toESM(require("fs/promises"), 1);
56594
- var import_node_path49 = __toESM(require("path"), 1);
58296
+ var import_node_path50 = __toESM(require("path"), 1);
56595
58297
  var import_node_crypto14 = __toESM(require("crypto"), 1);
56596
58298
  var import_jszip2 = __toESM(require_lib3(), 1);
56597
58299
  async function bundleExtensionDir(dir) {
56598
58300
  const entries = await listFilesSorted(dir);
56599
58301
  const zip = new import_jszip2.default();
56600
58302
  for (const rel of entries) {
56601
- const abs = import_node_path49.default.join(dir, rel);
58303
+ const abs = import_node_path50.default.join(dir, rel);
56602
58304
  const content = await import_promises6.default.readFile(abs);
56603
58305
  zip.file(rel, content, { date: FIXED_DATE });
56604
58306
  }
@@ -56619,7 +58321,7 @@ async function listFilesSorted(rootDir) {
56619
58321
  return out;
56620
58322
  }
56621
58323
  async function walk(absRoot, relPrefix, out) {
56622
- const dirAbs = import_node_path49.default.join(absRoot, relPrefix);
58324
+ const dirAbs = import_node_path50.default.join(absRoot, relPrefix);
56623
58325
  const entries = await import_promises6.default.readdir(dirAbs, { withFileTypes: true });
56624
58326
  for (const e of entries) {
56625
58327
  if (IGNORE_BASENAMES.has(e.name)) continue;
@@ -56673,25 +58375,25 @@ function computePublishCheck(args) {
56673
58375
 
56674
58376
  // src/extension/install-flow.ts
56675
58377
  var import_promises7 = __toESM(require("fs/promises"), 1);
56676
- var import_node_path51 = __toESM(require("path"), 1);
58378
+ var import_node_path52 = __toESM(require("path"), 1);
56677
58379
  var import_node_os19 = __toESM(require("os"), 1);
56678
58380
  var import_node_crypto15 = __toESM(require("crypto"), 1);
56679
58381
  var import_jszip3 = __toESM(require_lib3(), 1);
56680
58382
 
56681
58383
  // src/extension/paths.ts
56682
58384
  var import_node_os18 = __toESM(require("os"), 1);
56683
- var import_node_path50 = __toESM(require("path"), 1);
58385
+ var import_node_path51 = __toESM(require("path"), 1);
56684
58386
  function clawdHomeRoot(override) {
56685
- return override ?? process.env.CLAWD_HOME ?? import_node_path50.default.join(import_node_os18.default.homedir(), ".clawd");
58387
+ return override ?? process.env.CLAWD_HOME ?? import_node_path51.default.join(import_node_os18.default.homedir(), ".clawd");
56686
58388
  }
56687
58389
  function extensionsRoot(override) {
56688
- return import_node_path50.default.join(clawdHomeRoot(override), "extensions");
58390
+ return import_node_path51.default.join(clawdHomeRoot(override), "extensions");
56689
58391
  }
56690
58392
  function publishedChannelsFile(override) {
56691
- return import_node_path50.default.join(clawdHomeRoot(override), "extensions-published.json");
58393
+ return import_node_path51.default.join(clawdHomeRoot(override), "extensions-published.json");
56692
58394
  }
56693
58395
  function bundleCacheRoot(override) {
56694
- return import_node_path50.default.join(clawdHomeRoot(override), "extension-bundles");
58396
+ return import_node_path51.default.join(clawdHomeRoot(override), "extension-bundles");
56695
58397
  }
56696
58398
 
56697
58399
  // src/extension/install-flow.ts
@@ -56718,7 +58420,7 @@ async function installFromChannel(args, deps) {
56718
58420
  throw new InstallError("ZIP_INVALID", `failed to load zip: ${e.message}`);
56719
58421
  }
56720
58422
  for (const name of Object.keys(zip.files)) {
56721
- if (name.includes("..") || name.startsWith("/") || import_node_path51.default.isAbsolute(name)) {
58423
+ if (name.includes("..") || name.startsWith("/") || import_node_path52.default.isAbsolute(name)) {
56722
58424
  throw new InstallError("ZIP_INVALID", `unsafe zip entry: ${name}`);
56723
58425
  }
56724
58426
  }
@@ -56750,7 +58452,7 @@ async function installFromChannel(args, deps) {
56750
58452
  );
56751
58453
  }
56752
58454
  const localExtId = namespacedExtId(ownerSlug, channelRef.ownerPrincipalId);
56753
- const destDir = import_node_path51.default.join(deps.extensionsRoot, localExtId);
58455
+ const destDir = import_node_path52.default.join(deps.extensionsRoot, localExtId);
56754
58456
  let destExists = false;
56755
58457
  try {
56756
58458
  await import_promises7.default.access(destDir);
@@ -56764,16 +58466,16 @@ async function installFromChannel(args, deps) {
56764
58466
  );
56765
58467
  }
56766
58468
  const stage = await import_promises7.default.mkdtemp(
56767
- import_node_path51.default.join(import_node_os19.default.tmpdir(), `clawd-ext-install-${localExtId}-`)
58469
+ import_node_path52.default.join(import_node_os19.default.tmpdir(), `clawd-ext-install-${localExtId}-`)
56768
58470
  );
56769
58471
  try {
56770
58472
  for (const [name, entry] of Object.entries(zip.files)) {
56771
- const dest = import_node_path51.default.join(stage, name);
58473
+ const dest = import_node_path52.default.join(stage, name);
56772
58474
  if (entry.dir) {
56773
58475
  await import_promises7.default.mkdir(dest, { recursive: true });
56774
58476
  continue;
56775
58477
  }
56776
- await import_promises7.default.mkdir(import_node_path51.default.dirname(dest), { recursive: true });
58478
+ await import_promises7.default.mkdir(import_node_path52.default.dirname(dest), { recursive: true });
56777
58479
  if (name === "manifest.json") {
56778
58480
  const rewritten = { ...parsed.data, id: localExtId };
56779
58481
  await import_promises7.default.writeFile(dest, JSON.stringify(rewritten, null, 2));
@@ -56794,7 +58496,7 @@ async function installFromChannel(args, deps) {
56794
58496
 
56795
58497
  // src/extension/update-flow.ts
56796
58498
  var import_promises8 = __toESM(require("fs/promises"), 1);
56797
- var import_node_path52 = __toESM(require("path"), 1);
58499
+ var import_node_path53 = __toESM(require("path"), 1);
56798
58500
  var import_node_os20 = __toESM(require("os"), 1);
56799
58501
  var import_node_crypto16 = __toESM(require("crypto"), 1);
56800
58502
  var import_jszip4 = __toESM(require_lib3(), 1);
@@ -56811,11 +58513,11 @@ async function updateFromChannel(args, deps) {
56811
58513
  channelRef.extId,
56812
58514
  channelRef.ownerPrincipalId
56813
58515
  );
56814
- const liveDir = import_node_path52.default.join(deps.extensionsRoot, localExtId);
58516
+ const liveDir = import_node_path53.default.join(deps.extensionsRoot, localExtId);
56815
58517
  const prevDir = `${liveDir}.prev`;
56816
58518
  let existingVersion;
56817
58519
  try {
56818
- const raw = await import_promises8.default.readFile(import_node_path52.default.join(liveDir, "manifest.json"), "utf8");
58520
+ const raw = await import_promises8.default.readFile(import_node_path53.default.join(liveDir, "manifest.json"), "utf8");
56819
58521
  const parsed2 = ExtensionManifestSchema.safeParse(JSON.parse(raw));
56820
58522
  if (!parsed2.success) {
56821
58523
  throw new UpdateError(
@@ -56848,7 +58550,7 @@ async function updateFromChannel(args, deps) {
56848
58550
  throw new UpdateError("ZIP_INVALID", `failed to load zip: ${e.message}`);
56849
58551
  }
56850
58552
  for (const name of Object.keys(zip.files)) {
56851
- if (name.includes("..") || name.startsWith("/") || import_node_path52.default.isAbsolute(name)) {
58553
+ if (name.includes("..") || name.startsWith("/") || import_node_path53.default.isAbsolute(name)) {
56852
58554
  throw new UpdateError("ZIP_INVALID", `unsafe zip entry: ${name}`);
56853
58555
  }
56854
58556
  }
@@ -56883,16 +58585,16 @@ async function updateFromChannel(args, deps) {
56883
58585
  await import_promises8.default.rm(prevDir, { recursive: true, force: true });
56884
58586
  await import_promises8.default.rename(liveDir, prevDir);
56885
58587
  const stage = await import_promises8.default.mkdtemp(
56886
- import_node_path52.default.join(import_node_os20.default.tmpdir(), `clawd-ext-update-${localExtId}-`)
58588
+ import_node_path53.default.join(import_node_os20.default.tmpdir(), `clawd-ext-update-${localExtId}-`)
56887
58589
  );
56888
58590
  try {
56889
58591
  for (const [name, entry] of Object.entries(zip.files)) {
56890
- const dest = import_node_path52.default.join(stage, name);
58592
+ const dest = import_node_path53.default.join(stage, name);
56891
58593
  if (entry.dir) {
56892
58594
  await import_promises8.default.mkdir(dest, { recursive: true });
56893
58595
  continue;
56894
58596
  }
56895
- await import_promises8.default.mkdir(import_node_path52.default.dirname(dest), { recursive: true });
58597
+ await import_promises8.default.mkdir(import_node_path53.default.dirname(dest), { recursive: true });
56896
58598
  if (name === "manifest.json") {
56897
58599
  const rewritten = { ...parsed.data, id: localExtId };
56898
58600
  await import_promises8.default.writeFile(dest, JSON.stringify(rewritten, null, 2));
@@ -56959,7 +58661,7 @@ async function rewriteManifestVersion(root, extId, newVersion, previousPublished
56959
58661
  );
56960
58662
  }
56961
58663
  }
56962
- const manifestPath = import_node_path53.default.join(root, extId, "manifest.json");
58664
+ const manifestPath = import_node_path54.default.join(root, extId, "manifest.json");
56963
58665
  const manifest = await readManifest(root, extId);
56964
58666
  const next = { ...manifest, version: newVersion };
56965
58667
  const tmp = `${manifestPath}.tmp`;
@@ -56967,7 +58669,7 @@ async function rewriteManifestVersion(root, extId, newVersion, previousPublished
56967
58669
  await import_promises9.default.rename(tmp, manifestPath);
56968
58670
  }
56969
58671
  async function readManifest(root, extId) {
56970
- const file = import_node_path53.default.join(root, extId, "manifest.json");
58672
+ const file = import_node_path54.default.join(root, extId, "manifest.json");
56971
58673
  let raw;
56972
58674
  try {
56973
58675
  raw = await import_promises9.default.readFile(file, "utf8");
@@ -57051,7 +58753,7 @@ function buildExtensionHandlers(deps) {
57051
58753
  };
57052
58754
  async function buildSnapshotMeta(extId) {
57053
58755
  const manifest = await readManifest(deps.root, extId);
57054
- const { sha256, buffer } = await bundleExtensionDir(import_node_path53.default.join(deps.root, extId));
58756
+ const { sha256, buffer } = await bundleExtensionDir(import_node_path54.default.join(deps.root, extId));
57055
58757
  return { manifest, contentHash: sha256, buffer };
57056
58758
  }
57057
58759
  const publish = async (frame, _client, ctx) => {
@@ -57228,7 +58930,7 @@ function buildExtensionHandlers(deps) {
57228
58930
  // src/app-builder/project-store.ts
57229
58931
  var import_node_fs44 = require("fs");
57230
58932
  var import_node_child_process12 = require("child_process");
57231
- var import_node_path54 = require("path");
58933
+ var import_node_path55 = require("path");
57232
58934
  init_protocol();
57233
58935
  var PROJECTS_DIR = "projects";
57234
58936
  var META_FILE = ".clawd-project.json";
@@ -57242,14 +58944,14 @@ var ProjectStore = class {
57242
58944
  root;
57243
58945
  /** projects/<name>/.clawd-project.json 路径 */
57244
58946
  metaPath(name) {
57245
- return (0, import_node_path54.join)(this.projectsRoot(), name, META_FILE);
58947
+ return (0, import_node_path55.join)(this.projectsRoot(), name, META_FILE);
57246
58948
  }
57247
58949
  /** projects/<name>/ 目录路径(cwd 用) */
57248
58950
  projectDir(name) {
57249
- return (0, import_node_path54.join)(this.projectsRoot(), name);
58951
+ return (0, import_node_path55.join)(this.projectsRoot(), name);
57250
58952
  }
57251
58953
  projectsRoot() {
57252
- return (0, import_node_path54.join)(this.root, PROJECTS_DIR);
58954
+ return (0, import_node_path55.join)(this.root, PROJECTS_DIR);
57253
58955
  }
57254
58956
  async list() {
57255
58957
  let entries;
@@ -57552,7 +59254,7 @@ var PublishJobRegistry = class {
57552
59254
  // src/app-builder/publish-job-runner.ts
57553
59255
  var import_node_child_process14 = require("child_process");
57554
59256
  var import_node_fs45 = require("fs");
57555
- var import_node_path55 = require("path");
59257
+ var import_node_path56 = require("path");
57556
59258
 
57557
59259
  // src/app-builder/publish-stage-parser.ts
57558
59260
  var STAGE_RE = /^\s*::stage::(build|deploy|verify)\s*$/;
@@ -57584,7 +59286,7 @@ async function startPublishJob(deps, args) {
57584
59286
  return { jobId: registry2.get(args.name).jobId, status: "already-publishing" };
57585
59287
  }
57586
59288
  const projDir = projectDir(args.name);
57587
- const logPath = (0, import_node_path55.join)(projDir, ".publish.log");
59289
+ const logPath = (0, import_node_path56.join)(projDir, ".publish.log");
57588
59290
  let logStream = null;
57589
59291
  try {
57590
59292
  logStream = (0, import_node_fs45.createWriteStream)(logPath, { flags: "w" });
@@ -57844,7 +59546,7 @@ async function recoverInterruptedJobs(deps) {
57844
59546
 
57845
59547
  // src/handlers/app-builder.ts
57846
59548
  init_protocol();
57847
- var import_node_path56 = require("path");
59549
+ var import_node_path57 = require("path");
57848
59550
  var import_node_fs46 = require("fs");
57849
59551
  var APP_BUILDER_PERSONAS = ["persona-app-builder", "persona-dataclaw-builder"];
57850
59552
  var DEV_SERVER_READY_TIMEOUT_MS = 3e4;
@@ -57995,8 +59697,8 @@ function buildAppBuilderHandlers(deps) {
57995
59697
  const project = await userStore.create(f.name, reservedPorts);
57996
59698
  try {
57997
59699
  const personaRoot = deps.resolvePersonaRoot ? deps.resolvePersonaRoot(session.ownerPersonaId ?? "") : deps.personaRoot;
57998
- const templateSrcDir = (0, import_node_path56.join)(personaRoot, "extension-kit", "examples", DEFAULT_TEMPLATE);
57999
- const scaffoldScript = (0, import_node_path56.join)(deps.deployKitRoot, "scripts", "new-extension.sh");
59700
+ const templateSrcDir = (0, import_node_path57.join)(personaRoot, "extension-kit", "examples", DEFAULT_TEMPLATE);
59701
+ const scaffoldScript = (0, import_node_path57.join)(deps.deployKitRoot, "scripts", "new-extension.sh");
58000
59702
  const scaffoldResult = await userStore.scaffold(project.name, templateSrcDir, scaffoldScript);
58001
59703
  deps.logger?.info("app-builder.scaffold.done", {
58002
59704
  name: project.name,
@@ -58200,7 +59902,7 @@ function buildAppBuilderHandlers(deps) {
58200
59902
  await userStore.clearPublishJob(args.name);
58201
59903
  }
58202
59904
  const personaRoot = deps.resolvePersonaRoot ? deps.resolvePersonaRoot(boundSession.ownerPersonaId ?? "") : deps.personaRoot;
58203
- const scriptPath = (0, import_node_path56.join)(deps.deployKitRoot, "scripts", "publish.sh");
59905
+ const scriptPath = (0, import_node_path57.join)(deps.deployKitRoot, "scripts", "publish.sh");
58204
59906
  deps.logger?.info("app-builder.publish.start", {
58205
59907
  name: args.name,
58206
59908
  sessionId: boundSession.sessionId,
@@ -58376,7 +60078,7 @@ function buildVisitorHandlers(deps) {
58376
60078
 
58377
60079
  // src/extension/registry.ts
58378
60080
  var import_promises10 = __toESM(require("fs/promises"), 1);
58379
- var import_node_path57 = __toESM(require("path"), 1);
60081
+ var import_node_path58 = __toESM(require("path"), 1);
58380
60082
  async function loadAll(root) {
58381
60083
  let entries;
58382
60084
  try {
@@ -58389,13 +60091,13 @@ async function loadAll(root) {
58389
60091
  for (const ent of entries) {
58390
60092
  if (!ent.isDirectory()) continue;
58391
60093
  if (ent.name.startsWith(".")) continue;
58392
- records.push(await loadOne(import_node_path57.default.join(root, ent.name), ent.name));
60094
+ records.push(await loadOne(import_node_path58.default.join(root, ent.name), ent.name));
58393
60095
  }
58394
60096
  records.sort((a, b2) => a.extId < b2.extId ? -1 : a.extId > b2.extId ? 1 : 0);
58395
60097
  return records;
58396
60098
  }
58397
60099
  async function loadOne(dir, dirName) {
58398
- const manifestPath = import_node_path57.default.join(dir, "manifest.json");
60100
+ const manifestPath = import_node_path58.default.join(dir, "manifest.json");
58399
60101
  let raw;
58400
60102
  try {
58401
60103
  raw = await import_promises10.default.readFile(manifestPath, "utf8");
@@ -58440,7 +60142,7 @@ async function loadOne(dir, dirName) {
58440
60142
 
58441
60143
  // src/extension/uninstall.ts
58442
60144
  var import_promises11 = __toESM(require("fs/promises"), 1);
58443
- var import_node_path58 = __toESM(require("path"), 1);
60145
+ var import_node_path59 = __toESM(require("path"), 1);
58444
60146
  var UninstallError = class extends Error {
58445
60147
  constructor(code, message) {
58446
60148
  super(message);
@@ -58449,7 +60151,7 @@ var UninstallError = class extends Error {
58449
60151
  code;
58450
60152
  };
58451
60153
  async function uninstall(deps) {
58452
- const dir = import_node_path58.default.join(deps.root, deps.extId);
60154
+ const dir = import_node_path59.default.join(deps.root, deps.extId);
58453
60155
  try {
58454
60156
  await import_promises11.default.access(dir);
58455
60157
  } catch {
@@ -58979,7 +60681,7 @@ async function dispatchRpc(method, frame, client, ctx, deps) {
58979
60681
 
58980
60682
  // src/extension/runtime.ts
58981
60683
  var import_node_child_process17 = require("child_process");
58982
- var import_node_path59 = __toESM(require("path"), 1);
60684
+ var import_node_path60 = __toESM(require("path"), 1);
58983
60685
  var import_promises12 = require("timers/promises");
58984
60686
 
58985
60687
  // src/extension/port-allocator.ts
@@ -59080,7 +60782,7 @@ var Runtime = class {
59080
60782
  /\$CLAWOS_EXT_PORT/g,
59081
60783
  String(port)
59082
60784
  );
59083
- const dir = import_node_path59.default.join(this.root, extId);
60785
+ const dir = import_node_path60.default.join(this.root, extId);
59084
60786
  const env = {
59085
60787
  ...process.env,
59086
60788
  CLAWOS_EXT_PORT: String(port),
@@ -59192,7 +60894,7 @@ ${handle.stderrTail}`
59192
60894
 
59193
60895
  // src/extension/published-channels.ts
59194
60896
  var import_promises13 = __toESM(require("fs/promises"), 1);
59195
- var import_node_path60 = __toESM(require("path"), 1);
60897
+ var import_node_path61 = __toESM(require("path"), 1);
59196
60898
  init_zod();
59197
60899
  var PublishedChannelsError = class extends Error {
59198
60900
  constructor(code, message) {
@@ -59291,7 +60993,7 @@ var PublishedChannelStore = class {
59291
60993
  )
59292
60994
  };
59293
60995
  const tmp = `${this.filePath}.tmp`;
59294
- await import_promises13.default.mkdir(import_node_path60.default.dirname(this.filePath), { recursive: true });
60996
+ await import_promises13.default.mkdir(import_node_path61.default.dirname(this.filePath), { recursive: true });
59295
60997
  await import_promises13.default.writeFile(tmp, JSON.stringify(data, null, 2), { mode: 384 });
59296
60998
  await import_promises13.default.rename(tmp, this.filePath);
59297
60999
  }
@@ -59299,7 +61001,7 @@ var PublishedChannelStore = class {
59299
61001
 
59300
61002
  // src/extension/bundle-cache.ts
59301
61003
  var import_promises14 = __toESM(require("fs/promises"), 1);
59302
- var import_node_path61 = __toESM(require("path"), 1);
61004
+ var import_node_path62 = __toESM(require("path"), 1);
59303
61005
  var BundleCache = class {
59304
61006
  constructor(rootDir) {
59305
61007
  this.rootDir = rootDir;
@@ -59308,14 +61010,14 @@ var BundleCache = class {
59308
61010
  /** Atomic write: stage tmp → rename. Caller passes the hex sha256. */
59309
61011
  async write(snapshotHash, buffer) {
59310
61012
  await import_promises14.default.mkdir(this.rootDir, { recursive: true });
59311
- const file = import_node_path61.default.join(this.rootDir, `${snapshotHash}.zip`);
61013
+ const file = import_node_path62.default.join(this.rootDir, `${snapshotHash}.zip`);
59312
61014
  const tmp = `${file}.tmp`;
59313
61015
  await import_promises14.default.writeFile(tmp, buffer, { mode: 384 });
59314
61016
  await import_promises14.default.rename(tmp, file);
59315
61017
  }
59316
61018
  /** Returns the bundle bytes, or null when the file doesn't exist. */
59317
61019
  async read(snapshotHash) {
59318
- const file = import_node_path61.default.join(this.rootDir, `${snapshotHash}.zip`);
61020
+ const file = import_node_path62.default.join(this.rootDir, `${snapshotHash}.zip`);
59319
61021
  try {
59320
61022
  return await import_promises14.default.readFile(file);
59321
61023
  } catch (e) {
@@ -59325,7 +61027,7 @@ var BundleCache = class {
59325
61027
  }
59326
61028
  /** Idempotent — missing file is not an error. */
59327
61029
  async delete(snapshotHash) {
59328
- const file = import_node_path61.default.join(this.rootDir, `${snapshotHash}.zip`);
61030
+ const file = import_node_path62.default.join(this.rootDir, `${snapshotHash}.zip`);
59329
61031
  await import_promises14.default.rm(file, { force: true });
59330
61032
  }
59331
61033
  };
@@ -59348,24 +61050,24 @@ async function startDaemon(config) {
59348
61050
  sampling: logShippingCfg.sampling,
59349
61051
  homeDir: import_node_os22.default.homedir()
59350
61052
  });
59351
- const logDir = import_node_path62.default.join(config.dataDir, "log");
61053
+ const logDir = import_node_path63.default.join(config.dataDir, "log");
59352
61054
  import_node_fs47.default.mkdirSync(logDir, { recursive: true });
59353
61055
  const logger = createLogger({
59354
61056
  level: config.logLevel,
59355
- file: import_node_path62.default.join(logDir, "clawd.log"),
61057
+ file: import_node_path63.default.join(logDir, "clawd.log"),
59356
61058
  logClient
59357
61059
  });
59358
61060
  logger.info("starting clawd", { version, config: { port: config.port, host: config.host, dataDir: config.dataDir } });
59359
61061
  const screenIdleProbeLogger = createFileOnlyLogger({
59360
- file: import_node_path62.default.join(logDir, "screen-idle-probe.log"),
61062
+ file: import_node_path63.default.join(logDir, "screen-idle-probe.log"),
59361
61063
  level: "debug"
59362
61064
  });
59363
61065
  logger.info("screen-idle probe logger enabled", {
59364
- file: import_node_path62.default.join(logDir, "screen-idle-probe.log")
61066
+ file: import_node_path63.default.join(logDir, "screen-idle-probe.log")
59365
61067
  });
59366
61068
  const CAP_TARGETS = [
59367
- import_node_path62.default.join(logDir, "clawd.log"),
59368
- import_node_path62.default.join(logDir, "screen-idle-probe.log")
61069
+ import_node_path63.default.join(logDir, "clawd.log"),
61070
+ import_node_path63.default.join(logDir, "screen-idle-probe.log")
59369
61071
  ];
59370
61072
  const LOG_CAP_MAX_BYTES = 10 * 1024 * 1024;
59371
61073
  const LOG_CAP_KEEP_BYTES = 5 * 1024 * 1024;
@@ -59461,8 +61163,8 @@ async function startDaemon(config) {
59461
61163
  const agents = new AgentsScanner();
59462
61164
  const history = new ClaudeHistoryReader();
59463
61165
  let transport = null;
59464
- const personaStore = new PersonaStore(import_node_path62.default.join(config.dataDir, "personas"));
59465
- const usersRoot = import_node_path62.default.join(config.dataDir, "users");
61166
+ const personaStore = new PersonaStore(import_node_path63.default.join(config.dataDir, "personas"));
61167
+ const usersRoot = import_node_path63.default.join(config.dataDir, "users");
59466
61168
  const defaultsRoot = findDefaultsRoot(logger);
59467
61169
  if (defaultsRoot) {
59468
61170
  seedDefaultPersonas({ store: personaStore, defaultsRoot, logger });
@@ -59482,7 +61184,7 @@ async function startDaemon(config) {
59482
61184
  migrateCodexSandbox({ store: personaStore, logger });
59483
61185
  const groupFileStore = new GroupFileStore({ dataDir: config.dataDir, logger });
59484
61186
  const dispatchStore = createDispatchStore({
59485
- filePath: import_node_path62.default.join(config.dataDir, "dispatch.json"),
61187
+ filePath: import_node_path63.default.join(config.dataDir, "dispatch.json"),
59486
61188
  now: () => Date.now(),
59487
61189
  onFlushError: (err) => logger.error("dispatch store flush failed", {
59488
61190
  reason: err instanceof Error ? err.message : String(err)
@@ -59497,18 +61199,18 @@ async function startDaemon(config) {
59497
61199
  now: () => Date.now(),
59498
61200
  onCompleted: (sid) => deliverPendingRef?.(sid)
59499
61201
  });
59500
- const here = typeof __dirname === "string" ? __dirname : import_node_path62.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
61202
+ const here = typeof __dirname === "string" ? __dirname : import_node_path63.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
59501
61203
  const mcpConfigs = [];
59502
61204
  const mcpDaemonUrl = `http://127.0.0.1:${config.port}`;
59503
61205
  const dispatchServerCandidates = [
59504
- import_node_path62.default.join(here, "dispatch", "mcp-server.cjs"),
61206
+ import_node_path63.default.join(here, "dispatch", "mcp-server.cjs"),
59505
61207
  // 生产 dist/index → dist/dispatch/mcp-server.cjs
59506
- import_node_path62.default.join(here, "..", "dist", "dispatch", "mcp-server.cjs")
61208
+ import_node_path63.default.join(here, "..", "dist", "dispatch", "mcp-server.cjs")
59507
61209
  // dev tsx src/index → ../dist/dispatch/mcp-server.cjs
59508
61210
  ];
59509
61211
  const dispatchServerScriptPath = dispatchServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59510
61212
  if (dispatchServerScriptPath) {
59511
- const dispatchLogPath = import_node_path62.default.join(logDir, "dispatch-mcp-server.log");
61213
+ const dispatchLogPath = import_node_path63.default.join(logDir, "dispatch-mcp-server.log");
59512
61214
  const dispatchCfgPath = writeDispatchMcpConfig({
59513
61215
  dataDir: config.dataDir,
59514
61216
  serverScriptPath: dispatchServerScriptPath,
@@ -59528,12 +61230,12 @@ async function startDaemon(config) {
59528
61230
  });
59529
61231
  }
59530
61232
  const ticketServerCandidates = [
59531
- import_node_path62.default.join(here, "ticket", "mcp-server.cjs"),
59532
- import_node_path62.default.join(here, "..", "dist", "ticket", "mcp-server.cjs")
61233
+ import_node_path63.default.join(here, "ticket", "mcp-server.cjs"),
61234
+ import_node_path63.default.join(here, "..", "dist", "ticket", "mcp-server.cjs")
59533
61235
  ];
59534
61236
  const ticketServerScriptPath = ticketServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59535
61237
  if (ticketServerScriptPath) {
59536
- const ticketLogPath = import_node_path62.default.join(logDir, "ticket-mcp-server.log");
61238
+ const ticketLogPath = import_node_path63.default.join(logDir, "ticket-mcp-server.log");
59537
61239
  const ticketCfgPath = writeTicketMcpConfig({
59538
61240
  dataDir: config.dataDir,
59539
61241
  serverScriptPath: ticketServerScriptPath,
@@ -59555,12 +61257,12 @@ async function startDaemon(config) {
59555
61257
  });
59556
61258
  }
59557
61259
  const shiftServerCandidates = [
59558
- import_node_path62.default.join(here, "shift", "mcp-server.cjs"),
59559
- import_node_path62.default.join(here, "..", "dist", "shift", "mcp-server.cjs")
61260
+ import_node_path63.default.join(here, "shift", "mcp-server.cjs"),
61261
+ import_node_path63.default.join(here, "..", "dist", "shift", "mcp-server.cjs")
59560
61262
  ];
59561
61263
  const shiftServerScriptPath = shiftServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59562
61264
  if (shiftServerScriptPath) {
59563
- const shiftLogPath = import_node_path62.default.join(logDir, "shift-mcp-server.log");
61265
+ const shiftLogPath = import_node_path63.default.join(logDir, "shift-mcp-server.log");
59564
61266
  const shiftCfgPath = await writeShiftMcpConfig({
59565
61267
  dataDir: config.dataDir,
59566
61268
  serverScriptPath: shiftServerScriptPath,
@@ -59581,12 +61283,12 @@ async function startDaemon(config) {
59581
61283
  );
59582
61284
  }
59583
61285
  const inboxServerCandidates = [
59584
- import_node_path62.default.join(here, "inbox", "mcp-server.cjs"),
59585
- import_node_path62.default.join(here, "..", "dist", "inbox", "mcp-server.cjs")
61286
+ import_node_path63.default.join(here, "inbox", "mcp-server.cjs"),
61287
+ import_node_path63.default.join(here, "..", "dist", "inbox", "mcp-server.cjs")
59586
61288
  ];
59587
61289
  const inboxServerScriptPath = inboxServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59588
61290
  if (inboxServerScriptPath) {
59589
- const inboxLogPath = import_node_path62.default.join(logDir, "inbox-mcp-server.log");
61291
+ const inboxLogPath = import_node_path63.default.join(logDir, "inbox-mcp-server.log");
59590
61292
  const inboxCfgPath = await writeInboxMcpConfig({
59591
61293
  dataDir: config.dataDir,
59592
61294
  serverScriptPath: inboxServerScriptPath,
@@ -59607,8 +61309,8 @@ async function startDaemon(config) {
59607
61309
  );
59608
61310
  }
59609
61311
  const peerOpsServerCandidates = [
59610
- import_node_path62.default.join(here, "peer-ops", "mcp-server.cjs"),
59611
- import_node_path62.default.join(here, "..", "dist", "peer-ops", "mcp-server.cjs")
61312
+ import_node_path63.default.join(here, "peer-ops", "mcp-server.cjs"),
61313
+ import_node_path63.default.join(here, "..", "dist", "peer-ops", "mcp-server.cjs")
59612
61314
  ];
59613
61315
  const peerOpsServerScriptPath = peerOpsServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59614
61316
  if (peerOpsServerScriptPath) {
@@ -59630,12 +61332,12 @@ async function startDaemon(config) {
59630
61332
  );
59631
61333
  }
59632
61334
  const rpcToolServerCandidates = [
59633
- import_node_path62.default.join(here, "rpc-tool", "mcp-server.cjs"),
59634
- import_node_path62.default.join(here, "..", "dist", "rpc-tool", "mcp-server.cjs")
61335
+ import_node_path63.default.join(here, "rpc-tool", "mcp-server.cjs"),
61336
+ import_node_path63.default.join(here, "..", "dist", "rpc-tool", "mcp-server.cjs")
59635
61337
  ];
59636
61338
  const rpcToolServerScriptPath = rpcToolServerCandidates.find((p2) => import_node_fs47.default.existsSync(p2));
59637
61339
  if (rpcToolServerScriptPath) {
59638
- const rpcToolLogPath = import_node_path62.default.join(logDir, "rpc-tool-mcp-server.log");
61340
+ const rpcToolLogPath = import_node_path63.default.join(logDir, "rpc-tool-mcp-server.log");
59639
61341
  const rpcToolCfgPath = writeRpcToolMcpConfig({
59640
61342
  dataDir: config.dataDir,
59641
61343
  serverScriptPath: rpcToolServerScriptPath,
@@ -59656,7 +61358,7 @@ async function startDaemon(config) {
59656
61358
  );
59657
61359
  }
59658
61360
  const shiftStore = createShiftStore({
59659
- filePath: import_node_path62.default.join(config.dataDir, "shift.json"),
61361
+ filePath: import_node_path63.default.join(config.dataDir, "shift.json"),
59660
61362
  ownerIdProvider: () => ownerPrincipalId,
59661
61363
  now: () => Date.now()
59662
61364
  });
@@ -59678,7 +61380,7 @@ async function startDaemon(config) {
59678
61380
  getAdapter,
59679
61381
  historyReader: history,
59680
61382
  dataDir: config.dataDir,
59681
- personaRoot: import_node_path62.default.join(config.dataDir, "personas"),
61383
+ personaRoot: import_node_path63.default.join(config.dataDir, "personas"),
59682
61384
  // dispatch / shift 自动化 spawn 按 persona 绑定 tool 起 B session(codex persona 用 codex)。
59683
61385
  // personaRegistry 声明在 manager 之后(同作用域 const,调用时机在启动完成后,无 TDZ 风险)。
59684
61386
  getPersonaTool: (personaId2) => personaRegistry.get(personaId2)?.tool,
@@ -59729,7 +61431,7 @@ async function startDaemon(config) {
59729
61431
  // 文件可能 agent 写完又被自己删(罕见),用 size=0 / fallback mime 兜底。
59730
61432
  attachmentGroup: {
59731
61433
  onFileEdit: (input) => {
59732
- const absPath = import_node_path62.default.isAbsolute(input.relPath) ? input.relPath : import_node_path62.default.join(input.cwd, input.relPath);
61434
+ const absPath = import_node_path63.default.isAbsolute(input.relPath) ? input.relPath : import_node_path63.default.join(input.cwd, input.relPath);
59733
61435
  let size = 0;
59734
61436
  try {
59735
61437
  size = import_node_fs47.default.statSync(absPath).size;
@@ -59973,11 +61675,11 @@ async function startDaemon(config) {
59973
61675
  // 'persona/<pid>/owner',default 走 'default'。
59974
61676
  getSessionScope: (sid) => manager.findOwnedSessionScope(sid),
59975
61677
  // guest path guard:candidate 必须在 personaRoot 子树或调用者自己的 user-dir 下
59976
- personaRoot: import_node_path62.default.join(config.dataDir, "personas"),
61678
+ personaRoot: import_node_path63.default.join(config.dataDir, "personas"),
59977
61679
  usersRoot
59978
61680
  },
59979
61681
  // workspace/git/history/skills/agents handler 共用的 guest path guard 锚点
59980
- personaRoot: import_node_path62.default.join(config.dataDir, "personas"),
61682
+ personaRoot: import_node_path63.default.join(config.dataDir, "personas"),
59981
61683
  // v2 多人 persona 隔离:handler 派生 guest user-dir 放行
59982
61684
  usersRoot,
59983
61685
  // v2 Phase 6: whoami handler 装在 owner principal.displayName + persona 解析
@@ -60078,7 +61780,9 @@ async function startDaemon(config) {
60078
61780
  // 自动反向(spec 决策 #11):本机可达地址 = tunnel URL(公网),出站连接时
60079
61781
  // 透传让对方反向加我为联系人。无 tunnel(仅本机 ws)→ null,对方不自动反向(不造假数据)。
60080
61782
  // 决策 #16:身份不自报——本机 deviceId/ownerId/provider 由 exchange 签进 token 背书。
60081
- selfUrl: () => currentTunnelUrl
61783
+ selfUrl: () => currentTunnelUrl,
61784
+ // device:connections 数据源。惰性闭包:wsServer 晚于本 deps 赋值,请求时才解引用。
61785
+ listOwnerConnections: () => wsServer?.listOwnerConnections() ?? []
60082
61786
  },
60083
61787
  // app-builder
60084
61788
  appBuilderStore,
@@ -60101,11 +61805,11 @@ async function startDaemon(config) {
60101
61805
  // 发布上线脚手架化 (spec 2026-06-03 §5.2):
60102
61806
  // appBuilderPersonaRoot 用于拼 publish.sh 绝对路径(persona-app-builder 安装在
60103
61807
  // dataDir/personas/persona-app-builder 之下,extension-kit/scripts/publish.sh 是相对路径)。
60104
- appBuilderPersonaRoot: import_node_path62.default.join(config.dataDir, "personas", "persona-app-builder"),
61808
+ appBuilderPersonaRoot: import_node_path63.default.join(config.dataDir, "personas", "persona-app-builder"),
60105
61809
  // 共享 deploy-kit 根:scaffold/publish 脚本骨架 + 阿里云凭证单一真源。
60106
- deployKitRoot: import_node_path62.default.join(config.dataDir, "deploy-kit"),
61810
+ deployKitRoot: import_node_path63.default.join(config.dataDir, "deploy-kit"),
60107
61811
  // scaffold/publish 按当前 session 的 persona 解析其安装根,让每个 persona 用自己的模板/注入配置。
60108
- resolvePersonaRoot: (personaId2) => import_node_path62.default.join(config.dataDir, "personas", personaId2),
61812
+ resolvePersonaRoot: (personaId2) => import_node_path63.default.join(config.dataDir, "personas", personaId2),
60109
61813
  // 发布上线脚手架化 (spec 2026-06-03 §5.2.2):
60110
61814
  // 复用 SessionManagerDeps.broadcastFrame 同款 dispatch 逻辑 —— runner 调 manager.send
60111
61815
  // 取回 broadcast 帧后逐帧 push 到 transport,跟 manager 自身的 deps 一致。
@@ -60146,19 +61850,7 @@ async function startDaemon(config) {
60146
61850
  sourceSessionId: args.sourceSessionId
60147
61851
  });
60148
61852
  const sourceFile = manager.findOwnedSession(args.sourceSessionId);
60149
- if (!sourceFile && !args.guestPrincipalId) {
60150
- throw new Error(`personaDispatch:run source session not found: ${args.sourceSessionId}`);
60151
- }
60152
- let sourceJsonlPath = "(no transcript yet \u2014 operate from the task description alone)";
60153
- if (sourceFile && sourceFile.toolSessionId) {
60154
- sourceJsonlPath = import_node_path62.default.join(
60155
- import_node_os22.default.homedir(),
60156
- ".claude",
60157
- "projects",
60158
- cwdToHashDir(sourceFile.cwd),
60159
- `${sourceFile.toolSessionId}.jsonl`
60160
- );
60161
- }
61853
+ const sourceJsonlPath = resolveSourceJsonlPath(sourceFile, import_node_os22.default.homedir());
60162
61854
  logger.info("dispatch.spawnB.source-resolved", {
60163
61855
  dispatchId: args.dispatchId,
60164
61856
  sourceJsonlPath,
@@ -60452,8 +62144,8 @@ async function startDaemon(config) {
60452
62144
  const lines = [
60453
62145
  `Tunnel: ${r.url}`,
60454
62146
  ...resolvedAuthToken ? [`Connect: ${connectUrl}`] : [],
60455
- `Frpc config: ${import_node_path62.default.join(config.dataDir, "frpc.toml")}`,
60456
- `Frpc log: ${import_node_path62.default.join(logDir, "frpc.log")}`
62147
+ `Frpc config: ${import_node_path63.default.join(config.dataDir, "frpc.toml")}`,
62148
+ `Frpc log: ${import_node_path63.default.join(logDir, "frpc.log")}`
60457
62149
  ];
60458
62150
  const width = Math.max(...lines.map((l) => l.length));
60459
62151
  const bar = "\u2550".repeat(width + 4);
@@ -60466,7 +62158,7 @@ ${bar}
60466
62158
 
60467
62159
  `);
60468
62160
  try {
60469
- const connectPath = import_node_path62.default.join(config.dataDir, "connect.txt");
62161
+ const connectPath = import_node_path63.default.join(config.dataDir, "connect.txt");
60470
62162
  import_node_fs47.default.writeFileSync(connectPath, lines.join("\n") + "\n", { mode: 384 });
60471
62163
  } catch {
60472
62164
  }
@@ -60539,7 +62231,7 @@ ${bar}
60539
62231
  };
60540
62232
  }
60541
62233
  function migrateDropPersonsDir(dataDir) {
60542
- const dir = import_node_path62.default.join(dataDir, "persons");
62234
+ const dir = import_node_path63.default.join(dataDir, "persons");
60543
62235
  try {
60544
62236
  import_node_fs47.default.rmSync(dir, { recursive: true, force: true });
60545
62237
  } catch {