neatlogs-cli 0.2.1 → 0.2.2

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,31 @@
2
2
 
3
3
  All notable changes to `neatlogs-cli` are documented in this file.
4
4
 
5
+ ## 0.2.2
6
+
7
+ - Release the user OAuth MCP setup, sign-in, proxy, and sign-out commands for customers.
8
+ - Include patched Zod and preserve compatibility with the deployed action catalog.
9
+
10
+ ## 0.2.2-team-test.2
11
+
12
+ - Require Zod 4.6.6 or later to address GHSA-mrhx-c7xc-m3w5 and validate packed
13
+ consumers against that patched minimum.
14
+ - Retain the user MCP OAuth, custody and catalog integration from the previous
15
+ candidate. Publish under a new prerelease version without moving its reserved tag.
16
+
17
+ ## 0.2.2-team-test.1 (unpublished; superseded by 0.2.2-team-test.2)
18
+
19
+ - Add user-scoped MCP OAuth, the local custody proxy, and negotiated v2/v4
20
+ action discovery and execution for DEV acceptance.
21
+ - Preserve explicitly negotiated read-only v2 proxy preparation when v4
22
+ discovery is disabled.
23
+
24
+ - Add opt-in live detection read discovery through `schema list`, `schema search`,
25
+ and `schema show` with `--live`.
26
+ - Add `api <operationId> --live` execution from validated backend descriptors,
27
+ without a new local handler for each compatible read.
28
+ - Keep friendly commands and default embedded-schema behavior compatible.
29
+
5
30
  ## 0.2.1
6
31
 
7
32
  - Verify `auth status` against the Public API instead of treating a configured
@@ -32,8 +57,12 @@ All notable changes to `neatlogs-cli` are documented in this file.
32
57
 
33
58
  ## 0.2.0-team-test.1
34
59
 
35
- - Add project lifecycle, existing-member access, reviewer-aware evaluation activation,
36
- classifier workflows, and bounded historical job commands for Dev acceptance.
60
+ - Add project archive, restore, soft deletion, and existing-member access commands.
61
+ - Add evaluation draft discard and reviewer-aware activation commands.
62
+ - Add classifier dataset, training, publication, and bounded job management commands.
63
+ - Add bounded historical detection job commands and refresh the Public API contract.
64
+ - Publish this candidate to the `team-test` channel for Dev acceptance; provider
65
+ admission and historical backfill still require their environment prerequisites.
37
66
 
38
67
  ## 0.1.0 (release candidate)
39
68
 
@@ -44,7 +73,7 @@ All notable changes to `neatlogs-cli` are documented in this file.
44
73
  contracts and safe request-ID diagnostics from the retest repairs.
45
74
  - Publication and deployed end-to-end acceptance remain release requirements.
46
75
 
47
- ## 0.1.0-team-test.7
76
+ ## 0.1.0-team-test.7 (unpublished; superseded by 0.1.0)
48
77
 
49
78
  - Include the merged fresh-start fixes: read-only default OAuth scopes and
50
79
  field-specific guidance for required analytics dates and other arguments.
@@ -101,7 +130,3 @@ All notable changes to `neatlogs-cli` are documented in this file.
101
130
  ## 0.1.0-team-test.1
102
131
 
103
132
  - Team-testing prerelease of the NeatLogs public API CLI.
104
-
105
- ## 0.1.0
106
-
107
- - Initial public release of the NeatLogs public API CLI.
package/README.md CHANGED
@@ -34,18 +34,20 @@ flowchart LR
34
34
 
35
35
  ## Human quickstart
36
36
 
37
- This checkout prepares `neatlogs-cli@0.2.1`, under the MIT license in
38
- [LICENSE](LICENSE). Release changes are described in [CHANGELOG.md](CHANGELOG.md).
39
- Publication is a separate release step; check `npm view neatlogs-cli version`
40
- for the current stable release.
37
+ The stable release candidate in this checkout is `neatlogs-cli@0.1.0`, under
38
+ the MIT license in [LICENSE](LICENSE). It is not published by a source change.
39
+ Verify `npm view neatlogs-cli@0.1.0 version` before using the stable install
40
+ command; the currently published team-test release remains available through
41
+ `npm install --global neatlogs-cli@team-test` until the reviewed release ships.
41
42
 
