@loomcycle/client 1.131.0 → 1.133.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 CHANGED
@@ -161,6 +161,20 @@ The low-level primitives (`runStreaming({interactive:true})` + `sendRunInput` +
161
161
 
162
162
  Both need a tenant operator or admin token; `tenant` is an admin's focus.
163
163
 
164
+ ### Statement review
165
+
166
+ | Method | Returns | Notes |
167
+ |---|---|---|
168
+ | `listReviewQueue({ filter?, summarize?, limit?, after?, order?, scope?, scopeId?, tenant? })` | `Promise<ReviewQueueResult>` | The scope's proposed relations, narrowed by `filter` (`method` prefix, `kind(s)`, `actor`, `from_/to_document_id`, `from_/to_under_path`, `min_confidence`, `created_before/after`, `has_judge_verdict`, `judge_verdict`), newest first; `summarize: true` returns counts by kind × method × from-path prefix × judge verdict instead (`GET /v1/_statements/review`). |
169
+ | `ruleStatements(action, { ids } \| { filter }, { reason?, dryRun?, expectCount?, max?, scope?, scopeId?, tenant? })` | `Promise<RuleStatementsResult>` | Accept or reject up to 1000 statements at once (`POST /v1/_statements/rule`). A dry run unless `dryRun: false`; the real call needs `expectCount` = the dry run's `matched` (`queue_changed` otherwise). `reason` is required to reject. Each statement records `ruled_by: bulk:<ruling_id>`. |
170
+ | `revertRuling(rulingId, { scope?, scopeId?, tenant? })` | `Promise<RevertRulingResult>` | Undo a bulk ruling, or a review policy's, where nothing changed the statements since (`POST /v1/_statements/revert`); changed ones are listed and left. Returns `revert_id`. |
171
+ | `listRulings({ limit?, after?, scope?, scopeId?, tenant? })` | `Promise<ListRulingsResult>` | The scope's bulk rulings and reverts, newest first (`GET /v1/_statements/rulings`; limit 20 by default, at most 100): action, who, reason, counts, the selector (filter, or an ids count — never the ids), and `reverted` / `reverted_by`. An operator sees all, a member its own. |
172
+ | `applyReviewPolicy({ filter?, dryRun?, expectCount?, max?, scope?, scopeId?, tenant? })` | `Promise<ApplyReviewPolicyResult>` | Run the tenant's review policy (the ontology's Review section) over the proposals already in the queue (`POST /v1/_statements/apply_policy`). A dry run unless `dryRun: false` (`matched`, `accept` / `reject` / `judge` / `human`, per-rule `rules`, `sample`); the real call needs `expectCount` = the dry run's `matched` and rules at most `max` (1000) accepts and rejects as one ruling, each recording `ruled_by: policy:<rule>@<ontology version>`. An admin or a tenant operator only (`forbidden` for a member). |
173
+
174
+ The filter also takes the exact selectors `method_exact`, `kind_exact`, `from_path_prefix` and `from_unfiled`, and each summary group carries the `filter` that selects exactly it. Every method takes `scopeId` with `scope: "user"`: an admin or a tenant operator may name another subject of its tenant, a member only itself.
175
+
176
+ An admin, a tenant operator, or a member holding the access-control action `review` on the statements' from-documents may rule; what the caller may not rule on is skipped and counted. Pass `created_before` / `created_after` as text (RFC 3339, or unix nanoseconds as a decimal string): a nanosecond `created_at` does not fit a JS number. Refusals throw with `code`: `invalid_request`, `forbidden`, `queue_changed`, `ruling_not_found`, `unavailable`.
177
+
164
178
  ### Pause / Resume / State (v0.8.17 / v0.8.18)
165
179
 
166
180
  | Method | Returns | Notes |
@@ -733,6 +733,156 @@ class LoomcycleClient {
733
733
  : "";
734
734
  return (0, fetch_helpers_js_1.postJSON)(this.ctx, `/v1/_ontology/subjects/principal${q}`, { subject, principal }, opts);
735
735
  }
