@swirls/deploy 0.0.0 → 0.2.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.
- package/README.md +63 -2
- package/dist/index.d.ts +163 -10
- package/dist/index.js +1273 -480
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1637,7 +1637,7 @@ function diag(message, range2, severity = "error") {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
function resolveNamedSchemasFromDecls(decls) {
|
|
1639
1639
|
const diagnostics = [];
|
|
1640
|
-
const
|
|
1640
|
+
const byName3 = new Map(decls.map((d) => [d.name, d]));
|
|
1641
1641
|
const resolved = /* @__PURE__ */ new Map();
|
|
1642
1642
|
const visiting = /* @__PURE__ */ new Set();
|
|
1643
1643
|
const seenSchemaNames = /* @__PURE__ */ new Set();
|
|
@@ -1682,7 +1682,7 @@ function resolveNamedSchemasFromDecls(decls) {
|
|
|
1682
1682
|
visiting.add(decl.name);
|
|
1683
1683
|
let lit;
|
|
1684
1684
|
if (decl.schemaRef) {
|
|
1685
|
-
const target =
|
|
1685
|
+
const target = byName3.get(decl.schemaRef);
|
|
1686
1686
|
if (!target) {
|
|
1687
1687
|
diagnostics.push(
|
|
1688
1688
|
diag(
|
|
@@ -13553,13 +13553,13 @@ function validateResourceName2(name, range2, kind) {
|
|
|
13553
13553
|
return [diag5(`${kind} name: ${msg}`, range2)];
|
|
13554
13554
|
}
|
|
13555
13555
|
function channelsByName(ast, workspace) {
|
|
13556
|
-
const
|
|
13556
|
+
const byName3 = new Map((ast.channels ?? []).map((c) => [c.name, c]));
|
|
13557
13557
|
for (const [name, decl] of workspace?.channelBlocks ?? []) {
|
|
13558
|
-
if (!
|
|
13559
|
-
|
|
13558
|
+
if (!byName3.has(name)) {
|
|
13559
|
+
byName3.set(name, decl);
|
|
13560
13560
|
}
|
|
13561
13561
|
}
|
|
13562
|
-
return
|
|
13562
|
+
return byName3;
|
|
13563
13563
|
}
|
|
13564
13564
|
function validateHttpsUrl(value, range2, label) {
|
|
13565
13565
|
try {
|
|
@@ -14717,13 +14717,13 @@ function configStringValue(cv) {
|
|
|
14717
14717
|
return void 0;
|
|
14718
14718
|
}
|
|
14719
14719
|
function mergeNamedDecls(local, workspaceMap) {
|
|
14720
|
-
const
|
|
14720
|
+
const byName3 = new Map((local ?? []).map((d) => [d.name, d]));
|
|
14721
14721
|
for (const [name, decl] of workspaceMap ?? []) {
|
|
14722
|
-
if (!
|
|
14723
|
-
|
|
14722
|
+
if (!byName3.has(name)) {
|
|
14723
|
+
byName3.set(name, decl);
|
|
14724
14724
|
}
|
|
14725
14725
|
}
|
|
14726
|
-
return [...
|
|
14726
|
+
return [...byName3.values()];
|
|
14727
14727
|
}
|
|
14728
14728
|
function mergeConnectionDecls(ast, workspace) {
|
|
14729
14729
|
return mergeNamedDecls(ast.connections, workspace?.connectionBlocks);
|
|
@@ -16242,24 +16242,24 @@ function computerBlockMap2(ast, workspace) {
|
|
|
16242
16242
|
return m;
|
|
16243
16243
|
}
|
|
16244
16244
|
function workflowsForBindings(ast, workspace) {
|
|
16245
|
-
const
|
|
16245
|
+
const byName3 = /* @__PURE__ */ new Map();
|
|
16246
16246
|
for (const workflow of workspace?.workflowBlocks?.values() ?? []) {
|
|
16247
|
-
|
|
16247
|
+
byName3.set(workflow.name, workflow);
|
|
16248
16248
|
}
|
|
16249
16249
|
for (const workflow of ast.workflows ?? []) {
|
|
16250
|
-
|
|
16250
|
+
byName3.set(workflow.name, workflow);
|
|
16251
16251
|
}
|
|
16252
|
-
return [...
|
|
16252
|
+
return [...byName3.values()];
|
|
16253
16253
|
}
|
|
16254
16254
|
function agentsForBindings(ast, workspace) {
|
|
16255
|
-
const
|
|
16255
|
+
const byName3 = /* @__PURE__ */ new Map();
|
|
16256
16256
|
for (const agent of workspace?.agentBlocks?.values() ?? []) {
|
|
16257
|
-
|
|
16257
|
+
byName3.set(agent.name, agent);
|
|
16258
16258
|
}
|
|
16259
16259
|
for (const agent of ast.agent ?? []) {
|
|
16260
|
-
|
|
16260
|
+
byName3.set(agent.name, agent);
|
|
16261
16261
|
}
|
|
16262
|
-
return [...
|
|
16262
|
+
return [...byName3.values()];
|
|
16263
16263
|
}
|
|
16264
16264
|
function boundComputerNames(ast, workspace) {
|
|
16265
16265
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -19337,32 +19337,6 @@ function parseSwirlsFile(args) {
|
|
|
19337
19337
|
return result.ast;
|
|
19338
19338
|
}
|
|
19339
19339
|
|
|
19340
|
-
// src/fs.ts
|
|
19341
|
-
function deployBundleToWorkspaceFileSystem(fs2) {
|
|
19342
|
-
return {
|
|
19343
|
-
readdirSync: fs2.readdirSync.bind(fs2),
|
|
19344
|
-
readFileSync: fs2.readFileSync.bind(fs2),
|
|
19345
|
-
existsSync: (p) => {
|
|
19346
|
-
try {
|
|
19347
|
-
fs2.readFileSync(p, "utf-8");
|
|
19348
|
-
return true;
|
|
19349
|
-
} catch {
|
|
19350
|
-
return false;
|
|
19351
|
-
}
|
|
19352
|
-
}
|
|
19353
|
-
};
|
|
19354
|
-
}
|
|
19355
|
-
|
|
19356
|
-
// src/collect-swirls-files.ts
|
|
19357
|
-
function collectSwirlsFiles2(fs2, cwd, dir = cwd, acc = []) {
|
|
19358
|
-
return collectSwirlsFiles({
|
|
19359
|
-
cwd,
|
|
19360
|
-
fileSystem: deployBundleToWorkspaceFileSystem(fs2),
|
|
19361
|
-
dir,
|
|
19362
|
-
acc
|
|
19363
|
-
});
|
|
19364
|
-
}
|
|
19365
|
-
|
|
19366
19340
|
// src/sha256.ts
|
|
19367
19341
|
import { createHash } from "node:crypto";
|
|
19368
19342
|
function sha256Hex(data) {
|
|
@@ -19728,6 +19702,22 @@ function daytonaSnapshotResources(resources) {
|
|
|
19728
19702
|
};
|
|
19729
19703
|
}
|
|
19730
19704
|
|
|
19705
|
+
// src/fs.ts
|
|
19706
|
+
function deployBundleToWorkspaceFileSystem(fs2) {
|
|
19707
|
+
return {
|
|
19708
|
+
readdirSync: fs2.readdirSync.bind(fs2),
|
|
19709
|
+
readFileSync: fs2.readFileSync.bind(fs2),
|
|
19710
|
+
existsSync: (p) => {
|
|
19711
|
+
try {
|
|
19712
|
+
fs2.readFileSync(p, "utf-8");
|
|
19713
|
+
return true;
|
|
19714
|
+
} catch {
|
|
19715
|
+
return false;
|
|
19716
|
+
}
|
|
19717
|
+
}
|
|
19718
|
+
};
|
|
19719
|
+
}
|
|
19720
|
+
|
|
19731
19721
|
// src/ids.ts
|
|
19732
19722
|
function uuidv7(now = Date.now()) {
|
|
19733
19723
|
const bytes = new Uint8Array(16);
|
|
@@ -19742,6 +19732,43 @@ function uuidv7(now = Date.now()) {
|
|
|
19742
19732
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
19743
19733
|
}
|
|
19744
19734
|
|
|
19735
|
+
// src/ids-sites.ts
|
|
19736
|
+
function createSiteIds(newId) {
|
|
19737
|
+
if (newId === void 0) {
|
|
19738
|
+
return () => uuidv7();
|
|
19739
|
+
}
|
|
19740
|
+
const used = /* @__PURE__ */ new Map();
|
|
19741
|
+
return (site, mount) => {
|
|
19742
|
+
const count = (used.get(site) ?? 0) + 1;
|
|
19743
|
+
used.set(site, count);
|
|
19744
|
+
return newId(count === 1 ? site : `${site}#${count}`, mount);
|
|
19745
|
+
};
|
|
19746
|
+
}
|
|
19747
|
+
function namedSite(kind, name) {
|
|
19748
|
+
return `${kind}:${name}`;
|
|
19749
|
+
}
|
|
19750
|
+
function nodeSite(workflow, node) {
|
|
19751
|
+
return `workflow:${workflow}/node:${node}`;
|
|
19752
|
+
}
|
|
19753
|
+
function edgeSite(workflow, source, target) {
|
|
19754
|
+
return `workflow:${workflow}/edge:${source}->${target}`;
|
|
19755
|
+
}
|
|
19756
|
+
function connectionSite(database, connection) {
|
|
19757
|
+
return `database:${database}/connection:${connection}`;
|
|
19758
|
+
}
|
|
19759
|
+
function sourceMountOf(decl) {
|
|
19760
|
+
if (decl !== void 0 && "sourceMount" in decl && typeof decl.sourceMount === "string") {
|
|
19761
|
+
return decl.sourceMount;
|
|
19762
|
+
}
|
|
19763
|
+
return "";
|
|
19764
|
+
}
|
|
19765
|
+
function sourcePathOf(decl) {
|
|
19766
|
+
if (decl !== void 0 && "sourcePath" in decl && typeof decl.sourcePath === "string") {
|
|
19767
|
+
return decl.sourcePath;
|
|
19768
|
+
}
|
|
19769
|
+
return void 0;
|
|
19770
|
+
}
|
|
19771
|
+
|
|
19745
19772
|
// src/inline-integration-action.ts
|
|
19746
19773
|
function buildActionsByName(ast, workspace) {
|
|
19747
19774
|
return new Map(mergeActionDecls(ast, workspace).map((a) => [a.name, a]));
|
|
@@ -19992,7 +20019,7 @@ function stripEditorMetadata(value) {
|
|
|
19992
20019
|
if (typeof value === "object") {
|
|
19993
20020
|
const stripped = {};
|
|
19994
20021
|
for (const [key, val] of Object.entries(value)) {
|
|
19995
|
-
if (key === "range" || key === "innerRange" || key === "flowRange" || key === "inputSchemaBlock" || key === "outputSchemaBlock" || key === "schemaBlock" || key === "docComment" || key === "sourcePath" || key === "sourcePathRange" || key === "pathRange" || key === "databaseRange" || key === "nameRange" || key === "accentRange" || key === "logoRange" || key === "schemas" || key === "schemaRef" || key === "schemaRefRange" || key === "inputSchemaRef" || key === "inputSchemaRefRange" || key === "outputSchemaRef" || key === "outputSchemaRefRange" || key === "visibilityRange") {
|
|
20022
|
+
if (key === "range" || key === "innerRange" || key === "flowRange" || key === "inputSchemaBlock" || key === "outputSchemaBlock" || key === "schemaBlock" || key === "docComment" || key === "sourcePath" || key === "sourceMount" || key === "sourcePathRange" || key === "pathRange" || key === "databaseRange" || key === "nameRange" || key === "accentRange" || key === "logoRange" || key === "schemas" || key === "schemaRef" || key === "schemaRefRange" || key === "inputSchemaRef" || key === "inputSchemaRefRange" || key === "outputSchemaRef" || key === "outputSchemaRefRange" || key === "visibilityRange") {
|
|
19996
20023
|
continue;
|
|
19997
20024
|
}
|
|
19998
20025
|
stripped[key] = stripEditorMetadata(val);
|
|
@@ -20090,26 +20117,16 @@ function nodeActionRefFromConfigFields(nodeType, fields) {
|
|
|
20090
20117
|
}
|
|
20091
20118
|
return action.value;
|
|
20092
20119
|
}
|
|
20093
|
-
function
|
|
20094
|
-
|
|
20095
|
-
const prev = seen.get(key);
|
|
20096
|
-
if (prev !== void 0) {
|
|
20097
|
-
throw new Error(
|
|
20098
|
-
`Duplicate ${kind} name "${name}" in "${filePath}" and "${prev}". Each resource name must be unique across all .swirls files in this project.`
|
|
20099
|
-
);
|
|
20100
|
-
}
|
|
20101
|
-
seen.set(key, filePath);
|
|
20102
|
-
}
|
|
20103
|
-
function markSourcePath(decl, filePath) {
|
|
20104
|
-
Object.assign(decl, { sourcePath: filePath });
|
|
20120
|
+
function markSource(decl, mount, filePath) {
|
|
20121
|
+
Object.assign(decl, { sourcePath: filePath, sourceMount: mount });
|
|
20105
20122
|
return decl;
|
|
20106
20123
|
}
|
|
20107
|
-
function
|
|
20108
|
-
|
|
20124
|
+
function markWorkflowSource(workflow, mount, filePath) {
|
|
20125
|
+
markSource(workflow, mount, filePath);
|
|
20109
20126
|
for (const node of workflow.nodes) {
|
|
20110
|
-
|
|
20127
|
+
markSource(node, mount, filePath);
|
|
20111
20128
|
for (const subNode of node.subgraph?.nodes ?? []) {
|
|
20112
|
-
|
|
20129
|
+
markSource(subNode, mount, filePath);
|
|
20113
20130
|
}
|
|
20114
20131
|
}
|
|
20115
20132
|
return workflow;
|
|
@@ -20145,14 +20162,8 @@ function mergedSecretsForAgentNode(opts) {
|
|
|
20145
20162
|
const merged = { ...inferred, ...nodeMap };
|
|
20146
20163
|
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
20147
20164
|
}
|
|
20148
|
-
function
|
|
20149
|
-
|
|
20150
|
-
const fileSystem = deployBundleToWorkspaceFileSystem(fs2);
|
|
20151
|
-
const workspace = buildWorkspaceResourceIndex({
|
|
20152
|
-
cwd,
|
|
20153
|
-
fileSystem
|
|
20154
|
-
});
|
|
20155
|
-
const merged = {
|
|
20165
|
+
function emptySwirlsFile() {
|
|
20166
|
+
return {
|
|
20156
20167
|
schemas: [],
|
|
20157
20168
|
forms: [],
|
|
20158
20169
|
webhooks: [],
|
|
@@ -20185,151 +20196,132 @@ function mergeProjectSwirlsFiles(fs2, cwd, options) {
|
|
|
20185
20196
|
mocks: [],
|
|
20186
20197
|
playbooks: []
|
|
20187
20198
|
};
|
|
20188
|
-
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20193
|
-
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
20219
|
-
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
recordConflict(seen, "query", q.name, filePath);
|
|
20288
|
-
merged.queries.push(markSourcePath(q, filePath));
|
|
20289
|
-
}
|
|
20290
|
-
for (const c of ast.connections ?? []) {
|
|
20291
|
-
recordConflict(seen, "connection", c.name, filePath);
|
|
20292
|
-
merged.connections.push(markSourcePath(c, filePath));
|
|
20293
|
-
}
|
|
20294
|
-
for (const c of ast.connector ?? []) {
|
|
20295
|
-
recordConflict(seen, "connector", c.name, filePath);
|
|
20296
|
-
merged.connector.push(markSourcePath(c, filePath));
|
|
20297
|
-
}
|
|
20298
|
-
for (const a of ast.actions ?? []) {
|
|
20299
|
-
recordConflict(seen, "action", a.name, filePath);
|
|
20300
|
-
merged.actions.push(markSourcePath(a, filePath));
|
|
20301
|
-
}
|
|
20302
|
-
for (const sch of ast.schemas ?? []) {
|
|
20303
|
-
recordConflict(seen, "schema", sch.name, filePath);
|
|
20304
|
-
merged.schemas.push(markSourcePath(sch, filePath));
|
|
20305
|
-
}
|
|
20306
|
-
for (const role of ast.roles ?? []) {
|
|
20307
|
-
recordConflict(seen, "role", role.name, filePath);
|
|
20308
|
-
merged.roles.push(markSourcePath(role, filePath));
|
|
20309
|
-
}
|
|
20310
|
-
for (const p of ast.policies ?? []) {
|
|
20311
|
-
merged.policies.push(markSourcePath(p, filePath));
|
|
20312
|
-
}
|
|
20313
|
-
for (const app of ast.apps ?? []) {
|
|
20314
|
-
recordConflict(seen, "app", app.name, filePath);
|
|
20315
|
-
merged.apps.push(markSourcePath(app, filePath));
|
|
20316
|
-
}
|
|
20317
|
-
for (const mock of ast.mocks ?? []) {
|
|
20318
|
-
recordConflict(seen, "mock", mock.name, filePath);
|
|
20319
|
-
merged.mocks.push(markSourcePath(mock, filePath));
|
|
20320
|
-
}
|
|
20321
|
-
for (const playbook of ast.playbooks ?? []) {
|
|
20322
|
-
recordConflict(seen, "playbook", playbook.name, filePath);
|
|
20323
|
-
merged.playbooks.push(markSourcePath(playbook, filePath));
|
|
20324
|
-
}
|
|
20325
|
-
if (ast.version !== void 0 && merged.version === void 0) {
|
|
20326
|
-
merged.version = ast.version;
|
|
20199
|
+
}
|
|
20200
|
+
function asError(error) {
|
|
20201
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
20202
|
+
}
|
|
20203
|
+
function mergeMounts(mounts, options) {
|
|
20204
|
+
const merged = emptySwirlsFile();
|
|
20205
|
+
const sites = /* @__PURE__ */ new Map();
|
|
20206
|
+
const versions = [];
|
|
20207
|
+
const fileErrors = [];
|
|
20208
|
+
let firstProblem;
|
|
20209
|
+
for (const mount of mounts) {
|
|
20210
|
+
for (const filePath of collectSwirlsFiles({
|
|
20211
|
+
cwd: mount.dir,
|
|
20212
|
+
fileSystem: mount.fileSystem
|
|
20213
|
+
})) {
|
|
20214
|
+
let ast;
|
|
20215
|
+
try {
|
|
20216
|
+
ast = parseSwirlsFile({
|
|
20217
|
+
cwd: mount.dir,
|
|
20218
|
+
relativePath: filePath,
|
|
20219
|
+
fileSystem: mount.fileSystem,
|
|
20220
|
+
workspace: options.workspace,
|
|
20221
|
+
host: options.host
|
|
20222
|
+
});
|
|
20223
|
+
} catch (error) {
|
|
20224
|
+
fileErrors.push({ mount: mount.id, path: filePath, error: asError(error) });
|
|
20225
|
+
firstProblem ??= asError(error);
|
|
20226
|
+
continue;
|
|
20227
|
+
}
|
|
20228
|
+
if (!ast) {
|
|
20229
|
+
const error = new Error(
|
|
20230
|
+
`Failed to read "${filePath}" while bundling the deployment. The file was found while scanning the workspace but could not be read, so the deploy was aborted instead of silently dropping the resources it defines.`
|
|
20231
|
+
);
|
|
20232
|
+
fileErrors.push({ mount: mount.id, path: filePath, error });
|
|
20233
|
+
firstProblem ??= error;
|
|
20234
|
+
continue;
|
|
20235
|
+
}
|
|
20236
|
+
const record = (kind, decl) => {
|
|
20237
|
+
const key = `${kind}:${decl.name}`;
|
|
20238
|
+
const site = { mount: mount.id, path: filePath, range: decl.range };
|
|
20239
|
+
const known = sites.get(key);
|
|
20240
|
+
if (known === void 0) {
|
|
20241
|
+
sites.set(key, { kind, name: decl.name, sites: [site] });
|
|
20242
|
+
return;
|
|
20243
|
+
}
|
|
20244
|
+
const first = known.sites[0];
|
|
20245
|
+
known.sites.push(site);
|
|
20246
|
+
firstProblem ??= new Error(
|
|
20247
|
+
`Duplicate ${kind} name "${decl.name}" in "${filePath}" and "${first?.path ?? ""}". Each resource name must be unique across all .swirls files in this project.`
|
|
20248
|
+
);
|
|
20249
|
+
};
|
|
20250
|
+
const take = (kind, decls, into) => {
|
|
20251
|
+
for (const decl of decls ?? []) {
|
|
20252
|
+
record(kind, decl);
|
|
20253
|
+
into?.push(markSource(decl, mount.id, filePath));
|
|
20254
|
+
}
|
|
20255
|
+
};
|
|
20256
|
+
take("decision", ast.decisions, merged.decisions);
|
|
20257
|
+
take("form", ast.forms, merged.forms);
|
|
20258
|
+
take("webhook", ast.webhooks, merged.webhooks);
|
|
20259
|
+
take("schedule", ast.schedules, merged.schedules);
|
|
20260
|
+
for (const g of ast.workflows) {
|
|
20261
|
+
record("workflow", g);
|
|
20262
|
+
merged.workflows.push(markWorkflowSource(g, mount.id, filePath));
|
|
20263
|
+
}
|
|
20264
|
+
take("stream", ast.streams, merged.streams);
|
|
20265
|
+
take("view", ast.views, merged.views);
|
|
20266
|
+
take("trigger", ast.triggers, merged.triggers);
|
|
20267
|
+
take("secret", ast.secrets, merged.secrets);
|
|
20268
|
+
take("auth", ast.auths, merged.auths);
|
|
20269
|
+
take("postgres", ast.postgres, merged.postgres);
|
|
20270
|
+
take("database", ast.databases, merged.databases);
|
|
20271
|
+
take("migration", ast.migrations, merged.migrations);
|
|
20272
|
+
take("disk", ast.disk, merged.disk);
|
|
20273
|
+
take("computer", ast.computer, merged.computer);
|
|
20274
|
+
take("operation", ast.operations, merged.operations);
|
|
20275
|
+
take("skill", ast.skill, merged.skill);
|
|
20276
|
+
take("agent", ast.agent, merged.agent);
|
|
20277
|
+
take("mcp", ast.mcp, merged.mcp);
|
|
20278
|
+
take("network", ast.networks, merged.networks);
|
|
20279
|
+
take("channel", ast.channels, merged.channels);
|
|
20280
|
+
take("query", ast.queries, merged.queries);
|
|
20281
|
+
take("connection", ast.connections, merged.connections);
|
|
20282
|
+
take("connector", ast.connector, merged.connector);
|
|
20283
|
+
take("action", ast.actions, merged.actions);
|
|
20284
|
+
take("schema", ast.schemas, merged.schemas);
|
|
20285
|
+
take("role", ast.roles, merged.roles);
|
|
20286
|
+
for (const p of ast.policies ?? []) {
|
|
20287
|
+
merged.policies.push(markSource(p, mount.id, filePath));
|
|
20288
|
+
}
|
|
20289
|
+
take("app", ast.apps, merged.apps);
|
|
20290
|
+
take("mock", ast.mocks, merged.mocks);
|
|
20291
|
+
take("playbook", ast.playbooks, merged.playbooks);
|
|
20292
|
+
if (ast.version !== void 0) {
|
|
20293
|
+
versions.push({ mount: mount.id, path: filePath, version: ast.version });
|
|
20294
|
+
if (merged.version === void 0) {
|
|
20295
|
+
merged.version = ast.version;
|
|
20296
|
+
}
|
|
20297
|
+
}
|
|
20327
20298
|
}
|
|
20328
20299
|
}
|
|
20329
|
-
return
|
|
20300
|
+
return {
|
|
20301
|
+
merged,
|
|
20302
|
+
duplicates: [...sites.values()].filter((entry) => entry.sites.length > 1),
|
|
20303
|
+
versions,
|
|
20304
|
+
fileErrors,
|
|
20305
|
+
firstProblem
|
|
20306
|
+
};
|
|
20307
|
+
}
|
|
20308
|
+
function mergeProjectSwirlsFiles(fs2, cwd, options) {
|
|
20309
|
+
const fileSystem = deployBundleToWorkspaceFileSystem(fs2);
|
|
20310
|
+
const workspace = buildWorkspaceResourceIndex({
|
|
20311
|
+
cwd,
|
|
20312
|
+
fileSystem
|
|
20313
|
+
});
|
|
20314
|
+
const result = mergeMounts([{ id: ".", dir: cwd, fileSystem }], {
|
|
20315
|
+
host: options?.host,
|
|
20316
|
+
workspace
|
|
20317
|
+
});
|
|
20318
|
+
if (result.firstProblem) {
|
|
20319
|
+
throw result.firstProblem;
|
|
20320
|
+
}
|
|
20321
|
+
return result.merged;
|
|
20330
20322
|
}
|
|
20331
20323
|
function buildDeploymentWorkflowPayload(g, ctx) {
|
|
20332
|
-
const {
|
|
20324
|
+
const { id: siteId } = ctx;
|
|
20333
20325
|
let executionTokenTtlSeconds;
|
|
20334
20326
|
if (g.executionTokenTtl !== void 0) {
|
|
20335
20327
|
const parsedTtlSeconds = parseDurationSeconds(g.executionTokenTtl);
|
|
@@ -20340,10 +20332,10 @@ function buildDeploymentWorkflowPayload(g, ctx) {
|
|
|
20340
20332
|
}
|
|
20341
20333
|
executionTokenTtlSeconds = parsedTtlSeconds;
|
|
20342
20334
|
}
|
|
20343
|
-
const workflowId =
|
|
20335
|
+
const workflowId = siteId(namedSite("workflow", g.name));
|
|
20344
20336
|
const nameToNodeId = /* @__PURE__ */ new Map();
|
|
20345
20337
|
for (const n of g.nodes) {
|
|
20346
|
-
nameToNodeId.set(n.name,
|
|
20338
|
+
nameToNodeId.set(n.name, siteId(nodeSite(g.name, n.name)));
|
|
20347
20339
|
}
|
|
20348
20340
|
const nodes = g.nodes.map((n) => {
|
|
20349
20341
|
const id = nameToNodeId.get(n.name);
|
|
@@ -20443,7 +20435,7 @@ ${z9.prettifyError(r.error)}`
|
|
|
20443
20435
|
);
|
|
20444
20436
|
}
|
|
20445
20437
|
return {
|
|
20446
|
-
id:
|
|
20438
|
+
id: siteId(edgeSite(g.name, e.source, e.target)),
|
|
20447
20439
|
sourceNodeId,
|
|
20448
20440
|
targetNodeId,
|
|
20449
20441
|
label: e.label
|
|
@@ -20461,7 +20453,29 @@ ${z9.prettifyError(r.error)}`
|
|
|
20461
20453
|
};
|
|
20462
20454
|
}
|
|
20463
20455
|
function buildDeploymentDefinitionPayload(merged, options) {
|
|
20464
|
-
const newId = options?.newId
|
|
20456
|
+
const newId = options?.newId;
|
|
20457
|
+
return buildDefinitionPayloadWithSites(
|
|
20458
|
+
merged,
|
|
20459
|
+
createSiteIds(newId === void 0 ? void 0 : () => newId())
|
|
20460
|
+
);
|
|
20461
|
+
}
|
|
20462
|
+
function mountLookup() {
|
|
20463
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
20464
|
+
return (list, name) => {
|
|
20465
|
+
if (list === void 0) {
|
|
20466
|
+
return "";
|
|
20467
|
+
}
|
|
20468
|
+
let byName3 = cache.get(list);
|
|
20469
|
+
if (byName3 === void 0) {
|
|
20470
|
+
byName3 = new Map(list.map((decl) => [decl.name, sourceMountOf(decl)]));
|
|
20471
|
+
cache.set(list, byName3);
|
|
20472
|
+
}
|
|
20473
|
+
return byName3.get(name) ?? "";
|
|
20474
|
+
};
|
|
20475
|
+
}
|
|
20476
|
+
function buildDefinitionPayloadWithSites(merged, ids) {
|
|
20477
|
+
const mountIn = mountLookup();
|
|
20478
|
+
const blockId = (kind, list, name) => ids(namedSite(kind, name), mountIn(list, name));
|
|
20465
20479
|
assertNoMergedViewExecutionCycles(merged);
|
|
20466
20480
|
const inlined = inlineNamedSchemaRefs(merged);
|
|
20467
20481
|
const stripped = stripEditorMetadata(inlined);
|
|
@@ -20472,7 +20486,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20472
20486
|
throw new Error(`Schema "${decl.name}" could not be resolved \u2014 fix schema declarations`);
|
|
20473
20487
|
}
|
|
20474
20488
|
return {
|
|
20475
|
-
id:
|
|
20489
|
+
id: blockId("schema", merged.schemas, decl.name),
|
|
20476
20490
|
name: decl.name,
|
|
20477
20491
|
label: decl.label,
|
|
20478
20492
|
description: decl.description,
|
|
@@ -20480,7 +20494,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20480
20494
|
};
|
|
20481
20495
|
});
|
|
20482
20496
|
const forms = stripped.forms.map((f) => ({
|
|
20483
|
-
id:
|
|
20497
|
+
id: blockId("form", merged.forms, f.name),
|
|
20484
20498
|
name: f.name,
|
|
20485
20499
|
label: f.label,
|
|
20486
20500
|
description: f.description,
|
|
@@ -20490,7 +20504,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20490
20504
|
authName: f.authRef?.name
|
|
20491
20505
|
}));
|
|
20492
20506
|
const webhooks = stripped.webhooks.map((w) => ({
|
|
20493
|
-
id:
|
|
20507
|
+
id: blockId("webhook", merged.webhooks, w.name),
|
|
20494
20508
|
name: w.name,
|
|
20495
20509
|
label: w.label,
|
|
20496
20510
|
description: w.description,
|
|
@@ -20501,7 +20515,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20501
20515
|
headerName: w.header ? normalizeHeaderName(w.header.value) : void 0
|
|
20502
20516
|
}));
|
|
20503
20517
|
const schedules = stripped.schedules.map((s) => ({
|
|
20504
|
-
id:
|
|
20518
|
+
id: blockId("schedule", merged.schedules, s.name),
|
|
20505
20519
|
name: s.name,
|
|
20506
20520
|
label: s.label,
|
|
20507
20521
|
description: s.description,
|
|
@@ -20520,19 +20534,20 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20520
20534
|
agentsByName,
|
|
20521
20535
|
secrets: stripped.secrets,
|
|
20522
20536
|
actionsByName,
|
|
20523
|
-
schemaLiterals: actionSchemaLiterals
|
|
20524
|
-
newId
|
|
20537
|
+
schemaLiterals: actionSchemaLiterals
|
|
20525
20538
|
};
|
|
20526
20539
|
const workflows = stripped.workflows.flatMap((decl) => {
|
|
20527
20540
|
const { graph: flatGraph, synthesizedGraphs } = flattenInlineSubgraphsInGraph(decl);
|
|
20541
|
+
const mount = mountIn(merged.workflows, decl.name);
|
|
20542
|
+
const workflowCtx = { ...deployCtx, id: (site) => ids(site, mount) };
|
|
20528
20543
|
return [
|
|
20529
|
-
buildDeploymentWorkflowPayload(flatGraph,
|
|
20544
|
+
buildDeploymentWorkflowPayload(flatGraph, workflowCtx),
|
|
20530
20545
|
// Inline map/fanout/while subgraphs are flattened into synthetic graphs. They
|
|
20531
20546
|
// are carried to the worker via `preloadedWorkflows` and intentionally
|
|
20532
20547
|
// marked synthetic so deploy never persists them as workflow snapshots
|
|
20533
20548
|
// (otherwise they'd surface as bogus entries in the workflow list / UI).
|
|
20534
20549
|
...synthesizedGraphs.map((g) => ({
|
|
20535
|
-
...buildDeploymentWorkflowPayload(g,
|
|
20550
|
+
...buildDeploymentWorkflowPayload(g, workflowCtx),
|
|
20536
20551
|
synthetic: true
|
|
20537
20552
|
}))
|
|
20538
20553
|
];
|
|
@@ -20567,7 +20582,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20567
20582
|
);
|
|
20568
20583
|
}
|
|
20569
20584
|
triggers.push({
|
|
20570
|
-
id:
|
|
20585
|
+
id: blockId("trigger", merged.triggers, t.name),
|
|
20571
20586
|
name: t.name,
|
|
20572
20587
|
resourceType: t.resourceType,
|
|
20573
20588
|
resourceId,
|
|
@@ -20576,7 +20591,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20576
20591
|
});
|
|
20577
20592
|
}
|
|
20578
20593
|
const secretBlocks = (stripped.secrets ?? []).map((s) => ({
|
|
20579
|
-
id:
|
|
20594
|
+
id: blockId("secret", merged.secrets, s.name),
|
|
20580
20595
|
name: s.name,
|
|
20581
20596
|
label: s.label,
|
|
20582
20597
|
description: s.description,
|
|
@@ -20595,7 +20610,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20595
20610
|
}
|
|
20596
20611
|
}
|
|
20597
20612
|
return {
|
|
20598
|
-
id:
|
|
20613
|
+
id: blockId("auth", merged.auths, a.name),
|
|
20599
20614
|
name: a.name,
|
|
20600
20615
|
label: a.label,
|
|
20601
20616
|
description: a.description,
|
|
@@ -20605,7 +20620,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20605
20620
|
};
|
|
20606
20621
|
});
|
|
20607
20622
|
const postgresBlocks = (stripped.postgres ?? []).map((p) => ({
|
|
20608
|
-
id:
|
|
20623
|
+
id: blockId("postgres", merged.postgres, p.name),
|
|
20609
20624
|
name: p.name,
|
|
20610
20625
|
secretsRef: p.secretsRef,
|
|
20611
20626
|
connection: p.connection,
|
|
@@ -20622,14 +20637,14 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20622
20637
|
throw new Error(`Database "${d.name}" must define a non-empty schema: @prisma { \u2026 }`);
|
|
20623
20638
|
}
|
|
20624
20639
|
return {
|
|
20625
|
-
id:
|
|
20640
|
+
id: blockId("database", merged.databases, d.name),
|
|
20626
20641
|
name: d.name,
|
|
20627
20642
|
label: d.label,
|
|
20628
20643
|
description: d.description,
|
|
20629
20644
|
schema,
|
|
20630
20645
|
schemaChecksum: sha256Hex(schema),
|
|
20631
20646
|
connections: (d.connections ?? []).map((connection) => ({
|
|
20632
|
-
id:
|
|
20647
|
+
id: ids(connectionSite(d.name, connection.name), mountIn(merged.databases, d.name)),
|
|
20633
20648
|
name: connection.name,
|
|
20634
20649
|
label: connection.label,
|
|
20635
20650
|
description: connection.description
|
|
@@ -20650,7 +20665,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20650
20665
|
}
|
|
20651
20666
|
seenDatabaseOrder.add(orderKey);
|
|
20652
20667
|
return {
|
|
20653
|
-
id:
|
|
20668
|
+
id: blockId("migration", merged.migrations, m.name),
|
|
20654
20669
|
name: m.name,
|
|
20655
20670
|
database: m.database,
|
|
20656
20671
|
order: m.order,
|
|
@@ -20658,18 +20673,18 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20658
20673
|
};
|
|
20659
20674
|
});
|
|
20660
20675
|
const diskBlocks = (stripped.disk ?? []).map((a) => ({
|
|
20661
|
-
id:
|
|
20676
|
+
id: blockId("disk", merged.disk, a.name),
|
|
20662
20677
|
name: a.name,
|
|
20663
20678
|
label: a.label,
|
|
20664
20679
|
region: a.region
|
|
20665
20680
|
}));
|
|
20666
20681
|
const skillBlocks = (stripped.skill ?? []).map((s) => ({
|
|
20667
|
-
id:
|
|
20682
|
+
id: blockId("skill", merged.skill, s.name),
|
|
20668
20683
|
name: s.name,
|
|
20669
20684
|
skillName: s.skillName
|
|
20670
20685
|
}));
|
|
20671
20686
|
const agentBlocks = (stripped.agent ?? []).map((a) => ({
|
|
20672
|
-
id:
|
|
20687
|
+
id: blockId("agent", merged.agent, a.name),
|
|
20673
20688
|
name: a.name,
|
|
20674
20689
|
label: a.label,
|
|
20675
20690
|
description: a.description,
|
|
@@ -20721,12 +20736,12 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20721
20736
|
boundByAgent: computersBoundByAgents.has(computer.name)
|
|
20722
20737
|
});
|
|
20723
20738
|
return {
|
|
20724
|
-
id:
|
|
20739
|
+
id: blockId("computer", merged.computer, computer.name),
|
|
20725
20740
|
...compiled
|
|
20726
20741
|
};
|
|
20727
20742
|
});
|
|
20728
20743
|
const operationBlocks = (stripped.operations ?? []).map((operation) => ({
|
|
20729
|
-
id:
|
|
20744
|
+
id: blockId("operation", merged.operations, operation.name),
|
|
20730
20745
|
...compileOperationBlock(operation)
|
|
20731
20746
|
}));
|
|
20732
20747
|
const streams = (stripped.streams ?? []).map((s) => {
|
|
@@ -20752,7 +20767,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20752
20767
|
throw new Error(`Stream "${s.name}" has invalid active version "${s.version ?? ""}"`);
|
|
20753
20768
|
}
|
|
20754
20769
|
return {
|
|
20755
|
-
id:
|
|
20770
|
+
id: blockId("stream", merged.streams, s.name),
|
|
20756
20771
|
name: s.name,
|
|
20757
20772
|
label: s.label,
|
|
20758
20773
|
description: s.description,
|
|
@@ -20790,7 +20805,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20790
20805
|
};
|
|
20791
20806
|
});
|
|
20792
20807
|
return {
|
|
20793
|
-
id:
|
|
20808
|
+
id: blockId("view", merged.views, v.name),
|
|
20794
20809
|
name: v.name,
|
|
20795
20810
|
label: v.label,
|
|
20796
20811
|
description: v.description,
|
|
@@ -20805,7 +20820,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20805
20820
|
(stripped.channels ?? []).map((channel) => [channel.name, channel])
|
|
20806
20821
|
);
|
|
20807
20822
|
const apps = (stripped.apps ?? []).map((a) => ({
|
|
20808
|
-
id:
|
|
20823
|
+
id: blockId("app", merged.apps, a.name),
|
|
20809
20824
|
name: a.name,
|
|
20810
20825
|
label: a.label ?? a.name,
|
|
20811
20826
|
...a.description !== void 0 ? { description: a.description } : {},
|
|
@@ -20921,7 +20936,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20921
20936
|
throw new Error(`Query "${q.name}" must declare database: <name>`);
|
|
20922
20937
|
}
|
|
20923
20938
|
return {
|
|
20924
|
-
id:
|
|
20939
|
+
id: blockId("query", merged.queries, q.name),
|
|
20925
20940
|
name: q.name,
|
|
20926
20941
|
label: q.label,
|
|
20927
20942
|
description: q.description,
|
|
@@ -20932,7 +20947,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20932
20947
|
};
|
|
20933
20948
|
});
|
|
20934
20949
|
const channelBlocks = (stripped.channels ?? []).map((c) => ({
|
|
20935
|
-
id:
|
|
20950
|
+
id: blockId("channel", merged.channels, c.name),
|
|
20936
20951
|
name: c.name,
|
|
20937
20952
|
label: c.label,
|
|
20938
20953
|
description: c.description,
|
|
@@ -20946,7 +20961,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20946
20961
|
...channelResponsePolicyToDeploymentPayload(c)
|
|
20947
20962
|
}));
|
|
20948
20963
|
const connectionBlocks = (stripped.connections ?? []).map((c) => ({
|
|
20949
|
-
id:
|
|
20964
|
+
id: blockId("connection", merged.connections, c.name),
|
|
20950
20965
|
name: c.name,
|
|
20951
20966
|
label: c.label,
|
|
20952
20967
|
description: c.description,
|
|
@@ -20956,7 +20971,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20956
20971
|
...c.networkRef !== void 0 ? { networkRef: c.networkRef } : {}
|
|
20957
20972
|
}));
|
|
20958
20973
|
const mcpBlocks = (stripped.mcp ?? []).map((m) => ({
|
|
20959
|
-
id:
|
|
20974
|
+
id: blockId("mcp", merged.mcp, m.name),
|
|
20960
20975
|
name: m.name,
|
|
20961
20976
|
label: m.label,
|
|
20962
20977
|
description: m.description,
|
|
@@ -20965,7 +20980,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20965
20980
|
...m.networkRef !== void 0 ? { networkRef: m.networkRef } : {}
|
|
20966
20981
|
}));
|
|
20967
20982
|
const networkBlocks = (stripped.networks ?? []).map((network) => ({
|
|
20968
|
-
id:
|
|
20983
|
+
id: blockId("network", merged.networks, network.name),
|
|
20969
20984
|
name: network.name,
|
|
20970
20985
|
label: network.label,
|
|
20971
20986
|
description: network.description,
|
|
@@ -20982,7 +20997,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20982
20997
|
}
|
|
20983
20998
|
}));
|
|
20984
20999
|
const connectorBlocks = (stripped.connector ?? []).map((c) => ({
|
|
20985
|
-
id:
|
|
21000
|
+
id: blockId("connector", merged.connector, c.name),
|
|
20986
21001
|
name: c.name,
|
|
20987
21002
|
label: c.label,
|
|
20988
21003
|
description: c.description
|
|
@@ -20994,7 +21009,7 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
20994
21009
|
const inputSchema = resolveActionInputSchema(a, ws);
|
|
20995
21010
|
const outputSchema = resolveActionOutputSchema(a, ws);
|
|
20996
21011
|
return {
|
|
20997
|
-
id:
|
|
21012
|
+
id: blockId("action", merged.actions, a.name),
|
|
20998
21013
|
name: a.name,
|
|
20999
21014
|
label: a.label,
|
|
21000
21015
|
description: a.description,
|
|
@@ -21031,11 +21046,11 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
21031
21046
|
} : {}
|
|
21032
21047
|
}));
|
|
21033
21048
|
const mockBlocks = (stripped.mocks ?? []).map((m) => ({
|
|
21034
|
-
id:
|
|
21049
|
+
id: blockId("mock", merged.mocks, m.name),
|
|
21035
21050
|
...m
|
|
21036
21051
|
}));
|
|
21037
21052
|
const playbookBlocks = (stripped.playbooks ?? []).map((p) => ({
|
|
21038
|
-
id:
|
|
21053
|
+
id: blockId("playbook", merged.playbooks, p.name),
|
|
21039
21054
|
...p
|
|
21040
21055
|
}));
|
|
21041
21056
|
const definition = {
|
|
@@ -21056,7 +21071,10 @@ function buildDeploymentDefinitionPayload(merged, options) {
|
|
|
21056
21071
|
operationBlocks,
|
|
21057
21072
|
skillBlocks,
|
|
21058
21073
|
agentBlocks,
|
|
21059
|
-
decisionBlocks: decisionBlocks.map((d) => ({
|
|
21074
|
+
decisionBlocks: decisionBlocks.map((d) => ({
|
|
21075
|
+
...d,
|
|
21076
|
+
id: blockId("decision", merged.decisions, d.name)
|
|
21077
|
+
})),
|
|
21060
21078
|
queryBlocks,
|
|
21061
21079
|
channelBlocks,
|
|
21062
21080
|
connectionBlocks,
|
|
@@ -21106,6 +21124,16 @@ function canonicalizeForStableJson(value) {
|
|
|
21106
21124
|
return value;
|
|
21107
21125
|
}
|
|
21108
21126
|
|
|
21127
|
+
// src/collect-swirls-files.ts
|
|
21128
|
+
function collectSwirlsFiles2(fs2, cwd, dir = cwd, acc = []) {
|
|
21129
|
+
return collectSwirlsFiles({
|
|
21130
|
+
cwd,
|
|
21131
|
+
fileSystem: deployBundleToWorkspaceFileSystem(fs2),
|
|
21132
|
+
dir,
|
|
21133
|
+
acc
|
|
21134
|
+
});
|
|
21135
|
+
}
|
|
21136
|
+
|
|
21109
21137
|
// src/definition-hash.ts
|
|
21110
21138
|
function computeDefinitionHash(stripped) {
|
|
21111
21139
|
const payload = canonicalizeForStableJson(stripped);
|
|
@@ -21457,148 +21485,429 @@ function normalizeDeploymentDefinition(def) {
|
|
|
21457
21485
|
return computerHarnesses.length > 0 ? { ...out, computerHarnesses } : out;
|
|
21458
21486
|
}
|
|
21459
21487
|
|
|
21460
|
-
// src/
|
|
21488
|
+
// src/mounts.ts
|
|
21461
21489
|
import { join as join7 } from "pathe";
|
|
21462
21490
|
|
|
21463
|
-
// src/
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
const key = k.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
21469
|
-
normalized.set(key, v);
|
|
21470
|
-
}
|
|
21471
|
-
function toRel(absPath) {
|
|
21472
|
-
const a = absPath.replace(/\\/g, "/");
|
|
21473
|
-
const r = root;
|
|
21474
|
-
if (a === r) {
|
|
21475
|
-
return "";
|
|
21476
|
-
}
|
|
21477
|
-
const prefix = `${r}/`;
|
|
21478
|
-
if (!a.startsWith(prefix)) {
|
|
21479
|
-
throw new Error(`Path outside virtual root: ${absPath}`);
|
|
21480
|
-
}
|
|
21481
|
-
return a.slice(prefix.length);
|
|
21482
|
-
}
|
|
21483
|
-
return {
|
|
21484
|
-
readdirSync(absDir, _options) {
|
|
21485
|
-
const relDir = toRel(absDir);
|
|
21486
|
-
const prefix = relDir === "" ? "" : `${relDir}/`;
|
|
21487
|
-
const names = /* @__PURE__ */ new Set();
|
|
21488
|
-
for (const key of normalized.keys()) {
|
|
21489
|
-
if (relDir !== "" && !key.startsWith(prefix)) {
|
|
21490
|
-
continue;
|
|
21491
|
-
}
|
|
21492
|
-
if (relDir !== "" && key === relDir) {
|
|
21493
|
-
continue;
|
|
21494
|
-
}
|
|
21495
|
-
const rest = relDir === "" ? key : key.slice(prefix.length);
|
|
21496
|
-
const slash = rest.indexOf("/");
|
|
21497
|
-
if (slash === -1) {
|
|
21498
|
-
names.add(rest);
|
|
21499
|
-
} else {
|
|
21500
|
-
names.add(rest.slice(0, slash));
|
|
21501
|
-
}
|
|
21502
|
-
}
|
|
21503
|
-
return [...names].sort().map((name) => {
|
|
21504
|
-
const childRel = relDir === "" ? name : `${relDir}/${name}`;
|
|
21505
|
-
const isDir = [...normalized.keys()].some(
|
|
21506
|
-
(k) => k === childRel || k.startsWith(`${childRel}/`)
|
|
21507
|
-
);
|
|
21508
|
-
const isFile = normalized.has(childRel);
|
|
21509
|
-
return {
|
|
21510
|
-
name,
|
|
21511
|
-
isDirectory: () => isDir && !isFile,
|
|
21512
|
-
isFile: () => isFile
|
|
21513
|
-
};
|
|
21514
|
-
});
|
|
21515
|
-
},
|
|
21516
|
-
readFileSync(absPath, _encoding) {
|
|
21517
|
-
const rel = toRel(absPath);
|
|
21518
|
-
const content = normalized.get(rel);
|
|
21519
|
-
if (content === void 0) {
|
|
21520
|
-
throw new Error(`ENOENT: ${absPath}`);
|
|
21521
|
-
}
|
|
21522
|
-
return content;
|
|
21523
|
-
}
|
|
21524
|
-
};
|
|
21491
|
+
// src/bytes.ts
|
|
21492
|
+
var encoder = new TextEncoder();
|
|
21493
|
+
var decoder = new TextDecoder();
|
|
21494
|
+
function utf8Bytes(text) {
|
|
21495
|
+
return encoder.encode(text);
|
|
21525
21496
|
}
|
|
21526
|
-
function
|
|
21527
|
-
|
|
21528
|
-
|
|
21497
|
+
function utf8Text(bytes) {
|
|
21498
|
+
return decoder.decode(bytes);
|
|
21499
|
+
}
|
|
21500
|
+
var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
21501
|
+
function base64(bytes) {
|
|
21502
|
+
let out = "";
|
|
21503
|
+
for (let i = 0; i < bytes.length; i += 3) {
|
|
21504
|
+
const a = bytes[i] ?? 0;
|
|
21505
|
+
const b = bytes[i + 1] ?? 0;
|
|
21506
|
+
const c = bytes[i + 2] ?? 0;
|
|
21507
|
+
const left = bytes.length - i;
|
|
21508
|
+
out += BASE64.charAt(a >> 2);
|
|
21509
|
+
out += BASE64.charAt((a & 3) << 4 | b >> 4);
|
|
21510
|
+
out += left > 1 ? BASE64.charAt((b & 15) << 2 | c >> 6) : "=";
|
|
21511
|
+
out += left > 2 ? BASE64.charAt(c & 63) : "=";
|
|
21529
21512
|
}
|
|
21530
|
-
|
|
21531
|
-
|
|
21532
|
-
|
|
21533
|
-
|
|
21534
|
-
|
|
21535
|
-
|
|
21536
|
-
|
|
21537
|
-
|
|
21538
|
-
|
|
21513
|
+
return out;
|
|
21514
|
+
}
|
|
21515
|
+
|
|
21516
|
+
// src/manifest-v2.ts
|
|
21517
|
+
import { z as z11 } from "zod";
|
|
21518
|
+
|
|
21519
|
+
// ../definition/src/deployment-source-schemas.ts
|
|
21520
|
+
import { z as z10 } from "zod";
|
|
21521
|
+
var deploymentSourcePositionSchema = z10.object({
|
|
21522
|
+
line: z10.number().int().min(0),
|
|
21523
|
+
column: z10.number().int().min(0),
|
|
21524
|
+
offset: z10.number().int().min(0)
|
|
21525
|
+
});
|
|
21526
|
+
var deploymentSourceRangeSchema = z10.object({
|
|
21527
|
+
start: deploymentSourcePositionSchema,
|
|
21528
|
+
end: deploymentSourcePositionSchema
|
|
21529
|
+
});
|
|
21530
|
+
var deploymentSourceFileContentSchema = z10.object({
|
|
21531
|
+
path: z10.string().min(1),
|
|
21532
|
+
content: z10.string(),
|
|
21533
|
+
size: z10.number().int().nonnegative(),
|
|
21534
|
+
sha256: z10.string().length(64)
|
|
21535
|
+
});
|
|
21536
|
+
var deploymentSourceFileManifestSchema = z10.object({
|
|
21537
|
+
path: z10.string().min(1),
|
|
21538
|
+
size: z10.number().int().nonnegative(),
|
|
21539
|
+
sha256: z10.string().length(64),
|
|
21540
|
+
r2Key: z10.string().optional()
|
|
21541
|
+
});
|
|
21542
|
+
var deploymentSourceResourceKindSchema = z10.enum([
|
|
21543
|
+
"schema",
|
|
21544
|
+
"form",
|
|
21545
|
+
"webhook",
|
|
21546
|
+
"schedule",
|
|
21547
|
+
"workflow",
|
|
21548
|
+
"stream",
|
|
21549
|
+
"view",
|
|
21550
|
+
"trigger",
|
|
21551
|
+
"secret",
|
|
21552
|
+
"auth",
|
|
21553
|
+
"postgres",
|
|
21554
|
+
"database",
|
|
21555
|
+
"migration",
|
|
21556
|
+
"disk",
|
|
21557
|
+
"skill",
|
|
21558
|
+
"agent",
|
|
21559
|
+
"decision",
|
|
21560
|
+
"mcp",
|
|
21561
|
+
"network",
|
|
21562
|
+
"channel",
|
|
21563
|
+
"connection",
|
|
21564
|
+
"connector",
|
|
21565
|
+
"action",
|
|
21566
|
+
/** Bespoke OpenUI-backed interfaces (`app`, RFC 0022). Also present on
|
|
21567
|
+
* historical manifests from the short-lived RFC 0015 generative app. */
|
|
21568
|
+
"app"
|
|
21569
|
+
]);
|
|
21570
|
+
var deploymentSourceResourceLocationSchema = z10.object({
|
|
21571
|
+
kind: deploymentSourceResourceKindSchema,
|
|
21572
|
+
id: z10.uuid(),
|
|
21573
|
+
name: z10.string(),
|
|
21574
|
+
path: z10.string().min(1),
|
|
21575
|
+
range: deploymentSourceRangeSchema
|
|
21576
|
+
});
|
|
21577
|
+
var deploymentSourceNodeLocationSchema = z10.object({
|
|
21578
|
+
workflowId: z10.uuid(),
|
|
21579
|
+
workflowName: z10.string(),
|
|
21580
|
+
nodeId: z10.uuid(),
|
|
21581
|
+
nodeName: z10.string(),
|
|
21582
|
+
path: z10.string().min(1),
|
|
21583
|
+
range: deploymentSourceRangeSchema
|
|
21584
|
+
});
|
|
21585
|
+
var deploymentSourceManifestSchema = z10.object({
|
|
21586
|
+
version: z10.literal(1),
|
|
21587
|
+
files: z10.array(deploymentSourceFileManifestSchema),
|
|
21588
|
+
resources: z10.array(deploymentSourceResourceLocationSchema),
|
|
21589
|
+
nodes: z10.array(deploymentSourceNodeLocationSchema),
|
|
21590
|
+
sourceFingerprint: z10.string().length(64)
|
|
21591
|
+
});
|
|
21592
|
+
var deploymentSkillFileEntrySchema = z10.object({
|
|
21593
|
+
path: z10.string().min(1),
|
|
21594
|
+
contentBase64: z10.string().min(1),
|
|
21595
|
+
size: z10.number().int().nonnegative()
|
|
21596
|
+
});
|
|
21597
|
+
var deploymentSkillFilesBundleSchema = z10.object({
|
|
21598
|
+
/** On-disk directory name under `.agents/skills/`. */
|
|
21599
|
+
skillName: z10.string().min(1),
|
|
21600
|
+
/** Swirls `skill` block handle for error messages. */
|
|
21601
|
+
blockName: z10.string().min(1),
|
|
21602
|
+
files: z10.array(deploymentSkillFileEntrySchema).min(1)
|
|
21603
|
+
});
|
|
21604
|
+
|
|
21605
|
+
// src/manifest-v2.ts
|
|
21606
|
+
var sha256Schema = z11.string().length(64);
|
|
21607
|
+
var resourceKindV2Schema = z11.enum([
|
|
21608
|
+
...deploymentSourceResourceKindSchema.options,
|
|
21609
|
+
"computer",
|
|
21610
|
+
"query",
|
|
21611
|
+
"operation",
|
|
21612
|
+
"role",
|
|
21613
|
+
"mock",
|
|
21614
|
+
"playbook"
|
|
21615
|
+
]);
|
|
21616
|
+
var deploymentSourceManifestV2Schema = z11.object({
|
|
21617
|
+
version: z11.literal(2),
|
|
21618
|
+
mounts: z11.array(z11.object({ id: z11.string().min(1), sources: sha256Schema, skills: sha256Schema })),
|
|
21619
|
+
files: z11.array(
|
|
21620
|
+
z11.object({
|
|
21621
|
+
mount: z11.string().min(1),
|
|
21622
|
+
path: z11.string().min(1),
|
|
21623
|
+
size: z11.number().int().nonnegative(),
|
|
21624
|
+
sha256: sha256Schema
|
|
21625
|
+
})
|
|
21626
|
+
),
|
|
21627
|
+
resources: z11.array(
|
|
21628
|
+
z11.object({
|
|
21629
|
+
mount: z11.string().min(1),
|
|
21630
|
+
kind: resourceKindV2Schema,
|
|
21631
|
+
id: z11.uuid().optional(),
|
|
21632
|
+
name: z11.string(),
|
|
21633
|
+
path: z11.string().min(1),
|
|
21634
|
+
range: deploymentSourceRangeSchema
|
|
21635
|
+
})
|
|
21636
|
+
),
|
|
21637
|
+
nodes: z11.array(
|
|
21638
|
+
z11.object({
|
|
21639
|
+
mount: z11.string().min(1),
|
|
21640
|
+
workflowId: z11.uuid(),
|
|
21641
|
+
workflowName: z11.string(),
|
|
21642
|
+
nodeId: z11.uuid(),
|
|
21643
|
+
nodeName: z11.string(),
|
|
21644
|
+
path: z11.string().min(1),
|
|
21645
|
+
range: deploymentSourceRangeSchema
|
|
21646
|
+
})
|
|
21647
|
+
),
|
|
21648
|
+
fingerprint: sha256Schema
|
|
21649
|
+
});
|
|
21650
|
+
function parseDeploymentSourceManifestV2(input) {
|
|
21651
|
+
return deploymentSourceManifestV2Schema.safeParse(input);
|
|
21652
|
+
}
|
|
21653
|
+
var ENTRIES = [
|
|
21654
|
+
["schema", "schemas", "schemas"],
|
|
21655
|
+
["form", "forms", "forms"],
|
|
21656
|
+
["webhook", "webhooks", "webhooks"],
|
|
21657
|
+
["schedule", "schedules", "schedules"],
|
|
21658
|
+
["workflow", "workflows", "workflows"],
|
|
21659
|
+
["stream", "streams", "streams"],
|
|
21660
|
+
["view", "views", "views"],
|
|
21661
|
+
["trigger", "triggers", "triggers"],
|
|
21662
|
+
["secret", "secretBlocks", "secrets"],
|
|
21663
|
+
["auth", "authBlocks", "auths"],
|
|
21664
|
+
["postgres", "postgresBlocks", "postgres"],
|
|
21665
|
+
["database", "databaseBlocks", "databases"],
|
|
21666
|
+
["migration", "databaseMigrations", "migrations"],
|
|
21667
|
+
["disk", "diskBlocks", "disk"],
|
|
21668
|
+
["skill", "skillBlocks", "skill"],
|
|
21669
|
+
["agent", "agentBlocks", "agent"],
|
|
21670
|
+
["decision", "decisionBlocks", "decisions"],
|
|
21671
|
+
["mcp", "mcpBlocks", "mcp"],
|
|
21672
|
+
["network", "networkBlocks", "networks"],
|
|
21673
|
+
["channel", "channelBlocks", "channels"],
|
|
21674
|
+
["connection", "connectionBlocks", "connections"],
|
|
21675
|
+
["connector", "connectorBlocks", "connector"],
|
|
21676
|
+
["action", "actionBlocks", "actions"],
|
|
21677
|
+
["app", "apps", "apps"],
|
|
21678
|
+
["computer", "computerBlocks", "computer"],
|
|
21679
|
+
["query", "queryBlocks", "queries"],
|
|
21680
|
+
["operation", "operationBlocks", "operations"],
|
|
21681
|
+
["role", "roles", "roles"],
|
|
21682
|
+
["mock", "mockBlocks", "mocks"],
|
|
21683
|
+
["playbook", "playbookBlocks", "playbooks"]
|
|
21684
|
+
];
|
|
21685
|
+
function listOf(value) {
|
|
21686
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "object" && item !== null) : [];
|
|
21687
|
+
}
|
|
21688
|
+
function stringField(item, key) {
|
|
21689
|
+
const value = Reflect.get(item, key);
|
|
21690
|
+
return typeof value === "string" ? value : void 0;
|
|
21691
|
+
}
|
|
21692
|
+
function located(decl) {
|
|
21693
|
+
const name = stringField(decl, "name");
|
|
21694
|
+
const range2 = Reflect.get(decl, "range");
|
|
21695
|
+
if (name === void 0 || typeof range2 !== "object" || range2 === null) {
|
|
21696
|
+
return void 0;
|
|
21539
21697
|
}
|
|
21540
|
-
|
|
21698
|
+
return { name, range: range2, sourcePath: stringField(decl, "sourcePath") };
|
|
21699
|
+
}
|
|
21700
|
+
function byName(decls) {
|
|
21541
21701
|
const out = /* @__PURE__ */ new Map();
|
|
21542
|
-
for (const
|
|
21543
|
-
const
|
|
21544
|
-
if (
|
|
21545
|
-
|
|
21702
|
+
for (const item of listOf(decls)) {
|
|
21703
|
+
const decl = located(item);
|
|
21704
|
+
if (decl !== void 0) {
|
|
21705
|
+
out.set(decl.name, { decl, mount: sourceMountOf(item) });
|
|
21546
21706
|
}
|
|
21547
|
-
out.set(nk.slice(prefix.length), v);
|
|
21548
21707
|
}
|
|
21549
21708
|
return out;
|
|
21550
21709
|
}
|
|
21551
|
-
function
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21710
|
+
function buildDeploymentSourceManifestV2({
|
|
21711
|
+
definition,
|
|
21712
|
+
ast,
|
|
21713
|
+
mounts,
|
|
21714
|
+
files,
|
|
21715
|
+
fingerprint
|
|
21716
|
+
}) {
|
|
21717
|
+
const resources = [];
|
|
21718
|
+
const nodes = [];
|
|
21719
|
+
for (const [kind, definitionKey, astKey] of ENTRIES) {
|
|
21720
|
+
const decls = byName(ast[astKey]);
|
|
21721
|
+
for (const item of listOf(definition[definitionKey])) {
|
|
21722
|
+
const name = stringField(item, "name");
|
|
21723
|
+
const found = name === void 0 ? void 0 : decls.get(name);
|
|
21724
|
+
if (name === void 0 || found?.decl.sourcePath === void 0) {
|
|
21725
|
+
continue;
|
|
21726
|
+
}
|
|
21727
|
+
const id = stringField(item, "id");
|
|
21728
|
+
resources.push({
|
|
21729
|
+
mount: found.mount,
|
|
21730
|
+
kind,
|
|
21731
|
+
...id !== void 0 ? { id } : {},
|
|
21732
|
+
name,
|
|
21733
|
+
path: found.decl.sourcePath,
|
|
21734
|
+
range: found.decl.range
|
|
21735
|
+
});
|
|
21736
|
+
}
|
|
21558
21737
|
}
|
|
21559
|
-
const
|
|
21560
|
-
const
|
|
21561
|
-
|
|
21562
|
-
const
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21738
|
+
const workflowDecls = new Map(ast.workflows.map((workflow) => [workflow.name, workflow]));
|
|
21739
|
+
for (const workflow of listOf(definition.workflows)) {
|
|
21740
|
+
const workflowName = stringField(workflow, "name");
|
|
21741
|
+
const workflowId = stringField(workflow, "id");
|
|
21742
|
+
const decl = workflowName === void 0 ? void 0 : workflowDecls.get(workflowName);
|
|
21743
|
+
if (workflowName === void 0 || workflowId === void 0 || decl === void 0) {
|
|
21744
|
+
continue;
|
|
21745
|
+
}
|
|
21746
|
+
const nodeDecls = byName(decl.nodes);
|
|
21747
|
+
for (const node of listOf(Reflect.get(workflow, "nodes"))) {
|
|
21748
|
+
const nodeName = stringField(node, "name");
|
|
21749
|
+
const nodeId = stringField(node, "id");
|
|
21750
|
+
const found = nodeName === void 0 ? void 0 : nodeDecls.get(nodeName);
|
|
21751
|
+
if (nodeName === void 0 || nodeId === void 0 || found?.decl.sourcePath === void 0) {
|
|
21752
|
+
continue;
|
|
21569
21753
|
}
|
|
21754
|
+
nodes.push({
|
|
21755
|
+
mount: sourceMountOf(decl),
|
|
21756
|
+
workflowId,
|
|
21757
|
+
workflowName,
|
|
21758
|
+
nodeId,
|
|
21759
|
+
nodeName,
|
|
21760
|
+
path: found.decl.sourcePath,
|
|
21761
|
+
range: found.decl.range
|
|
21762
|
+
});
|
|
21570
21763
|
}
|
|
21571
21764
|
}
|
|
21572
|
-
return
|
|
21765
|
+
return {
|
|
21766
|
+
version: 2,
|
|
21767
|
+
mounts,
|
|
21768
|
+
files,
|
|
21769
|
+
resources: resources.sort((a, b) => `${a.kind}:${a.name}`.localeCompare(`${b.kind}:${b.name}`)),
|
|
21770
|
+
nodes: nodes.sort(
|
|
21771
|
+
(a, b) => `${a.workflowName}:${a.nodeName}`.localeCompare(`${b.workflowName}:${b.nodeName}`)
|
|
21772
|
+
),
|
|
21773
|
+
fingerprint
|
|
21774
|
+
};
|
|
21573
21775
|
}
|
|
21574
21776
|
|
|
21575
|
-
// src/
|
|
21576
|
-
|
|
21577
|
-
var
|
|
21578
|
-
function
|
|
21579
|
-
return
|
|
21777
|
+
// src/mount-fs.ts
|
|
21778
|
+
import { normalize as normalize2 } from "pathe";
|
|
21779
|
+
var MOUNTS_ROOT = "/m";
|
|
21780
|
+
function mountDirectory(index) {
|
|
21781
|
+
return `${MOUNTS_ROOT}/${index}`;
|
|
21782
|
+
}
|
|
21783
|
+
var strictUtf8 = new TextDecoder("utf-8", { fatal: true });
|
|
21784
|
+
var lenientUtf8 = new TextDecoder("utf-8");
|
|
21785
|
+
function decodeUtf8(content) {
|
|
21786
|
+
if (typeof content === "string") {
|
|
21787
|
+
return content;
|
|
21788
|
+
}
|
|
21789
|
+
try {
|
|
21790
|
+
return strictUtf8.decode(content);
|
|
21791
|
+
} catch {
|
|
21792
|
+
return null;
|
|
21793
|
+
}
|
|
21580
21794
|
}
|
|
21581
|
-
function
|
|
21582
|
-
return
|
|
21795
|
+
function decodeUtf8Lenient(content) {
|
|
21796
|
+
return typeof content === "string" ? content : lenientUtf8.decode(content);
|
|
21583
21797
|
}
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
|
|
21798
|
+
function contentBytes(content) {
|
|
21799
|
+
return typeof content === "string" ? utf8Bytes(content) : content;
|
|
21800
|
+
}
|
|
21801
|
+
function clean(path) {
|
|
21802
|
+
const normalized = normalize2(path);
|
|
21803
|
+
return normalized.length > 1 ? normalized.replace(/\/+$/, "") : normalized;
|
|
21804
|
+
}
|
|
21805
|
+
function enoent(path) {
|
|
21806
|
+
return new Error(`ENOENT: no such file or directory, "${path}"`);
|
|
21807
|
+
}
|
|
21808
|
+
function createMountFs(files, directories = []) {
|
|
21809
|
+
const children = /* @__PURE__ */ new Map([["/", /* @__PURE__ */ new Map()]]);
|
|
21810
|
+
const placeholder = "\0";
|
|
21811
|
+
for (const path of [...files.keys(), ...directories.map((dir) => `${dir}/${placeholder}`)]) {
|
|
21812
|
+
const parts = path.split("/").filter(Boolean);
|
|
21813
|
+
let dir = "/";
|
|
21814
|
+
for (const [index, part] of parts.entries()) {
|
|
21815
|
+
const isLast = index === parts.length - 1;
|
|
21816
|
+
const listing = children.get(dir) ?? /* @__PURE__ */ new Map();
|
|
21817
|
+
children.set(dir, listing);
|
|
21818
|
+
if (isLast) {
|
|
21819
|
+
if (part !== placeholder) {
|
|
21820
|
+
listing.set(part, "file");
|
|
21821
|
+
}
|
|
21822
|
+
} else {
|
|
21823
|
+
if (listing.get(part) !== "file") {
|
|
21824
|
+
listing.set(part, "dir");
|
|
21825
|
+
}
|
|
21826
|
+
dir = dir === "/" ? `/${part}` : `${dir}/${part}`;
|
|
21827
|
+
if (!children.has(dir)) {
|
|
21828
|
+
children.set(dir, /* @__PURE__ */ new Map());
|
|
21829
|
+
}
|
|
21830
|
+
}
|
|
21831
|
+
}
|
|
21596
21832
|
}
|
|
21597
|
-
|
|
21833
|
+
const isDirectory = (path) => !files.has(path) && children.has(path);
|
|
21834
|
+
return {
|
|
21835
|
+
readdirSync(path, _options) {
|
|
21836
|
+
const dir = clean(path);
|
|
21837
|
+
if (!isDirectory(dir)) {
|
|
21838
|
+
throw enoent(path);
|
|
21839
|
+
}
|
|
21840
|
+
const listing = children.get(dir) ?? /* @__PURE__ */ new Map();
|
|
21841
|
+
return [...listing.keys()].sort().map((name) => {
|
|
21842
|
+
const kind = listing.get(name);
|
|
21843
|
+
return {
|
|
21844
|
+
name,
|
|
21845
|
+
isDirectory: () => kind === "dir",
|
|
21846
|
+
isFile: () => kind === "file"
|
|
21847
|
+
};
|
|
21848
|
+
});
|
|
21849
|
+
},
|
|
21850
|
+
readFileSync(path, _encoding) {
|
|
21851
|
+
const content = files.get(clean(path));
|
|
21852
|
+
if (content === void 0) {
|
|
21853
|
+
throw enoent(path);
|
|
21854
|
+
}
|
|
21855
|
+
const text = decodeUtf8(content);
|
|
21856
|
+
if (text === null) {
|
|
21857
|
+
throw new Error(`"${path}" is not UTF-8 text`);
|
|
21858
|
+
}
|
|
21859
|
+
return text;
|
|
21860
|
+
},
|
|
21861
|
+
readFileBuffer(path) {
|
|
21862
|
+
const content = files.get(clean(path));
|
|
21863
|
+
if (content === void 0) {
|
|
21864
|
+
throw enoent(path);
|
|
21865
|
+
}
|
|
21866
|
+
return contentBytes(content);
|
|
21867
|
+
},
|
|
21868
|
+
lstatSync(path) {
|
|
21869
|
+
const target = clean(path);
|
|
21870
|
+
if (files.has(target)) {
|
|
21871
|
+
return { isSymbolicLink: false, isFile: true, isDirectory: false, mode: 420 };
|
|
21872
|
+
}
|
|
21873
|
+
if (children.has(target)) {
|
|
21874
|
+
return { isSymbolicLink: false, isFile: false, isDirectory: true, mode: 493 };
|
|
21875
|
+
}
|
|
21876
|
+
throw enoent(path);
|
|
21877
|
+
},
|
|
21878
|
+
existsSync(path) {
|
|
21879
|
+
return files.has(clean(path));
|
|
21880
|
+
}
|
|
21881
|
+
};
|
|
21882
|
+
}
|
|
21883
|
+
function isWithin(dir, path) {
|
|
21884
|
+
const target = normalize2(path);
|
|
21885
|
+
return target === dir || target.startsWith(`${dir}/`);
|
|
21886
|
+
}
|
|
21887
|
+
function confineTo(fs2, dir) {
|
|
21888
|
+
return {
|
|
21889
|
+
readdirSync(path, options) {
|
|
21890
|
+
if (!isWithin(dir, path)) {
|
|
21891
|
+
throw enoent(path);
|
|
21892
|
+
}
|
|
21893
|
+
return fs2.readdirSync(path, options);
|
|
21894
|
+
},
|
|
21895
|
+
readFileSync(path, encoding) {
|
|
21896
|
+
if (!isWithin(dir, path)) {
|
|
21897
|
+
throw new Error(
|
|
21898
|
+
`"${path}" is outside this directory: a file may reference only files in its own mount`
|
|
21899
|
+
);
|
|
21900
|
+
}
|
|
21901
|
+
return fs2.readFileSync(path, encoding);
|
|
21902
|
+
},
|
|
21903
|
+
existsSync(path) {
|
|
21904
|
+
return isWithin(dir, path) && fs2.existsSync(path);
|
|
21905
|
+
}
|
|
21906
|
+
};
|
|
21598
21907
|
}
|
|
21599
21908
|
|
|
21600
21909
|
// src/skills/resolve-skill.ts
|
|
21601
|
-
import { isAbsolute as isAbsolute2, join as join5, normalize as
|
|
21910
|
+
import { isAbsolute as isAbsolute2, join as join5, normalize as normalize3, relative } from "pathe";
|
|
21602
21911
|
|
|
21603
21912
|
// src/skills/constants.ts
|
|
21604
21913
|
var AGENTS_SKILLS_DIR = ".agents/skills";
|
|
@@ -21659,8 +21968,8 @@ function assertValidSkillSlug(skillName) {
|
|
|
21659
21968
|
}
|
|
21660
21969
|
|
|
21661
21970
|
// src/skills/resolve-skill.ts
|
|
21662
|
-
function skillRootPath(projectRoot, skillName) {
|
|
21663
|
-
return join5(projectRoot,
|
|
21971
|
+
function skillRootPath(projectRoot, skillsRoot, skillName) {
|
|
21972
|
+
return join5(projectRoot, skillsRoot, skillName);
|
|
21664
21973
|
}
|
|
21665
21974
|
function assertContained(skillRoot, absolutePath) {
|
|
21666
21975
|
const rel = relative(skillRoot, absolutePath);
|
|
@@ -21709,27 +22018,27 @@ function collectSkillFilesRecursive(fs2, skillRoot, absoluteDir, acc, totals) {
|
|
|
21709
22018
|
});
|
|
21710
22019
|
}
|
|
21711
22020
|
}
|
|
21712
|
-
function resolveSkillTree(fs2, projectRoot, skillName) {
|
|
22021
|
+
function resolveSkillTree(fs2, projectRoot, skillName, skillsRoot = AGENTS_SKILLS_DIR) {
|
|
21713
22022
|
const trimmed = skillName.trim();
|
|
21714
22023
|
if (!trimmed) {
|
|
21715
22024
|
throw new Error("Skill name must be non-empty");
|
|
21716
22025
|
}
|
|
21717
22026
|
assertValidSkillSlug(trimmed);
|
|
21718
|
-
const skillRoot =
|
|
22027
|
+
const skillRoot = normalize3(skillRootPath(projectRoot, skillsRoot, trimmed));
|
|
21719
22028
|
const totals = { bytes: 0, count: 0 };
|
|
21720
22029
|
const files = [];
|
|
21721
22030
|
try {
|
|
21722
22031
|
collectSkillFilesRecursive(fs2, skillRoot, skillRoot, files, totals);
|
|
21723
22032
|
} catch (err) {
|
|
21724
22033
|
if (err instanceof Error && err.message.includes("ENOENT")) {
|
|
21725
|
-
throw new Error(`Skill "${trimmed}" not found under ${
|
|
22034
|
+
throw new Error(`Skill "${trimmed}" not found under ${skillsRoot}/${trimmed}/`, {
|
|
21726
22035
|
cause: err
|
|
21727
22036
|
});
|
|
21728
22037
|
}
|
|
21729
22038
|
throw err;
|
|
21730
22039
|
}
|
|
21731
22040
|
if (files.length === 0) {
|
|
21732
|
-
throw new Error(`Skill "${trimmed}" not found under ${
|
|
22041
|
+
throw new Error(`Skill "${trimmed}" not found under ${skillsRoot}/${trimmed}/`);
|
|
21733
22042
|
}
|
|
21734
22043
|
const hasSkillMd = files.some((f) => f.path === SKILL_MD_FILENAME);
|
|
21735
22044
|
if (!hasSkillMd) {
|
|
@@ -21765,7 +22074,7 @@ function collectDeploymentSkillFiles(fs2, cwd, skillBlocks) {
|
|
|
21765
22074
|
return bundles.sort((a, b) => a.skillName.localeCompare(b.skillName));
|
|
21766
22075
|
}
|
|
21767
22076
|
function collectReferencedSkillBlocksFromAst(ast) {
|
|
21768
|
-
const
|
|
22077
|
+
const byName3 = new Map((ast.skill ?? []).map((s) => [s.name, s]));
|
|
21769
22078
|
const needed = /* @__PURE__ */ new Set();
|
|
21770
22079
|
for (const agent of ast.agent ?? []) {
|
|
21771
22080
|
for (const name of agent.skills ?? []) {
|
|
@@ -21779,7 +22088,7 @@ function collectReferencedSkillBlocksFromAst(ast) {
|
|
|
21779
22088
|
}
|
|
21780
22089
|
const blocks = [];
|
|
21781
22090
|
for (const name of needed) {
|
|
21782
|
-
const block =
|
|
22091
|
+
const block = byName3.get(name);
|
|
21783
22092
|
if (block) {
|
|
21784
22093
|
blocks.push(block);
|
|
21785
22094
|
}
|
|
@@ -21787,33 +22096,6 @@ function collectReferencedSkillBlocksFromAst(ast) {
|
|
|
21787
22096
|
return blocks;
|
|
21788
22097
|
}
|
|
21789
22098
|
|
|
21790
|
-
// src/skills/skill-fs.ts
|
|
21791
|
-
function deployBundleToSkillDeployFs(fs2) {
|
|
21792
|
-
return {
|
|
21793
|
-
readdirSync: fs2.readdirSync.bind(fs2),
|
|
21794
|
-
readFileSync: fs2.readFileSync.bind(fs2),
|
|
21795
|
-
readFileBuffer(absPath) {
|
|
21796
|
-
return utf8Bytes(fs2.readFileSync(absPath, "utf-8"));
|
|
21797
|
-
},
|
|
21798
|
-
lstatSync(absPath) {
|
|
21799
|
-
let isFile = false;
|
|
21800
|
-
let isDirectory = false;
|
|
21801
|
-
try {
|
|
21802
|
-
fs2.readFileSync(absPath, "utf-8");
|
|
21803
|
-
isFile = true;
|
|
21804
|
-
} catch {
|
|
21805
|
-
isDirectory = true;
|
|
21806
|
-
}
|
|
21807
|
-
return {
|
|
21808
|
-
isSymbolicLink: false,
|
|
21809
|
-
isFile,
|
|
21810
|
-
isDirectory,
|
|
21811
|
-
mode: isFile ? 420 : 493
|
|
21812
|
-
};
|
|
21813
|
-
}
|
|
21814
|
-
};
|
|
21815
|
-
}
|
|
21816
|
-
|
|
21817
22099
|
// src/source-files.ts
|
|
21818
22100
|
import { join as join6 } from "pathe";
|
|
21819
22101
|
var IGNORE_DIRS2 = /* @__PURE__ */ new Set(["node_modules", "__fixtures__"]);
|
|
@@ -21900,11 +22182,11 @@ function sourceLocationFor(decl) {
|
|
|
21900
22182
|
range: decl.range
|
|
21901
22183
|
};
|
|
21902
22184
|
}
|
|
21903
|
-
function
|
|
22185
|
+
function byName2(items) {
|
|
21904
22186
|
return new Map((items ?? []).map((item) => [item.name, item]));
|
|
21905
22187
|
}
|
|
21906
22188
|
function pushResourceLocation(out, kind, definitionItems, decls) {
|
|
21907
|
-
const declByName =
|
|
22189
|
+
const declByName = byName2(decls);
|
|
21908
22190
|
for (const item of definitionItems ?? []) {
|
|
21909
22191
|
const loc = sourceLocationFor(declByName.get(item.name));
|
|
21910
22192
|
if (!loc) {
|
|
@@ -21960,10 +22242,10 @@ function buildDeploymentSourceManifest({
|
|
|
21960
22242
|
ast[astKey]
|
|
21961
22243
|
);
|
|
21962
22244
|
}
|
|
21963
|
-
const workflowDecls =
|
|
22245
|
+
const workflowDecls = byName2(ast.workflows);
|
|
21964
22246
|
for (const workflow of definition.workflows ?? []) {
|
|
21965
22247
|
const decl = workflowDecls.get(workflow.name);
|
|
21966
|
-
const nodeDecls =
|
|
22248
|
+
const nodeDecls = byName2(decl?.nodes);
|
|
21967
22249
|
for (const node of workflow.nodes) {
|
|
21968
22250
|
const nodeDecl = nodeDecls.get(node.name);
|
|
21969
22251
|
const loc = sourceLocationFor(nodeDecl);
|
|
@@ -21994,92 +22276,415 @@ function buildDeploymentSourceManifest({
|
|
|
21994
22276
|
};
|
|
21995
22277
|
}
|
|
21996
22278
|
|
|
21997
|
-
// src/
|
|
21998
|
-
var
|
|
22279
|
+
// src/mounts.ts
|
|
22280
|
+
var MOUNT_SKILLS_ROOT = ".agents/skills";
|
|
22281
|
+
var IGNORE_DIRS3 = /* @__PURE__ */ new Set(["node_modules", "__fixtures__"]);
|
|
21999
22282
|
function messageOf(error) {
|
|
22000
22283
|
return error instanceof Error ? error.message : String(error);
|
|
22001
22284
|
}
|
|
22002
|
-
function
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
const fileSystem = deployBundleToWorkspaceFileSystem(fs2);
|
|
22006
|
-
const diagnostics = [];
|
|
22007
|
-
const sourceFiles = collectDeploymentSourceFiles(fs2, VIRTUAL_ROOT);
|
|
22008
|
-
const failed = () => ({
|
|
22009
|
-
ok: false,
|
|
22010
|
-
definition: null,
|
|
22011
|
-
diagnostics,
|
|
22012
|
-
sourceFiles,
|
|
22013
|
-
sourceFingerprint: computeDeploymentSourceFingerprint(sourceFiles),
|
|
22014
|
-
skillFiles: [],
|
|
22015
|
-
ast: null
|
|
22016
|
-
});
|
|
22017
|
-
const workspace = buildWorkspaceResourceIndex({ cwd: VIRTUAL_ROOT, fileSystem });
|
|
22018
|
-
for (const path of collectSwirlsFiles2(fs2, VIRTUAL_ROOT)) {
|
|
22019
|
-
const fullPath = join7(VIRTUAL_ROOT, path);
|
|
22020
|
-
const parsed = parse(fs2.readFileSync(fullPath, "utf-8"));
|
|
22021
|
-
if (parsed.errors.length > 0) {
|
|
22022
|
-
for (const error of parsed.errors) {
|
|
22023
|
-
diagnostics.push({
|
|
22024
|
-
severity: "error",
|
|
22025
|
-
stage: "parse",
|
|
22026
|
-
message: error.message,
|
|
22027
|
-
path,
|
|
22028
|
-
range: error.range
|
|
22029
|
-
});
|
|
22030
|
-
}
|
|
22031
|
-
continue;
|
|
22032
|
-
}
|
|
22033
|
-
const found = [
|
|
22034
|
-
...validate(parsed.ast, { workspace, host: options.host }),
|
|
22035
|
-
...validateTsFileRefs(parsed.ast, {
|
|
22036
|
-
swirlsFilePath: fullPath,
|
|
22037
|
-
existsSync: fileSystem.existsSync
|
|
22038
|
-
})
|
|
22039
|
-
];
|
|
22040
|
-
for (const diagnostic of found) {
|
|
22041
|
-
diagnostics.push({
|
|
22042
|
-
severity: diagnostic.severity === "warning" ? "warning" : "error",
|
|
22043
|
-
stage: "validate",
|
|
22044
|
-
message: diagnostic.message,
|
|
22045
|
-
path,
|
|
22046
|
-
range: diagnostic.range
|
|
22047
|
-
});
|
|
22048
|
-
}
|
|
22285
|
+
function compareIds(a, b) {
|
|
22286
|
+
if (a < b) {
|
|
22287
|
+
return -1;
|
|
22049
22288
|
}
|
|
22050
|
-
|
|
22051
|
-
|
|
22289
|
+
return a > b ? 1 : 0;
|
|
22290
|
+
}
|
|
22291
|
+
function pathProblem(path) {
|
|
22292
|
+
if (path.length === 0) {
|
|
22293
|
+
return "is empty";
|
|
22052
22294
|
}
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
merged = mergeProjectSwirlsFiles(fs2, VIRTUAL_ROOT, { host: options.host });
|
|
22056
|
-
} catch (error) {
|
|
22057
|
-
diagnostics.push({ severity: "error", stage: "merge", message: messageOf(error) });
|
|
22058
|
-
return failed();
|
|
22295
|
+
if (path.includes("\\")) {
|
|
22296
|
+
return 'holds a backslash; use "/"';
|
|
22059
22297
|
}
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22298
|
+
if (path.startsWith("/")) {
|
|
22299
|
+
return "is absolute; give it relative to the mount";
|
|
22300
|
+
}
|
|
22301
|
+
const parts = path.split("/");
|
|
22302
|
+
if (parts.some((part) => part === "")) {
|
|
22303
|
+
return "has an empty segment";
|
|
22304
|
+
}
|
|
22305
|
+
if (parts.some((part) => part === "." || part === "..")) {
|
|
22306
|
+
return 'holds a "." or ".." segment';
|
|
22307
|
+
}
|
|
22308
|
+
return null;
|
|
22309
|
+
}
|
|
22310
|
+
function isSourcePath(path) {
|
|
22311
|
+
const parts = path.split("/");
|
|
22312
|
+
const name = parts.at(-1) ?? "";
|
|
22313
|
+
return name.endsWith(".swirls") && !parts.slice(0, -1).some((part) => IGNORE_DIRS3.has(part));
|
|
22314
|
+
}
|
|
22315
|
+
function entriesOf(files) {
|
|
22316
|
+
return files instanceof Map ? [...files] : Object.entries(files);
|
|
22317
|
+
}
|
|
22318
|
+
function fileReferences(ast) {
|
|
22319
|
+
const refs = [];
|
|
22320
|
+
const visitNodes = (nodes) => {
|
|
22321
|
+
for (const node of nodes) {
|
|
22322
|
+
for (const cv of Object.values(node.configFields)) {
|
|
22323
|
+
if (cv.kind === "ts_file_ref") {
|
|
22324
|
+
refs.push({ ref: cv.path, range: cv.pathRange });
|
|
22325
|
+
}
|
|
22326
|
+
}
|
|
22327
|
+
if (node.subgraph?.nodes) {
|
|
22328
|
+
visitNodes(node.subgraph.nodes);
|
|
22329
|
+
}
|
|
22330
|
+
}
|
|
22331
|
+
};
|
|
22332
|
+
for (const stream of ast.streams ?? []) {
|
|
22333
|
+
for (const version of stream.versions ?? []) {
|
|
22334
|
+
for (const cv of [version.condition, version.prepare]) {
|
|
22335
|
+
if (cv?.kind === "ts_file_ref") {
|
|
22336
|
+
refs.push({ ref: cv.path, range: cv.pathRange });
|
|
22337
|
+
}
|
|
22338
|
+
}
|
|
22339
|
+
}
|
|
22340
|
+
}
|
|
22341
|
+
for (const workflow of ast.workflows) {
|
|
22342
|
+
visitNodes(workflow.nodes);
|
|
22343
|
+
}
|
|
22344
|
+
for (const migration of ast.migrations ?? []) {
|
|
22345
|
+
if (migration.operation?.kind === "ts_file_ref") {
|
|
22346
|
+
refs.push({ ref: migration.operation.path, range: migration.operation.pathRange });
|
|
22347
|
+
}
|
|
22348
|
+
}
|
|
22349
|
+
for (const operation of ast.operations ?? []) {
|
|
22350
|
+
if (operation.command?.path !== void 0) {
|
|
22351
|
+
refs.push({ ref: operation.command.path, range: operation.command.range });
|
|
22352
|
+
}
|
|
22353
|
+
}
|
|
22354
|
+
return refs.filter((entry) => entry.ref.trim() !== "");
|
|
22355
|
+
}
|
|
22356
|
+
function describeSite(site, from) {
|
|
22357
|
+
return site.mount === from ? site.path : `${site.path} (in mount ${site.mount})`;
|
|
22358
|
+
}
|
|
22359
|
+
function fingerprintOf(mounts) {
|
|
22360
|
+
const payload = {
|
|
22361
|
+
v: 1,
|
|
22362
|
+
mounts: mounts.map((mount) => ({
|
|
22363
|
+
id: mount.mount,
|
|
22364
|
+
sources: mount.sources,
|
|
22365
|
+
skills: mount.skills
|
|
22366
|
+
}))
|
|
22367
|
+
};
|
|
22368
|
+
return sha256Hex(JSON.stringify(canonicalizeForStableJson(payload)));
|
|
22369
|
+
}
|
|
22370
|
+
function fingerprintMount(mount) {
|
|
22371
|
+
const hashed = (paths2) => computeDeploymentSourceFingerprint(
|
|
22372
|
+
paths2.map((path) => ({
|
|
22373
|
+
path,
|
|
22374
|
+
sha256: sha256Hex(contentBytes(mount.files.get(path) ?? ""))
|
|
22375
|
+
}))
|
|
22376
|
+
);
|
|
22377
|
+
const paths = [...mount.files.keys()];
|
|
22378
|
+
return {
|
|
22379
|
+
mount: mount.id,
|
|
22380
|
+
sources: hashed(paths.filter(isSourcePath)),
|
|
22381
|
+
skills: hashed(paths.filter((path) => isWithin(mount.skillsRoot, path)))
|
|
22382
|
+
};
|
|
22383
|
+
}
|
|
22384
|
+
function lowerSwirlsMounts(mounts, options = {}) {
|
|
22385
|
+
const diagnostics = [];
|
|
22386
|
+
const prepared = [];
|
|
22387
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
22388
|
+
const error = (stage, message, at = {}) => {
|
|
22389
|
+
diagnostics.push({
|
|
22390
|
+
severity: "error",
|
|
22391
|
+
stage,
|
|
22392
|
+
message,
|
|
22393
|
+
...at.mount !== void 0 ? { mount: at.mount } : {},
|
|
22394
|
+
...at.path !== void 0 ? { path: at.path } : {},
|
|
22395
|
+
...at.range !== void 0 ? { range: at.range } : {}
|
|
22396
|
+
});
|
|
22397
|
+
};
|
|
22398
|
+
for (const [index, mount] of mounts.entries()) {
|
|
22399
|
+
const id = mount.id;
|
|
22400
|
+
if (typeof id !== "string" || id.length === 0) {
|
|
22401
|
+
error(
|
|
22402
|
+
"mount",
|
|
22403
|
+
`Mount ${index + 1} has no id: give each mount an id of at least one character`
|
|
22404
|
+
);
|
|
22405
|
+
continue;
|
|
22406
|
+
}
|
|
22407
|
+
if (seenIds.has(id)) {
|
|
22408
|
+
error("mount", `Mount id "${id}" is given more than once: each mount needs its own id`, {
|
|
22409
|
+
mount: id
|
|
22410
|
+
});
|
|
22411
|
+
}
|
|
22412
|
+
seenIds.add(id);
|
|
22413
|
+
let skillsRoot = mount.skillsRoot ?? MOUNT_SKILLS_ROOT;
|
|
22414
|
+
if (skillsRoot.endsWith("/")) {
|
|
22415
|
+
skillsRoot = skillsRoot.slice(0, -1);
|
|
22416
|
+
}
|
|
22417
|
+
const rootProblem = pathProblem(skillsRoot);
|
|
22418
|
+
if (rootProblem !== null) {
|
|
22419
|
+
error(
|
|
22420
|
+
"mount",
|
|
22421
|
+
`skillsRoot "${mount.skillsRoot ?? ""}" ${rootProblem}: it must be a relative directory under the mount`,
|
|
22422
|
+
{ mount: id }
|
|
22423
|
+
);
|
|
22424
|
+
}
|
|
22425
|
+
const files = /* @__PURE__ */ new Map();
|
|
22426
|
+
for (const [path, content] of entriesOf(mount.files ?? {})) {
|
|
22427
|
+
const problem = pathProblem(path);
|
|
22428
|
+
if (problem !== null) {
|
|
22429
|
+
error("mount", `File path "${path}" ${problem}`, { mount: id, path });
|
|
22430
|
+
continue;
|
|
22431
|
+
}
|
|
22432
|
+
if (typeof content !== "string" && !(content instanceof Uint8Array)) {
|
|
22433
|
+
error("mount", "A file must be text or bytes", { mount: id, path });
|
|
22434
|
+
continue;
|
|
22435
|
+
}
|
|
22436
|
+
files.set(path, content);
|
|
22437
|
+
}
|
|
22438
|
+
for (const path of files.keys()) {
|
|
22439
|
+
const parts = path.split("/");
|
|
22440
|
+
for (let end = 1; end < parts.length; end++) {
|
|
22441
|
+
const ancestor = parts.slice(0, end).join("/");
|
|
22442
|
+
if (files.has(ancestor)) {
|
|
22443
|
+
error("mount", `"${ancestor}" is a file and also a directory of "${path}"`, {
|
|
22444
|
+
mount: id,
|
|
22445
|
+
path: ancestor
|
|
22446
|
+
});
|
|
22447
|
+
}
|
|
22448
|
+
}
|
|
22449
|
+
}
|
|
22450
|
+
prepared.push({ id, dir: mountDirectory(index), skillsRoot, files });
|
|
22451
|
+
}
|
|
22452
|
+
const fingerprints = prepared.map(fingerprintMount).sort((a, b) => compareIds(a.mount, b.mount));
|
|
22453
|
+
const fingerprint = fingerprintOf(fingerprints);
|
|
22454
|
+
const sourceFiles = [...prepared].sort((a, b) => compareIds(a.id, b.id)).flatMap(
|
|
22455
|
+
(mount) => [...mount.files.keys()].filter(isSourcePath).sort((a, b) => a.localeCompare(b)).map((path) => {
|
|
22456
|
+
const content = mount.files.get(path) ?? "";
|
|
22457
|
+
const bytes = contentBytes(content);
|
|
22458
|
+
return {
|
|
22459
|
+
mount: mount.id,
|
|
22460
|
+
path,
|
|
22461
|
+
content: decodeUtf8Lenient(content),
|
|
22462
|
+
size: bytes.byteLength,
|
|
22463
|
+
sha256: sha256Hex(bytes)
|
|
22464
|
+
};
|
|
22465
|
+
})
|
|
22466
|
+
);
|
|
22467
|
+
const failed = () => ({
|
|
22468
|
+
ok: false,
|
|
22469
|
+
definition: null,
|
|
22470
|
+
diagnostics,
|
|
22471
|
+
sourceFiles,
|
|
22472
|
+
skillFiles: [],
|
|
22473
|
+
manifest: null,
|
|
22474
|
+
fingerprint,
|
|
22475
|
+
mounts: fingerprints,
|
|
22476
|
+
ast: null
|
|
22477
|
+
});
|
|
22478
|
+
if (diagnostics.length > 0) {
|
|
22479
|
+
return failed();
|
|
22480
|
+
}
|
|
22481
|
+
const all = /* @__PURE__ */ new Map();
|
|
22482
|
+
for (const mount of prepared) {
|
|
22483
|
+
for (const [path, content] of mount.files) {
|
|
22484
|
+
all.set(`${mount.dir}/${path}`, content);
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
const fs2 = createMountFs(all, [
|
|
22488
|
+
MOUNTS_ROOT,
|
|
22489
|
+
...prepared.map((mount) => mount.dir)
|
|
22490
|
+
]);
|
|
22491
|
+
let workspace;
|
|
22492
|
+
try {
|
|
22493
|
+
workspace = buildWorkspaceResourceIndex({ cwd: MOUNTS_ROOT, fileSystem: fs2 });
|
|
22494
|
+
for (const mount of prepared) {
|
|
22495
|
+
const confined = confineTo(fs2, mount.dir);
|
|
22496
|
+
for (const path of collectSwirlsFiles({ cwd: mount.dir, fileSystem: confined })) {
|
|
22497
|
+
const fullPath = join7(mount.dir, path);
|
|
22498
|
+
const text = decodeUtf8(mount.files.get(path) ?? "");
|
|
22499
|
+
if (text === null) {
|
|
22500
|
+
error("parse", `"${path}" is not UTF-8 text`, { mount: mount.id, path });
|
|
22501
|
+
continue;
|
|
22502
|
+
}
|
|
22503
|
+
const parsed = parse(text);
|
|
22504
|
+
if (parsed.errors.length > 0) {
|
|
22505
|
+
for (const problem of parsed.errors) {
|
|
22506
|
+
error("parse", problem.message, { mount: mount.id, path, range: problem.range });
|
|
22507
|
+
}
|
|
22508
|
+
continue;
|
|
22509
|
+
}
|
|
22510
|
+
const found = [
|
|
22511
|
+
...validate(parsed.ast, { workspace, host: options.host }),
|
|
22512
|
+
...validateTsFileRefs(parsed.ast, {
|
|
22513
|
+
swirlsFilePath: fullPath,
|
|
22514
|
+
// A reference outside the mount is reported below, not as "not found".
|
|
22515
|
+
existsSync: (target) => !isWithin(mount.dir, target) || confined.existsSync(target)
|
|
22516
|
+
})
|
|
22517
|
+
];
|
|
22518
|
+
for (const diagnostic of found) {
|
|
22519
|
+
diagnostics.push({
|
|
22520
|
+
severity: diagnostic.severity === "warning" ? "warning" : "error",
|
|
22521
|
+
stage: "validate",
|
|
22522
|
+
message: diagnostic.message,
|
|
22523
|
+
mount: mount.id,
|
|
22524
|
+
path,
|
|
22525
|
+
range: diagnostic.range
|
|
22526
|
+
});
|
|
22527
|
+
}
|
|
22528
|
+
for (const { ref, range: range2 } of fileReferences(parsed.ast)) {
|
|
22529
|
+
if (!isWithin(mount.dir, resolveTsRefFullPath(fullPath, ref))) {
|
|
22530
|
+
error(
|
|
22531
|
+
"validate",
|
|
22532
|
+
`"${ref}" is outside this directory: a file may reference only files in its own mount`,
|
|
22533
|
+
{ mount: mount.id, path, range: range2 }
|
|
22534
|
+
);
|
|
22535
|
+
}
|
|
22536
|
+
}
|
|
22537
|
+
}
|
|
22538
|
+
}
|
|
22539
|
+
} catch (thrown) {
|
|
22540
|
+
error("validate", messageOf(thrown));
|
|
22541
|
+
return failed();
|
|
22542
|
+
}
|
|
22543
|
+
if (diagnostics.some((diagnostic) => diagnostic.severity === "error")) {
|
|
22544
|
+
return failed();
|
|
22545
|
+
}
|
|
22546
|
+
let merged;
|
|
22547
|
+
try {
|
|
22548
|
+
const result = mergeMounts(
|
|
22549
|
+
[...prepared].sort((a, b) => compareIds(a.id, b.id)).map((mount) => ({ id: mount.id, dir: mount.dir, fileSystem: confineTo(fs2, mount.dir) })),
|
|
22550
|
+
{ host: options.host, workspace }
|
|
22551
|
+
);
|
|
22552
|
+
for (const failure of result.fileErrors) {
|
|
22553
|
+
error("merge", failure.error.message, { mount: failure.mount, path: failure.path });
|
|
22554
|
+
}
|
|
22555
|
+
for (const duplicate of result.duplicates) {
|
|
22556
|
+
for (const site of duplicate.sites) {
|
|
22557
|
+
const others = duplicate.sites.filter((other) => other !== site);
|
|
22067
22558
|
diagnostics.push({
|
|
22068
22559
|
severity: "error",
|
|
22069
|
-
stage: "
|
|
22070
|
-
message:
|
|
22560
|
+
stage: "merge",
|
|
22561
|
+
message: `Duplicate ${duplicate.kind} name "${duplicate.name}": also declared in ${others.map((other) => describeSite(other, site.mount)).join(", ")}.`,
|
|
22562
|
+
mount: site.mount,
|
|
22563
|
+
path: site.path,
|
|
22564
|
+
...site.range !== void 0 ? { range: site.range } : {},
|
|
22565
|
+
related: others.map((other) => ({
|
|
22566
|
+
mount: other.mount,
|
|
22567
|
+
path: other.path,
|
|
22568
|
+
...other.range !== void 0 ? { range: other.range } : {}
|
|
22569
|
+
}))
|
|
22071
22570
|
});
|
|
22072
22571
|
}
|
|
22572
|
+
}
|
|
22573
|
+
if (new Set(result.versions.map((entry) => entry.version)).size > 1) {
|
|
22574
|
+
for (const entry of result.versions) {
|
|
22575
|
+
const others = result.versions.filter((other) => other.version !== entry.version);
|
|
22576
|
+
const byVersion = /* @__PURE__ */ new Map();
|
|
22577
|
+
for (const other of others) {
|
|
22578
|
+
byVersion.set(other.version, [
|
|
22579
|
+
...byVersion.get(other.version) ?? [],
|
|
22580
|
+
describeSite(other, entry.mount)
|
|
22581
|
+
]);
|
|
22582
|
+
}
|
|
22583
|
+
const rest = [...byVersion].map(
|
|
22584
|
+
([version, paths]) => `${paths.join(", ")} ${paths.length === 1 ? "declares" : "declare"} ${version}`
|
|
22585
|
+
).join("; ");
|
|
22586
|
+
diagnostics.push({
|
|
22587
|
+
severity: "error",
|
|
22588
|
+
stage: "merge",
|
|
22589
|
+
message: `declares version ${entry.version}, and ${rest}`,
|
|
22590
|
+
mount: entry.mount,
|
|
22591
|
+
path: entry.path,
|
|
22592
|
+
related: others.map((other) => ({ mount: other.mount, path: other.path }))
|
|
22593
|
+
});
|
|
22594
|
+
}
|
|
22595
|
+
}
|
|
22596
|
+
merged = result.merged;
|
|
22597
|
+
} catch (thrown) {
|
|
22598
|
+
error("merge", messageOf(thrown));
|
|
22599
|
+
return failed();
|
|
22600
|
+
}
|
|
22601
|
+
if (diagnostics.some((diagnostic) => diagnostic.severity === "error")) {
|
|
22602
|
+
return failed();
|
|
22603
|
+
}
|
|
22604
|
+
let definition;
|
|
22605
|
+
try {
|
|
22606
|
+
const built = buildDefinitionPayloadWithSites(merged, createSiteIds(options.newId));
|
|
22607
|
+
if (built.parseError) {
|
|
22608
|
+
for (const issue of built.parseError.issues) {
|
|
22609
|
+
const where = issue.path.map(String).join(".");
|
|
22610
|
+
error("definition", where === "" ? issue.message : `${where}: ${issue.message}`);
|
|
22611
|
+
}
|
|
22073
22612
|
return failed();
|
|
22074
22613
|
}
|
|
22075
22614
|
definition = built.definition;
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22615
|
+
} catch (thrown) {
|
|
22616
|
+
error("lower", messageOf(thrown));
|
|
22617
|
+
return failed();
|
|
22618
|
+
}
|
|
22619
|
+
const skillFiles = [];
|
|
22620
|
+
try {
|
|
22621
|
+
const byId = new Map(prepared.map((mount) => [mount.id, mount]));
|
|
22622
|
+
const seenBlocks = /* @__PURE__ */ new Set();
|
|
22623
|
+
for (const block of collectReferencedSkillBlocksFromAst(merged)) {
|
|
22624
|
+
if (seenBlocks.has(block.name)) {
|
|
22625
|
+
continue;
|
|
22626
|
+
}
|
|
22627
|
+
seenBlocks.add(block.name);
|
|
22628
|
+
const decl = merged.skill.find((skill) => skill.name === block.name);
|
|
22629
|
+
const mount = byId.get(block.sourceMount ?? "");
|
|
22630
|
+
const declPath = sourcePathOf(decl);
|
|
22631
|
+
const at = {
|
|
22632
|
+
...mount !== void 0 ? { mount: mount.id } : {},
|
|
22633
|
+
...declPath !== void 0 ? { path: declPath } : {},
|
|
22634
|
+
...decl?.range !== void 0 ? { range: decl.range } : {}
|
|
22635
|
+
};
|
|
22636
|
+
const skillName = block.skillName.trim();
|
|
22637
|
+
if (!skillName) {
|
|
22638
|
+
error("lower", `Skill block "${block.name}" requires a non-empty skill name`, at);
|
|
22639
|
+
continue;
|
|
22640
|
+
}
|
|
22641
|
+
if (mount === void 0) {
|
|
22642
|
+
error("lower", `Skill block "${block.name}" has no mount`, at);
|
|
22643
|
+
continue;
|
|
22644
|
+
}
|
|
22645
|
+
try {
|
|
22646
|
+
const files = resolveSkillTree(fs2, mount.dir, skillName, mount.skillsRoot);
|
|
22647
|
+
skillFiles.push({
|
|
22648
|
+
mount: mount.id,
|
|
22649
|
+
blockName: block.name,
|
|
22650
|
+
skillName,
|
|
22651
|
+
files: files.map((file) => ({
|
|
22652
|
+
path: file.path,
|
|
22653
|
+
contentBase64: base64(file.bytes),
|
|
22654
|
+
size: file.bytes.byteLength
|
|
22655
|
+
}))
|
|
22656
|
+
});
|
|
22657
|
+
} catch (thrown) {
|
|
22658
|
+
error("lower", messageOf(thrown), at);
|
|
22659
|
+
}
|
|
22660
|
+
}
|
|
22661
|
+
} catch (thrown) {
|
|
22662
|
+
error("lower", messageOf(thrown));
|
|
22663
|
+
}
|
|
22664
|
+
if (diagnostics.some((diagnostic) => diagnostic.severity === "error")) {
|
|
22665
|
+
return failed();
|
|
22666
|
+
}
|
|
22667
|
+
skillFiles.sort((a, b) => compareIds(a.blockName, b.blockName));
|
|
22668
|
+
let manifest;
|
|
22669
|
+
try {
|
|
22670
|
+
manifest = buildDeploymentSourceManifestV2({
|
|
22671
|
+
definition,
|
|
22672
|
+
ast: merged,
|
|
22673
|
+
mounts: fingerprints.map((mount) => ({
|
|
22674
|
+
id: mount.mount,
|
|
22675
|
+
sources: mount.sources,
|
|
22676
|
+
skills: mount.skills
|
|
22677
|
+
})),
|
|
22678
|
+
files: sourceFiles.map((file) => ({
|
|
22679
|
+
mount: file.mount,
|
|
22680
|
+
path: file.path,
|
|
22681
|
+
size: file.size,
|
|
22682
|
+
sha256: file.sha256
|
|
22683
|
+
})),
|
|
22684
|
+
fingerprint
|
|
22685
|
+
});
|
|
22686
|
+
} catch (thrown) {
|
|
22687
|
+
error("lower", messageOf(thrown));
|
|
22083
22688
|
return failed();
|
|
22084
22689
|
}
|
|
22085
22690
|
return {
|
|
@@ -22087,12 +22692,169 @@ function lowerSwirlsSources(files, options = {}) {
|
|
|
22087
22692
|
definition,
|
|
22088
22693
|
diagnostics,
|
|
22089
22694
|
sourceFiles,
|
|
22090
|
-
sourceFingerprint: computeDeploymentSourceFingerprint(sourceFiles),
|
|
22091
22695
|
skillFiles,
|
|
22696
|
+
manifest,
|
|
22697
|
+
fingerprint,
|
|
22698
|
+
mounts: fingerprints,
|
|
22092
22699
|
ast: merged
|
|
22093
22700
|
};
|
|
22094
22701
|
}
|
|
22095
22702
|
|
|
22703
|
+
// src/lower.ts
|
|
22704
|
+
var ONE_MOUNT = ".";
|
|
22705
|
+
function lowerSwirlsSources(files, options = {}) {
|
|
22706
|
+
const entries = files instanceof Map ? [...files] : Object.entries(files);
|
|
22707
|
+
const newId = options.newId;
|
|
22708
|
+
const result = lowerSwirlsMounts(
|
|
22709
|
+
[
|
|
22710
|
+
{
|
|
22711
|
+
id: ONE_MOUNT,
|
|
22712
|
+
files: new Map(
|
|
22713
|
+
entries.map(([path, content]) => [path.replace(/\\/g, "/").replace(/^\/+/, ""), content])
|
|
22714
|
+
)
|
|
22715
|
+
}
|
|
22716
|
+
],
|
|
22717
|
+
{
|
|
22718
|
+
host: options.host,
|
|
22719
|
+
newId: newId === void 0 ? void 0 : () => newId()
|
|
22720
|
+
}
|
|
22721
|
+
);
|
|
22722
|
+
const sourceFiles = result.sourceFiles.map(({ mount: _mount, ...file }) => file);
|
|
22723
|
+
return {
|
|
22724
|
+
ok: result.ok,
|
|
22725
|
+
definition: result.definition,
|
|
22726
|
+
diagnostics: result.diagnostics.map((diagnostic) => ({
|
|
22727
|
+
severity: diagnostic.severity,
|
|
22728
|
+
stage: diagnostic.stage,
|
|
22729
|
+
message: diagnostic.message,
|
|
22730
|
+
...diagnostic.path !== void 0 ? { path: diagnostic.path } : {},
|
|
22731
|
+
...diagnostic.range !== void 0 ? { range: diagnostic.range } : {},
|
|
22732
|
+
...diagnostic.related !== void 0 ? {
|
|
22733
|
+
related: diagnostic.related.map((site) => ({
|
|
22734
|
+
path: site.path,
|
|
22735
|
+
...site.range !== void 0 ? { range: site.range } : {}
|
|
22736
|
+
}))
|
|
22737
|
+
} : {}
|
|
22738
|
+
})),
|
|
22739
|
+
sourceFiles,
|
|
22740
|
+
sourceFingerprint: computeDeploymentSourceFingerprint(sourceFiles),
|
|
22741
|
+
skillFiles: result.skillFiles.map(({ mount: _mount, ...bundle }) => bundle).sort((a, b) => a.skillName.localeCompare(b.skillName)),
|
|
22742
|
+
ast: result.ast
|
|
22743
|
+
};
|
|
22744
|
+
}
|
|
22745
|
+
|
|
22746
|
+
// src/memory-repo-fs.ts
|
|
22747
|
+
function createMemoryRepoFs(files, virtualRoot) {
|
|
22748
|
+
const root = virtualRoot.replace(/\/$/, "") || "/repo";
|
|
22749
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
22750
|
+
for (const [k, v] of files) {
|
|
22751
|
+
const key = k.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
22752
|
+
normalized.set(key, v);
|
|
22753
|
+
}
|
|
22754
|
+
function toRel(absPath) {
|
|
22755
|
+
const a = absPath.replace(/\\/g, "/");
|
|
22756
|
+
const r = root;
|
|
22757
|
+
if (a === r) {
|
|
22758
|
+
return "";
|
|
22759
|
+
}
|
|
22760
|
+
const prefix = `${r}/`;
|
|
22761
|
+
if (!a.startsWith(prefix)) {
|
|
22762
|
+
throw new Error(`Path outside virtual root: ${absPath}`);
|
|
22763
|
+
}
|
|
22764
|
+
return a.slice(prefix.length);
|
|
22765
|
+
}
|
|
22766
|
+
return {
|
|
22767
|
+
readdirSync(absDir, _options) {
|
|
22768
|
+
const relDir = toRel(absDir);
|
|
22769
|
+
const prefix = relDir === "" ? "" : `${relDir}/`;
|
|
22770
|
+
const names = /* @__PURE__ */ new Set();
|
|
22771
|
+
for (const key of normalized.keys()) {
|
|
22772
|
+
if (relDir !== "" && !key.startsWith(prefix)) {
|
|
22773
|
+
continue;
|
|
22774
|
+
}
|
|
22775
|
+
if (relDir !== "" && key === relDir) {
|
|
22776
|
+
continue;
|
|
22777
|
+
}
|
|
22778
|
+
const rest = relDir === "" ? key : key.slice(prefix.length);
|
|
22779
|
+
const slash = rest.indexOf("/");
|
|
22780
|
+
if (slash === -1) {
|
|
22781
|
+
names.add(rest);
|
|
22782
|
+
} else {
|
|
22783
|
+
names.add(rest.slice(0, slash));
|
|
22784
|
+
}
|
|
22785
|
+
}
|
|
22786
|
+
return [...names].sort().map((name) => {
|
|
22787
|
+
const childRel = relDir === "" ? name : `${relDir}/${name}`;
|
|
22788
|
+
const isDir = [...normalized.keys()].some(
|
|
22789
|
+
(k) => k === childRel || k.startsWith(`${childRel}/`)
|
|
22790
|
+
);
|
|
22791
|
+
const isFile = normalized.has(childRel);
|
|
22792
|
+
return {
|
|
22793
|
+
name,
|
|
22794
|
+
isDirectory: () => isDir && !isFile,
|
|
22795
|
+
isFile: () => isFile
|
|
22796
|
+
};
|
|
22797
|
+
});
|
|
22798
|
+
},
|
|
22799
|
+
readFileSync(absPath, _encoding) {
|
|
22800
|
+
const rel = toRel(absPath);
|
|
22801
|
+
const content = normalized.get(rel);
|
|
22802
|
+
if (content === void 0) {
|
|
22803
|
+
throw new Error(`ENOENT: ${absPath}`);
|
|
22804
|
+
}
|
|
22805
|
+
return content;
|
|
22806
|
+
}
|
|
22807
|
+
};
|
|
22808
|
+
}
|
|
22809
|
+
function flattenArchivePathMap(paths) {
|
|
22810
|
+
if (paths.size === 0) {
|
|
22811
|
+
return paths;
|
|
22812
|
+
}
|
|
22813
|
+
const firstKeys = [...paths.keys()].map((k) => k.replace(/\\/g, "/"));
|
|
22814
|
+
const segments = firstKeys.map((k) => k.split("/").filter(Boolean));
|
|
22815
|
+
if (segments.length === 0 || segments[0]?.length === 0) {
|
|
22816
|
+
return paths;
|
|
22817
|
+
}
|
|
22818
|
+
const firstSeg = segments[0]?.[0];
|
|
22819
|
+
const allShare = firstSeg && segments.every((s) => s.length > 0 && s[0] === firstSeg);
|
|
22820
|
+
if (!allShare) {
|
|
22821
|
+
return paths;
|
|
22822
|
+
}
|
|
22823
|
+
const prefix = `${firstSeg}/`;
|
|
22824
|
+
const out = /* @__PURE__ */ new Map();
|
|
22825
|
+
for (const [k, v] of paths) {
|
|
22826
|
+
const nk = k.replace(/\\/g, "/");
|
|
22827
|
+
if (!nk.startsWith(prefix)) {
|
|
22828
|
+
return paths;
|
|
22829
|
+
}
|
|
22830
|
+
out.set(nk.slice(prefix.length), v);
|
|
22831
|
+
}
|
|
22832
|
+
return out;
|
|
22833
|
+
}
|
|
22834
|
+
function virtualRepoCwd(virtualRoot) {
|
|
22835
|
+
return virtualRoot.replace(/\/$/, "") || "/repo";
|
|
22836
|
+
}
|
|
22837
|
+
function sliceRepoFilesToRoot(files, rootPath) {
|
|
22838
|
+
const seg = rootPath.replace(/^\/+|\/+$/g, "").replace(/\\/g, "/");
|
|
22839
|
+
if (!seg) {
|
|
22840
|
+
return files;
|
|
22841
|
+
}
|
|
22842
|
+
const prefix = `${seg}/`;
|
|
22843
|
+
const out = /* @__PURE__ */ new Map();
|
|
22844
|
+
for (const [k, v] of files) {
|
|
22845
|
+
const n = k.replace(/\\/g, "/");
|
|
22846
|
+
if (n.startsWith(prefix)) {
|
|
22847
|
+
out.set(n.slice(prefix.length), v);
|
|
22848
|
+
} else if (n === seg) {
|
|
22849
|
+
const base = seg.split("/").pop();
|
|
22850
|
+
if (base) {
|
|
22851
|
+
out.set(base, v);
|
|
22852
|
+
}
|
|
22853
|
+
}
|
|
22854
|
+
}
|
|
22855
|
+
return out;
|
|
22856
|
+
}
|
|
22857
|
+
|
|
22096
22858
|
// src/node-fs.ts
|
|
22097
22859
|
function createNodeDeployBundleFs(nodeFs) {
|
|
22098
22860
|
return {
|
|
@@ -22174,6 +22936,33 @@ function parseSkillMdFrontmatter(input) {
|
|
|
22174
22936
|
}
|
|
22175
22937
|
return parseFrontmatterText(match[1]);
|
|
22176
22938
|
}
|
|
22939
|
+
|
|
22940
|
+
// src/skills/skill-fs.ts
|
|
22941
|
+
function deployBundleToSkillDeployFs(fs2) {
|
|
22942
|
+
return {
|
|
22943
|
+
readdirSync: fs2.readdirSync.bind(fs2),
|
|
22944
|
+
readFileSync: fs2.readFileSync.bind(fs2),
|
|
22945
|
+
readFileBuffer(absPath) {
|
|
22946
|
+
return utf8Bytes(fs2.readFileSync(absPath, "utf-8"));
|
|
22947
|
+
},
|
|
22948
|
+
lstatSync(absPath) {
|
|
22949
|
+
let isFile = false;
|
|
22950
|
+
let isDirectory = false;
|
|
22951
|
+
try {
|
|
22952
|
+
fs2.readFileSync(absPath, "utf-8");
|
|
22953
|
+
isFile = true;
|
|
22954
|
+
} catch {
|
|
22955
|
+
isDirectory = true;
|
|
22956
|
+
}
|
|
22957
|
+
return {
|
|
22958
|
+
isSymbolicLink: false,
|
|
22959
|
+
isFile,
|
|
22960
|
+
isDirectory,
|
|
22961
|
+
mode: isFile ? 420 : 493
|
|
22962
|
+
};
|
|
22963
|
+
}
|
|
22964
|
+
};
|
|
22965
|
+
}
|
|
22177
22966
|
export {
|
|
22178
22967
|
AGENTS_SKILLS_DIR,
|
|
22179
22968
|
COMPUTER_BASELINE_KIT,
|
|
@@ -22190,6 +22979,7 @@ export {
|
|
|
22190
22979
|
MAX_SKILL_FILES,
|
|
22191
22980
|
MAX_SKILL_FILE_BYTES,
|
|
22192
22981
|
MAX_SKILL_TREE_BYTES,
|
|
22982
|
+
MOUNT_SKILLS_ROOT,
|
|
22193
22983
|
SKILL_MD_FILENAME,
|
|
22194
22984
|
buildConfigValueKindsFromNodeDecl,
|
|
22195
22985
|
buildDeploymentDefinitionPayload,
|
|
@@ -22215,6 +23005,7 @@ export {
|
|
|
22215
23005
|
daytonaSnapshotResources,
|
|
22216
23006
|
deployBundleToSkillDeployFs,
|
|
22217
23007
|
deployBundleToWorkspaceFileSystem,
|
|
23008
|
+
deploymentSourceManifestV2Schema,
|
|
22218
23009
|
flattenArchivePathMap,
|
|
22219
23010
|
flattenInlineSubgraphsInGraph,
|
|
22220
23011
|
floxManifestToml,
|
|
@@ -22223,11 +23014,13 @@ export {
|
|
|
22223
23014
|
isHarnessProvider,
|
|
22224
23015
|
isKnownScriptExtension,
|
|
22225
23016
|
isScriptsOrBinDirectory,
|
|
23017
|
+
lowerSwirlsMounts,
|
|
22226
23018
|
lowerSwirlsSources,
|
|
22227
23019
|
mergeProjectSwirlsFiles,
|
|
22228
23020
|
normalizeDeploymentSourcePath,
|
|
22229
23021
|
operationScriptSha256,
|
|
22230
23022
|
parseDeploymentDefinition,
|
|
23023
|
+
parseDeploymentSourceManifestV2,
|
|
22231
23024
|
parseSkillMdFrontmatter,
|
|
22232
23025
|
platformComputerSnapshotName,
|
|
22233
23026
|
recipePackages,
|