@desplega.ai/agent-swarm 1.160.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 +4 -3
- package/dist/{acp-adapter-2mjwcsfh.js → acp-adapter-74m73ae9.js} +163 -49
- package/dist/{actions-e43rxskr.js → actions-4sr14gnt.js} +42 -38
- package/dist/{anthropic-messages-5qx80j9k.js → anthropic-messages-8xxrzky9.js} +22 -26
- package/dist/{app-mc7xfagn.js → app-pt68fbwp.js} +17 -14
- package/dist/{artifact-3v5t9jtg.js → artifact-fey7dvj9.js} +3 -2
- package/dist/{assistant-sedkzv3b.js → assistant-cv3jytks.js} +43 -39
- package/dist/{azure-openai-responses-nfb21z9a.js → azure-openai-responses-f5cqsyj8.js} +15 -10
- package/dist/{boot-reembed-m3656j2n.js → boot-reembed-4ht4gqth.js} +17 -14
- package/dist/{boot-reembed-cqz9swn5.js → boot-reembed-nxpcvpj9.js} +16 -13
- package/dist/{boot-scrub-logs-xbxf5d7w.js → boot-scrub-logs-k93kyw8k.js} +13 -10
- package/dist/boot-seeds-1skcrs0e.js +32 -0
- package/dist/{claude-adapter-dc6289mc.js → claude-adapter-r5g0tzge.js} +39 -30
- package/dist/{claude-managed-adapter-naaw51me.js → claude-managed-adapter-yxkfxg8j.js} +6 -5
- package/dist/{claude-managed-setup-eacvchx0.js → claude-managed-setup-pkyrgshb.js} +27 -27
- package/dist/{claude-sdk-session-bqp2xvym.js → claude-sdk-session-jxyxnrwd.js} +8041 -7910
- package/dist/{cli-4derpgyk.js → cli-2hhfhfq5.js} +6 -1
- package/dist/{cli-rykfmgwg.js → cli-2x0e561b.js} +1 -1
- package/dist/{cli-tzx2ke1v.js → cli-2zy95vhm.js} +137 -64
- package/dist/{cli-0x01kwrd.js → cli-4cwxn7gp.js} +47 -186
- package/dist/{cli-xjcywfsf.js → cli-4dcpaefp.js} +12 -11
- package/dist/{cli-v7fn5gms.js → cli-4x0csdjq.js} +164 -76
- package/dist/{cli-12tszpk9.js → cli-5bcd7sfy.js} +91 -29
- package/dist/{cli-jz4w45qt.js → cli-5k6k8ta3.js} +190 -50
- package/dist/{cli-tpq83z89.js → cli-5xhpb3kv.js} +20 -19
- package/dist/{cli-r1mxd1xh.js → cli-7af8yhav.js} +6 -179
- package/dist/{cli-jajnsm8q.js → cli-7tre70zp.js} +18160 -31345
- package/dist/{cli-447dt1h3.js → cli-8ev9xqnx.js} +218 -25
- package/dist/cli-bsky8g7w.js +449 -0
- package/dist/{cli-0z2v4nhw.js → cli-cat6h73s.js} +1 -1
- package/dist/{cli-25fcq4b4.js → cli-cebmgwsc.js} +15 -11
- package/dist/{cli-shkxm1vn.js → cli-cvatsam7.js} +189 -13
- package/dist/{cli-2658f6at.js → cli-cvk6yzw5.js} +6 -8
- package/dist/cli-dbmwby6a.js +9 -0
- package/dist/{cli-ptr8h7kp.js → cli-eg0b3p0k.js} +5 -218
- package/dist/cli-f9w1semm.js +413 -0
- package/dist/{cli-523679eh.js → cli-g739zqzt.js} +6 -5
- package/dist/{cli-dv6cdjs2.js → cli-gd4favx9.js} +28 -7
- package/dist/{cli-c8a36vcc.js → cli-gpqpmns7.js} +2 -2
- package/dist/{cli-5nbmpy8w.js → cli-hb5c2x5y.js} +1 -1
- package/dist/{cli-741yb0xx.js → cli-hmsw1gpy.js} +55 -169
- package/dist/{cli-qydf22qq.js → cli-jf7wmv1r.js} +2562 -735
- package/dist/{cli-mfe5btp9.js → cli-jxs2ygaw.js} +317 -121
- package/dist/{cli-kmcpfwn2.js → cli-jyy6pm2f.js} +19 -3
- package/dist/cli-kdkwd3yr.js +615 -0
- package/dist/{cli-6cs6wzxt.js → cli-kh04eqwe.js} +2 -2
- package/dist/{cli-9hsgwz4w.js → cli-kp42yek0.js} +1309 -391
- package/dist/cli-ma3zvh39.js +10404 -0
- package/dist/{cli-ybgv4kw2.js → cli-mbssg1xv.js} +9 -2
- package/dist/{cli-jsp14b6c.js → cli-mzfth0bp.js} +38 -1
- package/dist/{cli-r2ap2czm.js → cli-nexqx4ve.js} +6 -0
- package/dist/{cli-f8gy6r2r.js → cli-nq7yqw7b.js} +19 -8
- package/dist/{cli-10nhj6xq.js → cli-nt8hecg9.js} +34 -33
- package/dist/cli-p0r8sxj5.js +303 -0
- package/dist/{cli-58e8yr0d.js → cli-pkd6s2wy.js} +4 -2
- package/dist/{cli-a8dvhzrt.js → cli-q24re23n.js} +7 -5
- 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-7e398j1h.js → cli-rj0gqwwp.js} +3 -3
- package/dist/{cli-btfv8y88.js → cli-rnyzn44p.js} +2 -2
- package/dist/{cli-d5czme6m.js → cli-s3hwpt9v.js} +4754 -4945
- package/dist/{cli-0jwe9034.js → cli-sptrj5f5.js} +3 -3
- package/dist/{cli-0q3avq3s.js → cli-sqvfa090.js} +19 -11
- package/dist/{cli-azhgzetg.js → cli-swfmp1fx.js} +27 -27
- package/dist/{cli-jyk0ynw2.js → cli-t845n9xk.js} +23 -10
- package/dist/{cli-zpep9q5e.js → cli-tcen9p5w.js} +20 -15
- package/dist/{cli-74h9hscv.js → cli-tre4bdgq.js} +1 -1
- package/dist/{cli-pm1rst0h.js → cli-twrh04ap.js} +30 -15
- package/dist/{cli-phsaj4xq.js → cli-v0pvvhfq.js} +1 -1
- package/dist/{cli-ydmcgve1.js → cli-vc9bp061.js} +5 -5
- package/dist/{cli-g2whhdrf.js → cli-vxe6qa4h.js} +1 -1
- package/dist/{cli-vctdqs5h.js → cli-vy3ed88x.js} +15 -2
- package/dist/{cli-br0qdrnp.js → cli-vyqs9ya8.js} +18 -18
- package/dist/{cli-cpvsaqsw.js → cli-w0bwte75.js} +8 -5
- package/dist/cli-wbvnn6tk.js +861 -0
- package/dist/{cli-r94z9p1z.js → cli-wgbezhw2.js} +3 -0
- package/dist/{cli-evvtk35y.js → cli-wjgs5wxe.js} +7 -7
- package/dist/cli-wxkkd0e0.js +33 -0
- package/dist/{cli-0wgxmwf6.js → cli-xk79303e.js} +20 -7
- package/dist/{cli-ktmyrtpn.js → cli-xqpk3rp7.js} +33 -10
- package/dist/{cli-ygwm91nt.js → cli-yy6dew39.js} +1 -1
- package/dist/cli-zp38xvtm.js +9487 -0
- package/dist/{cli-tfky2838.js → cli-zvhd3f64.js} +4 -4
- package/dist/{cli-jayjpjmb.js → cli-zxqx25nz.js} +66 -23
- package/dist/cli.js +40 -32
- package/dist/{cloudflare-workers-ai-system-one-k6fbxw9d.js → cloudflare-workers-ai-system-one-k8ddqjkq.js} +8 -6
- package/dist/{codex-adapter-nmxcatww.js → codex-adapter-esvmnhn7.js} +24 -23
- package/dist/{codex-hook-20me6byw.js → codex-hook-m73jmqgx.js} +19 -3
- package/dist/{codex-login-w6fz4xbz.js → codex-login-cf7mzsgg.js} +2 -2
- package/dist/{codex-session-runner-90aa80ev.js → codex-session-runner-ban9excr.js} +24 -23
- package/dist/{commands-8wcq1kn7.js → commands-75413p2n.js} +13 -10
- package/dist/{db-j40kc4se.js → db-7f5pecwg.js} +17 -10
- package/dist/{dispatcher-4zqy768d.js → dispatcher-fh9at8nz.js} +41 -37
- package/dist/dsh-adapter-wpze65d4.js +24 -0
- package/dist/{e2b-ez07znam.js → e2b-gjgdjp91.js} +12 -9
- package/dist/easter-egg-3d-3w5c2n4c.js +1057 -0
- package/dist/{execute-6e7qeyk4.js → execute-f50wg9nh.js} +203 -49
- 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-kjdce1w5.js → handlers-w13787bb.js} +44 -40
- package/dist/{hook-r2t4bqfg.js → hook-46g1jrvx.js} +34 -20
- package/dist/{hook-czx13n12.js → hook-4tpts2ry.js} +25 -21
- package/dist/{http-3bbb19be.js → http-19pzbfrt.js} +1440 -283
- package/dist/{index-668me3f0.js → index-8fd4dm4h.js} +42 -38
- package/dist/{index-fg0dsp6c.js → index-dqmp15bq.js} +41 -37
- package/dist/{index-kkv84jq9.js → index-qb4q1y3e.js} +41 -37
- package/dist/index-s75wc4wd.js +33 -0
- package/dist/{index-zg7vp46x.js → index-scptvdxg.js} +64 -38
- package/dist/{keepalive-yra8dy57.js → keepalive-xa5ts9cd.js} +15 -12
- package/dist/{lead-va0pad2c.js → lead-qp4xkvjq.js} +59 -54
- package/dist/{maintenance-hqewtmyg.js → maintenance-rm5885hm.js} +17 -14
- package/dist/{mistral-conversations-pc3ntnxt.js → mistral-conversations-rw7fbt22.js} +4 -4
- package/dist/{node-a5e00qhp.js → node-8zkdq42h.js} +834 -833
- package/dist/node-f0ykebbv.js +2107 -0
- package/dist/node-wyamey5r.js +19 -0
- package/dist/{oauth-refresh-sweep-7rdt1m9n.js → oauth-refresh-sweep-1csdfebf.js} +14 -11
- package/dist/{onboard-j6ms6d0x.js → onboard-r6b78cs4.js} +10 -10
- package/dist/{openai-codex-responses-bbancrr0.js → openai-codex-responses-efvrgrq3.js} +4 -4
- package/dist/{openai-completions-jpaj5g2b.js → openai-completions-bbbrrz4z.js} +12 -8
- package/dist/{openai-responses-200k1wx4.js → openai-responses-9jjyrcm1.js} +15 -10
- package/dist/{opencode-adapter-89rabkw2.js → opencode-adapter-kb3g6pkf.js} +12 -9
- package/dist/{otel-impl-a792rjz0.js → otel-impl-0y9knpky.js} +6 -6
- package/dist/{pi-mono-adapter-g7qzvr3v.js → pi-mono-adapter-z6s1bme2.js} +128 -37
- package/dist/{pricing-refresh-wx0tp7cb.js → pricing-refresh-mth26tgp.js} +15 -12
- package/dist/{rbac-roles-8tzawacv.js → rbac-roles-kwntb23q.js} +17 -12
- package/dist/rbac-roles-vpk4ebm8.js +45 -0
- package/dist/{registry-v5wytg0s.js → registry-km6t1jd2.js} +1 -1
- package/dist/{render-v2-mm7zswb8.js → render-v2-hcm7h00y.js} +17 -14
- package/dist/{runtime-zyssgse0.js → runtime-vfjsfsc5.js} +5 -4
- package/dist/{setup-8y70ys6t.js → setup-hbyzd65h.js} +2 -2
- package/dist/{virtual-modules-6nmk7h3n.js → virtual-modules-9bv7ry91.js} +9 -7
- package/dist/{work-objects-fg6xkb0n.js → work-objects-m09sxnhe.js} +44 -40
- package/dist/{worker-wmwhxsph.js → worker-0h35rvk4.js} +59 -54
- package/dist/{x-n3e0v3xa.js → x-f1gt1pz3.js} +2 -2
- package/openapi.json +699 -26
- package/package.json +19 -11
- package/src/azure-devops/api.ts +121 -0
- package/src/azure-devops/auth.ts +78 -0
- package/src/azure-devops/handlers.ts +413 -0
- package/src/azure-devops/index.ts +27 -0
- package/src/azure-devops/templates.ts +108 -0
- package/src/azure-devops/types.ts +90 -0
- package/src/be/api-drain.ts +184 -0
- package/src/be/db/tasks/read.ts +32 -7
- package/src/be/db/tasks/write.ts +21 -4
- package/src/be/db-client.ts +11 -2
- package/src/be/db-retention.ts +95 -32
- package/src/be/db.ts +44 -19
- package/src/be/memory/constants.ts +16 -0
- package/src/be/memory/graph-expansion.ts +8 -1
- package/src/be/memory/index-content.ts +20 -1
- package/src/be/memory/key-guard.ts +93 -0
- package/src/be/memory/key-paths.ts +103 -0
- package/src/be/memory/link-resolver.ts +29 -3
- package/src/be/memory/providers/sqlite-store.ts +152 -45
- package/src/be/memory/raters/llm-summarizer.ts +10 -4
- package/src/be/memory/raters/llm.ts +15 -5
- package/src/be/memory/raters/store.ts +6 -3
- package/src/be/memory/raters/types.ts +11 -0
- package/src/be/memory/reranker.ts +38 -7
- package/src/be/memory/types.ts +12 -1
- package/src/be/migrations/190_memory_rating_model.sql +7 -0
- package/src/be/migrations/191_context_versions_previous_index.sql +8 -0
- package/src/be/migrations/192_favorites_agent_fs_path.sql +36 -0
- package/src/be/onboarding.ts +7 -1
- package/src/be/pricing-normalize.ts +4 -2
- package/src/be/scripts/typecheck.ts +4 -3
- package/src/be/seed-pricing.ts +16 -0
- package/src/be/seed-prompt-templates.ts +1 -0
- package/src/be/swarm-config-guard.ts +46 -17
- 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/claude-managed-setup.ts +33 -31
- package/src/commands/context-preamble.ts +4 -1
- package/src/commands/hook.ts +2 -1
- package/src/commands/provider-credentials.ts +28 -15
- package/src/commands/runner.ts +458 -110
- package/src/commands/templates.ts +10 -0
- package/src/e2b/env.ts +2 -0
- package/src/extensions/catalog.generated.json +17 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/fs/agent-fs-provider.ts +106 -2
- package/src/github/handlers.ts +10 -74
- package/src/github/reactions.ts +119 -138
- package/src/github/task-reactions.ts +34 -11
- package/src/heartbeat/heartbeat.ts +4 -0
- package/src/hooks/codex-hook.ts +25 -1
- package/src/hooks/hook.ts +14 -1
- package/src/hooks/pr-body-guard.ts +983 -0
- package/src/http/agents.ts +1 -1
- 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 +14 -1
- package/src/http/extensions.ts +51 -27
- package/src/http/fs.ts +9 -17
- package/src/http/index.ts +27 -9
- package/src/http/mcp-user.ts +8 -13
- package/src/http/mcp.ts +19 -12
- package/src/http/memory.ts +80 -14
- 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/session-data.ts +6 -4
- package/src/http/stats.ts +1 -0
- package/src/http/status.ts +34 -2
- package/src/http/tasks.ts +17 -3
- package/src/http/users.ts +1 -1
- package/src/http/webhooks.ts +120 -2
- package/src/kv-reserved-namespaces.ts +10 -5
- package/src/providers/claude-adapter.ts +84 -16
- package/src/providers/claude-managed-adapter.ts +29 -2
- package/src/providers/codex-adapter.ts +1 -1
- package/src/providers/codex-skill-resolver.ts +6 -0
- package/src/providers/dsh-adapter.ts +204 -7
- package/src/providers/opencode-adapter.ts +24 -3
- package/src/providers/pi-mono-adapter.ts +154 -5
- package/src/providers/pi-mono-extension.ts +1 -1
- package/src/providers/pricing-sources.md +5 -1
- package/src/providers/reasoning-effort.ts +10 -2
- package/src/providers/types.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +14 -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/stdlib.d.ts +13 -5
- package/src/scripts-runtime/types/swarm-extension.d.ts +7 -3
- package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -5
- package/src/tasks/context-key.ts +38 -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/azure-devops-auth.test.ts +100 -0
- package/src/tests/azure-devops-handlers.test.ts +324 -0
- package/src/tests/azure-devops-webhook-malformed.test.ts +96 -0
- package/src/tests/claude-default-route.test.ts +260 -0
- package/src/tests/claude-managed-adapter.test.ts +47 -0
- package/src/tests/claude-managed-setup.test.ts +48 -0
- package/src/tests/claude-prompt-body-once.test.ts +117 -0
- package/src/tests/claude-routes-e2e.test.ts +316 -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/context-versions-retention.test.ts +314 -0
- package/src/tests/core-auth.test.ts +7 -0
- package/src/tests/db-retention.test.ts +14 -14
- package/src/tests/db-task-read-contract.test.ts +3 -0
- package/src/tests/db-task-write-contract.test.ts +3 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +134 -2
- package/src/tests/dsh-usage.test.ts +153 -0
- package/src/tests/extensions-catalog.test.ts +1 -0
- package/src/tests/extensions-example-deploy-awareness.test.ts +301 -0
- package/src/tests/extensions-http.test.ts +137 -10
- package/src/tests/extensions-mcp-tools.test.ts +28 -0
- package/src/tests/favorites-agent-fs-path.test.ts +226 -0
- package/src/tests/fetch-resolved-env.test.ts +24 -0
- package/src/tests/fixtures/azure-devops/pull-request-commented.json +129 -0
- package/src/tests/fixtures/azure-devops/pull-request-created.json +88 -0
- package/src/tests/fixtures/fake-claude-routes.ts +229 -0
- package/src/tests/github-handlers-reactions.test.ts +486 -0
- package/src/tests/github-reactions.test.ts +280 -0
- package/src/tests/harness-cli-version.test.ts +62 -0
- package/src/tests/http-api-integration.test.ts +21 -0
- package/src/tests/http-task-write-ownership.test.ts +24 -1
- package/src/tests/internal-ai/complete-structured.test.ts +94 -0
- package/src/tests/internal-ai/credentials.test.ts +22 -0
- package/src/tests/internal-ai/models.test.ts +36 -2
- package/src/tests/internal-ai/schema-parity.test.ts +25 -1
- package/src/tests/internal-ai/summarize-session.test.ts +23 -7
- package/src/tests/mcp-user-route.test.ts +133 -0
- package/src/tests/memory-key-paths.test.ts +1055 -0
- package/src/tests/memory-link-resolver.test.ts +34 -0
- package/src/tests/memory-rate-endpoint.test.ts +66 -0
- package/src/tests/memory-rater-llm-summarizer.test.ts +2 -1
- package/src/tests/memory-rater-llm.test.ts +73 -0
- package/src/tests/memory-rater-store.test.ts +31 -0
- package/src/tests/memory-reranker.test.ts +40 -0
- package/src/tests/onboarding.test.ts +108 -0
- package/src/tests/opencode-adapter.test.ts +57 -0
- package/src/tests/opencode-plugin.test.ts +4 -0
- package/src/tests/pi-codemode.test.ts +82 -4
- 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 +14 -0
- package/src/tests/provider-registration.test.ts +0 -2
- package/src/tests/providers/pi-cost.test.ts +190 -4
- package/src/tests/rbac-engine.test.ts +25 -1
- 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/runner-slot-reconcile.test.ts +199 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/send-task-requested-by.test.ts +133 -15
- package/src/tests/session-costs-recompute-all-providers.test.ts +23 -0
- package/src/tests/task-lifecycle-telemetry.test.ts +8 -3
- package/src/tests/task-reactions.test.ts +29 -6
- 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/vcs-azure-devops.test.ts +73 -0
- package/src/tests/webhooks-task-blocked.test.ts +23 -0
- package/src/tests/workflow-agent-task-retry.test.ts +363 -0
- package/src/tests/workflow-definition-telemetry.test.ts +4 -4
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tools/context-diff.ts +20 -0
- package/src/tools/extension-install.ts +27 -16
- package/src/tools/memory-edit.ts +47 -3
- package/src/tools/memory-search.ts +13 -1
- package/src/tools/memory-store.ts +55 -3
- 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 +45 -8
- package/src/utils/api-drain.ts +24 -0
- package/src/utils/constants.ts +57 -16
- package/src/utils/credentials.test.ts +31 -1
- package/src/utils/credentials.ts +20 -9
- package/src/utils/dsh-usage.ts +53 -0
- package/src/utils/harness-cli-version.ts +6 -4
- package/src/utils/internal-ai/complete-structured.ts +26 -3
- package/src/utils/internal-ai/credentials.ts +23 -9
- package/src/utils/internal-ai/index.ts +8 -1
- package/src/utils/internal-ai/models.ts +34 -8
- package/src/utils/internal-ai/summarize-session.ts +22 -8
- package/src/utils/pr-body-leaks.ts +172 -0
- package/src/utils/secret-scrubber.ts +8 -0
- package/src/utils/task-attachment-links.ts +14 -8
- package/src/vcs/azure-devops.ts +80 -0
- package/src/vcs/index.ts +5 -1
- package/src/vcs/types.ts +2 -2
- package/src/workflows/recovery.ts +26 -1
- package/src/workflows/resume.ts +31 -4
- package/src/workflows/task-step-routing.ts +75 -2
- package/templates/community/open-prompt-showreel/PLAYBOOK.md +336 -0
- package/templates/community/open-prompt-showreel/README.md +33 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.ts +145 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.v3.json +140 -0
- package/templates/community/open-prompt-showreel/example/tla-races/music.mist-city.json +8 -0
- package/templates/community/open-prompt-showreel/example/tla-races/reel.html +805 -0
- package/templates/community/open-prompt-showreel/example/tla-races/smoke.sh +48 -0
- package/templates/community/open-prompt-showreel/lead-prompt.md +89 -0
- package/templates/community/open-prompt-showreel/setup.sh +167 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-replication/SKILL.md +85 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-video-analysis/SKILL.md +115 -0
- package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +147 -0
- package/templates/community/open-prompt-showreel/skills/video-generation/SKILL.md +195 -0
- package/templates/community/open-prompt-showreel/tools/fetch-music.sh +65 -0
- package/templates/community/open-prompt-showreel/tools/music-analyze.py +69 -0
- package/templates/community/open-prompt-showreel/tools/music-current.sh +34 -0
- package/templates/community/open-prompt-showreel/tools/music-cut.sh +36 -0
- package/templates/community/open-prompt-showreel/tools/music-refine.py +39 -0
- package/templates/community/open-prompt-showreel/tools/render.mjs +157 -0
- package/templates/community/open-prompt-showreel/tools/sheet.sh +44 -0
- package/templates/community/open-prompt-showreel/tools/web-compress.sh +17 -0
- package/templates/community/open-prompt-showreel/tools/x-reencode.sh +21 -0
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/deploy-awareness/README.md +28 -0
- package/templates/extensions/deploy-awareness/hooks.ts +152 -0
- package/templates/extensions/deploy-awareness/manifest.json +8 -0
- package/templates/skills/memory/config.json +2 -2
- package/templates/skills/memory/content.md +59 -5
- package/templates/skills/swarm-extensions/config.json +1 -1
- package/templates/skills/swarm-extensions/content.md +28 -5
- package/tsconfig.json +3 -0
- package/dist/boot-seeds-gsetbs5y.js +0 -28
- package/dist/cli-j490egb5.js +0 -5632
- package/dist/cli-tjf4cn8z.js +0 -9119
- package/dist/cli-tmqt7dpj.js +0 -572
- package/dist/dsh-adapter-mpnzgztj.js +0 -19
- package/dist/index-7aj368tw.js +0 -30
package/src/telemetry.ts
CHANGED
|
@@ -3,13 +3,41 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - Opt-out via ANONYMIZED_TELEMETRY=false
|
|
5
5
|
* - Fire-and-forget: never throws, never blocks
|
|
6
|
-
* - No external
|
|
6
|
+
* - No DB and no external services (global fetch + node:crypto only)
|
|
7
7
|
* - Importable from both API server and workers
|
|
8
|
+
* - Every event is schema_version 2: a top-level `context` identity envelope
|
|
9
|
+
* plus properties typed against the proxy's event catalog
|
|
10
|
+
* (`src/telemetry-contract`). An event or property that is not in the
|
|
11
|
+
* catalog fails `tsc`, and the proxy rejects it at ingest.
|
|
8
12
|
*/
|
|
9
13
|
import { randomUUID } from "node:crypto";
|
|
10
14
|
import pkg from "../package.json";
|
|
11
15
|
import { isSlackConfigured } from "./slack/config";
|
|
16
|
+
import {
|
|
17
|
+
buildContext,
|
|
18
|
+
mintOrgId,
|
|
19
|
+
normalizeProperties,
|
|
20
|
+
type TelemetryActor,
|
|
21
|
+
type TelemetryUserRole,
|
|
22
|
+
validOrgDomain,
|
|
23
|
+
validOrgId,
|
|
24
|
+
} from "./telemetry-context";
|
|
25
|
+
import type { PropsFor, TelemetryEventName } from "./telemetry-contract";
|
|
12
26
|
import { isEnvFlagEnabled } from "./utils/env-flag";
|
|
27
|
+
import { getCurrentRequestUserId } from "./utils/request-auth-context";
|
|
28
|
+
|
|
29
|
+
export type { TelemetryActor } from "./telemetry-context";
|
|
30
|
+
|
|
31
|
+
type SwarmEventName = TelemetryEventName<"agent-swarm">;
|
|
32
|
+
/** `started` for `server.started`: the event names of one family, without the prefix. */
|
|
33
|
+
type EventSuffix<Prefix extends string> = SwarmEventName extends infer E
|
|
34
|
+
? E extends `${Prefix}.${infer Suffix}`
|
|
35
|
+
? Suffix
|
|
36
|
+
: never
|
|
37
|
+
: never;
|
|
38
|
+
type FamilyProps<Prefix extends string, S extends string> = PropsFor<
|
|
39
|
+
Extract<SwarmEventName, `${Prefix}.${S}`>
|
|
40
|
+
>;
|
|
13
41
|
|
|
14
42
|
const TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events";
|
|
15
43
|
const PRODUCT = "agent-swarm";
|
|
@@ -17,6 +45,13 @@ const TIMEOUT_MS = 5_000;
|
|
|
17
45
|
|
|
18
46
|
let installationId: string | null = null;
|
|
19
47
|
let installedAt: string | null = null;
|
|
48
|
+
/** Org ID resolved at init (env, then `telemetry_org_id`). `SWARM_ORG_ID` is re-read per event. */
|
|
49
|
+
let cachedOrgId: string | undefined;
|
|
50
|
+
/** Email domain of the org's admin, set by the API server (`setTelemetryOrgDomain`). */
|
|
51
|
+
let cachedOrgDomain: string | undefined;
|
|
52
|
+
let roleResolver: ((userId: string) => TelemetryUserRole | undefined) | null = null;
|
|
53
|
+
let identityReloader: (() => Promise<void>) | null = null;
|
|
54
|
+
let lastIdentityLoadAt = 0;
|
|
20
55
|
let source = "unknown";
|
|
21
56
|
let cachedIsCloud = false;
|
|
22
57
|
let cachedIsE2b = false;
|
|
@@ -362,6 +397,112 @@ export async function initTelemetry(
|
|
|
362
397
|
}
|
|
363
398
|
// else: leave installationId = null; track() will no-op
|
|
364
399
|
}
|
|
400
|
+
|
|
401
|
+
if (installationId) {
|
|
402
|
+
await loadOrgIdentity(getConfig, setConfig, generateIfMissing);
|
|
403
|
+
if (!generateIfMissing) {
|
|
404
|
+
// Workers cannot mint an org ID and the API server updates the org
|
|
405
|
+
// domain while they run, so they re-read both through the same
|
|
406
|
+
// config reader: soon after boot while the org ID is missing, hourly after.
|
|
407
|
+
identityReloader = () => loadOrgIdentity(getConfig, setConfig, false);
|
|
408
|
+
lastIdentityLoadAt = Date.now();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const ORG_IDENTITY_RETRY_MS = 60_000;
|
|
414
|
+
const ORG_IDENTITY_REFRESH_MS = 60 * 60_000;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Resolve the org ID and the org email domain.
|
|
418
|
+
*
|
|
419
|
+
* The org ID is `SWARM_ORG_ID` when it is a valid ID (cloud sets it), else the
|
|
420
|
+
* one persisted as `swarm_config.telemetry_org_id`, else (API server only) a
|
|
421
|
+
* newly minted `org_<16 hex>` that is persisted next to the installation ID.
|
|
422
|
+
* The API server also persists a valid `SWARM_ORG_ID`, so workers, which never
|
|
423
|
+
* see that env var, send the same org ID.
|
|
424
|
+
*/
|
|
425
|
+
async function loadOrgIdentity(
|
|
426
|
+
getConfig: (key: string) => Promise<string | undefined> | string | undefined,
|
|
427
|
+
setConfig: (key: string, value: string) => Promise<void> | void,
|
|
428
|
+
generateIfMissing: boolean,
|
|
429
|
+
): Promise<void> {
|
|
430
|
+
const rawEnvOrg = process.env.SWARM_ORG_ID?.trim();
|
|
431
|
+
const envOrg = validOrgId(rawEnvOrg);
|
|
432
|
+
if (rawEnvOrg && !envOrg && generateIfMissing) {
|
|
433
|
+
console.log(
|
|
434
|
+
"telemetry: SWARM_ORG_ID is not org_<16 hex> or org_<27 alphanumerics>; using a derived org ID",
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
let stored: string | undefined;
|
|
439
|
+
try {
|
|
440
|
+
stored = validOrgId(await getConfig("telemetry_org_id"));
|
|
441
|
+
} catch {
|
|
442
|
+
// Config unreadable: fall through with what the env gives us.
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (generateIfMissing) {
|
|
446
|
+
const wanted = envOrg ?? stored ?? mintOrgId();
|
|
447
|
+
if (wanted !== stored) {
|
|
448
|
+
try {
|
|
449
|
+
await setConfig("telemetry_org_id", wanted);
|
|
450
|
+
} catch {
|
|
451
|
+
// Not persisted: this session still sends `wanted`, like the ephemeral install ID.
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
cachedOrgId = wanted;
|
|
455
|
+
} else {
|
|
456
|
+
cachedOrgId = envOrg ?? stored;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
try {
|
|
460
|
+
cachedOrgDomain = validOrgDomain(await getConfig("telemetry_org_domain"));
|
|
461
|
+
} catch {
|
|
462
|
+
// Keep the previous value.
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** The current org ID: a valid `SWARM_ORG_ID` (re-read per event) or the resolved one. */
|
|
467
|
+
function currentOrgId(): string | undefined {
|
|
468
|
+
return validOrgId(process.env.SWARM_ORG_ID) ?? cachedOrgId;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function maybeRefreshOrgIdentity(): void {
|
|
472
|
+
if (!identityReloader) return;
|
|
473
|
+
const now = Date.now();
|
|
474
|
+
const interval = currentOrgId() ? ORG_IDENTITY_REFRESH_MS : ORG_IDENTITY_RETRY_MS;
|
|
475
|
+
if (now - lastIdentityLoadAt < interval) return;
|
|
476
|
+
lastIdentityLoadAt = now;
|
|
477
|
+
identityReloader().catch(() => {});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** API server only: publish the org admin's email domain (never the email). */
|
|
481
|
+
export function setTelemetryOrgDomain(domain: string | null | undefined): void {
|
|
482
|
+
cachedOrgDomain = validOrgDomain(domain);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* API server only: how to look up a user's role for `context.user_role`
|
|
487
|
+
* without an await. The resolver must be synchronous and cache-backed.
|
|
488
|
+
*/
|
|
489
|
+
export function setTelemetryRoleResolver(
|
|
490
|
+
resolver: ((userId: string) => TelemetryUserRole | undefined) | null,
|
|
491
|
+
): void {
|
|
492
|
+
roleResolver = resolver;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* True when `track()` would send: telemetry is on, an install ID exists and an
|
|
497
|
+
* org ID resolved. Emitters that record "already sent" state check this first.
|
|
498
|
+
*/
|
|
499
|
+
export function isTelemetryReady(): boolean {
|
|
500
|
+
return isTelemetryEnabled() && installationId !== null && currentOrgId() !== undefined;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** The install ID, or null before `initTelemetry` resolved one (or after opt-out). */
|
|
504
|
+
export function getTelemetryInstallationId(): string | null {
|
|
505
|
+
return installationId;
|
|
365
506
|
}
|
|
366
507
|
|
|
367
508
|
/**
|
|
@@ -390,10 +531,12 @@ async function tryPersistInstalledAt(
|
|
|
390
531
|
}
|
|
391
532
|
}
|
|
392
533
|
|
|
393
|
-
interface TrackOptions {
|
|
394
|
-
event:
|
|
395
|
-
properties
|
|
534
|
+
export interface TrackOptions<E extends SwarmEventName> {
|
|
535
|
+
event: E;
|
|
536
|
+
properties: PropsFor<E>;
|
|
396
537
|
metadata?: Record<string, unknown>;
|
|
538
|
+
/** Who caused the event. Omit for system events (`user_ref` is then null). */
|
|
539
|
+
actor?: TelemetryActor;
|
|
397
540
|
}
|
|
398
541
|
|
|
399
542
|
/**
|
|
@@ -432,19 +575,63 @@ function getTelemetryEnvironment(): string {
|
|
|
432
575
|
return "production";
|
|
433
576
|
}
|
|
434
577
|
|
|
435
|
-
/**
|
|
436
|
-
|
|
578
|
+
/**
|
|
579
|
+
* Fire-and-forget telemetry event. Never throws, never blocks.
|
|
580
|
+
*
|
|
581
|
+
* Sends `schema_version: 2`: a `context` identity envelope (org, pseudonymous
|
|
582
|
+
* user, plan, deployment, version) and catalog-typed `properties`. Drops the
|
|
583
|
+
* event (rather than sending a half-identified one) until an org ID exists.
|
|
584
|
+
*/
|
|
585
|
+
export function track<E extends SwarmEventName>(options: TrackOptions<E>): void {
|
|
586
|
+
emit(
|
|
587
|
+
options.event,
|
|
588
|
+
options.properties as Record<string, unknown>,
|
|
589
|
+
options.metadata,
|
|
590
|
+
options.actor,
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/** The untyped sender behind `track` and the typed `telemetry.*` wrappers. */
|
|
595
|
+
function emit(
|
|
596
|
+
event: string,
|
|
597
|
+
properties: Record<string, unknown>,
|
|
598
|
+
metadata?: Record<string, unknown>,
|
|
599
|
+
actor?: TelemetryActor,
|
|
600
|
+
): void {
|
|
437
601
|
if (!isTelemetryEnabled() || !installationId) return;
|
|
602
|
+
maybeRefreshOrgIdentity();
|
|
603
|
+
const orgId = currentOrgId();
|
|
604
|
+
if (!orgId) return;
|
|
438
605
|
try {
|
|
606
|
+
const isCloud = cachedIsCloud || isCloudDeployment();
|
|
607
|
+
const orgIdentity = getOrgIdentity();
|
|
608
|
+
const userId = actor?.userId?.trim() || undefined;
|
|
439
609
|
const payload = {
|
|
610
|
+
schema_version: 2 as const,
|
|
440
611
|
product: PRODUCT,
|
|
441
|
-
event
|
|
612
|
+
event,
|
|
442
613
|
occurred_at: new Date().toISOString(),
|
|
443
614
|
source,
|
|
444
615
|
actor_mode: "anonymous" as const,
|
|
445
616
|
actor_anonymous_id: installationId,
|
|
446
|
-
|
|
447
|
-
|
|
617
|
+
context: buildContext({
|
|
618
|
+
orgId,
|
|
619
|
+
orgName: orgIdentity.organization_name,
|
|
620
|
+
orgDomain: cachedOrgDomain,
|
|
621
|
+
installationId,
|
|
622
|
+
actor: userId ? { userId, role: actor?.role ?? roleResolver?.(userId) ?? null } : undefined,
|
|
623
|
+
isCloud,
|
|
624
|
+
isE2b: cachedIsE2b,
|
|
625
|
+
swarmVersion: pkg.version,
|
|
626
|
+
installMethod: cachedInstallMethod,
|
|
627
|
+
installPreset: cachedInstallPreset,
|
|
628
|
+
// Stays null until the dashboard reports where the visitor came from.
|
|
629
|
+
acquisitionSource: null,
|
|
630
|
+
}),
|
|
631
|
+
properties: normalizeProperties(event, {
|
|
632
|
+
...properties,
|
|
633
|
+
// Legacy keys, kept during the v1 window so dashboards that still read
|
|
634
|
+
// properties_json keep working; v2 carries the same facts in `context`.
|
|
448
635
|
// Cloud-cohort signal. Two independent signals OR'd together:
|
|
449
636
|
// `cachedIsCloud` (MCP_BASE_URL points at a host we own, resolved at
|
|
450
637
|
// init time) catches self-host operators who point their swarm at
|
|
@@ -461,7 +648,7 @@ export function track(options: TrackOptions): void {
|
|
|
461
648
|
// caller-supplied keys can never spoof the cohort classification.
|
|
462
649
|
// The hostname is intentionally NOT included — telemetry must stay
|
|
463
650
|
// anonymous, and the boolean is sufficient to split cloud vs self-host.
|
|
464
|
-
is_cloud:
|
|
651
|
+
is_cloud: isCloud,
|
|
465
652
|
is_e2b: cachedIsE2b,
|
|
466
653
|
swarmVersion: pkg.version,
|
|
467
654
|
// Instrumentation-gap closure (2026-07-29): activation-funnel signals.
|
|
@@ -473,17 +660,16 @@ export function track(options: TrackOptions): void {
|
|
|
473
660
|
has_email_channel: cachedHasEmailChannel,
|
|
474
661
|
has_notification_channel: cachedHasSlackChannel || cachedHasEmailChannel,
|
|
475
662
|
install_method: cachedInstallMethod,
|
|
476
|
-
},
|
|
663
|
+
}),
|
|
477
664
|
metadata: {
|
|
478
665
|
transport: "https",
|
|
479
|
-
schema_version: 1,
|
|
480
666
|
environment: getTelemetryEnvironment(),
|
|
481
667
|
is_cloud: isCloudDeployment(),
|
|
482
|
-
...
|
|
668
|
+
...orgIdentity,
|
|
483
669
|
// Optional — only present when known, same pattern as organization_*.
|
|
484
670
|
...(cachedInstallPreset ? { install_preset: cachedInstallPreset } : {}),
|
|
485
671
|
...(installedAt ? { install_created_at: installedAt } : {}),
|
|
486
|
-
...
|
|
672
|
+
...metadata,
|
|
487
673
|
},
|
|
488
674
|
};
|
|
489
675
|
fetch(TELEMETRY_ENDPOINT, {
|
|
@@ -512,6 +698,16 @@ export function _resetTelemetryStateForTests(): void {
|
|
|
512
698
|
cachedHasEmailChannel = false;
|
|
513
699
|
cachedInstallMethod = "manual";
|
|
514
700
|
cachedInstallPreset = undefined;
|
|
701
|
+
cachedOrgId = undefined;
|
|
702
|
+
cachedOrgDomain = undefined;
|
|
703
|
+
roleResolver = null;
|
|
704
|
+
identityReloader = null;
|
|
705
|
+
lastIdentityLoadAt = 0;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/** Test-only: read the org ID resolved at init. */
|
|
709
|
+
export function _getOrgIdForTests(): string | undefined {
|
|
710
|
+
return cachedOrgId;
|
|
515
711
|
}
|
|
516
712
|
|
|
517
713
|
/** Test-only: read the resolved install ID. */
|
|
@@ -525,88 +721,90 @@ export function _getInstalledAtForTests(): string | null {
|
|
|
525
721
|
}
|
|
526
722
|
|
|
527
723
|
export const telemetry = {
|
|
528
|
-
taskEvent(
|
|
529
|
-
event:
|
|
530
|
-
props:
|
|
531
|
-
|
|
532
|
-
source?: string;
|
|
533
|
-
durationMs?: number;
|
|
534
|
-
hasParent?: boolean;
|
|
535
|
-
agentId?: string;
|
|
536
|
-
priority?: number;
|
|
537
|
-
[k: string]: unknown;
|
|
538
|
-
},
|
|
724
|
+
taskEvent<S extends EventSuffix<"task">>(
|
|
725
|
+
event: S,
|
|
726
|
+
props: FamilyProps<"task", S>,
|
|
727
|
+
actor?: TelemetryActor,
|
|
539
728
|
): void {
|
|
540
|
-
|
|
729
|
+
emit(`task.${event}`, props as Record<string, unknown>, undefined, actor);
|
|
541
730
|
},
|
|
542
731
|
|
|
543
|
-
server(event:
|
|
544
|
-
|
|
732
|
+
server<S extends EventSuffix<"server">>(event: S, props: FamilyProps<"server", S>): void {
|
|
733
|
+
emit(`server.${event}`, props as Record<string, unknown>, undefined);
|
|
545
734
|
},
|
|
546
735
|
|
|
547
|
-
session
|
|
548
|
-
|
|
736
|
+
session<S extends EventSuffix<"session">>(
|
|
737
|
+
event: S,
|
|
738
|
+
props: FamilyProps<"session", S>,
|
|
739
|
+
actor?: TelemetryActor,
|
|
740
|
+
): void {
|
|
741
|
+
emit(`session.${event}`, props as Record<string, unknown>, undefined, actor);
|
|
549
742
|
},
|
|
550
743
|
|
|
551
|
-
schedule(event:
|
|
552
|
-
|
|
744
|
+
schedule<S extends EventSuffix<"schedule">>(event: S, props: FamilyProps<"schedule", S>): void {
|
|
745
|
+
emit(`schedule.${event}`, props as Record<string, unknown>, undefined);
|
|
553
746
|
},
|
|
554
747
|
|
|
555
|
-
workflow
|
|
556
|
-
|
|
748
|
+
workflow<S extends EventSuffix<"workflow">>(
|
|
749
|
+
event: S,
|
|
750
|
+
props: FamilyProps<"workflow", S>,
|
|
751
|
+
actor?: TelemetryActor,
|
|
752
|
+
): void {
|
|
753
|
+
emit(`workflow.${event}`, props as Record<string, unknown>, undefined, actor);
|
|
557
754
|
},
|
|
558
755
|
|
|
559
|
-
agent(event:
|
|
560
|
-
|
|
756
|
+
agent<S extends EventSuffix<"agent">>(event: S, props: FamilyProps<"agent", S>): void {
|
|
757
|
+
emit(`agent.${event}`, props as Record<string, unknown>, undefined);
|
|
561
758
|
},
|
|
562
759
|
|
|
563
|
-
onboarding(
|
|
564
|
-
event:
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
| "step_completed"
|
|
568
|
-
| "step_skipped"
|
|
569
|
-
| "step_failed"
|
|
570
|
-
| "dismissed"
|
|
571
|
-
| "completed"
|
|
572
|
-
| "first_task_completed",
|
|
573
|
-
props: Record<string, string | boolean | number>,
|
|
760
|
+
onboarding<S extends EventSuffix<"onboarding">>(
|
|
761
|
+
event: S,
|
|
762
|
+
props: Omit<FamilyProps<"onboarding", S>, "seconds_since_install">,
|
|
763
|
+
actor?: TelemetryActor,
|
|
574
764
|
): void {
|
|
575
765
|
const installedAtMs = installedAt ? Date.parse(installedAt) : Number.NaN;
|
|
576
766
|
const secondsSinceInstall = Number.isFinite(installedAtMs)
|
|
577
767
|
? Math.max(0, Math.floor((Date.now() - installedAtMs) / 1_000))
|
|
578
768
|
: undefined;
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
769
|
+
emit(
|
|
770
|
+
`onboarding.${event}`,
|
|
771
|
+
{
|
|
582
772
|
...props,
|
|
583
773
|
...(secondsSinceInstall !== undefined
|
|
584
774
|
? { seconds_since_install: secondsSinceInstall }
|
|
585
775
|
: {}),
|
|
586
776
|
},
|
|
587
|
-
|
|
777
|
+
undefined,
|
|
778
|
+
actor,
|
|
779
|
+
);
|
|
780
|
+
},
|
|
781
|
+
|
|
782
|
+
org<S extends EventSuffix<"org">>(event: S, props: FamilyProps<"org", S>): void {
|
|
783
|
+
emit(`org.${event}`, props as Record<string, unknown>, undefined);
|
|
588
784
|
},
|
|
589
785
|
|
|
590
786
|
integration(
|
|
591
|
-
event:
|
|
787
|
+
event: "connected",
|
|
592
788
|
props: { type: IntegrationType; provider?: IntegrationProvider; first_of_type: boolean },
|
|
789
|
+
actor?: TelemetryActor,
|
|
593
790
|
): void {
|
|
594
791
|
const type = KNOWN_INTEGRATION_TYPES.has(props.type) ? props.type : "other";
|
|
595
792
|
const provider = props.provider
|
|
596
793
|
? integrationProviderEntry(props.provider)?.provider
|
|
597
794
|
: undefined;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
},
|
|
605
|
-
});
|
|
795
|
+
emit(
|
|
796
|
+
`integration.${event}`,
|
|
797
|
+
{ type, ...(provider ? { provider } : {}), first_of_type: props.first_of_type },
|
|
798
|
+
undefined,
|
|
799
|
+
actor,
|
|
800
|
+
);
|
|
606
801
|
},
|
|
607
802
|
|
|
608
|
-
compaction
|
|
609
|
-
|
|
803
|
+
compaction<S extends EventSuffix<"compaction">>(
|
|
804
|
+
event: S,
|
|
805
|
+
props: FamilyProps<"compaction", S>,
|
|
806
|
+
): void {
|
|
807
|
+
emit(`compaction.${event}`, props as Record<string, unknown>, undefined);
|
|
610
808
|
},
|
|
611
809
|
};
|
|
612
810
|
|
|
@@ -622,10 +820,16 @@ export function emitIntegrationConnected(
|
|
|
622
820
|
): boolean {
|
|
623
821
|
if (!isTelemetryEnabled() || !installationId) return false;
|
|
624
822
|
const provider = _resolveIntegrationProvider(providerSlug);
|
|
625
|
-
telemetry.integration(
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
823
|
+
telemetry.integration(
|
|
824
|
+
"connected",
|
|
825
|
+
{
|
|
826
|
+
type,
|
|
827
|
+
...(provider ? { provider } : {}),
|
|
828
|
+
first_of_type: firstOfType,
|
|
829
|
+
},
|
|
830
|
+
// The user whose request connected it, when there is one (a boot-time
|
|
831
|
+
// built-in connection has none, so user_ref is null).
|
|
832
|
+
{ userId: getCurrentRequestUserId() ?? null },
|
|
833
|
+
);
|
|
630
834
|
return true;
|
|
631
835
|
}
|