@once-agent/sdk 0.1.10 → 0.1.12
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/README.md +76 -1
- package/dist/cli.js +50 -1
- package/dist/cli.js.map +1 -1
- package/dist/connect/identity.d.ts +22 -0
- package/dist/connect/identity.d.ts.map +1 -0
- package/dist/connect/identity.js +159 -0
- package/dist/connect/identity.js.map +1 -0
- package/dist/connect/index.d.ts +17 -0
- package/dist/connect/index.d.ts.map +1 -0
- package/dist/connect/index.js +9 -0
- package/dist/connect/index.js.map +1 -0
- package/dist/connect/local-agent-tool.d.ts +62 -0
- package/dist/connect/local-agent-tool.d.ts.map +1 -0
- package/dist/connect/local-agent-tool.js +131 -0
- package/dist/connect/local-agent-tool.js.map +1 -0
- package/dist/connect/manifest.d.ts +55 -0
- package/dist/connect/manifest.d.ts.map +1 -0
- package/dist/connect/manifest.js +166 -0
- package/dist/connect/manifest.js.map +1 -0
- package/dist/connect/openai-function-tools.d.ts +66 -0
- package/dist/connect/openai-function-tools.d.ts.map +1 -0
- package/dist/connect/openai-function-tools.js +182 -0
- package/dist/connect/openai-function-tools.js.map +1 -0
- package/dist/connect/payload.d.ts +30 -0
- package/dist/connect/payload.d.ts.map +1 -0
- package/dist/connect/payload.js +122 -0
- package/dist/connect/payload.js.map +1 -0
- package/dist/connect/tool-classifier.d.ts +40 -0
- package/dist/connect/tool-classifier.d.ts.map +1 -0
- package/dist/connect/tool-classifier.js +271 -0
- package/dist/connect/tool-classifier.js.map +1 -0
- package/dist/connect/toolset.d.ts +42 -0
- package/dist/connect/toolset.d.ts.map +1 -0
- package/dist/connect/toolset.js +123 -0
- package/dist/connect/toolset.js.map +1 -0
- package/dist/discovery/index.d.ts +13 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +8 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/execution-observation.d.ts +122 -0
- package/dist/execution-observation.d.ts.map +1 -0
- package/dist/execution-observation.js +324 -0
- package/dist/execution-observation.js.map +1 -0
- package/dist/gateway/index.d.ts +9 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +5 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/local-toolset.d.ts +32 -0
- package/dist/gateway/local-toolset.d.ts.map +1 -0
- package/dist/gateway/local-toolset.js +79 -0
- package/dist/gateway/local-toolset.js.map +1 -0
- package/dist/gateway/openai-function-tools.d.ts +28 -0
- package/dist/gateway/openai-function-tools.d.ts.map +1 -0
- package/dist/gateway/openai-function-tools.js +117 -0
- package/dist/gateway/openai-function-tools.js.map +1 -0
- package/dist/gateway/planner.d.ts +53 -0
- package/dist/gateway/planner.d.ts.map +1 -0
- package/dist/gateway/planner.js +155 -0
- package/dist/gateway/planner.js.map +1 -0
- package/dist/gateway/tool-graph-binding.d.ts +51 -0
- package/dist/gateway/tool-graph-binding.d.ts.map +1 -0
- package/dist/gateway/tool-graph-binding.js +123 -0
- package/dist/gateway/tool-graph-binding.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/langchain-execution-observer.d.ts +22 -0
- package/dist/langchain-execution-observer.d.ts.map +1 -0
- package/dist/langchain-execution-observer.js +128 -0
- package/dist/langchain-execution-observer.js.map +1 -0
- package/dist/langchain-runtime-discovery.d.ts +33 -0
- package/dist/langchain-runtime-discovery.d.ts.map +1 -0
- package/dist/langchain-runtime-discovery.js +214 -0
- package/dist/langchain-runtime-discovery.js.map +1 -0
- package/dist/mcp-live-discovery.d.ts +71 -0
- package/dist/mcp-live-discovery.d.ts.map +1 -0
- package/dist/mcp-live-discovery.js +710 -0
- package/dist/mcp-live-discovery.js.map +1 -0
- package/dist/mcp-live-report.d.ts +3 -0
- package/dist/mcp-live-report.d.ts.map +1 -0
- package/dist/mcp-live-report.js +50 -0
- package/dist/mcp-live-report.js.map +1 -0
- package/dist/mcp-tool-refresh-report.d.ts +3 -0
- package/dist/mcp-tool-refresh-report.d.ts.map +1 -0
- package/dist/mcp-tool-refresh-report.js +44 -0
- package/dist/mcp-tool-refresh-report.js.map +1 -0
- package/dist/mcp-tool-refresh.d.ts +33 -0
- package/dist/mcp-tool-refresh.d.ts.map +1 -0
- package/dist/mcp-tool-refresh.js +489 -0
- package/dist/mcp-tool-refresh.js.map +1 -0
- package/dist/openai-agents-execution-observer.d.ts +24 -0
- package/dist/openai-agents-execution-observer.d.ts.map +1 -0
- package/dist/openai-agents-execution-observer.js +163 -0
- package/dist/openai-agents-execution-observer.js.map +1 -0
- package/dist/otel-execution-observer.d.ts +16 -0
- package/dist/otel-execution-observer.d.ts.map +1 -0
- package/dist/otel-execution-observer.js +129 -0
- package/dist/otel-execution-observer.js.map +1 -0
- package/dist/runtime-tool-discovery.d.ts +86 -0
- package/dist/runtime-tool-discovery.d.ts.map +1 -0
- package/dist/runtime-tool-discovery.js +429 -0
- package/dist/runtime-tool-discovery.js.map +1 -0
- package/dist/tool-discovery.d.ts +51 -0
- package/dist/tool-discovery.d.ts.map +1 -0
- package/dist/tool-discovery.js +487 -0
- package/dist/tool-discovery.js.map +1 -0
- package/dist/tool-importance.d.ts +34 -0
- package/dist/tool-importance.d.ts.map +1 -0
- package/dist/tool-importance.js +269 -0
- package/dist/tool-importance.js.map +1 -0
- package/dist/tool-report.d.ts +3 -0
- package/dist/tool-report.d.ts.map +1 -0
- package/dist/tool-report.js +75 -0
- package/dist/tool-report.js.map +1 -0
- package/dist/vercel-execution-observer.d.ts +12 -0
- package/dist/vercel-execution-observer.d.ts.map +1 -0
- package/dist/vercel-execution-observer.js +97 -0
- package/dist/vercel-execution-observer.js.map +1 -0
- package/dist-cjs/connect/identity.js +162 -0
- package/dist-cjs/connect/identity.js.map +1 -0
- package/dist-cjs/connect/index.js +26 -0
- package/dist-cjs/connect/index.js.map +1 -0
- package/dist-cjs/connect/local-agent-tool.js +137 -0
- package/dist-cjs/connect/local-agent-tool.js.map +1 -0
- package/dist-cjs/connect/manifest.js +171 -0
- package/dist-cjs/connect/manifest.js.map +1 -0
- package/dist-cjs/connect/openai-function-tools.js +187 -0
- package/dist-cjs/connect/openai-function-tools.js.map +1 -0
- package/dist-cjs/connect/payload.js +125 -0
- package/dist-cjs/connect/payload.js.map +1 -0
- package/dist-cjs/connect/tool-classifier.js +276 -0
- package/dist-cjs/connect/tool-classifier.js.map +1 -0
- package/dist-cjs/connect/toolset.js +126 -0
- package/dist-cjs/connect/toolset.js.map +1 -0
- package/dist-cjs/discovery/index.js +26 -0
- package/dist-cjs/discovery/index.js.map +1 -0
- package/dist-cjs/execution-observation.js +330 -0
- package/dist-cjs/execution-observation.js.map +1 -0
- package/dist-cjs/gateway/index.js +16 -0
- package/dist-cjs/gateway/index.js.map +1 -0
- package/dist-cjs/gateway/local-toolset.js +84 -0
- package/dist-cjs/gateway/local-toolset.js.map +1 -0
- package/dist-cjs/gateway/openai-function-tools.js +120 -0
- package/dist-cjs/gateway/openai-function-tools.js.map +1 -0
- package/dist-cjs/gateway/planner.js +160 -0
- package/dist-cjs/gateway/planner.js.map +1 -0
- package/dist-cjs/gateway/tool-graph-binding.js +126 -0
- package/dist-cjs/gateway/tool-graph-binding.js.map +1 -0
- package/dist-cjs/index.js +4 -1
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/langchain-execution-observer.js +131 -0
- package/dist-cjs/langchain-execution-observer.js.map +1 -0
- package/dist-cjs/langchain-runtime-discovery.js +218 -0
- package/dist-cjs/langchain-runtime-discovery.js.map +1 -0
- package/dist-cjs/openai-agents-execution-observer.js +166 -0
- package/dist-cjs/openai-agents-execution-observer.js.map +1 -0
- package/dist-cjs/otel-execution-observer.js +132 -0
- package/dist-cjs/otel-execution-observer.js.map +1 -0
- package/dist-cjs/runtime-tool-discovery.js +436 -0
- package/dist-cjs/runtime-tool-discovery.js.map +1 -0
- package/dist-cjs/tool-importance.js +272 -0
- package/dist-cjs/tool-importance.js.map +1 -0
- package/dist-cjs/vercel-execution-observer.js +100 -0
- package/dist-cjs/vercel-execution-observer.js.map +1 -0
- package/package.json +25 -3
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
const evidenceAdjustment = {
|
|
2
|
+
EXECUTED: 15,
|
|
3
|
+
MODEL_VISIBLE: 10,
|
|
4
|
+
RUNTIME_REGISTERED: 7,
|
|
5
|
+
SERVER_AUTHORITATIVE: 4,
|
|
6
|
+
HOST_CONFIGURED: 2,
|
|
7
|
+
SOURCE_DISCOVERED: 0,
|
|
8
|
+
REGISTRY_CANDIDATE: -30
|
|
9
|
+
};
|
|
10
|
+
const protectionAdjustment = {
|
|
11
|
+
NONE: 10,
|
|
12
|
+
NATIVE_IDEMPOTENCY: -5,
|
|
13
|
+
AUTHORITATIVE_RECONCILIATION: -15,
|
|
14
|
+
ONCE_HEALTHY: -35,
|
|
15
|
+
ONCE_UNVERIFIED: 0
|
|
16
|
+
};
|
|
17
|
+
function clamp(value, minimum = 0, maximum = 100) {
|
|
18
|
+
return Math.max(minimum, Math.min(maximum, value));
|
|
19
|
+
}
|
|
20
|
+
function criticalityBand(score) {
|
|
21
|
+
if (score >= 85)
|
|
22
|
+
return "I5";
|
|
23
|
+
if (score >= 70)
|
|
24
|
+
return "I4";
|
|
25
|
+
if (score >= 50)
|
|
26
|
+
return "I3";
|
|
27
|
+
if (score >= 30)
|
|
28
|
+
return "I2";
|
|
29
|
+
if (score >= 10)
|
|
30
|
+
return "I1";
|
|
31
|
+
return "I0";
|
|
32
|
+
}
|
|
33
|
+
function actionBand(score) {
|
|
34
|
+
if (score >= 95)
|
|
35
|
+
return "CRITICAL_GAP";
|
|
36
|
+
if (score >= 80)
|
|
37
|
+
return "PROTECT_PRIORITY";
|
|
38
|
+
if (score >= 60)
|
|
39
|
+
return "QUALIFY";
|
|
40
|
+
if (score >= 40)
|
|
41
|
+
return "REVIEW";
|
|
42
|
+
if (score >= 20)
|
|
43
|
+
return "OBSERVE";
|
|
44
|
+
return "BYPASS";
|
|
45
|
+
}
|
|
46
|
+
function inferredQualification(effectClass) {
|
|
47
|
+
switch (effectClass) {
|
|
48
|
+
case "READ_ONLY":
|
|
49
|
+
case "GENERATION_ONLY":
|
|
50
|
+
return "NOT_APPLICABLE";
|
|
51
|
+
case "UNKNOWN":
|
|
52
|
+
case "DYNAMIC_EXECUTION":
|
|
53
|
+
return "UNKNOWN";
|
|
54
|
+
case "LOCAL_MUTATION":
|
|
55
|
+
return "UNLIKELY";
|
|
56
|
+
default:
|
|
57
|
+
return "REVIEW_REQUIRED";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function inferEffect(input) {
|
|
61
|
+
const text = [
|
|
62
|
+
input.name,
|
|
63
|
+
input.description ?? "",
|
|
64
|
+
input.sourceCategory ?? ""
|
|
65
|
+
].join(" ").toLowerCase();
|
|
66
|
+
if (input.readOnlyHint === true) {
|
|
67
|
+
return {
|
|
68
|
+
effectClass: "READ_ONLY",
|
|
69
|
+
base: 5,
|
|
70
|
+
confidence: 0.78,
|
|
71
|
+
reasons: ["read_only_hint"]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (/terraform\s*(destroy|apply)|kubectl.*(?:delete|apply)|destroy.*(?:prod|production)|(?:prod|production).*(?:destroy|delete|purge|drop)/.test(text)) {
|
|
75
|
+
return {
|
|
76
|
+
effectClass: "DESTRUCTIVE_ADMIN",
|
|
77
|
+
base: 95,
|
|
78
|
+
confidence: 0.94,
|
|
79
|
+
reasons: ["destructive_production_operation"]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (/refund|charge|payment|payout|transfer|capture.*(?:card|payment)|money|financial/.test(text)) {
|
|
83
|
+
return {
|
|
84
|
+
effectClass: "MONEY_MOVEMENT",
|
|
85
|
+
base: 90,
|
|
86
|
+
confidence: 0.93,
|
|
87
|
+
reasons: ["money_movement"]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (/grant.*(?:admin|role|permission)|revoke.*(?:access|role|permission)|rotate.*(?:key|credential|secret)|deleteuser|disableuser|identity|iam|security policy|account mutation/.test(text)) {
|
|
91
|
+
return {
|
|
92
|
+
effectClass: "IDENTITY_ACCESS_SECURITY",
|
|
93
|
+
base: 90,
|
|
94
|
+
confidence: 0.9,
|
|
95
|
+
reasons: ["identity_access_security_change"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (/deploy|production|terraform|kubectl|helm|cloudformation|dns|infrastructure/.test(text)) {
|
|
99
|
+
return {
|
|
100
|
+
effectClass: "PRODUCTION_INFRASTRUCTURE",
|
|
101
|
+
base: 85,
|
|
102
|
+
confidence: 0.84,
|
|
103
|
+
reasons: ["production_or_infrastructure_change"]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (/merge.*pull|pull.*merge|git.*push|create.*tag|publish.*release|repository|github.*(?:create|update|delete)|code_repository/.test(text)) {
|
|
107
|
+
return {
|
|
108
|
+
effectClass: "CODE_REPOSITORY_MUTATION",
|
|
109
|
+
base: 72,
|
|
110
|
+
confidence: 0.82,
|
|
111
|
+
reasons: ["code_repository_mutation"]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (/database|prisma|insert|upsert|sql.*(?:update|delete|insert)|delete.*record|update.*record/.test(text)) {
|
|
115
|
+
return {
|
|
116
|
+
effectClass: "DATABASE_MUTATION",
|
|
117
|
+
base: 62,
|
|
118
|
+
confidence: 0.82,
|
|
119
|
+
reasons: ["database_mutation"]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (/queue|kafka|sns|sqs|pubsub|enqueue|publish.*event|event publication/.test(text)) {
|
|
123
|
+
return {
|
|
124
|
+
effectClass: "QUEUE_EVENT_MUTATION",
|
|
125
|
+
base: 60,
|
|
126
|
+
confidence: 0.82,
|
|
127
|
+
reasons: ["queue_or_event_mutation"]
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (/sendmail|sendemail|sendmessage|sendsms|postmessage|email|sms|slack|teams|discord|messaging/.test(text)) {
|
|
131
|
+
return {
|
|
132
|
+
effectClass: "EXTERNAL_COMMUNICATION",
|
|
133
|
+
base: 55,
|
|
134
|
+
confidence: 0.88,
|
|
135
|
+
reasons: ["external_communication"]
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (/booking|reservation|appointment|order mutation|createorder|cancelorder|business mutation/.test(text)) {
|
|
139
|
+
return {
|
|
140
|
+
effectClass: "EXTERNAL_BUSINESS_MUTATION",
|
|
141
|
+
base: 65,
|
|
142
|
+
confidence: 0.86,
|
|
143
|
+
reasons: ["external_business_mutation"]
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (/putobject|deleteobject|uploadfile|uploadobject|object storage|blob/.test(text)) {
|
|
147
|
+
return {
|
|
148
|
+
effectClass: "STORAGE_MUTATION",
|
|
149
|
+
base: 50,
|
|
150
|
+
confidence: 0.82,
|
|
151
|
+
reasons: ["storage_mutation"]
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (/writefile|appendfile|unlink|rename|local filesystem|file_write/.test(text)) {
|
|
155
|
+
return {
|
|
156
|
+
effectClass: "LOCAL_MUTATION",
|
|
157
|
+
base: 25,
|
|
158
|
+
confidence: 0.86,
|
|
159
|
+
reasons: ["local_mutation"]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (/http_write|http_delete|http request|shell|computer|browser|code execution|execute command/.test(text)) {
|
|
163
|
+
return {
|
|
164
|
+
effectClass: "DYNAMIC_EXECUTION",
|
|
165
|
+
base: 55,
|
|
166
|
+
confidence: 0.58,
|
|
167
|
+
reasons: ["dynamic_or_generic_execution"]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (/\b(get|list|read|search|fetch|lookup|inspect|query)\b|read_only/.test(text)) {
|
|
171
|
+
return {
|
|
172
|
+
effectClass: "READ_ONLY",
|
|
173
|
+
base: 4,
|
|
174
|
+
confidence: 0.66,
|
|
175
|
+
reasons: ["read_semantics"]
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (/summar|generate|reason|classify|translate|generation/.test(text)) {
|
|
179
|
+
return {
|
|
180
|
+
effectClass: "GENERATION_ONLY",
|
|
181
|
+
base: 4,
|
|
182
|
+
confidence: 0.64,
|
|
183
|
+
reasons: ["generation_semantics"]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
effectClass: "UNKNOWN",
|
|
188
|
+
base: 50,
|
|
189
|
+
confidence: 0.25,
|
|
190
|
+
reasons: ["insufficient_effect_evidence"]
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export function assessToolImportance(input) {
|
|
194
|
+
const inferred = inferEffect(input);
|
|
195
|
+
const text = [
|
|
196
|
+
input.name,
|
|
197
|
+
input.description ?? "",
|
|
198
|
+
input.sourceCategory ?? ""
|
|
199
|
+
].join(" ").toLowerCase();
|
|
200
|
+
let criticality = inferred.base;
|
|
201
|
+
const criticalityReasons = [...inferred.reasons];
|
|
202
|
+
if (inferred.effectClass !== "READ_ONLY" &&
|
|
203
|
+
inferred.effectClass !== "GENERATION_ONLY" &&
|
|
204
|
+
/irreversible|destructive|destroy|purge|terminate|drop\b/.test(text)) {
|
|
205
|
+
criticality += 15;
|
|
206
|
+
criticalityReasons.push("irreversible_or_destructive");
|
|
207
|
+
}
|
|
208
|
+
if (/bulk|batch|all records|multi-record/.test(text)) {
|
|
209
|
+
criticality += 10;
|
|
210
|
+
criticalityReasons.push("bulk_scope");
|
|
211
|
+
}
|
|
212
|
+
if (inferred.effectClass === "QUEUE_EVENT_MUTATION") {
|
|
213
|
+
criticality += 8;
|
|
214
|
+
criticalityReasons.push("downstream_fanout");
|
|
215
|
+
}
|
|
216
|
+
criticality = clamp(criticality);
|
|
217
|
+
const qualification = input.qualification ??
|
|
218
|
+
inferredQualification(inferred.effectClass);
|
|
219
|
+
const protection = input.protection ?? "NONE";
|
|
220
|
+
let priority = criticality +
|
|
221
|
+
evidenceAdjustment[input.evidence] +
|
|
222
|
+
protectionAdjustment[protection];
|
|
223
|
+
const actionReasons = [
|
|
224
|
+
`evidence_${input.evidence.toLowerCase()}`,
|
|
225
|
+
`protection_${protection.toLowerCase()}`
|
|
226
|
+
];
|
|
227
|
+
switch (qualification) {
|
|
228
|
+
case "QUALIFIED":
|
|
229
|
+
priority += 15;
|
|
230
|
+
actionReasons.push("once_qualified");
|
|
231
|
+
break;
|
|
232
|
+
case "REVIEW_REQUIRED":
|
|
233
|
+
priority += 5;
|
|
234
|
+
actionReasons.push("qualification_review_required");
|
|
235
|
+
break;
|
|
236
|
+
case "UNKNOWN":
|
|
237
|
+
priority += 5;
|
|
238
|
+
actionReasons.push("qualification_unknown");
|
|
239
|
+
break;
|
|
240
|
+
case "UNLIKELY":
|
|
241
|
+
priority -= 20;
|
|
242
|
+
actionReasons.push("once_unlikely");
|
|
243
|
+
break;
|
|
244
|
+
case "NOT_APPLICABLE":
|
|
245
|
+
priority = Math.min(priority, 15);
|
|
246
|
+
actionReasons.push("once_not_applicable");
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
priority = clamp(priority);
|
|
250
|
+
return {
|
|
251
|
+
effectClass: inferred.effectClass,
|
|
252
|
+
criticality: {
|
|
253
|
+
score: criticality,
|
|
254
|
+
band: criticalityBand(criticality),
|
|
255
|
+
confidence: inferred.confidence,
|
|
256
|
+
reasons: criticalityReasons
|
|
257
|
+
},
|
|
258
|
+
qualification,
|
|
259
|
+
actionPriority: {
|
|
260
|
+
score: priority,
|
|
261
|
+
band: actionBand(priority),
|
|
262
|
+
reasons: actionReasons
|
|
263
|
+
},
|
|
264
|
+
protection,
|
|
265
|
+
protectedCritical: protection === "ONCE_HEALTHY" &&
|
|
266
|
+
criticality >= 70
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=tool-importance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-importance.js","sourceRoot":"","sources":["../src/tool-importance.ts"],"names":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,EAAE,UAAU,CAAC,QAAQ,CAAC;YAC1B,OAAO,EAAE,aAAa;SACvB;QACD,UAAU;QACV,iBAAiB,EACf,UAAU,KAAK,cAAc;YAC7B,WAAW,IAAI,EAAE;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-report.d.ts","sourceRoot":"","sources":["../src/tool-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,qBAAqB,CAAC;AAiD7B,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,GAC1B,IAAI,CAuGN"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
function printConfiguredSource(source) {
|
|
2
|
+
console.log(` ${source.scope.padEnd(7)} ${source.host}/${source.name} ${source.transport} ${source.status}`);
|
|
3
|
+
console.log(` ${source.configPath}`);
|
|
4
|
+
}
|
|
5
|
+
function printTool(tool) {
|
|
6
|
+
const priority = tool.once.actionPriority.score
|
|
7
|
+
.toString()
|
|
8
|
+
.padStart(3, " ");
|
|
9
|
+
const importance = tool.once.criticality.band;
|
|
10
|
+
console.log(` ${priority} ${importance} ${tool.canonicalName} ${tool.evidence.level} ${tool.once.qualification}`);
|
|
11
|
+
console.log(` ${tool.once.effectClass} · ${tool.source.file}${tool.source.line ? `:${tool.source.line}` : ""}`);
|
|
12
|
+
}
|
|
13
|
+
function section(title, tools) {
|
|
14
|
+
if (tools.length === 0) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
console.log("");
|
|
18
|
+
console.log(title);
|
|
19
|
+
console.log("-".repeat(title.length));
|
|
20
|
+
for (const tool of tools) {
|
|
21
|
+
printTool(tool);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function printToolDiscoveryReport(result) {
|
|
25
|
+
console.log("");
|
|
26
|
+
console.log("TOOL DISCOVERY");
|
|
27
|
+
console.log("--------------");
|
|
28
|
+
console.log("Mode: local + read-only");
|
|
29
|
+
console.log("External MCP servers contacted: no");
|
|
30
|
+
console.log("Unknown local server commands launched: no");
|
|
31
|
+
console.log("Secret values retained: no");
|
|
32
|
+
console.log(`Configured MCP sources: ${result.configuredSources.length}`);
|
|
33
|
+
console.log(`Source-discovered tools/capabilities: ${result.tools.length}`);
|
|
34
|
+
if (result.configuredSources.length > 0) {
|
|
35
|
+
console.log("");
|
|
36
|
+
console.log("CONFIGURED TOOL SOURCES");
|
|
37
|
+
console.log("-----------------------");
|
|
38
|
+
for (const source of result.configuredSources) {
|
|
39
|
+
printConfiguredSource(source);
|
|
40
|
+
}
|
|
41
|
+
console.log("");
|
|
42
|
+
console.log("Configured servers are not treated as authoritative tool inventories until a later trusted tools/list probe.");
|
|
43
|
+
}
|
|
44
|
+
console.log("");
|
|
45
|
+
console.log("TOOL SAFETY PRIORITY");
|
|
46
|
+
console.log("--------------------");
|
|
47
|
+
if (result.tools.length === 0) {
|
|
48
|
+
console.log("No source-level tool or consequential-operation candidates were discovered.");
|
|
49
|
+
console.log("This does not prove the environment has no tools; runtime and authoritative MCP discovery are later phases.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const criticalGaps = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
53
|
+
tool.once.actionPriority.band === "CRITICAL_GAP");
|
|
54
|
+
const highPriority = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
55
|
+
tool.once.actionPriority.band === "PROTECT_PRIORITY");
|
|
56
|
+
const qualify = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
57
|
+
tool.once.actionPriority.band === "QUALIFY");
|
|
58
|
+
const review = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
59
|
+
tool.once.actionPriority.band === "REVIEW");
|
|
60
|
+
const observe = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
61
|
+
tool.once.actionPriority.band === "OBSERVE");
|
|
62
|
+
const bypass = result.tools.filter(tool => !tool.once.protectedCritical &&
|
|
63
|
+
tool.once.actionPriority.band === "BYPASS");
|
|
64
|
+
const protectedCritical = result.tools.filter(tool => tool.once.protectedCritical);
|
|
65
|
+
section("CRITICAL GAPS", criticalGaps);
|
|
66
|
+
section("HIGH PRIORITY", highPriority);
|
|
67
|
+
section("QUALIFY", qualify);
|
|
68
|
+
section("REVIEW", review);
|
|
69
|
+
section("OBSERVE", observe);
|
|
70
|
+
section("BYPASS / READ-ONLY", bypass);
|
|
71
|
+
section("PROTECTED CRITICAL", protectedCritical);
|
|
72
|
+
console.log("");
|
|
73
|
+
console.log("Importance orders attention only. It does not authorize execution or protection. The Once four-condition test remains the qualification gate.");
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=tool-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-report.js","sourceRoot":"","sources":["../src/tool-report.ts"],"names":[],"mappings":"AAMA,SAAS,qBAAqB,CAC5B,MAA4B;IAE5B,OAAO,CAAC,GAAG,CACT,KAAK,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,MAAM,EAAE,CACnG,CAAC;IACF,OAAO,CAAC,GAAG,CACT,cAAc,MAAM,CAAC,UAAU,EAAE,CAClC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAChB,IAAqB;IAErB,MAAM,QAAQ,GACZ,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK;SAC3B,QAAQ,EAAE;SACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEtB,MAAM,UAAU,GACd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAE7B,OAAO,CAAC,GAAG,CACT,KAAK,QAAQ,KAAK,UAAU,KAAK,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC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AC;IAEjD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CACT,+IAA+I,CAChJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ToolExecutionObservation } from "./execution-observation.js";
|
|
2
|
+
import type { VercelAiSdkModelVisibleToolSnapshot } from "./runtime-tool-discovery.js";
|
|
3
|
+
/**
|
|
4
|
+
* Convert an already-emitted Vercel AI SDK step result into Once EXECUTED
|
|
5
|
+
* observations. This helper never calls a model, provider, tool or callback.
|
|
6
|
+
*
|
|
7
|
+
* Only entries present in `toolResults` establish execution evidence. A
|
|
8
|
+
* `toolCalls` entry without a result is model intent, not proof of execution.
|
|
9
|
+
* Tool arguments and tool results are deliberately ignored.
|
|
10
|
+
*/
|
|
11
|
+
export declare function observeVercelAiSdkStepExecutions(stepResult: unknown, visibleSnapshot: VercelAiSdkModelVisibleToolSnapshot): readonly ToolExecutionObservation[];
|
|
12
|
+
//# sourceMappingURL=vercel-execution-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-execution-observer.d.ts","sourceRoot":"","sources":["../src/vercel-execution-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAEV,mCAAmC,EACpC,MAAM,6BAA6B,CAAC;AAwDrC;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,OAAO,EACnB,eAAe,EAAE,mCAAmC,GACnD,SAAS,wBAAwB,EAAE,CA6CrC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { executionToolFingerprint, observeToolExecution, } from "./execution-observation.js";
|
|
2
|
+
function asRecord(value) {
|
|
3
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
4
|
+
? value
|
|
5
|
+
: undefined;
|
|
6
|
+
}
|
|
7
|
+
function ownDataValue(value, key) {
|
|
8
|
+
const record = asRecord(value);
|
|
9
|
+
if (!record)
|
|
10
|
+
return undefined;
|
|
11
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
12
|
+
return descriptor && "value" in descriptor
|
|
13
|
+
? descriptor.value
|
|
14
|
+
: undefined;
|
|
15
|
+
}
|
|
16
|
+
function ownString(value, key) {
|
|
17
|
+
const raw = ownDataValue(value, key);
|
|
18
|
+
return typeof raw === "string" && raw.trim() !== ""
|
|
19
|
+
? raw
|
|
20
|
+
: undefined;
|
|
21
|
+
}
|
|
22
|
+
function arrayData(value, key) {
|
|
23
|
+
const raw = ownDataValue(value, key);
|
|
24
|
+
return Array.isArray(raw) ? raw : [];
|
|
25
|
+
}
|
|
26
|
+
function toolMap(snapshot) {
|
|
27
|
+
const map = new Map();
|
|
28
|
+
for (const tool of snapshot.tools) {
|
|
29
|
+
const current = map.get(tool.canonicalName);
|
|
30
|
+
if (current === undefined) {
|
|
31
|
+
map.set(tool.canonicalName, tool);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Fail closed if a malformed/custom snapshot contains duplicate names.
|
|
35
|
+
map.set(tool.canonicalName, null);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return map;
|
|
39
|
+
}
|
|
40
|
+
function statusFromResult(result) {
|
|
41
|
+
const isError = ownDataValue(result, "isError");
|
|
42
|
+
if (isError === true)
|
|
43
|
+
return "FAILED";
|
|
44
|
+
if (isError === false)
|
|
45
|
+
return "SUCCEEDED";
|
|
46
|
+
return "UNKNOWN";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convert an already-emitted Vercel AI SDK step result into Once EXECUTED
|
|
50
|
+
* observations. This helper never calls a model, provider, tool or callback.
|
|
51
|
+
*
|
|
52
|
+
* Only entries present in `toolResults` establish execution evidence. A
|
|
53
|
+
* `toolCalls` entry without a result is model intent, not proof of execution.
|
|
54
|
+
* Tool arguments and tool results are deliberately ignored.
|
|
55
|
+
*/
|
|
56
|
+
export function observeVercelAiSdkStepExecutions(stepResult, visibleSnapshot) {
|
|
57
|
+
const visible = toolMap(visibleSnapshot);
|
|
58
|
+
const calls = arrayData(stepResult, "toolCalls");
|
|
59
|
+
const results = arrayData(stepResult, "toolResults");
|
|
60
|
+
const callNameById = new Map();
|
|
61
|
+
for (const call of calls) {
|
|
62
|
+
const toolCallId = ownString(call, "toolCallId");
|
|
63
|
+
const toolName = ownString(call, "toolName");
|
|
64
|
+
if (toolCallId && toolName) {
|
|
65
|
+
callNameById.set(toolCallId, toolName);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const observations = [];
|
|
69
|
+
const now = new Date().toISOString();
|
|
70
|
+
for (const result of results) {
|
|
71
|
+
const toolCallId = ownString(result, "toolCallId");
|
|
72
|
+
const explicitName = ownString(result, "toolName");
|
|
73
|
+
const toolName = explicitName ?? (toolCallId ? callNameById.get(toolCallId) : undefined);
|
|
74
|
+
if (!toolName)
|
|
75
|
+
continue;
|
|
76
|
+
const tool = visible.get(toolName);
|
|
77
|
+
if (!tool)
|
|
78
|
+
continue;
|
|
79
|
+
const observed = observeToolExecution({
|
|
80
|
+
...(toolCallId ? { eventId: `vercel-tool-call:${toolCallId}` } : {}),
|
|
81
|
+
toolId: tool.toolId,
|
|
82
|
+
namespacedName: tool.namespacedName,
|
|
83
|
+
descriptorFingerprint: executionToolFingerprint(tool),
|
|
84
|
+
canonicalName: tool.canonicalName,
|
|
85
|
+
framework: "vercel-ai-sdk",
|
|
86
|
+
runtimeName: visibleSnapshot.runtimeName,
|
|
87
|
+
source: "framework_callback",
|
|
88
|
+
status: statusFromResult(result),
|
|
89
|
+
observedAt: now,
|
|
90
|
+
});
|
|
91
|
+
if (observed.accepted) {
|
|
92
|
+
observations.push(observed.event);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return Object.freeze(observations);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=vercel-execution-observer.js.map
|
|
@@ -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AC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveConnectToolOperationIdentity = resolveConnectToolOperationIdentity;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const binding_js_1 = require("./binding.js");
|
|
6
|
+
const INPUT_FIELDS = [
|
|
7
|
+
{ key: "once_operation_id", source: "input:once_operation_id" },
|
|
8
|
+
{ key: "onceOperationId", source: "input:onceOperationId" },
|
|
9
|
+
{ key: "operation_id", source: "input:operation_id" },
|
|
10
|
+
{ key: "operationId", source: "input:operationId" },
|
|
11
|
+
{ key: "idempotency_key", source: "input:idempotency_key" },
|
|
12
|
+
{ key: "idempotencyKey", source: "input:idempotencyKey" },
|
|
13
|
+
{ key: "intent_id", source: "input:intent_id" },
|
|
14
|
+
{ key: "intentId", source: "input:intentId" },
|
|
15
|
+
{ key: "intent_key", source: "input:intent_key" },
|
|
16
|
+
{ key: "intentKey", source: "input:intentKey" },
|
|
17
|
+
];
|
|
18
|
+
function cleanString(value) {
|
|
19
|
+
if (typeof value !== "string") {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const cleaned = value.trim();
|
|
23
|
+
return cleaned.length > 0 ? cleaned : null;
|
|
24
|
+
}
|
|
25
|
+
function plainObject(value) {
|
|
26
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const objectValue = value;
|
|
30
|
+
const prototype = Object.getPrototypeOf(objectValue);
|
|
31
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return objectValue;
|
|
35
|
+
}
|
|
36
|
+
function metadataIdentityFields(tool) {
|
|
37
|
+
const meta = plainObject(tool._meta);
|
|
38
|
+
if (!meta) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const once = plainObject(meta.once);
|
|
42
|
+
if (!once || !Array.isArray(once.identityFields)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const fields = once.identityFields;
|
|
46
|
+
if (fields.length === 0 ||
|
|
47
|
+
fields.some(field => typeof field !== "string" ||
|
|
48
|
+
field.trim().length === 0 ||
|
|
49
|
+
field.includes("."))) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return Object.freeze(fields.map(field => field.trim()));
|
|
53
|
+
}
|
|
54
|
+
function metadataIdentityCandidate(tool, input) {
|
|
55
|
+
const fields = metadataIdentityFields(tool);
|
|
56
|
+
if (!fields) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const identity = {};
|
|
60
|
+
for (const field of fields) {
|
|
61
|
+
if (!(field in input)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const value = input[field];
|
|
65
|
+
if (value === undefined) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
identity[field] = value;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
return {
|
|
72
|
+
source: "meta:identity_fields",
|
|
73
|
+
value: (0, binding_js_1.canonicalizeConnectPayload)(identity),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function buildOperationId(toolName, identity) {
|
|
81
|
+
const hash = (0, node_crypto_1.createHash)("sha256");
|
|
82
|
+
hash.update("once-connect-id-v1\u0000", "utf8");
|
|
83
|
+
for (const value of [toolName, identity]) {
|
|
84
|
+
const bytes = Buffer.from(value, "utf8");
|
|
85
|
+
const length = Buffer.allocUnsafe(4);
|
|
86
|
+
length.writeUInt32BE(bytes.length, 0);
|
|
87
|
+
hash.update(length);
|
|
88
|
+
hash.update(bytes);
|
|
89
|
+
}
|
|
90
|
+
const prefix = toolName
|
|
91
|
+
.toLowerCase()
|
|
92
|
+
.replace(/[^a-z0-9._:-]+/g, "-")
|
|
93
|
+
.replace(/^[^a-z0-9]+/, "")
|
|
94
|
+
.replace(/-+$/g, "")
|
|
95
|
+
.slice(0, 48) || "tool";
|
|
96
|
+
return `${prefix}:${hash.digest("hex").slice(0, 32)}`;
|
|
97
|
+
}
|
|
98
|
+
function resolveConnectToolOperationIdentity(request) {
|
|
99
|
+
if (!request ||
|
|
100
|
+
!request.tool ||
|
|
101
|
+
typeof request.tool.name !== "string" ||
|
|
102
|
+
request.tool.name.trim().length === 0) {
|
|
103
|
+
return Object.freeze({
|
|
104
|
+
status: "REQUIRED",
|
|
105
|
+
reason: "A stable tool name is required before operation identity can be resolved.",
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const input = plainObject(request.input);
|
|
109
|
+
if (!input) {
|
|
110
|
+
return Object.freeze({
|
|
111
|
+
status: "REQUIRED",
|
|
112
|
+
reason: "Parsed plain-object tool input is required before operation identity can be resolved.",
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const candidates = [];
|
|
116
|
+
const explicit = cleanString(request.explicitIdentity);
|
|
117
|
+
if (explicit) {
|
|
118
|
+
candidates.push({
|
|
119
|
+
source: "explicit",
|
|
120
|
+
value: explicit,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
for (const field of INPUT_FIELDS) {
|
|
124
|
+
const value = cleanString(input[field.key]);
|
|
125
|
+
if (value) {
|
|
126
|
+
candidates.push({
|
|
127
|
+
source: field.source,
|
|
128
|
+
value,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (candidates.length > 0) {
|
|
133
|
+
const values = Array.from(new Set(candidates.map(candidate => candidate.value)));
|
|
134
|
+
if (values.length !== 1) {
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
status: "CONFLICT",
|
|
137
|
+
sources: Object.freeze(candidates.map(candidate => candidate.source)),
|
|
138
|
+
reason: "Stable identity carriers disagree. Once Connect refuses ambiguous logical-operation identity.",
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return Object.freeze({
|
|
142
|
+
status: "FOUND",
|
|
143
|
+
operationId: buildOperationId(request.tool.name.trim(), values[0]),
|
|
144
|
+
source: candidates[0].source,
|
|
145
|
+
reason: "Stable logical-operation identity found and deterministically scoped to this tool.",
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
const metadataCandidate = metadataIdentityCandidate(request.tool, input);
|
|
149
|
+
if (metadataCandidate) {
|
|
150
|
+
return Object.freeze({
|
|
151
|
+
status: "FOUND",
|
|
152
|
+
operationId: buildOperationId(request.tool.name.trim(), metadataCandidate.value),
|
|
153
|
+
source: metadataCandidate.source,
|
|
154
|
+
reason: "Tool metadata declared the input fields that define stable logical-operation identity.",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return Object.freeze({
|
|
158
|
+
status: "REQUIRED",
|
|
159
|
+
reason: "No trustworthy stable identity carrier was found. Once Connect refuses to guess from the full payload.",
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=identity.js.map
|