@finalai/agent-definition 0.1.0
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.
Potentially problematic release.
This version of @finalai/agent-definition might be problematic. Click here for more details.
- package/README.md +16 -0
- package/THIRD_PARTY_NOTICES.md +303 -0
- package/dist/compiler-assets/chunk-2CZRHOLL.ts +10 -0
- package/dist/compiler-assets/chunk-32O3ODZE.ts +39 -0
- package/dist/compiler-assets/chunk-5BK6FVRE.ts +75 -0
- package/dist/compiler-assets/chunk-6WR3PGNF.ts +0 -0
- package/dist/compiler-assets/chunk-7QP2CKPI.ts +30 -0
- package/dist/compiler-assets/chunk-7VSSVZM4.ts +55 -0
- package/dist/compiler-assets/chunk-7WGYG73V.ts +42 -0
- package/dist/compiler-assets/chunk-BLB6JGLO.ts +481 -0
- package/dist/compiler-assets/chunk-CWWRTRWW.ts +76 -0
- package/dist/compiler-assets/chunk-EVQIK62B.ts +188 -0
- package/dist/compiler-assets/chunk-GNR7XBPN.ts +3364 -0
- package/dist/compiler-assets/chunk-GTUZOATD.ts +10 -0
- package/dist/compiler-assets/chunk-HFS4KLEL.ts +10 -0
- package/dist/compiler-assets/chunk-HGW4YHAY.ts +6865 -0
- package/dist/compiler-assets/chunk-HNPUTP35.ts +172 -0
- package/dist/compiler-assets/chunk-JIPNTA56.ts +59 -0
- package/dist/compiler-assets/chunk-JNJE72EH.ts +10 -0
- package/dist/compiler-assets/chunk-JPY4L2UJ.ts +349 -0
- package/dist/compiler-assets/chunk-JTGTLYDT.ts +0 -0
- package/dist/compiler-assets/chunk-LUSAAV4L.ts +33 -0
- package/dist/compiler-assets/chunk-MZMSKIKU.ts +472 -0
- package/dist/compiler-assets/chunk-NMYHO2QN.ts +25 -0
- package/dist/compiler-assets/chunk-NYTOYKKF.ts +28 -0
- package/dist/compiler-assets/chunk-OWC6SFFF.ts +295 -0
- package/dist/compiler-assets/chunk-QMKWAFVZ.ts +59 -0
- package/dist/compiler-assets/chunk-QMWTDPNT.ts +79 -0
- package/dist/compiler-assets/chunk-RWUIMTBI.ts +13 -0
- package/dist/compiler-assets/chunk-SKTNMUO7.ts +64 -0
- package/dist/compiler-assets/chunk-T6WG4L4M.ts +19 -0
- package/dist/compiler-assets/chunk-TATN3PYK.ts +81 -0
- package/dist/compiler-assets/chunk-VHXHUU7L.ts +16 -0
- package/dist/compiler-assets/chunk-WMXMVFHM.ts +121 -0
- package/dist/compiler-assets/chunk-XHKPWT3G.ts +55 -0
- package/dist/compiler-assets/chunk-ZDLVA6XF.ts +476 -0
- package/dist/compiler-assets/src/authoring/agent.ts +10 -0
- package/dist/compiler-assets/src/authoring/approval.ts +19 -0
- package/dist/compiler-assets/src/authoring/brand.ts +23 -0
- package/dist/compiler-assets/src/authoring/channels.ts +26 -0
- package/dist/compiler-assets/src/authoring/connections.ts +10 -0
- package/dist/compiler-assets/src/authoring/context.ts +7 -0
- package/dist/compiler-assets/src/authoring/credentials.ts +21 -0
- package/dist/compiler-assets/src/authoring/dynamic.ts +10 -0
- package/dist/compiler-assets/src/authoring/harness.ts +17 -0
- package/dist/compiler-assets/src/authoring/hooks.ts +28 -0
- package/dist/compiler-assets/src/authoring/index.ts +110 -0
- package/dist/compiler-assets/src/authoring/instructions.ts +14 -0
- package/dist/compiler-assets/src/authoring/sandbox.ts +25 -0
- package/dist/compiler-assets/src/authoring/schedules.ts +10 -0
- package/dist/compiler-assets/src/authoring/skills.ts +10 -0
- package/dist/compiler-assets/src/authoring/tools.ts +23 -0
- package/dist/compiler-assets/src/compatibility.ts +14810 -0
- package/dist/compiler-assets/src/compiler/evaluate-child.mjs +77 -0
- package/dist/compiler-assets/src/index.ts +195 -0
- package/dist/compiler-assets/src/manifest.ts +72 -0
- package/dist/compiler-assets/src/resolve.ts +19 -0
- package/dist/compiler-assets/src/runtime/bundle.ts +72 -0
- package/dist/compiler-assets/src/runtime/describe.ts +31 -0
- package/dist/compiler-assets/src/runtime/described.ts +142 -0
- package/dist/compiler-assets/src/runtime/isolate.ts +28 -0
- package/dist/compiler-assets/src/runtime/layout.ts +15 -0
- package/dist/compiler-assets/src/runtime/lower.ts +52 -0
- package/dist/compiler-assets/src/runtime/schema-validation.ts +21 -0
- package/dist/compiler-assets/src/runtime/values.ts +38 -0
- package/dist/modules/authoring/agent.d.mts +22 -0
- package/dist/modules/authoring/agent.mjs +6 -0
- package/dist/modules/authoring/agent.mjs.map +7 -0
- package/dist/modules/authoring/approval.d.mts +17 -0
- package/dist/modules/authoring/approval.mjs +42 -0
- package/dist/modules/authoring/approval.mjs.map +7 -0
- package/dist/modules/authoring/brand.d.mts +27 -0
- package/dist/modules/authoring/brand.mjs +51 -0
- package/dist/modules/authoring/brand.mjs.map +7 -0
- package/dist/modules/authoring/channels.d.mts +41 -0
- package/dist/modules/authoring/channels.mjs +65 -0
- package/dist/modules/authoring/channels.mjs.map +7 -0
- package/dist/modules/authoring/connections.d.mts +23 -0
- package/dist/modules/authoring/connections.mjs +6 -0
- package/dist/modules/authoring/connections.mjs.map +7 -0
- package/dist/modules/authoring/context.d.mts +83 -0
- package/dist/modules/authoring/context.mjs +12 -0
- package/dist/modules/authoring/context.mjs.map +7 -0
- package/dist/modules/authoring/credentials.d.mts +10 -0
- package/dist/modules/authoring/credentials.mjs +31 -0
- package/dist/modules/authoring/credentials.mjs.map +7 -0
- package/dist/modules/authoring/dynamic.d.mts +30 -0
- package/dist/modules/authoring/dynamic.mjs +15 -0
- package/dist/modules/authoring/dynamic.mjs.map +7 -0
- package/dist/modules/authoring/harness.d.mts +85 -0
- package/dist/modules/authoring/harness.mjs +55 -0
- package/dist/modules/authoring/harness.mjs.map +7 -0
- package/dist/modules/authoring/hooks.d.mts +120 -0
- package/dist/modules/authoring/hooks.mjs +72 -0
- package/dist/modules/authoring/hooks.mjs.map +7 -0
- package/dist/modules/authoring/index.d.mts +27 -0
- package/dist/modules/authoring/index.mjs +63 -0
- package/dist/modules/authoring/index.mjs.map +7 -0
- package/dist/modules/authoring/instructions.d.mts +13 -0
- package/dist/modules/authoring/instructions.mjs +15 -0
- package/dist/modules/authoring/instructions.mjs.map +7 -0
- package/dist/modules/authoring/sandbox.d.mts +21 -0
- package/dist/modules/authoring/sandbox.mjs +13 -0
- package/dist/modules/authoring/sandbox.mjs.map +7 -0
- package/dist/modules/authoring/schedules.d.mts +8 -0
- package/dist/modules/authoring/schedules.mjs +6 -0
- package/dist/modules/authoring/schedules.mjs.map +7 -0
- package/dist/modules/authoring/skills.d.mts +8 -0
- package/dist/modules/authoring/skills.mjs +6 -0
- package/dist/modules/authoring/skills.mjs.map +7 -0
- package/dist/modules/authoring/tools.d.mts +80 -0
- package/dist/modules/authoring/tools.mjs +70 -0
- package/dist/modules/authoring/tools.mjs.map +7 -0
- package/dist/modules/compatibility.d.mts +36 -0
- package/dist/modules/compatibility.mjs +536 -0
- package/dist/modules/compatibility.mjs.map +7 -0
- package/dist/modules/compiler/assemble.d.mts +30 -0
- package/dist/modules/compiler/assemble.mjs +923 -0
- package/dist/modules/compiler/assemble.mjs.map +7 -0
- package/dist/modules/compiler/bundle.d.mts +22 -0
- package/dist/modules/compiler/bundle.mjs +385 -0
- package/dist/modules/compiler/bundle.mjs.map +7 -0
- package/dist/modules/compiler/diagnostics.d.mts +40 -0
- package/dist/modules/compiler/diagnostics.mjs +38 -0
- package/dist/modules/compiler/diagnostics.mjs.map +7 -0
- package/dist/modules/compiler/discovery.d.mts +36 -0
- package/dist/modules/compiler/discovery.mjs +158 -0
- package/dist/modules/compiler/discovery.mjs.map +7 -0
- package/dist/modules/compiler/evaluate.d.mts +13 -0
- package/dist/modules/compiler/evaluate.mjs +194 -0
- package/dist/modules/compiler/evaluate.mjs.map +7 -0
- package/dist/modules/compiler/files.d.mts +19 -0
- package/dist/modules/compiler/files.mjs +90 -0
- package/dist/modules/compiler/files.mjs.map +7 -0
- package/dist/modules/compiler/frontmatter.d.mts +9 -0
- package/dist/modules/compiler/frontmatter.mjs +34 -0
- package/dist/modules/compiler/frontmatter.mjs.map +7 -0
- package/dist/modules/compiler/index.d.mts +49 -0
- package/dist/modules/compiler/index.mjs +244 -0
- package/dist/modules/compiler/index.mjs.map +7 -0
- package/dist/modules/compiler/load.d.mts +8 -0
- package/dist/modules/compiler/load.mjs +45 -0
- package/dist/modules/compiler/load.mjs.map +7 -0
- package/dist/modules/compiler/local-isolate.d.mts +20 -0
- package/dist/modules/compiler/local-isolate.mjs +93 -0
- package/dist/modules/compiler/local-isolate.mjs.map +7 -0
- package/dist/modules/compiler/packages.d.mts +66 -0
- package/dist/modules/compiler/packages.mjs +307 -0
- package/dist/modules/compiler/packages.mjs.map +7 -0
- package/dist/modules/index.d.mts +7 -0
- package/dist/modules/index.mjs +25 -0
- package/dist/modules/index.mjs.map +7 -0
- package/dist/modules/manifest.d.mts +2 -0
- package/dist/modules/manifest.mjs +67 -0
- package/dist/modules/manifest.mjs.map +7 -0
- package/dist/modules/resolve.d.mts +24 -0
- package/dist/modules/resolve.mjs +176 -0
- package/dist/modules/resolve.mjs.map +7 -0
- package/dist/modules/runtime/bundle.d.mts +12 -0
- package/dist/modules/runtime/bundle.mjs +48 -0
- package/dist/modules/runtime/bundle.mjs.map +7 -0
- package/dist/modules/runtime/describe.d.mts +19 -0
- package/dist/modules/runtime/describe.mjs +471 -0
- package/dist/modules/runtime/describe.mjs.map +7 -0
- package/dist/modules/runtime/described.d.mts +376 -0
- package/dist/modules/runtime/described.mjs +116 -0
- package/dist/modules/runtime/described.mjs.map +7 -0
- package/dist/modules/runtime/isolate.d.mts +70 -0
- package/dist/modules/runtime/isolate.mjs +454 -0
- package/dist/modules/runtime/isolate.mjs.map +7 -0
- package/dist/modules/runtime/layout.d.mts +21 -0
- package/dist/modules/runtime/layout.mjs +24 -0
- package/dist/modules/runtime/layout.mjs.map +7 -0
- package/dist/modules/runtime/lower.d.mts +73 -0
- package/dist/modules/runtime/lower.mjs +463 -0
- package/dist/modules/runtime/lower.mjs.map +7 -0
- package/dist/modules/runtime/schema-validation.d.mts +21 -0
- package/dist/modules/runtime/schema-validation.mjs +238 -0
- package/dist/modules/runtime/schema-validation.mjs.map +7 -0
- package/dist/modules/runtime/values.d.mts +20 -0
- package/dist/modules/runtime/values.mjs +48 -0
- package/dist/modules/runtime/values.mjs.map +7 -0
- package/fixtures/acme-fleet/agent/agent.ts +74 -0
- package/fixtures/acme-fleet/agent/instructions.md +1 -0
- package/fixtures/assistant/agent/agent.ts +16 -0
- package/fixtures/assistant/agent/instructions.md +1 -0
- package/fixtures/assistant/agent/tools/current_time.ts +9 -0
- package/fixtures/assistant-with-tools/agent/agent.ts +16 -0
- package/fixtures/assistant-with-tools/agent/instructions.md +1 -0
- package/fixtures/assistant-with-tools/agent/tools/current_time.ts +9 -0
- package/fixtures/final-connection/agent/agent.ts +15 -0
- package/fixtures/final-connection/agent/connections/final.ts +9 -0
- package/fixtures/release-scout/agent/agent.ts +22 -0
- package/fixtures/release-scout/agent/channels/github-signature.ts +27 -0
- package/fixtures/release-scout/agent/channels/github.ts +38 -0
- package/fixtures/release-scout/agent/connections/linear.ts +9 -0
- package/fixtures/release-scout/agent/hooks/audit.ts +24 -0
- package/fixtures/release-scout/agent/instructions/org-context.ts +26 -0
- package/fixtures/release-scout/agent/instructions.md +2 -0
- package/fixtures/release-scout/agent/sandbox.ts +20 -0
- package/fixtures/release-scout/agent/schedules/daily-digest.md +7 -0
- package/fixtures/release-scout/agent/skills/triage/SKILL.md +8 -0
- package/fixtures/release-scout/agent/skills/triage/checklist.md +3 -0
- package/fixtures/release-scout/agent/tools/lookup_release_notes.ts +24 -0
- package/fixtures/tsconfig.json +5 -0
- package/package.json +94 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
jsonObjectSchema
|
|
3
|
+
} from "./chunk-7QP2CKPI.ts";
|
|
4
|
+
import {
|
|
5
|
+
stamp
|
|
6
|
+
} from "./chunk-XHKPWT3G.ts";
|
|
7
|
+
import {
|
|
8
|
+
array,
|
|
9
|
+
nativeEnum,
|
|
10
|
+
object,
|
|
11
|
+
string
|
|
12
|
+
} from "./chunk-HGW4YHAY.ts";
|
|
13
|
+
|
|
14
|
+
// ../agent-provider/src/channel-context.ts
|
|
15
|
+
var ChannelPrincipalType = /* @__PURE__ */ ((ChannelPrincipalType2) => {
|
|
16
|
+
ChannelPrincipalType2["User"] = "user";
|
|
17
|
+
ChannelPrincipalType2["Service"] = "service";
|
|
18
|
+
return ChannelPrincipalType2;
|
|
19
|
+
})(ChannelPrincipalType || {});
|
|
20
|
+
var channelAuthSchema = object({
|
|
21
|
+
principalId: string().min(1),
|
|
22
|
+
principalType: nativeEnum(ChannelPrincipalType),
|
|
23
|
+
authenticator: string().min(1),
|
|
24
|
+
attributes: jsonObjectSchema.default({})
|
|
25
|
+
});
|
|
26
|
+
var channelAccessors = (platform) => {
|
|
27
|
+
const operations = () => {
|
|
28
|
+
if (platform.channelSessions == null)
|
|
29
|
+
throw new Error("channel session operations are unavailable");
|
|
30
|
+
return platform.channelSessions;
|
|
31
|
+
};
|
|
32
|
+
const handle = (target) => ({
|
|
33
|
+
inspect: () => operations().inspect(target),
|
|
34
|
+
resolveSession: () => operations().resolve(target),
|
|
35
|
+
send: (input) => operations().send(target, input),
|
|
36
|
+
respond: (input) => operations().respond(target, input),
|
|
37
|
+
cancel: (input) => operations().cancel(target, input),
|
|
38
|
+
close: () => operations().close(target),
|
|
39
|
+
observe: (input) => operations().observe(target, input),
|
|
40
|
+
setConfigOption: (input) => operations().setConfigOption(target, input),
|
|
41
|
+
park: () => operations().park(target),
|
|
42
|
+
getState: () => operations().getState(target),
|
|
43
|
+
setState: (state) => operations().setState(target, state)
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
from: (address) => handle({ address }),
|
|
47
|
+
resolveSession: (address) => operations().resolve({ address }),
|
|
48
|
+
attachSession: (sessionId) => handle({ sessionId }),
|
|
49
|
+
to: (channel, target) => ({ send: (input) => operations().handoff(channel, target, input) })
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// ../agent-provider/src/semantic-events.ts
|
|
54
|
+
var channelMessageCompletedSchema = object({
|
|
55
|
+
message: object({ id: string(), content: array(jsonObjectSchema) }),
|
|
56
|
+
finishReason: string().nullable()
|
|
57
|
+
});
|
|
58
|
+
var channelTurnEventSchema = object({
|
|
59
|
+
turnId: string(),
|
|
60
|
+
stopReason: string().nullable().optional()
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// src/authoring/channels.ts
|
|
64
|
+
var defineChannel = (definition) => {
|
|
65
|
+
const {
|
|
66
|
+
"message.delta": delta,
|
|
67
|
+
"message.completed": completed,
|
|
68
|
+
"turn.started": started,
|
|
69
|
+
"turn.completed": ended,
|
|
70
|
+
...raw
|
|
71
|
+
} = definition.events ?? {};
|
|
72
|
+
const events = { ...raw };
|
|
73
|
+
const wrap = (schema, handler) => handler == null ? void 0 : async (event, ctx) => handler(
|
|
74
|
+
schema.parse(event.data),
|
|
75
|
+
{ ...channelAccessors(ctx.platform), platform: ctx.platform },
|
|
76
|
+
{
|
|
77
|
+
sessionId: ctx.sessionId ?? null,
|
|
78
|
+
turnId: ctx.turn.id,
|
|
79
|
+
state: ctx.state
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
const semantic = {
|
|
83
|
+
"message.delta": wrap(object({ messageId: string(), delta: jsonObjectSchema }), delta),
|
|
84
|
+
"message.completed": wrap(channelMessageCompletedSchema, completed),
|
|
85
|
+
"turn.started": wrap(object({ turnId: string() }), started),
|
|
86
|
+
"turn.completed": wrap(
|
|
87
|
+
object({ turnId: string(), stopReason: string().nullable() }),
|
|
88
|
+
ended
|
|
89
|
+
)
|
|
90
|
+
};
|
|
91
|
+
for (const [kind, handler] of Object.entries(semantic))
|
|
92
|
+
if (handler != null) events[kind] = handler;
|
|
93
|
+
const { installed, configure, ...authored } = definition;
|
|
94
|
+
return stamp(
|
|
95
|
+
{ ...authored, configure: installed == null ? configure : void 0, events },
|
|
96
|
+
"channel" /* Channel */
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
var disableChannel = () => defineChannel({ disabled: true });
|
|
100
|
+
var route = (method) => (path, handler) => ({
|
|
101
|
+
method,
|
|
102
|
+
path,
|
|
103
|
+
handler
|
|
104
|
+
});
|
|
105
|
+
var GET = route("GET");
|
|
106
|
+
var POST = route("POST");
|
|
107
|
+
var PUT = route("PUT");
|
|
108
|
+
var DELETE = route("DELETE");
|
|
109
|
+
var WS = (path, handler) => ({ method: "WS", path, handler });
|
|
110
|
+
var defineProviderChannel = (definition) => stamp(definition, "channel" /* Channel */);
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
defineChannel,
|
|
114
|
+
disableChannel,
|
|
115
|
+
GET,
|
|
116
|
+
POST,
|
|
117
|
+
PUT,
|
|
118
|
+
DELETE,
|
|
119
|
+
WS,
|
|
120
|
+
defineProviderChannel
|
|
121
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isObjectLike
|
|
3
|
+
} from "./chunk-JIPNTA56.ts";
|
|
4
|
+
|
|
5
|
+
// src/authoring/brand.ts
|
|
6
|
+
var AuthoredKind = /* @__PURE__ */ ((AuthoredKind2) => {
|
|
7
|
+
AuthoredKind2["Agent"] = "agent";
|
|
8
|
+
AuthoredKind2["Tool"] = "tool";
|
|
9
|
+
AuthoredKind2["Dynamic"] = "dynamic";
|
|
10
|
+
AuthoredKind2["Instructions"] = "instructions";
|
|
11
|
+
AuthoredKind2["Skill"] = "skill";
|
|
12
|
+
AuthoredKind2["Connection"] = "connection";
|
|
13
|
+
AuthoredKind2["Schedule"] = "schedule";
|
|
14
|
+
AuthoredKind2["SandboxSelector"] = "sandbox-selector";
|
|
15
|
+
AuthoredKind2["BaseTools"] = "base-tools";
|
|
16
|
+
AuthoredKind2["HarnessHost"] = "harness-host";
|
|
17
|
+
AuthoredKind2["Hook"] = "hook";
|
|
18
|
+
AuthoredKind2["Channel"] = "channel";
|
|
19
|
+
AuthoredKind2["Approval"] = "approval";
|
|
20
|
+
return AuthoredKind2;
|
|
21
|
+
})(AuthoredKind || {});
|
|
22
|
+
var kinds = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
var stamp = (value, kind) => {
|
|
24
|
+
kinds.set(value, kind);
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
var authoredKindOf = (value) => isObjectLike(value) ? kinds.get(value) ?? null : null;
|
|
28
|
+
var isAuthored = (value, kind) => authoredKindOf(value) === kind;
|
|
29
|
+
var PENDING_PREFIX = "<pending:";
|
|
30
|
+
var pendingValues = [];
|
|
31
|
+
var registerPending = (value) => {
|
|
32
|
+
pendingValues.push(value);
|
|
33
|
+
return `${PENDING_PREFIX}${pendingValues.length - 1}>`;
|
|
34
|
+
};
|
|
35
|
+
var pendingEntries = () => pendingValues.map((value, index) => ({
|
|
36
|
+
placeholder: `${PENDING_PREFIX}${index}>`,
|
|
37
|
+
index,
|
|
38
|
+
value
|
|
39
|
+
}));
|
|
40
|
+
var pendingIndexOf = (placeholder) => {
|
|
41
|
+
const match = /^<pending:(\d+)>$/.exec(placeholder);
|
|
42
|
+
return match?.[1] == null ? null : Number(match[1]);
|
|
43
|
+
};
|
|
44
|
+
var pendingExportName = (index) => `pending:${index}`;
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
AuthoredKind,
|
|
48
|
+
stamp,
|
|
49
|
+
authoredKindOf,
|
|
50
|
+
isAuthored,
|
|
51
|
+
registerPending,
|
|
52
|
+
pendingEntries,
|
|
53
|
+
pendingIndexOf,
|
|
54
|
+
pendingExportName
|
|
55
|
+
};
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toolLabelSchema
|
|
3
|
+
} from "./chunk-TATN3PYK.ts";
|
|
4
|
+
import {
|
|
5
|
+
jsonSchemaDeclarationError
|
|
6
|
+
} from "./chunk-GNR7XBPN.ts";
|
|
7
|
+
import {
|
|
8
|
+
lowerApproval
|
|
9
|
+
} from "./chunk-7VSSVZM4.ts";
|
|
10
|
+
import {
|
|
11
|
+
authoredKindOf,
|
|
12
|
+
pendingExportName,
|
|
13
|
+
pendingIndexOf
|
|
14
|
+
} from "./chunk-XHKPWT3G.ts";
|
|
15
|
+
import {
|
|
16
|
+
authoredRecordSchema,
|
|
17
|
+
authoredValueSchema,
|
|
18
|
+
callableSchema,
|
|
19
|
+
entriesOf,
|
|
20
|
+
fieldOf,
|
|
21
|
+
isBoolean,
|
|
22
|
+
isCallable,
|
|
23
|
+
isNumber,
|
|
24
|
+
isObjectLike,
|
|
25
|
+
isPlainObject,
|
|
26
|
+
isString,
|
|
27
|
+
messageOf,
|
|
28
|
+
optionalValueSchema
|
|
29
|
+
} from "./chunk-JIPNTA56.ts";
|
|
30
|
+
import {
|
|
31
|
+
ZodType,
|
|
32
|
+
array,
|
|
33
|
+
boolean,
|
|
34
|
+
literal,
|
|
35
|
+
looseObject,
|
|
36
|
+
object,
|
|
37
|
+
record,
|
|
38
|
+
string,
|
|
39
|
+
toJSONSchema,
|
|
40
|
+
union,
|
|
41
|
+
url
|
|
42
|
+
} from "./chunk-HGW4YHAY.ts";
|
|
43
|
+
|
|
44
|
+
// src/runtime/lower.ts
|
|
45
|
+
var IssueSeverity = /* @__PURE__ */ ((IssueSeverity2) => {
|
|
46
|
+
IssueSeverity2["Error"] = "error";
|
|
47
|
+
IssueSeverity2["Warning"] = "warning";
|
|
48
|
+
IssueSeverity2["Note"] = "note";
|
|
49
|
+
return IssueSeverity2;
|
|
50
|
+
})(IssueSeverity || {});
|
|
51
|
+
var error = (message) => ({ severity: "error" /* Error */, message });
|
|
52
|
+
var warning = (message) => ({
|
|
53
|
+
severity: "warning" /* Warning */,
|
|
54
|
+
message
|
|
55
|
+
});
|
|
56
|
+
var note = (message) => ({ severity: "note" /* Note */, message });
|
|
57
|
+
var childPath = (parent, key) => {
|
|
58
|
+
if (isNumber(key)) return `${parent}[${key}]`;
|
|
59
|
+
return parent.length === 0 ? key : `${parent}.${key}`;
|
|
60
|
+
};
|
|
61
|
+
var PENDING_PLACEHOLDER = /^<pending:\d+>$/;
|
|
62
|
+
var label = (path) => path.length === 0 ? "value" : path;
|
|
63
|
+
var toJson = (value, options) => {
|
|
64
|
+
const visited = options.visit?.(value, options.path);
|
|
65
|
+
if (visited !== void 0) return visited;
|
|
66
|
+
if (value == null) return null;
|
|
67
|
+
if (isString(value)) {
|
|
68
|
+
const index = PENDING_PLACEHOLDER.test(value) ? pendingIndexOf(value) : null;
|
|
69
|
+
return index == null ? value : pendingExportName(index);
|
|
70
|
+
}
|
|
71
|
+
if (isNumber(value)) {
|
|
72
|
+
if (Number.isFinite(value)) return value;
|
|
73
|
+
options.issues.push(error(`${label(options.path)} is not a finite number`));
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (isBoolean(value)) return value;
|
|
77
|
+
if (Array.isArray(value)) {
|
|
78
|
+
return value.map(
|
|
79
|
+
(item, index) => toJson(item, { ...options, path: childPath(options.path, index) })
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (isCallable(value)) {
|
|
83
|
+
options.issues.push(
|
|
84
|
+
error(`${label(options.path)} is a function; only static values can appear here`)
|
|
85
|
+
);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (isPlainObject(value) || authoredKindOf(value) != null) {
|
|
89
|
+
const out = {};
|
|
90
|
+
for (const [key, item] of entriesOf(value)) {
|
|
91
|
+
if (item === void 0) continue;
|
|
92
|
+
out[key] = toJson(item, { ...options, path: childPath(options.path, key) });
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
options.issues.push(
|
|
97
|
+
error(`${label(options.path)} is not JSON (${Object.prototype.toString.call(value)})`)
|
|
98
|
+
);
|
|
99
|
+
return null;
|
|
100
|
+
};
|
|
101
|
+
var jsonSchemaObjectSchema = record(string(), authoredValueSchema);
|
|
102
|
+
var standardJsonSchemaSchema = looseObject({
|
|
103
|
+
"~standard": looseObject({
|
|
104
|
+
jsonSchema: looseObject({ input: callableSchema, output: callableSchema.optional() }).optional()
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
var isZodSchema = (value) => value instanceof ZodType;
|
|
108
|
+
var toJsonSchema = (args) => {
|
|
109
|
+
const { schema, path, issues } = args;
|
|
110
|
+
const io = args.io ?? "input" /* Input */;
|
|
111
|
+
const standard = standardJsonSchemaSchema.safeParse(schema);
|
|
112
|
+
const jsonSchema = fieldOf(fieldOf(schema, "~standard"), "jsonSchema");
|
|
113
|
+
let converted = null;
|
|
114
|
+
if (standard.success && standard.data["~standard"].jsonSchema != null) {
|
|
115
|
+
try {
|
|
116
|
+
const convert = standard.data["~standard"].jsonSchema[io];
|
|
117
|
+
if (convert == null) throw new Error(`Standard JSON Schema has no ${io} converter`);
|
|
118
|
+
converted = convert.call(jsonSchema, {
|
|
119
|
+
target: "draft-2020-12"
|
|
120
|
+
});
|
|
121
|
+
} catch (cause) {
|
|
122
|
+
issues.push(error(`${path} could not be converted to JSON Schema: ${messageOf(cause)}`));
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
} else if (isZodSchema(schema)) {
|
|
126
|
+
converted = toJSONSchema(schema, { io });
|
|
127
|
+
} else if (standard.success) {
|
|
128
|
+
issues.push(
|
|
129
|
+
error(
|
|
130
|
+
`${path} is a Standard Schema without JSON Schema support; use zod 4 or a JSON Schema object`
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
return null;
|
|
134
|
+
} else if (isPlainObject(schema)) {
|
|
135
|
+
converted = schema;
|
|
136
|
+
} else {
|
|
137
|
+
issues.push(error(`${path} must be a zod schema or a JSON Schema object`));
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const json = toJson(converted, { path, issues });
|
|
141
|
+
if (json == null || Array.isArray(json) || !jsonSchemaObjectSchema.safeParse(json).success || !isPlainObject(json)) {
|
|
142
|
+
issues.push(error(`${path} did not produce a JSON Schema object`));
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const out = {};
|
|
146
|
+
for (const [key, item] of Object.entries(json)) {
|
|
147
|
+
if (key !== "$schema" || !standard.success && !isZodSchema(schema)) out[key] = item;
|
|
148
|
+
}
|
|
149
|
+
const declarationError = jsonSchemaDeclarationError(out);
|
|
150
|
+
if (declarationError != null) {
|
|
151
|
+
issues.push(error(`${path} is an invalid JSON Schema: ${declarationError}`));
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
};
|
|
156
|
+
var authoredToolSchema = looseObject({
|
|
157
|
+
description: optionalValueSchema,
|
|
158
|
+
execute: optionalValueSchema,
|
|
159
|
+
inputSchema: optionalValueSchema,
|
|
160
|
+
outputSchema: optionalValueSchema,
|
|
161
|
+
endsTurn: optionalValueSchema,
|
|
162
|
+
approval: optionalValueSchema,
|
|
163
|
+
label: optionalValueSchema,
|
|
164
|
+
annotations: looseObject({
|
|
165
|
+
title: string().optional(),
|
|
166
|
+
readOnlyHint: boolean().optional(),
|
|
167
|
+
destructiveHint: boolean().optional(),
|
|
168
|
+
idempotentHint: boolean().optional(),
|
|
169
|
+
openWorldHint: boolean().optional()
|
|
170
|
+
}).optional().catch(void 0)
|
|
171
|
+
});
|
|
172
|
+
var lowerTool = (args) => {
|
|
173
|
+
const issues = [];
|
|
174
|
+
const path = `tool ${args.name}`;
|
|
175
|
+
const parsed = authoredToolSchema.safeParse(args.value);
|
|
176
|
+
if (!parsed.success) {
|
|
177
|
+
issues.push(error(`${path} must be defineTool({ description, inputSchema, execute })`));
|
|
178
|
+
return {
|
|
179
|
+
descriptor: {
|
|
180
|
+
name: args.name,
|
|
181
|
+
description: "",
|
|
182
|
+
inputSchema: { type: "object" },
|
|
183
|
+
export: args.exportName
|
|
184
|
+
},
|
|
185
|
+
approval: "ask" /* Ask */,
|
|
186
|
+
issues
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const tool = parsed.data;
|
|
190
|
+
const description = isString(tool.description) ? tool.description : "";
|
|
191
|
+
if (description.length === 0) issues.push(error(`${path} needs a description`));
|
|
192
|
+
if (!isCallable(tool.execute)) issues.push(error(`${path} needs an execute function`));
|
|
193
|
+
const inputSchema = toJsonSchema({
|
|
194
|
+
schema: tool.inputSchema,
|
|
195
|
+
path: `${path} inputSchema`,
|
|
196
|
+
issues
|
|
197
|
+
}) ?? {
|
|
198
|
+
type: "object"
|
|
199
|
+
};
|
|
200
|
+
if (tool.endsTurn != null && tool.endsTurn !== false) {
|
|
201
|
+
issues.push(
|
|
202
|
+
error(`${path} sets endsTurn; it is not supported because the harness owns the loop`)
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
const approval = lowerApproval(tool.approval);
|
|
206
|
+
if (approval.error != null) issues.push(error(`${path}: ${approval.error}`));
|
|
207
|
+
if (approval.note != null) issues.push(note(`${path}: ${approval.note}`));
|
|
208
|
+
const descriptor = {
|
|
209
|
+
name: args.name,
|
|
210
|
+
description,
|
|
211
|
+
inputSchema,
|
|
212
|
+
export: args.exportName
|
|
213
|
+
};
|
|
214
|
+
if (approval.inputDependent)
|
|
215
|
+
descriptor.inputApproval = { kind: "tool" /* Tool */, export: args.exportName };
|
|
216
|
+
if (tool.outputSchema != null) {
|
|
217
|
+
const outputSchema = toJsonSchema({
|
|
218
|
+
schema: tool.outputSchema,
|
|
219
|
+
path: `${path} outputSchema`,
|
|
220
|
+
issues,
|
|
221
|
+
io: "output" /* Output */
|
|
222
|
+
});
|
|
223
|
+
if (outputSchema != null) descriptor.outputSchema = outputSchema;
|
|
224
|
+
}
|
|
225
|
+
const annotations = { ...tool.annotations };
|
|
226
|
+
if (tool.label != null && !toolLabelSchema.safeParse(tool.label).success)
|
|
227
|
+
issues.push(error(`${path} label must be text or { start, delta?, complete? } callbacks`));
|
|
228
|
+
if (isString(tool.label)) annotations.title = tool.label;
|
|
229
|
+
if (Object.keys(annotations).length > 0) descriptor.annotations = annotations;
|
|
230
|
+
return { descriptor, approval: approval.policy, issues };
|
|
231
|
+
};
|
|
232
|
+
var authoredConnectionSchema = looseObject({
|
|
233
|
+
url: optionalValueSchema,
|
|
234
|
+
auth: optionalValueSchema,
|
|
235
|
+
headers: optionalValueSchema,
|
|
236
|
+
approval: optionalValueSchema,
|
|
237
|
+
toolCall: optionalValueSchema,
|
|
238
|
+
tools: looseObject({
|
|
239
|
+
allow: array(string()).optional(),
|
|
240
|
+
deny: array(string()).optional(),
|
|
241
|
+
approval: authoredRecordSchema.optional()
|
|
242
|
+
}).optional()
|
|
243
|
+
});
|
|
244
|
+
var connectionAuthSchema = union([
|
|
245
|
+
object({ kind: literal("final-session") }).transform(() => ({ kind: "final-session" })),
|
|
246
|
+
looseObject({ secretKey: string().min(1), headerName: string().nullish() }).transform((auth) => ({ secretKey: auth.secretKey, headerName: auth.headerName ?? null }))
|
|
247
|
+
]);
|
|
248
|
+
var stringRecord = (value, path, issues) => {
|
|
249
|
+
if (value == null) return {};
|
|
250
|
+
const parsed = record(string(), string()).safeParse(value);
|
|
251
|
+
if (parsed.success) return parsed.data;
|
|
252
|
+
issues.push(error(`${path} must be a record of strings (header callbacks are not supported)`));
|
|
253
|
+
return {};
|
|
254
|
+
};
|
|
255
|
+
var lowerAuth = (value, path, issues) => {
|
|
256
|
+
if (value == null) return null;
|
|
257
|
+
const parsed = connectionAuthSchema.safeParse(value);
|
|
258
|
+
if (parsed.success) return parsed.data;
|
|
259
|
+
issues.push(
|
|
260
|
+
error(
|
|
261
|
+
`${path} must be { secretKey, headerName } or { kind: 'final-session' }; auth providers and callbacks are not supported`
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
return null;
|
|
265
|
+
};
|
|
266
|
+
var lowerConnection = (args) => {
|
|
267
|
+
const issues = [];
|
|
268
|
+
const path = `connection ${args.key}`;
|
|
269
|
+
const parsed = authoredConnectionSchema.safeParse(args.value);
|
|
270
|
+
const connection = parsed.success ? parsed.data : null;
|
|
271
|
+
if (connection == null)
|
|
272
|
+
issues.push(error(`${path} must be defineMcpClientConnection({ url, ... })`));
|
|
273
|
+
const url2 = isString(connection?.url) ? connection.url : null;
|
|
274
|
+
if (url2 == null || !url().safeParse(url2).success)
|
|
275
|
+
issues.push(error(`${path} needs a valid url`));
|
|
276
|
+
const tools = connection?.tools;
|
|
277
|
+
const defaultApproval = lowerApproval(connection?.approval);
|
|
278
|
+
if (defaultApproval.error != null) issues.push(error(`${path}: ${defaultApproval.error}`));
|
|
279
|
+
if (defaultApproval.note != null) issues.push(note(`${path}: ${defaultApproval.note}`));
|
|
280
|
+
const overrideEntries = [];
|
|
281
|
+
const inputApprovalEntries = [];
|
|
282
|
+
const staticOverrideKeys = [];
|
|
283
|
+
if (defaultApproval.inputDependent)
|
|
284
|
+
inputApprovalEntries.push([
|
|
285
|
+
"*",
|
|
286
|
+
{ kind: "connection" /* Connection */, export: args.exportName }
|
|
287
|
+
]);
|
|
288
|
+
for (const [tool, approval] of Object.entries(tools?.approval ?? {})) {
|
|
289
|
+
const lowered = lowerApproval(approval);
|
|
290
|
+
if (lowered.error != null)
|
|
291
|
+
issues.push(error(`${path} tools.approval.${tool}: ${lowered.error}`));
|
|
292
|
+
if (lowered.note != null) issues.push(note(`${path} tools.approval.${tool}: ${lowered.note}`));
|
|
293
|
+
overrideEntries.push([tool, lowered.policy]);
|
|
294
|
+
if (lowered.inputDependent)
|
|
295
|
+
inputApprovalEntries.push([
|
|
296
|
+
tool,
|
|
297
|
+
{ kind: "connection" /* Connection */, export: args.exportName, policyKey: tool }
|
|
298
|
+
]);
|
|
299
|
+
else staticOverrideKeys.push(tool);
|
|
300
|
+
}
|
|
301
|
+
const overrides = Object.fromEntries(overrideEntries);
|
|
302
|
+
const inputApprovals = Object.fromEntries(inputApprovalEntries);
|
|
303
|
+
for (const key of staticOverrideKeys) delete inputApprovals[key];
|
|
304
|
+
const defaultPolicy = overrides["*"] ?? defaultApproval.policy;
|
|
305
|
+
const allow = tools?.allow ?? null;
|
|
306
|
+
let approvals = null;
|
|
307
|
+
if (allow != null) {
|
|
308
|
+
approvals = Object.fromEntries(allow.map((tool) => [tool, overrides[tool] ?? defaultPolicy]));
|
|
309
|
+
const inherited = Object.hasOwn(inputApprovals, "*") ? inputApprovals["*"] : void 0;
|
|
310
|
+
if (inherited != null) {
|
|
311
|
+
for (const tool of allow) {
|
|
312
|
+
if (!Object.hasOwn(overrides, tool))
|
|
313
|
+
Object.defineProperty(inputApprovals, tool, {
|
|
314
|
+
value: inherited,
|
|
315
|
+
enumerable: true,
|
|
316
|
+
configurable: true,
|
|
317
|
+
writable: true
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (const tool of Object.keys(overrides)) {
|
|
322
|
+
if (!allow.includes(tool)) {
|
|
323
|
+
issues.push(
|
|
324
|
+
warning(`${path} sets an approval for ${tool}, which tools.allow does not expose`)
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
} else if (defaultApproval.policy === "ask" /* Ask */ || Object.keys(overrides).length > 0) {
|
|
329
|
+
approvals = { "*": defaultApproval.policy, ...overrides };
|
|
330
|
+
}
|
|
331
|
+
const deny = tools?.deny ?? [];
|
|
332
|
+
for (const tool of deny) {
|
|
333
|
+
if (Object.hasOwn(overrides, tool))
|
|
334
|
+
issues.push(warning(`${path} sets an approval for ${tool}, which tools.deny hides`));
|
|
335
|
+
}
|
|
336
|
+
if (connection?.toolCall != null)
|
|
337
|
+
issues.push(error(`${path} uses toolCall.providedArguments, which is not supported`));
|
|
338
|
+
const binding = {
|
|
339
|
+
key: args.key,
|
|
340
|
+
kind: "http" /* Http */,
|
|
341
|
+
url: url2 ?? "https://invalid.invalid",
|
|
342
|
+
auth: lowerAuth(connection?.auth, `${path} auth`, issues),
|
|
343
|
+
headers: stringRecord(connection?.headers, `${path} headers`, issues),
|
|
344
|
+
approvals
|
|
345
|
+
};
|
|
346
|
+
if (deny.length > 0) binding.deny = [...new Set(deny)];
|
|
347
|
+
if (Object.keys(inputApprovals).length > 0) binding.inputApprovals = inputApprovals;
|
|
348
|
+
return { binding, issues };
|
|
349
|
+
};
|
|
350
|
+
var skillMarkdown = (args) => args.markdown.startsWith("---\n") ? args.markdown : `---
|
|
351
|
+
name: ${JSON.stringify(args.key)}
|
|
352
|
+
description: ${JSON.stringify(args.description)}
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
${args.markdown}`;
|
|
356
|
+
var authoredSkillSchema = looseObject({
|
|
357
|
+
description: optionalValueSchema,
|
|
358
|
+
markdown: optionalValueSchema,
|
|
359
|
+
files: authoredRecordSchema.optional().catch(void 0)
|
|
360
|
+
});
|
|
361
|
+
var lowerSkill = (args) => {
|
|
362
|
+
const issues = [];
|
|
363
|
+
const parsed = authoredSkillSchema.safeParse(args.value);
|
|
364
|
+
const description = parsed.success && isString(parsed.data.description) ? parsed.data.description : null;
|
|
365
|
+
const markdown = parsed.success && isString(parsed.data.markdown) ? parsed.data.markdown : null;
|
|
366
|
+
if (description == null || description.length === 0)
|
|
367
|
+
issues.push(error(`skill ${args.key} needs a description`));
|
|
368
|
+
if (markdown == null) issues.push(error(`skill ${args.key} needs markdown`));
|
|
369
|
+
const files = [
|
|
370
|
+
{
|
|
371
|
+
path: "SKILL.md",
|
|
372
|
+
content: skillMarkdown({
|
|
373
|
+
key: args.key,
|
|
374
|
+
description: description ?? "",
|
|
375
|
+
markdown: markdown ?? ""
|
|
376
|
+
})
|
|
377
|
+
}
|
|
378
|
+
];
|
|
379
|
+
for (const [path, content] of Object.entries(
|
|
380
|
+
(parsed.success ? parsed.data.files : void 0) ?? {}
|
|
381
|
+
)) {
|
|
382
|
+
if (path.startsWith("/") || path.split(/[\\/]/).includes("..")) {
|
|
383
|
+
issues.push(error(`skill ${args.key} file ${path} must stay inside the skill directory`));
|
|
384
|
+
} else if (!isString(content)) {
|
|
385
|
+
issues.push(warning(`skill ${args.key} file ${path} is binary and was left out`));
|
|
386
|
+
} else if (path !== "SKILL.md") files.push({ path, content });
|
|
387
|
+
}
|
|
388
|
+
const skill = { key: args.key, files };
|
|
389
|
+
if (description != null) skill.description = description;
|
|
390
|
+
return { skill, issues };
|
|
391
|
+
};
|
|
392
|
+
var authoredInstructionsSchema = looseObject({
|
|
393
|
+
content: string(),
|
|
394
|
+
role: string().optional()
|
|
395
|
+
});
|
|
396
|
+
var lowerInstructions = (value, source) => {
|
|
397
|
+
const parsed = authoredInstructionsSchema.safeParse(value);
|
|
398
|
+
if (!parsed.success) return null;
|
|
399
|
+
const fragment = {
|
|
400
|
+
role: parsed.data.role === "user" /* User */ ? "user" /* User */ : "system" /* System */,
|
|
401
|
+
content: parsed.data.content
|
|
402
|
+
};
|
|
403
|
+
if (source != null) fragment.source = source;
|
|
404
|
+
return fragment;
|
|
405
|
+
};
|
|
406
|
+
var environmentSchema = looseObject({
|
|
407
|
+
providerName: string(),
|
|
408
|
+
providerRef: optionalValueSchema,
|
|
409
|
+
options: optionalValueSchema,
|
|
410
|
+
open: callableSchema
|
|
411
|
+
});
|
|
412
|
+
var openRequestSchema = looseObject({
|
|
413
|
+
providerName: string(),
|
|
414
|
+
providerRef: optionalValueSchema,
|
|
415
|
+
environmentOptions: optionalValueSchema,
|
|
416
|
+
openOptions: optionalValueSchema
|
|
417
|
+
});
|
|
418
|
+
var sandboxProviderSchema = looseObject({
|
|
419
|
+
name: string(),
|
|
420
|
+
environment: callableSchema,
|
|
421
|
+
definition: looseObject({})
|
|
422
|
+
});
|
|
423
|
+
var isEnvironmentLike = (value) => environmentSchema.safeParse(value).success;
|
|
424
|
+
var isOpenRequestLike = (value) => openRequestSchema.safeParse(value).success && isObjectLike(value) && "environmentOptions" in value;
|
|
425
|
+
var sandboxProviderNameOf = (value) => {
|
|
426
|
+
const parsed = sandboxProviderSchema.safeParse(value);
|
|
427
|
+
return parsed.success ? parsed.data.name : null;
|
|
428
|
+
};
|
|
429
|
+
var lowerEnvironment = (value, path, issues) => {
|
|
430
|
+
const warnings = array(string()).safeParse(fieldOf(value, "authoringWarnings"));
|
|
431
|
+
if (warnings.success)
|
|
432
|
+
for (const message of warnings.data) issues.push(warning(`${path}: ${message}`));
|
|
433
|
+
const request = isOpenRequestLike(value) ? openRequestSchema.safeParse(value) : null;
|
|
434
|
+
if (request?.success === true) {
|
|
435
|
+
return {
|
|
436
|
+
providerName: request.data.providerName,
|
|
437
|
+
providerRef: request.data.providerRef == null ? null : toJson(request.data.providerRef, { path, issues }),
|
|
438
|
+
options: toJson(request.data.environmentOptions ?? {}, { path: `${path} options`, issues }),
|
|
439
|
+
openOptions: toJson(request.data.openOptions ?? null, {
|
|
440
|
+
path: `${path} open options`,
|
|
441
|
+
issues
|
|
442
|
+
})
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
const environment = environmentSchema.safeParse(value);
|
|
446
|
+
if (!environment.success) return null;
|
|
447
|
+
return {
|
|
448
|
+
providerName: environment.data.providerName,
|
|
449
|
+
providerRef: environment.data.providerRef == null ? null : toJson(environment.data.providerRef, { path, issues }),
|
|
450
|
+
options: toJson(environment.data.options ?? {}, { path: `${path} options`, issues }),
|
|
451
|
+
openOptions: null
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
var isDynamicSentinel = (value) => authoredKindOf(value) === "dynamic" /* Dynamic */;
|
|
455
|
+
var dynamicEventsOf = (value) => entriesOf(fieldOf(value, "events")).filter(([, handler]) => isCallable(handler)).map(([event]) => event);
|
|
456
|
+
|
|
457
|
+
export {
|
|
458
|
+
IssueSeverity,
|
|
459
|
+
error,
|
|
460
|
+
warning,
|
|
461
|
+
note,
|
|
462
|
+
childPath,
|
|
463
|
+
toJson,
|
|
464
|
+
toJsonSchema,
|
|
465
|
+
lowerTool,
|
|
466
|
+
lowerConnection,
|
|
467
|
+
skillMarkdown,
|
|
468
|
+
lowerSkill,
|
|
469
|
+
lowerInstructions,
|
|
470
|
+
isEnvironmentLike,
|
|
471
|
+
isOpenRequestLike,
|
|
472
|
+
sandboxProviderNameOf,
|
|
473
|
+
lowerEnvironment,
|
|
474
|
+
isDynamicSentinel,
|
|
475
|
+
dynamicEventsOf
|
|
476
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
always,
|
|
3
|
+
lowerApproval,
|
|
4
|
+
never,
|
|
5
|
+
whenInput
|
|
6
|
+
} from "../../chunk-7VSSVZM4.ts";
|
|
7
|
+
import "../../chunk-OWC6SFFF.ts";
|
|
8
|
+
import "../../chunk-7QP2CKPI.ts";
|
|
9
|
+
import "../../chunk-SKTNMUO7.ts";
|
|
10
|
+
import "../../chunk-XHKPWT3G.ts";
|
|
11
|
+
import "../../chunk-JIPNTA56.ts";
|
|
12
|
+
import "../../chunk-HGW4YHAY.ts";
|
|
13
|
+
import "../../chunk-32O3ODZE.ts";
|
|
14
|
+
export {
|
|
15
|
+
always,
|
|
16
|
+
lowerApproval,
|
|
17
|
+
never,
|
|
18
|
+
whenInput
|
|
19
|
+
};
|