agent-relay 11.1.1 → 11.3.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.
Files changed (92) hide show
  1. package/README.md +80 -0
  2. package/dist/cli/agent-relay-mcp.d.ts +1 -0
  3. package/dist/cli/agent-relay-mcp.d.ts.map +1 -1
  4. package/dist/cli/agent-relay-mcp.js +10 -3
  5. package/dist/cli/agent-relay-mcp.js.map +1 -1
  6. package/dist/cli/bootstrap.d.ts +14 -0
  7. package/dist/cli/bootstrap.d.ts.map +1 -1
  8. package/dist/cli/bootstrap.js +83 -7
  9. package/dist/cli/bootstrap.js.map +1 -1
  10. package/dist/cli/commands/agent.d.ts.map +1 -1
  11. package/dist/cli/commands/agent.js +12 -0
  12. package/dist/cli/commands/agent.js.map +1 -1
  13. package/dist/cli/commands/cloud-integration.d.ts +6 -0
  14. package/dist/cli/commands/cloud-integration.d.ts.map +1 -0
  15. package/dist/cli/commands/cloud-integration.js +282 -0
  16. package/dist/cli/commands/cloud-integration.js.map +1 -0
  17. package/dist/cli/commands/cloud-room.d.ts +11 -0
  18. package/dist/cli/commands/cloud-room.d.ts.map +1 -0
  19. package/dist/cli/commands/cloud-room.js +569 -0
  20. package/dist/cli/commands/cloud-room.js.map +1 -0
  21. package/dist/cli/commands/cloud.d.ts.map +1 -1
  22. package/dist/cli/commands/cloud.js +14 -3
  23. package/dist/cli/commands/cloud.js.map +1 -1
  24. package/dist/cli/commands/core.d.ts +2 -0
  25. package/dist/cli/commands/core.d.ts.map +1 -1
  26. package/dist/cli/commands/core.js +11 -5
  27. package/dist/cli/commands/core.js.map +1 -1
  28. package/dist/cli/commands/local-agent.d.ts.map +1 -1
  29. package/dist/cli/commands/local-agent.js +13 -1
  30. package/dist/cli/commands/local-agent.js.map +1 -1
  31. package/dist/cli/commands/node.js +4 -0
  32. package/dist/cli/commands/node.js.map +1 -1
  33. package/dist/cli/commands/setup.d.ts.map +1 -1
  34. package/dist/cli/commands/setup.js +9 -0
  35. package/dist/cli/commands/setup.js.map +1 -1
  36. package/dist/cli/lib/attach-drive.d.ts +37 -18
  37. package/dist/cli/lib/attach-drive.d.ts.map +1 -1
  38. package/dist/cli/lib/attach-drive.js +178 -75
  39. package/dist/cli/lib/attach-drive.js.map +1 -1
  40. package/dist/cli/lib/attach-passthrough.d.ts +5 -0
  41. package/dist/cli/lib/attach-passthrough.d.ts.map +1 -1
  42. package/dist/cli/lib/attach-passthrough.js +108 -31
  43. package/dist/cli/lib/attach-passthrough.js.map +1 -1
  44. package/dist/cli/lib/attach-view.d.ts +2 -0
  45. package/dist/cli/lib/attach-view.d.ts.map +1 -1
  46. package/dist/cli/lib/attach-view.js +10 -0
  47. package/dist/cli/lib/attach-view.js.map +1 -1
  48. package/dist/cli/lib/attach.d.ts +127 -11
  49. package/dist/cli/lib/attach.d.ts.map +1 -1
  50. package/dist/cli/lib/attach.js +471 -31
  51. package/dist/cli/lib/attach.js.map +1 -1
  52. package/dist/cli/lib/broker-lifecycle.d.ts +3 -2
  53. package/dist/cli/lib/broker-lifecycle.d.ts.map +1 -1
  54. package/dist/cli/lib/broker-lifecycle.js +63 -5
  55. package/dist/cli/lib/broker-lifecycle.js.map +1 -1
  56. package/dist/cli/lib/sdk-client.d.ts.map +1 -1
  57. package/dist/cli/lib/sdk-client.js +10 -1
  58. package/dist/cli/lib/sdk-client.js.map +1 -1
  59. package/dist/cli/mcp/action-schema.d.ts +2 -2
  60. package/dist/cli/mcp/action-schema.d.ts.map +1 -1
  61. package/dist/cli/mcp/action-schema.js +1 -1
  62. package/dist/cli/mcp/action-schema.js.map +1 -1
  63. package/dist/cli/mcp/messaging-tools.js +5 -5
  64. package/dist/cli/mcp/messaging-tools.js.map +1 -1
  65. package/dist/cli/mcp/tool-results.d.ts +1 -1
  66. package/dist/cli/mcp/tool-results.d.ts.map +1 -1
  67. package/dist/cli/mcp/tool-results.js +1 -1
  68. package/dist/cli/mcp/tool-results.js.map +1 -1
  69. package/dist/cli/telemetry/client.d.ts +16 -0
  70. package/dist/cli/telemetry/client.d.ts.map +1 -1
  71. package/dist/cli/telemetry/client.js +122 -5
  72. package/dist/cli/telemetry/client.js.map +1 -1
  73. package/dist/cli/telemetry/config.d.ts +14 -1
  74. package/dist/cli/telemetry/config.d.ts.map +1 -1
  75. package/dist/cli/telemetry/config.js +10 -0
  76. package/dist/cli/telemetry/config.js.map +1 -1
  77. package/dist/cli/telemetry/events.d.ts +35 -0
  78. package/dist/cli/telemetry/events.d.ts.map +1 -1
  79. package/dist/cli/telemetry/index.d.ts +1 -1
  80. package/dist/cli/telemetry/index.d.ts.map +1 -1
  81. package/dist/cli/telemetry/index.js +1 -1
  82. package/dist/cli/telemetry/index.js.map +1 -1
  83. package/dist/cli/telemetry/posthog-config.d.ts +21 -15
  84. package/dist/cli/telemetry/posthog-config.d.ts.map +1 -1
  85. package/dist/cli/telemetry/posthog-config.js +32 -21
  86. package/dist/cli/telemetry/posthog-config.js.map +1 -1
  87. package/dist/cli/telemetry/posthog-key.d.ts +18 -0
  88. package/dist/cli/telemetry/posthog-key.d.ts.map +1 -0
  89. package/dist/cli/telemetry/posthog-key.js +18 -0
  90. package/dist/cli/telemetry/posthog-key.js.map +1 -0
  91. package/dist/index.cjs +3453 -32342
  92. package/package.json +11 -11
