@agent-watch-ai/edge 0.7.2 → 0.7.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.7.3
6
+
7
+ - `agentwatch setup <organization-id>` signs in to the Agent Watch backend without a URL:
8
+ the install line no longer needs `https://api.agent-watch.ai?organization=…`. The URL form
9
+ still works, and `--endpoint` points a bare id at another backend.
10
+
5
11
  ## 0.7.2
6
12
 
7
13
  - Google Antigravity turns now report token usage, read from the conversation's own
package/README.md CHANGED
@@ -364,7 +364,8 @@ The cloud documentation behind each of these points, and the container runs that
364
364
  ## CLI
365
365
 
366
366
  ```bash
367
- agentwatch setup --token <key> # install hooks and exporters
367
+ agentwatch setup <organization-id> # install hooks and exporters, sign in through the browser
368
+ agentwatch setup --token <key> # same, with an install key
368
369
  agentwatch status # backend, queue and agent health
369
370
  agentwatch doctor # environment checks (--json for CI)
370
371
  agentwatch config # active configuration, secrets redacted
package/dist/cli/setup.js CHANGED
@@ -152,7 +152,7 @@ async function setup(options, context, cloud) {
152
152
  const inherited = rootPath === undefined ? baseConfig : { endpoint: existingRoot?.endpoint === undefined ? baseConfig.endpoint : existingRoot.endpoint };
153
153
  const heldDevice = rootPath === undefined ? baseConfig.device : existingRoot?.device;
154
154
  if (options.deferSignIn === true && (options.setupUrl === undefined || rootPath !== undefined)) {
155
- println(`${symbols.fail} --defer-sign-in takes the organization enrollment URL and configures the machine, not a project root; nothing was written`);
155
+ println(`${symbols.fail} --defer-sign-in takes the organization id or enrollment URL and configures the machine, not a project root; nothing was written`);
156
156
  return 1;
157
157
  }
158
158
  const resolvedEnrollment = enroll({ ...options, setupUrl: options.setupUrl ?? pendingSignInUrl(options, baseConfig, rootPath) }, inherited, baseConfig.customEndpoints);
@@ -397,7 +397,7 @@ async function readEnrollmentCode(options, withUrl) {
397
397
  return { error: `an enrollment code goes in $${ENROLLMENT_CODE_VAR} or on stdin with --enrollment-code -, never on the command line, where other users can read it; nothing was written. If that was a code, ask your admin for a new one` };
398
398
  }
399
399
  if (flag !== undefined && !withUrl)
400
- return { error: 'an enrollment code is redeemed with the enrollment URL: agentwatch setup <backend>?organization=<id>; nothing was written' };
400
+ return { error: 'an enrollment code is redeemed with the organization id: agentwatch setup <organization-id>; nothing was written' };
401
401
  if (!withUrl)
402
402
  return {};
403
403
  // `||`, as for the token: an exported-but-empty variable is one nobody set.
@@ -115,7 +115,7 @@ function report(outcome, current) {
115
115
  */
116
116
  function revocationLine(revocation) {
117
117
  if (revocation.revoked && revocation.removed)
118
- return `${symbols.ok} device credential revoked on the platform and removed from this machine; your organization's setup command (\`agentwatch setup <enrollment-url>\`) enrolls it again`;
118
+ return `${symbols.ok} device credential revoked on the platform and removed from this machine; your organization's setup command (\`agentwatch setup <organization-id>\`) enrolls it again`;
119
119
  const leftover = revocation.leftover ? `; remove it by hand from ${revocation.leftover}` : '';
120
120
  if (revocation.revoked)
