@desplega.ai/agent-swarm 1.119.1 → 1.119.3
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 +3 -0
- package/dist/{actions-d6rvh4xw.js → actions-kd321p1j.js} +7 -7
- package/dist/{app-2t2t6qtm.js → app-p1gqacgd.js} +3 -3
- package/dist/{assistant-kb23g109.js → assistant-6w0zb089.js} +10 -10
- package/dist/{boot-reembed-t2ct62pw.js → boot-reembed-7gy85nnp.js} +3 -3
- package/dist/{boot-reembed-gjatq261.js → boot-reembed-zktmj8zt.js} +4 -4
- package/dist/{boot-scrub-logs-vwvpxk23.js → boot-scrub-logs-d8n8pcgr.js} +2 -2
- package/dist/{cli-wmep6bjt.js → cli-3sew4a9j.js} +1 -1
- package/dist/{cli-gq1ss3yf.js → cli-527y7yzc.js} +3 -3
- package/dist/{cli-bwkxh7pa.js → cli-6expbmb3.js} +1 -1
- package/dist/{cli-2teefgw6.js → cli-7yfmb4ne.js} +1 -1
- package/dist/{cli-p750jfs0.js → cli-8y1kmyn7.js} +2 -2
- package/dist/cli-95kferzh.js +439 -0
- package/dist/{cli-2dsbab02.js → cli-9aqtt1dn.js} +7 -7
- package/dist/{cli-q8bgrc7c.js → cli-9y4z25ke.js} +1 -1
- package/dist/{cli-6j7ftsbs.js → cli-cx30v78p.js} +1 -1
- package/dist/{cli-wh91zby6.js → cli-dh9eb7tt.js} +6 -6
- package/dist/{cli-gpyx6t1w.js → cli-e5hdn9nx.js} +1 -1
- package/dist/{cli-34194d2q.js → cli-eb3s7zwh.js} +37 -35
- package/dist/{cli-wt7b0vr9.js → cli-emgzr4ja.js} +5 -5
- package/dist/{cli-9b5m9d9v.js → cli-g5a31r9y.js} +22 -3
- package/dist/{cli-1q7q8zws.js → cli-get7n46a.js} +1 -1
- package/dist/{cli-3hqj0r0f.js → cli-gzng1fst.js} +2 -2
- package/dist/{cli-e7306swv.js → cli-hcpm1e90.js} +6 -6
- package/dist/{cli-yk38sbmz.js → cli-j2vpt4hd.js} +11 -11
- package/dist/{cli-zyjvbdgq.js → cli-j5da6jb2.js} +12 -12
- package/dist/{cli-xjb2jg7b.js → cli-j6n9at34.js} +2 -2
- package/dist/{cli-gq46dx9q.js → cli-p4yn675m.js} +1 -1
- package/dist/{cli-226nz7j1.js → cli-td2x0s9b.js} +1 -1
- package/dist/{cli-5fb5rv64.js → cli-xgefj1nz.js} +2 -2
- package/dist/{cli-6637ryhr.js → cli-y82m27mq.js} +1 -1
- package/dist/{cli-03hw3tdq.js → cli-yzxg93ma.js} +4 -4
- package/dist/{cli-gat4kjhe.js → cli-z612d1nc.js} +1 -1
- package/dist/cli.js +13 -13
- package/dist/{codex-adapter-de3w0nch.js → codex-adapter-efskwfc4.js} +4 -4
- package/dist/{codex-session-runner-bnw8cysk.js → codex-session-runner-n7ad0jdv.js} +4 -4
- package/dist/{commands-sar3k5f6.js → commands-14gkjns3.js} +2 -2
- package/dist/{db-93qmw47d.js → db-c9wx8pbf.js} +2 -2
- package/dist/{handlers-4q6rrpg6.js → handlers-m9jxp50r.js} +10 -10
- package/dist/{hook-r6j7pb72.js → hook-mm8mj3cp.js} +3 -3
- package/dist/{http-yr4md33c.js → http-hhmh7m51.js} +101 -495
- package/dist/{index-snekxj7z.js → index-9h6qre5v.js} +6 -6
- package/dist/{index-afc5zk9k.js → index-basky7qw.js} +10 -10
- package/dist/{index-4zpkrw7q.js → index-ep25fyer.js} +9 -9
- package/dist/{index-wk5gsfqy.js → index-vmcp507g.js} +8 -8
- package/dist/{keepalive-wp8xyhnb.js → keepalive-70mwsyhb.js} +4 -4
- package/dist/{lead-5x0j5wxz.js → lead-pshn5w58.js} +25 -25
- package/dist/{maintenance-yx9pwy8a.js → maintenance-rbjav7ey.js} +4 -4
- package/dist/{oauth-refresh-sweep-yb4scdc0.js → oauth-refresh-sweep-dfbd7yw0.js} +3 -3
- package/dist/{onboard-f27pqdmq.js → onboard-g8911158.js} +2 -2
- package/dist/{otel-impl-z3cdybex.js → otel-impl-qw4pakj6.js} +1 -1
- package/dist/{pi-mono-adapter-05sck1ds.js → pi-mono-adapter-erghwha0.js} +7 -7
- package/dist/{pricing-refresh-0d0877ex.js → pricing-refresh-7ra0g3az.js} +4 -4
- package/dist/{rbac-roles-fya9jda4.js → rbac-roles-ksnmkjzf.js} +2 -2
- package/dist/{rbac-roles-s1kpmgrb.js → rbac-roles-s0esm5k6.js} +3 -3
- package/dist/registry-wejfsj31.js +13 -0
- package/dist/{seed-pricing-n6weaf7s.js → seed-pricing-jd8zj8k7.js} +3 -3
- package/dist/{setup-64291zb4.js → setup-z2s4vqf3.js} +2 -2
- package/dist/{worker-2v01h42e.js → worker-xse3rpzd.js} +25 -25
- package/openapi.json +53 -1
- package/package.json +1 -1
- package/src/be/seed/agent-fs-provision.ts +41 -1
- package/src/fs/registry.ts +13 -1
- package/src/http/core.ts +8 -0
- package/src/http/fs.ts +41 -1
- package/src/tests/agent-fs-provision-seeder.test.ts +40 -0
- package/src/tests/preload.ts +21 -0
- package/src/tests/prompt-template-resolver.test.ts +6 -0
- package/src/tests/prompt-template-session.test.ts +6 -0
- package/src/tests/template-registry-helpers.ts +29 -0
- package/dist/{azure-openai-responses-gm1ejtmn.js → azure-openai-responses-f57n5qy7.js} +4 -4
- package/dist/{claude-managed-setup-cm05wtek.js → claude-managed-setup-eac00cqn.js} +1 -1
- package/dist/{cli-6b4wwmm8.js → cli-0qy7bk86.js} +3 -3
- package/dist/{google-vertex-8bs2pzgn.js → google-vertex-9hhq68sw.js} +3 -3
- package/dist/{mistral-conversations-7gqnz2wt.js → mistral-conversations-tn4sj5qv.js} +3 -3
- package/dist/{openai-codex-responses-3nkvje79.js → openai-codex-responses-bex0bpn6.js} +2 -2
- package/dist/{openai-completions-0asftkwg.js → openai-completions-gygw5cxt.js} +8 -8
- package/dist/{openai-responses-pmatek45.js → openai-responses-8c0dgmty.js} +7 -7
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
// src/fs/provider.ts
|
|
2
|
+
class FilesError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
status;
|
|
5
|
+
cause;
|
|
6
|
+
constructor(code, message, opts = {}) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "FilesError";
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.status = opts.status;
|
|
11
|
+
this.cause = opts.cause;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function providerPath(scope) {
|
|
15
|
+
if (scope.key !== undefined && scope.key !== null && scope.key !== "") {
|
|
16
|
+
return normalizeStoredKey(scope.key);
|
|
17
|
+
}
|
|
18
|
+
const safeName = normalizeName(scope.name);
|
|
19
|
+
return `tasks/${encodeURIComponent(scope.taskId)}/${safeName}`;
|
|
20
|
+
}
|
|
21
|
+
function normalizeStoredKey(key) {
|
|
22
|
+
const trimmed = key.trim().replace(/^\/+/, "");
|
|
23
|
+
if (!trimmed || trimmed.includes("\x00")) {
|
|
24
|
+
throw new FilesError("Provider", "Stored file key must be a non-empty path");
|
|
25
|
+
}
|
|
26
|
+
if (trimmed.split("/").some((part) => part === "..")) {
|
|
27
|
+
throw new FilesError("Provider", "Stored file key must not contain parent path segments");
|
|
28
|
+
}
|
|
29
|
+
return trimmed;
|
|
30
|
+
}
|
|
31
|
+
function normalizeName(name) {
|
|
32
|
+
const trimmed = name.trim().replace(/^\/+/, "");
|
|
33
|
+
if (!trimmed || trimmed === "." || trimmed.includes("\x00")) {
|
|
34
|
+
throw new FilesError("Provider", "File name must be a non-empty relative path");
|
|
35
|
+
}
|
|
36
|
+
const parts = trimmed.split("/");
|
|
37
|
+
if (parts.some((part) => !part || part === "." || part === "..")) {
|
|
38
|
+
throw new FilesError("Provider", "File name must not contain empty or parent path segments");
|
|
39
|
+
}
|
|
40
|
+
return parts.map(encodeURIComponent).join("/");
|
|
41
|
+
}
|
|
42
|
+
function fileObjectFromHeaders(providerId, scope, headers, overrides = {}) {
|
|
43
|
+
const sizeHeader = headers.get("content-length");
|
|
44
|
+
return {
|
|
45
|
+
providerId,
|
|
46
|
+
key: providerPath(scope),
|
|
47
|
+
taskId: scope.taskId,
|
|
48
|
+
name: scope.name,
|
|
49
|
+
contentType: headers.get("content-type") ?? undefined,
|
|
50
|
+
sizeBytes: sizeHeader ? Number(sizeHeader) : undefined,
|
|
51
|
+
etag: headers.get("etag") ?? undefined,
|
|
52
|
+
sha256: headers.get("x-agent-fs-content-hash") ?? undefined,
|
|
53
|
+
version: headers.get("x-agent-fs-version") ?? undefined,
|
|
54
|
+
...overrides
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function normalizeFilesError(error) {
|
|
58
|
+
if (error instanceof FilesError) {
|
|
59
|
+
return error;
|
|
60
|
+
}
|
|
61
|
+
return new FilesError("Provider", error instanceof Error ? error.message : "File provider error", {
|
|
62
|
+
cause: error
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/fs/agent-fs-provider.ts
|
|
67
|
+
class AgentFsProvider {
|
|
68
|
+
id = "agent-fs";
|
|
69
|
+
capabilities = {
|
|
70
|
+
signedUrl: { supported: true, maxExpiresIn: 3600 },
|
|
71
|
+
search: true,
|
|
72
|
+
comments: true,
|
|
73
|
+
versioning: true
|
|
74
|
+
};
|
|
75
|
+
apiUrl;
|
|
76
|
+
apiKey;
|
|
77
|
+
orgId;
|
|
78
|
+
driveId;
|
|
79
|
+
fetchImpl;
|
|
80
|
+
constructor(options = {}) {
|
|
81
|
+
this.apiUrl = stripTrailingSlash(options.apiUrl ?? process.env.AGENT_FS_API_URL ?? "");
|
|
82
|
+
this.apiKey = options.apiKey ?? process.env.API_AGENT_FS_API_KEY ?? process.env.AGENT_FS_API_KEY ?? "";
|
|
83
|
+
this.orgId = options.orgId ?? process.env.AGENT_FS_DEFAULT_ORG_ID ?? process.env.AGENT_FS_SHARED_ORG_ID ?? "";
|
|
84
|
+
this.driveId = options.driveId ?? process.env.AGENT_FS_DEFAULT_DRIVE_ID ?? "";
|
|
85
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
86
|
+
if (!this.apiUrl || !this.apiKey || !this.orgId || !this.driveId) {
|
|
87
|
+
throw new FilesError("Provider", "AGENT_FS_API_URL, API_AGENT_FS_API_KEY or AGENT_FS_API_KEY, AGENT_FS_DEFAULT_ORG_ID, and AGENT_FS_DEFAULT_DRIVE_ID are required for the agent-fs provider");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async upload(scope, body, options = {}) {
|
|
91
|
+
const headers = new Headers(this.authHeaders());
|
|
92
|
+
if (options.contentType) {
|
|
93
|
+
headers.set("content-type", options.contentType);
|
|
94
|
+
}
|
|
95
|
+
if (options.ifNoneMatch) {
|
|
96
|
+
headers.set("if-none-match", options.ifNoneMatch);
|
|
97
|
+
}
|
|
98
|
+
if (options.ifMatch) {
|
|
99
|
+
headers.set("if-match", options.ifMatch);
|
|
100
|
+
}
|
|
101
|
+
if (options.message) {
|
|
102
|
+
headers.set("x-agent-fs-message", options.message);
|
|
103
|
+
}
|
|
104
|
+
const response = await this.fetchRaw(scope, { method: "PUT", headers, body });
|
|
105
|
+
const parsed = await response.json().catch(() => ({}));
|
|
106
|
+
return fileObjectFromHeaders(this.id, scope, response.headers, {
|
|
107
|
+
key: parsed.path ?? providerPath(scope),
|
|
108
|
+
version: parsed.version === undefined ? response.headers.get("x-agent-fs-version") ?? undefined : String(parsed.version),
|
|
109
|
+
sha256: parsed.contentHash ?? response.headers.get("x-agent-fs-content-hash") ?? undefined,
|
|
110
|
+
metadata: { deduped: parsed.deduped }
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async download(scope) {
|
|
114
|
+
return this.fetchRaw(scope, { method: "GET", headers: this.authHeaders() });
|
|
115
|
+
}
|
|
116
|
+
async head(scope) {
|
|
117
|
+
const response = await this.download(scope);
|
|
118
|
+
await response.body?.cancel();
|
|
119
|
+
return fileObjectFromHeaders(this.id, scope, response.headers);
|
|
120
|
+
}
|
|
121
|
+
async exists(scope) {
|
|
122
|
+
try {
|
|
123
|
+
await this.head(scope);
|
|
124
|
+
return true;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof FilesError && error.code === "NotFound") {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async delete(scope) {
|
|
133
|
+
await this.ops({ op: "rm", path: providerPath(scope) }, scope);
|
|
134
|
+
}
|
|
135
|
+
async copy(source, destination) {
|
|
136
|
+
await this.ops({ op: "cp", path: providerPath(source), dest: providerPath(destination) });
|
|
137
|
+
return this.head(destination);
|
|
138
|
+
}
|
|
139
|
+
async move(source, destination) {
|
|
140
|
+
await this.ops({ op: "mv", path: providerPath(source), dest: providerPath(destination) });
|
|
141
|
+
return this.head(destination);
|
|
142
|
+
}
|
|
143
|
+
async list(options) {
|
|
144
|
+
const prefix = `tasks/${encodeURIComponent(options.taskId)}/${options.prefix ?? ""}`;
|
|
145
|
+
const result = await this.ops({ op: "ls", path: prefix });
|
|
146
|
+
const resultRecord = asRecord(result);
|
|
147
|
+
const entries = Array.isArray(result) ? result : Array.isArray(resultRecord?.entries) ? resultRecord.entries : [];
|
|
148
|
+
return entries.slice(0, options.limit).map((entry) => {
|
|
149
|
+
const key = String(entry.path ?? entry.name ?? "");
|
|
150
|
+
const name = key.startsWith(`tasks/${encodeURIComponent(options.taskId)}/`) ? key.slice(`tasks/${encodeURIComponent(options.taskId)}/`.length) : key;
|
|
151
|
+
return {
|
|
152
|
+
providerId: this.id,
|
|
153
|
+
key,
|
|
154
|
+
taskId: options.taskId,
|
|
155
|
+
name: decodeURIComponent(name),
|
|
156
|
+
contentType: typeof entry.mimeType === "string" ? entry.mimeType : undefined,
|
|
157
|
+
sizeBytes: typeof entry.size === "number" ? entry.size : undefined,
|
|
158
|
+
version: entry.version === undefined ? undefined : String(entry.version)
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async* listAll(options) {
|
|
163
|
+
for (const item of await this.list(options)) {
|
|
164
|
+
yield item;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async url(scope, options = {}) {
|
|
168
|
+
const expiresIn = Math.min(options.expiresIn ?? 3600, this.capabilities.signedUrl.maxExpiresIn);
|
|
169
|
+
const result = await this.ops({ op: "signed-url", path: providerPath(scope), expiresIn }, scope);
|
|
170
|
+
if (typeof result === "string") {
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
const resultRecord = asRecord(result);
|
|
174
|
+
if (typeof resultRecord?.url === "string") {
|
|
175
|
+
return resultRecord.url;
|
|
176
|
+
}
|
|
177
|
+
throw new FilesError("Provider", "agent-fs signed-url op did not return a URL");
|
|
178
|
+
}
|
|
179
|
+
async signedUploadUrl() {
|
|
180
|
+
throw new FilesError("ReadOnly", "agent-fs does not support signed upload URLs");
|
|
181
|
+
}
|
|
182
|
+
async search(query) {
|
|
183
|
+
const result = await this.ops({
|
|
184
|
+
op: "search",
|
|
185
|
+
query: query.query,
|
|
186
|
+
path: `tasks/${encodeURIComponent(query.taskId)}`,
|
|
187
|
+
limit: query.limit
|
|
188
|
+
});
|
|
189
|
+
return Array.isArray(result) ? result : [];
|
|
190
|
+
}
|
|
191
|
+
async addComment(input) {
|
|
192
|
+
return await this.ops({
|
|
193
|
+
op: "comment-add",
|
|
194
|
+
path: providerPath(input),
|
|
195
|
+
body: input.body,
|
|
196
|
+
range: input.range
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
async listComments(scope) {
|
|
200
|
+
const result = await this.ops({ op: "comment-list", path: providerPath(scope) });
|
|
201
|
+
return Array.isArray(result) ? result : [];
|
|
202
|
+
}
|
|
203
|
+
async listVersions(scope) {
|
|
204
|
+
const result = await this.ops({ op: "log", path: providerPath(scope) });
|
|
205
|
+
return Array.isArray(result) ? result : [];
|
|
206
|
+
}
|
|
207
|
+
async restoreVersion(scope) {
|
|
208
|
+
return await this.ops({
|
|
209
|
+
op: "revert",
|
|
210
|
+
path: providerPath(scope),
|
|
211
|
+
version: scope.version
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async fetchRaw(scope, init) {
|
|
215
|
+
const response = await this.fetchImpl(this.rawUrl(scope), init);
|
|
216
|
+
if (!response.ok) {
|
|
217
|
+
throw await responseToFilesError(response);
|
|
218
|
+
}
|
|
219
|
+
return response;
|
|
220
|
+
}
|
|
221
|
+
async ops(body, scope) {
|
|
222
|
+
const response = await this.fetchImpl(`${this.apiUrl}/orgs/${encodeURIComponent(this.orgFor(scope))}/ops`, {
|
|
223
|
+
method: "POST",
|
|
224
|
+
headers: {
|
|
225
|
+
...this.authHeaders(),
|
|
226
|
+
"content-type": "application/json"
|
|
227
|
+
},
|
|
228
|
+
body: JSON.stringify({ driveId: this.driveFor(scope), ...body })
|
|
229
|
+
});
|
|
230
|
+
if (!response.ok) {
|
|
231
|
+
throw await responseToFilesError(response);
|
|
232
|
+
}
|
|
233
|
+
return response.json().catch(() => null);
|
|
234
|
+
}
|
|
235
|
+
rawUrl(scope) {
|
|
236
|
+
return `${this.apiUrl}/orgs/${encodeURIComponent(this.orgFor(scope))}/drives/${encodeURIComponent(this.driveFor(scope))}/files/${providerPath(scope)}/raw`;
|
|
237
|
+
}
|
|
238
|
+
orgFor(scope) {
|
|
239
|
+
return scope?.orgId?.trim() || this.orgId;
|
|
240
|
+
}
|
|
241
|
+
driveFor(scope) {
|
|
242
|
+
return scope?.driveId?.trim() || this.driveId;
|
|
243
|
+
}
|
|
244
|
+
authHeaders() {
|
|
245
|
+
return { authorization: `Bearer ${this.apiKey}` };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function asRecord(value) {
|
|
249
|
+
return value && typeof value === "object" ? value : null;
|
|
250
|
+
}
|
|
251
|
+
async function responseToFilesError(response) {
|
|
252
|
+
const text = await response.text().catch(() => "");
|
|
253
|
+
const message = text || `File provider returned HTTP ${response.status}`;
|
|
254
|
+
if (response.status === 401 || response.status === 403) {
|
|
255
|
+
return new FilesError("Unauthorized", message, { status: response.status });
|
|
256
|
+
}
|
|
257
|
+
if (response.status === 404) {
|
|
258
|
+
return new FilesError("NotFound", message, { status: response.status });
|
|
259
|
+
}
|
|
260
|
+
if (response.status === 409 || response.status === 412) {
|
|
261
|
+
return new FilesError("Conflict", message, { status: response.status });
|
|
262
|
+
}
|
|
263
|
+
return new FilesError("Provider", message, { status: response.status });
|
|
264
|
+
}
|
|
265
|
+
function stripTrailingSlash(value) {
|
|
266
|
+
return value.replace(/\/+$/, "");
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/fs/local-fs-provider.ts
|
|
270
|
+
import { mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
271
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
272
|
+
var DEFAULT_ROOT_DIR = "./data/fs";
|
|
273
|
+
|
|
274
|
+
class LocalFsProvider {
|
|
275
|
+
id = "local-fs";
|
|
276
|
+
capabilities = {
|
|
277
|
+
signedUrl: { supported: false }
|
|
278
|
+
};
|
|
279
|
+
rootDir;
|
|
280
|
+
constructor(options = {}) {
|
|
281
|
+
this.rootDir = options.rootDir ?? process.env.AGENT_FS_LOCAL_DIR ?? DEFAULT_ROOT_DIR;
|
|
282
|
+
}
|
|
283
|
+
async upload(scope, body, options = {}) {
|
|
284
|
+
const target = this.localPath(scope);
|
|
285
|
+
await mkdir(dirname(target), { recursive: true });
|
|
286
|
+
if (options.ifNoneMatch === "*" && await this.exists(scope)) {
|
|
287
|
+
throw new FilesError("Conflict", "File already exists");
|
|
288
|
+
}
|
|
289
|
+
await Bun.write(target, await new Response(body).arrayBuffer());
|
|
290
|
+
if (options.contentType) {
|
|
291
|
+
await Bun.write(this.metaPath(target), JSON.stringify({ contentType: options.contentType }));
|
|
292
|
+
}
|
|
293
|
+
return this.head(scope);
|
|
294
|
+
}
|
|
295
|
+
async download(scope) {
|
|
296
|
+
const target = this.localPath(scope);
|
|
297
|
+
if (!await this.exists(scope)) {
|
|
298
|
+
throw new FilesError("NotFound", "File not found");
|
|
299
|
+
}
|
|
300
|
+
return new Response(Bun.file(target));
|
|
301
|
+
}
|
|
302
|
+
async head(scope) {
|
|
303
|
+
const target = this.localPath(scope);
|
|
304
|
+
try {
|
|
305
|
+
const info = await stat(target);
|
|
306
|
+
const storedContentType = await this.readStoredContentType(target);
|
|
307
|
+
return {
|
|
308
|
+
providerId: this.id,
|
|
309
|
+
key: providerPath(scope),
|
|
310
|
+
taskId: scope.taskId,
|
|
311
|
+
name: scope.name,
|
|
312
|
+
contentType: storedContentType ?? Bun.file(target).type ?? undefined,
|
|
313
|
+
sizeBytes: info.size,
|
|
314
|
+
updatedAt: info.mtime.toISOString()
|
|
315
|
+
};
|
|
316
|
+
} catch (error) {
|
|
317
|
+
if (error.code === "ENOENT") {
|
|
318
|
+
throw new FilesError("NotFound", "File not found", { cause: error });
|
|
319
|
+
}
|
|
320
|
+
throw new FilesError("Provider", "Unable to read file metadata", { cause: error });
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
async exists(scope) {
|
|
324
|
+
try {
|
|
325
|
+
await stat(this.localPath(scope));
|
|
326
|
+
return true;
|
|
327
|
+
} catch (error) {
|
|
328
|
+
if (error.code === "ENOENT") {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
throw new FilesError("Provider", "Unable to check file existence", { cause: error });
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async delete(scope) {
|
|
335
|
+
const target = this.localPath(scope);
|
|
336
|
+
await rm(target, { force: true });
|
|
337
|
+
await rm(this.metaPath(target), { force: true });
|
|
338
|
+
}
|
|
339
|
+
async copy(source, destination) {
|
|
340
|
+
const sourceHead = await this.head(source);
|
|
341
|
+
const response = await this.download(source);
|
|
342
|
+
await this.upload(destination, await response.arrayBuffer(), {
|
|
343
|
+
contentType: sourceHead.contentType
|
|
344
|
+
});
|
|
345
|
+
return this.head(destination);
|
|
346
|
+
}
|
|
347
|
+
async move(source, destination) {
|
|
348
|
+
const copied = await this.copy(source, destination);
|
|
349
|
+
await this.delete(source);
|
|
350
|
+
return copied;
|
|
351
|
+
}
|
|
352
|
+
async list(options) {
|
|
353
|
+
const taskRoot = join(this.rootDir, "tasks", encodeURIComponent(options.taskId));
|
|
354
|
+
const files = [];
|
|
355
|
+
await this.walk(taskRoot, async (path) => {
|
|
356
|
+
const rel = relative(taskRoot, path).split(sep).join("/");
|
|
357
|
+
const name = decodePath(rel);
|
|
358
|
+
if (options.prefix && !name.startsWith(options.prefix)) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
files.push(await this.head({ taskId: options.taskId, name }));
|
|
362
|
+
});
|
|
363
|
+
return typeof options.limit === "number" ? files.slice(0, options.limit) : files;
|
|
364
|
+
}
|
|
365
|
+
async* listAll(options) {
|
|
366
|
+
for (const item of await this.list(options)) {
|
|
367
|
+
yield item;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
async url(scope) {
|
|
371
|
+
return `/api/fs/tasks/${encodeURIComponent(scope.taskId)}/files/${encodeURIComponent(scope.name)}/raw`;
|
|
372
|
+
}
|
|
373
|
+
async signedUploadUrl() {
|
|
374
|
+
throw new FilesError("ReadOnly", "local-fs does not support signed upload URLs");
|
|
375
|
+
}
|
|
376
|
+
localPath(scope) {
|
|
377
|
+
return join(this.rootDir, providerPath(scope));
|
|
378
|
+
}
|
|
379
|
+
metaPath(target) {
|
|
380
|
+
return `${target}.meta.json`;
|
|
381
|
+
}
|
|
382
|
+
async readStoredContentType(target) {
|
|
383
|
+
try {
|
|
384
|
+
const metaFile = Bun.file(this.metaPath(target));
|
|
385
|
+
if (!await metaFile.exists()) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const meta = await metaFile.json();
|
|
389
|
+
return typeof meta?.contentType === "string" ? meta.contentType : undefined;
|
|
390
|
+
} catch {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
async walk(dir, visit) {
|
|
395
|
+
let entries;
|
|
396
|
+
try {
|
|
397
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
398
|
+
} catch (error) {
|
|
399
|
+
if (error.code === "ENOENT") {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
throw new FilesError("Provider", "Unable to list files", { cause: error });
|
|
403
|
+
}
|
|
404
|
+
for (const entry of entries) {
|
|
405
|
+
const path = join(dir, entry.name);
|
|
406
|
+
if (entry.isDirectory()) {
|
|
407
|
+
await this.walk(path, visit);
|
|
408
|
+
} else if (entry.isFile() && !entry.name.endsWith(".meta.json")) {
|
|
409
|
+
await visit(path);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function decodePath(path) {
|
|
415
|
+
return path.split("/").map((part) => decodeURIComponent(part)).join("/");
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// src/fs/registry.ts
|
|
419
|
+
var memoizedProvider = null;
|
|
420
|
+
function getFileStorageProvider() {
|
|
421
|
+
if (!memoizedProvider) {
|
|
422
|
+
memoizedProvider = selectProvider();
|
|
423
|
+
}
|
|
424
|
+
return memoizedProvider;
|
|
425
|
+
}
|
|
426
|
+
function selectProvider() {
|
|
427
|
+
if (process.env.AGENT_FS_API_URL && (process.env.API_AGENT_FS_API_KEY || process.env.AGENT_FS_API_KEY)) {
|
|
428
|
+
return new AgentFsProvider;
|
|
429
|
+
}
|
|
430
|
+
return new LocalFsProvider;
|
|
431
|
+
}
|
|
432
|
+
function resetFileStorageProvider() {
|
|
433
|
+
memoizedProvider = null;
|
|
434
|
+
}
|
|
435
|
+
function resetFileStorageProviderForTests() {
|
|
436
|
+
resetFileStorageProvider();
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export { FilesError, normalizeFilesError, getFileStorageProvider, selectProvider, resetFileStorageProvider, resetFileStorageProviderForTests };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAdditiveBuffer,
|
|
3
3
|
extractSlackMessageText
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-9y4z25ke.js";
|
|
5
5
|
import {
|
|
6
6
|
getSlackApp,
|
|
7
7
|
registerTreeMessage
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-emgzr4ja.js";
|
|
9
9
|
import {
|
|
10
10
|
rewriteSlackMentions
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-j6n9at34.js";
|
|
12
|
+
import {
|
|
13
|
+
createTaskWithSiblingAwareness
|
|
14
|
+
} from "./cli-td2x0s9b.js";
|
|
12
15
|
import {
|
|
13
16
|
buildBufferFlushBlocks
|
|
14
17
|
} from "./cli-ma04faw5.js";
|
|
15
|
-
import {
|
|
16
|
-
createTaskWithSiblingAwareness
|
|
17
|
-
} from "./cli-226nz7j1.js";
|
|
18
18
|
import {
|
|
19
19
|
getLatestActiveTaskInThread,
|
|
20
20
|
getLeadAgent,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
init_registry,
|
|
25
25
|
registerTemplate,
|
|
26
26
|
slackContextKey
|
|
27
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-y82m27mq.js";
|
|
28
28
|
|
|
29
29
|
// src/slack/event-dedup.ts
|
|
30
30
|
var DEFAULT_TTL_MS = 300000;
|
|
@@ -7,7 +7,7 @@ var package_default;
|
|
|
7
7
|
var init_package = __esm(() => {
|
|
8
8
|
package_default = {
|
|
9
9
|
name: "@desplega.ai/agent-swarm",
|
|
10
|
-
version: "1.119.
|
|
10
|
+
version: "1.119.3",
|
|
11
11
|
description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
|
|
12
12
|
license: "MIT",
|
|
13
13
|
author: "desplega.sh <contact@desplega.sh>",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveCodexPrompt
|
|
3
|
-
} from "./cli-r94z9p1z.js";
|
|
4
|
-
import {
|
|
5
|
-
summarizeSession
|
|
6
|
-
} from "./cli-e7306swv.js";
|
|
7
1
|
import {
|
|
8
2
|
createSwarmEventHandler
|
|
9
3
|
} from "./cli-07er7wrs.js";
|
|
4
|
+
import {
|
|
5
|
+
resolveCodexPrompt
|
|
6
|
+
} from "./cli-r94z9p1z.js";
|
|
10
7
|
import {
|
|
11
8
|
readPkgVersion
|
|
12
9
|
} from "./cli-d6n0thxw.js";
|
|
10
|
+
import {
|
|
11
|
+
summarizeSession
|
|
12
|
+
} from "./cli-hcpm1e90.js";
|
|
13
13
|
import {
|
|
14
14
|
buildRatingsFromLlm,
|
|
15
15
|
fetchRetrievalsForTask,
|
|
@@ -8,16 +8,22 @@ import {
|
|
|
8
8
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
9
9
|
sanitizeReferencesSource
|
|
10
10
|
} from "./cli-ftyf58xj.js";
|
|
11
|
+
import {
|
|
12
|
+
calculateNextRun,
|
|
13
|
+
ensure,
|
|
14
|
+
require_dist,
|
|
15
|
+
runScheduleNow
|
|
16
|
+
} from "./cli-yzxg93ma.js";
|
|
11
17
|
import {
|
|
12
18
|
startPricingRefreshLoop
|
|
13
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-8y1kmyn7.js";
|
|
14
20
|
import {
|
|
15
21
|
seedPricingFromModelsDev
|
|
16
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-e5hdn9nx.js";
|
|
17
23
|
import {
|
|
18
24
|
ensureRbacSeedsSynced,
|
|
19
25
|
getUserGrant
|
|
20
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-7yfmb4ne.js";
|
|
21
27
|
import {
|
|
22
28
|
can,
|
|
23
29
|
decideAdmission,
|
|
@@ -37,17 +43,7 @@ import {
|
|
|
37
43
|
repointTrackerSyncBySwarmId,
|
|
38
44
|
updateTrackerSync,
|
|
39
45
|
updateTrackerSyncSwarmId
|
|
40
|
-
} from "./cli-
|
|
41
|
-
import {
|
|
42
|
-
ZodFirstPartyTypeKind,
|
|
43
|
-
objectType
|
|
44
|
-
} from "./cli-fad8m16k.js";
|
|
45
|
-
import {
|
|
46
|
-
calculateNextRun,
|
|
47
|
-
ensure,
|
|
48
|
-
require_dist,
|
|
49
|
-
runScheduleNow
|
|
50
|
-
} from "./cli-03hw3tdq.js";
|
|
46
|
+
} from "./cli-z612d1nc.js";
|
|
51
47
|
import {
|
|
52
48
|
TriggerSchemaError,
|
|
53
49
|
applyDefinitionPatch,
|
|
@@ -61,10 +57,18 @@ import {
|
|
|
61
57
|
startWorkflowExecution,
|
|
62
58
|
validateDefinition,
|
|
63
59
|
validateJsonSchema
|
|
64
|
-
} from "./cli-
|
|
60
|
+
} from "./cli-j5da6jb2.js";
|
|
65
61
|
import {
|
|
66
62
|
getApiKey
|
|
67
63
|
} from "./cli-f14fvzag.js";
|
|
64
|
+
import {
|
|
65
|
+
buildAuthorizationUrl,
|
|
66
|
+
ensureToken,
|
|
67
|
+
ensureTokenOrThrow,
|
|
68
|
+
getOAuthApp,
|
|
69
|
+
getOAuthTokens,
|
|
70
|
+
upsertOAuthApp
|
|
71
|
+
} from "./cli-p4yn675m.js";
|
|
68
72
|
import {
|
|
69
73
|
CREDENTIAL_BINDINGS_CONFIG_KEY,
|
|
70
74
|
CredentialBindingSchema,
|
|
@@ -81,7 +85,7 @@ import {
|
|
|
81
85
|
setScriptConnectionEnabled,
|
|
82
86
|
upsertCredentialBinding,
|
|
83
87
|
upsertScriptConnection
|
|
84
|
-
} from "./cli-
|
|
88
|
+
} from "./cli-gzng1fst.js";
|
|
85
89
|
import {
|
|
86
90
|
CANDIDATE_SET_MULTIPLIER,
|
|
87
91
|
computeScore,
|
|
@@ -93,25 +97,21 @@ import {
|
|
|
93
97
|
isGraphExpansionEnabled,
|
|
94
98
|
rerank,
|
|
95
99
|
rowToCandidate
|
|
96
|
-
} from "./cli-
|
|
100
|
+
} from "./cli-6expbmb3.js";
|
|
97
101
|
import {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
getOAuthApp,
|
|
102
|
-
getOAuthTokens,
|
|
103
|
-
upsertOAuthApp
|
|
104
|
-
} from "./cli-gq46dx9q.js";
|
|
102
|
+
ZodFirstPartyTypeKind,
|
|
103
|
+
objectType
|
|
104
|
+
} from "./cli-fad8m16k.js";
|
|
105
105
|
import {
|
|
106
106
|
createAdditiveBuffer,
|
|
107
107
|
extractSlackMessageText,
|
|
108
108
|
parseSlackTs
|
|
109
|
-
} from "./cli-
|
|
109
|
+
} from "./cli-9y4z25ke.js";
|
|
110
110
|
import {
|
|
111
111
|
getSlackApp,
|
|
112
112
|
startSlackApp,
|
|
113
113
|
stopSlackApp
|
|
114
|
-
} from "./cli-
|
|
114
|
+
} from "./cli-emgzr4ja.js";
|
|
115
115
|
import {
|
|
116
116
|
findOrCreateUserByEmail,
|
|
117
117
|
findUserByExternalId,
|
|
@@ -127,13 +127,13 @@ import {
|
|
|
127
127
|
resolveIdentityByEmail,
|
|
128
128
|
resolveUserByToken,
|
|
129
129
|
unlinkIdentity
|
|
130
|
-
} from "./cli-
|
|
130
|
+
} from "./cli-3sew4a9j.js";
|
|
131
|
+
import {
|
|
132
|
+
createTaskWithSiblingAwareness
|
|
133
|
+
} from "./cli-td2x0s9b.js";
|
|
131
134
|
import {
|
|
132
135
|
markdownToSlack
|
|
133
136
|
} from "./cli-ma04faw5.js";
|
|
134
|
-
import {
|
|
135
|
-
createTaskWithSiblingAwareness
|
|
136
|
-
} from "./cli-226nz7j1.js";
|
|
137
137
|
import {
|
|
138
138
|
getAppUrl,
|
|
139
139
|
getMcpBaseUrl,
|
|
@@ -377,7 +377,7 @@ import {
|
|
|
377
377
|
upsertService,
|
|
378
378
|
upsertSwarmConfig,
|
|
379
379
|
validateConfigValue
|
|
380
|
-
} from "./cli-
|
|
380
|
+
} from "./cli-y82m27mq.js";
|
|
381
381
|
import {
|
|
382
382
|
init_zod
|
|
383
383
|
} from "./cli-bw80ck94.js";
|
|
@@ -422,7 +422,7 @@ import {
|
|
|
422
422
|
import {
|
|
423
423
|
init_package,
|
|
424
424
|
package_default
|
|
425
|
-
} from "./cli-
|
|
425
|
+
} from "./cli-cx30v78p.js";
|
|
426
426
|
import {
|
|
427
427
|
init_secret_scrubber,
|
|
428
428
|
refreshSecretScrubberCache,
|
|
@@ -19710,7 +19710,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
19710
19710
|
return;
|
|
19711
19711
|
initialized2 = true;
|
|
19712
19712
|
try {
|
|
19713
|
-
const impl = await import("./otel-impl-
|
|
19713
|
+
const impl = await import("./otel-impl-qw4pakj6.js");
|
|
19714
19714
|
await impl.boot(serviceRole);
|
|
19715
19715
|
realWithSpan = impl.withSpan;
|
|
19716
19716
|
realStartSpan = impl.startSpan;
|
|
@@ -34997,7 +34997,7 @@ async function notifySlack(text) {
|
|
|
34997
34997
|
return;
|
|
34998
34998
|
}
|
|
34999
34999
|
try {
|
|
35000
|
-
const { getSlackApp: getSlackApp2 } = await import("./app-
|
|
35000
|
+
const { getSlackApp: getSlackApp2 } = await import("./app-p1gqacgd.js");
|
|
35001
35001
|
const app = getSlackApp2();
|
|
35002
35002
|
if (!app) {
|
|
35003
35003
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -35066,7 +35066,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
35066
35066
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
35067
35067
|
}
|
|
35068
35068
|
async function overwriteWebhookIds(next) {
|
|
35069
|
-
const { getDb: getDb2 } = await import("./db-
|
|
35069
|
+
const { getDb: getDb2 } = await import("./db-c9wx8pbf.js");
|
|
35070
35070
|
const db = getDb2();
|
|
35071
35071
|
const txn = db.transaction(() => {
|
|
35072
35072
|
const row = db.query("SELECT metadata FROM oauth_apps WHERE provider = 'jira'").get();
|
|
@@ -109263,6 +109263,8 @@ function loadGlobalConfigsIntoEnv(override = false) {
|
|
|
109263
109263
|
}
|
|
109264
109264
|
async function reloadGlobalConfigsAndIntegrations() {
|
|
109265
109265
|
const updated = loadGlobalConfigsIntoEnv(true);
|
|
109266
|
+
const { resetFileStorageProvider } = await import("./registry-wejfsj31.js");
|
|
109267
|
+
resetFileStorageProvider();
|
|
109266
109268
|
const integrations = [];
|
|
109267
109269
|
resetAgentMail();
|
|
109268
109270
|
if (initAgentMail())
|