@@ -1,22 +1,28 @@
1
1
  /**
2
2
  * PostHog configuration.
3
3
  *
4
- * Environment variables (read at runtime):
5
- * AGENT_RELAY_POSTHOG_KEY - PostHog write key. Set by published-artifact
6
- * builds via GitHub Actions secret. When unset,
7
- * telemetry runs as a no-op so forks, local dev,
8
- * and CI test runs don't pollute the production
9
- * project.
10
- * POSTHOG_API_KEY - Per-process override (mainly for local
11
- * debugging or staging). Wins over
12
- * `AGENT_RELAY_POSTHOG_KEY` when set.
13
- * POSTHOG_HOST - Override host URL. Defaults to the hosted
14
- * Agent Relay ingestion proxy.
15
- *
16
4
  * Key selection order:
17
- * 1. POSTHOG_API_KEY (process override, any environment)
18
- * 2. AGENT_RELAY_POSTHOG_KEY (release-time injection)
19
- * 3. None → returns `null` and `initTelemetry()` becomes a no-op.
5
+ * 1. `POSTHOG_API_KEY` — per-process override (local debugging,
6
+ * staging swaps). Wins everywhere.
7
+ * 2. `AGENT_RELAY_POSTHOG_KEY` — runtime env, and the name the bun standalone
8
+ * build substitutes via `--define`.
9
+ * 3. `BUILD_TIME_POSTHOG_KEY` — baked into the published npm tarball by
10
+ * `scripts/inject-posthog-key.mjs`.
11
+ * 4. None → returns `null` and `initTelemetry()` becomes a no-op, which is
12
+ * what forks, local dev, and CI runs get.
13
+ *
14
+ * `POSTHOG_HOST` overrides the ingestion host; it defaults to the hosted Agent
15
+ * Relay proxy.
16
+ *
17
+ * ## The env reads must stay literal
18
+ *
19
+ * These MUST remain static `process.env.NAME` member expressions. The bun
20
+ * `--define` used for the standalone binary performs a *syntactic* substitution
21
+ * of exactly `process.env.AGENT_RELAY_POSTHOG_KEY`; a computed lookup such as
22
+ * `process.env[name]` is a different expression and is silently left alone. An
23
+ * earlier `readKey(name: string)` helper did exactly that, so every standalone
24
+ * binary shipped with telemetry permanently disabled even though the define was
25
+ * present in the release workflow. Do not refactor these back behind a variable.
20
26
  */
