@wyattjoh/rfc-pi 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/extensions/rfc.ts +20 -10
  2. package/package.json +4 -4
package/extensions/rfc.ts CHANGED
@@ -76,6 +76,16 @@ const commandFailures = new Map<string, RfcCommandFailureDiagnostics>();
76
76
 
77
77
  const nonEmptyString = (description: string) => Type.String({ description, minLength: 1 });
78
78
 
79
+ /**
80
+ * RFC identifier accepted as a string such as "RFC9110" or a bare positive
81
+ * integer such as 9110, matching the MCP surface.
82
+ */
83
+ const rfcIdentifier = (description: string) =>
84
+ Type.Union([Type.String({ minLength: 1 }), Type.Integer({ minimum: 1 })], { description });
85
+
86
+ const toRfcIdentifier = (value: string | number): string =>
87
+ typeof value === "number" ? `RFC${value}` : value;
88
+
79
89
  const researchParameters = Type.Object(
80
90
  {
81
91
  questions: Type.Array(nonEmptyString(descriptions.question), {
@@ -84,7 +94,7 @@ const researchParameters = Type.Object(
84
94
  maxItems: retrievalPolicy.maxQuestions,
85
95
  }),
86
96
  rfcs: Type.Optional(
87
- Type.Array(nonEmptyString(descriptions.rfc), {
97
+ Type.Array(rfcIdentifier(descriptions.rfc), {
88
98
  description: descriptions.rfcs,
89
99
  minItems: 1,
90
100
  maxItems: retrievalPolicy.maxRequestedRfcs,
@@ -110,7 +120,7 @@ const researchParameters = Type.Object(
110
120
 
111
121
  const citationParameters = Type.Object(
112
122
  {
113
- rfc: nonEmptyString(descriptions.citationRfc),
123
+ rfc: rfcIdentifier(descriptions.citationRfc),
114
124
  claim: nonEmptyString(descriptions.claim),
115
125
  quote: nonEmptyString(descriptions.quote),
116
126
  offset: Type.Optional(Type.Integer({ description: descriptions.offset, minimum: 0 })),
@@ -120,7 +130,7 @@ const citationParameters = Type.Object(
120
130
 
121
131
  const sourceTextParameters = Type.Object(
122
132
  {
123
- rfc: nonEmptyString(descriptions.sourceRfc),
133
+ rfc: rfcIdentifier(descriptions.sourceRfc),
124
134
  startOffset: Type.Optional(Type.Integer({ description: descriptions.sourceStart, minimum: 0 })),
125
135
  endOffset: Type.Optional(Type.Integer({ description: descriptions.sourceEnd, minimum: 0 })),
126
136
  expectedSourceHash: Type.Optional(nonEmptyString(descriptions.expectedSourceHash)),
@@ -130,14 +140,14 @@ const sourceTextParameters = Type.Object(
130
140
 
131
141
  const rfcParameters = Type.Object(
132
142
  {
133
- rfc: nonEmptyString(descriptions.cacheRfc),
143
+ rfc: rfcIdentifier(descriptions.cacheRfc),
134
144
  },
135
145
  { additionalProperties: false },
136
146
  );
137
147
 
138
148
  const sourceCacheRemoveParameters = Type.Object(
139
149
  {
140
- rfc: nonEmptyString(descriptions.cacheRfc),
150
+ rfc: rfcIdentifier(descriptions.cacheRfc),
141
151
  confirm: Type.Literal(true, { description: descriptions.confirm }),
142
152
  },
143
153
  { additionalProperties: false },
@@ -404,7 +414,7 @@ export default function rfcExtension(pi: ExtensionAPI): void {
404
414
  {
405
415
  schemaVersion,
406
416
  questions,
407
- ...(rfcs === undefined ? {} : { rfcs }),
417
+ ...(rfcs === undefined ? {} : { rfcs: rfcs.map(toRfcIdentifier) }),
408
418
  ...(searchTerms === undefined ? {} : { searchTerms }),
409
419
  },
410
420
  signal,
@@ -423,7 +433,7 @@ export default function rfcExtension(pi: ExtensionAPI): void {
423
433
  const result = await runToolCommand<CitationVerificationResult>(
424
434
  toolCallId,
425
435
  ["verify-citation"],
426
- { schemaVersion, rfc, claim, quote, offset: offset ?? null },
436
+ { schemaVersion, rfc: toRfcIdentifier(rfc), claim, quote, offset: offset ?? null },
427
437
  signal,
428
438
  );
429
439
  return successResult(
@@ -446,7 +456,7 @@ export default function rfcExtension(pi: ExtensionAPI): void {
446
456
  [
447
457
  "source-text",
448
458
  "--rfc",
449
- rfc,
459
+ toRfcIdentifier(rfc),
450
460
  "--format",
451
461
  "json",
452
462
  ...(startOffset === undefined ? [] : ["--start-offset", String(startOffset)]),
@@ -473,7 +483,7 @@ export default function rfcExtension(pi: ExtensionAPI): void {
473
483
  async execute(toolCallId, { rfc }, signal) {
474
484
  const result = await runToolCommand<RfcSourceCacheStatus>(
475
485
  toolCallId,
476
- ["cache", "status", "--rfc", rfc, "--format", "json"],
486
+ ["cache", "status", "--rfc", toRfcIdentifier(rfc), "--format", "json"],
477
487
  undefined,
478
488
  signal,
479
489
  );
@@ -490,7 +500,7 @@ export default function rfcExtension(pi: ExtensionAPI): void {
490
500
  async execute(toolCallId, { rfc }, signal) {
491
501
  const result = await runToolCommand<RfcSourceCacheRemoveResult>(
492
502
  toolCallId,
493
- ["cache", "remove", "--rfc", rfc, "--format", "json"],
503
+ ["cache", "remove", "--rfc", toRfcIdentifier(rfc), "--format", "json"],
494
504
  undefined,
495
505
  signal,
496
506
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wyattjoh/rfc-pi",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Native Pi extension and lookup skill for evidence-grounded IETF RFC research.",
5
5
  "keywords": [
6
6
  "ietf",
@@ -28,11 +28,11 @@
28
28
  "typecheck": "tsc --noEmit -p tsconfig.json"
29
29
  },
30
30
  "dependencies": {
31
- "@wyattjoh/rfc": "0.6.1",
32
- "@wyattjoh/rfc-core": "0.3.1"
31
+ "@wyattjoh/rfc": "0.6.3",
32
+ "@wyattjoh/rfc-core": "0.3.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/bun": "1.4.2",
35
+ "@types/bun": "1.4.4",
36
36
  "typescript": "7.0.2"
37
37
  },
38
38
  "peerDependencies": {