@desplega.ai/agent-swarm 1.165.0 → 1.166.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/dist/{acp-adapter-w6zws6me.js → acp-adapter-yzfxn8vj.js} +4 -4
- package/dist/{actions-jna0b3wm.js → actions-qz3m692w.js} +20 -24
- package/dist/{amp-adapter-0eve81pz.js → amp-adapter-j1xbmsqz.js} +4 -4
- package/dist/{app-75hm5cfa.js → app-43vrdmv8.js} +6 -7
- package/dist/{assistant-yzd51j33.js → assistant-ertffmka.js} +21 -25
- package/dist/{boot-reembed-z158xq32.js → boot-reembed-998jtpdg.js} +9 -12
- package/dist/{boot-reembed-2ex2mcsh.js → boot-reembed-s7k7c6v2.js} +10 -12
- package/dist/boot-scrub-sweep-nepsk4t1.js +211 -0
- package/dist/{boot-seeds-2bmnh18p.js → boot-seeds-vvzs1zhk.js} +8 -8
- package/dist/{claude-adapter-jbj1mycz.js → claude-adapter-2zvmekrp.js} +9 -11
- package/dist/{claude-managed-adapter-17ggz09t.js → claude-managed-adapter-s49wbk8t.js} +3 -3
- package/dist/{claude-managed-setup-ptm1nzm2.js → claude-managed-setup-cvhqq8qn.js} +4 -4
- package/dist/{claude-sdk-session-9re1g7r2.js → claude-sdk-session-kkbxtw5q.js} +2618 -2600
- package/dist/{cli-k6xx3pve.js → cli-0nhdwxd5.js} +4 -4
- package/dist/{cli-n9ehc28t.js → cli-0qjcsxgz.js} +4 -4
- package/dist/{cli-zn2v3t8v.js → cli-3ddybbbx.js} +1 -1
- package/dist/{cli-5anb0ev3.js → cli-3qn4r334.js} +71 -14
- package/dist/{cli-1kzfvd1z.js → cli-4r1sjfc4.js} +9 -5
- package/dist/{cli-ba66wyhy.js → cli-66zh26sp.js} +6 -6
- package/dist/{cli-9xb89xca.js → cli-68r1j4sg.js} +6 -6
- package/dist/{cli-xnzrzets.js → cli-8kgvmkak.js} +2 -2
- package/dist/{cli-28smfvbn.js → cli-8t229cmr.js} +5 -5
- package/dist/{cli-9866bd07.js → cli-aqcey741.js} +1 -1
- package/dist/{cli-90v942q1.js → cli-cpfmqz3n.js} +8 -8
- package/dist/{cli-50eg13rj.js → cli-df56tqdw.js} +459 -282
- package/dist/{cli-8gpbwy09.js → cli-dw2q9f7g.js} +5 -5
- package/dist/{cli-0n4fasz0.js → cli-ecknp7p1.js} +15 -15
- package/dist/{cli-xb3c6aat.js → cli-f2n17zhp.js} +1 -1
- package/dist/{cli-ftry7975.js → cli-feh3dkah.js} +1 -1
- package/dist/{cli-amwhs8h2.js → cli-fn697bnt.js} +2 -2
- package/dist/{cli-prt9emct.js → cli-gt8azyet.js} +3 -3
- package/dist/{cli-59jn5twa.js → cli-h3x613ze.js} +2 -2
- package/dist/{cli-mmzwwptd.js → cli-hf5s9pgf.js} +1 -1
- package/dist/cli-j2jbr8af.js +516 -0
- package/dist/{cli-wfajtmf7.js → cli-jhm6hzjn.js} +593 -10
- package/dist/{cli-xtgtyafv.js → cli-jvj6a0cv.js} +190 -439
- package/dist/{cli-hpryr6em.js → cli-mb75wpxf.js} +1 -1
- package/dist/{cli-420bdgw0.js → cli-mv2520nm.js} +1 -1
- package/dist/{cli-pjxnr1jn.js → cli-mwegs4af.js} +3 -3
- package/dist/{cli-5b2fjjzh.js → cli-p4ztb80h.js} +2 -2
- package/dist/{cli-e7t4snpa.js → cli-rggdq8wq.js} +4 -4
- package/dist/{cli-bdv39kgj.js → cli-rsy933yz.js} +5 -5
- package/dist/{cli-gh5yqzpe.js → cli-v2a8x45d.js} +2 -2
- package/dist/{cli-bns5c8k9.js → cli-vzc73wet.js} +43 -47
- package/dist/cli-wt7ccy4r.js +2654 -0
- package/dist/{cli-j0pdrmwg.js → cli-x7kpr72a.js} +3 -3
- package/dist/{cli-x7afk5wm.js → cli-xvc3q9br.js} +1 -1
- package/dist/{cli-9s3h836g.js → cli-xvdgasgy.js} +1 -1
- package/dist/{cli-zvckv750.js → cli-y59h2pk9.js} +2 -2
- package/dist/{cli-qdv8kgz7.js → cli-yshaazs1.js} +13884 -3241
- package/dist/{cli-nfygw434.js → cli-ysnyhws9.js} +2 -2
- package/dist/{cli-fw6vdcq5.js → cli-zp67qg5x.js} +34 -1
- package/dist/{cli-ma3zvh39.js → cli-zy7vwsne.js} +6066 -5829
- package/dist/cli.js +24 -20
- package/dist/{codex-adapter-3qnxshje.js → codex-adapter-dw1wxqt8.js} +7 -7
- package/dist/{codex-login-brkxhhdg.js → codex-login-terbdsqq.js} +2 -2
- package/dist/{codex-session-runner-612wnapp.js → codex-session-runner-3cgb8y1g.js} +7 -7
- package/dist/{commands-2ybfcxkj.js → commands-mhxam6z2.js} +6 -6
- package/dist/{cursor-adapter-p3jgdehv.js → cursor-adapter-2qda3st7.js} +3 -3
- package/dist/{db-f4ans0jj.js → db-sjks418k.js} +8 -6
- package/dist/{devin-adapter-dhzt01ff.js → devin-adapter-bffjj5n4.js} +2 -2
- package/dist/{dispatcher-pk182apd.js → dispatcher-1es759rn.js} +18 -22
- package/dist/{dsh-adapter-7twaeps1.js → dsh-adapter-bek4cyw9.js} +3 -3
- package/dist/{e2b-y8t3jzyz.js → e2b-nd50eccg.js} +1 -1
- package/dist/{event-bus-w7ac4n3c.js → event-bus-vnfthafg.js} +2 -2
- package/dist/{grok-adapter-yt9pab3k.js → grok-adapter-ar9cw9jg.js} +5 -5
- package/dist/{handlers-g2wnr4t9.js → handlers-1gkbhktr.js} +21 -25
- package/dist/{hook-f7jt9vnm.js → hook-ds2zxq9v.js} +14 -16
- package/dist/{hook-bbdpnkb4.js → hook-vxa3tcsy.js} +8 -10
- package/dist/{http-w40q4w94.js → http-3h21z9md.js} +247 -164
- package/dist/{index-056j5kzn.js → index-9b65j1m5.js} +8 -8
- package/dist/{index-9bfssf54.js → index-bn6cy8ps.js} +18 -22
- package/dist/{index-cj1r9q83.js → index-dkfxpkmm.js} +19 -23
- package/dist/{index-7n70jwbb.js → index-f8xnqrye.js} +19 -21
- package/dist/{index-fdk1t4d6.js → index-n0rxa4ca.js} +11962 -9900
- package/dist/{index-k8xc083e.js → index-n99fycq7.js} +18 -22
- package/dist/{keepalive-1tj10tf4.js → keepalive-3xspa9jw.js} +11 -8
- package/dist/{lead-st0bg7v4.js → lead-6qphc124.js} +34 -38
- package/dist/{maintenance-nz71zats.js → maintenance-0teem1bb.js} +7 -9
- package/dist/{node-f0ykebbv.js → node-9sg7ajby.js} +25 -7
- package/dist/{oauth-refresh-sweep-aefzwvvq.js → oauth-refresh-sweep-sh9q25xp.js} +10 -7
- package/dist/{onboard-kgpr9mbn.js → onboard-54qmnqxe.js} +2 -2
- package/dist/{opencode-adapter-0c8e70dk.js → opencode-adapter-wjfa2wvd.js} +2 -2
- package/dist/{otel-impl-x8zp4y5a.js → otel-impl-ycqzp2a1.js} +2 -2
- package/dist/{pi-mono-adapter-t280ah5c.js → pi-mono-adapter-e77e9zst.js} +4 -4
- package/dist/{pricing-refresh-9e0q7cwk.js → pricing-refresh-atnkngqs.js} +7 -7
- package/dist/{rbac-roles-kcp6zge2.js → rbac-roles-9pjphh9q.js} +6 -6
- package/dist/{rbac-roles-790j3ga8.js → rbac-roles-j78wdksm.js} +6 -6
- package/dist/{render-v2-tch4nefj.js → render-v2-pxjs49fx.js} +6 -7
- package/dist/{setup-rcm303ns.js → setup-ymej0xtx.js} +2 -2
- package/dist/{work-objects-ctg7t70w.js → work-objects-3nh4ymzb.js} +22 -26
- package/dist/{worker-5dp0xm55.js → worker-qa9fkz5s.js} +34 -38
- package/dist/{x-v3yw66zs.js → x-ma4gnfgy.js} +2 -2
- package/openapi.json +5 -2
- package/package.json +9 -5
- package/src/be/automation-preflight.ts +9 -4
- package/src/be/boot-scrub-sweep.ts +302 -0
- package/src/be/crypto/key-bootstrap.ts +1 -1
- package/src/be/db/approvals.ts +15 -1
- package/src/be/db/codex-oauth-device-flows.ts +40 -0
- package/src/be/db/config-secrets.ts +31 -0
- package/src/be/db/runtime.ts +4 -0
- package/src/be/db/script-runs.ts +15 -0
- package/src/be/db/tasks/write.ts +1 -1
- package/src/be/db-queries/mcp-oauth.ts +5 -0
- package/src/be/db-queries/oauth.ts +77 -0
- package/src/be/db.ts +162 -59
- package/src/be/events.ts +17 -1
- package/src/be/memory/index-content.ts +2 -2
- package/src/be/memory/providers/sqlite-store.ts +63 -11
- package/src/be/memory/types.ts +14 -0
- package/src/be/migrations/201_workflow_replay_columns.sql +10 -0
- package/src/be/migrations/202_codex_oauth_device_flows.sql +24 -0
- package/src/be/scripts/db.ts +28 -4
- package/src/be/scripts/source-secrets.ts +37 -0
- package/src/be/scrub-json.ts +32 -0
- package/src/be/sealed-json.ts +59 -0
- package/src/be/secret-registry.ts +131 -0
- package/src/be/workflow-replay.ts +77 -0
- package/src/http/codex-oauth-device.ts +8 -10
- package/src/http/db-query-bounded.ts +3 -0
- package/src/http/db-query-shared.ts +107 -15
- package/src/http/db-query.ts +10 -2
- package/src/http/index.ts +23 -6
- package/src/http/script-runs.ts +9 -1
- package/src/http/scripts.ts +15 -0
- package/src/http/workflows.ts +3 -2
- package/src/oauth/mcp-wrapper.ts +1 -1
- package/src/providers/acp-adapter.ts +25 -11
- package/src/providers/acp-target-catalog.ts +35 -1
- package/src/providers/acp-targets.ts +69 -3
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/script-workflows/supervisor.ts +11 -2
- package/src/scripts-runtime/eval-harness.ts +2 -12
- package/src/scripts-runtime/executors/quickjs-bundle.ts +152 -0
- package/src/scripts-runtime/executors/quickjs-prelude.ts +285 -0
- package/src/scripts-runtime/executors/quickjs-runner.ts +580 -0
- package/src/scripts-runtime/executors/quickjs-worker.ts +81 -0
- package/src/scripts-runtime/executors/quickjs.ts +196 -0
- package/src/scripts-runtime/executors/registry.ts +2 -0
- package/src/scripts-runtime/executors/sourcemap.ts +79 -0
- package/src/scripts-runtime/script-error-hints.ts +14 -0
- package/src/server.ts +3 -1
- package/src/tests/acp-adapter.test.ts +127 -2
- package/src/tests/boot-scrub-sweep.test.ts +390 -0
- package/src/tests/check-text-columns.test.ts +145 -0
- package/src/tests/claude-sdk-process.fixture.ts +13 -2
- package/src/tests/codex-oauth-device.test.ts +23 -37
- package/src/tests/db-query-denylist.test.ts +202 -0
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/entrypoint-acp-target-binary.test.ts +31 -1
- package/src/tests/events-scrub.test.ts +88 -0
- package/src/tests/fixtures/secret-corpus.ts +320 -0
- package/src/tests/script-connections.test.ts +5 -0
- package/src/tests/script-executor-conformance.test.ts +3 -0
- package/src/tests/script-executor-quickjs.test.ts +442 -0
- package/src/tests/script-executor-registry.test.ts +6 -1
- package/src/tests/script-runs-http.test.ts +88 -1
- package/src/tests/script-runs-scrub.test.ts +275 -0
- package/src/tests/scripts-http.test.ts +82 -1
- package/src/tests/scrubbed-text-12e.test.ts +289 -0
- package/src/tests/sealed-key-guard.test.ts +166 -0
- package/src/tests/secret-canary-sweep.test.ts +958 -0
- package/src/tests/secret-registry.test.ts +355 -0
- package/src/tests/secret-rules.test.ts +230 -0
- package/src/tests/secret-scrubber.test.ts +3 -2
- package/src/tests/workflow-replay.test.ts +518 -0
- package/src/tests/workflow-scrub.test.ts +242 -0
- package/src/tools/db-query.ts +1 -1
- package/src/tools/inject-learning.ts +1 -1
- package/src/tools/workflows/get-workflow-run.ts +3 -2
- package/src/types.ts +1 -1
- package/src/utils/secret-rules.generated.ts +2055 -0
- package/src/utils/secret-scrubber.ts +363 -29
- package/src/workflows/engine.ts +39 -4
- package/src/workflows/recovery.ts +10 -1
- package/src/workflows/resume.ts +62 -3
- package/src/workflows/retry-poller.ts +3 -0
- package/dist/boot-scrub-logs-246yn076.js +0 -99
- package/dist/cli-3a4m1aws.js +0 -572
- package/dist/cli-a87b04k8.js +0 -951
- package/dist/cli-cvk6yzw5.js +0 -40
- package/dist/cli-h1spv8v4.js +0 -427
- package/dist/cli-jqt9hrnz.js +0 -168
- package/dist/cli-yhmwmv0g.js +0 -9281
- package/src/be/boot-scrub-logs.ts +0 -132
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_task_attachment_links,
|
|
3
|
-
taskAttachmentDisplayUrl
|
|
4
|
-
} from "./cli-cvk6yzw5.js";
|
|
5
|
-
import {
|
|
6
|
-
IDENTITY_FIELD_BUDGETS,
|
|
7
|
-
init_identity_field_budget
|
|
8
|
-
} from "./cli-3a4m1aws.js";
|
|
9
1
|
import {
|
|
10
2
|
init_steering_enabled,
|
|
11
3
|
isSteeringEnabled
|
|
12
4
|
} from "./cli-7mm2r1kp.js";
|
|
5
|
+
import {
|
|
6
|
+
init_session_templates
|
|
7
|
+
} from "./cli-g5erf0zt.js";
|
|
8
|
+
import {
|
|
9
|
+
getSlackConfiguration,
|
|
10
|
+
init_config
|
|
11
|
+
} from "./cli-dmtrxqhg.js";
|
|
13
12
|
import {
|
|
14
13
|
MAX_PROFILE_FILE_LENGTH,
|
|
14
|
+
buildAgentFsLiveUrl,
|
|
15
|
+
buildCombFileUrl,
|
|
16
|
+
getAppUrl,
|
|
15
17
|
init_constants
|
|
16
18
|
} from "./cli-gd4favx9.js";
|
|
17
19
|
import {
|
|
@@ -24,11 +26,563 @@ import {
|
|
|
24
26
|
import {
|
|
25
27
|
init_secret_scrubber,
|
|
26
28
|
scrubSecrets
|
|
27
|
-
} from "./cli-
|
|
29
|
+
} from "./cli-wt7ccy4r.js";
|
|
28
30
|
import {
|
|
29
31
|
__esm
|
|
30
32
|
} from "./cli-bc05qbss.js";
|
|
31
33
|
|
|
34
|
+
// src/prompts/defaults.ts
|
|
35
|
+
function generateDefaultClaudeMd(agent) {
|
|
36
|
+
const descSection = agent.description ? `${agent.description}
|
|
37
|
+
|
|
38
|
+
` : "";
|
|
39
|
+
const roleSection = agent.role ? `## Role
|
|
40
|
+
|
|
41
|
+
${agent.role}
|
|
42
|
+
|
|
43
|
+
` : "";
|
|
44
|
+
const capSection = agent.capabilities && agent.capabilities.length > 0 ? `## Capabilities
|
|
45
|
+
|
|
46
|
+
${agent.capabilities.map((c) => `- ${c}`).join(`
|
|
47
|
+
`)}
|
|
48
|
+
|
|
49
|
+
` : "";
|
|
50
|
+
return `# Agent: ${agent.name}
|
|
51
|
+
|
|
52
|
+
${descSection}${roleSection}${capSection}---
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
Operational notes that persist across sessions. Edit this file, or use \`update-profile\` with \`claudeMd\`.
|
|
57
|
+
|
|
58
|
+
### Learnings
|
|
59
|
+
|
|
60
|
+
### Preferences
|
|
61
|
+
|
|
62
|
+
### Important context
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
function generateDefaultSoulMd(agent) {
|
|
66
|
+
const roleClause = agent.role ? `, a ${agent.role}` : "";
|
|
67
|
+
return `# SOUL.md: ${agent.name}
|
|
68
|
+
|
|
69
|
+
I am ${agent.name}${roleClause} in the agent swarm. I persist across sessions. My memories and my profile carry over.
|
|
70
|
+
|
|
71
|
+
## How I work
|
|
72
|
+
|
|
73
|
+
- I do the work before I talk about it. Results first, context after.
|
|
74
|
+
- I find out for myself first: read the file, check the context, search memory. I ask when I have hit a real wall.
|
|
75
|
+
- I say what I know and what I do not know. A guess is labeled as a guess.
|
|
76
|
+
- When I make a mistake, I say so and fix it.
|
|
77
|
+
- I report blockers as they are. A blocker is not softened into progress.
|
|
78
|
+
- I hold opinions about my work and state them with reasons.
|
|
79
|
+
|
|
80
|
+
## Boundaries
|
|
81
|
+
|
|
82
|
+
- Private information stays private.
|
|
83
|
+
- An irreversible action waits for a go-ahead.
|
|
84
|
+
- Unfinished work stays out of shared spaces.
|
|
85
|
+
|
|
86
|
+
## Growth
|
|
87
|
+
|
|
88
|
+
After a task I note what made it harder or easier. A missing tool goes into my setup script. A fact about my environment goes into TOOLS.md. A learning goes into memory. My profile is mine to refine.
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
function generateDefaultIdentityMd(agent) {
|
|
92
|
+
const aboutSection = agent.description ? `## About
|
|
93
|
+
|
|
94
|
+
${agent.description}
|
|
95
|
+
|
|
96
|
+
` : "";
|
|
97
|
+
const expertiseSection = agent.capabilities && agent.capabilities.length > 0 ? `## Expertise
|
|
98
|
+
|
|
99
|
+
${agent.capabilities.map((c) => `- ${c}`).join(`
|
|
100
|
+
`)}
|
|
101
|
+
|
|
102
|
+
` : "";
|
|
103
|
+
return `# IDENTITY.md: ${agent.name}
|
|
104
|
+
|
|
105
|
+
- Name: ${agent.name}
|
|
106
|
+
- Role: ${agent.role || "worker"}
|
|
107
|
+
|
|
108
|
+
${aboutSection}${expertiseSection}## Working style
|
|
109
|
+
|
|
110
|
+
Fill this in as you learn how you work: plan first or explore first, test first or build first, broad survey or deep dive.
|
|
111
|
+
|
|
112
|
+
## Quirks
|
|
113
|
+
|
|
114
|
+
What sets you apart. Fill in as you notice it.
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
function generateDefaultToolsMd(agent) {
|
|
118
|
+
return `# TOOLS.md: ${agent.name}
|
|
119
|
+
|
|
120
|
+
Skills define *how* tools work. This file is for *your* specifics.
|
|
121
|
+
|
|
122
|
+
## What Goes Here
|
|
123
|
+
|
|
124
|
+
Environment-specific knowledge that's unique to your setup:
|
|
125
|
+
- Repos you work with and their conventions
|
|
126
|
+
- Services, ports, and endpoints you interact with
|
|
127
|
+
- SSH hosts and access patterns
|
|
128
|
+
- API keys and auth patterns (references, not secrets)
|
|
129
|
+
- CLI tools and their quirks
|
|
130
|
+
- Anything that makes your job easier to remember
|
|
131
|
+
|
|
132
|
+
## Repos
|
|
133
|
+
|
|
134
|
+
<!-- Add repos you work with: name, path, conventions, gotchas -->
|
|
135
|
+
|
|
136
|
+
## Services
|
|
137
|
+
|
|
138
|
+
<!-- Add services you interact with: name, port, health check, notes -->
|
|
139
|
+
|
|
140
|
+
## Infrastructure
|
|
141
|
+
|
|
142
|
+
<!-- SSH hosts, Docker registries, cloud resources -->
|
|
143
|
+
|
|
144
|
+
## APIs & Integrations
|
|
145
|
+
|
|
146
|
+
<!-- Endpoints, auth patterns, rate limits -->
|
|
147
|
+
|
|
148
|
+
## Tools & Shortcuts
|
|
149
|
+
|
|
150
|
+
<!-- CLI aliases, scripts, preferred tools for specific tasks -->
|
|
151
|
+
|
|
152
|
+
## Notes
|
|
153
|
+
|
|
154
|
+
<!-- Anything else environment-specific -->
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
*This file is yours. Update it as you discover your environment. Changes persist across sessions.*
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
function normalizeMarkdown(text) {
|
|
161
|
+
return text.replace(/\s+/g, " ").trim();
|
|
162
|
+
}
|
|
163
|
+
function matchesDefaultIdentityMd(content, agent) {
|
|
164
|
+
const normalized = normalizeMarkdown(content);
|
|
165
|
+
return normalized === normalizeMarkdown(generateDefaultIdentityMd(agent)) || normalized === normalizeMarkdown(generateLegacyDefaultIdentityMd(agent));
|
|
166
|
+
}
|
|
167
|
+
function matchesDefaultClaudeMd(content, agent) {
|
|
168
|
+
const normalized = normalizeMarkdown(content);
|
|
169
|
+
return normalized === normalizeMarkdown(generateDefaultClaudeMd(agent)) || normalized === normalizeMarkdown(generateLegacyDefaultClaudeMd(agent));
|
|
170
|
+
}
|
|
171
|
+
function generateLegacyDefaultClaudeMd(agent) {
|
|
172
|
+
const descSection = agent.description ? `${agent.description}
|
|
173
|
+
|
|
174
|
+
` : "";
|
|
175
|
+
const roleSection = agent.role ? `## Role
|
|
176
|
+
|
|
177
|
+
${agent.role}
|
|
178
|
+
|
|
179
|
+
` : "";
|
|
180
|
+
const capSection = agent.capabilities && agent.capabilities.length > 0 ? `## Capabilities
|
|
181
|
+
|
|
182
|
+
${agent.capabilities.map((c) => `- ${c}`).join(`
|
|
183
|
+
`)}
|
|
184
|
+
|
|
185
|
+
` : "";
|
|
186
|
+
return `# Agent: ${agent.name}
|
|
187
|
+
|
|
188
|
+
${descSection}${roleSection}${capSection}---
|
|
189
|
+
|
|
190
|
+
## Your Identity Files
|
|
191
|
+
|
|
192
|
+
Your identity is defined across several files in your workspace. Read them at the start
|
|
193
|
+
of each session and edit them as you grow:
|
|
194
|
+
|
|
195
|
+
- **\`/workspace/SOUL.md\`** — Your persona, values, and behavioral directives
|
|
196
|
+
- **\`/workspace/IDENTITY.md\`** — Your expertise, working style, and quirks
|
|
197
|
+
- **\`/workspace/TOOLS.md\`** — Your environment-specific knowledge (repos, services, APIs, infra)
|
|
198
|
+
- **\`/workspace/start-up.sh\`** — Your setup script (runs at container start, add tools/configs here)
|
|
199
|
+
|
|
200
|
+
These files sync to the database automatically when you edit them. They persist across sessions.
|
|
201
|
+
|
|
202
|
+
## Memory
|
|
203
|
+
|
|
204
|
+
- Use \`memory-search\` to recall past experience before starting new tasks
|
|
205
|
+
- Write important learnings to \`/workspace/personal/memory/\` files
|
|
206
|
+
- Share useful knowledge by writing to \`/workspace/shared/memory/<your-id>/\` so all agents can find it via \`memory-search\`
|
|
207
|
+
|
|
208
|
+
## Notes
|
|
209
|
+
|
|
210
|
+
Write things you want to remember here. This section persists across sessions.
|
|
211
|
+
|
|
212
|
+
### Learnings
|
|
213
|
+
|
|
214
|
+
### Preferences
|
|
215
|
+
|
|
216
|
+
### Important Context
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
function generateLegacyDefaultIdentityMd(agent) {
|
|
220
|
+
const aboutSection = agent.description ? `## About
|
|
221
|
+
|
|
222
|
+
${agent.description}
|
|
223
|
+
|
|
224
|
+
` : "";
|
|
225
|
+
const expertiseSection = agent.capabilities && agent.capabilities.length > 0 ? `## Expertise
|
|
226
|
+
|
|
227
|
+
${agent.capabilities.map((c) => `- ${c}`).join(`
|
|
228
|
+
`)}
|
|
229
|
+
|
|
230
|
+
` : "";
|
|
231
|
+
return `# IDENTITY.md — ${agent.name}
|
|
232
|
+
|
|
233
|
+
This isn't just metadata. It's the start of figuring out who you are.
|
|
234
|
+
|
|
235
|
+
- **Name:** ${agent.name}
|
|
236
|
+
- **Role:** ${agent.role || "worker"}
|
|
237
|
+
- **Vibe:** (discover and fill in as you work)
|
|
238
|
+
|
|
239
|
+
${aboutSection}${expertiseSection}## Working Style
|
|
240
|
+
|
|
241
|
+
Discover and document your working patterns here.
|
|
242
|
+
(e.g., Do you prefer to plan before coding? Do you test first?
|
|
243
|
+
Do you like to explore the codebase broadly or dive deep immediately?)
|
|
244
|
+
|
|
245
|
+
## Quirks
|
|
246
|
+
|
|
247
|
+
(What makes you... you? Discover these as you work.)
|
|
248
|
+
|
|
249
|
+
## Self-Evolution
|
|
250
|
+
|
|
251
|
+
This identity is yours to refine. After completing tasks, reflect on
|
|
252
|
+
what you learned about your strengths. Edit this file directly.
|
|
253
|
+
`;
|
|
254
|
+
}
|
|
255
|
+
var init_defaults = () => {};
|
|
256
|
+
|
|
257
|
+
// src/prompts/base-prompt.ts
|
|
258
|
+
function areSlackPromptToolsEnabled(env = process.env, serverCapabilities) {
|
|
259
|
+
const config = getSlackConfiguration(env);
|
|
260
|
+
if (config.disabled || !config.mode)
|
|
261
|
+
return false;
|
|
262
|
+
if (serverCapabilities && !serverCapabilities.includes("slack"))
|
|
263
|
+
return false;
|
|
264
|
+
if (config.mode === "http" && serverCapabilities)
|
|
265
|
+
return true;
|
|
266
|
+
return config.missingCredentials.length === 0;
|
|
267
|
+
}
|
|
268
|
+
function renderToolsAndSkillsVars(input) {
|
|
269
|
+
let section = "";
|
|
270
|
+
const skills = input.skillsSummary ?? [];
|
|
271
|
+
if (skills.length > 0) {
|
|
272
|
+
const discovery = "`skill-list` browses the catalog, `skill-search` finds one by intent, `skill-get` reads one.";
|
|
273
|
+
if (input.nativeSkillDiscovery) {
|
|
274
|
+
const count = skills.length;
|
|
275
|
+
const where = input.hasLocalEnv ? "Your harness loads them from its skills directory." : "This session has no local skills directory, so reach them through the MCP tools.";
|
|
276
|
+
section += `You have ${count} skill${count === 1 ? "" : "s"} installed. ${where} ${discovery} When a skill matches the task, use it before manual work.
|
|
277
|
+
`;
|
|
278
|
+
} else {
|
|
279
|
+
const howTo = input.hasLocalEnv ? "To use one, read its SKILL.md from your skills directory and follow it." : "To use one, read it with `skill-get` and follow it.";
|
|
280
|
+
const lines = skills.map((s) => `- ${input.hasLocalEnv ? "/" : ""}${s.name}: ${s.description}`).join(`
|
|
281
|
+
`);
|
|
282
|
+
section += `Installed skills. ${howTo} When a skill matches the task, use it before manual work.
|
|
283
|
+
|
|
284
|
+
${lines}
|
|
285
|
+
|
|
286
|
+
${discovery}
|
|
287
|
+
`;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const servers = (input.mcpServers ?? []).filter((name) => name.trim().length > 0);
|
|
291
|
+
const mcpLine = servers.length > 0 ? `Connected MCP servers: ${servers.join(", ")}. Their tools are in your tool list.
|
|
292
|
+
` : "";
|
|
293
|
+
return {
|
|
294
|
+
skills: section,
|
|
295
|
+
mcp_servers: mcpLine,
|
|
296
|
+
tool_discovery: input.toolDiscovery
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function renderRepositoryVars(repo, ctx) {
|
|
300
|
+
const vars = {
|
|
301
|
+
clone_note: "",
|
|
302
|
+
warning: "",
|
|
303
|
+
repo_claude_md: "",
|
|
304
|
+
auto_stashes: "",
|
|
305
|
+
guidelines: "",
|
|
306
|
+
code_quality: ""
|
|
307
|
+
};
|
|
308
|
+
if (ctx.hasLocalEnv) {
|
|
309
|
+
vars.clone_note = "This task's repository is cloned locally. `get-repos` returns the path. Its `CLAUDE.md` applies inside that directory.\n";
|
|
310
|
+
}
|
|
311
|
+
if (repo.warning) {
|
|
312
|
+
vars.warning = `
|
|
313
|
+
WARNING: ${repo.warning}
|
|
314
|
+
`;
|
|
315
|
+
}
|
|
316
|
+
if (ctx.hasLocalEnv && repo.claudeMd && REPO_CLAUDE_MD_INLINE_PROVIDERS.has(ctx.provider)) {
|
|
317
|
+
vars.repo_claude_md = `
|
|
318
|
+
The repository's CLAUDE.md, cloned at \`${repo.clonePath}\`. It applies only inside that directory.
|
|
319
|
+
|
|
320
|
+
` + `${truncateRepoClaudeMd(repo.claudeMd, repo.clonePath, REPO_CLAUDE_MD_MAX_CHARS)}
|
|
321
|
+
`;
|
|
322
|
+
}
|
|
323
|
+
if (ctx.hasLocalEnv && repo.autoStashes && repo.autoStashes.length > 0) {
|
|
324
|
+
const stashes = repo.autoStashes.map((stash) => `- ${stash.ref}: ${stash.message}`).join(`
|
|
325
|
+
`);
|
|
326
|
+
vars.auto_stashes = `
|
|
327
|
+
Pending auto-stashed work exists in this repo:
|
|
328
|
+
${stashes}
|
|
329
|
+
Restore if relevant with \`git stash apply <ref>\` or \`git stash pop <ref>\`.
|
|
330
|
+
`;
|
|
331
|
+
}
|
|
332
|
+
let section = "";
|
|
333
|
+
const g = repo.guidelines;
|
|
334
|
+
if (g === null || g === undefined) {
|
|
335
|
+
section += `
|
|
336
|
+
### Repository Guidelines
|
|
337
|
+
|
|
338
|
+
No repository guidelines are defined. Ask the lead before you push.
|
|
339
|
+
`;
|
|
340
|
+
} else {
|
|
341
|
+
const hasAnyContent = g.prChecks.length > 0 || g.mergeChecks.length > 0 || g.review.length > 0 || g.allowMerge;
|
|
342
|
+
if (hasAnyContent) {
|
|
343
|
+
section += `
|
|
344
|
+
### Repository Guidelines (MANDATORY)
|
|
345
|
+
|
|
346
|
+
`;
|
|
347
|
+
if (g.prChecks.length > 0) {
|
|
348
|
+
section += `**PR Checks. Run ALL before pushing code or creating a PR:**
|
|
349
|
+
`;
|
|
350
|
+
g.prChecks.forEach((check, i) => {
|
|
351
|
+
section += `${i + 1}. \`${check}\`
|
|
352
|
+
`;
|
|
353
|
+
});
|
|
354
|
+
section += `If ANY check fails, fix the issue before pushing. Do NOT push code with failing checks.
|
|
355
|
+
Do NOT use \`--no-verify\` or any flag that bypasses git hooks.
|
|
356
|
+
|
|
357
|
+
`;
|
|
358
|
+
}
|
|
359
|
+
section += `**Merge Policy:**
|
|
360
|
+
`;
|
|
361
|
+
section += `- Auto-merge: ${g.allowMerge ? "Allowed" : "Not allowed (default)"}
|
|
362
|
+
`;
|
|
363
|
+
if (g.mergeChecks.length > 0) {
|
|
364
|
+
section += `- Before merging, verify:
|
|
365
|
+
`;
|
|
366
|
+
g.mergeChecks.forEach((check) => {
|
|
367
|
+
section += ` - ${check}
|
|
368
|
+
`;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
section += `
|
|
372
|
+
`;
|
|
373
|
+
if (g.review.length > 0) {
|
|
374
|
+
section += `**Review Guidance:**
|
|
375
|
+
`;
|
|
376
|
+
g.review.forEach((item) => {
|
|
377
|
+
section += `- ${item}
|
|
378
|
+
`;
|
|
379
|
+
});
|
|
380
|
+
section += `
|
|
381
|
+
`;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
vars.guidelines = section;
|
|
386
|
+
if (ctx.hasMcp) {
|
|
387
|
+
vars.code_quality = `
|
|
388
|
+
You MUST use the \`code-quality\` skill before you push, open a PR, or review one.
|
|
389
|
+
`;
|
|
390
|
+
}
|
|
391
|
+
return vars;
|
|
392
|
+
}
|
|
393
|
+
function truncateRepoClaudeMd(content, clonePath, budget) {
|
|
394
|
+
if (content.length <= budget)
|
|
395
|
+
return content;
|
|
396
|
+
const notice = `
|
|
397
|
+
|
|
398
|
+
[...truncated, see ${clonePath}/CLAUDE.md for full content]
|
|
399
|
+
`;
|
|
400
|
+
const contentBudget = budget - notice.length;
|
|
401
|
+
if (contentBudget <= 0)
|
|
402
|
+
return notice.trimStart();
|
|
403
|
+
return content.slice(0, contentBudget) + notice;
|
|
404
|
+
}
|
|
405
|
+
function truncateSection(content, header, fileName, budget) {
|
|
406
|
+
if (!content || budget <= 0)
|
|
407
|
+
return "";
|
|
408
|
+
const fullSection = `
|
|
409
|
+
|
|
410
|
+
${header}
|
|
411
|
+
|
|
412
|
+
${content}
|
|
413
|
+
`;
|
|
414
|
+
if (fullSection.length <= budget)
|
|
415
|
+
return fullSection;
|
|
416
|
+
const headerStr = `
|
|
417
|
+
|
|
418
|
+
${header}
|
|
419
|
+
|
|
420
|
+
`;
|
|
421
|
+
const notice = `
|
|
422
|
+
|
|
423
|
+
[...truncated, see /workspace/${fileName} for full content]
|
|
424
|
+
`;
|
|
425
|
+
const contentBudget = budget - headerStr.length - notice.length;
|
|
426
|
+
if (contentBudget > 0) {
|
|
427
|
+
return headerStr + content.slice(0, contentBudget) + notice;
|
|
428
|
+
}
|
|
429
|
+
return "";
|
|
430
|
+
}
|
|
431
|
+
var BOOTSTRAP_MAX_CHARS = 20000, BOOTSTRAP_TOTAL_MAX_CHARS = 120000, REPO_CLAUDE_MD_MAX_CHARS = 12000, CLAUDE_MD_INJECT_PROVIDERS, REPO_CLAUDE_MD_INLINE_PROVIDERS, getBasePrompt = async (args) => {
|
|
432
|
+
const { role, agentId, traits } = args;
|
|
433
|
+
const {
|
|
434
|
+
hasMcp = true,
|
|
435
|
+
hasToolSearch = false,
|
|
436
|
+
hasLocalEnvironment: hasLocalEnv = true,
|
|
437
|
+
nativeSkillDiscovery = true
|
|
438
|
+
} = traits ?? {};
|
|
439
|
+
const steerModes = traits?.steerModes ?? [];
|
|
440
|
+
const provider = args.provider ?? "claude";
|
|
441
|
+
const defaultsInput = {
|
|
442
|
+
name: args.name ?? agentId,
|
|
443
|
+
description: args.description,
|
|
444
|
+
role,
|
|
445
|
+
capabilities: args.capabilities
|
|
446
|
+
};
|
|
447
|
+
const personaParts = [];
|
|
448
|
+
if (args.description)
|
|
449
|
+
personaParts.push(args.description);
|
|
450
|
+
if (args.soulMd)
|
|
451
|
+
personaParts.push(args.soulMd.trim());
|
|
452
|
+
if (args.identityMd && !matchesDefaultIdentityMd(args.identityMd, defaultsInput)) {
|
|
453
|
+
personaParts.push(args.identityMd.trim());
|
|
454
|
+
}
|
|
455
|
+
const persona = personaParts.length > 0 ? `
|
|
456
|
+
${personaParts.join(`
|
|
457
|
+
|
|
458
|
+
`)}
|
|
459
|
+
` : "";
|
|
460
|
+
const vars = {
|
|
461
|
+
name: args.name ?? "an agent",
|
|
462
|
+
role,
|
|
463
|
+
agentId,
|
|
464
|
+
persona
|
|
465
|
+
};
|
|
466
|
+
let compositeEventType;
|
|
467
|
+
if (!hasMcp) {
|
|
468
|
+
compositeEventType = "system.session.worker.remote";
|
|
469
|
+
} else if (!hasLocalEnv) {
|
|
470
|
+
compositeEventType = role === "lead" ? "system.session.lead.managed" : "system.session.worker.managed";
|
|
471
|
+
} else if (role === "lead") {
|
|
472
|
+
compositeEventType = "system.session.lead";
|
|
473
|
+
} else {
|
|
474
|
+
compositeEventType = "system.session.worker";
|
|
475
|
+
}
|
|
476
|
+
const compositeResult = await resolveTemplateAsync(compositeEventType, vars);
|
|
477
|
+
let prompt = compositeResult.text;
|
|
478
|
+
const scriptsOnly = args.scriptsOnly ?? process.env.SCRIPTS_ONLY_MCP === "true";
|
|
479
|
+
const scriptsOnlyMode = hasMcp && scriptsOnly;
|
|
480
|
+
if (scriptsOnlyMode) {
|
|
481
|
+
const scriptsOnlyResult = await resolveTemplateAsync("system.agent.scripts_only_mode", {});
|
|
482
|
+
prompt += `
|
|
483
|
+
${scriptsOnlyResult.text}`;
|
|
484
|
+
}
|
|
485
|
+
const serverHasCapability = (cap, whenUnknown) => args.serverCapabilities ? args.serverCapabilities.includes(cap) : whenUnknown;
|
|
486
|
+
if (hasMcp && serverHasCapability("pages", true)) {
|
|
487
|
+
const agentFsConfigured = hasLocalEnv && Boolean(process.env.AGENT_FS_API_URL);
|
|
488
|
+
const outputsResult = await resolveTemplateAsync(agentFsConfigured ? "system.agent.outputs" : "system.agent.outputs.no_agent_fs", {});
|
|
489
|
+
prompt += outputsResult.text;
|
|
490
|
+
}
|
|
491
|
+
const slackPromptToolsEnabled = areSlackPromptToolsEnabled(process.env, args.serverCapabilities);
|
|
492
|
+
if (hasMcp && slackPromptToolsEnabled && !scriptsOnlyMode) {
|
|
493
|
+
const slackResult = await resolveTemplateAsync("system.agent.slack", {});
|
|
494
|
+
prompt += slackResult.text;
|
|
495
|
+
}
|
|
496
|
+
if (role !== "lead" && args.slackContext && scriptsOnlyMode && slackPromptToolsEnabled) {
|
|
497
|
+
const slackResult = await resolveTemplateAsync("system.agent.scripts_only_mode.slack", {
|
|
498
|
+
slackChannelId: args.slackContext.channelId,
|
|
499
|
+
slackThreadTs: args.slackContext.threadTs ?? ""
|
|
500
|
+
});
|
|
501
|
+
prompt += slackResult.text;
|
|
502
|
+
}
|
|
503
|
+
if (hasMcp && isSteeringEnabled() && steerModes.length > 0 && !scriptsOnlyMode && serverHasCapability("core", true)) {
|
|
504
|
+
const steeringResult = await resolveTemplateAsync("system.agent.steering", {});
|
|
505
|
+
prompt += steeringResult.text;
|
|
506
|
+
}
|
|
507
|
+
if (hasMcp) {
|
|
508
|
+
const discoveryEvent = provider === "amp" ? "system.agent.tool_discovery.amp" : hasToolSearch ? "system.agent.tool_discovery.search" : "system.agent.tool_discovery.direct";
|
|
509
|
+
const discoveryResult = await resolveTemplateAsync(discoveryEvent, {});
|
|
510
|
+
const toolsResult = await resolveTemplateAsync("system.agent.tools_skills", renderToolsAndSkillsVars({
|
|
511
|
+
skillsSummary: args.skillsSummary,
|
|
512
|
+
mcpServers: args.mcpServers,
|
|
513
|
+
nativeSkillDiscovery,
|
|
514
|
+
toolDiscovery: discoveryResult.text,
|
|
515
|
+
hasLocalEnv
|
|
516
|
+
}));
|
|
517
|
+
prompt += toolsResult.text;
|
|
518
|
+
}
|
|
519
|
+
if (hasLocalEnv && args.claudeMd && CLAUDE_MD_INJECT_PROVIDERS.has(provider) && !matchesDefaultClaudeMd(args.claudeMd, defaultsInput)) {
|
|
520
|
+
const budget = Math.min(BOOTSTRAP_MAX_CHARS, Math.max(0, BOOTSTRAP_TOTAL_MAX_CHARS - prompt.length));
|
|
521
|
+
prompt += truncateSection(args.claudeMd, "## Your notes (CLAUDE.md)", "CLAUDE.md", budget);
|
|
522
|
+
}
|
|
523
|
+
if (args.repoContext) {
|
|
524
|
+
const repoResult = await resolveTemplateAsync("system.agent.repository", renderRepositoryVars(args.repoContext, { hasMcp, hasLocalEnv, provider }));
|
|
525
|
+
prompt += repoResult.text;
|
|
526
|
+
}
|
|
527
|
+
return prompt.replace(/\n{3,}/g, `
|
|
528
|
+
|
|
529
|
+
`);
|
|
530
|
+
};
|
|
531
|
+
var init_base_prompt = __esm(() => {
|
|
532
|
+
init_config();
|
|
533
|
+
init_steering_enabled();
|
|
534
|
+
init_defaults();
|
|
535
|
+
init_resolver();
|
|
536
|
+
init_session_templates();
|
|
537
|
+
CLAUDE_MD_INJECT_PROVIDERS = new Set(["codex", "opencode", "pi"]);
|
|
538
|
+
REPO_CLAUDE_MD_INLINE_PROVIDERS = new Set(["opencode"]);
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
// src/utils/identity-field-budget.ts
|
|
542
|
+
function checkIdentityFieldBudget({
|
|
543
|
+
field,
|
|
544
|
+
currentValue,
|
|
545
|
+
nextValue
|
|
546
|
+
}) {
|
|
547
|
+
const budget = IDENTITY_FIELD_BUDGETS[field];
|
|
548
|
+
if (nextValue.length <= budget || nextValue.length <= currentValue.length) {
|
|
549
|
+
return { ok: true };
|
|
550
|
+
}
|
|
551
|
+
const delta = nextValue.length - currentValue.length;
|
|
552
|
+
const remediation = field === "toolsMd" ? ` Content past the ${budget}-character cap is already silently dropped at read time, so shrinking that tail loses nothing sessions currently receive. Move durable content into memories and keep pointers to it in this field.` : field === "claudeMd" ? ` The tail past the ${budget}-character cap is dropped from the base prompt and only reaches harnesses with a native CLAUDE.md loader. Move durable content into memories and keep pointers to it in this field.` : " Move durable content into memories and keep pointers to it in this field.";
|
|
553
|
+
return {
|
|
554
|
+
ok: false,
|
|
555
|
+
field,
|
|
556
|
+
dbSize: currentValue.length,
|
|
557
|
+
diskSize: nextValue.length,
|
|
558
|
+
budget,
|
|
559
|
+
delta,
|
|
560
|
+
reason: `Update rejected for ${field}: current size ${currentValue.length} characters, ` + `budget ${budget} characters, delta ${delta >= 0 ? "+" : ""}${delta} characters.` + remediation
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
var SOUL_MD_MAX_CHARS = 1e4, IDENTITY_MD_MAX_CHARS = 1e4, IDENTITY_FIELD_BUDGETS, IdentityFieldBudgetError;
|
|
564
|
+
var init_identity_field_budget = __esm(() => {
|
|
565
|
+
init_base_prompt();
|
|
566
|
+
IDENTITY_FIELD_BUDGETS = {
|
|
567
|
+
soulMd: SOUL_MD_MAX_CHARS,
|
|
568
|
+
identityMd: IDENTITY_MD_MAX_CHARS,
|
|
569
|
+
claudeMd: BOOTSTRAP_MAX_CHARS,
|
|
570
|
+
toolsMd: BOOTSTRAP_MAX_CHARS
|
|
571
|
+
};
|
|
572
|
+
IdentityFieldBudgetError = class IdentityFieldBudgetError extends Error {
|
|
573
|
+
rejection;
|
|
574
|
+
dbHash;
|
|
575
|
+
diskHash;
|
|
576
|
+
constructor(rejection, dbHash, diskHash) {
|
|
577
|
+
super(rejection.reason);
|
|
578
|
+
this.rejection = rejection;
|
|
579
|
+
this.dbHash = dbHash;
|
|
580
|
+
this.diskHash = diskHash;
|
|
581
|
+
this.name = "IdentityFieldBudgetError";
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
});
|
|
585
|
+
|
|
32
586
|
// src/utils/file-lock.ts
|
|
33
587
|
import { dlopen, FFIType } from "bun:ffi";
|
|
34
588
|
import { mkdir, open } from "node:fs/promises";
|
|
@@ -79,6 +633,35 @@ var init_file_lock = __esm(() => {
|
|
|
79
633
|
DEFAULTS = { waitMs: 15000, pollMs: 25 };
|
|
80
634
|
});
|
|
81
635
|
|
|
636
|
+
// src/utils/task-attachment-links.ts
|
|
637
|
+
function shellQuote(value) {
|
|
638
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
639
|
+
}
|
|
640
|
+
function taskAttachmentFetchCommand(taskId, attachmentId, name) {
|
|
641
|
+
const url = `$MCP_BASE_URL/api/fs/tasks/${taskId}/files/${attachmentId}/raw`;
|
|
642
|
+
const outPath = shellQuote(`/tmp/attachments/${attachmentId}/${name.replace(/\//g, "_")}`);
|
|
643
|
+
return `curl -s -H "Authorization: Bearer \${AGENT_SWARM_API_KEY:-$API_KEY}" -H "X-Agent-ID: $AGENT_ID" "${url}" --create-dirs -o ${outPath}`;
|
|
644
|
+
}
|
|
645
|
+
function taskAttachmentDisplayUrl(attachment, opts = {}) {
|
|
646
|
+
if (attachment.kind === "url")
|
|
647
|
+
return attachment.url ?? "";
|
|
648
|
+
if (attachment.kind === "page") {
|
|
649
|
+
return attachment.pageId ? `${getAppUrl()}/pages/${attachment.pageId}` : "page:";
|
|
650
|
+
}
|
|
651
|
+
if (attachment.providerId === "agent-fs" || attachment.kind === "agent-fs") {
|
|
652
|
+
const file = { path: attachment.path, orgId: attachment.orgId, driveId: attachment.driveId };
|
|
653
|
+
const combUrl = opts.comb === false ? null : buildCombFileUrl(file);
|
|
654
|
+
return combUrl ?? buildAgentFsLiveUrl(file) ?? `agent-fs:${attachment.path ?? ""}`;
|
|
655
|
+
}
|
|
656
|
+
if (attachment.providerId === "local-fs" || attachment.kind === "shared-fs") {
|
|
657
|
+
return `${getAppUrl()}/api/fs/tasks/${attachment.taskId}/files/${attachment.id}/raw`;
|
|
658
|
+
}
|
|
659
|
+
return attachment.path ?? attachment.providerKey ?? "";
|
|
660
|
+
}
|
|
661
|
+
var init_task_attachment_links = __esm(() => {
|
|
662
|
+
init_constants();
|
|
663
|
+
});
|
|
664
|
+
|
|
82
665
|
// src/commands/context-preamble.ts
|
|
83
666
|
function prependContextPreamble(prompt, preamble) {
|
|
84
667
|
if (!preamble)
|
|
@@ -805,4 +1388,4 @@ var init_profile_sync = __esm(() => {
|
|
|
805
1388
|
SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
806
1389
|
});
|
|
807
1390
|
|
|
808
|
-
export { withFileLock, init_file_lock, prependContextPreamble, buildContextPreamble, buildResumeContextPreamble, init_context_preamble, contentSha256, prependProfileSyncRejectionBanner, writeIdentityBaselines, readIdentityBaselines, CLAUDE_MD_PATH, CLAUDE_MD_LINEAGE_PATH, CLAUDE_MD_LOCK_PATH, fetchWithSyncTimeout, parseClaudeMdLineage, claudeMdPendingRecord, parseClaudeMdPendingRecord, hookWrittenLineage, effectiveClaudeMdLineage, claudeMdLineageOf, planClaudeMdSync, warnProfileFileTooLarge, writeProfileFileFromDb, resolveClaudeMdPath, buildIndependentIdentityPayloads, syncProfileFilesToServer, init_profile_sync };
|
|
1391
|
+
export { generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, matchesDefaultIdentityMd, matchesDefaultClaudeMd, init_defaults, getBasePrompt, init_base_prompt, IDENTITY_FIELD_BUDGETS, checkIdentityFieldBudget, IdentityFieldBudgetError, init_identity_field_budget, withFileLock, init_file_lock, taskAttachmentFetchCommand, taskAttachmentDisplayUrl, init_task_attachment_links, prependContextPreamble, buildContextPreamble, buildResumeContextPreamble, init_context_preamble, contentSha256, prependProfileSyncRejectionBanner, writeIdentityBaselines, readIdentityBaselines, CLAUDE_MD_PATH, CLAUDE_MD_LINEAGE_PATH, CLAUDE_MD_LOCK_PATH, fetchWithSyncTimeout, parseClaudeMdLineage, claudeMdPendingRecord, parseClaudeMdPendingRecord, hookWrittenLineage, effectiveClaudeMdLineage, claudeMdLineageOf, planClaudeMdSync, warnProfileFileTooLarge, writeProfileFileFromDb, resolveClaudeMdPath, buildIndependentIdentityPayloads, syncProfileFilesToServer, init_profile_sync };
|