21
27
  export declare function getPostHogConfig(): {
22
28
  apiKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"posthog-config.d.ts","sourceRoot":"","sources":["../../../src/cli/telemetry/posthog-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAWH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiB1E"}
1
+ {"version":3,"file":"posthog-config.d.ts","sourceRoot":"","sources":["../../../src/cli/telemetry/posthog-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAYH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAuB1E"}
@@ -1,26 +1,32 @@
1
1
  /**
2
2
  * PostHog configuration.
3
3
  *
4
- * Environment variables (read at runtime):
5
- * AGENT_RELAY_POSTHOG_KEY - PostHog write key. Set by published-artifact
6
- * builds via GitHub Actions secret. When unset,
7
- * telemetry runs as a no-op so forks, local dev,
8
- * and CI test runs don't pollute the production
9
- * project.
10
- * POSTHOG_API_KEY - Per-process override (mainly for local
11
- * debugging or staging). Wins over
12
- * `AGENT_RELAY_POSTHOG_KEY` when set.
13
- * POSTHOG_HOST - Override host URL. Defaults to the hosted
14
- * Agent Relay ingestion proxy.
15
- *
16
4
  * Key selection order:
17
- * 1. POSTHOG_API_KEY (process override, any environment)
18
- * 2. AGENT_RELAY_POSTHOG_KEY (release-time injection)
19
- * 3. None → returns `null` and `initTelemetry()` becomes a no-op.
5
+ * 1. `POSTHOG_API_KEY` — per-process override (local debugging,
6
+ * staging swaps). Wins everywhere.
7
+ * 2. `AGENT_RELAY_POSTHOG_KEY` — runtime env, and the name the bun standalone
8
+ * build substitutes via `--define`.
9
+ * 3. `BUILD_TIME_POSTHOG_KEY` — baked into the published npm tarball by
10
+ * `scripts/inject-posthog-key.mjs`.
11
+ * 4. None → returns `null` and `initTelemetry()` becomes a no-op, which is
12
+ * what forks, local dev, and CI runs get.
13
+ *
14
+ * `POSTHOG_HOST` overrides the ingestion host; it defaults to the hosted Agent
15
+ * Relay proxy.
16
+ *
17
+ * ## The env reads must stay literal
18
+ *
19
+ * These MUST remain static `process.env.NAME` member expressions. The bun
20
+ * `--define` used for the standalone binary performs a *syntactic* substitution
21
+ * of exactly `process.env.AGENT_RELAY_POSTHOG_KEY`; a computed lookup such as
22
+ * `process.env[name]` is a different expression and is silently left alone. An
23
+ * earlier `readKey(name: string)` helper did exactly that, so every standalone
24
+ * binary shipped with telemetry permanently disabled even though the define was
25
+ * present in the release workflow. Do not refactor these back behind a variable.
20
26
  */
27
+ import { BUILD_TIME_POSTHOG_KEY } from './posthog-key.js';
21
28
  const HOST = 'https://i.agentrelay.com';
22
- function readKey(name) {
23
- const raw = process.env[name];
29
+ function nonEmpty(raw) {
24
30
  if (!raw)
25
31
  return null;
26
32
  const trimmed = raw.trim();
@@ -29,13 +35,18 @@ function readKey(name) {
29
35
  export function getPostHogConfig() {
30
36
  const host = process.env.POSTHOG_HOST || HOST;
31
37
  // Process-level override wins for local debugging / staging swaps.
32
- const override = readKey('POSTHOG_API_KEY');
38
+ const override = nonEmpty(process.env.POSTHOG_API_KEY);
33
39
  if (override) {
34
40
  return { apiKey: override, host };
35
41
  }
36
- // Release-time injection. CI for forks / dev / tests leaves this unset,
37
- // which intentionally turns telemetry into a no-op.
38
- const baked = readKey('AGENT_RELAY_POSTHOG_KEY');
42
+ // Runtime env, and the bun standalone's `--define` target. Literal access —
43
+ // see the module comment.
44
+ const injected = nonEmpty(process.env.AGENT_RELAY_POSTHOG_KEY);
45
+ if (injected) {
46
+ return { apiKey: injected, host };
47
+ }
48
+ // Baked into the published npm artifact at release time.
49
+ const baked = nonEmpty(BUILD_TIME_POSTHOG_KEY);
39
50
  if (baked) {
40
51
  return { apiKey: baked, host };
41
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"posthog-config.js","sourceRoot":"","sources":["../../../src/cli/telemetry/posthog-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,gB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C,CAAC;IAED,4EAA4E;IAC5E,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAC/D,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,yDAAyD;IACzD,MAAM,KAAK,GAAG,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IAC/C,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Build-time PostHog write key.
3
+ *
4
+ * The published npm package is plain `tsc` output — there is no bundler step
5
+ * that could inline an env var, and `npm publish --ignore-scripts` rules out a
6
+ * prepublish hook. So the release pipeline rewrites the *compiled* form of this
7
+ * module (`scripts/inject-posthog-key.mjs`) after `npm run build`, and the value
8
+ * ships inside the tarball.
9
+ *
10
+ * The key is a PostHog project ingest key: write-only and public by design, the
11
+ * same category as a Sentry DSN. The Rust broker already ships one via
12
+ * `option_env!`; this is the TypeScript equivalent.
13
+ *
14
+ * Empty here is the correct default — forks, local dev, and CI builds that never
15
+ * run the injection step ship with telemetry disabled.
16
+ */
17
+ export declare const BUILD_TIME_POSTHOG_KEY = "";
18
+ //# sourceMappingURL=posthog-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posthog-key.d.ts","sourceRoot":"","sources":["../../../src/cli/telemetry/posthog-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Build-time PostHog write key.
3
+ *
4
+ * The published npm package is plain `tsc` output — there is no bundler step
5
+ * that could inline an env var, and `npm publish --ignore-scripts` rules out a
6
+ * prepublish hook. So the release pipeline rewrites the *compiled* form of this
7
+ * module (`scripts/inject-posthog-key.mjs`) after `npm run build`, and the value
8
+ * ships inside the tarball.
9
+ *
10
+ * The key is a PostHog project ingest key: write-only and public by design, the
11
+ * same category as a Sentry DSN. The Rust broker already ships one via
12
+ * `option_env!`; this is the TypeScript equivalent.
13
+ *
14
+ * Empty here is the correct default — forks, local dev, and CI builds that never
15
+ * run the injection step ship with telemetry disabled.
16
+ */
17
+ export const BUILD_TIME_POSTHOG_KEY = 'phc_2uDu01GtnLABJpVkWw4ri1OgScLU90aEmXmDjufGdqr';
18
+ //# sourceMappingURL=posthog-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posthog-key.js","sourceRoot":"","sources":["../../../src/cli/telemetry/posthog-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC"}