42
43
  1. Install the CLI and confirm that it runs.
43
44
 
44
45
  ```bash
45
- npm install --global neatlogs-cli
46
+ npm install --global neatlogs-cli@0.1.0
46
47
  neatlogs --version
47
48
  ```
48
49
 
50
+ The stable candidate is `0.1.0`; publication must be independently verified.
49
51
  Use Node.js 22 or
50
52
  24. The complete dev setup and verification flow is in the
51
53
  [team quickstart](../backend/docs/public-api/dev-team-quickstart.md).
@@ -53,57 +55,34 @@ for the current stable release.
53
55
  2. Save the host, select the profile, and sign in.
54
56
 
55
57
  ```bash
56
- neatlogs profile set work --host 'https://app.neatlogs.com'
58
+ neatlogs profile set work --host '<https-app-origin>'
57
59
  neatlogs profile use work
58
- neatlogs --host https://app.neatlogs.com --profile work auth login --device
60
+ neatlogs auth login
59
61
  ```
60
62
 
61
- Approve the displayed code in your browser. Omit `--device` for browser
62
- OAuth on an interactive terminal; headless terminals use Device Flow.
63
+ An interactive terminal opens browser OAuth and prints the URL as a
64
+ copy/paste fallback. A non-interactive or headless terminal automatically
65
+ uses Device Flow; `--device` selects it explicitly.
63
66
 
64
67
  3. List the projects you can access.
65
68
 
66
69
  ```bash
67
- env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN -u NEATLOGS_PROJECT_ID neatlogs --profile work projects list
70
+ neatlogs projects list
68
71
  ```
69
72
 
70
73
  4. Save the project you want this profile to use.
71
74
 
72
75
  ```bash
73
- neatlogs profile set work --host 'https://app.neatlogs.com' --project '<project-uuid>'
76
+ neatlogs profile set work --host '<https-app-origin>' --project '<project-uuid>'
74
77
  ```
75
78
 
76
79
  5. Check your identity and read recent traces.
77
80
 
78
81
  ```bash
79
- env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work whoami
80
- env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work traces list --limit 10
81
- env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work traces get <trace-id>
82
+ neatlogs whoami
83
+ neatlogs traces list --limit 10
82
84
  ```
83
85
 
84
- The read commands use POSIX `env -u` to exclude SDK credentials only from the
85
- CLI process, keeping them available to the application. In other shells, use
86
- an equivalent clean credential environment. These examples work with the
87
- published 0.2.0 package.
88
-
89
- These examples use the US dashboard host; use `https://eu.app.neatlogs.com`
90
- for EU. `projects list` must run without `--project` or `NEATLOGS_PROJECT_ID`.
91
- A saved profile's project is automatically omitted for discovery.
92
-
93
- `--credential-source profile` (available in 0.2.1) ignores both credential environment
94
- variables and uses the selected or active profile's stored OAuth login. This
95
- lets an SDK application keep its `NEATLOGS_API_KEY` in the same shell. With the
96
- published 0.2.0 CLI, omit this new option and run each OAuth CLI command through
97
- `env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN` on POSIX shells, or use an equivalent
98
- clean credential environment on other platforms. Do not remove the SDK key
99
- from the application's configuration.
100
-
101
- A key-only user can verify SDK ingestion/readback with the SDK's documented
102
- `doctor --local` and `doctor --probe` commands without CLI login. Report CLI
103
- readback as **waiting on a human** unless OAuth approval or a suitable service
104
- account is available. A synthetic probe proves the telemetry pipeline; verify
105
- the application's actual trace separately.
106
-
107
86
  `profile set` stores non-secret host and project preferences. Login stores the
108
87
  OAuth credentials separately in the native operating-system vault.
109
88
 
@@ -168,6 +147,10 @@ The consent page lists only the permissions requested by this login command.
168
147
  `offline_access` allows refresh tokens; it is not an API permission shown by
