@desplega.ai/agent-swarm 1.82.0 → 1.83.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/openapi.json +5 -3
- package/package.json +1 -1
- package/src/be/db.ts +14 -1
- package/src/be/migrations/073_task_attachments_agent_fs_ids.sql +15 -0
- package/src/commands/provider-credentials.ts +11 -0
- package/src/http/tasks.ts +7 -3
- package/src/providers/pi-mono-adapter.ts +20 -3
- package/src/providers/types.ts +5 -1
- package/src/slack/blocks.ts +132 -1
- package/src/slack/responses.ts +15 -5
- package/src/slack/watcher.ts +12 -0
- package/src/tests/credential-check.test.ts +47 -0
- package/src/tests/rest-api.test.ts +51 -1
- package/src/tests/slack-attachments-block.test.ts +240 -0
- package/src/tests/slack-blocks.test.ts +162 -0
- package/src/tests/slack-watcher.test.ts +83 -0
- package/src/tests/store-progress-attachments-handler.test.ts +480 -0
- package/src/tests/store-progress-attachments.test.ts +41 -0
- package/src/tools/store-progress.ts +55 -19
- package/src/types.ts +21 -1
- package/src/utils/constants.ts +58 -0
package/src/utils/constants.ts
CHANGED
|
@@ -17,3 +17,61 @@ export function getAppUrl(): string {
|
|
|
17
17
|
const raw = process.env.APP_URL?.trim();
|
|
18
18
|
return (raw || DEFAULT_APP_URL).replace(/\/+$/, "");
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Default agent-fs live host used when `AGENT_FS_LIVE_URL` is unset. Points at
|
|
23
|
+
* the public production live server so any link rendered in Slack/UI is
|
|
24
|
+
* always reachable. Self-hosted operators should set `AGENT_FS_LIVE_URL`.
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_AGENT_FS_LIVE_URL = "https://live.agent-fs.dev";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the effective agent-fs live URL from `AGENT_FS_LIVE_URL` (with
|
|
30
|
+
* trailing slashes stripped), falling back to {@link DEFAULT_AGENT_FS_LIVE_URL}.
|
|
31
|
+
*/
|
|
32
|
+
export function getAgentFsLiveUrl(): string {
|
|
33
|
+
const raw = process.env.AGENT_FS_LIVE_URL?.trim();
|
|
34
|
+
return (raw || DEFAULT_AGENT_FS_LIVE_URL).replace(/\/+$/, "");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Optional fallback agent-fs `org_id` for attachments that store only `path`.
|
|
39
|
+
* Strictly opt-in — when neither env var is set, the renderer keeps the
|
|
40
|
+
* `agent-fs:<path>` raw-string fallback. Row-level IDs always win over the
|
|
41
|
+
* env-var defaults so per-attachment overrides remain authoritative.
|
|
42
|
+
*/
|
|
43
|
+
export function getAgentFsDefaultOrgId(): string | undefined {
|
|
44
|
+
const raw = process.env.AGENT_FS_DEFAULT_ORG_ID?.trim();
|
|
45
|
+
return raw || undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optional fallback agent-fs `drive_id`. See {@link getAgentFsDefaultOrgId}.
|
|
50
|
+
*/
|
|
51
|
+
export function getAgentFsDefaultDriveId(): string | undefined {
|
|
52
|
+
const raw = process.env.AGENT_FS_DEFAULT_DRIVE_ID?.trim();
|
|
53
|
+
return raw || undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a public agent-fs live URL for an attachment when we have enough
|
|
58
|
+
* info — `path` plus (`orgId` and `driveId`, falling back to env-var
|
|
59
|
+
* defaults). Returns `null` when the path is missing or no org/drive pair is
|
|
60
|
+
* available; callers fall back to the raw `agent-fs:<path>` display.
|
|
61
|
+
*
|
|
62
|
+
* Shape: ${liveHost}/file/~/<orgId>/<driveId>/<normalized-path>
|
|
63
|
+
*/
|
|
64
|
+
export function buildAgentFsLiveUrl(opts: {
|
|
65
|
+
path?: string | null;
|
|
66
|
+
orgId?: string | null;
|
|
67
|
+
driveId?: string | null;
|
|
68
|
+
}): string | null {
|
|
69
|
+
const path = opts.path?.trim();
|
|
70
|
+
if (!path) return null;
|
|
71
|
+
const orgId = opts.orgId?.trim() || getAgentFsDefaultOrgId();
|
|
72
|
+
const driveId = opts.driveId?.trim() || getAgentFsDefaultDriveId();
|
|
73
|
+
if (!orgId || !driveId) return null;
|
|
74
|
+
const host = getAgentFsLiveUrl();
|
|
75
|
+
const normalizedPath = path.replace(/^\/+/, "");
|
|
76
|
+
return `${host}/file/~/${orgId}/${driveId}/${normalizedPath}`;
|
|
77
|
+
}
|