@desplega.ai/agent-swarm 1.131.0 → 1.131.1
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/dist/{actions-w53mbns9.js → actions-jgcy477k.js} +6 -6
- package/dist/{app-m9gwqsqv.js → app-5da78bd4.js} +3 -3
- package/dist/{assistant-bp65m6f3.js → assistant-f2vkk1hj.js} +8 -8
- package/dist/{boot-reembed-62p0at2k.js → boot-reembed-q7mp8hcr.js} +3 -3
- package/dist/{boot-reembed-xmfp6wdh.js → boot-reembed-xmw8wcx6.js} +4 -4
- package/dist/{boot-scrub-logs-rr8q2dms.js → boot-scrub-logs-dsqrv79n.js} +2 -2
- package/dist/{claude-adapter-2y47mrkd.js → claude-adapter-q6x7yspx.js} +4 -4
- package/dist/{claude-managed-adapter-gv19tdew.js → claude-managed-adapter-wsg37bt8.js} +1 -1
- package/dist/{cli-t1xze5qh.js → cli-114fvtmj.js} +1 -1
- package/dist/{cli-cdeg08wx.js → cli-2f07m0xr.js} +1 -1
- package/dist/{cli-70xqj0z3.js → cli-2rk0cx7s.js} +2 -2
- package/dist/{cli-nm5gtp1x.js → cli-3ty0t082.js} +1 -1
- package/dist/{cli-efxfnq6q.js → cli-4rkfg1wx.js} +3 -3
- package/dist/{cli-a4jzdpa3.js → cli-50vbt00w.js} +1 -1
- package/dist/{cli-pm6xbh84.js → cli-6dp3ydxa.js} +34 -8
- package/dist/{cli-d3x3x1c9.js → cli-6dpytdr2.js} +1 -1
- package/dist/{cli-e7ckcg4v.js → cli-6pcz9h15.js} +12 -12
- package/dist/{cli-5kx36evn.js → cli-793jvbsh.js} +1 -1
- package/dist/{cli-78xwvkhj.js → cli-7dm2zqy2.js} +2 -2
- package/dist/{cli-psh3c4va.js → cli-aca5pz9f.js} +1 -1
- package/dist/{cli-72q8m8gk.js → cli-ccf9vy7q.js} +2 -2
- package/dist/{cli-qv61hp37.js → cli-g1re8r05.js} +2 -2
- package/dist/{cli-d2tfkcga.js → cli-g74vpjp2.js} +3 -3
- package/dist/{cli-2q72qz2s.js → cli-gecy3z2s.js} +13 -4
- package/dist/{cli-yw8vghx2.js → cli-jbcva0xj.js} +14 -6
- package/dist/{cli-t76vw5db.js → cli-jevgrb4w.js} +19 -19
- package/dist/{cli-3kf51j15.js → cli-kd1ck4rx.js} +1 -1
- package/dist/{cli-g6b8x1h8.js → cli-nrkkknat.js} +1 -1
- package/dist/{cli-fywms69x.js → cli-pxfxkx5m.js} +1 -1
- package/dist/{cli-cvgjwnh1.js → cli-rgrfzg8z.js} +6 -6
- package/dist/{cli-rzbpmxdr.js → cli-se2p6rkb.js} +1 -1
- package/dist/{cli-5v4rw6yd.js → cli-sy7jk3tx.js} +1 -1
- package/dist/{cli-t55yw3a1.js → cli-t8d349cy.js} +2 -2
- package/dist/{cli-0rcyq6d9.js → cli-w2wxd56v.js} +2 -2
- package/dist/{cli-qmdnhpej.js → cli-wz9115x0.js} +17 -7
- package/dist/{cli-5ze9rv97.js → cli-ycrnynpw.js} +4 -4
- package/dist/{cli-a40rnf71.js → cli-ygrbmjja.js} +5 -5
- package/dist/cli.js +12 -12
- package/dist/{codex-adapter-d24q75wk.js → codex-adapter-htjkn22b.js} +2 -2
- package/dist/{codex-session-runner-g50vcsex.js → codex-session-runner-wjfc7smz.js} +2 -2
- package/dist/{commands-c3nrc5hg.js → commands-xhrfwqsk.js} +2 -2
- package/dist/{db-nt7fg3tw.js → db-anvwb22f.js} +2 -2
- package/dist/{handlers-fkr6swat.js → handlers-b9kbc621.js} +8 -8
- package/dist/{hook-g019yehy.js → hook-cgk4wxmx.js} +3 -3
- package/dist/{hook-77wpvnjc.js → hook-xkvn6c5h.js} +2 -2
- package/dist/{http-jewj0syk.js → http-9xh6ta4r.js} +156 -37
- package/dist/{index-hfvggd0z.js → index-25wjsdv2.js} +9 -9
- package/dist/{index-7n2xpbd4.js → index-eaxyqcmj.js} +8 -8
- package/dist/{index-hp1kdbjj.js → index-vg4snay4.js} +10 -10
- package/dist/{index-6gm5he8h.js → index-ywds4812.js} +8 -8
- package/dist/{keepalive-j0fjvqfd.js → keepalive-vc7s2aa6.js} +4 -4
- package/dist/{lead-1n8x30xe.js → lead-r2yqfmx7.js} +24 -24
- package/dist/{maintenance-gvev11sa.js → maintenance-mw70k468.js} +4 -4
- package/dist/{oauth-refresh-sweep-s9ecsvh0.js → oauth-refresh-sweep-yecgjpk4.js} +3 -3
- package/dist/{onboard-pvm5b38w.js → onboard-xj0f73f9.js} +2 -2
- package/dist/{otel-impl-p6jvgd9c.js → otel-impl-nxg0n0b3.js} +1 -1
- package/dist/{pi-mono-adapter-t091s27g.js → pi-mono-adapter-4g5kby31.js} +1 -1
- package/dist/{pricing-refresh-k49rcyed.js → pricing-refresh-2cn6effr.js} +4 -4
- package/dist/{rbac-roles-cr80g96t.js → rbac-roles-1hcxdtg7.js} +2 -2
- package/dist/{rbac-roles-30pspvy7.js → rbac-roles-vynday5g.js} +3 -3
- package/dist/{render-v2-xm457ng1.js → render-v2-tc0bh8kk.js} +3 -3
- package/dist/{seed-pricing-yhpv35fr.js → seed-pricing-8kceb43f.js} +3 -3
- package/dist/{setup-nytnmwwr.js → setup-46xtgq3c.js} +2 -2
- package/dist/{worker-msytr2cw.js → worker-qrbz6hmv.js} +24 -24
- package/openapi.json +1 -1
- package/package.json +2 -2
- package/src/be/migrations/130_scratch_script_retention_grace.sql +6 -0
- package/src/be/scripts/db.ts +43 -1
- package/src/be/scripts/retention.ts +164 -0
- package/src/be/scripts/run-saved.ts +16 -1
- package/src/http/index.ts +5 -0
- package/src/http/scripts.ts +21 -3
- package/src/http/x.ts +14 -0
- package/src/providers/claude-managed-models.ts +34 -10
- package/src/tests/claude-managed-adapter.test.ts +38 -7
- package/src/tests/sandboxed-process.test.ts +45 -0
- package/src/tests/script-connections.test.ts +3 -2
- package/src/tests/scripts-external-api.test.ts +8 -3
- package/src/tests/scripts-http.test.ts +12 -0
- package/src/tests/scripts-retention.test.ts +384 -0
- package/src/tests/workflow-swarm-script.test.ts +14 -5
- package/src/utils/sandboxed-process.ts +40 -14
- package/src/workflows/executors/swarm-script.ts +24 -1
- package/templates/schedules/daily-compounding-reflection/content.md +12 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleHook
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
3
|
+
} from "./cli-2rk0cx7s.js";
|
|
4
|
+
import"./cli-w2wxd56v.js";
|
|
5
5
|
import"./cli-yv9dttkh.js";
|
|
6
6
|
import"./cli-v1mwc5v2.js";
|
|
7
7
|
import"./cli-2wadx7p2.js";
|
|
@@ -12,7 +12,7 @@ import"./cli-0258203w.js";
|
|
|
12
12
|
import"./cli-x23me2mg.js";
|
|
13
13
|
import"./cli-zsspvvm2.js";
|
|
14
14
|
import"./cli-4j2mrzag.js";
|
|
15
|
-
import"./cli-
|
|
15
|
+
import"./cli-ccf9vy7q.js";
|
|
16
16
|
import"./cli-5dsbcjjw.js";
|
|
17
17
|
import"./cli-darcwax3.js";
|
|
18
18
|
import"./cli-4wgngmwv.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
summarizeSession
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-w2wxd56v.js";
|
|
5
5
|
import {
|
|
6
6
|
checkToolLoop,
|
|
7
7
|
clearToolHistory
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
init_package,
|
|
40
40
|
package_default
|
|
41
|
-
} from "./cli-
|
|
41
|
+
} from "./cli-ccf9vy7q.js";
|
|
42
42
|
import"./cli-5dsbcjjw.js";
|
|
43
43
|
import"./cli-darcwax3.js";
|
|
44
44
|
import"./cli-4wgngmwv.js";
|
|
@@ -152,7 +152,7 @@ import {
|
|
|
152
152
|
withRemoteContext,
|
|
153
153
|
withSpanContext,
|
|
154
154
|
writeSkillsToFilesystem
|
|
155
|
-
} from "./cli-
|
|
155
|
+
} from "./cli-jevgrb4w.js";
|
|
156
156
|
import"./cli-1z7048dy.js";
|
|
157
157
|
import {
|
|
158
158
|
Anthropic
|
|
@@ -173,27 +173,27 @@ import {
|
|
|
173
173
|
checkHeartbeatChecklist,
|
|
174
174
|
runHeartbeatSweep,
|
|
175
175
|
stopHeartbeat
|
|
176
|
-
} from "./cli-
|
|
176
|
+
} from "./cli-g74vpjp2.js";
|
|
177
177
|
import {
|
|
178
178
|
createResumeFollowUp,
|
|
179
179
|
createWorkerTaskFollowUp
|
|
180
|
-
} from "./cli-
|
|
180
|
+
} from "./cli-3ty0t082.js";
|
|
181
181
|
import {
|
|
182
182
|
calculateNextRun,
|
|
183
183
|
dispatchScheduleTarget,
|
|
184
184
|
ensure,
|
|
185
185
|
initialize,
|
|
186
186
|
require_dist
|
|
187
|
-
} from "./cli-
|
|
187
|
+
} from "./cli-ycrnynpw.js";
|
|
188
188
|
import {
|
|
189
189
|
getModelsCatalog
|
|
190
|
-
} from "./cli-
|
|
190
|
+
} from "./cli-t8d349cy.js";
|
|
191
191
|
import {
|
|
192
192
|
normalizeModelKey
|
|
193
|
-
} from "./cli-
|
|
193
|
+
} from "./cli-114fvtmj.js";
|
|
194
194
|
import {
|
|
195
195
|
getUserGrant
|
|
196
|
-
} from "./cli-
|
|
196
|
+
} from "./cli-sy7jk3tx.js";
|
|
197
197
|
import {
|
|
198
198
|
can,
|
|
199
199
|
clearAuditSink,
|
|
@@ -210,12 +210,12 @@ import {
|
|
|
210
210
|
scriptSdkTypesWithGeneratedApis,
|
|
211
211
|
scriptStdlibTypesWithGeneratedApis,
|
|
212
212
|
typecheckScript
|
|
213
|
-
} from "./cli-
|
|
213
|
+
} from "./cli-4rkfg1wx.js";
|
|
214
214
|
import {
|
|
215
215
|
collectScriptReferences,
|
|
216
216
|
getApp,
|
|
217
217
|
listAppRecords
|
|
218
|
-
} from "./cli-
|
|
218
|
+
} from "./cli-gecy3z2s.js";
|
|
219
219
|
import {
|
|
220
220
|
RawLlmConfigSchema,
|
|
221
221
|
RawLlmOutputSchema,
|
|
@@ -235,7 +235,7 @@ import {
|
|
|
235
235
|
validateDefinition,
|
|
236
236
|
validateJsonSchema,
|
|
237
237
|
verifyHmacSignature
|
|
238
|
-
} from "./cli-
|
|
238
|
+
} from "./cli-jbcva0xj.js";
|
|
239
239
|
import"./cli-3dpj7atn.js";
|
|
240
240
|
import {
|
|
241
241
|
ConnectionAuthInputSchema,
|
|
@@ -293,6 +293,7 @@ import {
|
|
|
293
293
|
registerClient,
|
|
294
294
|
require_typescript,
|
|
295
295
|
resolveAdvertisedTokenEndpointAuthMethod,
|
|
296
|
+
restoreScratchScriptLastUsedIfUnchanged,
|
|
296
297
|
revokeMcpToken,
|
|
297
298
|
rotateScriptApiSecret,
|
|
298
299
|
runScript,
|
|
@@ -300,19 +301,20 @@ import {
|
|
|
300
301
|
selectDcrTokenEndpointAuthMethod,
|
|
301
302
|
setMcpServerAuthMethod,
|
|
302
303
|
setScriptConnectionEnabled,
|
|
304
|
+
touchScratchScriptLastUsed,
|
|
303
305
|
updateScriptApi,
|
|
304
306
|
upsertCredentialBinding,
|
|
305
307
|
upsertMcpOAuthToken,
|
|
306
308
|
upsertScriptByName,
|
|
307
309
|
upsertScriptConnection
|
|
308
|
-
} from "./cli-
|
|
310
|
+
} from "./cli-6dp3ydxa.js";
|
|
309
311
|
import"./cli-epan13p1.js";
|
|
310
312
|
import {
|
|
311
313
|
getApiKey
|
|
312
314
|
} from "./cli-f14fvzag.js";
|
|
313
315
|
import {
|
|
314
316
|
searchScripts
|
|
315
|
-
} from "./cli-
|
|
317
|
+
} from "./cli-g1re8r05.js";
|
|
316
318
|
import {
|
|
317
319
|
CANDIDATE_SET_MULTIPLIER,
|
|
318
320
|
getEmbeddingProvider,
|
|
@@ -320,7 +322,7 @@ import {
|
|
|
320
322
|
init_constants as init_constants2,
|
|
321
323
|
init_reranker,
|
|
322
324
|
rerank
|
|
323
|
-
} from "./cli-
|
|
325
|
+
} from "./cli-se2p6rkb.js";
|
|
324
326
|
import"./cli-0258203w.js";
|
|
325
327
|
import {
|
|
326
328
|
acquireOAuthRefreshLock,
|
|
@@ -345,14 +347,14 @@ import {
|
|
|
345
347
|
updateAuthorizationIdentity,
|
|
346
348
|
updateOAuthAppById,
|
|
347
349
|
upsertAuthorization
|
|
348
|
-
} from "./cli-
|
|
350
|
+
} from "./cli-nrkkknat.js";
|
|
349
351
|
import"./cli-fad8m16k.js";
|
|
350
352
|
import {
|
|
351
353
|
FilesError,
|
|
352
354
|
getFileStorageProvider,
|
|
353
355
|
normalizeFilesError
|
|
354
356
|
} from "./cli-bnx54kxv.js";
|
|
355
|
-
import"./cli-
|
|
357
|
+
import"./cli-6dpytdr2.js";
|
|
356
358
|
import {
|
|
357
359
|
findUserById,
|
|
358
360
|
fingerprintApiKey,
|
|
@@ -368,15 +370,15 @@ import {
|
|
|
368
370
|
resolveUserByToken,
|
|
369
371
|
revokeToken,
|
|
370
372
|
unlinkIdentity
|
|
371
|
-
} from "./cli-
|
|
373
|
+
} from "./cli-aca5pz9f.js";
|
|
372
374
|
import {
|
|
373
375
|
createTaskWithSiblingAwareness
|
|
374
|
-
} from "./cli-
|
|
376
|
+
} from "./cli-2f07m0xr.js";
|
|
375
377
|
import {
|
|
376
378
|
getSlackApp,
|
|
377
379
|
startSlackApp,
|
|
378
380
|
stopSlackApp
|
|
379
|
-
} from "./cli-
|
|
381
|
+
} from "./cli-rgrfzg8z.js";
|
|
380
382
|
import"./cli-k9qkf1hw.js";
|
|
381
383
|
import"./cli-b0p7rfnd.js";
|
|
382
384
|
import"./cli-t930g0xh.js";
|
|
@@ -754,7 +756,7 @@ import {
|
|
|
754
756
|
upsertSwarmConfig,
|
|
755
757
|
validateConfigValue,
|
|
756
758
|
withFavoriteFlags
|
|
757
|
-
} from "./cli-
|
|
759
|
+
} from "./cli-50vbt00w.js";
|
|
758
760
|
import {
|
|
759
761
|
getAllTemplateDefinitions,
|
|
760
762
|
getTemplateDefinition,
|
|
@@ -789,7 +791,7 @@ import {
|
|
|
789
791
|
import {
|
|
790
792
|
init_package,
|
|
791
793
|
package_default
|
|
792
|
-
} from "./cli-
|
|
794
|
+
} from "./cli-ccf9vy7q.js";
|
|
793
795
|
import {
|
|
794
796
|
array,
|
|
795
797
|
exports_external,
|
|
@@ -841,6 +843,107 @@ import {
|
|
|
841
843
|
} from "node:http";
|
|
842
844
|
init_db();
|
|
843
845
|
|
|
846
|
+
// src/be/scripts/retention.ts
|
|
847
|
+
init_db();
|
|
848
|
+
var SCRATCH_RETENTION_DAYS = 14;
|
|
849
|
+
var SCRATCH_GC_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
850
|
+
var scratchGcTimer = null;
|
|
851
|
+
function appReferencedScriptIds(candidateIds) {
|
|
852
|
+
const ids = new Set;
|
|
853
|
+
for (const app of listAppRecords()) {
|
|
854
|
+
for (const scriptId of collectScriptReferences(app.definition).keys()) {
|
|
855
|
+
ids.add(scriptId);
|
|
856
|
+
}
|
|
857
|
+
if (app.definitionError === undefined)
|
|
858
|
+
continue;
|
|
859
|
+
const serialized = JSON.stringify(app.definition ?? null);
|
|
860
|
+
for (const id of candidateIds) {
|
|
861
|
+
if (!ids.has(id) && serialized.includes(id))
|
|
862
|
+
ids.add(id);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return ids;
|
|
866
|
+
}
|
|
867
|
+
function scriptApiReferencedScriptIds() {
|
|
868
|
+
const rows = getDb().prepare("SELECT DISTINCT scriptId FROM script_apis").all();
|
|
869
|
+
return new Set(rows.map((row) => row.scriptId));
|
|
870
|
+
}
|
|
871
|
+
function workflowReferencedAgentScriptKeys() {
|
|
872
|
+
const keys = new Set;
|
|
873
|
+
for (const workflow of listWorkflows()) {
|
|
874
|
+
if (!workflow.createdByAgentId)
|
|
875
|
+
continue;
|
|
876
|
+
for (const node of workflow.definition.nodes) {
|
|
877
|
+
if (node.type !== "swarm-script")
|
|
878
|
+
continue;
|
|
879
|
+
const scriptName = node.config.scriptName;
|
|
880
|
+
const scope = node.config.scope;
|
|
881
|
+
if (typeof scriptName !== "string" || scope === "global")
|
|
882
|
+
continue;
|
|
883
|
+
keys.add(`${scriptName}::${workflow.createdByAgentId}`);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return keys;
|
|
887
|
+
}
|
|
888
|
+
function workflowReferencedScratchNamesForOwnerlessWorkflows() {
|
|
889
|
+
const names = new Set;
|
|
890
|
+
for (const workflow of listWorkflows()) {
|
|
891
|
+
if (workflow.createdByAgentId)
|
|
892
|
+
continue;
|
|
893
|
+
for (const node of workflow.definition.nodes) {
|
|
894
|
+
if (node.type !== "swarm-script")
|
|
895
|
+
continue;
|
|
896
|
+
const scriptName = node.config.scriptName;
|
|
897
|
+
const scope = node.config.scope;
|
|
898
|
+
if (typeof scriptName !== "string" || scope === "global")
|
|
899
|
+
continue;
|
|
900
|
+
names.add(scriptName);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return names;
|
|
904
|
+
}
|
|
905
|
+
function purgeExpiredScratchScripts(now = new Date) {
|
|
906
|
+
const cutoff = new Date(now.getTime() - SCRATCH_RETENTION_DAYS * 24 * 60 * 60 * 1000).toISOString();
|
|
907
|
+
const candidates = getDb().prepare(`SELECT id, name, scopeId FROM scripts
|
|
908
|
+
WHERE scope = 'agent'
|
|
909
|
+
AND isScratch = 1
|
|
910
|
+
AND name GLOB 'scratch-*'
|
|
911
|
+
AND updatedAt < ?`).all(cutoff);
|
|
912
|
+
if (candidates.length === 0)
|
|
913
|
+
return 0;
|
|
914
|
+
const referenced = appReferencedScriptIds(candidates.map((row) => row.id));
|
|
915
|
+
const apiReferenced = scriptApiReferencedScriptIds();
|
|
916
|
+
const workflowReferenced = workflowReferencedAgentScriptKeys();
|
|
917
|
+
const ownerlessWorkflowReferencedNames = workflowReferencedScratchNamesForOwnerlessWorkflows();
|
|
918
|
+
const idsToDelete = candidates.filter((row) => !referenced.has(row.id)).filter((row) => !apiReferenced.has(row.id)).filter((row) => !(row.scopeId && workflowReferenced.has(`${row.name}::${row.scopeId}`))).filter((row) => !ownerlessWorkflowReferencedNames.has(row.name)).map((row) => row.id);
|
|
919
|
+
if (idsToDelete.length === 0)
|
|
920
|
+
return 0;
|
|
921
|
+
const placeholders = idsToDelete.map(() => "?").join(",");
|
|
922
|
+
return getDb().prepare(`DELETE FROM scripts WHERE id IN (${placeholders}) RETURNING id`).all(...idsToDelete).length;
|
|
923
|
+
}
|
|
924
|
+
function runScratchScriptGc(label) {
|
|
925
|
+
try {
|
|
926
|
+
const purged = purgeExpiredScratchScripts();
|
|
927
|
+
console.log(`[scratch-script-gc] ${label} purge removed ${purged} scratch script row(s)`);
|
|
928
|
+
} catch (err) {
|
|
929
|
+
console.error(`[scratch-script-gc] ${label} purge failed:`, err.message);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
function startScratchScriptGc(intervalMs = SCRATCH_GC_INTERVAL_MS) {
|
|
933
|
+
if (scratchGcTimer)
|
|
934
|
+
return;
|
|
935
|
+
runScratchScriptGc("Initial");
|
|
936
|
+
scratchGcTimer = setInterval(() => runScratchScriptGc("Periodic"), intervalMs);
|
|
937
|
+
if (typeof scratchGcTimer.unref === "function")
|
|
938
|
+
scratchGcTimer.unref();
|
|
939
|
+
}
|
|
940
|
+
function stopScratchScriptGc() {
|
|
941
|
+
if (!scratchGcTimer)
|
|
942
|
+
return;
|
|
943
|
+
clearInterval(scratchGcTimer);
|
|
944
|
+
scratchGcTimer = null;
|
|
945
|
+
}
|
|
946
|
+
|
|
844
947
|
// src/be/seed-capabilities.ts
|
|
845
948
|
init_db();
|
|
846
949
|
var LEGACY_ALWAYS_ON_DEFAULTS = [
|
|
@@ -16556,12 +16659,14 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
16556
16659
|
return true;
|
|
16557
16660
|
let source = parsed.body.source;
|
|
16558
16661
|
let fsMode = parsed.body.fsMode;
|
|
16662
|
+
let namedScript = null;
|
|
16559
16663
|
if (parsed.body.name) {
|
|
16560
16664
|
const script = resolveScript(parsed.body.name, agent.id, parsed.body.scope);
|
|
16561
16665
|
if (!script) {
|
|
16562
16666
|
jsonError(res, "Script not found", 404);
|
|
16563
16667
|
return true;
|
|
16564
16668
|
}
|
|
16669
|
+
namedScript = script;
|
|
16565
16670
|
source = script.source;
|
|
16566
16671
|
fsMode = script.fsMode;
|
|
16567
16672
|
}
|
|
@@ -16570,6 +16675,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
16570
16675
|
return true;
|
|
16571
16676
|
}
|
|
16572
16677
|
const startedAt = new Date().toISOString();
|
|
16678
|
+
const runStartTouch = namedScript?.isScratch ? touchScratchScriptLastUsed(namedScript.id) : null;
|
|
16573
16679
|
const credentials = await buildScriptCredentialBindingsWithFailures({ agentId: agent.id });
|
|
16574
16680
|
const output = await runScript({
|
|
16575
16681
|
source,
|
|
@@ -16581,8 +16687,14 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
16581
16687
|
apiConnections: getScriptApiConnectionDescriptors({ agentId: agent.id }),
|
|
16582
16688
|
mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agent.id })
|
|
16583
16689
|
});
|
|
16690
|
+
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
16691
|
+
if (namedScript?.isScratch && ok) {
|
|
16692
|
+
touchScratchScriptLastUsed(namedScript.id);
|
|
16693
|
+
} else if (namedScript?.isScratch && runStartTouch) {
|
|
16694
|
+
restoreScratchScriptLastUsedIfUnchanged(namedScript.id, namedScript.updatedAt, runStartTouch);
|
|
16695
|
+
}
|
|
16584
16696
|
let kvSaved;
|
|
16585
|
-
if (parsed.body.idempotencyKey &&
|
|
16697
|
+
if (parsed.body.idempotencyKey && ok) {
|
|
16586
16698
|
const kvNamespace = `script:executions`;
|
|
16587
16699
|
const kvKey = parsed.body.idempotencyKey;
|
|
16588
16700
|
const kvValue = {
|
|
@@ -16601,7 +16713,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
16601
16713
|
kvSaved = { namespace: kvNamespace, key: kvKey };
|
|
16602
16714
|
}
|
|
16603
16715
|
let autoSaved;
|
|
16604
|
-
if (parsed.body.source &&
|
|
16716
|
+
if (parsed.body.source && ok) {
|
|
16605
16717
|
const slug = scratchSlug(parsed.body.intent, parsed.body.source);
|
|
16606
16718
|
await upsertScriptByName({
|
|
16607
16719
|
name: slug,
|
|
@@ -16619,7 +16731,6 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
16619
16731
|
});
|
|
16620
16732
|
autoSaved = { slug, reason: "successful_inline_run" };
|
|
16621
16733
|
}
|
|
16622
|
-
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
16623
16734
|
const runError = ok ? undefined : scrubSecrets([
|
|
16624
16735
|
output.error,
|
|
16625
16736
|
output.runtimeError ? `${output.runtimeError.name}: ${output.runtimeError.message}` : undefined
|
|
@@ -23200,6 +23311,7 @@ async function handleX(req, res, pathSegments) {
|
|
|
23200
23311
|
}
|
|
23201
23312
|
const timeoutMs = resolveTimeoutMs(req);
|
|
23202
23313
|
const startedAt = new Date().toISOString();
|
|
23314
|
+
const runStartTouch = script.isScratch ? touchScratchScriptLastUsed(script.id) : null;
|
|
23203
23315
|
const credentials = await buildScriptCredentialBindingsWithFailures({
|
|
23204
23316
|
agentId: endpoint.agentId
|
|
23205
23317
|
});
|
|
@@ -23216,6 +23328,11 @@ async function handleX(req, res, pathSegments) {
|
|
|
23216
23328
|
});
|
|
23217
23329
|
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
23218
23330
|
const error = ok ? null : buildExecutionError(output);
|
|
23331
|
+
if (ok) {
|
|
23332
|
+
touchScratchScriptLastUsed(script.id);
|
|
23333
|
+
} else if (script.isScratch && runStartTouch) {
|
|
23334
|
+
restoreScratchScriptLastUsedIfUnchanged(script.id, script.updatedAt, runStartTouch);
|
|
23335
|
+
}
|
|
23219
23336
|
try {
|
|
23220
23337
|
recordScriptApiUsage(endpointId);
|
|
23221
23338
|
} catch {}
|
|
@@ -23468,18 +23585,19 @@ async function shutdown() {
|
|
|
23468
23585
|
sessionsProcessed: getServerSessionsProcessed()
|
|
23469
23586
|
});
|
|
23470
23587
|
if (hasCapability("scheduling")) {
|
|
23471
|
-
const { stopScheduler } = await import("./index-
|
|
23588
|
+
const { stopScheduler } = await import("./index-25wjsdv2.js");
|
|
23472
23589
|
stopScheduler();
|
|
23473
23590
|
}
|
|
23474
23591
|
stopHeartbeat();
|
|
23475
23592
|
stopScriptRunSupervisor();
|
|
23476
23593
|
await stopSlackApp();
|
|
23477
23594
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
23478
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
23595
|
+
const { stopOAuthKeepalive } = await import("./keepalive-vc7s2aa6.js");
|
|
23479
23596
|
await stopOAuthKeepalive();
|
|
23480
23597
|
}
|
|
23481
23598
|
stopOAuthPendingGc();
|
|
23482
23599
|
stopMemoryGc();
|
|
23600
|
+
stopScratchScriptGc();
|
|
23483
23601
|
stopAuditGc();
|
|
23484
23602
|
stopAuditWriter();
|
|
23485
23603
|
flushAuditBuffer();
|
|
@@ -23537,15 +23655,15 @@ try {
|
|
|
23537
23655
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
23538
23656
|
}
|
|
23539
23657
|
try {
|
|
23540
|
-
const { seedPricingFromModelsDev } = await import("./seed-pricing-
|
|
23658
|
+
const { seedPricingFromModelsDev } = await import("./seed-pricing-8kceb43f.js");
|
|
23541
23659
|
seedPricingFromModelsDev();
|
|
23542
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
23660
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-2cn6effr.js");
|
|
23543
23661
|
startPricingRefreshLoop();
|
|
23544
23662
|
} catch (err) {
|
|
23545
23663
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
23546
23664
|
}
|
|
23547
23665
|
try {
|
|
23548
|
-
const { ensureRbacSeedsSynced } = await import("./rbac-roles-
|
|
23666
|
+
const { ensureRbacSeedsSynced } = await import("./rbac-roles-vynday5g.js");
|
|
23549
23667
|
ensureRbacSeedsSynced();
|
|
23550
23668
|
} catch (err) {
|
|
23551
23669
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -23553,7 +23671,7 @@ try {
|
|
|
23553
23671
|
throw err;
|
|
23554
23672
|
}
|
|
23555
23673
|
try {
|
|
23556
|
-
const { runAllSeeders } = await import("./index-
|
|
23674
|
+
const { runAllSeeders } = await import("./index-eaxyqcmj.js");
|
|
23557
23675
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
23558
23676
|
} catch (err) {
|
|
23559
23677
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -23561,6 +23679,7 @@ try {
|
|
|
23561
23679
|
setAuditSink(enqueueAuditRow);
|
|
23562
23680
|
startAuditWriter();
|
|
23563
23681
|
startAuditGc();
|
|
23682
|
+
startScratchScriptGc();
|
|
23564
23683
|
initialize();
|
|
23565
23684
|
await initOtel("api");
|
|
23566
23685
|
httpServer.listen(port, async () => {
|
|
@@ -23589,35 +23708,35 @@ httpServer.listen(port, async () => {
|
|
|
23589
23708
|
initWorkflows();
|
|
23590
23709
|
startScriptRunSupervisor(getMcpBaseUrl());
|
|
23591
23710
|
if (hasCapability("scheduling")) {
|
|
23592
|
-
const { startScheduler } = await import("./index-
|
|
23593
|
-
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-
|
|
23711
|
+
const { startScheduler } = await import("./index-25wjsdv2.js");
|
|
23712
|
+
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-ywds4812.js");
|
|
23594
23713
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
23595
23714
|
startScheduler(getExecutorRegistry2(), intervalMs, {
|
|
23596
23715
|
runId: globalState.__runId
|
|
23597
23716
|
});
|
|
23598
23717
|
}
|
|
23599
23718
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
23600
|
-
const { startHeartbeat } = await import("./index-
|
|
23719
|
+
const { startHeartbeat } = await import("./index-vg4snay4.js");
|
|
23601
23720
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
23602
23721
|
startHeartbeat(heartbeatMs);
|
|
23603
23722
|
}
|
|
23604
23723
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
23605
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
23724
|
+
const { startOAuthKeepalive } = await import("./keepalive-vc7s2aa6.js");
|
|
23606
23725
|
startOAuthKeepalive();
|
|
23607
23726
|
}
|
|
23608
23727
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
23609
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
23728
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-yecgjpk4.js");
|
|
23610
23729
|
startOAuthRefreshSweep();
|
|
23611
23730
|
}
|
|
23612
23731
|
startOAuthPendingGc();
|
|
23613
23732
|
startMemoryGc();
|
|
23614
|
-
import("./boot-reembed-
|
|
23733
|
+
import("./boot-reembed-q7mp8hcr.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
23615
23734
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
23616
23735
|
});
|
|
23617
|
-
import("./boot-reembed-
|
|
23736
|
+
import("./boot-reembed-xmw8wcx6.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
23618
23737
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
23619
23738
|
});
|
|
23620
|
-
import("./boot-scrub-logs-
|
|
23739
|
+
import("./boot-scrub-logs-dsqrv79n.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
|
|
23621
23740
|
console.error("[boot-scrub-logs] startup scrub failed (non-fatal):", err);
|
|
23622
23741
|
});
|
|
23623
23742
|
}).on("error", (err) => {
|
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
runScheduleNow,
|
|
5
5
|
startScheduler,
|
|
6
6
|
stopScheduler
|
|
7
|
-
} from "./cli-
|
|
8
|
-
import"./cli-
|
|
7
|
+
} from "./cli-ycrnynpw.js";
|
|
8
|
+
import"./cli-jbcva0xj.js";
|
|
9
9
|
import"./cli-3dpj7atn.js";
|
|
10
|
-
import"./cli-
|
|
10
|
+
import"./cli-6dp3ydxa.js";
|
|
11
11
|
import"./cli-epan13p1.js";
|
|
12
12
|
import"./cli-f14fvzag.js";
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
import"./cli-g1re8r05.js";
|
|
14
|
+
import"./cli-se2p6rkb.js";
|
|
15
15
|
import"./cli-0258203w.js";
|
|
16
|
-
import"./cli-
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
16
|
+
import"./cli-nrkkknat.js";
|
|
17
|
+
import"./cli-2f07m0xr.js";
|
|
18
|
+
import"./cli-50vbt00w.js";
|
|
19
19
|
import"./cli-xpxde7rm.js";
|
|
20
20
|
import"./cli-x23me2mg.js";
|
|
21
21
|
import"./cli-z2zcxes1.js";
|
|
22
22
|
import"./cli-zsspvvm2.js";
|
|
23
23
|
import"./cli-4j2mrzag.js";
|
|
24
|
-
import"./cli-
|
|
24
|
+
import"./cli-ccf9vy7q.js";
|
|
25
25
|
import"./cli-5dsbcjjw.js";
|
|
26
26
|
import"./cli-9aryf9tv.js";
|
|
27
27
|
import"./cli-p9swy5t3.js";
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
extractArgsJsonSchema,
|
|
4
4
|
extractScriptSignature,
|
|
5
5
|
typecheckScript
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
6
|
+
} from "./cli-4rkfg1wx.js";
|
|
7
|
+
import"./cli-gecy3z2s.js";
|
|
8
8
|
import {
|
|
9
9
|
getScript,
|
|
10
10
|
upsertScriptByName,
|
|
11
11
|
validateScriptImports
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-6dp3ydxa.js";
|
|
13
13
|
import"./cli-epan13p1.js";
|
|
14
14
|
import"./cli-f14fvzag.js";
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-
|
|
15
|
+
import"./cli-g1re8r05.js";
|
|
16
|
+
import"./cli-se2p6rkb.js";
|
|
17
17
|
import"./cli-0258203w.js";
|
|
18
|
-
import"./cli-
|
|
18
|
+
import"./cli-nrkkknat.js";
|
|
19
19
|
import {
|
|
20
20
|
computeContentHash,
|
|
21
21
|
createSkill,
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
init_db,
|
|
27
27
|
updateSkill,
|
|
28
28
|
upsertSkillFiles
|
|
29
|
-
} from "./cli-
|
|
29
|
+
} from "./cli-50vbt00w.js";
|
|
30
30
|
import"./cli-xpxde7rm.js";
|
|
31
31
|
import"./cli-x23me2mg.js";
|
|
32
32
|
import"./cli-z2zcxes1.js";
|
|
33
33
|
import"./cli-zsspvvm2.js";
|
|
34
34
|
import"./cli-4j2mrzag.js";
|
|
35
|
-
import"./cli-
|
|
35
|
+
import"./cli-ccf9vy7q.js";
|
|
36
36
|
import"./cli-5dsbcjjw.js";
|
|
37
37
|
import"./cli-p9swy5t3.js";
|
|
38
38
|
|
|
@@ -4,26 +4,26 @@ import {
|
|
|
4
4
|
runRebootSweep,
|
|
5
5
|
startHeartbeat,
|
|
6
6
|
stopHeartbeat
|
|
7
|
-
} from "./cli-
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
7
|
+
} from "./cli-g74vpjp2.js";
|
|
8
|
+
import"./cli-3ty0t082.js";
|
|
9
|
+
import"./cli-jbcva0xj.js";
|
|
10
10
|
import"./cli-3dpj7atn.js";
|
|
11
|
-
import"./cli-
|
|
11
|
+
import"./cli-6dp3ydxa.js";
|
|
12
12
|
import"./cli-epan13p1.js";
|
|
13
13
|
import"./cli-f14fvzag.js";
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
14
|
+
import"./cli-g1re8r05.js";
|
|
15
|
+
import"./cli-se2p6rkb.js";
|
|
16
16
|
import"./cli-0258203w.js";
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
17
|
+
import"./cli-nrkkknat.js";
|
|
18
|
+
import"./cli-2f07m0xr.js";
|
|
19
19
|
import"./cli-t930g0xh.js";
|
|
20
|
-
import"./cli-
|
|
20
|
+
import"./cli-50vbt00w.js";
|
|
21
21
|
import"./cli-xpxde7rm.js";
|
|
22
22
|
import"./cli-x23me2mg.js";
|
|
23
23
|
import"./cli-z2zcxes1.js";
|
|
24
24
|
import"./cli-zsspvvm2.js";
|
|
25
25
|
import"./cli-4j2mrzag.js";
|
|
26
|
-
import"./cli-
|
|
26
|
+
import"./cli-ccf9vy7q.js";
|
|
27
27
|
import"./cli-5dsbcjjw.js";
|
|
28
28
|
import"./cli-9aryf9tv.js";
|
|
29
29
|
import"./cli-p9swy5t3.js";
|
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
stopWaitPoller,
|
|
22
22
|
subscribeWaitToBus,
|
|
23
23
|
validateTemplateVariables
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-jbcva0xj.js";
|
|
25
25
|
import"./cli-3dpj7atn.js";
|
|
26
|
-
import"./cli-
|
|
26
|
+
import"./cli-6dp3ydxa.js";
|
|
27
27
|
import"./cli-epan13p1.js";
|
|
28
28
|
import"./cli-f14fvzag.js";
|
|
29
|
-
import"./cli-
|
|
30
|
-
import"./cli-
|
|
29
|
+
import"./cli-g1re8r05.js";
|
|
30
|
+
import"./cli-se2p6rkb.js";
|
|
31
31
|
import"./cli-0258203w.js";
|
|
32
|
-
import"./cli-
|
|
33
|
-
import"./cli-
|
|
34
|
-
import"./cli-
|
|
32
|
+
import"./cli-nrkkknat.js";
|
|
33
|
+
import"./cli-2f07m0xr.js";
|
|
34
|
+
import"./cli-50vbt00w.js";
|
|
35
35
|
import {
|
|
36
36
|
interpolate
|
|
37
37
|
} from "./cli-xpxde7rm.js";
|
|
@@ -39,7 +39,7 @@ import"./cli-x23me2mg.js";
|
|
|
39
39
|
import"./cli-z2zcxes1.js";
|
|
40
40
|
import"./cli-zsspvvm2.js";
|
|
41
41
|
import"./cli-4j2mrzag.js";
|
|
42
|
-
import"./cli-
|
|
42
|
+
import"./cli-ccf9vy7q.js";
|
|
43
43
|
import"./cli-5dsbcjjw.js";
|
|
44
44
|
import {
|
|
45
45
|
workflowEventBus
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureAuthorizationTokenOrThrow,
|
|
3
3
|
listKeepAliveAuthorizations
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-nrkkknat.js";
|
|
5
|
+
import"./cli-50vbt00w.js";
|
|
6
6
|
import"./cli-xpxde7rm.js";
|
|
7
7
|
import"./cli-x23me2mg.js";
|
|
8
8
|
import"./cli-z2zcxes1.js";
|
|
9
9
|
import"./cli-zsspvvm2.js";
|
|
10
10
|
import"./cli-4j2mrzag.js";
|
|
11
|
-
import"./cli-
|
|
11
|
+
import"./cli-ccf9vy7q.js";
|
|
12
12
|
import"./cli-5dsbcjjw.js";
|
|
13
13
|
import {
|
|
14
14
|
__require
|
|
@@ -59,7 +59,7 @@ async function notifySlack(text) {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
try {
|
|
62
|
-
const { getSlackApp } = await import("./app-
|
|
62
|
+
const { getSlackApp } = await import("./app-5da78bd4.js");
|
|
63
63
|
const app = getSlackApp();
|
|
64
64
|
if (!app) {
|
|
65
65
|
console.warn("[OAuth Keepalive] Slack not available, cannot send notification");
|