169
148
  `whoami`.
170
149
 
150
+ Existing OAuth credentials retain their issued scopes after a CLI upgrade.
151
+ Log out of the selected profile and sign in again to apply the stable release's
152
+ read-oriented defaults; request write scopes explicitly when needed.
153
+
171
154
  ## Agent and CI automation
172
155
 
173
156
  In **Settings → Service Accounts**, create a dedicated account, bind only the
@@ -208,11 +191,13 @@ only with `--allow-file-credentials`; it uses directory mode `0700`, file mode
208
191
  equivalent ACL enforcement is not implemented.
209
192
 
210
193
  Credentials are never accepted as command-line flags. The CLI never follows
211
- redirects, executes arbitrary API URLs, or fetches a live API schema. Recognized
194
+ redirects or executes arbitrary API URLs. Live detection reads fetch validated
195
+ structured metadata only when `--live` is explicit. Recognized
212
196
  `nloa_`, `nlsa_`, and `nlpk_` prefixes select exactly one credential class; a
213
197
  foreign or mismatched prefix is rejected without fallback.
214
198
 
215
- `schema` inspects the release-embedded contract, not active deployment flags.
199
+ `schema` inspects the release-embedded contract by default. Its subcommands with
200
+ `--live` inspect the authenticated deployment catalog for the selected project.
216
201
  Each operation carries `x-neatlogs-operation-gate`; only `always` is enabled by
217
202
  default, while every other gate must be enabled by the server before the
218
203
  operation is callable.
@@ -358,6 +343,10 @@ printf '%s' '{"q":"failed checkout"}' | neatlogs --project <uuid> api post_api_v
358
343
  neatlogs schema list
359
344
  neatlogs schema search <query>
360
345
  neatlogs schema show <operationId>