121
121
  return `${symbols.warn} device credential revoked on the platform but not removed from this machine (${revocation.reason})${leftover}`;
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import { providerIds } from './providers/loaders.js';
11
11
  const HELP = `agentwatch — telemetry edge for AI coding agents
12
12
 
13
13
  Usage:
14
- agentwatch setup [enrollment-url] [--endpoint <url>] [--allow-custom-endpoint] [--no-browser] [--enrollment-code -] [--token <token>] [--developer-email <email>] [--developer-name <name>] [--root <path>] [--otel <signals>] [--capture-runs on|off] [--replay-days <n>] [--no-replay] [--agent <id>]
14
+ agentwatch setup [organization-id | enrollment-url] [--endpoint <url>] [--allow-custom-endpoint] [--no-browser] [--enrollment-code -] [--token <token>] [--developer-email <email>] [--developer-name <name>] [--root <path>] [--otel <signals>] [--capture-runs on|off] [--replay-days <n>] [--no-replay] [--agent <id>]
15
15
  agentwatch setup --cloud (a Claude Code cloud session's managed SessionStart hook)
16
16
  agentwatch status
17
17
  agentwatch replay [--machine | --root <path>] [--replay-days <n>] [--resume | --stop] [--dry-run]
@@ -30,9 +30,9 @@ Flags:
30
30
  loopback for local development (default: https://api.agent-watch.ai)
31
31
  --allow-custom-endpoint trust an --endpoint outside the Agent Watch hosts (self-hosted or
32
32
  proxied backend). Stored in the config and shown by status and doctor
33
- --no-browser with an enrollment URL, print the sign-in link without opening a
33
+ --no-browser when signing in, print the sign-in link without opening a
34
34
  browser (never opened anyway under CI, over SSH or without a terminal)
35
- --enrollment-code - with an enrollment URL, enroll an unattended machine with an
35
+ --enrollment-code - with an organization id, enroll an unattended machine with an
36
36
  admin-issued code read from stdin instead of signing in through
37
37
  a browser; $AGENTWATCH_ENROLLMENT_CODE works too. A code is never
38
38
  accepted on the command line
@@ -54,7 +54,7 @@ Flags:
54
54
  per-request usage/cost ledger the backend turns into llm.call)
55
55
  --capture-runs on|off count the provider calls of scripts an agent starts (default: on).
56
56
  Apart from --otel: --otel none leaves it on
57
- --defer-sign-in with an enrollment URL, for an MDM run: save the organization and
57
+ --defer-sign-in with an organization id, for an MDM run: save the organization and
58
58
  install the hooks with no credential. Nothing is sent until the
59
59
  developer runs \`agentwatch setup\` and signs in as themselves.
60
60
  A machine with no device and an enrollment code redeems the
@@ -17,10 +17,13 @@ import { RE_ORGANIZATION_ID } from './constants/enrollment.constants.js';
17
17
  * @throws When the endpoint is not usable.
18
18
  */
19
19
  export function resolveEnrollment(input) {
20
- const link = input.setupUrl ? parseEnrollmentUrl(input.setupUrl) : undefined;
20
+ // A bare organization id signs in to the production backend, or `--endpoint` when given.
21
+ const bareId = input.setupUrl !== undefined && RE_ORGANIZATION_ID.test(input.setupUrl);
22
+ const parsed = input.setupUrl && !bareId ? parseEnrollmentUrl(input.setupUrl) : undefined;
23
+ const link = bareId ? { endpoint: input.endpoint ?? DEFAULT_ENDPOINT, organizationId: input.setupUrl } : parsed;
21
24
  if (link && input.token)
22
- throw new Error('an enrollment URL signs in through the browser and takes no install key; drop --token / $AGENTWATCH_TOKEN');
23
- if (link && input.endpoint)
25
+ throw new Error('an organization id or enrollment URL signs in through the browser and takes no install key; drop --token / $AGENTWATCH_TOKEN');
26
+ if (link && !bareId && input.endpoint)
24
27
  throw new Error('an enrollment URL names its own backend; drop --endpoint');
25
28
  const endpoint = link?.endpoint ?? input.endpoint ?? DEFAULT_ENDPOINT;
26
29
  const trimmed = normalizeEndpoint(endpoint);
@@ -48,7 +51,7 @@ function parseEnrollmentUrl(link) {
48
51
  const url = URL.canParse(link) ? new URL(link) : undefined;
49
52
  const organizationId = url?.searchParams.get('organization') ?? '';
50
53
  if (!url || !RE_ORGANIZATION_ID.test(organizationId))
51
- throw new Error('enrollment URL must look like https://<backend>?organization=<organization id>');
54
+ throw new Error('setup takes the organization id, or an enrollment URL like https://<backend>?organization=<organization id>');
52
55
  // A backend under a path prefix keeps it, as `--endpoint` does.
53
56
  return { endpoint: url.origin + url.pathname.replace(/\/+$/, ''), organizationId };
54
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-watch-ai/edge",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Usage and cost telemetry for Claude Code, Codex, Cursor, Gemini CLI and Antigravity. No daemon, no proxy.",
5
5
  "license": "MIT",
6
6
  "type": "module",