apps 0.0.1-beta.44 → 0.0.1-beta.46
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/framework-reference.json +1 -1
- package/js/{chunk-646JVUH4.js → chunk-3B2JAOSE.js} +23 -12
- package/js/{chunk-5SHUB37R.js → chunk-3UGDI2UI.js} +3 -3
- package/js/{chunk-7EBODVQJ.js → chunk-6QXPBJ5T.js} +14 -13
- package/js/{chunk-MGGMEGB2.js → chunk-7LGRK7TP.js} +2 -2
- package/js/{chunk-DZQYE626.js → chunk-7UUHJR2Q.js} +1 -1
- package/js/{chunk-4ZTVLEN6.js → chunk-CDXQDN7W.js} +1 -1
- package/js/{chunk-ELO5PRCO.js → chunk-CVAJ4F6O.js} +14 -1
- package/js/{chunk-CZGWW4NQ.js → chunk-JM7LOD2W.js} +187 -9
- package/js/{chunk-EJUK2NK5.js → chunk-KLYSEHUD.js} +1 -1
- package/js/{chunk-OTGUPKKK.js → chunk-LHCGND3R.js} +12 -46
- package/js/{chunk-EMHFXFTJ.js → chunk-LTDHQJ2Z.js} +53 -0
- package/js/{chunk-DRJRCHHO.js → chunk-OJ47HQVJ.js} +141 -63
- package/js/{chunk-MZH4J2PO.js → chunk-PD6I2SDG.js} +1 -1
- package/js/{chunk-KSGYJV46.js → chunk-TUMGL2OC.js} +1 -1
- package/js/{chunk-5GLC42LK.js → chunk-UM62MBJQ.js} +42 -24
- package/js/{chunk-V3RS2BK6.js → chunk-XK5I2XOI.js} +39 -29
- package/js/client.js +8 -8
- package/js/contracts.js +7 -3
- package/js/effect.js +11 -11
- package/js/graphql.js +20 -18
- package/js/host.js +76 -51
- package/js/index.js +21 -16
- package/js/mcp/effect.js +13 -13
- package/js/mcp/stdio.js +27 -22
- package/js/mcp.js +20 -18
- package/js/openapi.js +103 -77
- package/js/skills/effect.js +2 -2
- package/js/skills.js +50 -33
- package/js/ui/auth.js +3 -3
- package/js/ui/contracts.js +3 -3
- package/js/ui/serving.js +6 -6
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/host.d.ts +15 -0
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/cache.d.ts +4 -0
- package/types/apps/src/implementation/elicitation.d.ts +6 -3
- package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
- package/types/apps/src/implementation/operations.d.ts +2 -2
- package/types/apps/src/implementation/router-catalog.d.ts +4 -4
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/telemetry/src/index.d.ts +1 -0
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/js/{chunk-LNSVJS2Q.js → chunk-EOPQ727L.js} +2 -2
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
declaredOperations,
|
|
3
|
-
fromPromise,
|
|
4
3
|
nativeOperation,
|
|
5
4
|
nativeRouter
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LHCGND3R.js";
|
|
6
|
+
import {
|
|
7
|
+
fromPromise,
|
|
8
|
+
method
|
|
9
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
7
10
|
import {
|
|
8
11
|
ScheduleTiming
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
10
13
|
import {
|
|
11
14
|
decoderOf,
|
|
12
15
|
isSchema,
|
|
@@ -45,11 +48,8 @@ var workflow = (options, run) => ({
|
|
|
45
48
|
input: decoderOf(schemaArgument(options.input, "The workflow input")),
|
|
46
49
|
...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, "The workflow output")) },
|
|
47
50
|
...options.description === void 0 ? {} : { description: options.description },
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
try: () => run(context, input),
|
|
51
|
-
catch: (error) => error
|
|
52
|
-
})
|
|
51
|
+
// SAFETY: defineApp checks required context; the host supplies the pinned run's capabilities.
|
|
52
|
+
run: (context, input) => fromPromise(run, "workflow")(context, input)
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
var nativeWorkflow = (value) => {
|
|
@@ -68,14 +68,25 @@ function rejectCatalogs(definition) {
|
|
|
68
68
|
function adaptDefinition(definition) {
|
|
69
69
|
rejectCatalogs(definition);
|
|
70
70
|
const webhooks = definition.webhooks === void 0 ? {} : {
|
|
71
|
+
// SAFETY: `Required` only where the optional method was just checked to be present.
|
|
71
72
|
webhooks: Object.fromEntries(
|
|
72
73
|
Object.entries(definition.webhooks).map(([name, webhook]) => [
|
|
73
74
|
name,
|
|
74
75
|
{
|
|
75
76
|
...webhook,
|
|
76
|
-
...webhook.register === void 0 ? {} : {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
...webhook.register === void 0 ? {} : {
|
|
78
|
+
register: fromPromise(
|
|
79
|
+
method(webhook, "register"),
|
|
80
|
+
"webhook"
|
|
81
|
+
)
|
|
82
|
+
},
|
|
83
|
+
handle: fromPromise(method(webhook, "handle"), "webhook"),
|
|
84
|
+
...webhook.unregister === void 0 ? {} : {
|
|
85
|
+
unregister: fromPromise(
|
|
86
|
+
method(webhook, "unregister"),
|
|
87
|
+
"webhook"
|
|
88
|
+
)
|
|
89
|
+
},
|
|
79
90
|
..."config" in webhook && isSchema(webhook.config) ? { config: decoderOf(webhook.config) } : {},
|
|
80
91
|
..."state" in webhook && isSchema(webhook.state) ? { state: decoderOf(webhook.state) } : {}
|
|
81
92
|
}
|
|
@@ -134,7 +145,7 @@ function adaptDefinition(definition) {
|
|
|
134
145
|
var defineApp = (requirements, definition) => {
|
|
135
146
|
if (typeof definition !== "function") rejectCatalogs(definition);
|
|
136
147
|
const evaluate = typeof definition === "function" ? definition : async () => definition;
|
|
137
|
-
const factory = fromPromise(evaluate);
|
|
148
|
+
const factory = fromPromise(evaluate, "factory");
|
|
138
149
|
const native = {
|
|
139
150
|
accounts: requirements.accounts,
|
|
140
151
|
evaluate: (context) => factory(context).pipe(Effect_exports.map((value) => adaptDefinition(value)))
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
joinPath,
|
|
6
6
|
mergeMeta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LHCGND3R.js";
|
|
8
8
|
import {
|
|
9
9
|
isShortenedUpstream,
|
|
10
10
|
parseProviderError,
|
|
11
11
|
providerError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiErrorResponse,
|
|
15
15
|
HostDeclarationInvalid,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
McpError,
|
|
22
22
|
McpError2,
|
|
23
23
|
SkillLoadFailed as SkillLoadFailed2
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
25
25
|
import {
|
|
26
26
|
CacheError,
|
|
27
27
|
FailureCode,
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XK5I2XOI.js";
|
|
7
7
|
import {
|
|
8
8
|
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7UUHJR2Q.js";
|
|
10
10
|
import {
|
|
11
11
|
accountProviderError,
|
|
12
12
|
bodyUpstreamError,
|
|
13
13
|
httpProviderError,
|
|
14
14
|
providerErrorDetail
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
16
16
|
import {
|
|
17
17
|
McpCredentialsUnverified,
|
|
18
18
|
McpError,
|
|
@@ -20,21 +20,22 @@ import {
|
|
|
20
20
|
McpToolsOptions,
|
|
21
21
|
defaultMcpClientLimits,
|
|
22
22
|
mcpHealthReserveMs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
24
24
|
import {
|
|
25
25
|
NetworkRefused,
|
|
26
26
|
ProviderError
|
|
27
27
|
} from "./chunk-MWKHKOTL.js";
|
|
28
28
|
import {
|
|
29
|
-
captureTelemetry
|
|
30
|
-
|
|
29
|
+
captureTelemetry,
|
|
30
|
+
owned
|
|
31
|
+
} from "./chunk-JM7LOD2W.js";
|
|
31
32
|
import {
|
|
32
33
|
FetchHttpClient_exports
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-PD6I2SDG.js";
|
|
34
35
|
import {
|
|
35
36
|
HttpClientRequest_exports,
|
|
36
37
|
HttpClient_exports
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-EOPQ727L.js";
|
|
38
39
|
import {
|
|
39
40
|
Clock_exports,
|
|
40
41
|
Deferred_exports,
|
|
@@ -236,7 +237,7 @@ function withClient(connection, mode, use, changed) {
|
|
|
236
237
|
Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
|
|
237
238
|
Effect_exports.ignore
|
|
238
239
|
);
|
|
239
|
-
}).pipe(
|
|
240
|
+
}).pipe(owned("upstream", "provider.mcp.close"))
|
|
240
241
|
);
|
|
241
242
|
const wire = transport;
|
|
242
243
|
yield* Effect_exports.tryPromise({
|
|
@@ -246,7 +247,7 @@ function withClient(connection, mode, use, changed) {
|
|
|
246
247
|
Effect_exports.raceFirst(Deferred_exports.await(rejected)),
|
|
247
248
|
Effect_exports.catch(explained("connect", answered)),
|
|
248
249
|
Effect_exports.timeout(connection.timeoutMs),
|
|
249
|
-
|
|
250
|
+
owned("upstream", "provider.mcp.connect")
|
|
250
251
|
);
|
|
251
252
|
return yield* use(client).pipe(
|
|
252
253
|
Effect_exports.raceFirst(Deferred_exports.await(rejected)),
|
|
@@ -254,7 +255,7 @@ function withClient(connection, mode, use, changed) {
|
|
|
254
255
|
);
|
|
255
256
|
})
|
|
256
257
|
).pipe(
|
|
257
|
-
|
|
258
|
+
owned("upstream", "provider.mcp.session", {
|
|
258
259
|
attributes: {
|
|
259
260
|
"mcp.transport": kind,
|
|
260
261
|
"mcp.operation": mode,
|
|
@@ -327,9 +328,9 @@ var mcpHealthEffect = (check, options) => Effect_exports.gen(function* () {
|
|
|
327
328
|
// Executor's network refused the attempt, so the server never answered it.
|
|
328
329
|
onFailure: (error) => Schema_exports.is(NetworkRefused)(error) ? Effect_exports.fail(error) : refusesCredentials(error) ? Effect_exports.void : Effect_exports.fail(new McpCredentialsUnverified({ anonymous: error }))
|
|
329
330
|
}),
|
|
330
|
-
|
|
331
|
+
owned("upstream", "provider.mcp.anonymous")
|
|
331
332
|
);
|
|
332
|
-
}).pipe(
|
|
333
|
+
}).pipe(owned("upstream", "provider.mcp.health"));
|
|
333
334
|
var mcpToolsEffect = (input) => mcpClientEffect(input).pipe(Effect_exports.flatMap(adaptMcpTools));
|
|
334
335
|
|
|
335
336
|
export {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixedRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3UGDI2UI.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeOperation,
|
|
6
6
|
operationDeclaration,
|
|
7
7
|
routerDeclaration
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LHCGND3R.js";
|
|
9
9
|
|
|
10
10
|
// src/implementation/protocol-operations.ts
|
|
11
11
|
var protocolOperations = (operations, kinds = {}) => {
|
|
@@ -3253,6 +3253,17 @@ var ToolResultObservation = Context_exports.Reference(
|
|
|
3253
3253
|
{ defaultValue: () => ({ failed: () => {
|
|
3254
3254
|
} }) }
|
|
3255
3255
|
);
|
|
3256
|
+
var InvocationTiming = Schema_exports.Struct({
|
|
3257
|
+
elapsedMs: Schema_exports.Finite,
|
|
3258
|
+
upstreamMs: Schema_exports.Finite,
|
|
3259
|
+
elicitationMs: Schema_exports.Finite,
|
|
3260
|
+
authoredMs: Schema_exports.Finite
|
|
3261
|
+
});
|
|
3262
|
+
var InvocationTimingSink = Context_exports.Reference(
|
|
3263
|
+
"apps/InvocationTimingSink",
|
|
3264
|
+
{ defaultValue: () => () => {
|
|
3265
|
+
} }
|
|
3266
|
+
);
|
|
3256
3267
|
|
|
3257
3268
|
export {
|
|
3258
3269
|
SecretsMethod,
|
|
@@ -3395,5 +3406,7 @@ export {
|
|
|
3395
3406
|
HostCallError,
|
|
3396
3407
|
HostAccountCheckError,
|
|
3397
3408
|
HostDataError,
|
|
3398
|
-
ToolResultObservation
|
|
3409
|
+
ToolResultObservation,
|
|
3410
|
+
InvocationTiming,
|
|
3411
|
+
InvocationTimingSink
|
|
3399
3412
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FetchHttpClient_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PD6I2SDG.js";
|
|
4
4
|
import {
|
|
5
5
|
recordedMessage
|
|
6
6
|
} from "./chunk-5FHWNLCI.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
tapError,
|
|
24
24
|
transformResponse,
|
|
25
25
|
uint8Array
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EOPQ727L.js";
|
|
27
27
|
import {
|
|
28
28
|
Array as Array2,
|
|
29
29
|
Boolean2 as Boolean,
|
|
@@ -139,6 +139,145 @@ import {
|
|
|
139
139
|
__export
|
|
140
140
|
} from "./chunk-CZ7CSFO4.js";
|
|
141
141
|
|
|
142
|
+
// ../telemetry/src/ownership.ts
|
|
143
|
+
var ownerAttribute = "executor.owner";
|
|
144
|
+
var SpanOwner = Context_exports.Reference("@executor-js/telemetry/SpanOwner", {
|
|
145
|
+
defaultValue: () => void 0
|
|
146
|
+
});
|
|
147
|
+
var declaredOwner = (annotations) => Context_exports.get(annotations, SpanOwner);
|
|
148
|
+
var ownedBy = (owner, options = {}) => ({
|
|
149
|
+
...options,
|
|
150
|
+
annotations: Context_exports.add(options.annotations ?? Context_exports.empty(), SpanOwner, owner)
|
|
151
|
+
});
|
|
152
|
+
var owned = (owner, name, options) => (effect2) => effect2.pipe(Effect_exports.withSpan(name, ownedBy(owner, options)));
|
|
153
|
+
var measuredSpan = (name, options, measure) => (effect2) => Effect_exports.useSpan(name, options, (span) => {
|
|
154
|
+
const inner = Effect_exports.withParentSpan(effect2, span);
|
|
155
|
+
if (span.status._tag === "Ended") return inner;
|
|
156
|
+
const { around, end } = measure(span.status.startTime);
|
|
157
|
+
return (around === void 0 ? inner : around(inner)).pipe(
|
|
158
|
+
Effect_exports.onExit(
|
|
159
|
+
(exit) => Effect_exports.flatMap(
|
|
160
|
+
Clock_exports.currentTimeNanos,
|
|
161
|
+
(now) => Effect_exports.sync(() => {
|
|
162
|
+
end(now, span);
|
|
163
|
+
span.end(now, exit);
|
|
164
|
+
})
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
var concurrent = ["executor", "person", "upstream", "app"];
|
|
170
|
+
var makeOwnershipAccounting = (origin, owner) => {
|
|
171
|
+
const totals = { executor: 0, app: 0, upstream: 0, person: 0 };
|
|
172
|
+
const innermost = { executor: 0, app: 0, upstream: 0, person: 0 };
|
|
173
|
+
const boundaries2 = /* @__PURE__ */ new WeakMap();
|
|
174
|
+
let reached = origin;
|
|
175
|
+
let done = false;
|
|
176
|
+
const advance = (time) => {
|
|
177
|
+
if (time <= reached) return;
|
|
178
|
+
const current = concurrent.find((candidate) => innermost[candidate] > 0) ?? owner;
|
|
179
|
+
totals[current] += Number(time - reached) / 1e6;
|
|
180
|
+
reached = time;
|
|
181
|
+
};
|
|
182
|
+
const enclosing = (boundary) => {
|
|
183
|
+
let found = boundary.parent;
|
|
184
|
+
while (found !== void 0 && !found.open) found = found.parent;
|
|
185
|
+
boundary.parent = found;
|
|
186
|
+
return found;
|
|
187
|
+
};
|
|
188
|
+
const opened = (boundary) => {
|
|
189
|
+
const parent = enclosing(boundary);
|
|
190
|
+
if (parent !== void 0 && parent.children++ === 0) innermost[parent.owner] -= 1;
|
|
191
|
+
innermost[boundary.owner] += 1;
|
|
192
|
+
};
|
|
193
|
+
const closed = (boundary) => {
|
|
194
|
+
boundary.open = false;
|
|
195
|
+
if (boundary.children === 0) innermost[boundary.owner] -= 1;
|
|
196
|
+
const parent = enclosing(boundary);
|
|
197
|
+
if (parent === void 0) return;
|
|
198
|
+
parent.children += boundary.children - 1;
|
|
199
|
+
if (parent.children === 0) innermost[parent.owner] += 1;
|
|
200
|
+
};
|
|
201
|
+
const observed = (tracer) => ({
|
|
202
|
+
...tracer,
|
|
203
|
+
span: (options) => {
|
|
204
|
+
const span = tracer.span(options);
|
|
205
|
+
if (done) return span;
|
|
206
|
+
const parent = Option_exports.getOrUndefined(options.parent);
|
|
207
|
+
const enclosingBoundary = parent === void 0 ? void 0 : boundaries2.get(parent);
|
|
208
|
+
const boundary = {
|
|
209
|
+
owner: declaredOwner(options.annotations) ?? enclosingBoundary?.owner ?? owner,
|
|
210
|
+
parent: enclosingBoundary,
|
|
211
|
+
open: true,
|
|
212
|
+
children: 0
|
|
213
|
+
};
|
|
214
|
+
advance(options.startTime);
|
|
215
|
+
opened(boundary);
|
|
216
|
+
const tracked = {
|
|
217
|
+
_tag: "Span",
|
|
218
|
+
get name() {
|
|
219
|
+
return span.name;
|
|
220
|
+
},
|
|
221
|
+
get spanId() {
|
|
222
|
+
return span.spanId;
|
|
223
|
+
},
|
|
224
|
+
get traceId() {
|
|
225
|
+
return span.traceId;
|
|
226
|
+
},
|
|
227
|
+
get parent() {
|
|
228
|
+
return span.parent;
|
|
229
|
+
},
|
|
230
|
+
get annotations() {
|
|
231
|
+
return span.annotations;
|
|
232
|
+
},
|
|
233
|
+
get status() {
|
|
234
|
+
return span.status;
|
|
235
|
+
},
|
|
236
|
+
get attributes() {
|
|
237
|
+
return span.attributes;
|
|
238
|
+
},
|
|
239
|
+
get links() {
|
|
240
|
+
return span.links;
|
|
241
|
+
},
|
|
242
|
+
get sampled() {
|
|
243
|
+
return span.sampled;
|
|
244
|
+
},
|
|
245
|
+
get kind() {
|
|
246
|
+
return span.kind;
|
|
247
|
+
},
|
|
248
|
+
end: (endTime, exit) => {
|
|
249
|
+
if (boundary.open && !done) {
|
|
250
|
+
advance(endTime);
|
|
251
|
+
closed(boundary);
|
|
252
|
+
}
|
|
253
|
+
span.end(endTime, exit);
|
|
254
|
+
},
|
|
255
|
+
attribute: (key, value) => span.attribute(key, value),
|
|
256
|
+
event: (name, startTime, attributes2) => span.event(name, startTime, attributes2),
|
|
257
|
+
addLinks: (links) => span.addLinks(links)
|
|
258
|
+
};
|
|
259
|
+
boundaries2.set(tracked, boundary);
|
|
260
|
+
return tracked;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
/** Run `effect` with the spans it opens observed, including spans it hands to later work. */
|
|
265
|
+
observe: (effect2) => Effect_exports.gen(function* () {
|
|
266
|
+
const tracer = yield* Tracer_exports.Tracer;
|
|
267
|
+
return yield* effect2.pipe(Effect_exports.provideService(Tracer_exports.Tracer, observed(tracer)));
|
|
268
|
+
}),
|
|
269
|
+
/**
|
|
270
|
+
* Close the window at `end` and return its milliseconds by owner, each instant counted once.
|
|
271
|
+
* Spans still open count up to `end`; spans that open or end afterwards are ignored.
|
|
272
|
+
*/
|
|
273
|
+
read: (end) => {
|
|
274
|
+
if (!done) advance(end);
|
|
275
|
+
done = true;
|
|
276
|
+
return totals;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
|
|
142
281
|
// ../telemetry/src/context.ts
|
|
143
282
|
var captureTelemetry = Effect_exports.gen(function* () {
|
|
144
283
|
let context2 = Context_exports.make(Tracer_exports.Tracer, yield* Tracer_exports.Tracer).pipe(
|
|
@@ -170,9 +309,10 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
170
309
|
const request = yield* Effect_exports.try(() => new Request(input, init));
|
|
171
310
|
const client = yield* HttpClient_exports.HttpClient;
|
|
172
311
|
const response = yield* client.execute(HttpClientRequest_exports.fromWeb(request)).pipe(
|
|
173
|
-
Effect_exports.withSpan(
|
|
174
|
-
|
|
175
|
-
|
|
312
|
+
Effect_exports.withSpan(
|
|
313
|
+
"provider.http.request",
|
|
314
|
+
ownedBy("upstream", { attributes: { "http.request.method": request.method } })
|
|
315
|
+
),
|
|
176
316
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, {
|
|
177
317
|
cache: request.cache,
|
|
178
318
|
credentials: request.credentials,
|
|
@@ -201,9 +341,12 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
201
341
|
streamed,
|
|
202
342
|
HttpBody_exports.stream(
|
|
203
343
|
body.stream.pipe(
|
|
204
|
-
Stream_exports.withSpan(
|
|
205
|
-
|
|
206
|
-
|
|
344
|
+
Stream_exports.withSpan(
|
|
345
|
+
"provider.http.response.read",
|
|
346
|
+
ownedBy("upstream", {
|
|
347
|
+
attributes: { "http.response.status_code": response.status }
|
|
348
|
+
})
|
|
349
|
+
)
|
|
207
350
|
),
|
|
208
351
|
body.contentType,
|
|
209
352
|
body.contentLength
|
|
@@ -991,6 +1134,8 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
991
1134
|
if (recordAll && Option_exports.isSome(options.parent) && options.parent.value._tag === "ExternalSpan")
|
|
992
1135
|
span.attribute("executor.trace.parent_sampled", options.parent.value.sampled);
|
|
993
1136
|
if (clock !== void 0) span.attribute("executor.clock.type", clock);
|
|
1137
|
+
const owner = declaredOwner(options.annotations);
|
|
1138
|
+
if (owner !== void 0) span.attribute(ownerAttribute, owner);
|
|
994
1139
|
return span;
|
|
995
1140
|
}
|
|
996
1141
|
}))
|
|
@@ -2344,10 +2489,15 @@ var appSpanNames = /* @__PURE__ */ new Set([
|
|
|
2344
2489
|
"app.catalog.read",
|
|
2345
2490
|
"app.skills.load",
|
|
2346
2491
|
"app.skills.routers",
|
|
2492
|
+
"app.tool.resolve",
|
|
2347
2493
|
"app.tool.approval",
|
|
2348
2494
|
"app.tool.elicitation",
|
|
2495
|
+
"app.elicitation.wait",
|
|
2496
|
+
"app.workflow.control",
|
|
2349
2497
|
"app.operation.execute",
|
|
2350
2498
|
"app.sql.migrate",
|
|
2499
|
+
"app.code",
|
|
2500
|
+
"app.cache.call",
|
|
2351
2501
|
"app.cache.get",
|
|
2352
2502
|
"app.cache.load",
|
|
2353
2503
|
"app.cache.command",
|
|
@@ -2491,6 +2641,10 @@ var status = (value) => {
|
|
|
2491
2641
|
const found = integer(value);
|
|
2492
2642
|
return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
|
|
2493
2643
|
};
|
|
2644
|
+
var duration = (value) => {
|
|
2645
|
+
const found = typeof value["doubleValue"] === "number" ? value["doubleValue"] : integer(value);
|
|
2646
|
+
return found !== void 0 && Number.isFinite(found) && found >= 0 ? { doubleValue: found } : void 0;
|
|
2647
|
+
};
|
|
2494
2648
|
var spanAttributes2 = {
|
|
2495
2649
|
"executor.operation": oneOf(...operations, "mutation", "discover"),
|
|
2496
2650
|
"executor.outcome": oneOf("failed"),
|
|
@@ -2529,7 +2683,28 @@ var spanAttributes2 = {
|
|
|
2529
2683
|
"url.scheme": oneOf("http", "https"),
|
|
2530
2684
|
"span.label": oneOf("\u26A0\uFE0E Interrupted"),
|
|
2531
2685
|
"status.interrupted": flag,
|
|
2532
|
-
"executor.milestone.reached": flag
|
|
2686
|
+
"executor.milestone.reached": flag,
|
|
2687
|
+
"executor.owner": oneOf("executor", "app", "upstream", "person"),
|
|
2688
|
+
"executor.app.code": oneOf(
|
|
2689
|
+
"factory",
|
|
2690
|
+
"router",
|
|
2691
|
+
"approval",
|
|
2692
|
+
"handler",
|
|
2693
|
+
"loader",
|
|
2694
|
+
"cache",
|
|
2695
|
+
"webhook",
|
|
2696
|
+
"check",
|
|
2697
|
+
"skills",
|
|
2698
|
+
"elicitation",
|
|
2699
|
+
"workflow",
|
|
2700
|
+
"step"
|
|
2701
|
+
),
|
|
2702
|
+
"executor.workflow.operation": oneOf("start", "get", "list", "terminate"),
|
|
2703
|
+
"cache.method": oneOf("get", "revalidate", "read", "readMany", "write", "invalidate"),
|
|
2704
|
+
"executor.upstream.wait_ms": duration,
|
|
2705
|
+
"executor.elicitation.wait_ms": duration,
|
|
2706
|
+
"executor.authored_ms": duration,
|
|
2707
|
+
"executor.overhead_ms": duration
|
|
2533
2708
|
};
|
|
2534
2709
|
var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
|
|
2535
2710
|
var logMessages = /* @__PURE__ */ new Set([
|
|
@@ -2868,6 +3043,9 @@ var pendingSpan = (name, options) => Effect_exports.gen(function* () {
|
|
|
2868
3043
|
|
|
2869
3044
|
export {
|
|
2870
3045
|
CurrentTelemetryConfig,
|
|
3046
|
+
owned,
|
|
3047
|
+
measuredSpan,
|
|
3048
|
+
makeOwnershipAccounting,
|
|
2871
3049
|
OtlpExporter_exports,
|
|
2872
3050
|
telemetryLayer,
|
|
2873
3051
|
captureTelemetry,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fromPromise
|
|
3
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
1
4
|
import {
|
|
2
5
|
HostedTool,
|
|
3
6
|
RouterKey,
|
|
4
7
|
RouterMeta,
|
|
5
8
|
reservedRouterKeys
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
7
10
|
import {
|
|
8
11
|
decoderOf,
|
|
9
12
|
schemaArgument
|
|
@@ -13,38 +16,6 @@ import {
|
|
|
13
16
|
Schema_exports
|
|
14
17
|
} from "./chunk-IFJU5SYQ.js";
|
|
15
18
|
|
|
16
|
-
// src/implementation/authoring.ts
|
|
17
|
-
var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
|
|
18
|
-
var fromPromise = (callback) => (...args) => {
|
|
19
|
-
if (NativeCallback in callback) {
|
|
20
|
-
const native = callback[NativeCallback];
|
|
21
|
-
return native(...args);
|
|
22
|
-
}
|
|
23
|
-
return Effect_exports.tryPromise({ try: () => callback(...args), catch: (error) => error });
|
|
24
|
-
};
|
|
25
|
-
var toPromise = (operation, signal) => {
|
|
26
|
-
const native = (...args) => Effect_exports.suspend(() => {
|
|
27
|
-
if (signal === void 0) return operation(...args);
|
|
28
|
-
if (signal.aborted) return Effect_exports.interrupt;
|
|
29
|
-
const cancelled = Effect_exports.callback((resume) => {
|
|
30
|
-
if (signal.aborted) {
|
|
31
|
-
resume(Effect_exports.interrupt);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const abort = () => resume(Effect_exports.interrupt);
|
|
35
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
36
|
-
return Effect_exports.sync(() => signal.removeEventListener("abort", abort));
|
|
37
|
-
});
|
|
38
|
-
return Effect_exports.raceFirst(
|
|
39
|
-
cancelled,
|
|
40
|
-
Effect_exports.suspend(() => operation(...args))
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
return Object.assign((...args) => Effect_exports.runPromise(native(...args)), {
|
|
44
|
-
[NativeCallback]: native
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
19
|
// src/implementation/operations.ts
|
|
49
20
|
var NativeOperation = /* @__PURE__ */ Symbol("apps.Operation");
|
|
50
21
|
var NativeRouterKey = /* @__PURE__ */ Symbol("apps.Router");
|
|
@@ -65,7 +36,7 @@ var operationOptions = (options) => {
|
|
|
65
36
|
...options._meta === void 0 ? {} : { _meta: options._meta },
|
|
66
37
|
input: decoderOf(options.input),
|
|
67
38
|
...approval === void 0 ? {} : {
|
|
68
|
-
approval: (context) =>
|
|
39
|
+
approval: (context) => fromPromise(async () => approval(context), "approval")()
|
|
69
40
|
}
|
|
70
41
|
};
|
|
71
42
|
};
|
|
@@ -73,7 +44,7 @@ var approvedOperation = (operation, approval) => {
|
|
|
73
44
|
const copy = Object.defineProperties({}, Object.getOwnPropertyDescriptors(operation));
|
|
74
45
|
return Object.defineProperty(copy, "approval", {
|
|
75
46
|
enumerable: true,
|
|
76
|
-
value: (context) =>
|
|
47
|
+
value: (context) => fromPromise(async () => approval(context), "approval")()
|
|
77
48
|
});
|
|
78
49
|
};
|
|
79
50
|
var withApproval = (operation, approval) => ({
|
|
@@ -86,12 +57,9 @@ var make = (kind, options, run) => operationDeclaration({
|
|
|
86
57
|
kind,
|
|
87
58
|
// The host always validates JSON serialization, even without a stronger output declaration.
|
|
88
59
|
...options.output === void 0 ? {} : { output: decoderOf(schemaArgument(options.output, `The ${kind} output`)) },
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
try: () => run(context, input),
|
|
93
|
-
catch: (error) => error
|
|
94
|
-
})
|
|
60
|
+
// SAFETY: defineApp checks the handler context against its requirements.
|
|
61
|
+
// The host validates account bindings and creates the matching storage facade.
|
|
62
|
+
run: (context, input) => fromPromise(run, "handler")(context, input)
|
|
95
63
|
});
|
|
96
64
|
var query = (options, run) => make("query", options, run);
|
|
97
65
|
var mutation = (options, run) => make("mutation", options, run);
|
|
@@ -139,14 +107,14 @@ var dynamicRouter = (source) => {
|
|
|
139
107
|
return routerDeclaration({
|
|
140
108
|
kind: "dynamic",
|
|
141
109
|
...meta === void 0 ? {} : {
|
|
142
|
-
meta: () => fromPromise(async () => meta())().pipe(
|
|
110
|
+
meta: () => fromPromise(async () => meta(), "router")().pipe(
|
|
143
111
|
Effect_exports.flatMap((options) => Schema_exports.decodeUnknownEffect(RouterMeta)(options))
|
|
144
112
|
)
|
|
145
113
|
},
|
|
146
|
-
list: () => fromPromise(async () => source.list())().pipe(
|
|
114
|
+
list: () => fromPromise(async () => source.list(), "router")().pipe(
|
|
147
115
|
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(Schema_exports.Array(HostedTool)))
|
|
148
116
|
),
|
|
149
|
-
resolve: (name) => fromPromise(async () => source.resolve(name))().pipe(
|
|
117
|
+
resolve: (name) => fromPromise(async () => source.resolve(name), "router")().pipe(
|
|
150
118
|
Effect_exports.map((value) => {
|
|
151
119
|
if (value === void 0) return void 0;
|
|
152
120
|
const operation = nativeOperation(value);
|
|
@@ -235,8 +203,6 @@ var withApprovals = (source, policy) => {
|
|
|
235
203
|
};
|
|
236
204
|
|
|
237
205
|
export {
|
|
238
|
-
fromPromise,
|
|
239
|
-
toPromise,
|
|
240
206
|
operationDeclaration,
|
|
241
207
|
nativeOperation,
|
|
242
208
|
withApproval,
|