@funyard-org/cli 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -3
- package/src/cli.js +5 -1
- package/src/mcp.js +2 -1
- package/src/protocol/index.d.ts +914 -146
- package/src/protocol/index.js +28 -8
- package/src/version.js +3 -0
package/src/protocol/index.js
CHANGED
|
@@ -28,6 +28,10 @@ export const CAPABILITY_IDS = [
|
|
|
28
28
|
'linkedin.get',
|
|
29
29
|
'social.trending',
|
|
30
30
|
'news.get',
|
|
31
|
+
'web.get',
|
|
32
|
+
'company.get',
|
|
33
|
+
'people.get',
|
|
34
|
+
'social.get',
|
|
31
35
|
];
|
|
32
36
|
/** Canonical field id: category.group.name. The group is the public billing unit. */
|
|
33
37
|
export const FIELD_ID = /^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*){2}$/;
|
|
@@ -41,6 +45,10 @@ export const FIELD_CAPABILITIES = {
|
|
|
41
45
|
'youtube.get': { subject: 'handle', category: 'youtube' },
|
|
42
46
|
'linkedin.get': { subject: 'company', category: 'linkedin' },
|
|
43
47
|
'news.get': { subject: 'symbols', category: 'news' },
|
|
48
|
+
'web.get': { subject: 'query', category: 'web' },
|
|
49
|
+
'company.get': { subject: 'domain', category: 'company' },
|
|
50
|
+
'people.get': { subject: 'query', category: 'people' },
|
|
51
|
+
'social.get': { subject: 'query', category: 'social' },
|
|
44
52
|
};
|
|
45
53
|
export function fieldCapability(id) {
|
|
46
54
|
return Object.hasOwn(FIELD_CAPABILITIES, id) ? FIELD_CAPABILITIES[id] : undefined;
|
|
@@ -101,6 +109,10 @@ export const capabilityArguments = {
|
|
|
101
109
|
'linkedin.get': { required: ['fields'], optional: ['company', 'sources'] },
|
|
102
110
|
'social.trending': { required: ['platform'], optional: [] },
|
|
103
111
|
'news.get': { required: ['fields'], optional: ['symbols', 'sources'] },
|
|
112
|
+
'web.get': { required: ['fields'], optional: ['query', 'sources'] },
|
|
113
|
+
'company.get': { required: ['fields'], optional: ['domain', 'sources'] },
|
|
114
|
+
'people.get': { required: ['fields'], optional: ['query', 'sources'] },
|
|
115
|
+
'social.get': { required: ['fields'], optional: ['query', 'sources'] },
|
|
104
116
|
};
|
|
105
117
|
/** Route policy may narrow fields; it never adds an independently maintained schema. */
|
|
106
118
|
export function capabilityInputSchema(id, internalSearch = false) {
|
|
@@ -172,7 +184,7 @@ export const fieldsQuoteRequestSchema = {
|
|
|
172
184
|
fields: { type: 'string', minLength: 1, maxLength: 2048 },
|
|
173
185
|
sources: { const: 'all' },
|
|
174
186
|
capability: { type: 'string', pattern: '^[a-z][a-z0-9_]{0,31}\\.[a-z][a-z0-9_]{0,31}$' },
|
|
175
|
-
arguments: { type: 'object', additionalProperties: { type: 'string', maxLength:
|
|
187
|
+
arguments: { type: 'object', additionalProperties: { type: 'string', maxLength: 2048 } },
|
|
176
188
|
},
|
|
177
189
|
required: ['fields'],
|
|
178
190
|
additionalProperties: false,
|
|
@@ -338,42 +350,42 @@ export const fieldsResultSchema = {
|
|
|
338
350
|
properties: { symbol: quoteResultSchema.properties.symbol, fields: fieldsMap },
|
|
339
351
|
required: ['fields'],
|
|
340
352
|
// Echo of every argument the request carried.
|
|
341
|
-
additionalProperties: { type: 'string', maxLength:
|
|
353
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
342
354
|
};
|
|
343
355
|
export const cryptoFieldsResultSchema = {
|
|
344
356
|
type: 'object',
|
|
345
357
|
properties: { coin: { type: 'string', pattern: '^[a-z0-9][a-z0-9-]{0,99}$' }, fields: fieldsMap },
|
|
346
358
|
required: ['fields'],
|
|
347
359
|
// Echo of every argument the request carried.
|
|
348
|
-
additionalProperties: { type: 'string', maxLength:
|
|
360
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
349
361
|
};
|
|
350
362
|
export const economyFieldsResultSchema = {
|
|
351
363
|
type: 'object',
|
|
352
364
|
properties: { series: { type: 'string', pattern: '^[A-Z0-9][A-Z0-9_]{0,63}$' }, fields: fieldsMap },
|
|
353
365
|
required: ['fields'],
|
|
354
366
|
// Echo of every argument the request carried.
|
|
355
|
-
additionalProperties: { type: 'string', maxLength:
|
|
367
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
356
368
|
};
|
|
357
369
|
export const socialFieldsResultSchema = {
|
|
358
370
|
type: 'object',
|
|
359
371
|
properties: { handle: { type: 'string', pattern: '^[a-z0-9_][a-z0-9._-]{0,99}$' }, fields: fieldsMap },
|
|
360
372
|
required: ['fields'],
|
|
361
373
|
// Echo of every argument the request carried.
|
|
362
|
-
additionalProperties: { type: 'string', maxLength:
|
|
374
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
363
375
|
};
|
|
364
376
|
/** Field results whose capability has no normalized subject: the field map plus echoed arguments. */
|
|
365
377
|
export const echoFieldsResultSchema = {
|
|
366
378
|
type: 'object',
|
|
367
379
|
properties: { fields: fieldsMap },
|
|
368
380
|
required: ['fields'],
|
|
369
|
-
additionalProperties: { type: 'string', maxLength:
|
|
381
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
370
382
|
};
|
|
371
383
|
export const linkedinFieldsResultSchema = {
|
|
372
384
|
type: 'object',
|
|
373
385
|
properties: { company: { type: 'string', pattern: '^[a-z0-9][a-z0-9_-]{0,99}$' }, fields: fieldsMap },
|
|
374
386
|
required: ['fields'],
|
|
375
387
|
// Echo of every argument the request carried.
|
|
376
|
-
additionalProperties: { type: 'string', maxLength:
|
|
388
|
+
additionalProperties: { type: 'string', maxLength: 2048 },
|
|
377
389
|
};
|
|
378
390
|
export const resultSchemas = {
|
|
379
391
|
'finance.quote': quoteResultSchema,
|
|
@@ -391,6 +403,10 @@ export const resultSchemas = {
|
|
|
391
403
|
'linkedin.get': linkedinFieldsResultSchema,
|
|
392
404
|
'social.trending': trendingResultSchema,
|
|
393
405
|
'news.get': echoFieldsResultSchema,
|
|
406
|
+
'web.get': echoFieldsResultSchema,
|
|
407
|
+
'company.get': echoFieldsResultSchema,
|
|
408
|
+
'people.get': echoFieldsResultSchema,
|
|
409
|
+
'social.get': echoFieldsResultSchema,
|
|
394
410
|
};
|
|
395
411
|
const emptyItems = {
|
|
396
412
|
type: 'object',
|
|
@@ -417,6 +433,10 @@ export const emptyResultSchemas = {
|
|
|
417
433
|
'youtube.get': socialFieldsResultSchema,
|
|
418
434
|
'linkedin.get': linkedinFieldsResultSchema,
|
|
419
435
|
'news.get': echoFieldsResultSchema,
|
|
436
|
+
'web.get': echoFieldsResultSchema,
|
|
437
|
+
'company.get': echoFieldsResultSchema,
|
|
438
|
+
'people.get': echoFieldsResultSchema,
|
|
439
|
+
'social.get': echoFieldsResultSchema,
|
|
420
440
|
};
|
|
421
441
|
/** Only field-level capabilities deliver confirmed fields while others are still pending. */
|
|
422
442
|
export const PARTIAL_RESULT_CAPABILITIES = Object.keys(FIELD_CAPABILITIES);
|
|
@@ -429,7 +449,7 @@ export function fieldsResultMatches(status, value) {
|
|
|
429
449
|
return false;
|
|
430
450
|
const record = value, echoed = Object.keys(record).filter(key => key !== 'fields');
|
|
431
451
|
return (echoed.length <= 16 &&
|
|
432
|
-
echoed.every(key => /^[a-z][a-z0-9_]{0,31}$/.test(key) && typeof record[key] === 'string' && record[key].length <=
|
|
452
|
+
echoed.every(key => /^[a-z][a-z0-9_]{0,31}$/.test(key) && typeof record[key] === 'string' && record[key].length <= 2048) &&
|
|
433
453
|
matches(fieldsMap, record.fields));
|
|
434
454
|
}
|
|
435
455
|
export function resultMatches(capability, status, value) {
|
package/src/version.js
ADDED