@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,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatProviderRef,
|
|
3
|
+
instructionFragmentSchema,
|
|
4
|
+
mcpServerBindingSchema,
|
|
5
|
+
providerRefSchema,
|
|
6
|
+
resolvedAgentManifestSchema,
|
|
7
|
+
sandboxBindingSchema,
|
|
8
|
+
skillBundleSchema
|
|
9
|
+
} from "./chunk-OWC6SFFF.ts";
|
|
10
|
+
import {
|
|
11
|
+
jsonObjectSchema,
|
|
12
|
+
jsonValueSchema
|
|
13
|
+
} from "./chunk-7QP2CKPI.ts";
|
|
14
|
+
import {
|
|
15
|
+
findDynamicSlots,
|
|
16
|
+
isDynamicSlot
|
|
17
|
+
} from "./chunk-SKTNMUO7.ts";
|
|
18
|
+
import {
|
|
19
|
+
_null,
|
|
20
|
+
array,
|
|
21
|
+
looseObject,
|
|
22
|
+
number,
|
|
23
|
+
record,
|
|
24
|
+
string
|
|
25
|
+
} from "./chunk-HGW4YHAY.ts";
|
|
26
|
+
|
|
27
|
+
// src/resolve.ts
|
|
28
|
+
var SlotValueKind = /* @__PURE__ */ ((SlotValueKind2) => {
|
|
29
|
+
SlotValueKind2["InstructionFragment"] = "instruction-fragment";
|
|
30
|
+
SlotValueKind2["SkillBundle"] = "skill-bundle";
|
|
31
|
+
SlotValueKind2["McpServers"] = "mcp-servers";
|
|
32
|
+
SlotValueKind2["Sandboxes"] = "sandboxes";
|
|
33
|
+
SlotValueKind2["SandboxEnvironment"] = "sandbox-environment";
|
|
34
|
+
SlotValueKind2["Opaque"] = "opaque";
|
|
35
|
+
return SlotValueKind2;
|
|
36
|
+
})(SlotValueKind || {});
|
|
37
|
+
var slotKindOf = (path) => {
|
|
38
|
+
if (/^harness\.config\.instructions\[\d+\]$/.test(path)) return "instruction-fragment" /* InstructionFragment */;
|
|
39
|
+
if (/^harness\.config\.skills\[\d+\]$/.test(path)) return "skill-bundle" /* SkillBundle */;
|
|
40
|
+
if (path === "mcpServers") return "mcp-servers" /* McpServers */;
|
|
41
|
+
if (path === "sandboxes") return "sandboxes" /* Sandboxes */;
|
|
42
|
+
if (/^sandboxes\.[^.]+\.environment$/.test(path)) return "sandbox-environment" /* SandboxEnvironment */;
|
|
43
|
+
return "opaque" /* Opaque */;
|
|
44
|
+
};
|
|
45
|
+
var resolvedSandboxesSchema = record(
|
|
46
|
+
string(),
|
|
47
|
+
sandboxBindingSchema.extend({ environment: jsonValueSchema })
|
|
48
|
+
);
|
|
49
|
+
var issueText = (error) => error.issues.map((issue) => `${issue.path.join(".") || "value"}: ${issue.message}`).join("; ");
|
|
50
|
+
var invalid = (path, detail) => new Error(`dynamic slot ${path} resolved to an invalid value: ${detail}`);
|
|
51
|
+
var parseAs = (schema, value, path) => {
|
|
52
|
+
const parsed = schema.safeParse(value);
|
|
53
|
+
if (!parsed.success) throw invalid(path, issueText(parsed.error));
|
|
54
|
+
return jsonValueSchema.parse(parsed.data);
|
|
55
|
+
};
|
|
56
|
+
var isRecord = (value) => jsonObjectSchema.safeParse(value).success;
|
|
57
|
+
var roleless = looseObject({ role: _null().optional() });
|
|
58
|
+
var environmentResultSchema = looseObject({
|
|
59
|
+
providerName: string(),
|
|
60
|
+
providerRef: jsonValueSchema.optional(),
|
|
61
|
+
options: jsonValueSchema.optional(),
|
|
62
|
+
openOptions: jsonValueSchema.optional()
|
|
63
|
+
});
|
|
64
|
+
var validateSlotValue = (path, value, manifest) => {
|
|
65
|
+
if (value == null) return null;
|
|
66
|
+
switch (slotKindOf(path)) {
|
|
67
|
+
case "instruction-fragment" /* InstructionFragment */: {
|
|
68
|
+
if (isRecord(value) && roleless.safeParse(value).success) {
|
|
69
|
+
return parseAs(instructionFragmentSchema, { ...value, role: "system" }, path);
|
|
70
|
+
}
|
|
71
|
+
return parseAs(instructionFragmentSchema, value, path);
|
|
72
|
+
}
|
|
73
|
+
case "skill-bundle" /* SkillBundle */:
|
|
74
|
+
return Array.isArray(value) ? parseAs(array(skillBundleSchema), value, path) : parseAs(skillBundleSchema, value, path);
|
|
75
|
+
case "mcp-servers" /* McpServers */:
|
|
76
|
+
return parseAs(array(mcpServerBindingSchema), value, path);
|
|
77
|
+
case "sandboxes" /* Sandboxes */:
|
|
78
|
+
return parseAs(resolvedSandboxesSchema, value, path);
|
|
79
|
+
case "sandbox-environment" /* SandboxEnvironment */:
|
|
80
|
+
if (manifest != null) checkEnvironmentProvider(manifest, path, value);
|
|
81
|
+
const environment = environmentResultSchema.safeParse(value);
|
|
82
|
+
if (environment.success && environment.data.openOptions != null)
|
|
83
|
+
parseAs(
|
|
84
|
+
sandboxBindingSchema.pick({ access: true, attach: true }).partial(),
|
|
85
|
+
environment.data.openOptions,
|
|
86
|
+
path
|
|
87
|
+
);
|
|
88
|
+
return environment.success ? environment.data.options ?? null : value;
|
|
89
|
+
case "opaque" /* Opaque */:
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var childPath = (parent, key) => {
|
|
94
|
+
if (number().safeParse(key).success) return `${parent}[${key}]`;
|
|
95
|
+
return parent.length === 0 ? `${key}` : `${parent}.${key}`;
|
|
96
|
+
};
|
|
97
|
+
var splice = (value, values, path) => {
|
|
98
|
+
if (isDynamicSlot(value)) return values[path] ?? null;
|
|
99
|
+
if (Array.isArray(value)) {
|
|
100
|
+
const out = [];
|
|
101
|
+
value.forEach((item, index) => {
|
|
102
|
+
const itemPath = childPath(path, index);
|
|
103
|
+
if (isDynamicSlot(item)) {
|
|
104
|
+
const resolved = values[itemPath];
|
|
105
|
+
if (resolved == null) return;
|
|
106
|
+
if (Array.isArray(resolved) && slotKindOf(itemPath) === "skill-bundle" /* SkillBundle */)
|
|
107
|
+
out.push(...resolved);
|
|
108
|
+
else out.push(resolved);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
out.push(splice(item, values, itemPath));
|
|
112
|
+
});
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
if (isRecord(value)) {
|
|
116
|
+
const out = {};
|
|
117
|
+
for (const [key, item] of Object.entries(value)) {
|
|
118
|
+
const itemPath = childPath(path, key);
|
|
119
|
+
if (isDynamicSlot(item) && values[itemPath] == null && !KEEP_NULL.test(itemPath)) continue;
|
|
120
|
+
out[key] = splice(item, values, itemPath);
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
};
|
|
126
|
+
var KEEP_NULL = /^(sandboxes\.[^.]+\.environment)$/;
|
|
127
|
+
var FIELD_DEFAULTS = /* @__PURE__ */ new Map([
|
|
128
|
+
["mcpServers", []],
|
|
129
|
+
["sandboxes", {}],
|
|
130
|
+
["harness.config", {}]
|
|
131
|
+
]);
|
|
132
|
+
var checkEnvironmentProvider = (manifest, path, value) => {
|
|
133
|
+
if (slotKindOf(path) !== "sandbox-environment" /* SandboxEnvironment */ || value == null) return;
|
|
134
|
+
const returned = environmentResultSchema.safeParse(value);
|
|
135
|
+
if (!returned.success) return;
|
|
136
|
+
const target = path.slice("sandboxes.".length, -".environment".length);
|
|
137
|
+
const sandboxes = record(string(), sandboxBindingSchema).safeParse(manifest.sandboxes);
|
|
138
|
+
const provider = sandboxes.success ? sandboxes.data[target]?.provider : void 0;
|
|
139
|
+
if (provider == null) return;
|
|
140
|
+
const returnedRef = providerRefSchema.safeParse(returned.data.providerRef);
|
|
141
|
+
const mismatch = returnedRef.success ? formatProviderRef(returnedRef.data) !== formatProviderRef(provider) : (
|
|
142
|
+
// A bundle provider's environment carries only its name; installed ones are named for their specifier.
|
|
143
|
+
provider.kind === "package" /* Package */
|
|
144
|
+
);
|
|
145
|
+
if (mismatch) {
|
|
146
|
+
throw invalid(
|
|
147
|
+
path,
|
|
148
|
+
`returned a ${returned.data.providerName} environment for a ${formatProviderRef(provider)} target`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var resolveManifestDetailed = async (args) => {
|
|
153
|
+
const manifestJson = jsonValueSchema.parse(args.manifest);
|
|
154
|
+
const slots = findDynamicSlots(manifestJson);
|
|
155
|
+
const values = {};
|
|
156
|
+
const normalized = {};
|
|
157
|
+
for (const found of slots) {
|
|
158
|
+
const subscribed = found.slot.$dynamic.events.includes(args.event);
|
|
159
|
+
const raw = subscribed ? await args.resolve(found.slot, found.path) : args.previous?.[found.path] ?? null;
|
|
160
|
+
if (subscribed) checkEnvironmentProvider(args.manifest, found.path, raw);
|
|
161
|
+
normalized[found.path] = validateSlotValue(found.path, raw) ?? FIELD_DEFAULTS.get(found.path) ?? null;
|
|
162
|
+
values[found.path] = slotKindOf(found.path) === "sandbox-environment" /* SandboxEnvironment */ ? raw : normalized[found.path] ?? null;
|
|
163
|
+
}
|
|
164
|
+
const spliced = splice(manifestJson, normalized, "");
|
|
165
|
+
const parsed = resolvedAgentManifestSchema.safeParse(spliced);
|
|
166
|
+
if (!parsed.success) throw new Error(`resolved manifest is invalid: ${issueText(parsed.error)}`);
|
|
167
|
+
const openOptionsSchema = sandboxBindingSchema.pick({ access: true, attach: true }).partial();
|
|
168
|
+
for (const [path, raw] of Object.entries(values)) {
|
|
169
|
+
if (slotKindOf(path) !== "sandbox-environment" /* SandboxEnvironment */) continue;
|
|
170
|
+
const environment = environmentResultSchema.safeParse(raw);
|
|
171
|
+
if (!environment.success || environment.data.openOptions == null) continue;
|
|
172
|
+
const options = openOptionsSchema.safeParse(environment.data.openOptions);
|
|
173
|
+
if (!options.success) throw invalid(path, issueText(options.error));
|
|
174
|
+
const target = path.slice("sandboxes.".length, -".environment".length);
|
|
175
|
+
const binding = parsed.data.sandboxes[target];
|
|
176
|
+
if (binding != null) parsed.data.sandboxes[target] = { ...binding, ...options.data };
|
|
177
|
+
}
|
|
178
|
+
return { manifest: parsed.data, values };
|
|
179
|
+
};
|
|
180
|
+
var resolveManifest = async (args) => (await resolveManifestDetailed(args)).manifest;
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
SlotValueKind,
|
|
184
|
+
slotKindOf,
|
|
185
|
+
validateSlotValue,
|
|
186
|
+
resolveManifestDetailed,
|
|
187
|
+
resolveManifest
|
|
188
|
+
};
|