kylon-cli 0.4.2 → 0.4.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/README.md CHANGED
@@ -428,9 +428,11 @@ state:
428
428
  - Use `kylon workspace secret list|share|unshare|delete|run` for canonical
429
429
  workspace secret grants with browser authorization. Create API keys through
430
430
  the secure Connection flow in Kylon.
431
- - Use `kylon gateway secret list|set|delete --agent <agent-id>` for agent-local
431
+ - Use `kylon gateway secret list|delete --agent <agent-id>` for agent-local
432
432
  records, authenticated by this installation's saved runtime credential
433
- through agent-scoped runtime routes.
433
+ through agent-scoped runtime routes. There is no `set`: a credential is
434
+ stored as a Custom API Service from the agent's setup card or from
435
+ Connections in Kylon, and the agent reads it from its environment.
434
436
 
435
437
  This separation prevents browser credentials from reaching the
436
438
  daemon-authenticated secret endpoints and avoids state-dependent command
@@ -537,6 +539,77 @@ instead of waiting out inactivity timeouts and heartbeat intervals.
537
539
  without the advertisement fails over-budget assignments with a named error
538
540
  instead of receiving flags it would misparse.
539
541
 
542
+ ## Remote diagnostics
543
+
544
+ The CLI reports to the server through one channel (`src/lib/telemetry.ts`):
545
+ every logger record passes through it after redaction, and what leaves the
546
+ machine depends on the identity the running operation selected. This is event
547
+ logging into the API-to-Grafana Loki pipeline (`service=cli-client`), not
548
+ OpenTelemetry/Tempo tracing. It never ships Grafana credentials and never falls
549
+ back to another saved identity.
550
+
551
+ - **Machine identity** (the computer daemon and its supervisor, locked by the
552
+ computer session): posts to `POST /workspaces/:ws/computers/:id/client-events`
553
+ every `warn`/`error` record, the info-level names on the shared inventory, and
554
+ the daemon lifecycle events (`daemon.started`, `daemon.crash_detected`,
555
+ `daemon.system_wake`, `daemon.shutdown`). Fields are flattened one level and
556
+ bounded (32 keys, 300 characters); a prose message is normalized to a
557
+ snake_case name with the wording kept in `text`. The server stamps
558
+ `p2EventType=cli_daemon_event` and the machine's CLI version and OS, holds
559
+ each machine to 300 events per 5 minutes, and announces what it dropped or
560
+ rejected. The operator's `remoteDiagnostics` gateway setting is the consent
561
+ for this path, read at every flush.
562
+ - **User identity** (any other command once it has a credential): posts to
563
+ `POST /client-logs/cli` under the event and field allowlists in
564
+ `@p2/types/cli-telemetry`, so a command never uploads paths, prompts, argv,
565
+ or arbitrary error text. Identity and workspace attribution come from server
566
+ authentication, not client fields.
567
+ - **Anonymous** (status (`status`/`auth status`, `gateway status`), `diagnose`,
568
+ the upgrade commands (`upgrade`, `provider update`, `gateway service`)): the
569
+ same URL without a credential, command outcomes only, with an even narrower
570
+ metadata allowlist. The setup commands (`auth login`, `agent link`, `connect`,
571
+ `onboard`) report anonymously only when they fail, with the setup session id
572
+ from the link inspection and the stage they reached, and switch to the
573
+ credential they obtain. Other commands never fall back to anonymous
574
+ submission when authentication fails.
575
+
576
+ Telemetry initialization calls the installation store's `ensure()`:
577
+ `install.json` in the CLI configuration directory holds the random `installId`,
578
+ sent as `install_id` on every record. It is created before login and reused
579
+ across runs; deleting the file resets it, copying the configuration can
580
+ duplicate it. It identifies an installation, not a device or a person, so these
581
+ are pseudonymous diagnostics. If the installation cannot be read or created,
582
+ telemetry stays off.
583
+
584
+ Set `KYLON_TELEMETRY_DISABLED=1` in the CLI/daemon process environment to turn
585
+ the whole channel off; local diagnostic logs are unchanged. Restart a running
586
+ daemon after changing its environment.
587
+
588
+ Delivery: a bounded queue of 200 records (oldest dropped first, the count
589
+ announced as `gateway.remote_events.dropped_locally`), one batch of up to 20
590
+ every five seconds, plus an immediate flush for the daemon lifecycle events. A
591
+ `401`, `403`, or `404` stops the channel for the rest of the process; any other
592
+ failure keeps the batch and backs off, doubling from 30 seconds to 5 minutes.
593
+ Requests do not follow redirects; a command's request is cut after 2.5 seconds
594
+ (a cold connection to the API takes 0.5–0.7 s, and a failed command uploads
595
+ at exit with no connection to reuse), the daemon's after 5 seconds. A
596
+ `cli.command_failed` record starts its upload at once rather than at the
597
+ next interval. Normal command completion flushes the latest batch;
598
+ hard kills can lose events. The API limits each user identity to 60 batches per
599
+ minute and 32 KiB per batch, anonymous sources to 20 batches per minute per
600
+ hashed IP.
601
+
602
+ ### Event inventory
603
+
604
+ Info-level names are the shared inventory in `@p2/types/cli-telemetry`:
605
+ command lifecycle (`cli.command.started`, `cli.command.completed`,
606
+ `cli.command_failed`, `cli.api.failed`), connection open/close, gateway
607
+ connection failures and reconnect scheduling, assignment receipt and
608
+ acceptance, provider execution, cancellation, result delivery and outbox
609
+ replay, supervisor lifecycle, and upgrade outcomes. A machine identity adds
610
+ every warn/error record and the daemon lifecycle; a user identity is limited to
611
+ the inventory on both ends.
612
+
540
613
  ## State Model
541
614
 
542
615
  The CLI uses a per-agent installation profile and three runtime-state layers:
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.2",
3
- "fingerprint": "62cd57e7980a237a26ea6161139b0a915aa5acaefa66eb3a2c0047f909a38054",
4
- "source_commit": "ab7d78b1937c39c33e4fed04c164fb6e18f45d61"
2
+ "version": "0.4.3",
3
+ "fingerprint": "cd38846706877e4d392bf64014fa0bc18d8b4aa2a6ec1b3b501ba2f2fe5ab124",
4
+ "source_commit": "da7a3a625fa473b90ec331fba12933cf2ffa4335"
5
5
  }