claude-session-skill 1.1.7 → 1.1.8

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.
@@ -6499,6 +6499,9 @@ var require_dist = __commonJS((exports, module) => {
6499
6499
  exports.default = formatsPlugin;
6500
6500
  });
6501
6501
 
6502
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
6503
+ import process3 from "node:process";
6504
+
6502
6505
  // node_modules/zod/v4/core/core.js
6503
6506
  var NEVER = Object.freeze({
6504
6507
  status: "aborted"
@@ -10570,68 +10573,6 @@ var optionalProcessor = (schema, ctx, _json, params) => {
10570
10573
  const seen = ctx.seen.get(schema);
10571
10574
  seen.ref = def.innerType;
10572
10575
  };
10573
- // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
10574
- function isZ4Schema(s) {
10575
- const schema = s;
10576
- return !!schema._zod;
10577
- }
10578
- function safeParse2(schema, data) {
10579
- if (isZ4Schema(schema)) {
10580
- const result2 = safeParse(schema, data);
10581
- return result2;
10582
- }
10583
- const v3Schema = schema;
10584
- const result = v3Schema.safeParse(data);
10585
- return result;
10586
- }
10587
- function getObjectShape(schema) {
10588
- if (!schema)
10589
- return;
10590
- let rawShape;
10591
- if (isZ4Schema(schema)) {
10592
- const v4Schema = schema;
10593
- rawShape = v4Schema._zod?.def?.shape;
10594
- } else {
10595
- const v3Schema = schema;
10596
- rawShape = v3Schema.shape;
10597
- }
10598
- if (!rawShape)
10599
- return;
10600
- if (typeof rawShape === "function") {
10601
- try {
10602
- return rawShape();
10603
- } catch {
10604
- return;
10605
- }
10606
- }
10607
- return rawShape;
10608
- }
10609
- function getLiteralValue(schema) {
10610
- if (isZ4Schema(schema)) {
10611
- const v4Schema = schema;
10612
- const def2 = v4Schema._zod?.def;
10613
- if (def2) {
10614
- if (def2.value !== undefined)
10615
- return def2.value;
10616
- if (Array.isArray(def2.values) && def2.values.length > 0) {
10617
- return def2.values[0];
10618
- }
10619
- }
10620
- }
10621
- const v3Schema = schema;
10622
- const def = v3Schema._def;
10623
- if (def) {
10624
- if (def.value !== undefined)
10625
- return def.value;
10626
- if (Array.isArray(def.values) && def.values.length > 0) {
10627
- return def.values[0];
10628
- }
10629
- }
10630
- const directValue = schema.value;
10631
- if (directValue !== undefined)
10632
- return directValue;
10633
- return;
10634
- }
10635
10576
  // node_modules/zod/v4/classic/iso.js
10636
10577
  var exports_iso = {};
10637
10578
  __export(exports_iso, {
@@ -10711,16 +10652,16 @@ var ZodRealError = $constructor("ZodError", initializer2, {
10711
10652
  // node_modules/zod/v4/classic/parse.js
10712
10653
  var parse3 = /* @__PURE__ */ _parse(ZodRealError);
10713
10654
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
10714
- var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
10655
+ var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
10715
10656
  var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
10716
- var encode2 = /* @__PURE__ */ _encode(ZodRealError);
10717
- var decode2 = /* @__PURE__ */ _decode(ZodRealError);
10718
- var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
10719
- var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
10720
- var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
10721
- var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
10722
- var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
10723
- var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
10657
+ var encode = /* @__PURE__ */ _encode(ZodRealError);
10658
+ var decode = /* @__PURE__ */ _decode(ZodRealError);
10659
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
10660
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
10661
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
10662
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
10663
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
10664
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
10724
10665
 
10725
10666
  // node_modules/zod/v4/classic/schemas.js
10726
10667
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
@@ -10753,18 +10694,18 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
10753
10694
  return inst;
10754
10695
  };
10755
10696
  inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
10756
- inst.safeParse = (data, params) => safeParse3(inst, data, params);
10697
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
10757
10698
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
10758
10699
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
10759
10700
  inst.spa = inst.safeParseAsync;
10760
- inst.encode = (data, params) => encode2(inst, data, params);
10761
- inst.decode = (data, params) => decode2(inst, data, params);
10762
- inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
10763
- inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
10764
- inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
10765
- inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
10766
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
10767
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
10701
+ inst.encode = (data, params) => encode(inst, data, params);
10702
+ inst.decode = (data, params) => decode(inst, data, params);
10703
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
10704
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
10705
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
10706
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
10707
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
10708
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
10768
10709
  inst.refine = (check, params) => inst.check(refine(check, params));
10769
10710
  inst.superRefine = (refinement) => inst.check(superRefine(refinement));
10770
10711
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
@@ -11051,7 +10992,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
11051
10992
  inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
11052
10993
  inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
11053
10994
  });
11054
- function object2(shape, params) {
10995
+ function object(shape, params) {
11055
10996
  const def = {
11056
10997
  type: "object",
11057
10998
  shape: shape ?? {},
@@ -11376,31 +11317,31 @@ var TaskCreationParamsSchema = looseObject({
11376
11317
  ttl: union([number2(), _null3()]).optional(),
11377
11318
  pollInterval: number2().optional()
11378
11319
  });
11379
- var TaskMetadataSchema = object2({
11320
+ var TaskMetadataSchema = object({
11380
11321
  ttl: number2().optional()
11381
11322
  });
11382
- var RelatedTaskMetadataSchema = object2({
11323
+ var RelatedTaskMetadataSchema = object({
11383
11324
  taskId: string2()
11384
11325
  });
11385
11326
  var RequestMetaSchema = looseObject({
11386
11327
  progressToken: ProgressTokenSchema.optional(),
11387
11328
  [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
11388
11329
  });
11389
- var BaseRequestParamsSchema = object2({
11330
+ var BaseRequestParamsSchema = object({
11390
11331
  _meta: RequestMetaSchema.optional()
11391
11332
  });
11392
11333
  var TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
11393
11334
  task: TaskMetadataSchema.optional()
11394
11335
  });
11395
11336
  var isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success;
11396
- var RequestSchema = object2({
11337
+ var RequestSchema = object({
11397
11338
  method: string2(),
11398
11339
  params: BaseRequestParamsSchema.loose().optional()
11399
11340
  });
11400
- var NotificationsParamsSchema = object2({
11341
+ var NotificationsParamsSchema = object({
11401
11342
  _meta: RequestMetaSchema.optional()
11402
11343
  });
11403
- var NotificationSchema = object2({
11344
+ var NotificationSchema = object({
11404
11345
  method: string2(),
11405
11346
  params: NotificationsParamsSchema.loose().optional()
11406
11347
  });
@@ -11408,18 +11349,18 @@ var ResultSchema = looseObject({
11408
11349
  _meta: RequestMetaSchema.optional()
11409
11350
  });
11410
11351
  var RequestIdSchema = union([string2(), number2().int()]);
11411
- var JSONRPCRequestSchema = object2({
11352
+ var JSONRPCRequestSchema = object({
11412
11353
  jsonrpc: literal(JSONRPC_VERSION),
11413
11354
  id: RequestIdSchema,
11414
11355
  ...RequestSchema.shape
11415
11356
  }).strict();
11416
11357
  var isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;
11417
- var JSONRPCNotificationSchema = object2({
11358
+ var JSONRPCNotificationSchema = object({
11418
11359
  jsonrpc: literal(JSONRPC_VERSION),
11419
11360
  ...NotificationSchema.shape
11420
11361
  }).strict();
11421
11362
  var isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
11422
- var JSONRPCResultResponseSchema = object2({
11363
+ var JSONRPCResultResponseSchema = object({
11423
11364
  jsonrpc: literal(JSONRPC_VERSION),
11424
11365
  id: RequestIdSchema,
11425
11366
  result: ResultSchema
@@ -11436,10 +11377,10 @@ var ErrorCode;
11436
11377
  ErrorCode2[ErrorCode2["InternalError"] = -32603] = "InternalError";
11437
11378
  ErrorCode2[ErrorCode2["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
11438
11379
  })(ErrorCode || (ErrorCode = {}));
11439
- var JSONRPCErrorResponseSchema = object2({
11380
+ var JSONRPCErrorResponseSchema = object({
11440
11381
  jsonrpc: literal(JSONRPC_VERSION),
11441
11382
  id: RequestIdSchema.optional(),
11442
- error: object2({
11383
+ error: object({
11443
11384
  code: number2().int(),
11444
11385
  message: string2(),
11445
11386
  data: unknown().optional()
@@ -11462,16 +11403,16 @@ var CancelledNotificationSchema = NotificationSchema.extend({
11462
11403
  method: literal("notifications/cancelled"),
11463
11404
  params: CancelledNotificationParamsSchema
11464
11405
  });
11465
- var IconSchema = object2({
11406
+ var IconSchema = object({
11466
11407
  src: string2(),
11467
11408
  mimeType: string2().optional(),
11468
11409
  sizes: array(string2()).optional(),
11469
11410
  theme: _enum(["light", "dark"]).optional()
11470
11411
  });
11471
- var IconsSchema = object2({
11412
+ var IconsSchema = object({
11472
11413
  icons: array(IconSchema).optional()
11473
11414
  });
11474
- var BaseMetadataSchema = object2({
11415
+ var BaseMetadataSchema = object({
11475
11416
  name: string2(),
11476
11417
  title: string2().optional()
11477
11418
  });
@@ -11482,7 +11423,7 @@ var ImplementationSchema = BaseMetadataSchema.extend({
11482
11423
  websiteUrl: string2().optional(),
11483
11424
  description: string2().optional()
11484
11425
  });
11485
- var FormElicitationCapabilitySchema = intersection(object2({
11426
+ var FormElicitationCapabilitySchema = intersection(object({
11486
11427
  applyDefaults: boolean2().optional()
11487
11428
  }), record(string2(), unknown()));
11488
11429
  var ElicitationCapabilitySchema = preprocess((value) => {
@@ -11492,7 +11433,7 @@ var ElicitationCapabilitySchema = preprocess((value) => {
11492
11433
  }
11493
11434
  }
11494
11435
  return value;
11495
- }, intersection(object2({
11436
+ }, intersection(object({
11496
11437
  form: FormElicitationCapabilitySchema.optional(),
11497
11438
  url: AssertObjectSchema.optional()
11498
11439
  }), record(string2(), unknown()).optional()));
@@ -11517,14 +11458,14 @@ var ServerTasksCapabilitySchema = looseObject({
11517
11458
  }).optional()
11518
11459
  }).optional()
11519
11460
  });
11520
- var ClientCapabilitiesSchema = object2({
11461
+ var ClientCapabilitiesSchema = object({
11521
11462
  experimental: record(string2(), AssertObjectSchema).optional(),
11522
- sampling: object2({
11463
+ sampling: object({
11523
11464
  context: AssertObjectSchema.optional(),
11524
11465
  tools: AssertObjectSchema.optional()
11525
11466
  }).optional(),
11526
11467
  elicitation: ElicitationCapabilitySchema.optional(),
11527
- roots: object2({
11468
+ roots: object({
11528
11469
  listChanged: boolean2().optional()
11529
11470
  }).optional(),
11530
11471
  tasks: ClientTasksCapabilitySchema.optional()
@@ -11538,18 +11479,18 @@ var InitializeRequestSchema = RequestSchema.extend({
11538
11479
  method: literal("initialize"),
11539
11480
  params: InitializeRequestParamsSchema
11540
11481
  });
11541
- var ServerCapabilitiesSchema = object2({
11482
+ var ServerCapabilitiesSchema = object({
11542
11483
  experimental: record(string2(), AssertObjectSchema).optional(),
11543
11484
  logging: AssertObjectSchema.optional(),
11544
11485
  completions: AssertObjectSchema.optional(),
11545
- prompts: object2({
11486
+ prompts: object({
11546
11487
  listChanged: boolean2().optional()
11547
11488
  }).optional(),
11548
- resources: object2({
11489
+ resources: object({
11549
11490
  subscribe: boolean2().optional(),
11550
11491
  listChanged: boolean2().optional()
11551
11492
  }).optional(),
11552
- tools: object2({
11493
+ tools: object({
11553
11494
  listChanged: boolean2().optional()
11554
11495
  }).optional(),
11555
11496
  tasks: ServerTasksCapabilitySchema.optional()
@@ -11568,12 +11509,12 @@ var PingRequestSchema = RequestSchema.extend({
11568
11509
  method: literal("ping"),
11569
11510
  params: BaseRequestParamsSchema.optional()
11570
11511
  });
11571
- var ProgressSchema = object2({
11512
+ var ProgressSchema = object({
11572
11513
  progress: number2(),
11573
11514
  total: optional(number2()),
11574
11515
  message: optional(string2())
11575
11516
  });
11576
- var ProgressNotificationParamsSchema = object2({
11517
+ var ProgressNotificationParamsSchema = object({
11577
11518
  ...NotificationsParamsSchema.shape,
11578
11519
  ...ProgressSchema.shape,
11579
11520
  progressToken: ProgressTokenSchema
@@ -11592,7 +11533,7 @@ var PaginatedResultSchema = ResultSchema.extend({
11592
11533
  nextCursor: CursorSchema.optional()
11593
11534
  });
11594
11535
  var TaskStatusSchema = _enum(["working", "input_required", "completed", "failed", "cancelled"]);
11595
- var TaskSchema = object2({
11536
+ var TaskSchema = object({
11596
11537
  taskId: string2(),
11597
11538
  status: TaskStatusSchema,
11598
11539
  ttl: union([number2(), _null3()]),
@@ -11636,7 +11577,7 @@ var CancelTaskRequestSchema = RequestSchema.extend({
11636
11577
  })
11637
11578
  });
11638
11579
  var CancelTaskResultSchema = ResultSchema.merge(TaskSchema);
11639
- var ResourceContentsSchema = object2({
11580
+ var ResourceContentsSchema = object({
11640
11581
  uri: string2(),
11641
11582
  mimeType: optional(string2()),
11642
11583
  _meta: record(string2(), unknown()).optional()
@@ -11656,12 +11597,12 @@ var BlobResourceContentsSchema = ResourceContentsSchema.extend({
11656
11597
  blob: Base64Schema
11657
11598
  });
11658
11599
  var RoleSchema = _enum(["user", "assistant"]);
11659
- var AnnotationsSchema = object2({
11600
+ var AnnotationsSchema = object({
11660
11601
  audience: array(RoleSchema).optional(),
11661
11602
  priority: number2().min(0).max(1).optional(),
11662
11603
  lastModified: exports_iso.datetime({ offset: true }).optional()
11663
11604
  });
11664
- var ResourceSchema = object2({
11605
+ var ResourceSchema = object({
11665
11606
  ...BaseMetadataSchema.shape,
11666
11607
  ...IconsSchema.shape,
11667
11608
  uri: string2(),
@@ -11670,7 +11611,7 @@ var ResourceSchema = object2({
11670
11611
  annotations: AnnotationsSchema.optional(),
11671
11612
  _meta: optional(looseObject({}))
11672
11613
  });
11673
- var ResourceTemplateSchema = object2({
11614
+ var ResourceTemplateSchema = object({
11674
11615
  ...BaseMetadataSchema.shape,
11675
11616
  ...IconsSchema.shape,
11676
11617
  uriTemplate: string2(),
@@ -11723,12 +11664,12 @@ var ResourceUpdatedNotificationSchema = NotificationSchema.extend({
11723
11664
  method: literal("notifications/resources/updated"),
11724
11665
  params: ResourceUpdatedNotificationParamsSchema
11725
11666
  });
11726
- var PromptArgumentSchema = object2({
11667
+ var PromptArgumentSchema = object({
11727
11668
  name: string2(),
11728
11669
  description: optional(string2()),
11729
11670
  required: optional(boolean2())
11730
11671
  });
11731
- var PromptSchema = object2({
11672
+ var PromptSchema = object({
11732
11673
  ...BaseMetadataSchema.shape,
11733
11674
  ...IconsSchema.shape,
11734
11675
  description: optional(string2()),
@@ -11749,34 +11690,34 @@ var GetPromptRequestSchema = RequestSchema.extend({
11749
11690
  method: literal("prompts/get"),
11750
11691
  params: GetPromptRequestParamsSchema
11751
11692
  });
11752
- var TextContentSchema = object2({
11693
+ var TextContentSchema = object({
11753
11694
  type: literal("text"),
11754
11695
  text: string2(),
11755
11696
  annotations: AnnotationsSchema.optional(),
11756
11697
  _meta: record(string2(), unknown()).optional()
11757
11698
  });
11758
- var ImageContentSchema = object2({
11699
+ var ImageContentSchema = object({
11759
11700
  type: literal("image"),
11760
11701
  data: Base64Schema,
11761
11702
  mimeType: string2(),
11762
11703
  annotations: AnnotationsSchema.optional(),
11763
11704
  _meta: record(string2(), unknown()).optional()
11764
11705
  });
11765
- var AudioContentSchema = object2({
11706
+ var AudioContentSchema = object({
11766
11707
  type: literal("audio"),
11767
11708
  data: Base64Schema,
11768
11709
  mimeType: string2(),
11769
11710
  annotations: AnnotationsSchema.optional(),
11770
11711
  _meta: record(string2(), unknown()).optional()
11771
11712
  });
11772
- var ToolUseContentSchema = object2({
11713
+ var ToolUseContentSchema = object({
11773
11714
  type: literal("tool_use"),
11774
11715
  name: string2(),
11775
11716
  id: string2(),
11776
11717
  input: record(string2(), unknown()),
11777
11718
  _meta: record(string2(), unknown()).optional()
11778
11719
  });
11779
- var EmbeddedResourceSchema = object2({
11720
+ var EmbeddedResourceSchema = object({
11780
11721
  type: literal("resource"),
11781
11722
  resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
11782
11723
  annotations: AnnotationsSchema.optional(),
@@ -11792,7 +11733,7 @@ var ContentBlockSchema = union([
11792
11733
  ResourceLinkSchema,
11793
11734
  EmbeddedResourceSchema
11794
11735
  ]);
11795
- var PromptMessageSchema = object2({
11736
+ var PromptMessageSchema = object({
11796
11737
  role: RoleSchema,
11797
11738
  content: ContentBlockSchema
11798
11739
  });
@@ -11804,26 +11745,26 @@ var PromptListChangedNotificationSchema = NotificationSchema.extend({
11804
11745
  method: literal("notifications/prompts/list_changed"),
11805
11746
  params: NotificationsParamsSchema.optional()
11806
11747
  });
11807
- var ToolAnnotationsSchema = object2({
11748
+ var ToolAnnotationsSchema = object({
11808
11749
  title: string2().optional(),
11809
11750
  readOnlyHint: boolean2().optional(),
11810
11751
  destructiveHint: boolean2().optional(),
11811
11752
  idempotentHint: boolean2().optional(),
11812
11753
  openWorldHint: boolean2().optional()
11813
11754
  });
11814
- var ToolExecutionSchema = object2({
11755
+ var ToolExecutionSchema = object({
11815
11756
  taskSupport: _enum(["required", "optional", "forbidden"]).optional()
11816
11757
  });
11817
- var ToolSchema = object2({
11758
+ var ToolSchema = object({
11818
11759
  ...BaseMetadataSchema.shape,
11819
11760
  ...IconsSchema.shape,
11820
11761
  description: string2().optional(),
11821
- inputSchema: object2({
11762
+ inputSchema: object({
11822
11763
  type: literal("object"),
11823
11764
  properties: record(string2(), AssertObjectSchema).optional(),
11824
11765
  required: array(string2()).optional()
11825
11766
  }).catchall(unknown()),
11826
- outputSchema: object2({
11767
+ outputSchema: object({
11827
11768
  type: literal("object"),
11828
11769
  properties: record(string2(), AssertObjectSchema).optional(),
11829
11770
  required: array(string2()).optional()
@@ -11858,7 +11799,7 @@ var ToolListChangedNotificationSchema = NotificationSchema.extend({
11858
11799
  method: literal("notifications/tools/list_changed"),
11859
11800
  params: NotificationsParamsSchema.optional()
11860
11801
  });
11861
- var ListChangedOptionsBaseSchema = object2({
11802
+ var ListChangedOptionsBaseSchema = object({
11862
11803
  autoRefresh: boolean2().default(true),
11863
11804
  debounceMs: number2().int().nonnegative().default(300)
11864
11805
  });
@@ -11879,23 +11820,23 @@ var LoggingMessageNotificationSchema = NotificationSchema.extend({
11879
11820
  method: literal("notifications/message"),
11880
11821
  params: LoggingMessageNotificationParamsSchema
11881
11822
  });
11882
- var ModelHintSchema = object2({
11823
+ var ModelHintSchema = object({
11883
11824
  name: string2().optional()
11884
11825
  });
11885
- var ModelPreferencesSchema = object2({
11826
+ var ModelPreferencesSchema = object({
11886
11827
  hints: array(ModelHintSchema).optional(),
11887
11828
  costPriority: number2().min(0).max(1).optional(),
11888
11829
  speedPriority: number2().min(0).max(1).optional(),
11889
11830
  intelligencePriority: number2().min(0).max(1).optional()
11890
11831
  });
11891
- var ToolChoiceSchema = object2({
11832
+ var ToolChoiceSchema = object({
11892
11833
  mode: _enum(["auto", "required", "none"]).optional()
11893
11834
  });
11894
- var ToolResultContentSchema = object2({
11835
+ var ToolResultContentSchema = object({
11895
11836
  type: literal("tool_result"),
11896
11837
  toolUseId: string2().describe("The unique identifier for the corresponding tool call."),
11897
11838
  content: array(ContentBlockSchema).default([]),
11898
- structuredContent: object2({}).loose().optional(),
11839
+ structuredContent: object({}).loose().optional(),
11899
11840
  isError: boolean2().optional(),
11900
11841
  _meta: record(string2(), unknown()).optional()
11901
11842
  });
@@ -11907,7 +11848,7 @@ var SamplingMessageContentBlockSchema = discriminatedUnion("type", [
11907
11848
  ToolUseContentSchema,
11908
11849
  ToolResultContentSchema
11909
11850
  ]);
11910
- var SamplingMessageSchema = object2({
11851
+ var SamplingMessageSchema = object({
11911
11852
  role: RoleSchema,
11912
11853
  content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
11913
11854
  _meta: record(string2(), unknown()).optional()
@@ -11940,13 +11881,13 @@ var CreateMessageResultWithToolsSchema = ResultSchema.extend({
11940
11881
  role: RoleSchema,
11941
11882
  content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)])
11942
11883
  });
11943
- var BooleanSchemaSchema = object2({
11884
+ var BooleanSchemaSchema = object({
11944
11885
  type: literal("boolean"),
11945
11886
  title: string2().optional(),
11946
11887
  description: string2().optional(),
11947
11888
  default: boolean2().optional()
11948
11889
  });
11949
- var StringSchemaSchema = object2({
11890
+ var StringSchemaSchema = object({
11950
11891
  type: literal("string"),
11951
11892
  title: string2().optional(),
11952
11893
  description: string2().optional(),
@@ -11955,7 +11896,7 @@ var StringSchemaSchema = object2({
11955
11896
  format: _enum(["email", "uri", "date", "date-time"]).optional(),
11956
11897
  default: string2().optional()
11957
11898
  });
11958
- var NumberSchemaSchema = object2({
11899
+ var NumberSchemaSchema = object({
11959
11900
  type: _enum(["number", "integer"]),
11960
11901
  title: string2().optional(),
11961
11902
  description: string2().optional(),
@@ -11963,24 +11904,24 @@ var NumberSchemaSchema = object2({
11963
11904
  maximum: number2().optional(),
11964
11905
  default: number2().optional()
11965
11906
  });
11966
- var UntitledSingleSelectEnumSchemaSchema = object2({
11907
+ var UntitledSingleSelectEnumSchemaSchema = object({
11967
11908
  type: literal("string"),
11968
11909
  title: string2().optional(),
11969
11910
  description: string2().optional(),
11970
11911
  enum: array(string2()),
11971
11912
  default: string2().optional()
11972
11913
  });
11973
- var TitledSingleSelectEnumSchemaSchema = object2({
11914
+ var TitledSingleSelectEnumSchemaSchema = object({
11974
11915
  type: literal("string"),
11975
11916
  title: string2().optional(),
11976
11917
  description: string2().optional(),
11977
- oneOf: array(object2({
11918
+ oneOf: array(object({
11978
11919
  const: string2(),
11979
11920
  title: string2()
11980
11921
  })),
11981
11922
  default: string2().optional()
11982
11923
  });
11983
- var LegacyTitledEnumSchemaSchema = object2({
11924
+ var LegacyTitledEnumSchemaSchema = object({
11984
11925
  type: literal("string"),
11985
11926
  title: string2().optional(),
11986
11927
  description: string2().optional(),
@@ -11989,26 +11930,26 @@ var LegacyTitledEnumSchemaSchema = object2({
11989
11930
  default: string2().optional()
11990
11931
  });
11991
11932
  var SingleSelectEnumSchemaSchema = union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
11992
- var UntitledMultiSelectEnumSchemaSchema = object2({
11933
+ var UntitledMultiSelectEnumSchemaSchema = object({
11993
11934
  type: literal("array"),
11994
11935
  title: string2().optional(),
11995
11936
  description: string2().optional(),
11996
11937
  minItems: number2().optional(),
11997
11938
  maxItems: number2().optional(),
11998
- items: object2({
11939
+ items: object({
11999
11940
  type: literal("string"),
12000
11941
  enum: array(string2())
12001
11942
  }),
12002
11943
  default: array(string2()).optional()
12003
11944
  });
12004
- var TitledMultiSelectEnumSchemaSchema = object2({
11945
+ var TitledMultiSelectEnumSchemaSchema = object({
12005
11946
  type: literal("array"),
12006
11947
  title: string2().optional(),
12007
11948
  description: string2().optional(),
12008
11949
  minItems: number2().optional(),
12009
11950
  maxItems: number2().optional(),
12010
- items: object2({
12011
- anyOf: array(object2({
11951
+ items: object({
11952
+ anyOf: array(object({
12012
11953
  const: string2(),
12013
11954
  title: string2()
12014
11955
  }))
@@ -12021,7 +11962,7 @@ var PrimitiveSchemaDefinitionSchema = union([EnumSchemaSchema, BooleanSchemaSche
12021
11962
  var ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
12022
11963
  mode: literal("form").optional(),
12023
11964
  message: string2(),
12024
- requestedSchema: object2({
11965
+ requestedSchema: object({
12025
11966
  type: literal("object"),
12026
11967
  properties: record(string2(), PrimitiveSchemaDefinitionSchema),
12027
11968
  required: array(string2()).optional()
@@ -12049,21 +11990,21 @@ var ElicitResultSchema = ResultSchema.extend({
12049
11990
  action: _enum(["accept", "decline", "cancel"]),
12050
11991
  content: preprocess((val) => val === null ? undefined : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional())
12051
11992
  });
12052
- var ResourceTemplateReferenceSchema = object2({
11993
+ var ResourceTemplateReferenceSchema = object({
12053
11994
  type: literal("ref/resource"),
12054
11995
  uri: string2()
12055
11996
  });
12056
- var PromptReferenceSchema = object2({
11997
+ var PromptReferenceSchema = object({
12057
11998
  type: literal("ref/prompt"),
12058
11999
  name: string2()
12059
12000
  });
12060
12001
  var CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
12061
12002
  ref: union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
12062
- argument: object2({
12003
+ argument: object({
12063
12004
  name: string2(),
12064
12005
  value: string2()
12065
12006
  }),
12066
- context: object2({
12007
+ context: object({
12067
12008
  arguments: record(string2(), string2()).optional()
12068
12009
  }).optional()
12069
12010
  });
@@ -12078,7 +12019,7 @@ var CompleteResultSchema = ResultSchema.extend({
12078
12019
  hasMore: optional(boolean2())
12079
12020
  })
12080
12021
  });
12081
- var RootSchema = object2({
12022
+ var RootSchema = object({
12082
12023
  uri: string2().startsWith("file://"),
12083
12024
  name: string2().optional(),
12084
12025
  _meta: record(string2(), unknown()).optional()
@@ -12196,6 +12137,161 @@ class UrlElicitationRequiredError extends McpError {
12196
12137
  }
12197
12138
  }
12198
12139
 
12140
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
12141
+ class ReadBuffer {
12142
+ append(chunk) {
12143
+ this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
12144
+ }
12145
+ readMessage() {
12146
+ if (!this._buffer) {
12147
+ return null;
12148
+ }
12149
+ const index = this._buffer.indexOf(`
12150
+ `);
12151
+ if (index === -1) {
12152
+ return null;
12153
+ }
12154
+ const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
12155
+ this._buffer = this._buffer.subarray(index + 1);
12156
+ return deserializeMessage(line);
12157
+ }
12158
+ clear() {
12159
+ this._buffer = undefined;
12160
+ }
12161
+ }
12162
+ function deserializeMessage(line) {
12163
+ return JSONRPCMessageSchema.parse(JSON.parse(line));
12164
+ }
12165
+ function serializeMessage(message) {
12166
+ return JSON.stringify(message) + `
12167
+ `;
12168
+ }
12169
+
12170
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
12171
+ class StdioServerTransport {
12172
+ constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
12173
+ this._stdin = _stdin;
12174
+ this._stdout = _stdout;
12175
+ this._readBuffer = new ReadBuffer;
12176
+ this._started = false;
12177
+ this._ondata = (chunk) => {
12178
+ this._readBuffer.append(chunk);
12179
+ this.processReadBuffer();
12180
+ };
12181
+ this._onerror = (error2) => {
12182
+ this.onerror?.(error2);
12183
+ };
12184
+ }
12185
+ async start() {
12186
+ if (this._started) {
12187
+ throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
12188
+ }
12189
+ this._started = true;
12190
+ this._stdin.on("data", this._ondata);
12191
+ this._stdin.on("error", this._onerror);
12192
+ }
12193
+ processReadBuffer() {
12194
+ while (true) {
12195
+ try {
12196
+ const message = this._readBuffer.readMessage();
12197
+ if (message === null) {
12198
+ break;
12199
+ }
12200
+ this.onmessage?.(message);
12201
+ } catch (error2) {
12202
+ this.onerror?.(error2);
12203
+ }
12204
+ }
12205
+ }
12206
+ async close() {
12207
+ this._stdin.off("data", this._ondata);
12208
+ this._stdin.off("error", this._onerror);
12209
+ const remainingDataListeners = this._stdin.listenerCount("data");
12210
+ if (remainingDataListeners === 0) {
12211
+ this._stdin.pause();
12212
+ }
12213
+ this._readBuffer.clear();
12214
+ this.onclose?.();
12215
+ }
12216
+ send(message) {
12217
+ return new Promise((resolve) => {
12218
+ const json = serializeMessage(message);
12219
+ if (this._stdout.write(json)) {
12220
+ resolve();
12221
+ } else {
12222
+ this._stdout.once("drain", resolve);
12223
+ }
12224
+ });
12225
+ }
12226
+ }
12227
+
12228
+ // lib/create-server.ts
12229
+ import { readFileSync } from "fs";
12230
+ import { dirname, join as join2 } from "path";
12231
+ import { fileURLToPath } from "url";
12232
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
12233
+ function isZ4Schema(s) {
12234
+ const schema = s;
12235
+ return !!schema._zod;
12236
+ }
12237
+ function safeParse3(schema, data) {
12238
+ if (isZ4Schema(schema)) {
12239
+ const result2 = safeParse(schema, data);
12240
+ return result2;
12241
+ }
12242
+ const v3Schema = schema;
12243
+ const result = v3Schema.safeParse(data);
12244
+ return result;
12245
+ }
12246
+ function getObjectShape(schema) {
12247
+ if (!schema)
12248
+ return;
12249
+ let rawShape;
12250
+ if (isZ4Schema(schema)) {
12251
+ const v4Schema = schema;
12252
+ rawShape = v4Schema._zod?.def?.shape;
12253
+ } else {
12254
+ const v3Schema = schema;
12255
+ rawShape = v3Schema.shape;
12256
+ }
12257
+ if (!rawShape)
12258
+ return;
12259
+ if (typeof rawShape === "function") {
12260
+ try {
12261
+ return rawShape();
12262
+ } catch {
12263
+ return;
12264
+ }
12265
+ }
12266
+ return rawShape;
12267
+ }
12268
+ function getLiteralValue(schema) {
12269
+ if (isZ4Schema(schema)) {
12270
+ const v4Schema = schema;
12271
+ const def2 = v4Schema._zod?.def;
12272
+ if (def2) {
12273
+ if (def2.value !== undefined)
12274
+ return def2.value;
12275
+ if (Array.isArray(def2.values) && def2.values.length > 0) {
12276
+ return def2.values[0];
12277
+ }
12278
+ }
12279
+ }
12280
+ const v3Schema = schema;
12281
+ const def = v3Schema._def;
12282
+ if (def) {
12283
+ if (def.value !== undefined)
12284
+ return def.value;
12285
+ if (Array.isArray(def.values) && def.values.length > 0) {
12286
+ return def.values[0];
12287
+ }
12288
+ }
12289
+ const directValue = schema.value;
12290
+ if (directValue !== undefined)
12291
+ return directValue;
12292
+ return;
12293
+ }
12294
+
12199
12295
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
12200
12296
  function isTerminal(status) {
12201
12297
  return status === "completed" || status === "failed" || status === "cancelled";
@@ -12219,7 +12315,7 @@ function getMethodLiteral(schema) {
12219
12315
  return value;
12220
12316
  }
12221
12317
  function parseWithCompat(schema, data) {
12222
- const result = safeParse2(schema, data);
12318
+ const result = safeParse3(schema, data);
12223
12319
  if (!result.success) {
12224
12320
  throw result.error;
12225
12321
  }
@@ -12768,7 +12864,7 @@ class Protocol {
12768
12864
  return reject(response);
12769
12865
  }
12770
12866
  try {
12771
- const parseResult = safeParse2(resultSchema, response.result);
12867
+ const parseResult = safeParse3(resultSchema, response.result);
12772
12868
  if (!parseResult.success) {
12773
12869
  reject(parseResult.error);
12774
12870
  } else {
@@ -13278,7 +13374,7 @@ class Server extends Protocol {
13278
13374
  const method = methodValue;
13279
13375
  if (method === "tools/call") {
13280
13376
  const wrappedHandler = async (request, extra) => {
13281
- const validatedRequest = safeParse2(CallToolRequestSchema, request);
13377
+ const validatedRequest = safeParse3(CallToolRequestSchema, request);
13282
13378
  if (!validatedRequest.success) {
13283
13379
  const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
13284
13380
  throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
@@ -13286,14 +13382,14 @@ class Server extends Protocol {
13286
13382
  const { params } = validatedRequest.data;
13287
13383
  const result = await Promise.resolve(handler(request, extra));
13288
13384
  if (params.task) {
13289
- const taskValidationResult = safeParse2(CreateTaskResultSchema, result);
13385
+ const taskValidationResult = safeParse3(CreateTaskResultSchema, result);
13290
13386
  if (!taskValidationResult.success) {
13291
13387
  const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
13292
13388
  throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
13293
13389
  }
13294
13390
  return taskValidationResult.data;
13295
13391
  }
13296
- const validationResult = safeParse2(CallToolResultSchema, result);
13392
+ const validationResult = safeParse3(CallToolResultSchema, result);
13297
13393
  if (!validationResult.success) {
13298
13394
  const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
13299
13395
  throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
@@ -13547,906 +13643,19 @@ class Server extends Protocol {
13547
13643
  }
13548
13644
  }
13549
13645
 
13550
- // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
13551
- import process3 from "node:process";
13552
-
13553
- // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
13554
- class ReadBuffer {
13555
- append(chunk) {
13556
- this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
13557
- }
13558
- readMessage() {
13559
- if (!this._buffer) {
13560
- return null;
13561
- }
13562
- const index = this._buffer.indexOf(`
13563
- `);
13564
- if (index === -1) {
13565
- return null;
13566
- }
13567
- const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
13568
- this._buffer = this._buffer.subarray(index + 1);
13569
- return deserializeMessage(line);
13570
- }
13571
- clear() {
13572
- this._buffer = undefined;
13573
- }
13574
- }
13575
- function deserializeMessage(line) {
13576
- return JSONRPCMessageSchema.parse(JSON.parse(line));
13646
+ // lib/indexer.ts
13647
+ import { readdir, stat, mkdir, rename, unlink, readFile, writeFile, open } from "fs/promises";
13648
+ import { join, basename } from "path";
13649
+ var HOME = process.env.HOME;
13650
+ if (!HOME) {
13651
+ throw new Error("HOME environment variable is not set");
13577
13652
  }
13578
- function serializeMessage(message) {
13579
- return JSON.stringify(message) + `
13580
- `;
13581
- }
13582
-
13583
- // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
13584
- class StdioServerTransport {
13585
- constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
13586
- this._stdin = _stdin;
13587
- this._stdout = _stdout;
13588
- this._readBuffer = new ReadBuffer;
13589
- this._started = false;
13590
- this._ondata = (chunk) => {
13591
- this._readBuffer.append(chunk);
13592
- this.processReadBuffer();
13593
- };
13594
- this._onerror = (error2) => {
13595
- this.onerror?.(error2);
13596
- };
13597
- }
13598
- async start() {
13599
- if (this._started) {
13600
- throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
13601
- }
13602
- this._started = true;
13603
- this._stdin.on("data", this._ondata);
13604
- this._stdin.on("error", this._onerror);
13605
- }
13606
- processReadBuffer() {
13607
- while (true) {
13608
- try {
13609
- const message = this._readBuffer.readMessage();
13610
- if (message === null) {
13611
- break;
13612
- }
13613
- this.onmessage?.(message);
13614
- } catch (error2) {
13615
- this.onerror?.(error2);
13616
- }
13617
- }
13618
- }
13619
- async close() {
13620
- this._stdin.off("data", this._ondata);
13621
- this._stdin.off("error", this._onerror);
13622
- const remainingDataListeners = this._stdin.listenerCount("data");
13623
- if (remainingDataListeners === 0) {
13624
- this._stdin.pause();
13625
- }
13626
- this._readBuffer.clear();
13627
- this.onclose?.();
13628
- }
13629
- send(message) {
13630
- return new Promise((resolve) => {
13631
- const json = serializeMessage(message);
13632
- if (this._stdout.write(json)) {
13633
- resolve();
13634
- } else {
13635
- this._stdout.once("drain", resolve);
13636
- }
13637
- });
13638
- }
13639
- }
13640
-
13641
- // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
13642
- var RELATED_TASK_META_KEY2 = "io.modelcontextprotocol/related-task";
13643
- var JSONRPC_VERSION2 = "2.0";
13644
- var AssertObjectSchema2 = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
13645
- var ProgressTokenSchema2 = union([string2(), number2().int()]);
13646
- var CursorSchema2 = string2();
13647
- var TaskCreationParamsSchema2 = looseObject({
13648
- ttl: union([number2(), _null3()]).optional(),
13649
- pollInterval: number2().optional()
13650
- });
13651
- var TaskMetadataSchema2 = object2({
13652
- ttl: number2().optional()
13653
- });
13654
- var RelatedTaskMetadataSchema2 = object2({
13655
- taskId: string2()
13656
- });
13657
- var RequestMetaSchema2 = looseObject({
13658
- progressToken: ProgressTokenSchema2.optional(),
13659
- [RELATED_TASK_META_KEY2]: RelatedTaskMetadataSchema2.optional()
13660
- });
13661
- var BaseRequestParamsSchema2 = object2({
13662
- _meta: RequestMetaSchema2.optional()
13663
- });
13664
- var TaskAugmentedRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
13665
- task: TaskMetadataSchema2.optional()
13666
- });
13667
- var RequestSchema2 = object2({
13668
- method: string2(),
13669
- params: BaseRequestParamsSchema2.loose().optional()
13670
- });
13671
- var NotificationsParamsSchema2 = object2({
13672
- _meta: RequestMetaSchema2.optional()
13673
- });
13674
- var NotificationSchema2 = object2({
13675
- method: string2(),
13676
- params: NotificationsParamsSchema2.loose().optional()
13677
- });
13678
- var ResultSchema2 = looseObject({
13679
- _meta: RequestMetaSchema2.optional()
13680
- });
13681
- var RequestIdSchema2 = union([string2(), number2().int()]);
13682
- var JSONRPCRequestSchema2 = object2({
13683
- jsonrpc: literal(JSONRPC_VERSION2),
13684
- id: RequestIdSchema2,
13685
- ...RequestSchema2.shape
13686
- }).strict();
13687
- var JSONRPCNotificationSchema2 = object2({
13688
- jsonrpc: literal(JSONRPC_VERSION2),
13689
- ...NotificationSchema2.shape
13690
- }).strict();
13691
- var JSONRPCResultResponseSchema2 = object2({
13692
- jsonrpc: literal(JSONRPC_VERSION2),
13693
- id: RequestIdSchema2,
13694
- result: ResultSchema2
13695
- }).strict();
13696
- var ErrorCode2;
13697
- (function(ErrorCode3) {
13698
- ErrorCode3[ErrorCode3["ConnectionClosed"] = -32000] = "ConnectionClosed";
13699
- ErrorCode3[ErrorCode3["RequestTimeout"] = -32001] = "RequestTimeout";
13700
- ErrorCode3[ErrorCode3["ParseError"] = -32700] = "ParseError";
13701
- ErrorCode3[ErrorCode3["InvalidRequest"] = -32600] = "InvalidRequest";
13702
- ErrorCode3[ErrorCode3["MethodNotFound"] = -32601] = "MethodNotFound";
13703
- ErrorCode3[ErrorCode3["InvalidParams"] = -32602] = "InvalidParams";
13704
- ErrorCode3[ErrorCode3["InternalError"] = -32603] = "InternalError";
13705
- ErrorCode3[ErrorCode3["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
13706
- })(ErrorCode2 || (ErrorCode2 = {}));
13707
- var JSONRPCErrorResponseSchema2 = object2({
13708
- jsonrpc: literal(JSONRPC_VERSION2),
13709
- id: RequestIdSchema2.optional(),
13710
- error: object2({
13711
- code: number2().int(),
13712
- message: string2(),
13713
- data: unknown().optional()
13714
- })
13715
- }).strict();
13716
- var JSONRPCMessageSchema2 = union([
13717
- JSONRPCRequestSchema2,
13718
- JSONRPCNotificationSchema2,
13719
- JSONRPCResultResponseSchema2,
13720
- JSONRPCErrorResponseSchema2
13721
- ]);
13722
- var JSONRPCResponseSchema2 = union([JSONRPCResultResponseSchema2, JSONRPCErrorResponseSchema2]);
13723
- var EmptyResultSchema2 = ResultSchema2.strict();
13724
- var CancelledNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
13725
- requestId: RequestIdSchema2.optional(),
13726
- reason: string2().optional()
13727
- });
13728
- var CancelledNotificationSchema2 = NotificationSchema2.extend({
13729
- method: literal("notifications/cancelled"),
13730
- params: CancelledNotificationParamsSchema2
13731
- });
13732
- var IconSchema2 = object2({
13733
- src: string2(),
13734
- mimeType: string2().optional(),
13735
- sizes: array(string2()).optional(),
13736
- theme: _enum(["light", "dark"]).optional()
13737
- });
13738
- var IconsSchema2 = object2({
13739
- icons: array(IconSchema2).optional()
13740
- });
13741
- var BaseMetadataSchema2 = object2({
13742
- name: string2(),
13743
- title: string2().optional()
13744
- });
13745
- var ImplementationSchema2 = BaseMetadataSchema2.extend({
13746
- ...BaseMetadataSchema2.shape,
13747
- ...IconsSchema2.shape,
13748
- version: string2(),
13749
- websiteUrl: string2().optional(),
13750
- description: string2().optional()
13751
- });
13752
- var FormElicitationCapabilitySchema2 = intersection(object2({
13753
- applyDefaults: boolean2().optional()
13754
- }), record(string2(), unknown()));
13755
- var ElicitationCapabilitySchema2 = preprocess((value) => {
13756
- if (value && typeof value === "object" && !Array.isArray(value)) {
13757
- if (Object.keys(value).length === 0) {
13758
- return { form: {} };
13759
- }
13760
- }
13761
- return value;
13762
- }, intersection(object2({
13763
- form: FormElicitationCapabilitySchema2.optional(),
13764
- url: AssertObjectSchema2.optional()
13765
- }), record(string2(), unknown()).optional()));
13766
- var ClientTasksCapabilitySchema2 = looseObject({
13767
- list: AssertObjectSchema2.optional(),
13768
- cancel: AssertObjectSchema2.optional(),
13769
- requests: looseObject({
13770
- sampling: looseObject({
13771
- createMessage: AssertObjectSchema2.optional()
13772
- }).optional(),
13773
- elicitation: looseObject({
13774
- create: AssertObjectSchema2.optional()
13775
- }).optional()
13776
- }).optional()
13777
- });
13778
- var ServerTasksCapabilitySchema2 = looseObject({
13779
- list: AssertObjectSchema2.optional(),
13780
- cancel: AssertObjectSchema2.optional(),
13781
- requests: looseObject({
13782
- tools: looseObject({
13783
- call: AssertObjectSchema2.optional()
13784
- }).optional()
13785
- }).optional()
13786
- });
13787
- var ClientCapabilitiesSchema2 = object2({
13788
- experimental: record(string2(), AssertObjectSchema2).optional(),
13789
- sampling: object2({
13790
- context: AssertObjectSchema2.optional(),
13791
- tools: AssertObjectSchema2.optional()
13792
- }).optional(),
13793
- elicitation: ElicitationCapabilitySchema2.optional(),
13794
- roots: object2({
13795
- listChanged: boolean2().optional()
13796
- }).optional(),
13797
- tasks: ClientTasksCapabilitySchema2.optional()
13798
- });
13799
- var InitializeRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
13800
- protocolVersion: string2(),
13801
- capabilities: ClientCapabilitiesSchema2,
13802
- clientInfo: ImplementationSchema2
13803
- });
13804
- var InitializeRequestSchema2 = RequestSchema2.extend({
13805
- method: literal("initialize"),
13806
- params: InitializeRequestParamsSchema2
13807
- });
13808
- var ServerCapabilitiesSchema2 = object2({
13809
- experimental: record(string2(), AssertObjectSchema2).optional(),
13810
- logging: AssertObjectSchema2.optional(),
13811
- completions: AssertObjectSchema2.optional(),
13812
- prompts: object2({
13813
- listChanged: boolean2().optional()
13814
- }).optional(),
13815
- resources: object2({
13816
- subscribe: boolean2().optional(),
13817
- listChanged: boolean2().optional()
13818
- }).optional(),
13819
- tools: object2({
13820
- listChanged: boolean2().optional()
13821
- }).optional(),
13822
- tasks: ServerTasksCapabilitySchema2.optional()
13823
- });
13824
- var InitializeResultSchema2 = ResultSchema2.extend({
13825
- protocolVersion: string2(),
13826
- capabilities: ServerCapabilitiesSchema2,
13827
- serverInfo: ImplementationSchema2,
13828
- instructions: string2().optional()
13829
- });
13830
- var InitializedNotificationSchema2 = NotificationSchema2.extend({
13831
- method: literal("notifications/initialized"),
13832
- params: NotificationsParamsSchema2.optional()
13833
- });
13834
- var PingRequestSchema2 = RequestSchema2.extend({
13835
- method: literal("ping"),
13836
- params: BaseRequestParamsSchema2.optional()
13837
- });
13838
- var ProgressSchema2 = object2({
13839
- progress: number2(),
13840
- total: optional(number2()),
13841
- message: optional(string2())
13842
- });
13843
- var ProgressNotificationParamsSchema2 = object2({
13844
- ...NotificationsParamsSchema2.shape,
13845
- ...ProgressSchema2.shape,
13846
- progressToken: ProgressTokenSchema2
13847
- });
13848
- var ProgressNotificationSchema2 = NotificationSchema2.extend({
13849
- method: literal("notifications/progress"),
13850
- params: ProgressNotificationParamsSchema2
13851
- });
13852
- var PaginatedRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
13853
- cursor: CursorSchema2.optional()
13854
- });
13855
- var PaginatedRequestSchema2 = RequestSchema2.extend({
13856
- params: PaginatedRequestParamsSchema2.optional()
13857
- });
13858
- var PaginatedResultSchema2 = ResultSchema2.extend({
13859
- nextCursor: CursorSchema2.optional()
13860
- });
13861
- var TaskStatusSchema2 = _enum(["working", "input_required", "completed", "failed", "cancelled"]);
13862
- var TaskSchema2 = object2({
13863
- taskId: string2(),
13864
- status: TaskStatusSchema2,
13865
- ttl: union([number2(), _null3()]),
13866
- createdAt: string2(),
13867
- lastUpdatedAt: string2(),
13868
- pollInterval: optional(number2()),
13869
- statusMessage: optional(string2())
13870
- });
13871
- var CreateTaskResultSchema2 = ResultSchema2.extend({
13872
- task: TaskSchema2
13873
- });
13874
- var TaskStatusNotificationParamsSchema2 = NotificationsParamsSchema2.merge(TaskSchema2);
13875
- var TaskStatusNotificationSchema2 = NotificationSchema2.extend({
13876
- method: literal("notifications/tasks/status"),
13877
- params: TaskStatusNotificationParamsSchema2
13878
- });
13879
- var GetTaskRequestSchema2 = RequestSchema2.extend({
13880
- method: literal("tasks/get"),
13881
- params: BaseRequestParamsSchema2.extend({
13882
- taskId: string2()
13883
- })
13884
- });
13885
- var GetTaskResultSchema2 = ResultSchema2.merge(TaskSchema2);
13886
- var GetTaskPayloadRequestSchema2 = RequestSchema2.extend({
13887
- method: literal("tasks/result"),
13888
- params: BaseRequestParamsSchema2.extend({
13889
- taskId: string2()
13890
- })
13891
- });
13892
- var GetTaskPayloadResultSchema2 = ResultSchema2.loose();
13893
- var ListTasksRequestSchema2 = PaginatedRequestSchema2.extend({
13894
- method: literal("tasks/list")
13895
- });
13896
- var ListTasksResultSchema2 = PaginatedResultSchema2.extend({
13897
- tasks: array(TaskSchema2)
13898
- });
13899
- var CancelTaskRequestSchema2 = RequestSchema2.extend({
13900
- method: literal("tasks/cancel"),
13901
- params: BaseRequestParamsSchema2.extend({
13902
- taskId: string2()
13903
- })
13904
- });
13905
- var CancelTaskResultSchema2 = ResultSchema2.merge(TaskSchema2);
13906
- var ResourceContentsSchema2 = object2({
13907
- uri: string2(),
13908
- mimeType: optional(string2()),
13909
- _meta: record(string2(), unknown()).optional()
13910
- });
13911
- var TextResourceContentsSchema2 = ResourceContentsSchema2.extend({
13912
- text: string2()
13913
- });
13914
- var Base64Schema2 = string2().refine((val) => {
13915
- try {
13916
- atob(val);
13917
- return true;
13918
- } catch {
13919
- return false;
13920
- }
13921
- }, { message: "Invalid Base64 string" });
13922
- var BlobResourceContentsSchema2 = ResourceContentsSchema2.extend({
13923
- blob: Base64Schema2
13924
- });
13925
- var RoleSchema2 = _enum(["user", "assistant"]);
13926
- var AnnotationsSchema2 = object2({
13927
- audience: array(RoleSchema2).optional(),
13928
- priority: number2().min(0).max(1).optional(),
13929
- lastModified: exports_iso.datetime({ offset: true }).optional()
13930
- });
13931
- var ResourceSchema2 = object2({
13932
- ...BaseMetadataSchema2.shape,
13933
- ...IconsSchema2.shape,
13934
- uri: string2(),
13935
- description: optional(string2()),
13936
- mimeType: optional(string2()),
13937
- annotations: AnnotationsSchema2.optional(),
13938
- _meta: optional(looseObject({}))
13939
- });
13940
- var ResourceTemplateSchema2 = object2({
13941
- ...BaseMetadataSchema2.shape,
13942
- ...IconsSchema2.shape,
13943
- uriTemplate: string2(),
13944
- description: optional(string2()),
13945
- mimeType: optional(string2()),
13946
- annotations: AnnotationsSchema2.optional(),
13947
- _meta: optional(looseObject({}))
13948
- });
13949
- var ListResourcesRequestSchema2 = PaginatedRequestSchema2.extend({
13950
- method: literal("resources/list")
13951
- });
13952
- var ListResourcesResultSchema2 = PaginatedResultSchema2.extend({
13953
- resources: array(ResourceSchema2)
13954
- });
13955
- var ListResourceTemplatesRequestSchema2 = PaginatedRequestSchema2.extend({
13956
- method: literal("resources/templates/list")
13957
- });
13958
- var ListResourceTemplatesResultSchema2 = PaginatedResultSchema2.extend({
13959
- resourceTemplates: array(ResourceTemplateSchema2)
13960
- });
13961
- var ResourceRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
13962
- uri: string2()
13963
- });
13964
- var ReadResourceRequestParamsSchema2 = ResourceRequestParamsSchema2;
13965
- var ReadResourceRequestSchema2 = RequestSchema2.extend({
13966
- method: literal("resources/read"),
13967
- params: ReadResourceRequestParamsSchema2
13968
- });
13969
- var ReadResourceResultSchema2 = ResultSchema2.extend({
13970
- contents: array(union([TextResourceContentsSchema2, BlobResourceContentsSchema2]))
13971
- });
13972
- var ResourceListChangedNotificationSchema2 = NotificationSchema2.extend({
13973
- method: literal("notifications/resources/list_changed"),
13974
- params: NotificationsParamsSchema2.optional()
13975
- });
13976
- var SubscribeRequestParamsSchema2 = ResourceRequestParamsSchema2;
13977
- var SubscribeRequestSchema2 = RequestSchema2.extend({
13978
- method: literal("resources/subscribe"),
13979
- params: SubscribeRequestParamsSchema2
13980
- });
13981
- var UnsubscribeRequestParamsSchema2 = ResourceRequestParamsSchema2;
13982
- var UnsubscribeRequestSchema2 = RequestSchema2.extend({
13983
- method: literal("resources/unsubscribe"),
13984
- params: UnsubscribeRequestParamsSchema2
13985
- });
13986
- var ResourceUpdatedNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
13987
- uri: string2()
13988
- });
13989
- var ResourceUpdatedNotificationSchema2 = NotificationSchema2.extend({
13990
- method: literal("notifications/resources/updated"),
13991
- params: ResourceUpdatedNotificationParamsSchema2
13992
- });
13993
- var PromptArgumentSchema2 = object2({
13994
- name: string2(),
13995
- description: optional(string2()),
13996
- required: optional(boolean2())
13997
- });
13998
- var PromptSchema2 = object2({
13999
- ...BaseMetadataSchema2.shape,
14000
- ...IconsSchema2.shape,
14001
- description: optional(string2()),
14002
- arguments: optional(array(PromptArgumentSchema2)),
14003
- _meta: optional(looseObject({}))
14004
- });
14005
- var ListPromptsRequestSchema2 = PaginatedRequestSchema2.extend({
14006
- method: literal("prompts/list")
14007
- });
14008
- var ListPromptsResultSchema2 = PaginatedResultSchema2.extend({
14009
- prompts: array(PromptSchema2)
14010
- });
14011
- var GetPromptRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
14012
- name: string2(),
14013
- arguments: record(string2(), string2()).optional()
14014
- });
14015
- var GetPromptRequestSchema2 = RequestSchema2.extend({
14016
- method: literal("prompts/get"),
14017
- params: GetPromptRequestParamsSchema2
14018
- });
14019
- var TextContentSchema2 = object2({
14020
- type: literal("text"),
14021
- text: string2(),
14022
- annotations: AnnotationsSchema2.optional(),
14023
- _meta: record(string2(), unknown()).optional()
14024
- });
14025
- var ImageContentSchema2 = object2({
14026
- type: literal("image"),
14027
- data: Base64Schema2,
14028
- mimeType: string2(),
14029
- annotations: AnnotationsSchema2.optional(),
14030
- _meta: record(string2(), unknown()).optional()
14031
- });
14032
- var AudioContentSchema2 = object2({
14033
- type: literal("audio"),
14034
- data: Base64Schema2,
14035
- mimeType: string2(),
14036
- annotations: AnnotationsSchema2.optional(),
14037
- _meta: record(string2(), unknown()).optional()
14038
- });
14039
- var ToolUseContentSchema2 = object2({
14040
- type: literal("tool_use"),
14041
- name: string2(),
14042
- id: string2(),
14043
- input: record(string2(), unknown()),
14044
- _meta: record(string2(), unknown()).optional()
14045
- });
14046
- var EmbeddedResourceSchema2 = object2({
14047
- type: literal("resource"),
14048
- resource: union([TextResourceContentsSchema2, BlobResourceContentsSchema2]),
14049
- annotations: AnnotationsSchema2.optional(),
14050
- _meta: record(string2(), unknown()).optional()
14051
- });
14052
- var ResourceLinkSchema2 = ResourceSchema2.extend({
14053
- type: literal("resource_link")
14054
- });
14055
- var ContentBlockSchema2 = union([
14056
- TextContentSchema2,
14057
- ImageContentSchema2,
14058
- AudioContentSchema2,
14059
- ResourceLinkSchema2,
14060
- EmbeddedResourceSchema2
14061
- ]);
14062
- var PromptMessageSchema2 = object2({
14063
- role: RoleSchema2,
14064
- content: ContentBlockSchema2
14065
- });
14066
- var GetPromptResultSchema2 = ResultSchema2.extend({
14067
- description: string2().optional(),
14068
- messages: array(PromptMessageSchema2)
14069
- });
14070
- var PromptListChangedNotificationSchema2 = NotificationSchema2.extend({
14071
- method: literal("notifications/prompts/list_changed"),
14072
- params: NotificationsParamsSchema2.optional()
14073
- });
14074
- var ToolAnnotationsSchema2 = object2({
14075
- title: string2().optional(),
14076
- readOnlyHint: boolean2().optional(),
14077
- destructiveHint: boolean2().optional(),
14078
- idempotentHint: boolean2().optional(),
14079
- openWorldHint: boolean2().optional()
14080
- });
14081
- var ToolExecutionSchema2 = object2({
14082
- taskSupport: _enum(["required", "optional", "forbidden"]).optional()
14083
- });
14084
- var ToolSchema2 = object2({
14085
- ...BaseMetadataSchema2.shape,
14086
- ...IconsSchema2.shape,
14087
- description: string2().optional(),
14088
- inputSchema: object2({
14089
- type: literal("object"),
14090
- properties: record(string2(), AssertObjectSchema2).optional(),
14091
- required: array(string2()).optional()
14092
- }).catchall(unknown()),
14093
- outputSchema: object2({
14094
- type: literal("object"),
14095
- properties: record(string2(), AssertObjectSchema2).optional(),
14096
- required: array(string2()).optional()
14097
- }).catchall(unknown()).optional(),
14098
- annotations: ToolAnnotationsSchema2.optional(),
14099
- execution: ToolExecutionSchema2.optional(),
14100
- _meta: record(string2(), unknown()).optional()
14101
- });
14102
- var ListToolsRequestSchema2 = PaginatedRequestSchema2.extend({
14103
- method: literal("tools/list")
14104
- });
14105
- var ListToolsResultSchema2 = PaginatedResultSchema2.extend({
14106
- tools: array(ToolSchema2)
14107
- });
14108
- var CallToolResultSchema2 = ResultSchema2.extend({
14109
- content: array(ContentBlockSchema2).default([]),
14110
- structuredContent: record(string2(), unknown()).optional(),
14111
- isError: boolean2().optional()
14112
- });
14113
- var CompatibilityCallToolResultSchema2 = CallToolResultSchema2.or(ResultSchema2.extend({
14114
- toolResult: unknown()
14115
- }));
14116
- var CallToolRequestParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
14117
- name: string2(),
14118
- arguments: record(string2(), unknown()).optional()
14119
- });
14120
- var CallToolRequestSchema2 = RequestSchema2.extend({
14121
- method: literal("tools/call"),
14122
- params: CallToolRequestParamsSchema2
14123
- });
14124
- var ToolListChangedNotificationSchema2 = NotificationSchema2.extend({
14125
- method: literal("notifications/tools/list_changed"),
14126
- params: NotificationsParamsSchema2.optional()
14127
- });
14128
- var ListChangedOptionsBaseSchema2 = object2({
14129
- autoRefresh: boolean2().default(true),
14130
- debounceMs: number2().int().nonnegative().default(300)
14131
- });
14132
- var LoggingLevelSchema2 = _enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
14133
- var SetLevelRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
14134
- level: LoggingLevelSchema2
14135
- });
14136
- var SetLevelRequestSchema2 = RequestSchema2.extend({
14137
- method: literal("logging/setLevel"),
14138
- params: SetLevelRequestParamsSchema2
14139
- });
14140
- var LoggingMessageNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
14141
- level: LoggingLevelSchema2,
14142
- logger: string2().optional(),
14143
- data: unknown()
14144
- });
14145
- var LoggingMessageNotificationSchema2 = NotificationSchema2.extend({
14146
- method: literal("notifications/message"),
14147
- params: LoggingMessageNotificationParamsSchema2
14148
- });
14149
- var ModelHintSchema2 = object2({
14150
- name: string2().optional()
14151
- });
14152
- var ModelPreferencesSchema2 = object2({
14153
- hints: array(ModelHintSchema2).optional(),
14154
- costPriority: number2().min(0).max(1).optional(),
14155
- speedPriority: number2().min(0).max(1).optional(),
14156
- intelligencePriority: number2().min(0).max(1).optional()
14157
- });
14158
- var ToolChoiceSchema2 = object2({
14159
- mode: _enum(["auto", "required", "none"]).optional()
14160
- });
14161
- var ToolResultContentSchema2 = object2({
14162
- type: literal("tool_result"),
14163
- toolUseId: string2().describe("The unique identifier for the corresponding tool call."),
14164
- content: array(ContentBlockSchema2).default([]),
14165
- structuredContent: object2({}).loose().optional(),
14166
- isError: boolean2().optional(),
14167
- _meta: record(string2(), unknown()).optional()
14168
- });
14169
- var SamplingContentSchema2 = discriminatedUnion("type", [TextContentSchema2, ImageContentSchema2, AudioContentSchema2]);
14170
- var SamplingMessageContentBlockSchema2 = discriminatedUnion("type", [
14171
- TextContentSchema2,
14172
- ImageContentSchema2,
14173
- AudioContentSchema2,
14174
- ToolUseContentSchema2,
14175
- ToolResultContentSchema2
14176
- ]);
14177
- var SamplingMessageSchema2 = object2({
14178
- role: RoleSchema2,
14179
- content: union([SamplingMessageContentBlockSchema2, array(SamplingMessageContentBlockSchema2)]),
14180
- _meta: record(string2(), unknown()).optional()
14181
- });
14182
- var CreateMessageRequestParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
14183
- messages: array(SamplingMessageSchema2),
14184
- modelPreferences: ModelPreferencesSchema2.optional(),
14185
- systemPrompt: string2().optional(),
14186
- includeContext: _enum(["none", "thisServer", "allServers"]).optional(),
14187
- temperature: number2().optional(),
14188
- maxTokens: number2().int(),
14189
- stopSequences: array(string2()).optional(),
14190
- metadata: AssertObjectSchema2.optional(),
14191
- tools: array(ToolSchema2).optional(),
14192
- toolChoice: ToolChoiceSchema2.optional()
14193
- });
14194
- var CreateMessageRequestSchema2 = RequestSchema2.extend({
14195
- method: literal("sampling/createMessage"),
14196
- params: CreateMessageRequestParamsSchema2
14197
- });
14198
- var CreateMessageResultSchema2 = ResultSchema2.extend({
14199
- model: string2(),
14200
- stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string2())),
14201
- role: RoleSchema2,
14202
- content: SamplingContentSchema2
14203
- });
14204
- var CreateMessageResultWithToolsSchema2 = ResultSchema2.extend({
14205
- model: string2(),
14206
- stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())),
14207
- role: RoleSchema2,
14208
- content: union([SamplingMessageContentBlockSchema2, array(SamplingMessageContentBlockSchema2)])
14209
- });
14210
- var BooleanSchemaSchema2 = object2({
14211
- type: literal("boolean"),
14212
- title: string2().optional(),
14213
- description: string2().optional(),
14214
- default: boolean2().optional()
14215
- });
14216
- var StringSchemaSchema2 = object2({
14217
- type: literal("string"),
14218
- title: string2().optional(),
14219
- description: string2().optional(),
14220
- minLength: number2().optional(),
14221
- maxLength: number2().optional(),
14222
- format: _enum(["email", "uri", "date", "date-time"]).optional(),
14223
- default: string2().optional()
14224
- });
14225
- var NumberSchemaSchema2 = object2({
14226
- type: _enum(["number", "integer"]),
14227
- title: string2().optional(),
14228
- description: string2().optional(),
14229
- minimum: number2().optional(),
14230
- maximum: number2().optional(),
14231
- default: number2().optional()
14232
- });
14233
- var UntitledSingleSelectEnumSchemaSchema2 = object2({
14234
- type: literal("string"),
14235
- title: string2().optional(),
14236
- description: string2().optional(),
14237
- enum: array(string2()),
14238
- default: string2().optional()
14239
- });
14240
- var TitledSingleSelectEnumSchemaSchema2 = object2({
14241
- type: literal("string"),
14242
- title: string2().optional(),
14243
- description: string2().optional(),
14244
- oneOf: array(object2({
14245
- const: string2(),
14246
- title: string2()
14247
- })),
14248
- default: string2().optional()
14249
- });
14250
- var LegacyTitledEnumSchemaSchema2 = object2({
14251
- type: literal("string"),
14252
- title: string2().optional(),
14253
- description: string2().optional(),
14254
- enum: array(string2()),
14255
- enumNames: array(string2()).optional(),
14256
- default: string2().optional()
14257
- });
14258
- var SingleSelectEnumSchemaSchema2 = union([UntitledSingleSelectEnumSchemaSchema2, TitledSingleSelectEnumSchemaSchema2]);
14259
- var UntitledMultiSelectEnumSchemaSchema2 = object2({
14260
- type: literal("array"),
14261
- title: string2().optional(),
14262
- description: string2().optional(),
14263
- minItems: number2().optional(),
14264
- maxItems: number2().optional(),
14265
- items: object2({
14266
- type: literal("string"),
14267
- enum: array(string2())
14268
- }),
14269
- default: array(string2()).optional()
14270
- });
14271
- var TitledMultiSelectEnumSchemaSchema2 = object2({
14272
- type: literal("array"),
14273
- title: string2().optional(),
14274
- description: string2().optional(),
14275
- minItems: number2().optional(),
14276
- maxItems: number2().optional(),
14277
- items: object2({
14278
- anyOf: array(object2({
14279
- const: string2(),
14280
- title: string2()
14281
- }))
14282
- }),
14283
- default: array(string2()).optional()
14284
- });
14285
- var MultiSelectEnumSchemaSchema2 = union([UntitledMultiSelectEnumSchemaSchema2, TitledMultiSelectEnumSchemaSchema2]);
14286
- var EnumSchemaSchema2 = union([LegacyTitledEnumSchemaSchema2, SingleSelectEnumSchemaSchema2, MultiSelectEnumSchemaSchema2]);
14287
- var PrimitiveSchemaDefinitionSchema2 = union([EnumSchemaSchema2, BooleanSchemaSchema2, StringSchemaSchema2, NumberSchemaSchema2]);
14288
- var ElicitRequestFormParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
14289
- mode: literal("form").optional(),
14290
- message: string2(),
14291
- requestedSchema: object2({
14292
- type: literal("object"),
14293
- properties: record(string2(), PrimitiveSchemaDefinitionSchema2),
14294
- required: array(string2()).optional()
14295
- })
14296
- });
14297
- var ElicitRequestURLParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
14298
- mode: literal("url"),
14299
- message: string2(),
14300
- elicitationId: string2(),
14301
- url: string2().url()
14302
- });
14303
- var ElicitRequestParamsSchema2 = union([ElicitRequestFormParamsSchema2, ElicitRequestURLParamsSchema2]);
14304
- var ElicitRequestSchema2 = RequestSchema2.extend({
14305
- method: literal("elicitation/create"),
14306
- params: ElicitRequestParamsSchema2
14307
- });
14308
- var ElicitationCompleteNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
14309
- elicitationId: string2()
14310
- });
14311
- var ElicitationCompleteNotificationSchema2 = NotificationSchema2.extend({
14312
- method: literal("notifications/elicitation/complete"),
14313
- params: ElicitationCompleteNotificationParamsSchema2
14314
- });
14315
- var ElicitResultSchema2 = ResultSchema2.extend({
14316
- action: _enum(["accept", "decline", "cancel"]),
14317
- content: preprocess((val) => val === null ? undefined : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional())
14318
- });
14319
- var ResourceTemplateReferenceSchema2 = object2({
14320
- type: literal("ref/resource"),
14321
- uri: string2()
14322
- });
14323
- var PromptReferenceSchema2 = object2({
14324
- type: literal("ref/prompt"),
14325
- name: string2()
14326
- });
14327
- var CompleteRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
14328
- ref: union([PromptReferenceSchema2, ResourceTemplateReferenceSchema2]),
14329
- argument: object2({
14330
- name: string2(),
14331
- value: string2()
14332
- }),
14333
- context: object2({
14334
- arguments: record(string2(), string2()).optional()
14335
- }).optional()
14336
- });
14337
- var CompleteRequestSchema2 = RequestSchema2.extend({
14338
- method: literal("completion/complete"),
14339
- params: CompleteRequestParamsSchema2
14340
- });
14341
- var CompleteResultSchema2 = ResultSchema2.extend({
14342
- completion: looseObject({
14343
- values: array(string2()).max(100),
14344
- total: optional(number2().int()),
14345
- hasMore: optional(boolean2())
14346
- })
14347
- });
14348
- var RootSchema2 = object2({
14349
- uri: string2().startsWith("file://"),
14350
- name: string2().optional(),
14351
- _meta: record(string2(), unknown()).optional()
14352
- });
14353
- var ListRootsRequestSchema2 = RequestSchema2.extend({
14354
- method: literal("roots/list"),
14355
- params: BaseRequestParamsSchema2.optional()
14356
- });
14357
- var ListRootsResultSchema2 = ResultSchema2.extend({
14358
- roots: array(RootSchema2)
14359
- });
14360
- var RootsListChangedNotificationSchema2 = NotificationSchema2.extend({
14361
- method: literal("notifications/roots/list_changed"),
14362
- params: NotificationsParamsSchema2.optional()
14363
- });
14364
- var ClientRequestSchema2 = union([
14365
- PingRequestSchema2,
14366
- InitializeRequestSchema2,
14367
- CompleteRequestSchema2,
14368
- SetLevelRequestSchema2,
14369
- GetPromptRequestSchema2,
14370
- ListPromptsRequestSchema2,
14371
- ListResourcesRequestSchema2,
14372
- ListResourceTemplatesRequestSchema2,
14373
- ReadResourceRequestSchema2,
14374
- SubscribeRequestSchema2,
14375
- UnsubscribeRequestSchema2,
14376
- CallToolRequestSchema2,
14377
- ListToolsRequestSchema2,
14378
- GetTaskRequestSchema2,
14379
- GetTaskPayloadRequestSchema2,
14380
- ListTasksRequestSchema2,
14381
- CancelTaskRequestSchema2
14382
- ]);
14383
- var ClientNotificationSchema2 = union([
14384
- CancelledNotificationSchema2,
14385
- ProgressNotificationSchema2,
14386
- InitializedNotificationSchema2,
14387
- RootsListChangedNotificationSchema2,
14388
- TaskStatusNotificationSchema2
14389
- ]);
14390
- var ClientResultSchema2 = union([
14391
- EmptyResultSchema2,
14392
- CreateMessageResultSchema2,
14393
- CreateMessageResultWithToolsSchema2,
14394
- ElicitResultSchema2,
14395
- ListRootsResultSchema2,
14396
- GetTaskResultSchema2,
14397
- ListTasksResultSchema2,
14398
- CreateTaskResultSchema2
14399
- ]);
14400
- var ServerRequestSchema2 = union([
14401
- PingRequestSchema2,
14402
- CreateMessageRequestSchema2,
14403
- ElicitRequestSchema2,
14404
- ListRootsRequestSchema2,
14405
- GetTaskRequestSchema2,
14406
- GetTaskPayloadRequestSchema2,
14407
- ListTasksRequestSchema2,
14408
- CancelTaskRequestSchema2
14409
- ]);
14410
- var ServerNotificationSchema2 = union([
14411
- CancelledNotificationSchema2,
14412
- ProgressNotificationSchema2,
14413
- LoggingMessageNotificationSchema2,
14414
- ResourceUpdatedNotificationSchema2,
14415
- ResourceListChangedNotificationSchema2,
14416
- ToolListChangedNotificationSchema2,
14417
- PromptListChangedNotificationSchema2,
14418
- TaskStatusNotificationSchema2,
14419
- ElicitationCompleteNotificationSchema2
14420
- ]);
14421
- var ServerResultSchema2 = union([
14422
- EmptyResultSchema2,
14423
- InitializeResultSchema2,
14424
- CompleteResultSchema2,
14425
- GetPromptResultSchema2,
14426
- ListPromptsResultSchema2,
14427
- ListResourcesResultSchema2,
14428
- ListResourceTemplatesResultSchema2,
14429
- ReadResourceResultSchema2,
14430
- CallToolResultSchema2,
14431
- ListToolsResultSchema2,
14432
- GetTaskResultSchema2,
14433
- ListTasksResultSchema2,
14434
- CreateTaskResultSchema2
14435
- ]);
14436
-
14437
- // lib/indexer.ts
14438
- import { readdir, stat, mkdir, rename, unlink, readFile, writeFile, open } from "fs/promises";
14439
- import { join, basename } from "path";
14440
- var HOME = process.env.HOME;
14441
- if (!HOME) {
14442
- throw new Error("HOME environment variable is not set");
14443
- }
14444
- var SUMMARY_MODEL = process.env.SESSION_SUMMARY_MODEL || "claude-haiku-4-5-20251001";
14445
- var DEBUG = Boolean(process.env.SESSION_DEBUG);
14446
- function debug(msg) {
14447
- if (DEBUG)
14448
- process.stderr.write(`[session] ${msg}
14449
- `);
13653
+ var SUMMARY_MODEL = process.env.SESSION_SUMMARY_MODEL || "claude-haiku-4-5-20251001";
13654
+ var DEBUG = Boolean(process.env.SESSION_DEBUG);
13655
+ function debug(msg) {
13656
+ if (DEBUG)
13657
+ process.stderr.write(`[session] ${msg}
13658
+ `);
14450
13659
  }
14451
13660
  var CLAUDE_DIR = join(HOME, ".claude");
14452
13661
  var HISTORY_FILE = join(CLAUDE_DIR, "history.jsonl");
@@ -15075,29 +14284,6 @@ function searchSessions(sessions, query) {
15075
14284
  return scored.map((s) => s.session);
15076
14285
  }
15077
14286
 
15078
- // lib/indexer.ts
15079
- import { join as join2, basename as basename2 } from "path";
15080
- var HOME2 = process.env.HOME;
15081
- if (!HOME2) {
15082
- throw new Error("HOME environment variable is not set");
15083
- }
15084
- var SUMMARY_MODEL2 = process.env.SESSION_SUMMARY_MODEL || "claude-haiku-4-5-20251001";
15085
- var DEBUG2 = Boolean(process.env.SESSION_DEBUG);
15086
- var CLAUDE_DIR2 = join2(HOME2, ".claude");
15087
- var HISTORY_FILE2 = join2(CLAUDE_DIR2, "history.jsonl");
15088
- var PROJECTS_DIR2 = join2(CLAUDE_DIR2, "projects");
15089
- var DATA_DIR2 = join2(CLAUDE_DIR2, "skills", "session", "data");
15090
- var CACHE_FILE2 = join2(DATA_DIR2, "index.json");
15091
- var SUMMARIES_FILE2 = join2(DATA_DIR2, "summaries.json");
15092
- var NAMES_FILE2 = join2(DATA_DIR2, "names.json");
15093
- function isGarbageSummary2(s) {
15094
- if (!s)
15095
- return true;
15096
- const lower = s.toLowerCase();
15097
- return lower.startsWith("i don't have") || lower.startsWith("i don't see") || lower.startsWith("i'm afraid") || lower.startsWith("i cannot") || lower.startsWith("(80 chars max)") || lower.includes("don't have a transcript") || lower.includes("don't have access");
15098
- }
15099
- var LOCK_FILE2 = NAMES_FILE2 + ".lock";
15100
-
15101
14287
  // lib/format.ts
15102
14288
  function truncate(s, max) {
15103
14289
  if (s.length <= max)
@@ -15107,6 +14293,9 @@ function truncate(s, max) {
15107
14293
  return s;
15108
14294
  return chars.slice(0, max - 3).join("") + "...";
15109
14295
  }
14296
+ function normalizeWhitespace(value) {
14297
+ return value.replace(/\s+/g, " ").trim();
14298
+ }
15110
14299
  function formatDate(ts) {
15111
14300
  if (!ts)
15112
14301
  return "unknown";
@@ -15120,8 +14309,19 @@ function formatDate(ts) {
15120
14309
  const h = hours % 12 || 12;
15121
14310
  return `${month} ${day}, ${h}:${mins} ${ampm}`;
15122
14311
  }
14312
+ function formatNameTimestamp(ts) {
14313
+ if (!ts)
14314
+ return "unknown";
14315
+ const d = new Date(ts);
14316
+ const day = d.getDate().toString().padStart(2, "0");
14317
+ const month = (d.getMonth() + 1).toString().padStart(2, "0");
14318
+ const year = (d.getFullYear() % 100).toString().padStart(2, "0");
14319
+ const hours = d.getHours().toString().padStart(2, "0");
14320
+ const minutes = d.getMinutes().toString().padStart(2, "0");
14321
+ return `${day}/${month}/${year} ${hours}:${minutes}`;
14322
+ }
15123
14323
  function displayLine(s) {
15124
- if (s.topic && !isGarbageSummary2(s.topic)) {
14324
+ if (s.topic && !isGarbageSummary(s.topic)) {
15125
14325
  const lines = s.topic.split(`
15126
14326
  `).filter((l) => l.trim().length > 0);
15127
14327
  const firstBullet = lines.find((l) => l.startsWith("- "));
@@ -15133,6 +14333,17 @@ function displayLine(s) {
15133
14333
  return s.lastMessage;
15134
14334
  return s.firstMessage || "(no messages)";
15135
14335
  }
14336
+ function makeAutoSessionName(s, maxLength = 50) {
14337
+ const prefix = formatNameTimestamp(s.firstTimestamp);
14338
+ const summary = displayLine(s);
14339
+ const cleanSummary = normalizeWhitespace(summary.startsWith("- ") ? summary.slice(2) : summary).replace(/^["']+|["']+$/g, "");
14340
+ if (!cleanSummary)
14341
+ return prefix;
14342
+ const available = maxLength - prefix.length - 1;
14343
+ if (available <= 0)
14344
+ return prefix.slice(0, maxLength);
14345
+ return `${prefix} ${truncate(cleanSummary, available)}`;
14346
+ }
15136
14347
  function makeLabel(s, summary) {
15137
14348
  if (!s.name)
15138
14349
  return summary;
@@ -15140,7 +14351,7 @@ function makeLabel(s, summary) {
15140
14351
  return `${s.name} — ${clean}`;
15141
14352
  }
15142
14353
  function fullSummary(s) {
15143
- if (s.topic && !isGarbageSummary2(s.topic))
14354
+ if (s.topic && !isGarbageSummary(s.topic))
15144
14355
  return s.topic;
15145
14356
  if (s.lastMessage)
15146
14357
  return s.lastMessage;
@@ -15270,151 +14481,194 @@ function formatStats(sessions) {
15270
14481
  `);
15271
14482
  }
15272
14483
 
15273
- // mcp-server.ts
15274
- var server = new Server({ name: "claude-session", version: "1.1.0" }, { capabilities: { tools: {} } });
15275
- server.setRequestHandler(ListToolsRequestSchema2, async () => ({
15276
- tools: [
15277
- {
15278
- name: "list_sessions",
15279
- description: "List recent Claude Code sessions with AI-generated summaries, sorted by last activity.",
15280
- inputSchema: {
15281
- type: "object",
15282
- properties: {
15283
- limit: {
15284
- type: "number",
15285
- description: "Max sessions to return. Defaults to all sessions."
14484
+ // lib/create-server.ts
14485
+ var __filename2 = fileURLToPath(import.meta.url);
14486
+ var __dirname2 = dirname(__filename2);
14487
+ var pkg = JSON.parse(readFileSync(join2(__dirname2, "..", "package.json"), "utf-8"));
14488
+ function createServer() {
14489
+ const server = new Server({ name: "claude-session", version: pkg.version }, { capabilities: { tools: {} } });
14490
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
14491
+ tools: [
14492
+ {
14493
+ name: "list_sessions",
14494
+ description: "List recent Claude Code sessions with AI-generated summaries, sorted by last activity.",
14495
+ inputSchema: {
14496
+ type: "object",
14497
+ properties: {
14498
+ limit: {
14499
+ type: "number",
14500
+ description: "Max sessions to return. Defaults to all sessions."
14501
+ }
15286
14502
  }
15287
14503
  }
15288
- }
15289
- },
15290
- {
15291
- name: "search_sessions",
15292
- description: "Search Claude Code sessions by keyword, project path, topic, or quoted phrase.",
15293
- inputSchema: {
15294
- type: "object",
15295
- properties: {
15296
- query: {
15297
- type: "string",
15298
- description: 'Search query. Supports quoted phrases for exact matches, e.g. "auth bug".'
15299
- }
15300
- },
15301
- required: ["query"]
15302
- }
15303
- },
15304
- {
15305
- name: "show_session",
15306
- description: "Show detailed information about a specific session: project, branch, timestamps, message count, and AI summary.",
15307
- inputSchema: {
15308
- type: "object",
15309
- properties: {
15310
- id: {
15311
- type: "string",
15312
- description: "Full or partial session ID (first 8+ characters are sufficient)."
15313
- }
15314
- },
15315
- required: ["id"]
15316
- }
15317
- },
15318
- {
15319
- name: "name_session",
15320
- description: "Give a session a memorable name for easy recall. Defaults to the most recent session if no ID is provided.",
15321
- inputSchema: {
15322
- type: "object",
15323
- properties: {
15324
- id: {
15325
- type: "string",
15326
- description: "Session ID or prefix. If omitted, names the most recent session."
14504
+ },
14505
+ {
14506
+ name: "search_sessions",
14507
+ description: "Search Claude Code sessions by keyword, project path, topic, or quoted phrase.",
14508
+ inputSchema: {
14509
+ type: "object",
14510
+ properties: {
14511
+ query: {
14512
+ type: "string",
14513
+ description: 'Search query. Supports quoted phrases for exact matches, e.g. "auth bug".'
14514
+ }
15327
14515
  },
15328
- name: {
15329
- type: "string",
15330
- description: "Name to assign (max 50 characters)."
15331
- }
15332
- },
15333
- required: ["name"]
15334
- }
15335
- },
15336
- {
15337
- name: "unname_session",
15338
- description: "Remove the name from a session. Defaults to the most recent session if no ID is provided.",
15339
- inputSchema: {
15340
- type: "object",
15341
- properties: {
15342
- id: {
15343
- type: "string",
15344
- description: "Session ID or prefix. If omitted, clears the name of the most recent session."
14516
+ required: ["query"]
14517
+ }
14518
+ },
14519
+ {
14520
+ name: "show_session",
14521
+ description: "Show detailed information about a specific session: project, branch, timestamps, message count, and AI summary.",
14522
+ inputSchema: {
14523
+ type: "object",
14524
+ properties: {
14525
+ id: {
14526
+ type: "string",
14527
+ description: "Full or partial session ID (first 8+ characters are sufficient)."
14528
+ }
14529
+ },
14530
+ required: ["id"]
14531
+ }
14532
+ },
14533
+ {
14534
+ name: "name_session",
14535
+ description: "Give a session a memorable name for easy recall. Defaults to the most recent session if no ID is provided.",
14536
+ inputSchema: {
14537
+ type: "object",
14538
+ properties: {
14539
+ id: {
14540
+ type: "string",
14541
+ description: "Session ID or prefix. If omitted, names the most recent session."
14542
+ },
14543
+ name: {
14544
+ type: "string",
14545
+ description: "Name to assign (max 50 characters)."
14546
+ }
14547
+ },
14548
+ required: ["name"]
14549
+ }
14550
+ },
14551
+ {
14552
+ name: "autoname_session",
14553
+ description: "Generate a session title from its summary and prefix it with the session start time as dd/mm/yy HH:MM.",
14554
+ inputSchema: {
14555
+ type: "object",
14556
+ properties: {
14557
+ id: {
14558
+ type: "string",
14559
+ description: "Session ID or prefix. If omitted, names the most recent session."
14560
+ }
15345
14561
  }
15346
- },
15347
- required: ["id"]
15348
- }
15349
- },
15350
- {
15351
- name: "session_stats",
15352
- description: "Show session statistics broken down by project: session count, message count, and last activity.",
15353
- inputSchema: {
15354
- type: "object",
15355
- properties: {}
15356
- }
15357
- }
15358
- ]
15359
- }));
15360
- server.setRequestHandler(CallToolRequestSchema2, async (request) => {
15361
- const { name, arguments: args } = request.params;
15362
- try {
15363
- switch (name) {
15364
- case "list_sessions": {
15365
- const sessions = await buildIndex();
15366
- const limit = typeof args?.limit === "number" ? args.limit : undefined;
15367
- const list = limit ? sessions.slice(0, limit) : sessions;
15368
- return {
15369
- content: [{ type: "text", text: formatSessionList(list, true) }]
15370
- };
14562
+ }
14563
+ },
14564
+ {
14565
+ name: "unname_session",
14566
+ description: "Remove the name from a session. Defaults to the most recent session if no ID is provided.",
14567
+ inputSchema: {
14568
+ type: "object",
14569
+ properties: {
14570
+ id: {
14571
+ type: "string",
14572
+ description: "Session ID or prefix. If omitted, clears the name of the most recent session."
14573
+ }
14574
+ },
14575
+ required: ["id"]
14576
+ }
14577
+ },
14578
+ {
14579
+ name: "session_stats",
14580
+ description: "Show session statistics broken down by project: session count, message count, and last activity.",
14581
+ inputSchema: {
14582
+ type: "object",
14583
+ properties: {}
14584
+ }
15371
14585
  }
15372
- case "search_sessions": {
15373
- const query = String(args?.query ?? "").trim();
15374
- if (!query) {
14586
+ ]
14587
+ }));
14588
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
14589
+ const { name, arguments: args } = request.params;
14590
+ try {
14591
+ switch (name) {
14592
+ case "list_sessions": {
14593
+ const sessions = await buildIndex();
14594
+ const limit = typeof args?.limit === "number" ? args.limit : undefined;
14595
+ const list = limit ? sessions.slice(0, limit) : sessions;
15375
14596
  return {
15376
- content: [{ type: "text", text: "Error: query is required." }],
15377
- isError: true
14597
+ content: [{ type: "text", text: formatSessionList(list, true) }]
15378
14598
  };
15379
14599
  }
15380
- const sessions = await buildIndex();
15381
- const results = searchSessions(sessions, query);
15382
- return {
15383
- content: [{ type: "text", text: formatSearchResults(results, query) }]
15384
- };
15385
- }
15386
- case "show_session": {
15387
- const id = String(args?.id ?? "").trim();
15388
- if (!id) {
14600
+ case "search_sessions": {
14601
+ const query = String(args?.query ?? "").trim();
14602
+ if (!query) {
14603
+ return {
14604
+ content: [{ type: "text", text: "Error: query is required." }],
14605
+ isError: true
14606
+ };
14607
+ }
14608
+ const sessions = await buildIndex();
14609
+ const results = searchSessions(sessions, query);
15389
14610
  return {
15390
- content: [{ type: "text", text: "Error: id is required." }],
15391
- isError: true
14611
+ content: [{ type: "text", text: formatSearchResults(results, query) }]
15392
14612
  };
15393
14613
  }
15394
- const sessions = await buildIndex();
15395
- const resolved = resolveSession(sessions, id);
15396
- if (!resolved.ok) {
14614
+ case "show_session": {
14615
+ const id = String(args?.id ?? "").trim();
14616
+ if (!id) {
14617
+ return {
14618
+ content: [{ type: "text", text: "Error: id is required." }],
14619
+ isError: true
14620
+ };
14621
+ }
14622
+ const sessions = await buildIndex();
14623
+ const resolved = resolveSession(sessions, id);
14624
+ if (!resolved.ok) {
14625
+ return {
14626
+ content: [{ type: "text", text: `Error: ${resolved.error}` }],
14627
+ isError: true
14628
+ };
14629
+ }
15397
14630
  return {
15398
- content: [{ type: "text", text: `Error: ${resolved.error}` }],
15399
- isError: true
14631
+ content: [{ type: "text", text: formatSessionDetail(resolved.match) }]
15400
14632
  };
15401
14633
  }
15402
- return {
15403
- content: [{ type: "text", text: formatSessionDetail(resolved.match) }]
15404
- };
15405
- }
15406
- case "name_session": {
15407
- const sessionName = String(args?.name ?? "").trim();
15408
- if (!sessionName) {
14634
+ case "name_session": {
14635
+ const sessionName = String(args?.name ?? "").trim();
14636
+ if (!sessionName) {
14637
+ return {
14638
+ content: [{ type: "text", text: "Error: name is required." }],
14639
+ isError: true
14640
+ };
14641
+ }
14642
+ let sessionId;
14643
+ if (args?.id) {
14644
+ sessionId = String(args.id).trim();
14645
+ } else {
14646
+ const sessions = await buildIndex();
14647
+ if (sessions.length === 0) {
14648
+ return {
14649
+ content: [{ type: "text", text: "Error: No sessions found." }],
14650
+ isError: true
14651
+ };
14652
+ }
14653
+ sessionId = sessions[0].id;
14654
+ }
14655
+ const result = await nameSession(sessionId, sessionName);
14656
+ if (!result.ok) {
14657
+ return {
14658
+ content: [{ type: "text", text: `Error: ${result.error}` }],
14659
+ isError: true
14660
+ };
14661
+ }
15409
14662
  return {
15410
- content: [{ type: "text", text: "Error: name is required." }],
15411
- isError: true
14663
+ content: [
14664
+ {
14665
+ type: "text",
14666
+ text: `Named session ${(result.fullId ?? "").slice(0, 8)}... → "${sessionName}"`
14667
+ }
14668
+ ]
15412
14669
  };
15413
14670
  }
15414
- let sessionId;
15415
- if (args?.id) {
15416
- sessionId = String(args.id).trim();
15417
- } else {
14671
+ case "autoname_session": {
15418
14672
  const sessions = await buildIndex();
15419
14673
  if (sessions.length === 0) {
15420
14674
  return {
@@ -15422,73 +14676,85 @@ server.setRequestHandler(CallToolRequestSchema2, async (request) => {
15422
14676
  isError: true
15423
14677
  };
15424
14678
  }
15425
- sessionId = sessions[0].id;
15426
- }
15427
- const result = await nameSession(sessionId, sessionName);
15428
- if (!result.ok) {
14679
+ const sessionId = args?.id ? String(args.id).trim() : sessions[0].id;
14680
+ const resolved = resolveSession(sessions, sessionId);
14681
+ if (!resolved.ok) {
14682
+ return {
14683
+ content: [{ type: "text", text: `Error: ${resolved.error}` }],
14684
+ isError: true
14685
+ };
14686
+ }
14687
+ const generatedName = makeAutoSessionName(resolved.match);
14688
+ const result = await nameSession(resolved.match.id, generatedName);
14689
+ if (!result.ok) {
14690
+ return {
14691
+ content: [{ type: "text", text: `Error: ${result.error}` }],
14692
+ isError: true
14693
+ };
14694
+ }
15429
14695
  return {
15430
- content: [{ type: "text", text: `Error: ${result.error}` }],
15431
- isError: true
14696
+ content: [
14697
+ {
14698
+ type: "text",
14699
+ text: `Named session ${(result.fullId ?? "").slice(0, 8)}... → "${generatedName}"`
14700
+ }
14701
+ ]
15432
14702
  };
15433
14703
  }
15434
- return {
15435
- content: [
15436
- {
15437
- type: "text",
15438
- text: `Named session ${(result.fullId ?? "").slice(0, 8)}... \u2192 "${sessionName}"`
14704
+ case "unname_session": {
14705
+ let sessionId;
14706
+ if (args?.id) {
14707
+ sessionId = String(args.id).trim();
14708
+ } else {
14709
+ const sessions = await buildIndex();
14710
+ if (sessions.length === 0) {
14711
+ return {
14712
+ content: [{ type: "text", text: "Error: No sessions found." }],
14713
+ isError: true
14714
+ };
15439
14715
  }
15440
- ]
15441
- };
15442
- }
15443
- case "unname_session": {
15444
- let sessionId;
15445
- if (args?.id) {
15446
- sessionId = String(args.id).trim();
15447
- } else {
15448
- const sessions = await buildIndex();
15449
- if (sessions.length === 0) {
14716
+ sessionId = sessions[0].id;
14717
+ }
14718
+ const result = await clearSessionName(sessionId);
14719
+ if (!result.ok) {
15450
14720
  return {
15451
- content: [{ type: "text", text: "Error: No sessions found." }],
14721
+ content: [{ type: "text", text: `Error: ${result.error}` }],
15452
14722
  isError: true
15453
14723
  };
15454
14724
  }
15455
- sessionId = sessions[0].id;
14725
+ return {
14726
+ content: [
14727
+ {
14728
+ type: "text",
14729
+ text: `Cleared name from session ${(result.fullId ?? "").slice(0, 8)}...`
14730
+ }
14731
+ ]
14732
+ };
15456
14733
  }
15457
- const result = await clearSessionName(sessionId);
15458
- if (!result.ok) {
14734
+ case "session_stats": {
14735
+ const sessions = await buildIndex();
15459
14736
  return {
15460
- content: [{ type: "text", text: `Error: ${result.error}` }],
15461
- isError: true
14737
+ content: [{ type: "text", text: formatStats(sessions) }]
15462
14738
  };
15463
14739
  }
15464
- return {
15465
- content: [
15466
- {
15467
- type: "text",
15468
- text: `Cleared name from session ${(result.fullId ?? "").slice(0, 8)}...`
15469
- }
15470
- ]
15471
- };
15472
- }
15473
- case "session_stats": {
15474
- const sessions = await buildIndex();
15475
- return {
15476
- content: [{ type: "text", text: formatStats(sessions) }]
15477
- };
14740
+ default:
14741
+ return {
14742
+ content: [{ type: "text", text: `Error: Unknown tool "${name}"` }],
14743
+ isError: true
14744
+ };
15478
14745
  }
15479
- default:
15480
- return {
15481
- content: [{ type: "text", text: `Error: Unknown tool "${name}"` }],
15482
- isError: true
15483
- };
14746
+ } catch (err) {
14747
+ const message = err instanceof Error ? err.message : String(err);
14748
+ return {
14749
+ content: [{ type: "text", text: `Error: ${message}` }],
14750
+ isError: true
14751
+ };
15484
14752
  }
15485
- } catch (err) {
15486
- const message = err instanceof Error ? err.message : String(err);
15487
- return {
15488
- content: [{ type: "text", text: `Error: ${message}` }],
15489
- isError: true
15490
- };
15491
- }
15492
- });
14753
+ });
14754
+ return server;
14755
+ }
14756
+
14757
+ // mcp-server.ts
14758
+ var server = createServer();
15493
14759
  var transport = new StdioServerTransport;
15494
14760
  await server.connect(transport);