346
+ neatlogs --project <uuid> schema list --live
347
+ neatlogs --project <uuid> schema search detections --live
348
+ neatlogs --project <uuid> schema show get_api_v1_public_detections --live
349
+ neatlogs --project <uuid> api get_api_v1_public_detections --live --query limit=1
361
350
  ```
362
351
 
363
352
  For confidential or multiline prompt text, prefer bounded stdin so content is
@@ -377,17 +366,20 @@ Version creation and label activation are intentionally separate authorization
377
366
  steps: `prompts create` requires prompt write access, while `prompts label`
378
367
  requires prompt management access.
379
368
 
380
- `api` accepts only operation IDs with an explicit handler compiled into this
381
- CLI release. `--param` and `--query` accept bounded `name=value` pairs, reject
369
+ `api` without `--live` accepts only operation IDs with an explicit handler
370
+ compiled into this CLI release. `--param` and `--query` accept bounded `name=value` pairs, reject
382
371
  duplicates, and are checked against that operation's embedded parameter
383
372
  allowlist before any request. Body-bearing safe reads accept one object from
384
373
  `--body-stdin`, bounded to 64 KiB and validated against the embedded request
385
- schema before any request. `schema` commands are offline and do not require credentials.
374
+ schema before any request. `schema` commands without `--live` are offline and do not require credentials.
386
375
  `schema list` and `schema search` return concise descriptors. `schema show`
387
376
  returns the normalized embedded operation contract, including request and
388
377
  response schemas, authentication requirements, and execution/risk metadata.
389
- New schema operations default to non-executable until an explicit handler and
390
- risk classification are added.
378
+ New bundled schema operations require an explicit local handler and risk
379
+ classification. The detection read pilot adds `--live` to `api` and each `schema`
380
+ subcommand. Supported live reads use their validated descriptor and the existing
381
+ HTTP transport without a per-operation local handler. See the
382
+ [runtime detection read reference](docs/runtime-detection-reads.md).
391
383
 
392
384
  Raw `api` execution fails closed for operations that require target-specific
393
385
  destructive confirmation. Use the operation's curated command instead; raw
@@ -522,6 +514,28 @@ neatlogs evals launch '<evaluation-uuid>' --assign-me --review-duration 7d
522
514
  This OAuth-user-only action requires creator ownership and sends no email or
523
515
  Slack notification; the assignment remains available in the NeatLogs app.
524
516
 
517
+ The creator can activate selected members and explicitly opted-in retained
518
+ human guests or AI reviewers with `evals activate <id> --body-stdin`. The JSON
519
+ body also accepts `reminderConfig` and `notifications`:
520
+
521
+ ```json
522
+ {
523
+ "reviewerUserIds": ["30000000-0000-4000-8000-000000000003"],
524
+ "reviewDuration": "7d",
525
+ "reminderConfig": { "frequency": "custom", "intervalHours": 24, "time": "9:00 AM" },
526
+ "notifications": ["email", "slack"]
527
+ }
528
+ ```
529
+
530
+ Cadences are `none`, `every-day`, `halfway`, `one-day-before`, and `custom`.
531
+ Custom cadence requires 1–168 interval hours and a valid 12/24-hour time;
532
+ the worker uses creator profile timezone, then project timezone, then UTC.
533
+ Omitted settings preserve stored values. `notifications: []` disables external
534
+ member lifecycle channels; in-app notifications remain. Guest invitation and
535
+ reminder emails use the existing separate guest delivery rules. An active
536
+ receipt confirms persisted settings, not provider acceptance or delivery.
537
+ Use a stable `--idempotency-key` when retrying the same activation.
538
+
525
539
  Assigned-review discovery and reads are OAuth-only because an assignment belongs
526
540
  to a real user. Draft and submit additionally require `evaluation:write`,
527
541
  current `eval:submit`, and `PUBLIC_API_MUTATIONS_ENABLED=true` on the server.
@@ -608,26 +622,8 @@ request.
608
622
  ## Configuration and output
609
623
 
610
624
  - `NEATLOGS_TOKEN` is the primary credential source; `NEATLOGS_API_KEY` is the
611
- legacy public API key fallback, not an SDK project key. In the default
612
- `--credential-source auto` mode, environment credentials take precedence over
613
- a selected stored profile and differing token/key values fail closed.
614
- - `--credential-source profile` explicitly ignores both credential environment
615
- variables and uses the saved login, including its host/project defaults.
616
- Host overrides must still match the credential-bound host.
617
- - `--credential-source token` reads only `NEATLOGS_TOKEN`, ignoring the SDK's
618
- `NEATLOGS_API_KEY`. A missing or invalid token fails without falling back to
619
- another identity. Use this for service-account automation sharing an SDK shell.
620
- - `auth status` now verifies access against the public API. OAuth and service
621
- tokens use project discovery (`context:read`); legacy public API keys use
622
- their bound `whoami` context. No selected project is needed. Rejected/missing
623
- credentials report `authenticated: false` and exit 3. Scope failures and
624
- network failures retain their distinct errors instead of claiming the user
625
- is signed out. Success reports `verification: "public_api"`; this does not
626
- guarantee permission to read every project's traces.
627
- Older published clients only checked local credential presence, so use
628
- project-scoped `whoami` and a trace read when validating those versions.
629
- - Authentication and configuration diagnostics include a static, secret-free
630
- `hint` in JSON and human output with the recovery steps.
625
+ legacy fallback. An environment credential takes precedence over a selected
626
+ stored profile and is identified as `environment` by `auth status`.
631
627
  - `--profile <name>` selects non-secret host/project preferences and its
632
628
  separately stored OAuth credential. Stored tokens are never sent when a
633
629
  `--host` or `NEATLOGS_HOST` override differs from the credential-bound host.
@@ -638,7 +634,8 @@ request.
638
634
  - Product reads and selected-project context commands require `--project
