apps 0.0.1-beta.68 → 0.0.1-beta.69
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-L7ZC6JR4.js → chunk-3R3KFCDU.js} +172 -12
- package/js/{chunk-4733J7FG.js → chunk-7LMU3ER3.js} +23 -0
- package/js/{chunk-ACJPBBNH.js → chunk-CXDAEGXB.js} +3 -3
- package/js/{chunk-3K5SX2M6.js → chunk-CY4MT7PI.js} +5 -5
- package/js/{chunk-6JN66722.js → chunk-DZN5TQ53.js} +33 -15
- package/js/{chunk-YAOYLBKS.js → chunk-ECCWT5GJ.js} +2 -2
- package/js/{chunk-XUG423KM.js → chunk-FZB6D6ZD.js} +4 -4
- package/js/{chunk-6MJUPGMI.js → chunk-GJSNQSR7.js} +2 -2
- package/js/{chunk-M3IIZDHH.js → chunk-JW5LYSER.js} +92 -3
- package/js/{chunk-UD4RXDWG.js → chunk-MHB7IFG7.js} +1 -1
- package/js/{chunk-C47A664A.js → chunk-RUP4JMKO.js} +1 -1
- package/js/{chunk-2KVS7XBO.js → chunk-ZEJ3IKEC.js} +2 -2
- package/js/{chunk-JGLXI6SU.js → chunk-ZR7QAG67.js} +1 -1
- package/js/contracts.js +34 -2
- package/js/effect.js +9 -9
- package/js/graphql.js +11 -11
- package/js/host.js +9 -9
- package/js/index.js +59 -12
- package/js/mcp/effect.js +11 -11
- package/js/mcp/stdio.js +11 -11
- package/js/mcp.js +13 -13
- package/js/openapi.js +7 -7
- package/js/skills.js +5 -5
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/host.d.ts +600 -2
- package/types/apps/src/contracts/network.d.ts +36 -0
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +1 -1
- package/types/apps/src/contracts/protocols/current.d.ts +1368 -2
- package/types/apps/src/contracts/provider.d.ts +25 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +3 -3
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/provider.d.ts +8 -2
- package/types/apps/src/index.d.ts +27 -3
|
@@ -2,17 +2,21 @@ import {
|
|
|
2
2
|
declaredOperations,
|
|
3
3
|
nativeOperation,
|
|
4
4
|
nativeRouter
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZEJ3IKEC.js";
|
|
6
6
|
import {
|
|
7
7
|
fromPromise,
|
|
8
8
|
method
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZR7QAG67.js";
|
|
10
10
|
import {
|
|
11
11
|
EmittedEvent,
|
|
12
12
|
EventName,
|
|
13
|
+
Placement,
|
|
13
14
|
ScheduleTiming,
|
|
14
|
-
defaultEventLimits
|
|
15
|
-
|
|
15
|
+
defaultEventLimits,
|
|
16
|
+
normalizePlacements,
|
|
17
|
+
placementFields,
|
|
18
|
+
renderPlacement
|
|
19
|
+
} from "./chunk-JW5LYSER.js";
|
|
16
20
|
import {
|
|
17
21
|
decoderOf,
|
|
18
22
|
isSchema,
|
|
@@ -24,6 +28,7 @@ import {
|
|
|
24
28
|
} from "./chunk-H2CJWXA3.js";
|
|
25
29
|
import {
|
|
26
30
|
Effect_exports,
|
|
31
|
+
Result_exports,
|
|
27
32
|
Schema_exports
|
|
28
33
|
} from "./chunk-IFJU5SYQ.js";
|
|
29
34
|
|
|
@@ -45,6 +50,153 @@ var ResponseDecodeError = class extends Schema_exports.TaggedError()(
|
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
52
|
|
|
53
|
+
// src/implementation/placement.ts
|
|
54
|
+
var misuse = (name) => `${name} is a credential placement, not a string. Build placement values with t\`...\`, such as t\`Bearer \${token}\`, instead of an untagged template literal or string concatenation.`;
|
|
55
|
+
var NotAString = class {
|
|
56
|
+
#described;
|
|
57
|
+
constructor(described) {
|
|
58
|
+
this.#described = described;
|
|
59
|
+
}
|
|
60
|
+
[Symbol.toPrimitive]() {
|
|
61
|
+
throw new TypeError(misuse(this.#described));
|
|
62
|
+
}
|
|
63
|
+
toString() {
|
|
64
|
+
throw new TypeError(misuse(this.#described));
|
|
65
|
+
}
|
|
66
|
+
toJSON() {
|
|
67
|
+
throw new TypeError(misuse(this.#described));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var FieldRef = class extends NotAString {
|
|
71
|
+
field;
|
|
72
|
+
constructor(field) {
|
|
73
|
+
super(`The field reference ${JSON.stringify(field)}`);
|
|
74
|
+
this.field = field;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var PlacementValue = class extends NotAString {
|
|
78
|
+
parts;
|
|
79
|
+
constructor(parts) {
|
|
80
|
+
super("A t`...` value");
|
|
81
|
+
this.parts = parts;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var partsOf = (input) => {
|
|
85
|
+
if (typeof input === "string") return input === "" ? [] : [input];
|
|
86
|
+
if (input instanceof FieldRef) return [{ field: input.field }];
|
|
87
|
+
if (input instanceof PlacementValue) return input.parts;
|
|
88
|
+
throw new TypeError(
|
|
89
|
+
`A credential placement interpolates text, a field reference, t\`...\` or base64(...), not ${typeof input}.`
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
var joined = (parts) => parts.reduce((all, part) => {
|
|
93
|
+
const last = all.at(-1);
|
|
94
|
+
if (typeof part === "string" && typeof last === "string") all[all.length - 1] = last + part;
|
|
95
|
+
else all.push(part);
|
|
96
|
+
return all;
|
|
97
|
+
}, []);
|
|
98
|
+
var t = (strings, ...values) => new PlacementValue(
|
|
99
|
+
joined(
|
|
100
|
+
strings.flatMap((text, index) => [
|
|
101
|
+
...partsOf(text),
|
|
102
|
+
...index < values.length ? partsOf(values[index]) : []
|
|
103
|
+
])
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
var base64 = (value2) => {
|
|
107
|
+
const inner = partsOf(value2).map((part) => {
|
|
108
|
+
if (typeof part === "object" && "base64" in part)
|
|
109
|
+
throw new TypeError("base64(...) cannot contain another base64(...).");
|
|
110
|
+
return part;
|
|
111
|
+
});
|
|
112
|
+
if (inner.length === 0) throw new TypeError("base64(...) needs a value.");
|
|
113
|
+
return new PlacementValue([{ base64: inner }]);
|
|
114
|
+
};
|
|
115
|
+
var value = (input) => {
|
|
116
|
+
const parts = partsOf(input);
|
|
117
|
+
if (parts.length === 0) throw new TypeError("A credential placement needs a value.");
|
|
118
|
+
return joined(parts);
|
|
119
|
+
};
|
|
120
|
+
var header = (name, input) => ({
|
|
121
|
+
in: "header",
|
|
122
|
+
name: name.toLowerCase(),
|
|
123
|
+
value: value(input)
|
|
124
|
+
});
|
|
125
|
+
var query = (name, input) => ({
|
|
126
|
+
in: "query",
|
|
127
|
+
name,
|
|
128
|
+
value: value(input)
|
|
129
|
+
});
|
|
130
|
+
var bearer = (token) => header("authorization", t`Bearer ${token}`);
|
|
131
|
+
var basic = (user, password) => header("authorization", t`Basic ${base64(t`${user}:${password}`)}`);
|
|
132
|
+
var declarePlacements = (method2, names, exposure, request) => {
|
|
133
|
+
const declared = new Set(names);
|
|
134
|
+
const refs = new Proxy(Object.fromEntries(names.map((name) => [name, new FieldRef(name)])), {
|
|
135
|
+
get: (target, key) => {
|
|
136
|
+
if (typeof key === "string" && !declared.has(key))
|
|
137
|
+
throw new TypeError(
|
|
138
|
+
`The ${method2} request references "${key}", which is not one of its fields: ${names.join(", ")}.`
|
|
139
|
+
);
|
|
140
|
+
return Reflect.get(target, key);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const returned = request(refs);
|
|
144
|
+
const placements = Array.isArray(returned) ? returned : [returned];
|
|
145
|
+
if (placements.length === 0) throw new TypeError(`The ${method2} request declares no placements.`);
|
|
146
|
+
if (!placements.every(Schema_exports.is(Placement)))
|
|
147
|
+
throw new TypeError(
|
|
148
|
+
`The ${method2} request must return header(...) or query(...) placements, or an array of them.`
|
|
149
|
+
);
|
|
150
|
+
for (const placement of placements) {
|
|
151
|
+
const fields = placementFields(placement);
|
|
152
|
+
for (const field of fields) {
|
|
153
|
+
if (!declared.has(field))
|
|
154
|
+
throw new TypeError(
|
|
155
|
+
`The ${method2} request references "${field}", which is not one of its fields: ${names.join(", ")}.`
|
|
156
|
+
);
|
|
157
|
+
if (exposure?.[field] === "raw")
|
|
158
|
+
throw new TypeError(
|
|
159
|
+
`The ${method2} request references the raw() field "${field}". App code reads raw fields as real values, so they are never placed; remove raw() or the reference.`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
if (![...fields].some((field) => exposure?.[field] === void 0))
|
|
163
|
+
throw new TypeError(
|
|
164
|
+
`The ${method2} request's ${placement.in} ${placement.name} references no secret field. A placement places a secret: reference a field that is not plain() or raw().`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return normalizePlacements(placements);
|
|
168
|
+
};
|
|
169
|
+
var undeclared = (method2) => `The ${method2} account declares no request. Declare where its credentials go with request, such as request: ({ token }) => bearer(token), to use headers() and url().`;
|
|
170
|
+
var withPlacements = (account, placements) => {
|
|
171
|
+
const fields = typeof account.fields === "object" && account.fields !== null ? account.fields : {};
|
|
172
|
+
const render = (placement) => Result_exports.getOrThrowWith(
|
|
173
|
+
renderPlacement(placement, fields),
|
|
174
|
+
(error) => new TypeError(error.message)
|
|
175
|
+
);
|
|
176
|
+
const declared = () => {
|
|
177
|
+
if (placements === void 0 || placements.length === 0)
|
|
178
|
+
throw new TypeError(undeclared(account.method));
|
|
179
|
+
return placements;
|
|
180
|
+
};
|
|
181
|
+
return Object.defineProperties(account, {
|
|
182
|
+
headers: {
|
|
183
|
+
enumerable: false,
|
|
184
|
+
value: () => Object.fromEntries(
|
|
185
|
+
declared().filter((placement) => placement.in === "header").map((placement) => [placement.name, render(placement)])
|
|
186
|
+
)
|
|
187
|
+
},
|
|
188
|
+
url: {
|
|
189
|
+
enumerable: false,
|
|
190
|
+
value: (input) => {
|
|
191
|
+
const url = new URL(input);
|
|
192
|
+
for (const placement of declared())
|
|
193
|
+
if (placement.in === "query") url.searchParams.set(placement.name, render(placement));
|
|
194
|
+
return url.href;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
48
200
|
// src/implementation/workflows.ts
|
|
49
201
|
var NativeWorkflow = /* @__PURE__ */ Symbol("apps.Workflow");
|
|
50
202
|
var workflow = (options, run) => ({
|
|
@@ -56,9 +208,9 @@ var workflow = (options, run) => ({
|
|
|
56
208
|
run: (context, input) => fromPromise(run, "workflow")(context, input)
|
|
57
209
|
}
|
|
58
210
|
});
|
|
59
|
-
var nativeWorkflow = (
|
|
60
|
-
if (typeof
|
|
61
|
-
return
|
|
211
|
+
var nativeWorkflow = (value2) => {
|
|
212
|
+
if (typeof value2 !== "object" || value2 === null || !(NativeWorkflow in value2)) return void 0;
|
|
213
|
+
return value2[NativeWorkflow];
|
|
62
214
|
};
|
|
63
215
|
|
|
64
216
|
// src/implementation/events.ts
|
|
@@ -68,7 +220,7 @@ var isScalarSchema = (document) => {
|
|
|
68
220
|
const type = document.type;
|
|
69
221
|
if (typeof type === "string") return scalarTypes.has(type);
|
|
70
222
|
const choices = Array.isArray(document.enum) ? document.enum : "const" in document ? [document.const] : void 0;
|
|
71
|
-
return choices !== void 0 && choices.length > 0 && choices.every((
|
|
223
|
+
return choices !== void 0 && choices.length > 0 && choices.every((value2) => ["string", "number", "boolean"].includes(typeof value2));
|
|
72
224
|
};
|
|
73
225
|
var event = (options) => {
|
|
74
226
|
const filters = options.filters ?? {};
|
|
@@ -144,7 +296,7 @@ var makeEmitter = (input) => ({
|
|
|
144
296
|
|
|
145
297
|
// src/implementation/app.ts
|
|
146
298
|
var InternalApp = /* @__PURE__ */ Symbol("apps.App");
|
|
147
|
-
var isApp = (
|
|
299
|
+
var isApp = (value2) => typeof value2 === "object" && value2 !== null && InternalApp in value2;
|
|
148
300
|
var toEffectApp = (app) => app[InternalApp];
|
|
149
301
|
function rejectCatalogs(definition) {
|
|
150
302
|
if ("queries" in definition || "mutations" in definition)
|
|
@@ -180,8 +332,8 @@ function adaptDefinition(definition) {
|
|
|
180
332
|
};
|
|
181
333
|
const workflows = definition.workflows === void 0 ? {} : {
|
|
182
334
|
workflows: Object.fromEntries(
|
|
183
|
-
Object.entries(definition.workflows).map(([name,
|
|
184
|
-
const declared2 = nativeWorkflow(
|
|
335
|
+
Object.entries(definition.workflows).map(([name, value2]) => {
|
|
336
|
+
const declared2 = nativeWorkflow(value2);
|
|
185
337
|
if (declared2 === void 0) throw new Error("Invalid workflow declaration");
|
|
186
338
|
return [name, declared2];
|
|
187
339
|
})
|
|
@@ -244,7 +396,7 @@ var defineApp = (requirements, definition) => {
|
|
|
244
396
|
const native = {
|
|
245
397
|
accounts: requirements.accounts,
|
|
246
398
|
...events === void 0 ? {} : { events },
|
|
247
|
-
evaluate: (context) => factory(context).pipe(Effect_exports.map((
|
|
399
|
+
evaluate: (context) => factory(context).pipe(Effect_exports.map((value2) => adaptDefinition(value2)))
|
|
248
400
|
};
|
|
249
401
|
return {
|
|
250
402
|
[InternalApp]: native,
|
|
@@ -256,6 +408,14 @@ var defineApp = (requirements, definition) => {
|
|
|
256
408
|
export {
|
|
257
409
|
ResponseStatusError,
|
|
258
410
|
ResponseDecodeError,
|
|
411
|
+
t,
|
|
412
|
+
base64,
|
|
413
|
+
header,
|
|
414
|
+
query,
|
|
415
|
+
bearer,
|
|
416
|
+
basic,
|
|
417
|
+
declarePlacements,
|
|
418
|
+
withPlacements,
|
|
259
419
|
workflow,
|
|
260
420
|
event,
|
|
261
421
|
declaredEvents,
|
|
@@ -66,6 +66,23 @@ var NetworkRefusal = Schema_exports.Union([
|
|
|
66
66
|
reason: Schema_exports.Literal("credential_expired"),
|
|
67
67
|
/** The provider of the expired credential handle. */
|
|
68
68
|
provider: Schema_exports.String
|
|
69
|
+
}),
|
|
70
|
+
Schema_exports.Struct({
|
|
71
|
+
reason: Schema_exports.Literal("credential_placement"),
|
|
72
|
+
/** The provider of the misplaced credential handle. */
|
|
73
|
+
provider: Schema_exports.String,
|
|
74
|
+
/** Where the handle was found, such as `body` or `header x-note`. */
|
|
75
|
+
location: Schema_exports.String
|
|
76
|
+
}),
|
|
77
|
+
Schema_exports.Struct({
|
|
78
|
+
reason: Schema_exports.Literal("credential_transport"),
|
|
79
|
+
/** The provider of the credential handle the request carried. */
|
|
80
|
+
provider: Schema_exports.String
|
|
81
|
+
}),
|
|
82
|
+
Schema_exports.Struct({
|
|
83
|
+
reason: Schema_exports.Literal("credential_method"),
|
|
84
|
+
/** The refused HTTP method. */
|
|
85
|
+
method: Schema_exports.String
|
|
69
86
|
})
|
|
70
87
|
]);
|
|
71
88
|
var NetworkRefused = class extends Schema_exports.TaggedError()("NetworkRefused", {
|
|
@@ -84,6 +101,12 @@ var NetworkRefused = class extends Schema_exports.TaggedError()("NetworkRefused"
|
|
|
84
101
|
return "Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.";
|
|
85
102
|
case "credential_expired":
|
|
86
103
|
return `Executor refused this request: it carries an expired ${refusal.provider} credential handle. Use the account fields this invocation received.`;
|
|
104
|
+
case "credential_placement":
|
|
105
|
+
return `Executor refused this request: it carries a ${refusal.provider} credential handle in the ${refusal.location}, where the provider does not place it. Send credentials only as the provider's request declares, for example with the account's headers() and url().`;
|
|
106
|
+
case "credential_transport":
|
|
107
|
+
return `Executor refused this request: ${refusal.provider} credentials are sent only over HTTPS, and ${this.host} was requested over plain HTTP.`;
|
|
108
|
+
case "credential_method":
|
|
109
|
+
return `Executor refused this request: credential handles are never sent with ${refusal.method}, which asks the service to echo the request back.`;
|
|
87
110
|
}
|
|
88
111
|
}
|
|
89
112
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareElicitation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DZN5TQ53.js";
|
|
4
4
|
import {
|
|
5
5
|
bodyUpstreamError,
|
|
6
6
|
fromPromise
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZR7QAG67.js";
|
|
8
8
|
import {
|
|
9
9
|
ElicitationFailed,
|
|
10
10
|
McpError,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
defaultElicitationLimits,
|
|
17
17
|
defaultMcpClientLimits,
|
|
18
18
|
mcpSdkTimerCeilingMs
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JW5LYSER.js";
|
|
20
20
|
import {
|
|
21
21
|
jsonSchemaDecoder,
|
|
22
22
|
nestJsonSchema,
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CXDAEGXB.js";
|
|
7
7
|
import {
|
|
8
8
|
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MHB7IFG7.js";
|
|
10
10
|
import {
|
|
11
11
|
accountProviderError,
|
|
12
12
|
bodyUpstreamError,
|
|
13
13
|
httpProviderError,
|
|
14
14
|
providerErrorDetail
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZR7QAG67.js";
|
|
16
16
|
import {
|
|
17
17
|
McpCredentialsUnverified,
|
|
18
18
|
McpError,
|
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
McpToolsOptions,
|
|
21
21
|
defaultMcpClientLimits,
|
|
22
22
|
mcpHealthReserveMs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JW5LYSER.js";
|
|
24
24
|
import {
|
|
25
25
|
NetworkRefused,
|
|
26
26
|
ProviderError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7LMU3ER3.js";
|
|
28
28
|
import {
|
|
29
29
|
captureTelemetry,
|
|
30
30
|
owned
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RUP4JMKO.js";
|
|
4
4
|
import {
|
|
5
5
|
accountSecrets,
|
|
6
6
|
boundFailureMessage,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
parseSkillLoadFailed,
|
|
12
12
|
readCatalog,
|
|
13
13
|
routerSkills
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FZB6D6ZD.js";
|
|
15
15
|
import {
|
|
16
16
|
appInvocationFetch
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MHB7IFG7.js";
|
|
18
18
|
import {
|
|
19
19
|
folderSkillsEffect
|
|
20
20
|
} from "./chunk-XBG7HHXC.js";
|
|
@@ -23,13 +23,14 @@ import {
|
|
|
23
23
|
declaredEvents,
|
|
24
24
|
isApp,
|
|
25
25
|
makeEmitter,
|
|
26
|
-
toEffectApp
|
|
27
|
-
|
|
26
|
+
toEffectApp,
|
|
27
|
+
withPlacements
|
|
28
|
+
} from "./chunk-3R3KFCDU.js";
|
|
28
29
|
import {
|
|
29
30
|
declaredOperations,
|
|
30
31
|
locate,
|
|
31
32
|
nativeOperation
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZEJ3IKEC.js";
|
|
33
34
|
import {
|
|
34
35
|
accountProviderError,
|
|
35
36
|
appCode,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
method,
|
|
39
40
|
parseProviderError,
|
|
40
41
|
toPromise
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ZR7QAG67.js";
|
|
42
43
|
import {
|
|
43
44
|
AccountCheckResult,
|
|
44
45
|
DeclaredProvider,
|
|
@@ -86,13 +87,14 @@ import {
|
|
|
86
87
|
defaultWebhookTransportLimits,
|
|
87
88
|
maxInputProblems,
|
|
88
89
|
migrationsDirectory,
|
|
90
|
+
normalizePlacements,
|
|
89
91
|
reservedTablePrefix,
|
|
90
92
|
sqlBindingsLimit,
|
|
91
93
|
workflowDurationMillis
|
|
92
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-JW5LYSER.js";
|
|
93
95
|
import {
|
|
94
96
|
CacheError
|
|
95
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-7LMU3ER3.js";
|
|
96
98
|
import {
|
|
97
99
|
AppSkills,
|
|
98
100
|
SkillFile
|
|
@@ -1191,6 +1193,9 @@ function declaredExposure(exposure) {
|
|
|
1191
1193
|
const raw = named("raw");
|
|
1192
1194
|
return { ...plain.length === 0 ? {} : { plain }, ...raw.length === 0 ? {} : { raw } };
|
|
1193
1195
|
}
|
|
1196
|
+
function declaredPlacements(request) {
|
|
1197
|
+
return request === void 0 || request.length === 0 ? {} : { request: normalizePlacements(request) };
|
|
1198
|
+
}
|
|
1194
1199
|
function providerDeclaration(provider) {
|
|
1195
1200
|
return declarationSafe(
|
|
1196
1201
|
() => Effect_exports.gen(function* () {
|
|
@@ -1202,7 +1207,8 @@ function providerDeclaration(provider) {
|
|
|
1202
1207
|
type: "secrets",
|
|
1203
1208
|
label: method2.label,
|
|
1204
1209
|
fields: yield* jsonSchemaDocument(method2.fields),
|
|
1205
|
-
...declaredExposure(method2.exposure)
|
|
1210
|
+
...declaredExposure(method2.exposure),
|
|
1211
|
+
...declaredPlacements(method2.request)
|
|
1206
1212
|
});
|
|
1207
1213
|
break;
|
|
1208
1214
|
case "oauth2":
|
|
@@ -1210,7 +1216,8 @@ function providerDeclaration(provider) {
|
|
|
1210
1216
|
type: "oauth2",
|
|
1211
1217
|
...method2.config,
|
|
1212
1218
|
response: yield* jsonSchemaDocument(method2.response),
|
|
1213
|
-
...declaredExposure(method2.exposure)
|
|
1219
|
+
...declaredExposure(method2.exposure),
|
|
1220
|
+
...declaredPlacements(method2.request)
|
|
1214
1221
|
});
|
|
1215
1222
|
break;
|
|
1216
1223
|
}
|
|
@@ -1260,8 +1267,16 @@ function canonical(value) {
|
|
|
1260
1267
|
}
|
|
1261
1268
|
return JSON.stringify(value);
|
|
1262
1269
|
}
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1270
|
+
function withoutGrants({ hosts: _hosts, ...provider }) {
|
|
1271
|
+
return {
|
|
1272
|
+
...provider,
|
|
1273
|
+
auth: Object.fromEntries(
|
|
1274
|
+
Object.entries(provider.auth).map(([name, { request: _request, ...method2 }]) => [
|
|
1275
|
+
name,
|
|
1276
|
+
method2
|
|
1277
|
+
])
|
|
1278
|
+
)
|
|
1279
|
+
};
|
|
1265
1280
|
}
|
|
1266
1281
|
function bindAccounts(slots, declarations, context) {
|
|
1267
1282
|
return safe2(
|
|
@@ -1288,14 +1303,17 @@ function bindAccounts(slots, declarations, context) {
|
|
|
1288
1303
|
for (const account of accounts) {
|
|
1289
1304
|
if (ids.has(account.id)) return yield* Effect_exports.fail(new HostAccountsInvalid());
|
|
1290
1305
|
ids.add(account.id);
|
|
1291
|
-
if (canonical(
|
|
1306
|
+
if (canonical(withoutGrants(account.provider)) !== canonical(withoutGrants(requirement.definition)) || !Object.hasOwn(provider.auth, account.method))
|
|
1292
1307
|
return yield* Effect_exports.fail(new HostAccountsInvalid());
|
|
1293
1308
|
const method2 = provider.auth[account.method];
|
|
1294
1309
|
if (method2 === void 0) return yield* Effect_exports.fail(new HostAccountsInvalid());
|
|
1295
1310
|
const fields = yield* Schema_exports.decodeUnknownEffect(
|
|
1296
1311
|
method2._tag === "secrets" ? method2.fields : method2.response
|
|
1297
1312
|
)(account.fields);
|
|
1298
|
-
|
|
1313
|
+
const granted = Object.hasOwn(account.provider.auth, account.method) ? account.provider.auth[account.method]?.request : void 0;
|
|
1314
|
+
values.push(
|
|
1315
|
+
withPlacements({ id: account.id, method: account.method, fields }, granted)
|
|
1316
|
+
);
|
|
1299
1317
|
}
|
|
1300
1318
|
if (many) bound.set(slot, values);
|
|
1301
1319
|
else {
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
joinPath,
|
|
6
6
|
mergeMeta
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZEJ3IKEC.js";
|
|
8
8
|
import {
|
|
9
9
|
isShortenedUpstream,
|
|
10
10
|
parseProviderError,
|
|
11
11
|
providerError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZR7QAG67.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-JW5LYSER.js";
|
|
25
25
|
import {
|
|
26
26
|
CacheError,
|
|
27
27
|
FailureCode,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
maxFailureFields,
|
|
34
34
|
maxFailureMessageLength,
|
|
35
35
|
maxUpstreamMessageLength
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-7LMU3ER3.js";
|
|
37
37
|
import {
|
|
38
38
|
SkillLoadFailed,
|
|
39
39
|
skillFormatLimits
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixedRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FZB6D6ZD.js";
|
|
4
4
|
import {
|
|
5
5
|
nativeOperation,
|
|
6
6
|
operationDeclaration,
|
|
7
7
|
routerDeclaration
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZEJ3IKEC.js";
|
|
9
9
|
|
|
10
10
|
// src/implementation/protocol-operations.ts
|
|
11
11
|
var protocolOperations = (operations, kinds = {}) => {
|