@desplega.ai/agent-swarm 1.161.0 → 1.162.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 +3 -2
- package/dist/{acp-adapter-xx489vvb.js → acp-adapter-74m73ae9.js} +1 -1
- package/dist/{actions-ykjkn0m9.js → actions-4sr14gnt.js} +34 -31
- package/dist/{anthropic-messages-5qx80j9k.js → anthropic-messages-8xxrzky9.js} +22 -26
- package/dist/{app-0hdqa4k1.js → app-pt68fbwp.js} +13 -11
- package/dist/{artifact-3v5t9jtg.js → artifact-fey7dvj9.js} +3 -2
- package/dist/{assistant-am2g5g8a.js → assistant-cv3jytks.js} +37 -34
- package/dist/{azure-openai-responses-fszbkp0e.js → azure-openai-responses-f5cqsyj8.js} +15 -10
- package/dist/{boot-reembed-xy9t7avg.js → boot-reembed-4ht4gqth.js} +13 -11
- package/dist/{boot-reembed-gt5gjkt4.js → boot-reembed-nxpcvpj9.js} +12 -10
- package/dist/{boot-scrub-logs-9x0985y5.js → boot-scrub-logs-k93kyw8k.js} +9 -7
- package/dist/{boot-seeds-trv0d4vg.js → boot-seeds-1skcrs0e.js} +13 -10
- package/dist/{claude-adapter-jb6e1e54.js → claude-adapter-r5g0tzge.js} +23 -20
- package/dist/{claude-managed-setup-d1q9hv2b.js → claude-managed-setup-pkyrgshb.js} +3 -2
- package/dist/{claude-sdk-session-zga700s2.js → claude-sdk-session-jxyxnrwd.js} +5565 -5512
- package/dist/{cli-we0q7t0e.js → cli-2zy95vhm.js} +137 -64
- package/dist/{cli-35pj2yva.js → cli-4cwxn7gp.js} +38 -11
- package/dist/{cli-ad4qxm6j.js → cli-4dcpaefp.js} +2 -2
- package/dist/{cli-82c1pacn.js → cli-4x0csdjq.js} +71 -37
- package/dist/{cli-sqm3r5ps.js → cli-5bcd7sfy.js} +14 -18
- package/dist/{cli-d56tgd45.js → cli-5k6k8ta3.js} +2 -2
- package/dist/{cli-1er0rhz8.js → cli-5xhpb3kv.js} +15 -15
- package/dist/{cli-yrg7c73k.js → cli-7af8yhav.js} +10 -183
- package/dist/{cli-r6fsxc76.js → cli-7tre70zp.js} +513 -961
- package/dist/{cli-bh7jed3k.js → cli-8ev9xqnx.js} +34 -18
- package/dist/cli-bsky8g7w.js +449 -0
- package/dist/{cli-hn04t9db.js → cli-cebmgwsc.js} +14 -10
- package/dist/{cli-cfkrztza.js → cli-cvatsam7.js} +2 -2
- package/dist/{cli-2658f6at.js → cli-cvk6yzw5.js} +6 -8
- package/dist/{cli-ptr8h7kp.js → cli-eg0b3p0k.js} +5 -218
- package/dist/{cli-zb6xbk61.js → cli-g739zqzt.js} +4 -4
- package/dist/{cli-dv6cdjs2.js → cli-gd4favx9.js} +28 -7
- package/dist/{cli-5p3x4zna.js → cli-gpqpmns7.js} +2 -2
- package/dist/{cli-5nbmpy8w.js → cli-hb5c2x5y.js} +1 -1
- package/dist/{cli-jpf7e1zq.js → cli-hmsw1gpy.js} +3 -3
- package/dist/{cli-1cz0c18q.js → cli-jf7wmv1r.js} +2521 -733
- package/dist/{cli-qwsnmjdd.js → cli-jxs2ygaw.js} +168 -61
- package/dist/cli-kdkwd3yr.js +615 -0
- package/dist/{cli-hgmnf38m.js → cli-kh04eqwe.js} +1 -1
- package/dist/{cli-0383bp7f.js → cli-kp42yek0.js} +425 -90
- package/dist/{cli-ybgv4kw2.js → cli-mbssg1xv.js} +9 -2
- package/dist/{cli-jsp14b6c.js → cli-mzfth0bp.js} +38 -1
- package/dist/{cli-8g6mc14k.js → cli-nq7yqw7b.js} +16 -5
- package/dist/{cli-ee8bc46j.js → cli-nt8hecg9.js} +33 -32
- package/dist/{cli-9s68w752.js → cli-p0r8sxj5.js} +1 -1
- package/dist/{cli-58e8yr0d.js → cli-pkd6s2wy.js} +4 -2
- package/dist/{cli-17xpf7cm.js → cli-q24re23n.js} +6 -4
- package/dist/cli-qjjvzwzd.js +222 -0
- package/dist/cli-qrgt5bqf.js +189 -0
- package/dist/{cli-et8m9xsv.js → cli-rfjw9jw2.js} +22 -10
- package/dist/{cli-798vkbks.js → cli-rj0gqwwp.js} +2 -2
- package/dist/{cli-121ph74b.js → cli-rnyzn44p.js} +1 -1
- package/dist/{cli-vnnz5ncg.js → cli-s3hwpt9v.js} +95 -16
- package/dist/{cli-7119ja3w.js → cli-sptrj5f5.js} +2 -2
- package/dist/{cli-a8c82p2t.js → cli-sqvfa090.js} +13 -6
- package/dist/{cli-phfg8vy8.js → cli-swfmp1fx.js} +26 -26
- package/dist/{cli-nsdxtcbg.js → cli-tcen9p5w.js} +8 -5
- package/dist/{cli-9m03pzga.js → cli-vc9bp061.js} +5 -5
- package/dist/{cli-rtx9dygp.js → cli-vxe6qa4h.js} +1 -1
- package/dist/{cli-ecfxwnyb.js → cli-vy3ed88x.js} +1 -1
- package/dist/{cli-0c7ata9h.js → cli-vyqs9ya8.js} +6 -6
- package/dist/cli-wbvnn6tk.js +861 -0
- package/dist/{cli-kgd3p0bm.js → cli-wjgs5wxe.js} +6 -6
- package/dist/cli-wxkkd0e0.js +33 -0
- package/dist/{cli-akfj32vj.js → cli-xqpk3rp7.js} +5 -4
- package/dist/cli-zp38xvtm.js +9487 -0
- package/dist/{cli-3zc55ctx.js → cli-zvhd3f64.js} +2 -2
- package/dist/{cli-ze1d3wzv.js → cli-zxqx25nz.js} +5 -5
- package/dist/cli.js +32 -25
- package/dist/{cloudflare-workers-ai-system-one-k6fbxw9d.js → cloudflare-workers-ai-system-one-k8ddqjkq.js} +8 -6
- package/dist/{codex-adapter-04v97vep.js → codex-adapter-esvmnhn7.js} +13 -13
- package/dist/{codex-hook-20me6byw.js → codex-hook-m73jmqgx.js} +19 -3
- package/dist/{codex-session-runner-ax69mqq3.js → codex-session-runner-ban9excr.js} +13 -13
- package/dist/{commands-18gy08n1.js → commands-75413p2n.js} +9 -7
- package/dist/{db-d2pvjpyt.js → db-7f5pecwg.js} +11 -7
- package/dist/{dispatcher-8wbwyzjg.js → dispatcher-fh9at8nz.js} +33 -30
- package/dist/{dsh-adapter-ysqk9snv.js → dsh-adapter-wpze65d4.js} +3 -3
- package/dist/{e2b-esmt1r16.js → e2b-gjgdjp91.js} +10 -9
- package/dist/{pi-logo-animation-e9a0t68z.js → easter-egg-3d-3w5c2n4c.js} +122 -68
- package/dist/{execute-cmagrbrz.js → execute-f50wg9nh.js} +29 -6
- package/dist/{google-generative-ai-k6n5nbpp.js → google-generative-ai-jxxpnegy.js} +2 -2
- package/dist/{google-vertex-44xxtcvp.js → google-vertex-x7q1angm.js} +5 -5
- package/dist/{handlers-6b69m5kp.js → handlers-w13787bb.js} +36 -33
- package/dist/{hook-srnkt0hb.js → hook-46g1jrvx.js} +28 -15
- package/dist/{hook-k3mydf2n.js → hook-4tpts2ry.js} +20 -17
- package/dist/{http-hrf80ca1.js → http-19pzbfrt.js} +964 -176
- package/dist/{index-9rxdvj6w.js → index-8fd4dm4h.js} +34 -31
- package/dist/{index-1asbaj62.js → index-dqmp15bq.js} +35 -32
- package/dist/{index-45evq4ee.js → index-qb4q1y3e.js} +33 -30
- package/dist/{index-k4nj18qs.js → index-s75wc4wd.js} +12 -10
- package/dist/{index-xmevk2b9.js → index-scptvdxg.js} +27 -25
- package/dist/{keepalive-sfdz6ksp.js → keepalive-xa5ts9cd.js} +11 -9
- package/dist/{lead-ej91e9hw.js → lead-qp4xkvjq.js} +45 -41
- package/dist/{maintenance-80dnd7ke.js → maintenance-rm5885hm.js} +13 -11
- package/dist/{mistral-conversations-pc3ntnxt.js → mistral-conversations-rw7fbt22.js} +4 -4
- package/dist/{node-a5e00qhp.js → node-8zkdq42h.js} +834 -833
- package/dist/{oauth-refresh-sweep-m1etk2mx.js → oauth-refresh-sweep-1csdfebf.js} +10 -8
- package/dist/{onboard-0q8sdfqc.js → onboard-r6b78cs4.js} +10 -10
- package/dist/{openai-codex-responses-n7n683p2.js → openai-codex-responses-efvrgrq3.js} +4 -4
- package/dist/{openai-completions-jpaj5g2b.js → openai-completions-bbbrrz4z.js} +12 -8
- package/dist/{openai-responses-9a3nme9j.js → openai-responses-9jjyrcm1.js} +15 -10
- package/dist/{opencode-adapter-4wcgmvgf.js → opencode-adapter-kb3g6pkf.js} +2 -2
- package/dist/{otel-impl-hnqm9mxq.js → otel-impl-0y9knpky.js} +5 -5
- package/dist/{pi-mono-adapter-d6sqm9wr.js → pi-mono-adapter-z6s1bme2.js} +100 -19
- package/dist/{pricing-refresh-y60z64pm.js → pricing-refresh-mth26tgp.js} +11 -9
- package/dist/{rbac-roles-8pa0754b.js → rbac-roles-kwntb23q.js} +13 -9
- package/dist/rbac-roles-vpk4ebm8.js +45 -0
- package/dist/{registry-v5wytg0s.js → registry-km6t1jd2.js} +1 -1
- package/dist/{render-v2-418s1vj7.js → render-v2-hcm7h00y.js} +13 -11
- package/dist/{runtime-3pknc168.js → runtime-vfjsfsc5.js} +4 -4
- package/dist/{setup-yghdkj4x.js → setup-hbyzd65h.js} +2 -2
- package/dist/{virtual-modules-jcceevt5.js → virtual-modules-9bv7ry91.js} +9 -8
- package/dist/{work-objects-j1sz20v9.js → work-objects-m09sxnhe.js} +36 -33
- package/dist/{worker-d4gcvkjt.js → worker-0h35rvk4.js} +45 -41
- package/openapi.json +491 -12
- package/package.json +13 -6
- package/src/be/api-drain.ts +184 -0
- package/src/be/db/tasks/read.ts +31 -6
- package/src/be/db/tasks/write.ts +5 -4
- package/src/be/db.ts +42 -18
- package/src/be/memory/link-resolver.ts +29 -3
- package/src/be/migrations/192_favorites_agent_fs_path.sql +36 -0
- package/src/be/onboarding.ts +7 -1
- package/src/be/seed-prompt-templates.ts +1 -0
- package/src/be/swarm-config-guard.ts +35 -16
- package/src/be/task-citations.ts +11 -5
- package/src/be/users.ts +3 -0
- package/src/cli.tsx +3 -2
- package/src/comb/agent-fs.ts +39 -0
- package/src/comb/config.ts +37 -0
- package/src/comb/markers.ts +37 -0
- package/src/comb/review-batch.ts +486 -0
- package/src/comb/templates.ts +88 -0
- package/src/commands/context-preamble.ts +4 -1
- package/src/commands/hook.ts +2 -1
- package/src/commands/runner.ts +262 -68
- package/src/commands/templates.ts +10 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/fs/agent-fs-provider.ts +106 -2
- package/src/heartbeat/heartbeat.ts +4 -0
- package/src/hooks/codex-hook.ts +25 -1
- package/src/hooks/hook.ts +13 -0
- package/src/hooks/pr-body-guard.ts +983 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/assets.ts +5 -17
- package/src/http/comb.ts +131 -0
- package/src/http/core.ts +2 -1
- package/src/http/fs.ts +9 -17
- package/src/http/index.ts +23 -9
- package/src/http/onboarding.ts +21 -2
- package/src/http/poll.ts +30 -3
- package/src/http/realtime.ts +62 -0
- package/src/http/request-principal.ts +22 -0
- package/src/http/status.ts +34 -2
- package/src/kv-reserved-namespaces.ts +10 -5
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/pi-mono-adapter.ts +123 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +4 -0
- package/src/realtime/auth.ts +63 -1
- package/src/realtime/tickets.ts +52 -0
- package/src/realtime/transport.ts +51 -22
- package/src/scripts-runtime/types/swarm-extension.d.ts +3 -1
- package/src/telemetry-context.ts +175 -0
- package/src/telemetry-contract/EVENTS.md +81 -0
- package/src/telemetry-contract/SOURCE.json +9 -0
- package/src/telemetry-contract/catalog.json +1335 -0
- package/src/telemetry-contract/index.ts +60 -0
- package/src/telemetry-contract/types.gen.ts +1971 -0
- package/src/telemetry-identity.ts +129 -0
- package/src/telemetry-snapshot.ts +211 -0
- package/src/telemetry-trigger.ts +125 -0
- package/src/telemetry-types.typetest.ts +40 -0
- package/src/telemetry.ts +271 -67
- package/src/tests/api-drain-e2e.test.ts +249 -0
- package/src/tests/api-drain-worker-e2e.test.ts +216 -0
- package/src/tests/api-drain.test.ts +351 -0
- package/src/tests/comb-config-guard.test.ts +38 -0
- package/src/tests/comb-links.test.ts +162 -0
- package/src/tests/comb-markers.test.ts +68 -0
- package/src/tests/comb-review-batch.test.ts +770 -0
- package/src/tests/comb-status.test.ts +152 -0
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/favorites-agent-fs-path.test.ts +226 -0
- package/src/tests/memory-link-resolver.test.ts +34 -0
- package/src/tests/onboarding.test.ts +108 -0
- package/src/tests/pi-mono-adapter.test.ts +265 -2
- package/src/tests/pr-body-leaks.test.ts +789 -0
- package/src/tests/preload.ts +8 -0
- package/src/tests/rbac-engine.test.ts +19 -0
- package/src/tests/realtime-room-auth.test.ts +104 -1
- package/src/tests/realtime-tickets.test.ts +74 -0
- package/src/tests/realtime-transport.test.ts +131 -4
- package/src/tests/runner-api-drain.test.ts +301 -0
- package/src/tests/runner-fallback-output.test.ts +61 -0
- package/src/tests/runner-fenced-json-output.test.ts +178 -0
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/send-task-requested-by.test.ts +133 -15
- package/src/tests/task-lifecycle-telemetry.test.ts +8 -3
- package/src/tests/telemetry-context.test.ts +314 -0
- package/src/tests/telemetry-init.test.ts +51 -19
- package/src/tests/telemetry-snapshot.test.ts +229 -0
- package/src/tests/telemetry-trigger.test.ts +200 -0
- package/src/tests/template-registry-helpers.ts +1 -0
- package/src/tests/workflow-agent-task-retry.test.ts +363 -0
- package/src/tests/workflow-definition-telemetry.test.ts +4 -4
- package/src/tools/poll-task.ts +20 -1
- package/src/tools/send-task.ts +9 -1
- package/src/tools/task-action.ts +11 -0
- package/src/types.ts +2 -1
- package/src/utils/api-drain.ts +24 -0
- package/src/utils/constants.ts +57 -16
- package/src/utils/pr-body-leaks.ts +172 -0
- package/src/utils/task-attachment-links.ts +14 -8
- package/src/workflows/recovery.ts +26 -1
- package/src/workflows/resume.ts +31 -4
- package/src/workflows/task-step-routing.ts +75 -2
- package/tsconfig.json +3 -0
- package/dist/cli-tjf4cn8z.js +0 -9119
- package/dist/cli-tsk3nz8a.js +0 -582
- package/dist/{cli-t6v2ah3r.js → cli-twrh04ap.js} +3 -3
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_registry,
|
|
3
|
+
registerTemplate
|
|
4
|
+
} from "./cli-qjjvzwzd.js";
|
|
1
5
|
import {
|
|
2
6
|
init_env_flag,
|
|
3
7
|
parseEnvFlag
|
|
@@ -14,223 +18,6 @@ var init_steering_enabled = __esm(() => {
|
|
|
14
18
|
init_env_flag();
|
|
15
19
|
});
|
|
16
20
|
|
|
17
|
-
// src/utils/template.ts
|
|
18
|
-
function findInterpolationTokens(template) {
|
|
19
|
-
return Array.from(template.matchAll(INTERPOLATION_TOKEN_RE), (match) => match[1].trim());
|
|
20
|
-
}
|
|
21
|
-
function interpolate(template, ctx) {
|
|
22
|
-
const unresolved = [];
|
|
23
|
-
const result = template.replace(INTERPOLATION_TOKEN_RE, (_match, path) => {
|
|
24
|
-
const keys = path.trim().split(".");
|
|
25
|
-
let value = ctx;
|
|
26
|
-
for (const key of keys) {
|
|
27
|
-
if (value == null || typeof value !== "object") {
|
|
28
|
-
unresolved.push(path.trim());
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
value = value[key];
|
|
32
|
-
}
|
|
33
|
-
if (value == null) {
|
|
34
|
-
unresolved.push(path.trim());
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
return typeof value === "object" ? safeStringify(value) : String(value);
|
|
38
|
-
});
|
|
39
|
-
return { result, unresolved };
|
|
40
|
-
}
|
|
41
|
-
function safeStringify(value) {
|
|
42
|
-
try {
|
|
43
|
-
return JSON.stringify(value);
|
|
44
|
-
} catch {
|
|
45
|
-
return "[Circular]";
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function resolvePath(path, ctx) {
|
|
49
|
-
const keys = path.trim().split(".");
|
|
50
|
-
let value = ctx;
|
|
51
|
-
for (const key of keys) {
|
|
52
|
-
if (value == null || typeof value !== "object")
|
|
53
|
-
return { found: false };
|
|
54
|
-
value = value[key];
|
|
55
|
-
}
|
|
56
|
-
if (value === undefined)
|
|
57
|
-
return { found: false };
|
|
58
|
-
return { found: true, value };
|
|
59
|
-
}
|
|
60
|
-
function deepInterpolate(value, ctx, options = {}) {
|
|
61
|
-
const allUnresolved = [];
|
|
62
|
-
function walk(v) {
|
|
63
|
-
if (typeof v === "string") {
|
|
64
|
-
const exactMatch = options.preserveRawTokens ? EXACT_TOKEN_RE.exec(v) : null;
|
|
65
|
-
if (exactMatch?.[1]) {
|
|
66
|
-
const path = exactMatch[1].trim();
|
|
67
|
-
const resolved = resolvePath(path, ctx);
|
|
68
|
-
if (!resolved.found) {
|
|
69
|
-
allUnresolved.push(path);
|
|
70
|
-
return "";
|
|
71
|
-
}
|
|
72
|
-
return resolved.value;
|
|
73
|
-
}
|
|
74
|
-
const { result, unresolved } = interpolate(v, ctx);
|
|
75
|
-
allUnresolved.push(...unresolved);
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
if (Array.isArray(v))
|
|
79
|
-
return v.map(walk);
|
|
80
|
-
if (v != null && typeof v === "object") {
|
|
81
|
-
const out = {};
|
|
82
|
-
for (const [k, val] of Object.entries(v)) {
|
|
83
|
-
out[k] = walk(val);
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
return v;
|
|
88
|
-
}
|
|
89
|
-
return { value: walk(value), unresolved: allUnresolved };
|
|
90
|
-
}
|
|
91
|
-
var INTERPOLATION_TOKEN_RE, EXACT_TOKEN_RE;
|
|
92
|
-
var init_template = __esm(() => {
|
|
93
|
-
INTERPOLATION_TOKEN_RE = /\{\{([^}]+)\}\}/g;
|
|
94
|
-
EXACT_TOKEN_RE = /^\{\{([^}]+)\}\}$/;
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// src/prompts/registry.ts
|
|
98
|
-
function registerTemplate(def) {
|
|
99
|
-
templateDefinitions.set(def.eventType, def);
|
|
100
|
-
}
|
|
101
|
-
function getTemplateDefinition(eventType) {
|
|
102
|
-
return templateDefinitions.get(eventType);
|
|
103
|
-
}
|
|
104
|
-
function getAllTemplateDefinitions() {
|
|
105
|
-
return Array.from(templateDefinitions.values());
|
|
106
|
-
}
|
|
107
|
-
var templateDefinitions;
|
|
108
|
-
var init_registry = __esm(() => {
|
|
109
|
-
templateDefinitions = new Map;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// src/prompts/resolver.ts
|
|
113
|
-
function configureDbResolver(fn) {
|
|
114
|
-
dbResolverFn = fn;
|
|
115
|
-
}
|
|
116
|
-
function configureHttpResolver(apiUrl, apiKey) {
|
|
117
|
-
httpResolverConfig = { apiUrl, apiKey };
|
|
118
|
-
}
|
|
119
|
-
async function resolveTemplateViaHttp(eventType, variables, options) {
|
|
120
|
-
const config = httpResolverConfig;
|
|
121
|
-
const url = `${config.apiUrl}/api/prompt-templates/render`;
|
|
122
|
-
try {
|
|
123
|
-
const resp = await fetch(url, {
|
|
124
|
-
method: "POST",
|
|
125
|
-
headers: {
|
|
126
|
-
Authorization: `Bearer ${config.apiKey}`,
|
|
127
|
-
"Content-Type": "application/json"
|
|
128
|
-
},
|
|
129
|
-
body: JSON.stringify({
|
|
130
|
-
eventType,
|
|
131
|
-
variables,
|
|
132
|
-
agentId: options.agentId,
|
|
133
|
-
repoId: options.repoId
|
|
134
|
-
})
|
|
135
|
-
});
|
|
136
|
-
if (!resp.ok) {
|
|
137
|
-
console.warn(`[prompt-resolver] HTTP render failed (${resp.status}), falling back to code defaults`);
|
|
138
|
-
return resolveTemplateFromCode(eventType, variables);
|
|
139
|
-
}
|
|
140
|
-
return await resp.json();
|
|
141
|
-
} catch (err) {
|
|
142
|
-
console.warn(`[prompt-resolver] HTTP render error, falling back to code defaults:`, err instanceof Error ? err.message : err);
|
|
143
|
-
return resolveTemplateFromCode(eventType, variables);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function resolveTemplateFromCode(eventType, variables) {
|
|
147
|
-
const definition = getTemplateDefinition(eventType);
|
|
148
|
-
const header = definition?.header ?? "";
|
|
149
|
-
const body = definition?.defaultBody ?? "";
|
|
150
|
-
const composed = header ? `${header}
|
|
151
|
-
|
|
152
|
-
${body}` : body;
|
|
153
|
-
const { result: text, unresolved } = interpolate(composed, variables);
|
|
154
|
-
return { text, skipped: false, unresolved };
|
|
155
|
-
}
|
|
156
|
-
function resolveTemplate(eventType, variables, options = {}) {
|
|
157
|
-
if (httpResolverConfig) {
|
|
158
|
-
return resolveTemplateFromCode(eventType, variables);
|
|
159
|
-
}
|
|
160
|
-
return resolveTemplateViaDb(eventType, variables, options);
|
|
161
|
-
}
|
|
162
|
-
async function resolveTemplateAsync(eventType, variables, options = {}) {
|
|
163
|
-
if (httpResolverConfig) {
|
|
164
|
-
return resolveTemplateViaHttp(eventType, variables, options);
|
|
165
|
-
}
|
|
166
|
-
return resolveTemplateViaDb(eventType, variables, options);
|
|
167
|
-
}
|
|
168
|
-
function resolveTemplateViaDb(eventType, variables, options) {
|
|
169
|
-
const definition = getTemplateDefinition(eventType);
|
|
170
|
-
const header = definition?.header ?? "";
|
|
171
|
-
const defaultBody = definition?.defaultBody ?? "";
|
|
172
|
-
const dbResult = dbResolverFn?.(eventType, options.agentId, options.repoId) ?? null;
|
|
173
|
-
if (dbResult && "skip" in dbResult) {
|
|
174
|
-
return { text: "", skipped: true, unresolved: [] };
|
|
175
|
-
}
|
|
176
|
-
let body;
|
|
177
|
-
let templateId;
|
|
178
|
-
let scope;
|
|
179
|
-
if (dbResult && "template" in dbResult) {
|
|
180
|
-
body = dbResult.template.body;
|
|
181
|
-
templateId = dbResult.template.id;
|
|
182
|
-
scope = dbResult.template.scope;
|
|
183
|
-
} else {
|
|
184
|
-
body = defaultBody;
|
|
185
|
-
}
|
|
186
|
-
body = expandTemplateRefs(body, variables, options, new Set, 0);
|
|
187
|
-
const composed = header ? `${header}
|
|
188
|
-
|
|
189
|
-
${body}` : body;
|
|
190
|
-
const { result: text, unresolved } = interpolate(composed, variables);
|
|
191
|
-
return {
|
|
192
|
-
text,
|
|
193
|
-
templateId,
|
|
194
|
-
scope,
|
|
195
|
-
skipped: false,
|
|
196
|
-
unresolved
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function expandTemplateRefs(text, variables, options, visited, depth) {
|
|
200
|
-
if (depth > MAX_TEMPLATE_REF_DEPTH) {
|
|
201
|
-
return text;
|
|
202
|
-
}
|
|
203
|
-
return text.replace(TEMPLATE_REF_REGEX, (fullMatch, referencedId) => {
|
|
204
|
-
if (visited.has(referencedId)) {
|
|
205
|
-
console.warn(`[prompt-resolver] Cycle detected for template reference "${referencedId}", leaving token as-is`);
|
|
206
|
-
return fullMatch;
|
|
207
|
-
}
|
|
208
|
-
if (depth + 1 > MAX_TEMPLATE_REF_DEPTH) {
|
|
209
|
-
console.warn(`[prompt-resolver] Max template reference depth (${MAX_TEMPLATE_REF_DEPTH}) exceeded for "${referencedId}", leaving token as-is`);
|
|
210
|
-
return fullMatch;
|
|
211
|
-
}
|
|
212
|
-
const refDef = getTemplateDefinition(referencedId);
|
|
213
|
-
const refDefaultBody = refDef?.defaultBody ?? "";
|
|
214
|
-
const refDbResult = dbResolverFn?.(referencedId, options.agentId, options.repoId) ?? null;
|
|
215
|
-
if (refDbResult && "skip" in refDbResult) {
|
|
216
|
-
return fullMatch;
|
|
217
|
-
}
|
|
218
|
-
const refBody = refDbResult && "template" in refDbResult ? refDbResult.template.body : refDefaultBody;
|
|
219
|
-
if (!refBody) {
|
|
220
|
-
return fullMatch;
|
|
221
|
-
}
|
|
222
|
-
const newVisited = new Set(visited);
|
|
223
|
-
newVisited.add(referencedId);
|
|
224
|
-
return expandTemplateRefs(refBody, variables, options, newVisited, depth + 1);
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
var dbResolverFn = null, httpResolverConfig = null, MAX_TEMPLATE_REF_DEPTH = 3, TEMPLATE_REF_REGEX;
|
|
228
|
-
var init_resolver = __esm(() => {
|
|
229
|
-
init_template();
|
|
230
|
-
init_registry();
|
|
231
|
-
TEMPLATE_REF_REGEX = /\{\{@template\[([^\]]+)\]\}\}/g;
|
|
232
|
-
});
|
|
233
|
-
|
|
234
21
|
// src/prompts/session-templates.ts
|
|
235
22
|
var communicationBody = `
|
|
236
23
|
## How you write
|
|
@@ -701,4 +488,4 @@ If this task reveals new stable communication preferences for this requester, pe
|
|
|
701
488
|
});
|
|
702
489
|
});
|
|
703
490
|
|
|
704
|
-
export { isSteeringEnabled, init_steering_enabled
|
|
491
|
+
export { init_session_templates, isSteeringEnabled, init_steering_enabled };
|
|
@@ -8,13 +8,10 @@ import {
|
|
|
8
8
|
resolveGrammarConstrainedSampling,
|
|
9
9
|
resolveJsonSchemaStrictSampling,
|
|
10
10
|
transformMessages
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-mbssg1xv.js";
|
|
12
12
|
import {
|
|
13
13
|
sanitizeSurrogates
|
|
14
14
|
} from "./cli-y2apkfe2.js";
|
|
15
|
-
import {
|
|
16
|
-
parseStreamingJson
|
|
17
|
-
} from "./cli-1m2e086m.js";
|
|
18
15
|
import {
|
|
19
16
|
calculateCost,
|
|
20
17
|
getSystemMessageText,
|
|
@@ -22,6 +19,9 @@ import {
|
|
|
22
19
|
resolveTranscript,
|
|
23
20
|
resolveTranscriptTools
|
|
24
21
|
} from "./cli-ykk5jaax.js";
|
|
22
|
+
import {
|
|
23
|
+
parseStreamingJson
|
|
24
|
+
} from "./cli-1m2e086m.js";
|
|
25
25
|
|
|
26
26
|
// node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
|
|
27
27
|
function encodeTextSignatureV1(id, phase) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_env_flag,
|
|
3
|
+
isEnvFlagEnabled
|
|
4
|
+
} from "./cli-ej6gbxfb.js";
|
|
1
5
|
import {
|
|
2
6
|
__esm
|
|
3
7
|
} from "./cli-bc05qbss.js";
|
|
@@ -29,7 +33,7 @@ function getAgentFsDefaultDriveId() {
|
|
|
29
33
|
const raw = process.env.AGENT_FS_DEFAULT_DRIVE_ID?.trim();
|
|
30
34
|
return raw || undefined;
|
|
31
35
|
}
|
|
32
|
-
function
|
|
36
|
+
function agentFsFileRoute(opts) {
|
|
33
37
|
const path = opts.path?.trim();
|
|
34
38
|
if (!path)
|
|
35
39
|
return null;
|
|
@@ -40,14 +44,31 @@ function buildAgentFsLiveUrl(opts) {
|
|
|
40
44
|
const driveId = hasRowId ? rowDriveId : getAgentFsDefaultDriveId();
|
|
41
45
|
if (!orgId || !driveId)
|
|
42
46
|
return null;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const segments = path.replace(/^\/+/, "").split("/");
|
|
48
|
+
if (segments.some((segment) => DOT_SEGMENT_RE.test(segment)))
|
|
49
|
+
return null;
|
|
50
|
+
const encodedPath = segments.map((segment) => encodeURIComponent(segment).replace(/%25([0-9a-f]{2})/gi, "%$1")).join("/");
|
|
51
|
+
return `${orgId}/${driveId}/${encodedPath}`;
|
|
52
|
+
}
|
|
53
|
+
function buildAgentFsLiveUrl(opts) {
|
|
54
|
+
const route = agentFsFileRoute(opts);
|
|
55
|
+
return route ? `${getAgentFsLiveUrl()}/file/~/${route}` : null;
|
|
56
|
+
}
|
|
57
|
+
function isCombEnabled() {
|
|
58
|
+
const apiUrl = process.env.AGENT_FS_API_URL?.trim().replace(/\/+$/, "");
|
|
59
|
+
return isEnvFlagEnabled("COMB_ENABLED", false) && Boolean(apiUrl);
|
|
60
|
+
}
|
|
61
|
+
function buildCombFileUrl(opts) {
|
|
62
|
+
if (!isCombEnabled() || getConfiguredAppUrls().length === 0)
|
|
63
|
+
return null;
|
|
64
|
+
const route = agentFsFileRoute(opts);
|
|
65
|
+
return route ? `${getAppUrl()}/file/~/${route}` : null;
|
|
47
66
|
}
|
|
48
|
-
var MAX_PROFILE_FILE_LENGTH, DEFAULT_APP_URL = "https://app.agent-swarm.dev", DEFAULT_AGENT_FS_LIVE_URL = "https://live.agent-fs.dev";
|
|
67
|
+
var MAX_PROFILE_FILE_LENGTH, DEFAULT_APP_URL = "https://app.agent-swarm.dev", DEFAULT_AGENT_FS_LIVE_URL = "https://live.agent-fs.dev", DOT_SEGMENT_RE;
|
|
49
68
|
var init_constants = __esm(() => {
|
|
69
|
+
init_env_flag();
|
|
50
70
|
MAX_PROFILE_FILE_LENGTH = 256 * 1024;
|
|
71
|
+
DOT_SEGMENT_RE = /^(?:\.|%2e){1,2}$/i;
|
|
51
72
|
});
|
|
52
73
|
|
|
53
|
-
export { MAX_PROFILE_FILE_LENGTH, getConfiguredAppUrls, getAppUrl, getMcpBaseUrl, getPublicMcpBaseUrl, buildAgentFsLiveUrl, init_constants };
|
|
74
|
+
export { MAX_PROFILE_FILE_LENGTH, getConfiguredAppUrls, getAppUrl, getMcpBaseUrl, getPublicMcpBaseUrl, getAgentFsLiveUrl, getAgentFsDefaultOrgId, getAgentFsDefaultDriveId, agentFsFileRoute, buildAgentFsLiveUrl, isCombEnabled, buildCombFileUrl, init_constants };
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
linkIdentity,
|
|
5
5
|
recordUnmappedIdentity,
|
|
6
6
|
resolveIdentity
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-kp42yek0.js";
|
|
8
8
|
import {
|
|
9
9
|
getKv,
|
|
10
10
|
init_db,
|
|
11
11
|
upsertKv
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-jf7wmv1r.js";
|
|
13
13
|
|
|
14
14
|
// src/slack/enrich.ts
|
|
15
15
|
init_db();
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getTextOutput,
|
|
4
4
|
replaceTabs,
|
|
5
5
|
str
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-p0r8sxj5.js";
|
|
7
7
|
import {
|
|
8
8
|
Container,
|
|
9
9
|
Spacer,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getDocsPath,
|
|
12
12
|
highlightCode,
|
|
13
13
|
keyHint
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-s3hwpt9v.js";
|
|
15
15
|
import {
|
|
16
16
|
exports_typebox
|
|
17
17
|
} from "./cli-rb9m6rpe.js";
|
|
@@ -613,7 +613,7 @@ function createToolDefinitionFromAgentTool(tool) {
|
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.lazy.js
|
|
616
|
-
var loadCodemodeExecutor = () => import("./execute-
|
|
616
|
+
var loadCodemodeExecutor = () => import("./execute-f50wg9nh.js");
|
|
617
617
|
|
|
618
618
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js
|
|
619
619
|
var CODE_PREVIEW_LINES = 10;
|