@apify/actors-mcp-server 0.11.6-beta.0 → 0.11.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/actors.d.ts +0 -4
- package/dist/mcp/actors.d.ts.map +1 -1
- package/dist/mcp/actors.js +1 -7
- package/dist/mcp/actors.js.map +1 -1
- package/dist/resources/resource_service.d.ts.map +1 -1
- package/dist/resources/resource_service.js +2 -2
- package/dist/resources/resource_service.js.map +1 -1
- package/dist/resources/widgets.d.ts.map +1 -1
- package/dist/resources/widgets.js +5 -5
- package/dist/resources/widgets.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/actor.d.ts +1 -15
- package/dist/utils/actor.d.ts.map +1 -1
- package/dist/utils/actor.js +0 -62
- package/dist/utils/actor.js.map +1 -1
- package/dist/utils/generic.d.ts +0 -17
- package/dist/utils/generic.d.ts.map +1 -1
- package/dist/utils/generic.js +0 -49
- package/dist/utils/generic.js.map +1 -1
- package/dist/utils/tools.d.ts +0 -10
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +0 -35
- package/dist/utils/tools.js.map +1 -1
- package/dist/web/dist/actor-detail-widget.js +171 -462
- package/dist/web/dist/actor-run-widget.js +189 -480
- package/dist/web/dist/search-actors-widget.js +168 -459
- package/package.json +1 -2
- package/dist/utils/mcp_clients.d.ts +0 -6
- package/dist/utils/mcp_clients.d.ts.map +0 -1
- package/dist/utils/mcp_clients.js +0 -21
- package/dist/utils/mcp_clients.js.map +0 -1
package/dist/utils/actor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ApifyClient } from '../apify_client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ActorDefinitionWithInfo } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the cached Actor definition + info, fetching from the platform on miss
|
|
5
5
|
* and populating the cache on the way back.
|
|
@@ -14,18 +14,4 @@ export declare function getActorDefinitionCached(actorIdOrName: string, apifyCli
|
|
|
14
14
|
* `getActorDefinitionCached` instead of a separate cache that would leak a private Actor's URL across tenants.
|
|
15
15
|
*/
|
|
16
16
|
export declare function getActorMcpUrlCached(actorIdOrName: string, apifyClient: ApifyClient): Promise<string | false>;
|
|
17
|
-
/**
|
|
18
|
-
* Returns an array of all field names mentioned in the display.properties
|
|
19
|
-
* of all views in the given ActorDefinitionStorage object.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getActorDefinitionStorageFieldNames(storage: ActorDefinitionStorage | object): string[];
|
|
22
|
-
/**
|
|
23
|
-
* Ensures the Actor output items are within the character limit.
|
|
24
|
-
*
|
|
25
|
-
* First checks if all items fit into the limit, then tries only the important fields and as a last resort
|
|
26
|
-
* starts removing items until within the limit. In worst scenario return empty array.
|
|
27
|
-
*
|
|
28
|
-
* This is primarily used to ensure the tool output does not exceed the LLM context length or tool output limit.
|
|
29
|
-
*/
|
|
30
|
-
export declare function ensureOutputWithinCharLimit(items: DatasetItem[], importantFields: string[], charLimit: number): DatasetItem[];
|
|
31
17
|
//# sourceMappingURL=actor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../src/utils/actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../src/utils/actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAuB3D;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC1C,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,WAAW,GACzB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAMzC;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAKnH"}
|
package/dist/utils/actor.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getActorMCPServerPath, getActorMCPServerURL } from '../mcp/actors.js';
|
|
2
2
|
import { actorDefinitionCache } from '../state.js';
|
|
3
3
|
import { getActorDefinition } from '../tools/actors/actor_definition.js';
|
|
4
|
-
import { getValuesByDotKeys } from './generic.js';
|
|
5
4
|
import { getUserInfoCached } from './userid_cache.js';
|
|
6
5
|
/**
|
|
7
6
|
* `actorDefinitionCache` is process-wide, so a private Actor's definition must never be served from it to
|
|
@@ -52,65 +51,4 @@ export async function getActorMcpUrlCached(actorIdOrName, apifyClient) {
|
|
|
52
51
|
return false;
|
|
53
52
|
return getActorMCPServerURL(definition.id, mcpPath);
|
|
54
53
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Returns an array of all field names mentioned in the display.properties
|
|
57
|
-
* of all views in the given ActorDefinitionStorage object.
|
|
58
|
-
*/
|
|
59
|
-
export function getActorDefinitionStorageFieldNames(storage) {
|
|
60
|
-
const fieldSet = new Set();
|
|
61
|
-
if ('views' in storage && typeof storage.views === 'object' && storage.views !== null) {
|
|
62
|
-
for (const view of Object.values(storage.views)) {
|
|
63
|
-
// Collect from display.properties
|
|
64
|
-
if (view.display && view.display.properties) {
|
|
65
|
-
Object.keys(view.display.properties).forEach((field) => fieldSet.add(field));
|
|
66
|
-
}
|
|
67
|
-
// Collect from transformation.fields
|
|
68
|
-
if (view.transformation && Array.isArray(view.transformation.fields)) {
|
|
69
|
-
view.transformation.fields.forEach((field) => {
|
|
70
|
-
if (typeof field === 'string')
|
|
71
|
-
fieldSet.add(field);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return Array.from(fieldSet);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Ensures the Actor output items are within the character limit.
|
|
80
|
-
*
|
|
81
|
-
* First checks if all items fit into the limit, then tries only the important fields and as a last resort
|
|
82
|
-
* starts removing items until within the limit. In worst scenario return empty array.
|
|
83
|
-
*
|
|
84
|
-
* This is primarily used to ensure the tool output does not exceed the LLM context length or tool output limit.
|
|
85
|
-
*/
|
|
86
|
-
export function ensureOutputWithinCharLimit(items, importantFields, charLimit) {
|
|
87
|
-
// Check if all items fit into the limit
|
|
88
|
-
const allItemsString = JSON.stringify(items);
|
|
89
|
-
if (allItemsString.length <= charLimit) {
|
|
90
|
-
return items;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Items used for the final fallback - removing items until within the limit.
|
|
94
|
-
* If important fields are defined, use only those fields for that fallback step.
|
|
95
|
-
*/
|
|
96
|
-
let sourceItems = items;
|
|
97
|
-
// Try keeping only the important fields
|
|
98
|
-
if (importantFields.length > 0) {
|
|
99
|
-
const importantItems = items.map((item) => getValuesByDotKeys(item, importantFields));
|
|
100
|
-
const importantItemsString = JSON.stringify(importantItems);
|
|
101
|
-
if (importantItemsString.length <= charLimit) {
|
|
102
|
-
return importantItems;
|
|
103
|
-
}
|
|
104
|
-
sourceItems = importantItems;
|
|
105
|
-
}
|
|
106
|
-
// Start removing items until within the limit
|
|
107
|
-
const result = [];
|
|
108
|
-
for (const item of sourceItems) {
|
|
109
|
-
if (JSON.stringify(result.concat(item)).length > charLimit) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
result.push(item);
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
54
|
//# sourceMappingURL=actor.js.map
|
package/dist/utils/actor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/utils/actor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC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H,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,aAAqB,EAAE,WAAwB;;IACtF,MAAM,UAAU,GAAG,MAAA,CAAC,MAAM,wBAAwB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,0CAAE,UAAU,CAAC;IAC5F,MAAM,OAAO,GAAG,UAAU,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/utils/generic.d.ts
CHANGED
|
@@ -32,17 +32,6 @@ export declare function parseCommaSeparatedList(input?: string): string[];
|
|
|
32
32
|
* parseQueryParamList(undefined); // []
|
|
33
33
|
*/
|
|
34
34
|
export declare function parseQueryParamList(param?: string | string[]): string[];
|
|
35
|
-
/**
|
|
36
|
-
* Recursively gets the value in a nested object for each key in the keys array.
|
|
37
|
-
* Each key can be a dot-separated path (e.g. 'a.b.c').
|
|
38
|
-
* Returns an object mapping each key to its resolved value (or undefined if not found).
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* const obj = { a: { b: { c: 42 } }, nested: { d: 100 } };
|
|
42
|
-
* const value = getValuesByDotKeys(obj, ['a.b.c', 'a.b.d', 'nested']);
|
|
43
|
-
* value; // { 'a.b.c': 42, 'a.b.d': undefined, 'nested': { d: 100 } }
|
|
44
|
-
*/
|
|
45
|
-
export declare function getValuesByDotKeys(obj: Record<string, unknown>, keys: string[]): Record<string, unknown>;
|
|
46
35
|
/**
|
|
47
36
|
* Backtick + straight & smart double-quote chars LLMs wrap user inputs in.
|
|
48
37
|
* Shared between `stripQuoteWrappers` (which also strips apostrophes from ids)
|
|
@@ -53,10 +42,4 @@ export declare const QUOTE_WRAPPER_CHARS = "`\"\u201C\u201D\u2018\u2019";
|
|
|
53
42
|
export declare function stripQuoteWrappers(s: string): string;
|
|
54
43
|
/** Best-effort byte size of a value for summaries. */
|
|
55
44
|
export declare function computeValueBytes(value: unknown): number | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Validates whether a given string is a well-formed URL.
|
|
58
|
-
*
|
|
59
|
-
* Allows only valid HTTP or HTTPS URLs.
|
|
60
|
-
*/
|
|
61
|
-
export declare function isValidHttpUrl(urlString: string): boolean;
|
|
62
45
|
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/utils/generic.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,CAGxF;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAQvE;AAED
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/utils/generic.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,CAGxF;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAQvE;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gCAAW,CAAC;AAW5C,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQpE"}
|
package/dist/utils/generic.js
CHANGED
|
@@ -54,37 +54,6 @@ export function parseQueryParamList(param) {
|
|
|
54
54
|
}
|
|
55
55
|
return parseCommaSeparatedList(param);
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Recursively gets the value in a nested object for each key in the keys array.
|
|
59
|
-
* Each key can be a dot-separated path (e.g. 'a.b.c').
|
|
60
|
-
* Returns an object mapping each key to its resolved value (or undefined if not found).
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* const obj = { a: { b: { c: 42 } }, nested: { d: 100 } };
|
|
64
|
-
* const value = getValuesByDotKeys(obj, ['a.b.c', 'a.b.d', 'nested']);
|
|
65
|
-
* value; // { 'a.b.c': 42, 'a.b.d': undefined, 'nested': { d: 100 } }
|
|
66
|
-
*/
|
|
67
|
-
export function getValuesByDotKeys(obj, keys) {
|
|
68
|
-
const result = {};
|
|
69
|
-
for (const key of keys) {
|
|
70
|
-
const path = key.split('.');
|
|
71
|
-
let current = obj;
|
|
72
|
-
for (const segment of path) {
|
|
73
|
-
if (current !== null &&
|
|
74
|
-
typeof current === 'object' &&
|
|
75
|
-
Object.prototype.hasOwnProperty.call(current, segment)) {
|
|
76
|
-
// Use index signature to avoid 'any' and type errors
|
|
77
|
-
current = current[segment];
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
current = undefined;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
result[key] = current;
|
|
85
|
-
}
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
57
|
/**
|
|
89
58
|
* Backtick + straight & smart double-quote chars LLMs wrap user inputs in.
|
|
90
59
|
* Shared between `stripQuoteWrappers` (which also strips apostrophes from ids)
|
|
@@ -117,22 +86,4 @@ export function computeValueBytes(value) {
|
|
|
117
86
|
return undefined;
|
|
118
87
|
}
|
|
119
88
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Validates whether a given string is a well-formed URL.
|
|
122
|
-
*
|
|
123
|
-
* Allows only valid HTTP or HTTPS URLs.
|
|
124
|
-
*/
|
|
125
|
-
export function isValidHttpUrl(urlString) {
|
|
126
|
-
if (!urlString.startsWith('http://') && !urlString.startsWith('https://')) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
/* eslint-disable no-new */
|
|
131
|
-
new URL(urlString);
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
89
|
//# sourceMappingURL=generic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../src/utils/generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAc,aAAqB,EAAE,YAAoB;IACjF,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAM,CAAC;AAC5D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAc;IAClD,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,KAAK;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC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}
|
package/dist/utils/tools.d.ts
CHANGED
|
@@ -68,15 +68,5 @@ export declare function getToolPublicFieldOnly(tool: ToolBase, options?: ToolPub
|
|
|
68
68
|
* while cloning all other properties to avoid shared state mutations.
|
|
69
69
|
*/
|
|
70
70
|
export declare function cloneToolEntry(toolEntry: ToolEntry): ToolEntry;
|
|
71
|
-
/**
|
|
72
|
-
* Applies Skyfire augmentation to a tool entry.
|
|
73
|
-
* Clones the tool and, if eligible, appends Skyfire instructions to the description
|
|
74
|
-
* and adds a `skyfire-pay-id` property to the input schema.
|
|
75
|
-
*
|
|
76
|
-
* Returns the (possibly augmented) clone if the tool is eligible,
|
|
77
|
-
* or the original tool reference if it is not eligible.
|
|
78
|
-
* Augmentation is idempotent — calling this on an already-augmented clone is safe.
|
|
79
|
-
*/
|
|
80
|
-
export declare function applySkyfireAugmentation(tool: ToolEntry): ToolEntry;
|
|
81
71
|
export {};
|
|
82
72
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/utils/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/utils/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAc,QAAQ,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,WAAW,EAAa,MAAM,aAAa,CAAC;AAGrD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAUvD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAGlE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACjB,IAAI,CAAC,eAAe,EAAE,YAAY,GAAG,UAAU,CAAC,CAKlD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAUpG;AAED,KAAK,sBAAsB,GAAG;IAC1B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AA2BF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe1F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAoB9D"}
|
package/dist/utils/tools.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SKYFIRE_ENABLED_TOOLS, SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION, SKYFIRE_TOOL_INSTRUCTIONS, } from '../payments/const.js';
|
|
2
1
|
import { SERVER_MODE, TOOL_TYPE } from '../types.js';
|
|
3
2
|
import { fixZodSchemaRequired } from './ajv.js';
|
|
4
3
|
/**
|
|
@@ -115,38 +114,4 @@ export function cloneToolEntry(toolEntry) {
|
|
|
115
114
|
}
|
|
116
115
|
return cloned;
|
|
117
116
|
}
|
|
118
|
-
/** Returns true if the tool is eligible for Skyfire augmentation. */
|
|
119
|
-
function isSkyfireEligible(tool) {
|
|
120
|
-
return (tool.type === TOOL_TYPE.ACTOR ||
|
|
121
|
-
(tool.type === TOOL_TYPE.INTERNAL && SKYFIRE_ENABLED_TOOLS.has(tool.name)));
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Applies Skyfire augmentation to a tool entry.
|
|
125
|
-
* Clones the tool and, if eligible, appends Skyfire instructions to the description
|
|
126
|
-
* and adds a `skyfire-pay-id` property to the input schema.
|
|
127
|
-
*
|
|
128
|
-
* Returns the (possibly augmented) clone if the tool is eligible,
|
|
129
|
-
* or the original tool reference if it is not eligible.
|
|
130
|
-
* Augmentation is idempotent — calling this on an already-augmented clone is safe.
|
|
131
|
-
*/
|
|
132
|
-
export function applySkyfireAugmentation(tool) {
|
|
133
|
-
if (!isSkyfireEligible(tool))
|
|
134
|
-
return tool;
|
|
135
|
-
const cloned = cloneToolEntry(tool);
|
|
136
|
-
// Append Skyfire instructions to description (idempotent)
|
|
137
|
-
if (cloned.description && !cloned.description.includes(SKYFIRE_TOOL_INSTRUCTIONS)) {
|
|
138
|
-
cloned.description += `\n\n${SKYFIRE_TOOL_INSTRUCTIONS}`;
|
|
139
|
-
}
|
|
140
|
-
// Add skyfire-pay-id property to inputSchema (idempotent)
|
|
141
|
-
if (cloned.inputSchema && 'properties' in cloned.inputSchema) {
|
|
142
|
-
const props = cloned.inputSchema.properties;
|
|
143
|
-
if (!props['skyfire-pay-id']) {
|
|
144
|
-
props['skyfire-pay-id'] = {
|
|
145
|
-
type: 'string',
|
|
146
|
-
description: SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return Object.freeze(cloned);
|
|
151
|
-
}
|
|
152
117
|
//# sourceMappingURL=tools.js.map
|
package/dist/utils/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/utils/tools.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/utils/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC3C,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,SAAS,CAA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