@desplega.ai/agent-swarm 1.78.1 → 1.79.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.
Files changed (75) hide show
  1. package/README.md +1 -0
  2. package/openapi.json +1335 -236
  3. package/package.json +4 -4
  4. package/plugin/skills/artifacts/SKILL.md +151 -0
  5. package/plugin/skills/artifacts/examples/static-report.sh +1 -1
  6. package/plugin/skills/kv-storage/SKILL.md +168 -0
  7. package/plugin/skills/pages/SKILL.md +423 -0
  8. package/src/artifact-sdk/browser-sdk.ts +396 -19
  9. package/src/be/db.ts +548 -0
  10. package/src/be/migrations/059_pages.sql +34 -0
  11. package/src/be/migrations/060_page_versions.sql +19 -0
  12. package/src/be/migrations/061_kv_store.sql +34 -0
  13. package/src/be/migrations/062_pages_view_count.sql +9 -0
  14. package/src/commands/artifact.ts +17 -11
  15. package/src/commands/provider-credentials.ts +1 -1
  16. package/src/http/index.ts +9 -1
  17. package/src/http/kv.ts +658 -0
  18. package/src/http/page-proxy.ts +213 -0
  19. package/src/http/pages-public.ts +507 -0
  20. package/src/http/pages.ts +608 -0
  21. package/src/http/status.ts +1 -1
  22. package/src/http/utils.ts +68 -5
  23. package/src/pages/version.ts +44 -0
  24. package/src/prompts/session-templates.ts +51 -0
  25. package/src/providers/pi-mono-adapter.ts +3 -3
  26. package/src/providers/pi-mono-extension.ts +1 -1
  27. package/src/server.ts +29 -1
  28. package/src/tasks/context-key.ts +28 -0
  29. package/src/telemetry.ts +65 -1
  30. package/src/tests/artifact-commands.test.ts +92 -0
  31. package/src/tests/artifact-sdk.test.ts +80 -74
  32. package/src/tests/context-key.test.ts +17 -0
  33. package/src/tests/create-page-tool.test.ts +197 -0
  34. package/src/tests/fixtures/sample-json-page.json +52 -0
  35. package/src/tests/kv-http.test.ts +331 -0
  36. package/src/tests/kv-namespace-resolution.test.ts +172 -0
  37. package/src/tests/kv-page-proxy.test.ts +212 -0
  38. package/src/tests/kv-storage.test.ts +227 -0
  39. package/src/tests/kv-tool.test.ts +217 -0
  40. package/src/tests/launch-password-rejection.test.ts +139 -0
  41. package/src/tests/page-proxy-authed.test.ts +146 -0
  42. package/src/tests/page-proxy.test.ts +270 -0
  43. package/src/tests/page-session.test.ts +169 -0
  44. package/src/tests/pages-actions-endpoint.test.ts +102 -0
  45. package/src/tests/pages-authed-mode.test.ts +211 -0
  46. package/src/tests/pages-http.test.ts +193 -0
  47. package/src/tests/pages-list-endpoint.test.ts +149 -0
  48. package/src/tests/pages-password-hash.test.ts +57 -0
  49. package/src/tests/pages-password-mode.test.ts +265 -0
  50. package/src/tests/pages-public-authed-401.test.ts +102 -0
  51. package/src/tests/pages-public-html.test.ts +151 -0
  52. package/src/tests/pages-public-json-redirect.test.ts +86 -0
  53. package/src/tests/pages-storage.test.ts +196 -0
  54. package/src/tests/pages-versioning.test.ts +231 -0
  55. package/src/tests/pages-view-count.test.ts +220 -0
  56. package/src/tests/prompt-template-session.test.ts +3 -2
  57. package/src/tests/skill-update-scope.test.ts +165 -0
  58. package/src/tests/swarm-diff.test.ts +303 -0
  59. package/src/tests/telemetry-init.test.ts +149 -0
  60. package/src/tests/workflow-wait-event.test.ts +4 -7
  61. package/src/tools/create-page.ts +263 -0
  62. package/src/tools/kv/index.ts +5 -0
  63. package/src/tools/kv/kv-delete.ts +89 -0
  64. package/src/tools/kv/kv-get.ts +64 -0
  65. package/src/tools/kv/kv-incr.ts +116 -0
  66. package/src/tools/kv/kv-list.ts +81 -0
  67. package/src/tools/kv/kv-set.ts +194 -0
  68. package/src/tools/kv/resolve-namespace.ts +58 -0
  69. package/src/tools/skills/skill-update.ts +26 -0
  70. package/src/tools/tool-config.ts +10 -0
  71. package/src/types.ts +107 -0
  72. package/src/utils/internal-ai/complete-structured.ts +2 -2
  73. package/src/utils/internal-ai/credentials.ts +3 -3
  74. package/src/utils/page-session.ts +254 -0
  75. package/plugin/skills/artifacts/skill.md +0 -70
@@ -154,12 +154,15 @@ async function artifactList() {
154
154
  process.exit(1);
155
155
  }
156
156
 