736
+ /**
737
+ * The statement review queue: a scope's proposed relations (or another
738
+ * `filter.status`), narrowed by `filter`, newest first, or with
739
+ * `summarize: true` their counts by kind, method, from-path prefix and
740
+ * judge verdict. Rows the caller may not read are left out. Mirrors
741
+ * GET /v1/_statements/review. `scope` is `tenant` (default) or `user`;
742
+ * `tenant` is honored only for an admin token. With `scope: "user"`,
743
+ * `scopeId` names whose user documents: an admin or a tenant operator may
744
+ * name another subject of its tenant, a member only itself. Each summary
745
+ * group carries `filter`, which selects exactly that group.
746
+ */
747
+ async listReviewQueue(opts) {
748
+ const params = new URLSearchParams();
749
+ for (const [k, v] of Object.entries(opts?.filter ?? {})) {
750
+ if (v === undefined)
751
+ continue;
752
+ if (Array.isArray(v))
753
+ params.set(k, v.join(","));
754
+ else
755
+ params.set(k, String(v));
756
+ }
757
+ if (opts?.summarize)
758
+ params.set("summarize", "true");
759
+ if (opts?.limit !== undefined)
760
+ params.set("limit", String(opts.limit));
761
+ if (opts?.after)
762
+ params.set("after", opts.after);
763
+ if (opts?.order)
764
+ params.set("order", opts.order);
765
+ if (opts?.scope)
766
+ params.set("scope", opts.scope);
767
+ if (opts?.scopeId)
768
+ params.set("scope_id", opts.scopeId);
769
+ if (opts?.tenant !== undefined)
770
+ params.set("tenant", opts.tenant);
771
+ const q = params.toString() ? `?${params.toString()}` : "";
772
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/_statements/review${q}`, opts);
773
+ }
774
+ /**
775
+ * Accept or reject proposed statements in bulk, named by `ids` or by the
776
+ * queue's `filter`, at most 1000 per call (`max`). A DRY RUN unless
777
+ * `dryRun: false`: it returns `matched`, a sample of 20 and the kind/method
778
+ * breakdown. To rule, call again with `dryRun: false` and `expectCount` set
779
+ * to the dry run's `matched`; a queue that changed in between is refused
780
+ * (`queue_changed`) and nothing is ruled. `reason` is required to reject.
781
+ * Each statement is ruled as `accept_statement` / `reject_statement` would,
782
+ * with a result per statement, and records `ruled_by: bulk:<ruling_id>`.
783
+ * Mirrors POST /v1/_statements/rule.
784
+ *
785
+ * For an admin or a tenant operator (write on each from-document), or a
786
+ * member holding the access-control action `review` on the from-document's
787
+ * path; what the caller may not rule on is skipped and counted. A refusal
788
+ * throws with the server's code: `invalid_request`, `forbidden`,
789
+ * `queue_changed`, `unavailable`.
790
+ */
791
+ async ruleStatements(action, select, opts) {
792
+ const body = { action, ...select };
793
+ if (opts?.reason !== undefined)
794
+ body.reason = opts.reason;
795
+ if (opts?.dryRun !== undefined)
796
+ body.dry_run = opts.dryRun;
797
+ if (opts?.expectCount !== undefined)
798
+ body.expect_count = opts.expectCount;
799
+ if (opts?.max !== undefined)
800
+ body.max = opts.max;
801
+ if (opts?.scope !== undefined)
802
+ body.scope = opts.scope;
803
+ if (opts?.scopeId !== undefined)
804
+ body.scope_id = opts.scopeId;
805
+ if (opts?.tenant !== undefined)
806
+ body.tenant = opts.tenant;
807
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_statements/rule", body, opts);
808
+ }
809
+ /**
810
+ * Undo a bulk ruling: each statement it ruled goes back to its status
811
+ * before, if nothing changed it since (no new evidence, no maintenance, no
812
+ * later ruling); a rejected one is no longer refused when proposed again.
813
+ * Changed ones are listed and left. Same authority as
814
+ * {@link ruleStatements}. Mirrors POST /v1/_statements/revert; an unknown
815
+ * ruling throws `ruling_not_found`.
816
+ */
817
+ async revertRuling(rulingId, opts) {
818
+ const body = { ruling_id: rulingId };
819
+ if (opts?.scope !== undefined)
820
+ body.scope = opts.scope;
821
+ if (opts?.scopeId !== undefined)
822
+ body.scope_id = opts.scopeId;
823
+ if (opts?.tenant !== undefined)
824
+ body.tenant = opts.tenant;
825
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_statements/revert", body, opts);
826
+ }
827
+ /**
828
+ * The scope's bulk rulings and their reverts, newest first (`limit`
829
+ * default 20, at most 100; `after` = the previous page's `next_cursor`),
830
+ * so an undo can be found after the ruling's own answer is gone. An
831
+ * operator sees every ruling, a member only its own; each names what it
832
+ * selected as the filter or a count of ids, never the ids. Mirrors
833
+ * GET /v1/_statements/rulings.
834
+ */
835
+ async listRulings(opts) {
836
+ const params = new URLSearchParams();
837
+ if (opts?.limit !== undefined)
838
+ params.set("limit", String(opts.limit));
839
+ if (opts?.after)
840
+ params.set("after", opts.after);
841
+ if (opts?.scope)
842
+ params.set("scope", opts.scope);
843
+ if (opts?.scopeId)
844
+ params.set("scope_id", opts.scopeId);
845
+ if (opts?.tenant !== undefined)
846
+ params.set("tenant", opts.tenant);
847
+ const q = params.toString() ? `?${params.toString()}` : "";
848
+ return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, `/v1/_statements/rulings${q}`, opts);
849
+ }
850
+ /**
851
+ * Run the tenant's review policy (the ontology's Review section, or the
852
+ * policy `@auto_assert` implies) over the proposals already in the queue,
853
+ * narrowed by `filter` (its status, if any, must be `proposed`). A DRY RUN
854
+ * unless `dryRun: false`: it returns `matched`, what the policy would
855
+ * accept, reject, route to the judge or leave for a person, the count per
856
+ * rule and a sample. To apply, call again with `dryRun: false` and
857
+ * `expectCount` set to the dry run's `matched`: at most `max` (default and
858
+ * ceiling 1000) accepts and rejects are ruled as one ruling —
859
+ * {@link revertRuling} undoes it — each statement recording
860
+ * `ruled_by: policy:<rule>@<ontology version>`; the rest are `deferred`.
861
+ * Mirrors POST /v1/_statements/apply_policy.
862
+ *
863
+ * For an admin or a tenant operator only: a member is refused
864
+ * (`forbidden`) even holding `review`. A refusal throws with the server's
865
+ * code: `invalid_request` (no policy in force, or the Review section has
866
+ * issues), `forbidden`, `queue_changed`, `unavailable`.
867
+ */
868
+ async applyReviewPolicy(opts) {
869
+ const body = {};
870
+ if (opts?.filter !== undefined)
871
+ body.filter = opts.filter;
872
+ if (opts?.dryRun !== undefined)
873
+ body.dry_run = opts.dryRun;
874
+ if (opts?.expectCount !== undefined)
875
+ body.expect_count = opts.expectCount;
876
+ if (opts?.max !== undefined)
877
+ body.max = opts.max;
878
+ if (opts?.scope !== undefined)
879
+ body.scope = opts.scope;
880
+ if (opts?.scopeId !== undefined)
881
+ body.scope_id = opts.scopeId;
882
+ if (opts?.tenant !== undefined)
883
+ body.tenant = opts.tenant;
884
+ return (0, fetch_helpers_js_1.postJSON)(this.ctx, "/v1/_statements/apply_policy", body, opts);
885
+ }
736
886
  async compactRun(runId, opts) {
737
887
  const body = {};
738
888
  if (opts?.reason !== undefined)
package/dist/client.d.ts CHANGED
@@ -26,7 +26,7 @@
26
26
  import { InteractiveSession } from "./interactive.js";
27
27
  import { LoomcycleOAuth } from "./oauth.js";
28
28
  import { ClientToolHost, type ConnectClientToolsOptions } from "./client-tools.js";
29
- import type { ChangeFeedFrame, StreamChangesOptions, CredentialListResponse, CredentialMeta, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, AgentOverridableResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureHookDefOptions, EnsureHookDefResult, HookDefInput, HookDefOverlay, HookDefRowResponse, CreateDefOptions, ForkDefOptions, HookDefForkOverlay, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, WebhookDefInput, WebhookDefOverlay, WebhookDefRowResponse, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, ListUserAgentsOptions, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, CreateTeamOptions, DefNamesResponse, ForkTeamOptions, ModelAliasesResponse, OperatorTokenDefNamesResponse, ProviderModelsResponse, RoutingResponse, ScheduleListResponse, SchedulePauseResult, ScheduleRunNowResult, ScheduleStateView, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamDraft, TeamDraftVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
29
+ import type { ChangeFeedFrame, StreamChangesOptions, CredentialListResponse, CredentialMeta, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, ReviewQueueFilter, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, ListRulingsResult, ApplyReviewPolicyResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, AgentOverridableResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureHookDefOptions, EnsureHookDefResult, HookDefInput, HookDefOverlay, HookDefRowResponse, CreateDefOptions, ForkDefOptions, HookDefForkOverlay, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, WebhookDefInput, WebhookDefOverlay, WebhookDefRowResponse, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, ListUserAgentsOptions, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, CreateTeamOptions, DefNamesResponse, ForkTeamOptions, ModelAliasesResponse, OperatorTokenDefNamesResponse, ProviderModelsResponse, RoutingResponse, ScheduleListResponse, SchedulePauseResult, ScheduleRunNowResult, ScheduleStateView, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamDraft, TeamDraftVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
30
30
  export declare class LoomcycleClient {
31
31
  private ctx;
32
32
  private readonly tokenProvider?;
@@ -406,6 +406,117 @@ export declare class LoomcycleClient {
406
406
  tenant?: string;
407
407
  signal?: AbortSignal;
408
408
  }): Promise<BindSubjectPrincipalResult>;
409
+ /**
410
+ * The statement review queue: a scope's proposed relations (or another
411
+ * `filter.status`), narrowed by `filter`, newest first, or with
412
+ * `summarize: true` their counts by kind, method, from-path prefix and
413
+ * judge verdict. Rows the caller may not read are left out. Mirrors
414
+ * GET /v1/_statements/review. `scope` is `tenant` (default) or `user`;
415
+ * `tenant` is honored only for an admin token. With `scope: "user"`,
416
+ * `scopeId` names whose user documents: an admin or a tenant operator may
417
+ * name another subject of its tenant, a member only itself. Each summary
418
+ * group carries `filter`, which selects exactly that group.
419
+ */
420
+ listReviewQueue(opts?: {
421
+ filter?: ReviewQueueFilter;
422
+ summarize?: boolean;
423
+ limit?: number;
424
+ after?: string;
425
+ order?: "created" | "verified";
426
+ scope?: "tenant" | "user";
427
+ scopeId?: string;
428
+ tenant?: string;
429
+ signal?: AbortSignal;
430
+ }): Promise<ReviewQueueResult>;
431
+ /**
432
+ * Accept or reject proposed statements in bulk, named by `ids` or by the
433
+ * queue's `filter`, at most 1000 per call (`max`). A DRY RUN unless
434
+ * `dryRun: false`: it returns `matched`, a sample of 20 and the kind/method
435
+ * breakdown. To rule, call again with `dryRun: false` and `expectCount` set
436
+ * to the dry run's `matched`; a queue that changed in between is refused
437
+ * (`queue_changed`) and nothing is ruled. `reason` is required to reject.
438
+ * Each statement is ruled as `accept_statement` / `reject_statement` would,
439
+ * with a result per statement, and records `ruled_by: bulk:<ruling_id>`.
440
+ * Mirrors POST /v1/_statements/rule.
441
+ *
442
+ * For an admin or a tenant operator (write on each from-document), or a
443
+ * member holding the access-control action `review` on the from-document's
444
+ * path; what the caller may not rule on is skipped and counted. A refusal
445
+ * throws with the server's code: `invalid_request`, `forbidden`,
446
+ * `queue_changed`, `unavailable`.
447
+ */
448
+ ruleStatements(action: "accept" | "reject", select: {
449
+ ids: string[];
450
+ } | {
451
+ filter: ReviewQueueFilter;
452
+ }, opts?: {
453
+ reason?: string;
454
+ dryRun?: boolean;
455
+ expectCount?: number;
456
+ max?: number;
457
+ scope?: "tenant" | "user";
458
+ scopeId?: string;
459
+ tenant?: string;
460
+ signal?: AbortSignal;
461
+ }): Promise<RuleStatementsResult>;
462
+ /**
463
+ * Undo a bulk ruling: each statement it ruled goes back to its status
464
+ * before, if nothing changed it since (no new evidence, no maintenance, no
465
+ * later ruling); a rejected one is no longer refused when proposed again.
466
+ * Changed ones are listed and left. Same authority as
467
+ * {@link ruleStatements}. Mirrors POST /v1/_statements/revert; an unknown
468
+ * ruling throws `ruling_not_found`.
469
+ */
470
+ revertRuling(rulingId: string, opts?: {
471
+ scope?: "tenant" | "user";
472
+ scopeId?: string;
473
+ tenant?: string;
474
+ signal?: AbortSignal;
475
+ }): Promise<RevertRulingResult>;
476
+ /**
477
+ * The scope's bulk rulings and their reverts, newest first (`limit`
478
+ * default 20, at most 100; `after` = the previous page's `next_cursor`),
479
+ * so an undo can be found after the ruling's own answer is gone. An
480
+ * operator sees every ruling, a member only its own; each names what it
481
+ * selected as the filter or a count of ids, never the ids. Mirrors
482
+ * GET /v1/_statements/rulings.
483
+ */
484
+ listRulings(opts?: {
485
+ limit?: number;
486
+ after?: string;
487
+ scope?: "tenant" | "user";
488
+ scopeId?: string;
489
+ tenant?: string;
490
+ signal?: AbortSignal;
491
+ }): Promise<ListRulingsResult>;
492
+ /**
493
+ * Run the tenant's review policy (the ontology's Review section, or the
494
+ * policy `@auto_assert` implies) over the proposals already in the queue,
495
+ * narrowed by `filter` (its status, if any, must be `proposed`). A DRY RUN
496
+ * unless `dryRun: false`: it returns `matched`, what the policy would
497
+ * accept, reject, route to the judge or leave for a person, the count per
498
+ * rule and a sample. To apply, call again with `dryRun: false` and
499
+ * `expectCount` set to the dry run's `matched`: at most `max` (default and
500
+ * ceiling 1000) accepts and rejects are ruled as one ruling —
501
+ * {@link revertRuling} undoes it — each statement recording
502
+ * `ruled_by: policy:<rule>@<ontology version>`; the rest are `deferred`.
503
+ * Mirrors POST /v1/_statements/apply_policy.
504
+ *
505
+ * For an admin or a tenant operator only: a member is refused
506
+ * (`forbidden`) even holding `review`. A refusal throws with the server's
507
+ * code: `invalid_request` (no policy in force, or the Review section has
508
+ * issues), `forbidden`, `queue_changed`, `unavailable`.
509
+ */
510
+ applyReviewPolicy(opts?: {
511
+ filter?: ReviewQueueFilter;
512
+ dryRun?: boolean;
513
+ expectCount?: number;
514
+ max?: number;
515
+ scope?: "tenant" | "user";
516
+ scopeId?: string;
517
+ tenant?: string;
518
+ signal?: AbortSignal;
519
+ }): Promise<ApplyReviewPolicyResult>;
409
520
  compactRun(runId: string, opts?: {
410
521
  reason?: string;
411
522
  signal?: AbortSignal;
package/dist/client.js CHANGED
@@ -730,6 +730,156 @@ export class LoomcycleClient {
730
730
  : "";
731
731
  return postJSON(this.ctx, `/v1/_ontology/subjects/principal${q}`, { subject, principal }, opts);
732
732
  }
733
+ /**
734
+ * The statement review queue: a scope's proposed relations (or another
735
+ * `filter.status`), narrowed by `filter`, newest first, or with
736
+ * `summarize: true` their counts by kind, method, from-path prefix and
737
+ * judge verdict. Rows the caller may not read are left out. Mirrors
738
+ * GET /v1/_statements/review. `scope` is `tenant` (default) or `user`;
739
+ * `tenant` is honored only for an admin token. With `scope: "user"`,
740
+ * `scopeId` names whose user documents: an admin or a tenant operator may
741
+ * name another subject of its tenant, a member only itself. Each summary
742
+ * group carries `filter`, which selects exactly that group.
743
+ */
744
+ async listReviewQueue(opts) {
745
+ const params = new URLSearchParams();
746
+ for (const [k, v] of Object.entries(opts?.filter ?? {})) {
747
+ if (v === undefined)
748
+ continue;
749
+ if (Array.isArray(v))
750
+ params.set(k, v.join(","));
751
+ else
752
+ params.set(k, String(v));
753
+ }
754
+ if (opts?.summarize)
755
+ params.set("summarize", "true");
756
+ if (opts?.limit !== undefined)
757
+ params.set("limit", String(opts.limit));
758
+ if (opts?.after)
759
+ params.set("after", opts.after);
760
+ if (opts?.order)
761
+ params.set("order", opts.order);
762
+ if (opts?.scope)
763
+ params.set("scope", opts.scope);
764
+ if (opts?.scopeId)
765
+ params.set("scope_id", opts.scopeId);
766
+ if (opts?.tenant !== undefined)
767
+ params.set("tenant", opts.tenant);
768
+ const q = params.toString() ? `?${params.toString()}` : "";
769
+ return jsonFetch(this.ctx, `/v1/_statements/review${q}`, opts);
770
+ }
771
+ /**
772
+ * Accept or reject proposed statements in bulk, named by `ids` or by the
773
+ * queue's `filter`, at most 1000 per call (`max`). A DRY RUN unless
774
+ * `dryRun: false`: it returns `matched`, a sample of 20 and the kind/method
775
+ * breakdown. To rule, call again with `dryRun: false` and `expectCount` set
776
+ * to the dry run's `matched`; a queue that changed in between is refused
777
+ * (`queue_changed`) and nothing is ruled. `reason` is required to reject.
778
+ * Each statement is ruled as `accept_statement` / `reject_statement` would,
779
+ * with a result per statement, and records `ruled_by: bulk:<ruling_id>`.
780
+ * Mirrors POST /v1/_statements/rule.
781
+ *
782
+ * For an admin or a tenant operator (write on each from-document), or a
783
+ * member holding the access-control action `review` on the from-document's
784
+ * path; what the caller may not rule on is skipped and counted. A refusal
785
+ * throws with the server's code: `invalid_request`, `forbidden`,
786
+ * `queue_changed`, `unavailable`.
787
+ */
788
+ async ruleStatements(action, select, opts) {
789
+ const body = { action, ...select };
790
+ if (opts?.reason !== undefined)
791
+ body.reason = opts.reason;
792
+ if (opts?.dryRun !== undefined)
793
+ body.dry_run = opts.dryRun;
794
+ if (opts?.expectCount !== undefined)
795
+ body.expect_count = opts.expectCount;
796
+ if (opts?.max !== undefined)
797
+ body.max = opts.max;
798
+ if (opts?.scope !== undefined)
799
+ body.scope = opts.scope;
800
+ if (opts?.scopeId !== undefined)
801
+ body.scope_id = opts.scopeId;
802
+ if (opts?.tenant !== undefined)
803
+ body.tenant = opts.tenant;
804
+ return postJSON(this.ctx, "/v1/_statements/rule", body, opts);
805
+ }
806
+ /**
807
+ * Undo a bulk ruling: each statement it ruled goes back to its status
808
+ * before, if nothing changed it since (no new evidence, no maintenance, no
809
+ * later ruling); a rejected one is no longer refused when proposed again.
810
+ * Changed ones are listed and left. Same authority as
811
+ * {@link ruleStatements}. Mirrors POST /v1/_statements/revert; an unknown
812
+ * ruling throws `ruling_not_found`.
813
+ */
814
+ async revertRuling(rulingId, opts) {
815
+ const body = { ruling_id: rulingId };
816
+ if (opts?.scope !== undefined)
817
+ body.scope = opts.scope;
818
+ if (opts?.scopeId !== undefined)
819
+ body.scope_id = opts.scopeId;
820
+ if (opts?.tenant !== undefined)
821
+ body.tenant = opts.tenant;
822
+ return postJSON(this.ctx, "/v1/_statements/revert", body, opts);
823
+ }
824
+ /**
825
+ * The scope's bulk rulings and their reverts, newest first (`limit`
826
+ * default 20, at most 100; `after` = the previous page's `next_cursor`),
827
+ * so an undo can be found after the ruling's own answer is gone. An
828
+ * operator sees every ruling, a member only its own; each names what it
829
+ * selected as the filter or a count of ids, never the ids. Mirrors
830
+ * GET /v1/_statements/rulings.
831
+ */
832
+ async listRulings(opts) {
833
+ const params = new URLSearchParams();
834
+ if (opts?.limit !== undefined)
835
+ params.set("limit", String(opts.limit));
836
+ if (opts?.after)
837
+ params.set("after", opts.after);
838
+ if (opts?.scope)
839
+ params.set("scope", opts.scope);
840
+ if (opts?.scopeId)
841
+ params.set("scope_id", opts.scopeId);
842
+ if (opts?.tenant !== undefined)
843
+ params.set("tenant", opts.tenant);
844
+ const q = params.toString() ? `?${params.toString()}` : "";
845
+ return jsonFetch(this.ctx, `/v1/_statements/rulings${q}`, opts);
846
+ }
847
+ /**
848
+ * Run the tenant's review policy (the ontology's Review section, or the
849
+ * policy `@auto_assert` implies) over the proposals already in the queue,
850
+ * narrowed by `filter` (its status, if any, must be `proposed`). A DRY RUN
851
+ * unless `dryRun: false`: it returns `matched`, what the policy would
852
+ * accept, reject, route to the judge or leave for a person, the count per
853
+ * rule and a sample. To apply, call again with `dryRun: false` and
854
+ * `expectCount` set to the dry run's `matched`: at most `max` (default and
855
+ * ceiling 1000) accepts and rejects are ruled as one ruling —
856
+ * {@link revertRuling} undoes it — each statement recording
857
+ * `ruled_by: policy:<rule>@<ontology version>`; the rest are `deferred`.
858
+ * Mirrors POST /v1/_statements/apply_policy.
859
+ *
860
+ * For an admin or a tenant operator only: a member is refused
861
+ * (`forbidden`) even holding `review`. A refusal throws with the server's
862
+ * code: `invalid_request` (no policy in force, or the Review section has
863
+ * issues), `forbidden`, `queue_changed`, `unavailable`.
864
+ */
865
+ async applyReviewPolicy(opts) {
866
+ const body = {};
867
+ if (opts?.filter !== undefined)
868
+ body.filter = opts.filter;
869
+ if (opts?.dryRun !== undefined)
870
+ body.dry_run = opts.dryRun;
871
+ if (opts?.expectCount !== undefined)
872
+ body.expect_count = opts.expectCount;
873
+ if (opts?.max !== undefined)
874
+ body.max = opts.max;
875
+ if (opts?.scope !== undefined)
876
+ body.scope = opts.scope;
877
+ if (opts?.scopeId !== undefined)
878
+ body.scope_id = opts.scopeId;
879
+ if (opts?.tenant !== undefined)
880
+ body.tenant = opts.tenant;
881
+ return postJSON(this.ctx, "/v1/_statements/apply_policy", body, opts);
882
+ }
733
883
  async compactRun(runId, opts) {
734
884
  const body = {};
735
885
  if (opts?.reason !== undefined)
package/dist/index.d.ts CHANGED
@@ -216,5 +216,5 @@ export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./clien
216
216
  export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
217
217
  export { LoomcycleOAuth, OAuthTokenProvider, parseAuthorizeResponse, pkceChallenge } from "./oauth.js";
218
218
  export type { LoomcycleOAuthOptions, OAuthTokenProviderOptions } from "./oauth.js";
219
- export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
219
+ export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ReviewQueueFilter, ReviewQueueGroup, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, RulingBreakdown, RulingItem, RulingSelector, RulingRecord, ListRulingsResult, PolicyRuleCount, ApplyReviewPolicyResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
220
220
  export { AclDeniedError, AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, DeviceLoginError, NotFoundError, InsufficientScopeError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, OAuthError, PauseNotConfiguredError, PerUserQuotaExhaustedError, PromptTooLargeError, RateLimitedError, RequestTooLargeError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, TokenLimitExceededError, UnavailableError, } from "./errors.js";
package/dist/types.d.ts CHANGED
@@ -2069,6 +2069,218 @@ export interface BindSubjectPrincipalResult {
2069
2069
  /** False when the binding was already as asked. */
2070
2070
  changed: boolean;
2071
2071
  }
2072
+ /** Narrows the statement review queue and selects what a bulk ruling rules
2073
+ * ({@link LoomcycleClient.listReviewQueue}, {@link LoomcycleClient.ruleStatements}).
2074
+ * Every field is optional; they combine with AND. A filter never shows more
2075
+ * than the caller may read. */
2076
+ export interface ReviewQueueFilter {
2077
+ /** Statement status; default `proposed`. */
2078
+ status?: string;
2079
+ kind?: string;
2080
+ kinds?: string[];
2081
+ /** Exact, case-sensitive prefix of the method (`rule:`, `rule:citation`). */
2082
+ method?: string;
2083
+ /** The writer recorded on the statement: the agent for a run's write, else the user. */
2084
+ actor?: string;
2085
+ /** Either end in this document / under this Path. */
2086
+ document_id?: string;
2087
+ under_path?: string;
2088
+ from_document_id?: string;
2089
+ to_document_id?: string;
2090
+ from_under_path?: string;
2091
+ to_under_path?: string;
2092
+ /** The writer's own confidence is at least this (0..1). */
2093
+ min_confidence?: number;
2094
+ /** Bounds on created_at: an RFC 3339 timestamp, or unix nanoseconds as a
2095
+ * decimal string (a statement's `created_at` exceeds a JS number's exact
2096
+ * range, so pass it as text). */
2097
+ created_before?: string;
2098
+ created_after?: string;
2099
+ /** A judge's verdict is recorded (`attributes.judge`), or not / is exactly this. */
2100
+ has_judge_verdict?: boolean;
2101
+ judge_verdict?: string;
2102
+ /** The method / the kind exactly as stored: no prefix match, no widening
2103
+ * to a kind's declared sub-kinds. */
2104
+ method_exact?: string;
2105
+ kind_exact?: string;
2106
+ /** The from-document's path prefix exactly as the summary computes it
2107
+ * (first two segments of its first Path name in sort order). */
2108
+ from_path_prefix?: string;
2109
+ /** The from-document is filed under no Path name (the summary's "" prefix). */
2110
+ from_unfiled?: boolean;
2111
+ /** `judge`: the proposals the review policy left for the judge agent. */
2112
+ review_route?: "judge";
2113
+ /** A judge's acceptances in this audit state (attributes.judge.audited);
2114
+ * pair it with `status` (asserted for pending or confirmed, rejected for
2115
+ * overturned). */
2116
+ judge_audit?: "pending" | "confirmed" | "overturned";
2117
+ }
2118
+ /** One row of the review queue's summary. */
2119
+ export interface ReviewQueueGroup {
2120
+ kind: string;
2121
+ method: string;
2122
+ /** The from-document's Path name, first two segments; "" when filed nowhere. */
2123
+ from_path_prefix: string;
2124
+ /** `attributes.judge.verdict`; "" when none. */
2125
+ judge_verdict: string;
2126
+ count: number;
2127
+ /** The filter that selects exactly this group: pass it to
2128
+ * {@link LoomcycleClient.ruleStatements} or `listReviewQueue` as it is. */
2129
+ filter?: ReviewQueueFilter;
2130
+ }
2131
+ /** Result of {@link LoomcycleClient.listReviewQueue}. `statements` are as
2132
+ * `list_statements` renders them (envelope, both ends' titles and documents,
2133
+ * up to three evidence rows); with `summarize` it is empty and `summary` /
2134
+ * `total` carry the counts. */
2135
+ export interface ReviewQueueResult {
2136
+ tenant: string;
2137
+ scope: string;
2138
+ statements: Array<Record<string, unknown>>;
2139
+ truncated?: boolean;
2140
+ next_cursor?: string;
2141
+ summary?: ReviewQueueGroup[];
2142
+ total?: number;
2143
+ }
2144
+ /** Counts of what a ruling rules, by kind and method. */
2145
+ export interface RulingBreakdown {
2146
+ kind: string;
2147
+ method: string;
2148
+ count: number;
2149
+ }
2150
+ /** One statement's outcome in a ruling or a revert: the status it was ruled
2151
+ * (or reverted) to, or the refusal's code (`not_found`, `not_a_proposal`,
2152
+ * `statement_changed`, `failed`, `changed`) and message. */
2153
+ export interface RulingItem {
2154
+ id: string;
2155
+ status?: string;
2156
+ error?: string;
2157
+ message?: string;
2158
+ }
2159
+ /** Result of {@link LoomcycleClient.ruleStatements}. `matched` is what
2160
+ * `expect_count` must repeat; `skipped` counts statements the caller may not
2161
+ * rule on, never named. A dry run carries `sample` and `breakdown`; a real
2162
+ * call `ruling_id`, `ruled`, `failed` and `items`. */
2163
+ export interface RuleStatementsResult {
2164
+ tenant: string;
2165
+ scope: string;
2166
+ action: "accept" | "reject";
2167
+ dry_run: boolean;
2168
+ ruling_id?: string;
2169
+ matched: number;
2170
+ selected: number;
2171
+ skipped: number;
2172
+ to_rule: number;
2173
+ ruled: number;
2174
+ failed: number;
2175
+ sample?: Array<Record<string, unknown>>;
2176
+ breakdown: RulingBreakdown[];
2177
+ items?: RulingItem[];
2178
+ }
2179
+ /** Result of {@link LoomcycleClient.revertRuling}. */
2180
+ export interface RevertRulingResult {
2181
+ tenant: string;
2182
+ scope: string;
2183
+ ruling_id: string;
2184
+ action: string;
2185
+ reverted: number;
2186
+ /** Left because something changed them since the ruling (each in `items`
2187
+ * with error `changed`). */
2188
+ changed: number;
2189
+ skipped: number;
2190
+ items: RulingItem[];
2191
+ /** The revert's own record in {@link LoomcycleClient.listRulings}. */
2192
+ revert_id?: string;
2193
+ }
2194
+ /** What a ruling selected: the queue filter, or how many ids it named
2195
+ * (never the ids); on a revert, the ruling it undid. */
2196
+ export interface RulingSelector {
2197
+ filter?: ReviewQueueFilter;
2198
+ ids_count?: number;
2199
+ max?: number;
2200
+ reverts?: string;
2201
+ /** Set on a review policy's ruling: the ontology version it was read at,
2202
+ * its source (`review` / `auto_assert`; absent for a ruling made as a
2203
+ * run's proposals were filed) and that run. */
2204
+ policy?: {
2205
+ version: number;
2206
+ source?: string;
2207
+ run_id?: string;
2208
+ };
2209
+ /** Set on a judge run's ruling (action `judge`): that run and its agent. */
2210
+ judge?: {
2211
+ run_id: string;
2212
+ agent?: string;
2213
+ };
2214
+ }
2215
+ /** One bulk ruling (`accept` / `reject`) or one revert of one (`revert`:
2216
+ * `ruled` counts what it reverted, `failed` what had changed since). */
2217
+ export interface RulingRecord {
2218
+ id: string;
2219
+ action: string;
2220
+ ruled_by: string;
2221
+ /** The subject that made the call. */
2222
+ actor?: string;
2223
+ reason?: string;
2224
+ selector: RulingSelector;
2225
+ matched: number;
2226
+ ruled: number;
2227
+ failed: number;
2228
+ skipped: number;
2229
+ /** Unix nanoseconds; beyond a JS number's exact range, so compare loosely. */
2230
+ created_at: number;
2231
+ reverted: boolean;
2232
+ reverted_at?: number;
2233
+ /** The id of the (latest) revert, itself a record of the listing. */
2234
+ reverted_by?: string;
2235
+ }
2236
+ /** Result of {@link LoomcycleClient.listRulings}: newest first. An operator
2237
+ * sees every ruling of the scope; a member only its own. */
2238
+ export interface ListRulingsResult {
2239
+ tenant: string;
2240
+ scope: string;
2241
+ rulings: RulingRecord[];
2242
+ next_cursor?: string;
2243
+ }
2244
+ /** How many proposals one rule of the review policy decided; rule 0 is none
2245
+ * matched (and corrections, which the policy never rules): they wait for a
2246
+ * person. */
2247
+ export interface PolicyRuleCount {
2248
+ rule: number;
2249
+ action: "accept" | "reject" | "judge" | "human";
2250
+ text?: string;
2251
+ count: number;
2252
+ }
2253
+ /** Result of {@link LoomcycleClient.applyReviewPolicy}. `source` is where the
2254
+ * policy comes from (`review`: the ontology's Review section; `auto_assert`:
2255
+ * the one `@auto_assert` implies) and `version` the ontology version it was
2256
+ * read at. `matched` is what `expect_count` must repeat; `skipped` counts
2257
+ * proposals the caller may not rule on. `to_rule` is the accepts and rejects
2258
+ * this call rules, `deferred` those left for the next call; `marked` the
2259
+ * proposals whose judge routing it changed. A dry run carries `sample` (each
2260
+ * with `review_rule` and `review_action`); a real call `ruling_id`, `ruled`,
2261
+ * `failed` and `items`. */
2262
+ export interface ApplyReviewPolicyResult {
2263
+ tenant: string;
2264
+ scope: string;
2265
+ dry_run: boolean;
2266
+ source: "review" | "auto_assert";
2267
+ version: number;
2268
+ ruling_id?: string;
2269
+ matched: number;
2270
+ skipped: number;
2271
+ accept: number;
2272
+ reject: number;
2273
+ judge: number;
2274
+ human: number;
2275
+ to_rule: number;
2276
+ deferred: number;
2277
+ ruled: number;
2278
+ failed: number;
2279
+ marked: number;
2280
+ rules: PolicyRuleCount[];
2281
+ sample?: Array<Record<string, unknown>>;
2282
+ items?: RulingItem[];
2283
+ }
2072
2284
  export interface CompactRunResult {
2073
2285
  run_id: string;
2074
2286
  compacted: boolean;
@@ -3555,7 +3767,7 @@ export type DocumentEdgeEvidence = {
3555
3767
  char_end?: number;
3556
3768
  };
3557
3769
  export type DocumentToolInput = {
3558
- op: "create_document" | "get_document" | "documents_summary" | "query_documents" | "delete_document" | "set_path" | "create_chunk" | "upsert_chunk" | "get_chunk" | "update_chunk" | "delete_chunk" | "supersede_chunk" | "graph_recall" | "move_chunk" | "reorder_chunk" | "link_chunks" | "unlink_chunks" | "get_edges" | "get_edge" | "propose_statement" | "accept_statement" | "reject_statement" | "list_statements" | "maintain_statement" | "resolve_anchor" | "lease" | "release" | "describe_ontology" | "extract_citations" | "classify" | "accept_classification" | "query_chunks" | "add_tags" | "remove_tags" | "list_tags" | "define_type" | "list_types" | "set_asset" | "get_asset" | "export_md" | "import_md" | "backlinks" | "related" | "unlinked_mentions" | "history" | "get_version" | "diff" | "export_canvas" | "import_canvas" | "list_facts" | "judge_fact" | "verbatim_answer" | "verification_stats" | "remember" | "propose_entity" | "propose_subject" | "search" | "set_remote" | "sync" | "diff_remote";
3770
+ op: "create_document" | "get_document" | "documents_summary" | "query_documents" | "delete_document" | "set_path" | "create_chunk" | "upsert_chunk" | "get_chunk" | "update_chunk" | "delete_chunk" | "supersede_chunk" | "graph_recall" | "move_chunk" | "reorder_chunk" | "link_chunks" | "unlink_chunks" | "get_edges" | "get_edge" | "propose_statement" | "accept_statement" | "reject_statement" | "list_statements" | "judge_statements" | "maintain_statement" | "resolve_anchor" | "lease" | "release" | "describe_ontology" | "extract_citations" | "classify" | "accept_classification" | "query_chunks" | "add_tags" | "remove_tags" | "list_tags" | "define_type" | "list_types" | "set_asset" | "get_asset" | "export_md" | "import_md" | "backlinks" | "related" | "unlinked_mentions" | "history" | "get_version" | "diff" | "export_canvas" | "import_canvas" | "list_facts" | "judge_fact" | "verbatim_answer" | "verification_stats" | "remember" | "propose_entity" | "propose_subject" | "search" | "set_remote" | "sync" | "diff_remote";
3559
3771
  scope?: "agent" | "user" | "tenant";
3560
3772
  /** Document id (get/delete_document) or chunk id (get/update/delete/move_chunk). */
3561
3773
  id?: string;
@@ -3742,8 +3954,17 @@ export type DocumentToolInput = {
3742
3954
  /** lease: how long to hold it, in milliseconds (default 60000, max one hour). */
3743
3955
  ttl_ms?: number;
3744
3956
  /** classify: "propose" (default) applies an unambiguous rule match and files the
3745
- * rest for review; "report" writes nothing. */
3746
- write?: "propose" | "report";
3957
+ * rest for review; "report" writes nothing. judge_statements: "rule"
3958
+ * (default) or "recommend". */
3959
+ write?: "propose" | "report" | "rule" | "recommend";
3960
+ /** judge_statements (a judge agent's run only): the verdicts to record. */
3961
+ judgements?: Array<{
3962
+ id: string;
3963
+ verdict: "accept" | "reject" | "unsure";
3964
+ confidence: number;
3965
+ rationale: string;
3966
+ verdict_run_id?: string;
3967
+ }>;
3747
3968
  /** export_md: embed round-trippable chunk metadata + edges as HTML comments
3748
3969
  * (default true server-side). false = clean human-facing Markdown. */
3749
3970
  include_metadata?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/client",
3
- "version": "1.131.0",
3
+ "version": "1.133.0",
4
4
  "description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 71 methods covering run streaming, agent metadata, pause/resume/state, resolver re-probe (resolveProbe — issue #88 operator escape hatch), operator-token admin (operatorTokenDef — RFC L OSS multi-tenant auth) + whoami (RFC L authoritative principal, v0.17.0) + tenant-scoped listUsers / listUserAgents, dynamic MCP registration (mcpServerDef + v0.18.0 typed mcpServerDefVerify + ensureMcpServer idempotent register-if-changed), snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed AND v0.11.5 setMemoryEntry + deleteMemoryEntry), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel), v0.11.5 Channel admin CRUD (createChannel + updateChannel + deleteChannel — runtime substrate; yaml channels refuse mutation with HTTP 409), v0.9.x content_sha256 verify, v0.9.1 transcript first-cycle, v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult), v0.10.3 Library v2 enumeration (listLibraryAgents + listLibrarySkills + listLibraryMcpServers), and v0.11.0 LLM Gateway (llmChat + llmStream — direct provider routing without agent overhead; primary target is n8n's LoomCycleChatModel AI Agent sub-node and any LangChain-compatible consumer). v0.10.1 — dual ESM + CommonJS distribution (additive — ESM consumers unchanged; CJS consumers like n8n's community-node loader now work). v0.19.0 — typed inline code-js agent ingestion (AgentDefOverlay.code_body + ensureCodeAgent — register a deterministic code agent through the substrate with no host filesystem bind; RFC J). v0.20.0 — ensureMcpServer surfaces discoveredToolCount straight from create (loomcycle now auto-discovers MCP tools at ingestion); rediscover is now an explicit force-refresh. v0.21.0 — run/continue accept optional non-secret `metadata` (repo name, review policy, …) passed to the agent, symmetric with the WebHook/Schedule trigger paths. v0.22.0 — version-aligned lockstep release; no client-surface change (RFC N tenant isolation of the agent/skill/MCP/Schedule/Webhook definition plane + real op-schemas on the builtin MCP meta-tools are both server-side). v0.23.0 — version-aligned lockstep release; no client-surface change (RFCs O/P/R MCP-server hardening + thin client and the RFC Q DeepSeek tool-content fix are all server-side / MCP-transport-side). v0.24.0 — purgeChannel clears a channel's buffered messages without deleting its definition (allowed on yaml-declared channels too, unlike deleteChannel — F20); AgentDefOverlay gains channels / evaluation_scopes / interruption so a COMPLETE interactive/multi-agent agent round-trips over the substrate (F14). (Consolidates the interim 0.24/0.25 package bumps, which were never tag-published, back into lockstep with the loomcycle v0.24.0 tag.) v0.25.0 — adds the RFC S channel fan-in/fan-out client twins: awaitChannels() (wait for any/all/at_least N messages across channels, or a timeout — non-committing) + broadcastChannels() (publish one payload to N channels in one atomic-pre-flight call), the client-facing counterparts of the in-band Channel.await / Channel.broadcast tool ops (the rest of v0.25.0 — the manual-management Web UI console + Context op=time + max_fires self-retiring schedules — is server-side / in-band, no client-surface change). v0.29.1 — Usage gains optional `max_context_tokens` (the serving model's context-window ceiling, stamped by the loop from Provider.Capabilities() on each usage event) so a consumer can render a 'context used / max' gauge without a hard-coded per-model table; additive + optional, no behavior change. (Lockstep catch-up: the field landed in loomcycle v0.29.0 but the adapter publish skipped on a version mismatch; v0.29.1 realigns the package version with the release tag so it publishes.) v0.33.0 — gRPC + TS client parity for the RFC Y external fan-out and the compaction surface: spawnRunBatch() (POST /v1/runs:batch — spawn up to 32 fresh runs concurrently in one call, combined index-aligned envelope, per-child failures in-envelope) + compactRun(runId) (POST /v1/runs/{run_id}/compact — summarize a parked run's context); plus per-run sampling + compaction overrides now accepted on runStreaming / continueSession (an explicit temperature 0 is preserved as deterministic, not dropped as falsy). (The gRPC half adds the matching SpawnRunBatch / CompactRun RPCs + the sampling/compaction fields on RunRequest/ContinueRequest — server-side.) v0.34.0 — version-aligned lockstep release; no client-surface change (context-transform plugins / RFC Z Phase 1a are server-side config; the exp7 hardening pass is server-side; the R2 cross-provider thinking-model downgrade surfaces a new `model_downgraded` SSE event the generic stream passes through unchanged). v0.35.0 — RFC AH dynamic filesystem volumes: volumeDef() (POST /v1/_volumedef — op-discriminated create/get/list/delete/purge; a Volume is flat, so delete unmaps + purge RemoveAll's, no retire/promote/fork) + listVolumes() / listEphemeralVolumes() (GET /v1/_volumes[/ephemeral] — tenant-scoped; host paths redacted for non-operator callers). Tenant-confined; the runtime derives the path inside an operator-blessed dynamic_root, so callers pass name + mode, never a host path. v1.1.1 — RFC AI interactive agentic sessions: an `interactive: true` flag on runStreaming/continueSession (a run that parks at end_turn for steering) + sendRunInput(runId, text) (POST /v1/runs/{id}/input — steer a live run) + streamRunByID(runId, {fromSeq}) (GET /v1/runs/{id}/stream — re-attach by run_id; the operator's prior turns replay as `steer` events so a cold client reconstructs the whole conversation) + a high-level InteractiveSession driver (client.interactiveSession / attachInteractiveSession — events()/send()/cancel(), the adapter port of the Web UI run terminal). The AgentEvent union gains awaiting_input/steer/context_compaction frames. Version-aligned with the loomcycle v1.1.x line so the v1.1.1 tag publishes it (also carrying the previously-unpublished v0.35.0 volume surface). v1.4.0 — RFC AL Path VFS + RFC AK Document on the wire: path(input) (POST /v1/_path — a Unix-like filesystem over Memory/Volumes/Documents; resolve/ls/stat/mkdir/mv/rm) + document(input) (POST /v1/_document — chunked-graph documents; 13 ops, needs SQL Memory on the sidecar). Scope (agent/user/tenant) + tenant are resolved server-side from the authenticated principal, never the wire; an off-run scope:'user' op keys on the principal subject so it interoperates with that user's agent runs. New PathToolInput / DocumentToolInput types; responses are op-varying (unknown — narrow as needed). v1.7.0 — RFC AT image/vision input: the PromptContent union gains an `image` variant ({ type:'image'; media_type: ImageMediaType; data: base64-no-prefix }) accepted in a user segment by runStreaming / continueSession (segments pass through unchanged — no method change). The model must be vision-capable or the run errors before the call. New ImageMediaType type (image/png|jpeg|gif|webp). v1.12.1 — Path/Document browse-by-subject + the full Document op set (RFC AS/AK): path(input, opts) / document(input, opts) accept optional scopeId / tenant browse overrides sent as ?scope_id= / ?tenant= query params (server reads them from the URL, re-checks authorization; omit both to browse your own subject — byte-identical to the pre-RFC-AS request), and DocumentToolInput.op now covers all 16 backend ops (adds set_path, export_md, import_md) with the matching include_metadata / markdown fields. Additive — existing path() / document() callers are unchanged. v1.16.0 — RFC BC client-executed tools (local tool host): connectClientTools({tools,onInvoke}) opens a persistent WebSocket to /v1/client-tools, registers tools this client runs on the user's machine (browser DOM / files / shell), and answers the invoke frames loomcycle routes when an agent of your principal calls a client:<tool> — returning your reply as an ordinary tool result. Returns a ClientToolHost driver (.close() to stop; auto-reconnect); dependency-free (global WebSocket in browsers / Node 22+, or an injected WebSocketImpl like the ws package on older Node); the bearer rides the Sec-WebSocket-Protocol subprotocol (browsers can't set an Authorization header on a WebSocket). The runtime's first WebSocket surface. v1.45.0 — RFC BL P5 subject erasure: erasureReport(subject, {tenant}) (GET /v1/_erasure — what this deployment holds about one subject, in three tiers: deletable with existing primitives, subject-keyed but not deletable, and facts ABOUT the subject in scopes they do not own) + erasureExecute(subject, {dryRun, confirm, tenant}) (POST /v1/_erasure — removes tiers 1 and 2). DEFAULTS TO A DRY RUN: dryRun defaults true and a live run also requires confirm === subject. The tier-3 residue is traceable only through the subject's chats, which a live run deletes, so a report afterwards shows rows: 0 while those facts remain — the returned object is the only durable record of what was not reached; persist it. New ErasureReport / ErasureResult / ErasureTier / ErasureResidue types. v1.47.0 — RFC BV memory-view SDK: memorySearch() (POST /v1/_memory/search — off-run unified semantic search spanning k/v entries AND document-chunk bodies in one ranked list, each hit tagged kind memory|document with chunk_id on document hits) + memoryEmbedStats(scope) + reembedMemory(scope, scopeId, {dryRun,limit}) (the Vector Memory embed-admin reads the memory-view console needs; dry_run defaults true). Fact reads (list_facts + get_chunk's entity block) ride the existing document() passthrough. Additive — existing callers unchanged. v1.61.0 — RFC CJ per-run context-window override: runStreaming / continueSession accept an optional maxContextTokens (integer tokens) that wins over the agent's own max_context_tokens; omitted inherits it (which defers to the provider/driver default). Distinct from a model's output cap; primarily for local inference (Ollama num_ctx). Serialized as the snake_case max_context_tokens field on POST /v1/runs + the continuation body; additive, existing callers unchanged. v1.72.1 — the TeamDef version lifecycle: listTeamVersions(name) (op=list — every version of one team, newest first), promoteTeam(defId) (op=promote — point the active pointer, which is what a run BY NAME executes; forkTeam defaults to promote:false, so authoring and putting in force stay two steps), retireTeam(defId, retired) (op=retire — reversible and version-scoped, unlike deleteTeam) and verifyTeam(name, contentSha256) (op=verify — the drift check for a workflow kept in source control and pushed to several deployments; an absent team answers deployed:false rather than raising). The ops existed on the substrate and over HTTP; a client that could author a team could not put one in force.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",