639
635
  <uuid>` or `NEATLOGS_PROJECT_ID` for OAuth/service-account credentials.
640
636
  `--project` takes precedence. A project is optional for legacy credentials.
641
- Discovery commands instead forbid any selected project.
637
+ Organization/project discovery commands forbid any selected project. Runtime
638
+ detection action discovery requires a selected project.
642
639
  - A service-account token is sent only as `Authorization: Bearer` and the
643
640
  selected project only as `x-project-id`. A legacy key is sent only as
644
641
  `x-api-key`.
@@ -660,12 +657,19 @@ request.
660
657
  `--fields id,name` projects at most 32 bounded object paths in JSON/JSONL
661
658
  output. The trace-payload command keeps its existing request-specific
662
659
  `--fields input[,output,error]` meaning.
660
+ - `evals ai-insights --all --max-items <number>` collects runs and recomputes
661
+ evaluator metrics over exactly those returned runs. `metricsScope: "page"`
662
+ remains scoped to the returned collection; use `evals ai-metrics` for campaign
663
+ metrics. `metricsIncomplete` is true if any fetched page reports incomplete
664
+ metrics. JSONL and field projection select run rows.
663
665
  - `--debug` writes redacted request lifecycle records to stderr without
664
666
  credentials, headers, bodies, project IDs, or query values. `--no-color` and
665
667
  `NO_COLOR` are accepted; current output contains no ANSI color sequences.
666
668
  - Requests time out after 10 seconds and never follow redirects.
667
- - Idempotent GET requests and explicitly marked safe POST reads retry at most
668
- twice after a `429` or `503`, honoring a safe, bounded `Retry-After` value.
669
+ - Idempotent GET requests retry at most twice after a `429` or `503`, honoring
670
+ a safe, bounded `Retry-After` value. Unkeyed POST reads make one attempt,
671
+ including search and compute. A failed request may already have used compute;
672
+ another request can start and charge for new work.
669
673
  - Idempotent mutating operations retry at most twice after a `429` or `503`.
670
674
  Other mutating operations are never retried.
671
675
 
@@ -721,3 +725,80 @@ certificate temporary directories.
721
725
  | 9 | Partial bulk-operation success |
722
726
  | 10 | Destructive confirmation required |
723
727
  | 11 | Server or response-contract failure |
728
+ # Platform runtime discovery (unreleased)
729
+
730
+ Use `neatlogs schema list --live --catalog-version 2` to discover compatible
731
+ account reads and, when a project is selected, permitted project reads. Inspect
732
+ with `schema show <operationId> --live --catalog-version 2` and execute with
733
+ `api <operationId> --live --catalog-version 2`. Project-free organization/project
734
+ discovery needs `context:read`, not detection access. v1 remains the default.
735
+
736
+ The unreleased client also negotiates execution version 2 for bounded JSON POST
737
+ reads via `--body-stdin`: one attempt, validated input/output and canonical
738
+ operation budgets. Production POST discovery remains disabled pending shared
739
+ acceptance. Bundled unkeyed POST reads also make one attempt in this version;
740
+ older published CLI versions may retry them on `429` or `503`.
741
+
742
+ Only explicitly qualified and activated read contracts are advertised. Writes, unsupported
743
+ target/schema contracts, jobs and file workflows are not automatically enabled.
744
+ See the [shared v2 contract and exposure decisions](../backend/docs/public-api/runtime-catalog-v2.md).
745
+ These changes require backend deployment and a CLI release; neither has occurred.
746
+
747
+
748
+
749
+ Runtime catalog v2 can negotiate account and organization reads without a project:
750
+
751
+ ```sh
752
+ neatlogs schema list --live --catalog-version 2 --account
753
+ neatlogs schema list --live --catalog-version 2 --organization <uuid>
754
+ neatlogs api <operationId> --live --catalog-version 2 --organization <uuid>
755
+ ```
756
+
757
+ `--account` suppresses a saved project for discovery. `--organization` binds discovery and execution to that organization and supplies its path parameter; a conflicting `--param organizationId=...` is rejected. The flags are mutually exclusive and require live v2 discovery. Account bootstrap requires `context:read`; organization bootstrap requires OAuth with `organization:read`. Each action still requires its own canonical permission and scope. These are unreleased local capabilities; hosted availability is separate.
758
+
759
+
760
+ For service-account metadata, use `--service-account <uuid>` with live catalog v2. This selects the resource being read, while authentication remains OAuth. It cannot be combined with `--account` or `--organization`; a saved project is suppressed. The server retains the existing Owner/Admin, target-binding and audit-plan checks. Actor-specific detection draft discovery describes the OAuth management permission or workload read permission appropriate to the authenticated credential.
761
+
762
+ ### Complete action descriptions
763
+
764
+ Use `schema list --live --catalog-version 3` to discover permitted reads and
765
+ writes, or `schema show <operationId> --live --catalog-version 3` for full
766
+ input, response, idempotency, authorization and workflow contracts. Discovery
767
+ follows bounded revision-pinned pages. `--account`, `--organization <uuid>`,
768
+ `--service-account <uuid>` and v3-only `--service-account-token <uuid>` select
769
+ the target. Deployment gates and current permissions still filter results.
770
+
771
+ Version 3 describes capabilities; it does not activate generic write/job/file
772
+ execution. `api --live --catalog-version 3` fails explicitly. Use an activated
773
+ read contract or the existing bundled workflow command for execution.
774
+
775
+ ### Live canonical actions (catalog v4)
776
+
777
+ Discover with `neatlogs schema list --live --catalog-version 4`. Execute a reviewed
778
+ write with `neatlogs api OPERATION --live --catalog-version 4 --confirm
779
+ --idempotency-key KEY --body-stdin`. Keep the same key and exact original input for
780
+ retries across clients. The generic v4 path requires explicit keys for keyed writes
781
+ and sends one attempt. Compute reads additionally require `--compute-key KEY` with
782
+ 22–128 URL-safe characters; use a randomly generated key with adequate entropy.
783
+
784
+ Use the same command with `--result` to read the saved mutation result without
785
+ executing the mutation. It retains original target/input/key and current credentials.
786
+ `--result` does not require `--confirm`. Pending or unknown does not authorize a new
787
+ key or establish rollback. Domain job status/result/cancel operations are discoverable
788
+ through each action's workflow metadata. Wrapped-secret commands use local custody;
789
+ keys must never be passed in model-visible arguments or printed in ordinary output.
790
+
791
+ Catalog v3 remains descriptive. v1/v2 read clients keep their existing contracts.
792
+ Canonical binary responses are returned as bounded base64 with a SHA-256 digest.
793
+ Use `--output /absolute/new-file` to save exact bytes in a new mode-0600 file;
794
+ existing files are never overwritten. Private file export is supported on POSIX
795
+ systems. Windows rejects `--output` because POSIX modes do not establish private
796
+ Windows ACLs; omit `--output` to receive the bounded base64 response instead.
797
+ The client follows no redirects and accepts
798
+ only content types declared by the discovered action. Signed-URL JSON and domain
799
+ job lifecycle responses retain their canonical schemas. Combined file/export
800
+ acceptance remains required before release.
801
+
802
+ For v4 compute actions, reuse the original input and key with `--execution <uuid>` to read durable status. Add `--cancel-execution --expected-version <version> --confirm` to request cancellation. Cancellation is a versioned PATCH; a successful request does not imply an already dispatched provider call stopped. Use `--result` separately to recover a keyed mutation's saved response.
803
+
804
+ Compute submissions emit a bounded `{ "computeExecutionId": "<uuid>" }` receipt on stderr, including an HTTP error with an unknown outcome. Stdout retains the operation's canonical response. If the submission response was lost, use `--execution --compute-key <original-key>` with the same operation and original input to recover without dispatching again.
package/SECURITY.md CHANGED
@@ -25,6 +25,10 @@
25
25
  implemented.
26
26
  - Profiles contain only host, issuer, selected organization/project, and the
27
27
  credential-store kind. They never contain tokens.
28
+ - Execution custody may be explicitly selected with `--allow-file-custody`,
29
+ including when credentials come from `NEATLOGS_TOKEN`. Use the same choice
30
+ for result recovery. It selects the protected private-file store directly;
31
+ a native vault failure never triggers an automatic custody-store fallback.
28
32
 
29
33
  ## OAuth handling
30
34