157
- const services = (await res.json()) as Array<{
158
- name: string;
159
- agentId: string;
160
- status: string;
161
- metadata?: { type?: string; artifactName?: string; port?: number; publicUrl?: string };
162
- }>;
157
+ const body = (await res.json()) as {
158
+ services?: Array<{
159
+ name: string;
160
+ agentId: string;
161
+ status: string;
162
+ metadata?: { type?: string; artifactName?: string; port?: number; publicUrl?: string };
163
+ }>;
164
+ };
165
+ const services = body.services ?? [];
163
166
 
164
167
  const artifacts = services.filter((s) => s.metadata?.type === "artifact");
165
168
 
@@ -214,11 +217,14 @@ async function artifactStop(args: ArtifactArgs) {
214
217
  });
215
218
 
216
219
  if (res.ok) {
217
- const services = (await res.json()) as Array<{
218
- id: string;
219
- name: string;
220
- metadata?: { type?: string; artifactName?: string };
221
- }>;
220
+ const body = (await res.json()) as {
221
+ services?: Array<{
222
+ id: string;
223
+ name: string;
224
+ metadata?: { type?: string; artifactName?: string };
225
+ }>;
226
+ };
227
+ const services = body.services ?? [];
222
228
  const service = services.find(
223
229
  (s) => s.metadata?.type === "artifact" && s.metadata?.artifactName === name,
224
230
  );
@@ -2,7 +2,7 @@
2
2
  * Provider-agnostic credential check dispatcher (WORKER-ONLY).
3
3
  *
4
4
  * Lives in `src/commands/` because the predicates value-import worker-harness
5
- * SDKs (e.g. `@mariozechner/pi-coding-agent` via `pi-mono-adapter.ts`) that
5
+ * SDKs (e.g. `@earendil-works/pi-coding-agent` via `pi-mono-adapter.ts`) that
6
6
  * have module-load side effects. Importing this file from any module
7
7
  * reachable from `src/http.ts` would drag those SDKs into the bun-compiled
8
8
  * API binary — which is exactly the bug PR #452 hit at `/usr/local/bin/`.
package/src/http/index.ts CHANGED
@@ -31,10 +31,14 @@ import { handleEvents } from "./events";
31
31
  import { handleHeartbeat } from "./heartbeat";
32
32
  import { handleInboxState } from "./inbox-state";
33
33
  import { handleIntegrations } from "./integrations";
34
+ import { handleKv } from "./kv";
34
35
  import { handleMcp } from "./mcp";
35
36
  import { handleMcpOAuth, startMcpOAuthPendingGc, stopMcpOAuthPendingGc } from "./mcp-oauth";
36
37
  import { handleMcpServers } from "./mcp-servers";
37
38
  import { handleMemory } from "./memory";
39
+ import { handlePageProxy } from "./page-proxy";
40
+ import { handlePages } from "./pages";
41
+ import { handlePagesPublic } from "./pages-public";
38
42
  import { handlePoll } from "./poll";
39
43
  import { handlePricing } from "./pricing";
40
44
  import { handlePromptTemplates } from "./prompt-templates";
@@ -109,7 +113,7 @@ const httpServer = createHttpServer(async (req, res) => {
109
113
  console.error(`[HTTP] ❌ ${req.method} ${req.url} → Error: ${err.message}`);
110
114
  });
111
115
 
112
- setCorsHeaders(res);
116
+ setCorsHeaders(req, res);
113
117
 
114
118
  // ── Core routes (OPTIONS, health, auth, /me, /cancelled-tasks, /ping, /close) ──
115
119
  if (await handleCore(req, res, req.headers["x-agent-id"] as string | undefined, apiKey)) return;
@@ -139,6 +143,7 @@ const httpServer = createHttpServer(async (req, res) => {
139
143
  () => handleWorkflowEvents(req, res, pathSegments, queryParams),
140
144
  () => handleApprovalRequests(req, res, pathSegments, queryParams),
141
145
  () => handleConfig(req, res, pathSegments, queryParams),
146
+ () => handleKv(req, res, pathSegments, queryParams),
142
147
  () => handleIntegrations(req, res, pathSegments),
143
148
  () => handlePromptTemplates(req, res, pathSegments, queryParams),
144
149
  () => handleDbQuery(req, res, pathSegments, queryParams),
@@ -147,6 +152,9 @@ const httpServer = createHttpServer(async (req, res) => {
147
152
  () => handleMcpServers(req, res, pathSegments, queryParams),
148
153
  () => handleMcpOAuth(req, res, pathSegments, queryParams),
149
154
  () => handleMemory(req, res, pathSegments, myAgentId),
155
+ () => handlePagesPublic(req, res, pathSegments, queryParams),
156
+ () => handlePageProxy(req, res),
157
+ () => handlePages(req, res, pathSegments, queryParams, myAgentId),
150
158
  () => handleApiKeys(req, res, pathSegments, queryParams),
151
159
  () => handleHeartbeat(req, res, pathSegments),
152
160
  () => handleEvents(req, res, pathSegments, queryParams, myAgentId),