@kortexya/reasoninglayer 16.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. package/README.md +15 -0
  2. package/dist/index.cjs +3342 -181
  3. package/dist/index.d.cts +21684 -16900
  4. package/dist/index.d.ts +21684 -16900
  5. package/dist/index.js +3337 -182
  6. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  };
8
8
 
9
9
  // src/config.ts
10
- var SDK_VERSION = "16.0.0";
10
+ var SDK_VERSION = "17.0.0";
11
11
  function checkTimeoutMs(value, where) {
12
12
  if (!Number.isFinite(value) || value < 0) {
13
13
  throw new Error(
@@ -91,6 +91,8 @@ var ReasoningLayerError = class extends Error {
91
91
  };
92
92
  var ApiError = class extends ReasoningLayerError {
93
93
  name = "ApiError";
94
+ /** Health component that produced a structured refusal. */
95
+ component;
94
96
  /** HTTP status code. */
95
97
  status;
96
98
  /** Backend error code (from response body `error` field), if present. */
@@ -101,6 +103,7 @@ var ApiError = class extends ReasoningLayerError {
101
103
  headers;
102
104
  constructor(message, status, body, headers, errorCode) {
103
105
  super(message);
106
+ this.component = isRecord(body) && typeof body.component === "string" ? body.component : void 0;
104
107
  this.status = status;
105
108
  this.body = body;
106
109
  this.headers = headers;
@@ -2391,6 +2394,34 @@ var RESPONSE_COMPONENTS = {
2391
2394
  object: { message: [1, 0], message_ids: [1, { array: 0 }], recipients_count: [1, 0] }
2392
2395
  },
2393
2396
  BrowserReadCommand: { object: { command_id: [1, 0], origin: [1, 0], session_id: [1, 0] } },
2397
+ BrowserRunPendingAction: { object: { command: [1, 0], intent: [1, 0], name: [1, 0] } },
2398
+ BrowserRunProposal: { object: { action: [1, { object: {} }], id: [1, 0] } },
2399
+ BrowserRunResponse: {
2400
+ object: {
2401
+ browser_session: [1, 0],
2402
+ id: [1, 0],
2403
+ pending: [2, "BrowserRunPendingAction"],
2404
+ phase: [1, 0],
2405
+ result: [2, "BrowserRunResult"],
2406
+ revision: [1, 0],
2407
+ step: [1, 0],
2408
+ task: [1, 0],
2409
+ proposal: [2, "BrowserRunProposal"]
2410
+ }
2411
+ },
2412
+ BrowserRunResult: { object: { success: [1, 0], text: [1, 0] } },
2413
+ BrowserRunView: {
2414
+ object: {
2415
+ browser_session: [1, 0],
2416
+ id: [1, 0],
2417
+ pending: [2, "BrowserRunPendingAction"],
2418
+ phase: [1, 0],
2419
+ result: [2, "BrowserRunResult"],
2420
+ revision: [1, 0],
2421
+ step: [1, 0],
2422
+ task: [1, 0]
2423
+ }
2424
+ },
2394
2425
  BrowserStepResponse: {
2395
2426
  object: {
2396
2427
  actions: [1, { array: { object: {} } }],
@@ -2907,6 +2938,18 @@ var RESPONSE_COMPONENTS = {
2907
2938
  }
2908
2939
  },
2909
2940
  ClaimAssessmentDto: { object: { content: [1, 0], subtype: [1, 0], verdict: [1, 0] } },
2941
+ ClaimAttestationDto: { object: { at: [1, 0], by: [1, 0], kind: [1, 0] } },
2942
+ ClaimAttestationResponseDto: {
2943
+ object: {
2944
+ attestation_id: [1, 0],
2945
+ attested_at: [1, 0],
2946
+ attested_by: [1, 0],
2947
+ conversation_id: [1, 0],
2948
+ kind: [1, 0],
2949
+ point_ref: [1, 0],
2950
+ turn_id: [1, 0]
2951
+ }
2952
+ },
2910
2953
  ClaimProvenanceDto: {
2911
2954
  object: { source_scope: [1, 0], source_sort: [1, 0], source_term_id: [1, 0] }
2912
2955
  },
@@ -2954,6 +2997,9 @@ var RESPONSE_COMPONENTS = {
2954
2997
  question_probabilities: [1, { object: {} }]
2955
2998
  }
2956
2999
  },
3000
+ ClausePolicyDraftDto: {
3001
+ object: { rlql: [1, 0], source_clause_id: [1, 0], source_document_id: [1, 0] }
3002
+ },
2957
3003
  CleanupResponse: {
2958
3004
  object: {
2959
3005
  cleaned_curried_functions: [1, 0],
@@ -3870,8 +3916,12 @@ var RESPONSE_COMPONENTS = {
3870
3916
  reasoning_trace: [2, "ReasoningTraceDto"],
3871
3917
  stripped_claims: [0, { array: "StrippedClaimDto" }],
3872
3918
  suggestions: [1, { array: 0 }],
3919
+ to_verify: [0, { array: "ToVerifyPointDto" }],
3873
3920
  turn_id: [1, 0],
3874
- ui_customizations: [2, { array: "UICustomizationDto" }]
3921
+ ui_customizations: [2, { array: "UICustomizationDto" }],
3922
+ unconfirmed: [0, { array: "UnconfirmedRecordDto" }],
3923
+ unread_pages: [0, { array: "UnreadPagesDto" }],
3924
+ web_sources: [0, { array: "WebSourceDto" }]
3875
3925
  }
3876
3926
  },
3877
3927
  ConversationNextQuestionDto: { object: { claim_index: [1, 0], kind: [1, 0] } },
@@ -4057,7 +4107,13 @@ var RESPONSE_COMPONENTS = {
4057
4107
  },
4058
4108
  CreateModuleResponse: { object: { module_name: [1, 0], success: [1, 0] } },
4059
4109
  CreateResearchSessionResponse: {
4060
- object: { created_at: [1, 0], question: [1, 0], session_id: [1, 0], status: [1, 0] }
4110
+ object: {
4111
+ created_at: [1, 0],
4112
+ knowledge_base_tenant_id: [1, 0],
4113
+ question: [1, 0],
4114
+ session_id: [1, 0],
4115
+ status: [1, 0]
4116
+ }
4061
4117
  },
4062
4118
  CreateSessionResponse: { object: { created_at: [1, 0], session_id: [1, 0], status: [1, 0] } },
4063
4119
  CreateSubscriptionResponse: { object: { subscription_id: [1, 0] } },
@@ -4292,6 +4348,9 @@ var RESPONSE_COMPONENTS = {
4292
4348
  verified_count: [1, 0]
4293
4349
  }
4294
4350
  },
4351
+ Decision: {
4352
+ object: { quota: [2, "QuotaView"], sanitise: [1, 0], sites: [2, "Sites"], verdict: [1, 0] }
4353
+ },
4295
4354
  DecisionAuditResponse: {
4296
4355
  object: {
4297
4356
  acts: [1, { array: "ActValueDto" }],
@@ -4900,6 +4959,7 @@ var RESPONSE_COMPONENTS = {
4900
4959
  sort_names: [1, { array: 0 }],
4901
4960
  term_ids: [1, { array: 0 }],
4902
4961
  total_tokens: [1, 0],
4962
+ value_pass: [2, "IngestionValuePassDto"],
4903
4963
  work_cache: [2, "IngestionWorkCacheDto"]
4904
4964
  }
4905
4965
  },
@@ -5150,6 +5210,8 @@ var RESPONSE_COMPONENTS = {
5150
5210
  boot_id: [1, 0],
5151
5211
  build_info: [1, "BuildInfoDto"],
5152
5212
  components: [1, { array: "ComponentHealthDto" }],
5213
+ holds_unproven_text: [1, 0],
5214
+ live_recording: [1, 0],
5153
5215
  sovereign: [1, 0],
5154
5216
  started_at: [1, 0],
5155
5217
  status: [1, 0],
@@ -5377,6 +5439,7 @@ var RESPONSE_COMPONENTS = {
5377
5439
  },
5378
5440
  ExecuteTranspiledResponse: {
5379
5441
  object: {
5442
+ completeness: [1, 0],
5380
5443
  dialect: [1, 0],
5381
5444
  query: [1, 0],
5382
5445
  row_count: [1, 0],
@@ -5855,8 +5918,34 @@ var RESPONSE_COMPONENTS = {
5855
5918
  term_id: [1, 0]
5856
5919
  }
5857
5920
  },
5921
+ FindGroup: { object: { items: [1, { array: "FindHit" }], kind: [1, 0] } },
5922
+ FindHit: {
5923
+ object: {
5924
+ at: [1, "FindPlace"],
5925
+ id: [1, 0],
5926
+ marks: [1, { array: { array: 0 } }],
5927
+ people: [1, { array: 0 }],
5928
+ reading: [1, 0],
5929
+ snippet: [1, 0],
5930
+ sort: [1, 0],
5931
+ source: [1, "FindSource"],
5932
+ title: [1, 0]
5933
+ }
5934
+ },
5935
+ FindNotSearched: { object: { reason: [1, 0], unread_pages: [0, { array: 0 }] } },
5936
+ FindPlace: { object: {} },
5858
5937
  FindPlansResponse: { object: { count: [1, 0], plans: [1, { array: "PlanMatchDto" }] } },
5938
+ FindResponse: {
5939
+ object: {
5940
+ groups: [1, { array: "FindGroup" }],
5941
+ not_searched: [1, { array: "FindNotSearched" }],
5942
+ query: [1, 0],
5943
+ searched: [1, { array: "FindSearched" }]
5944
+ }
5945
+ },
5859
5946
  FindRulesResponse: { object: { matching_rules: [1, { array: "RuleDto" }] } },
5947
+ FindSearched: { object: { live: [1, 0], source: [1, 0] } },
5948
+ FindSource: { object: {} },
5860
5949
  FindingContextDto: {
5861
5950
  object: { related_record_ids: [1, { array: 0 }], roles: [1, { array: 0 }] }
5862
5951
  },
@@ -6309,6 +6398,7 @@ var RESPONSE_COMPONENTS = {
6309
6398
  created_at: [1, 0],
6310
6399
  cycles: [1, { array: "ResearchCycleResultDto" }],
6311
6400
  gap_check: [2, "GapCheck"],
6401
+ knowledge_base_tenant_id: [1, 0],
6312
6402
  papers: [1, { array: "PaperMetadataDto" }],
6313
6403
  question: [1, 0],
6314
6404
  session_id: [1, 0],
@@ -7033,6 +7123,9 @@ var RESPONSE_COMPONENTS = {
7033
7123
  work_cache: [0, "IngestionWorkCacheDto"]
7034
7124
  }
7035
7125
  },
7126
+ IngestionValuePassDto: {
7127
+ object: { passages_not_read: [1, 0], values_held: [1, 0], values_read: [1, 0] }
7128
+ },
7036
7129
  IngestionWorkCacheDto: {
7037
7130
  object: {
7038
7131
  model_calls: [1, 0],
@@ -7776,6 +7869,16 @@ var RESPONSE_COMPONENTS = {
7776
7869
  }
7777
7870
  },
7778
7871
  LiveDocVersionsResponse: { object: { versions: [1, { array: "LiveDocVersionDto" }] } },
7872
+ LiveRecordingView: {
7873
+ object: {
7874
+ bytes: [1, 0],
7875
+ duration_secs: [1, 0],
7876
+ finals: [1, { array: { object: {} } }],
7877
+ id: [1, 0],
7878
+ result: [2, "IngestAudioResponse"],
7879
+ state: [1, 0]
7880
+ }
7881
+ },
7779
7882
  LlmContextFeatureDto: { object: { name: [1, 0], required: [1, 0] } },
7780
7883
  LlmContextPreferenceDto: { object: { key: [1, 0], value: [1, 0] } },
7781
7884
  LlmContextSortDto: {
@@ -9765,6 +9868,17 @@ var RESPONSE_COMPONENTS = {
9765
9868
  worker_count: [1, 0]
9766
9869
  }
9767
9870
  },
9871
+ QueuedVideoIngestResponse: {
9872
+ object: {
9873
+ document_id: [1, 0],
9874
+ session_id: [1, 0],
9875
+ status: [1, 0],
9876
+ status_url: [1, 0],
9877
+ original_files: [1, { array: "RetainedOriginal" }],
9878
+ source_text: [1, 0]
9879
+ }
9880
+ },
9881
+ QuotaView: { object: { limit: [1, 0], resets_at: [1, 0], used: [1, 0] } },
9768
9882
  QuotientClass: { object: { alpha: [1, 0], size: [1, 0], sort_ids: [1, { array: 0 }] } },
9769
9883
  QuotientOrderEdge: { object: { degree: [1, 0], from: [1, 0], to: [1, 0] } },
9770
9884
  RangeDto: { object: { feature: [1, 0], lower: [1, "SideDto"], upper: [1, "SideDto"] } },
@@ -9839,6 +9953,7 @@ var RESPONSE_COMPONENTS = {
9839
9953
  },
9840
9954
  ReasoningStageDto: {
9841
9955
  object: {
9956
+ blocked_sites: [0, { array: 0 }],
9842
9957
  kind: [1, 0],
9843
9958
  llm_used: [1, 0],
9844
9959
  matched_entities: [0, { array: "MatchedEntityDto" }],
@@ -10455,7 +10570,8 @@ var RESPONSE_COMPONENTS = {
10455
10570
  total_corrected: [1, 0],
10456
10571
  total_merged: [1, 0],
10457
10572
  total_pending: [1, 0],
10458
- total_rejected: [1, 0]
10573
+ total_rejected: [1, 0],
10574
+ total_superseded: [1, 0]
10459
10575
  }
10460
10576
  },
10461
10577
  ReviewUnitResponse: {
@@ -11245,6 +11361,7 @@ var RESPONSE_COMPONENTS = {
11245
11361
  },
11246
11362
  SiteRequestFiled: { object: { created: [1, 0], request: [1, "SiteRequestDto"] } },
11247
11363
  SiteRequestList: { object: { items: [1, { array: "SiteRequestDto" }] } },
11364
+ Sites: { object: { allow: [1, { array: 0 }], block: [1, { array: 0 }] } },
11248
11365
  SkillDraftEditResponse: {
11249
11366
  object: { description: [1, 0], markdown: [1, 0], name: [1, 0], prompt_version: [1, 0] }
11250
11367
  },
@@ -11283,6 +11400,24 @@ var RESPONSE_COMPONENTS = {
11283
11400
  SlideNotes: { object: { page: [1, 0], text: [1, 0] } },
11284
11401
  SmoothingParametersDto: { object: { alpha: [1, 0] } },
11285
11402
  SmtCheckResponse: { object: { assignments: [2, { object: {} }], result: [1, 0] } },
11403
+ SnapshotEnvelope: {
11404
+ object: {
11405
+ data: [1, 0],
11406
+ format: [1, 0],
11407
+ metadata: [1, "SnapshotExportMetadata"],
11408
+ version: [1, 0]
11409
+ }
11410
+ },
11411
+ SnapshotExportMetadata: {
11412
+ object: {
11413
+ created_at: [1, 0],
11414
+ name: [1, 0],
11415
+ reasoninglayer_version: [1, 0],
11416
+ size_bytes: [1, 0],
11417
+ source_tenant_id: [1, 0],
11418
+ table_counts: [1, { object: {} }]
11419
+ }
11420
+ },
11286
11421
  SnapshotFilter: { object: { request_path_pattern: [1, 0] } },
11287
11422
  SnapshotResponse: {
11288
11423
  object: {
@@ -11737,6 +11872,7 @@ var RESPONSE_COMPONENTS = {
11737
11872
  supported_modes: [1, { array: 0 }]
11738
11873
  }
11739
11874
  },
11875
+ SourceVerdictDto: { object: { kind: [1, 0] } },
11740
11876
  SourcesResponse: { object: { sources: [1, { array: "SourceDto" }] } },
11741
11877
  SovereignEndpoint: { object: { host: [1, 0], internal: [1, 0], var: [1, 0] } },
11742
11878
  SovereigntyReport: {
@@ -12353,6 +12489,16 @@ var RESPONSE_COMPONENTS = {
12353
12489
  reachable: [2, "ReachableDto"]
12354
12490
  }
12355
12491
  },
12492
+ ToVerifyPointDto: {
12493
+ object: {
12494
+ attestations: [0, { array: "ClaimAttestationDto" }],
12495
+ fact_term_ids: [0, { array: 0 }],
12496
+ kind: [1, 0],
12497
+ point_ref: [1, 0],
12498
+ reason: [1, 0],
12499
+ text: [1, 0]
12500
+ }
12501
+ },
12356
12502
  TokenSummary: {
12357
12503
  object: { cache_read: [1, 0], cache_write: [1, 0], input: [1, 0], output: [1, 0] }
12358
12504
  },
@@ -12506,7 +12652,11 @@ var RESPONSE_COMPONENTS = {
12506
12652
  reasoning_trace: [2, "ReasoningTraceDto"],
12507
12653
  role: [1, 0],
12508
12654
  stripped_claims: [0, { array: "StrippedClaimDto" }],
12509
- timestamp: [1, 0]
12655
+ timestamp: [1, 0],
12656
+ to_verify: [0, { array: "ToVerifyPointDto" }],
12657
+ unconfirmed: [0, { array: "UnconfirmedRecordDto" }],
12658
+ unread_pages: [0, { array: "UnreadPagesDto" }],
12659
+ web_sources: [0, { array: "WebSourceDto" }]
12510
12660
  }
12511
12661
  },
12512
12662
  TurnFeedbackDto: { object: { feedback_id: [1, 0], rating: [1, 0], recorded_at: [1, 0] } },
@@ -12601,6 +12751,7 @@ var RESPONSE_COMPONENTS = {
12601
12751
  y: [1, 0]
12602
12752
  }
12603
12753
  },
12754
+ UnconfirmedRecordDto: { object: { record_id: [1, 0], sort: [1, 0] } },
12604
12755
  UndeterminedDriftDto: { object: { crosswalk_id: [1, 0], reason: [1, 0] } },
12605
12756
  UndoRuleStoreResponse: { object: { rule_count: [1, 0], success: [1, 0] } },
12606
12757
  UnificationQueryResponse: { object: { count: [1, 0], results: [1, { array: "TermDto" }] } },
@@ -12682,6 +12833,7 @@ var RESPONSE_COMPONENTS = {
12682
12833
  records: [1, 0]
12683
12834
  }
12684
12835
  },
12836
+ UnreadPagesDto: { object: { document_id: [1, 0], pages: [1, { array: 0 }], reason: [1, 0] } },
12685
12837
  UnreadableRecordDto: { object: { reason: [1, 0], record_id: [1, 0] } },
12686
12838
  UnsatisfiableClassDto: { object: { class: [1, 0], disjoint_pair: [1, { array: 0 }] } },
12687
12839
  UnsatisfiableSortDto: { object: { disjoint_pair: [1, { array: 0 }], sort: [1, 0] } },
@@ -12915,6 +13067,16 @@ var RESPONSE_COMPONENTS = {
12915
13067
  }
12916
13068
  },
12917
13069
  VersionDto: { object: { bundle_id: [1, 0], engine_req: [1, 0], version: [1, 0] } },
13070
+ VideoEvidenceReceiptDto: {
13071
+ object: {
13072
+ document_term_id: [1, 0],
13073
+ located_terms: [1, 0],
13074
+ unlocated_term_ids: [1, { array: 0 }]
13075
+ }
13076
+ },
13077
+ VideoIngestResponse: {
13078
+ object: { evidence: [1, "VideoEvidenceReceiptDto"], stats: [1, "IngestionStatsDto"] }
13079
+ },
12918
13080
  ViewRefDto: { object: { draft_not_active: [1, 0], kind: [1, 0] } },
12919
13081
  ViolatedConstraintDto: { object: { feature: [1, 0], kind: [1, 0] } },
12920
13082
  ViolationCounts: {
@@ -13071,6 +13233,16 @@ var RESPONSE_COMPONENTS = {
13071
13233
  WebSearchHitDto: { object: { provider: [1, 0], snippet: [1, 0], title: [1, 0], url: [1, 0] } },
13072
13234
  WebSearchProviderDto: { object: { healthy: [1, 0], name: [1, 0] } },
13073
13235
  WebSearchResponse: { object: { query: [1, 0], results: [1, { array: "WebSearchHitDto" }] } },
13236
+ WebSourceDto: {
13237
+ object: {
13238
+ qualification: [1, "WebSourceQualificationDto"],
13239
+ record_term_id: [1, 0],
13240
+ source_verdict: [2, "SourceVerdictDto"],
13241
+ url: [1, 0],
13242
+ used: [1, 0]
13243
+ }
13244
+ },
13245
+ WebSourceQualificationDto: { object: { level: [1, 0] } },
13074
13246
  WebhookCallbackResponse: {
13075
13247
  object: { demons_fired: [1, 0], message: [1, 0], status: [1, 0], term_updated: [1, 0] }
13076
13248
  },
@@ -13638,6 +13810,11 @@ var RESPONSE_OPERATIONS = {
13638
13810
  path: "/api/v1/feasibility/sessions/{session_id}/assumptions",
13639
13811
  responses: { 200: "SchedulingDeltaResponse" }
13640
13812
  },
13813
+ attestConversationPoint: {
13814
+ method: "POST",
13815
+ path: "/api/v1/conversation/{id}/attestations",
13816
+ responses: { 200: "ClaimAttestationResponseDto" }
13817
+ },
13641
13818
  auditAssumptions: {
13642
13819
  method: "POST",
13643
13820
  path: "/api/v1/causal/assumptions/audit",
@@ -13743,6 +13920,11 @@ var RESPONSE_OPERATIONS = {
13743
13920
  path: "/api/v1/cognitive/agents/messages/broadcast",
13744
13921
  responses: { 200: "BroadcastMessageResponse" }
13745
13922
  },
13923
+ browserAgentRun: {
13924
+ method: "POST",
13925
+ path: "/api/v1/agent/browser-runs/{run_id}",
13926
+ responses: { 200: "BrowserRunResponse" }
13927
+ },
13746
13928
  buildTaxonomy: {
13747
13929
  method: "POST",
13748
13930
  path: "/api/v1/grounded-synthesis/taxonomies/build",
@@ -14755,6 +14937,11 @@ var RESPONSE_OPERATIONS = {
14755
14937
  path: "/api/v1/governance/change-requests/{change_request_id}/dispose",
14756
14938
  responses: { 200: "ChangeRequestResponse" }
14757
14939
  },
14940
+ draftClausePolicy: {
14941
+ method: "POST",
14942
+ path: "/api/v1/documents/{document_id}/clauses/{clause_id}/policy-draft",
14943
+ responses: { 200: "ClausePolicyDraftDto" }
14944
+ },
14758
14945
  draftSkillEdit: {
14759
14946
  method: "POST",
14760
14947
  path: "/api/v1/skills/draft-edit",
@@ -15081,6 +15268,11 @@ var RESPONSE_OPERATIONS = {
15081
15268
  path: "/api/v1/vocabulary/exports/skos",
15082
15269
  responses: { 200: "SkosExportResponse" }
15083
15270
  },
15271
+ exportSnapshot: {
15272
+ method: "GET",
15273
+ path: "/api/v1/admin/snapshots/{snapshot_id}/export",
15274
+ responses: { 200: "SnapshotEnvelope" }
15275
+ },
15084
15276
  extendDsr: {
15085
15277
  method: "POST",
15086
15278
  path: "/api/v1/dsr/{id}/extend",
@@ -15126,6 +15318,7 @@ var RESPONSE_OPERATIONS = {
15126
15318
  path: "/api/v1/oversight/sessions/{session_id}/finalize",
15127
15319
  responses: { 200: "FormalJudgeResponse" }
15128
15320
  },
15321
+ find: { method: "POST", path: "/api/v1/find", responses: { 200: "FindResponse" } },
15129
15322
  findBySort: {
15130
15323
  method: "POST",
15131
15324
  path: "/api/v1/query/by-sort",
@@ -15773,6 +15966,11 @@ var RESPONSE_OPERATIONS = {
15773
15966
  path: "/api/v1/sorts/least/{tenant_id}",
15774
15967
  responses: { 200: "LeastSortsResponse" }
15775
15968
  },
15969
+ getLiveRecording: {
15970
+ method: "GET",
15971
+ path: "/api/v1/audio/recordings/{id}",
15972
+ responses: { 200: "LiveRecordingView" }
15973
+ },
15776
15974
  getLlmMetrics: {
15777
15975
  method: "GET",
15778
15976
  path: "/api/v1/metrics/llm",
@@ -16347,6 +16545,11 @@ var RESPONSE_OPERATIONS = {
16347
16545
  path: "/api/v1/ingest/url",
16348
16546
  responses: { 200: "IngestUrlResponse" }
16349
16547
  },
16548
+ ingestVideo: {
16549
+ method: "POST",
16550
+ path: "/api/v1/ingest/video",
16551
+ responses: { 201: "VideoIngestResponse", 202: "QueuedVideoIngestResponse" }
16552
+ },
16350
16553
  installConceptRules: {
16351
16554
  method: "POST",
16352
16555
  path: "/api/v1/analysis/concept-rules",
@@ -16495,7 +16698,7 @@ var RESPONSE_OPERATIONS = {
16495
16698
  listBrowserAgentRuns: {
16496
16699
  method: "GET",
16497
16700
  path: "/api/v1/agent/browser-runs",
16498
- responses: { 200: { array: 0 } }
16701
+ responses: { 200: { array: "BrowserRunView" } }
16499
16702
  },
16500
16703
  listCandidates: {
16501
16704
  method: "GET",
@@ -17387,6 +17590,7 @@ var RESPONSE_OPERATIONS = {
17387
17590
  path: "/api/v1/execution/sessions/{session_id}/goals/pop",
17388
17591
  responses: { 200: "GoalStackResponse" }
17389
17592
  },
17593
+ postDecide: { method: "POST", path: "/api/v1/boundary/decide", responses: { 200: "Decision" } },
17390
17594
  postExchange: {
17391
17595
  method: "POST",
17392
17596
  path: "/api/v1/gateway-sessions/{key}/exchanges",
@@ -18068,6 +18272,11 @@ var RESPONSE_OPERATIONS = {
18068
18272
  path: "/api/v1/ingest/dlq/{id}/retry",
18069
18273
  responses: { 202: "DlqRetryResponse" }
18070
18274
  },
18275
+ retryLiveRecording: {
18276
+ method: "POST",
18277
+ path: "/api/v1/audio/recordings/{id}/retry",
18278
+ responses: { 200: "LiveRecordingView", 202: "LiveRecordingView" }
18279
+ },
18071
18280
  review: {
18072
18281
  method: "POST",
18073
18282
  path: "/api/v1/runtime/builder-review",
@@ -18478,6 +18687,11 @@ var RESPONSE_OPERATIONS = {
18478
18687
  path: "/api/v1/cognitive/agents/{agent_id}/stop",
18479
18688
  responses: { 200: "AgentStatusChangeResponse" }
18480
18689
  },
18690
+ stopLiveRecording: {
18691
+ method: "POST",
18692
+ path: "/api/v1/audio/recordings/{id}/stop",
18693
+ responses: { 200: "LiveRecordingView", 202: "LiveRecordingView" }
18694
+ },
18481
18695
  storePlan: {
18482
18696
  method: "POST",
18483
18697
  path: "/api/v1/cognitive/agents/plans",
@@ -19552,7 +19766,8 @@ function BulkRowRefusalFromApiToFront(dto) {
19552
19766
  message: dto.message,
19553
19767
  ...dto.feature ? { feature: dto.feature } : {},
19554
19768
  ...dto.constraint_name != null ? { constraintName: dto.constraint_name } : {},
19555
- ...dto.constraint_message != null ? { constraintMessage: dto.constraint_message } : {}
19769
+ ...dto.constraint_message != null ? { constraintMessage: dto.constraint_message } : {},
19770
+ ...dto.code != null ? { code: dto.code } : {}
19556
19771
  };
19557
19772
  }
19558
19773
  function ClearTermsResponseFromApiToFront(dto) {
@@ -21660,6 +21875,7 @@ function BackwardChainResponseFromApiToFront(dto) {
21660
21875
  };
21661
21876
  if (dto.derivation_complete != null) out.derivationComplete = dto.derivation_complete;
21662
21877
  if (dto.completed_proof_count != null) out.completedProofCount = dto.completed_proof_count;
21878
+ if (dto.valid_before != null) out.validBefore = dto.valid_before;
21663
21879
  if (dto.open_world_search != null) {
21664
21880
  out.openWorldSearch = OpenWorldSearchCompletionFromApiToFront(dto.open_world_search);
21665
21881
  }
@@ -21732,7 +21948,11 @@ function BulkAddRulesResponseFromApiToFront(dto) {
21732
21948
  return out;
21733
21949
  }
21734
21950
  function RejectedBulkItemFromApiToFront(dto) {
21735
- return { index: dto.index, reason: dto.reason };
21951
+ return {
21952
+ index: dto.index,
21953
+ reason: dto.reason,
21954
+ ...dto.code != null ? { code: dto.code } : {}
21955
+ };
21736
21956
  }
21737
21957
  function BulkAddFactsResponseFromApiToFront(dto) {
21738
21958
  const out = {
@@ -21852,6 +22072,7 @@ function NafProveResponseFromApiToFront(dto) {
21852
22072
  };
21853
22073
  if (dto.derivation_complete != null) out.derivationComplete = dto.derivation_complete;
21854
22074
  if (dto.completed_proof_count != null) out.completedProofCount = dto.completed_proof_count;
22075
+ if (dto.valid_before != null) out.validBefore = dto.valid_before;
21855
22076
  return out;
21856
22077
  }
21857
22078
  function CreateGoalResponseFromApiToFront(dto) {
@@ -26947,7 +27168,9 @@ function VocabularyAuthorityRelationFromApiToFront(dto) {
26947
27168
  key,
26948
27169
  wireString(value, `body.fact.features.${key}`)
26949
27170
  ])
26950
- )
27171
+ ),
27172
+ ...present(dto.valid_until) ? { validUntil: wireString(dto.valid_until, "body.fact.valid_until") } : {},
27173
+ ...dto.expired === void 0 ? {} : { expired: wireBoolean(dto.expired, "body.fact.expired") }
26951
27174
  };
26952
27175
  }
26953
27176
  function VocabularyAuthorityRelationAssertedFromApiToFront(dto) {
@@ -27312,7 +27535,9 @@ function GovernanceAuthorityRelationFromApiToFront(dto) {
27312
27535
  return {
27313
27536
  features: definedRecord(dto.features),
27314
27537
  id: dto.id,
27315
- relation: dto.relation
27538
+ relation: dto.relation,
27539
+ ...dto.valid_until === void 0 ? {} : { validUntil: dto.valid_until === null ? null : dto.valid_until },
27540
+ ...dto.expired === void 0 ? {} : { expired: wireBoolean(dto.expired, "authorityRelation.expired") }
27316
27541
  };
27317
27542
  }
27318
27543
  function GovernanceAuthorityRelationPageResponseFromApiToFront(dto) {
@@ -28824,6 +29049,14 @@ var GOVERNANCE_REFUSAL_CODES = members({
28824
29049
  llm_provider_failed: true,
28825
29050
  subscription_source_unconfigured: true,
28826
29051
  subscription_source_foreign: true,
29052
+ browser_run_person_required: true,
29053
+ browser_run_access_denied: true,
29054
+ browser_authority_unavailable: true,
29055
+ browser_run_not_found: true,
29056
+ browser_run_conflict: true,
29057
+ browser_run_task_invalid: true,
29058
+ browser_observation_out_of_bounds: true,
29059
+ browser_run_store_unavailable: true,
28827
29060
  workflow_authority_unconfigured: true,
28828
29061
  action_approval_denied: true,
28829
29062
  action_approval_undetermined: true,
@@ -28860,7 +29093,14 @@ var GOVERNANCE_REFUSAL_CODES = members({
28860
29093
  statement_not_a_rule: true,
28861
29094
  statement_refused: true,
28862
29095
  rule_comparison_timeout: true,
28863
- rule_comparison_failed: true
29096
+ rule_comparison_failed: true,
29097
+ reserved_sort_write_refused: true,
29098
+ sort_write_not_granted: true,
29099
+ filing_term_unread: true,
29100
+ reference_term_unknown: true,
29101
+ term_id_unavailable: true,
29102
+ reserved_sort_delete_refused: true,
29103
+ sort_delete_not_granted: true
28864
29104
  });
28865
29105
 
28866
29106
  // src/utils/vocabulary-refusal.ts
@@ -29088,12 +29328,30 @@ function rethrowVocabularyRefusal(error) {
29088
29328
  }
29089
29329
  throw error;
29090
29330
  }
29331
+ function rethrowBulkRowCodes(error) {
29332
+ if (error instanceof BulkRefusedError) {
29333
+ const body = error.body;
29334
+ const wireRows = typeof body === "object" && body !== null && "errors" in body ? body.errors : void 0;
29335
+ if (Array.isArray(wireRows) && wireRows.length === error.rows.length) {
29336
+ const entries = wireRows;
29337
+ const rows = error.rows.map((row, position) => {
29338
+ const entry2 = entries[position];
29339
+ const code = typeof entry2 === "object" && entry2 !== null && "code" in entry2 ? entry2.code : void 0;
29340
+ const known = GOVERNANCE_REFUSAL_CODES.find((member) => member === code);
29341
+ return known === void 0 ? row : { ...row, code: known };
29342
+ });
29343
+ throw new BulkRefusedError(error.message, body, error.headers, rows, error.errorCode);
29344
+ }
29345
+ }
29346
+ throw error;
29347
+ }
29091
29348
  function governanceRefusalOfBody(body) {
29092
29349
  try {
29093
29350
  const wire = wireObject(body, "body");
29094
29351
  return {
29095
29352
  error: wireString(wire.error, "error"),
29096
29353
  code: wireLiteral(wire.code, GOVERNANCE_REFUSAL_CODES, "code"),
29354
+ ...isAbsent(wire.component) ? {} : { component: wireString(wire.component, "component") },
29097
29355
  message: wireString(wire.message, "message")
29098
29356
  };
29099
29357
  } catch (failure) {
@@ -30782,7 +31040,7 @@ var Sorts = class {
30782
31040
  ...params
30783
31041
  });
30784
31042
  /**
30785
- * @description `POST /api/v1/sorts/subsumption/bulk` keeps the relation's closed contract: it refuses `a ⊑·0.7 b, b ⊑·0.6 c` without `a ⊑· c`. This is the import path for such input, through the native [`SortHierarchy::compile_fuzzy_subsumptions`](osfkb_domain::types::SortHierarchy::compile_fuzzy_subsumptions): each source is exact for its pair, every degree transitivity forces beyond the one-hop reading is returned apart as `derived`, and the native partial-order check remains the verifier. The declaration is one unit, so it is admitted or refused whole: * a source naming a sort the caller cannot write is a 404, as on the single writer; * a contradiction (a source or an existing declaration below a forced degree, a degree outside `[0, 1]`, two different degrees for one pair) is a 422 naming it, and nothing is written; * a forced degree touching a sort the caller cannot write is a 422 as well: the relation is process-wide, so the closure may not write onto a sort outside the caller's ownership any more than a source may. The compilation is validated on a staging fork before recovery is armed, persisted as one batch, and mirrored into the tenant lattice every graded route reads (#113).
31043
+ * @description `POST /api/v1/sorts/subsumption/bulk` keeps the relation's closed contract: it refuses `a ⊑·0.7 b, b ⊑·0.6 c` without `a ⊑· c`. This is the import path for such input, through compilation of the fuzzy subsumption relation: each source is exact for its pair, every degree transitivity forces beyond the one-hop reading is returned apart as `derived`, and the native partial-order check remains the verifier. The declaration is one unit, so it is admitted or refused whole: * a source naming a sort the caller cannot write is a 404, as on the single writer; * a contradiction (a source or an existing declaration below a forced degree, a degree outside `[0, 1]`, two different degrees for one pair) is a 422 naming it, and nothing is written; * a forced degree touching a sort the caller cannot write is a 422 as well: the relation is process-wide, so the closure may not write onto a sort outside the caller's ownership any more than a source may. The compilation is validated on a staging fork before recovery is armed, persisted as one batch, and mirrored into the tenant lattice every graded route reads (#113).
30786
31044
  *
30787
31045
  * @tags sorts
30788
31046
  * @name CompileSubsumptions
@@ -31934,7 +32192,7 @@ var Terms = class {
31934
32192
  ...params
31935
32193
  });
31936
32194
  /**
31937
- * @description Newest first. Each entry carries the state after the write and, except for version 1, the diff against the version before it — computed on read with `osfkb_domain::versioning::compute_diff`, which skips the bitemporal features. Three distinct answers, which must not be collapsed into one 404: * the term exists and has states — `200` with them; * the term exists and has none (it predates the history, or the history is off) — `200` with `history_recorded: false` and an empty list. Every term written before this release is in this case, and calling it "not found" would be false. A rule's conclusion is ALWAYS in this case (#309): it is derived, never written, so no state of it is recorded; * the term is unknown to this tenant — `404`.
32195
+ * @description Newest first. Each entry carries the state after the write and, except for version 1, the diff against the version before it — computed on read, excluding the bitemporal features. Three distinct answers, which must not be collapsed into one 404: * the term exists and has states — `200` with them; * the term exists and has none (it predates the history, or the history is off) — `200` with `history_recorded: false` and an empty list. Every term written before this release is in this case, and calling it "not found" would be false. A rule's conclusion is ALWAYS in this case (#309): it is derived, never written, so no state of it is recorded; * the term is unknown to this tenant — `404`.
31938
32196
  *
31939
32197
  * @tags terms
31940
32198
  * @name ListTermVersions
@@ -32225,7 +32483,7 @@ var Inference = class {
32225
32483
  ...params
32226
32484
  });
32227
32485
  /**
32228
- * @description Phase 2 v2 entry point for retraction: 1. Removes each term from PG + in-memory stores via [`HomoiconicTermService::remove_term`](osfkb_application::services::HomoiconicTermService::remove_term). 2. When `state.use_plan_engine` is on, submits a single [`DeltaEvent::Retract`](osfkb_application::services::dataflow::DeltaEvent::Retract) to the per-tenant supervisor so the Backward/Forward backward chase decrements every dependent derived fact's `proof_count` (and deletes those whose count reaches zero). Symmetric to [`bulk_add_terms`]; idempotent (term ids absent from the working memory are silently skipped — same shape as [`delete_term`] returning 404, except in the bulk path the missing ids simply don't appear in `removed_term_ids`). Best-effort supervisor enqueue: a supervisor failure does NOT fail the 2xx response — the persist path has succeeded and a future bootstrap can recover any missed retraction. # Mid-batch error handling If `remove_term` fails for a term partway through the batch, the handler **stops accumulating successes**, runs cache invalidation for the prefix that did succeed, submits a single [`DeltaEvent::Retract`](osfkb_application::services::dataflow::DeltaEvent::Retract) covering that prefix, and **then** surfaces the error. This keeps the supervisor and the in-memory caches in sync with the actual store state — a leaked Retract event would orphan derived facts whose only antecedent is now removed, which is a critical correctness violation. # Authorization Requires `X-Tenant-Id` header. The `term_ids` are resolved against that tenant's working memory only — cross-tenant retraction is impossible by construction (the per-tenant `HomoiconicTermService` only sees its own tenant's terms).
32486
+ * @description Phase 2 v2 entry point for retraction: 1. Removes each term from persistent and in-memory storage. 2. When `state.use_plan_engine` is on, submits a single retraction event to the per-tenant supervisor so the Backward/Forward backward chase decrements every dependent derived fact's `proof_count` (and deletes those whose count reaches zero). Symmetric to [`bulk_add_terms`]; idempotent (term ids absent from the working memory are silently skipped — same shape as [`delete_term`] returning 404, except in the bulk path the missing ids simply don't appear in `removed_term_ids`). Best-effort supervisor enqueue: a supervisor failure does NOT fail the 2xx response — the persist path has succeeded and a future bootstrap can recover any missed retraction. # Mid-batch error handling If `remove_term` fails for a term partway through the batch, the handler **stops accumulating successes**, runs cache invalidation for the prefix that did succeed, submits a single retraction event covering that prefix, and **then** surfaces the error. This keeps the supervisor and the in-memory caches in sync with the actual store state — a leaked Retract event would orphan derived facts whose only antecedent is now removed, which is a critical correctness violation. # Authorization Requires `X-Tenant-Id` header. The `term_ids` are resolved against that tenant's working memory only — cross-tenant retraction is impossible by construction (the per-tenant `HomoiconicTermService` only sees its own tenant's terms).
32229
32487
  *
32230
32488
  * @tags inference
32231
32489
  * @name BulkRetractTerms
@@ -34544,6 +34802,22 @@ var Ingestion = class {
34544
34802
  format: "json",
34545
34803
  ...params
34546
34804
  });
34805
+ /**
34806
+ * @description A recording the live caption socket keeps (`/ws/audio/stream?protocol_version=2&recording=<id>`): its state, the audio held and the finals so far; once ready, the retained original and the parse-only audio result. Only the user who started it may read it. A ready or failed recording expires after the parse-only retention (`OSFKB_AUDIO_JOB_RETENTION_SECS`, a day by default).
34807
+ *
34808
+ * @tags ingestion
34809
+ * @name GetLiveRecording
34810
+ * @summary Read a live recording.
34811
+ * @request GET:/api/v1/audio/recordings/{id}
34812
+ * @secure
34813
+ */
34814
+ getLiveRecording = (id, params = {}) => this.http.request({
34815
+ path: `/api/v1/audio/recordings/${id}`,
34816
+ method: "GET",
34817
+ secure: true,
34818
+ format: "json",
34819
+ ...params
34820
+ });
34547
34821
  /**
34548
34822
  * @description `documents` counts the calling tenant's own ingestion documents by status; a tenant that never ingested sees all zeros (#293). Queue depth, worker figures, wait times, throughput and the LLM circuit-breaker state describe the process-wide pipeline shared by every tenant. `circuit_breaker_state` is one of `closed`, `open`, `half_open`, `unknown` (#294).
34549
34823
  *
@@ -34722,7 +34996,7 @@ var Ingestion = class {
34722
34996
  ...params
34723
34997
  });
34724
34998
  /**
34725
- * @description Crawls from `url` through the engine's web fetcher, obeying robots.txt and `<meta name="robots">`, staying inside `scope`, following at most `max_depth` link hops and requesting at most `max_pages` page URLs, with at least the reported interval between two requests to one host. Only public addresses are reachable: a URL naming — or resolving to — a loopback, private or link-local address is refused. Each page read becomes one `web_page` term carrying its provenance — `url`, `fetched_at`, `content_hash` — and its content: `title`, `headings`, `text`, `text_truncated`, `links`, `http_status`, `content_type`. Re-ingesting a URL lands on the same term: `unchanged` when the content hash matches (nothing is written), `updated` when it does not. Pages are written in crawl order. A store failure after the crawl stops the writes and answers `500` with code `web_ingest_store_failed`: `report` lists the pages stored before it (their post-write maintenance has run), `failed` names the step, the page and the cause, and `not_written` lists the pages read after it. Nothing is rolled back. Re-running the request is idempotent: a page's term id derives from its URL, so the stored pages answer `unchanged` and the rest are written.
34999
+ * @description Crawls from `url` through the engine's web fetcher, obeying robots.txt and `<meta name="robots">`, staying inside `scope`, following at most `max_depth` link hops and requesting at most `max_pages` page URLs, with at least the reported interval between two requests to one host. Only public addresses are reachable: a URL naming — or resolving to — a loopback, private or link-local address is refused. Each page read becomes one `web_page` term carrying its provenance — `url`, `fetched_at`, `content_hash` — and its content: `title`, `headings`, `text`, `text_truncated`, `links`, `http_status`, `content_type`. Re-ingesting a URL lands on the same term: `unchanged` when the content hash matches (nothing is written), `updated` when it does not. Pages are written in crawl order. A store failure after the crawl stops the writes and answers `500` with code `web_ingest_store_failed`: `report` lists the pages stored before it (their post-write maintenance has run), `failed` names the step, the page and the cause, and `not_written` lists the pages read after it. Nothing is rolled back. Re-running the request is idempotent: a page's term id derives from its URL, so the stored pages answer `unchanged` and the rest are written. The fetch goes through the engine's one web path ([`crate::handlers::web_effects::WebCall::ingest`], the same as the RLQL `READ PAGE` statement): the request is checked first, then the Space's boundary decides the fetch of the start page's host as `public` data, with the caller's forwarded credential. A refusal fetches nothing.
34726
35000
  *
34727
35001
  * @tags ingestion
34728
35002
  * @name IngestUrl
@@ -34739,6 +35013,25 @@ var Ingestion = class {
34739
35013
  format: "json",
34740
35014
  ...params
34741
35015
  });
35016
+ /**
35017
+ * @description Reads the clip's timeline from the configured service and ingests its text with the full ontology extraction. The run commits the document, its terms, the video evidence and one passage per utterance or frame together, or none of them.
35018
+ *
35019
+ * @tags ingestion
35020
+ * @name IngestVideo
35021
+ * @summary Ingest a short video
35022
+ * @request POST:/api/v1/ingest/video
35023
+ * @secure
35024
+ */
35025
+ ingestVideo = (data, query, params = {}) => this.http.request({
35026
+ path: `/api/v1/ingest/video`,
35027
+ method: "POST",
35028
+ query,
35029
+ body: data,
35030
+ secure: true,
35031
+ type: "application/json",
35032
+ format: "json",
35033
+ ...params
35034
+ });
34742
35035
  /**
34743
35036
  * @description Returns paginated list of chunk failures in the dead-letter queue.
34744
35037
  *
@@ -34997,6 +35290,22 @@ var Ingestion = class {
34997
35290
  format: "json",
34998
35291
  ...params
34999
35292
  });
35293
+ /**
35294
+ * @description Finalizes again a `failed` recording from the audio it kept. A ready recording answers 200 as it stands; one still recording or finalizing answers 409.
35295
+ *
35296
+ * @tags ingestion
35297
+ * @name RetryLiveRecording
35298
+ * @summary Finalize again a recording whose finalizing failed.
35299
+ * @request POST:/api/v1/audio/recordings/{id}/retry
35300
+ * @secure
35301
+ */
35302
+ retryLiveRecording = (id, params = {}) => this.http.request({
35303
+ path: `/api/v1/audio/recordings/${id}/retry`,
35304
+ method: "POST",
35305
+ secure: true,
35306
+ format: "json",
35307
+ ...params
35308
+ });
35000
35309
  /**
35001
35310
  * @description POST /api/v1/ingest/sessions Creates a resumable ingestion session for tracking batch document ingestion. Returns a session ID that can be used to track progress and resume interrupted ingestion. # Headers - `X-Tenant-Id`: Tenant ID for multi-tenancy isolation (required) # Request Body - `document_ids`: List of document IDs that will be ingested in this session # Response - Session details including ID, status, and document count
35002
35311
  *
@@ -35015,6 +35324,22 @@ var Ingestion = class {
35015
35324
  format: "json",
35016
35325
  ...params
35017
35326
  });
35327
+ /**
35328
+ * @description Stops a recording and finalizes it: the audio is sealed and retained as the meeting's original, then the parse-only audio pipeline writes the transcript, summary and actions. Idempotent: a recording already finalizing answers 202 (and finalizing starts again if its worker stopped), a ready or failed one answers 200. Audio a live socket had not yet written (at most about five seconds) is not kept.
35329
+ *
35330
+ * @tags ingestion
35331
+ * @name StopLiveRecording
35332
+ * @summary Stop a live recording whose socket is gone, and finalize it.
35333
+ * @request POST:/api/v1/audio/recordings/{id}/stop
35334
+ * @secure
35335
+ */
35336
+ stopLiveRecording = (id, params = {}) => this.http.request({
35337
+ path: `/api/v1/audio/recordings/${id}/stop`,
35338
+ method: "POST",
35339
+ secure: true,
35340
+ format: "json",
35341
+ ...params
35342
+ });
35018
35343
  /**
35019
35344
  * No description
35020
35345
  *
@@ -35079,11 +35404,11 @@ var Ingestion = class {
35079
35404
  ...params
35080
35405
  });
35081
35406
  /**
35082
- * @description The search goes through the same `WebSearchRouter` the `web_search` agent action uses: the providers, their failover order and their health marks are the ones `GET /api/v1/web/capabilities` reports. The route does not enforce health — a provider marked unhealthy is still tried in order, as the router does for the agent action, and a success marks it healthy again. The results are candidates for `POST /api/v1/ingest/url`; the search itself writes nothing for the tenant, so the route is wrapped in [`crate::middleware::mark_tenant_untouched`] and every answer — the body rejections included — carries the marker (#347, #385). A deployment that cannot search says so with a typed code — `503 web_search_not_configured` or `502 web_search_providers_failed` — and never with an empty list, which means the search ran and found nothing.
35407
+ * @description The search goes through the same `WebSearchRouter` the `web_search` agent action and the Ask turn's web leg use: crawl-bee through the gateway's relay, with the providers, their failover order and their health marks `GET /api/v1/web/capabilities` reports. It reads the Space's `web_search` setting first ([`web_search_reach`]), then asks the Space's boundary for the call (a query made of the person's own words is `internal`), and sends the Space's sites with it. The results are candidates for `POST /api/v1/ingest/url`; the search itself writes nothing for the tenant, so the route is wrapped in [`crate::middleware::mark_tenant_untouched`] and every answer — the body rejections included — carries the marker (#347, #385). A deployment that cannot search says so with a typed code — `503 web_search_not_configured` or `502 web_search_providers_failed` — and never with an empty list, which means the search ran and found nothing.
35083
35408
  *
35084
35409
  * @tags ingestion
35085
35410
  * @name WebSearch
35086
- * @summary Search the web through the deployment's search providers (#413).
35411
+ * @summary Search the web through the box's search (#413, gate 1 WP-0).
35087
35412
  * @request POST:/api/v1/web/search
35088
35413
  * @secure
35089
35414
  */
@@ -37582,7 +37907,7 @@ var Visualization = class {
37582
37907
  ...params
37583
37908
  });
37584
37909
  /**
37585
- * @description Without `term_id`, one constraint node per bound constraint DECLARED on a sort (`CHECK ON …`, or `bound_constraints` on `POST /api/v1/sorts`), with sort-level feature paths as its variables. With `term_id`, one node per constraint GOVERNING that term (own and inherited), each evaluated by the evaluator every write surface runs and carrying its `status`. In both, every dependency the reactive facade's tracker holds is added, and `cycles` are closed walks over the response graph's own node and edge ids. The graph is built by [`osfkb_domain::visualization::build_constraint_graph`]; `dot_output` renders that same graph. Before #341 this route answered one `Constraint System` placeholder node, never filled `fd_domains`, and rendered DOT from an empty graph.
37910
+ * @description Without `term_id`, one constraint node per bound constraint DECLARED on a sort (`CHECK ON …`, or `bound_constraints` on `POST /api/v1/sorts`), with sort-level feature paths as its variables. With `term_id`, one node per constraint GOVERNING that term (own and inherited), each evaluated by the evaluator every write surface runs and carrying its `status`. In both, every dependency the reactive facade's tracker holds is added, and `cycles` are closed walks over the response graph's own node and edge ids. The `dot_output` field renders the same graph. Before #341 this route answered one `Constraint System` placeholder node, never filled `fd_domains`, and rendered DOT from an empty graph.
37586
37911
  *
37587
37912
  * @tags visualization
37588
37913
  * @name GetConstraintGraph
@@ -39561,6 +39886,7 @@ function OsfqlBindingsFromApiToFront(value) {
39561
39886
  }
39562
39887
  function OsfqlRequestFromFrontToApi(model) {
39563
39888
  const dto = { query: model.query };
39889
+ if (model.confirmExternal !== void 0) dto.confirm_external = model.confirmExternal;
39564
39890
  if (model.reactive !== void 0) dto.reactive = model.reactive;
39565
39891
  if (model.atomic !== void 0) dto.atomic = model.atomic;
39566
39892
  if (model.maxRows !== void 0) dto.max_rows = model.maxRows;
@@ -39917,6 +40243,14 @@ function OsfqlRefusalFromApiToFront(value) {
39917
40243
  parsedRepairs.push(repair);
39918
40244
  }
39919
40245
  const refusal = { code, sort, candidates, repairs: parsedRepairs };
40246
+ const denialCode = value["denial_code"];
40247
+ if (typeof denialCode === "string") {
40248
+ const known = GOVERNANCE_REFUSAL_CODES.find((member) => member === denialCode);
40249
+ if (known === void 0) return void 0;
40250
+ refusal.denialCode = known;
40251
+ } else if (denialCode !== void 0 && denialCode !== null) {
40252
+ return void 0;
40253
+ }
39920
40254
  if (typeof role === "string") {
39921
40255
  refusal.role = role;
39922
40256
  } else if (role !== void 0 && role !== null) {
@@ -40170,28 +40504,30 @@ function definitionToApi(value) {
40170
40504
  own_created_records: value.ownCreatedRecords
40171
40505
  };
40172
40506
  }
40507
+ function definitionFromApi(d) {
40508
+ return {
40509
+ name: d.name,
40510
+ body: d.body,
40511
+ params: d.params,
40512
+ returns: d.returns,
40513
+ writes: d.writes,
40514
+ rules: d.rules?.map(ruleFromApi),
40515
+ projectId: d.project_id ?? void 0,
40516
+ frame: d.frame ?? void 0,
40517
+ boundParam: d.bound_param ?? void 0,
40518
+ requiredRoles: d.required_roles,
40519
+ approval: d.approval ?? void 0,
40520
+ riskTier: d.risk_tier ?? void 0,
40521
+ ownCreatedRecords: d.own_created_records
40522
+ };
40523
+ }
40173
40524
  function actionFromApi(dto) {
40174
- const d = dto.definition;
40175
40525
  return {
40176
40526
  id: dto.id,
40177
40527
  version: dto.version,
40178
40528
  owner: dto.owner ?? void 0,
40179
40529
  origin: dto.origin,
40180
- definition: {
40181
- name: d.name,
40182
- body: d.body,
40183
- params: d.params,
40184
- returns: d.returns,
40185
- writes: d.writes,
40186
- rules: d.rules?.map(ruleFromApi),
40187
- projectId: d.project_id ?? void 0,
40188
- frame: d.frame ?? void 0,
40189
- boundParam: d.bound_param ?? void 0,
40190
- requiredRoles: d.required_roles,
40191
- approval: d.approval ?? void 0,
40192
- riskTier: d.risk_tier ?? void 0,
40193
- ownCreatedRecords: d.own_created_records
40194
- }
40530
+ definition: definitionFromApi(dto.definition)
40195
40531
  };
40196
40532
  }
40197
40533
  function applyFromApi(dto) {
@@ -40219,6 +40555,215 @@ function applyFromApi(dto) {
40219
40555
  };
40220
40556
  }
40221
40557
 
40558
+ // src/normalizers/frame-authoring.ts
40559
+ function FrameCalculationDraftResponseFromApiToFront(dto) {
40560
+ switch (dto.status) {
40561
+ case "needs_clarification":
40562
+ return {
40563
+ questions: dto.questions.map(
40564
+ (item0) => RuleDraftClarificationQuestionDtoFromApiToFront(item0)
40565
+ ),
40566
+ status: dto.status
40567
+ };
40568
+ case "complete":
40569
+ return {
40570
+ definition: definitionFromApi(dto.definition),
40571
+ draft: CalculationFromApiToFront(dto.draft),
40572
+ status: dto.status
40573
+ };
40574
+ }
40575
+ }
40576
+ function CalculationFromApiToFront(dto) {
40577
+ return {
40578
+ function: dto.function,
40579
+ inputs: dto.inputs.map((item0) => CalculationInputFromApiToFront(item0)),
40580
+ name: dto.name,
40581
+ outputs: dto.outputs.map((item0) => CalculationOutputFromApiToFront(item0))
40582
+ };
40583
+ }
40584
+ function CalculationFromFrontToApi(model) {
40585
+ return {
40586
+ function: model.function,
40587
+ inputs: model.inputs.map((item0) => CalculationInputFromFrontToApi(item0)),
40588
+ name: model.name,
40589
+ outputs: model.outputs.map((item0) => CalculationOutputFromFrontToApi(item0))
40590
+ };
40591
+ }
40592
+ function CalculationInputFromApiToFront(dto) {
40593
+ return {
40594
+ integerRange: dto.integer_range == null ? dto.integer_range : IntegerRangeFromApiToFront(dto.integer_range),
40595
+ kind: dto.kind,
40596
+ name: dto.name
40597
+ };
40598
+ }
40599
+ function CalculationInputFromFrontToApi(model) {
40600
+ return {
40601
+ integer_range: model.integerRange == null ? model.integerRange : IntegerRangeFromFrontToApi(model.integerRange),
40602
+ kind: model.kind,
40603
+ name: model.name
40604
+ };
40605
+ }
40606
+ function CalculationOutputFromApiToFront(dto) {
40607
+ return {
40608
+ formula: dto.formula == null ? dto.formula : FormulaFromApiToFront(dto.formula),
40609
+ indices: dto.indices,
40610
+ kind: dto.kind,
40611
+ name: dto.name
40612
+ };
40613
+ }
40614
+ function CalculationOutputFromFrontToApi(model) {
40615
+ return {
40616
+ formula: model.formula == null ? model.formula : FormulaFromFrontToApi(model.formula),
40617
+ indices: model.indices,
40618
+ kind: model.kind,
40619
+ name: model.name
40620
+ };
40621
+ }
40622
+ function FormulaFromApiToFront(dto) {
40623
+ switch (dto.node) {
40624
+ case "input":
40625
+ return { name: dto.name, node: dto.node };
40626
+ case "number":
40627
+ return { node: dto.node, value: dto.value };
40628
+ case "arithmetic":
40629
+ return {
40630
+ left: FormulaFromApiToFront(dto.left),
40631
+ node: dto.node,
40632
+ operator: dto.operator,
40633
+ right: FormulaFromApiToFront(dto.right)
40634
+ };
40635
+ }
40636
+ }
40637
+ function FormulaFromFrontToApi(model) {
40638
+ switch (model.node) {
40639
+ case "input":
40640
+ return { name: model.name, node: model.node };
40641
+ case "number":
40642
+ return { node: model.node, value: model.value };
40643
+ case "arithmetic":
40644
+ return {
40645
+ left: FormulaFromFrontToApi(model.left),
40646
+ node: model.node,
40647
+ operator: model.operator,
40648
+ right: FormulaFromFrontToApi(model.right)
40649
+ };
40650
+ }
40651
+ }
40652
+ function IntegerRangeFromApiToFront(dto) {
40653
+ return {
40654
+ max: dto.max,
40655
+ min: dto.min
40656
+ };
40657
+ }
40658
+ function IntegerRangeFromFrontToApi(model) {
40659
+ return {
40660
+ max: model.max,
40661
+ min: model.min
40662
+ };
40663
+ }
40664
+ function FrameWriteDraftResponseFromApiToFront(dto) {
40665
+ switch (dto.status) {
40666
+ case "needs_clarification":
40667
+ return {
40668
+ questions: dto.questions.map(
40669
+ (item0) => RuleDraftClarificationQuestionDtoFromApiToFront(item0)
40670
+ ),
40671
+ status: dto.status
40672
+ };
40673
+ case "complete":
40674
+ return {
40675
+ definition: definitionFromApi(dto.definition),
40676
+ draft: FrameWriteDraftFromApiToFront(dto.draft),
40677
+ status: dto.status
40678
+ };
40679
+ }
40680
+ }
40681
+ function FrameWriteDraftFromApiToFront(dto) {
40682
+ return {
40683
+ fields: dto.fields.map((item0) => item0),
40684
+ name: dto.name,
40685
+ operation: dto.operation,
40686
+ sort: dto.sort
40687
+ };
40688
+ }
40689
+ function FrameConsultantRevisionFromApiToFront(dto) {
40690
+ return {
40691
+ added: dto.added,
40692
+ frameId: dto.frame_id,
40693
+ moved: dto.moved,
40694
+ name: dto.name,
40695
+ version: dto.version
40696
+ };
40697
+ }
40698
+ function FrameConsultantPlacementFromFrontToApi(model) {
40699
+ return {
40700
+ move_existing: model.moveExisting,
40701
+ section: model.section
40702
+ };
40703
+ }
40704
+ function RestoreFramePageResponseFromApiToFront(dto) {
40705
+ return {
40706
+ frameId: dto.frame_id,
40707
+ name: dto.name,
40708
+ restoredFrom: dto.restored_from,
40709
+ version: dto.version
40710
+ };
40711
+ }
40712
+ function UIFrameTableSourcesFromApiToFront(dto) {
40713
+ return {
40714
+ sources: dto.sources.map((item0) => UIFrameTableSourceFromApiToFront(item0)),
40715
+ total: dto.total
40716
+ };
40717
+ }
40718
+ function UIFrameTableSourceFromApiToFront(dto) {
40719
+ return {
40720
+ columns: dto.columns.map((item0) => item0),
40721
+ sort: dto.sort
40722
+ };
40723
+ }
40724
+ function AddFrameConsultantFromFrontToApi(model) {
40725
+ return {
40726
+ authoring: model.authoring == null ? model.authoring : FrameAuthoringOriginFromFrontToApi(model.authoring),
40727
+ expected_version: model.expectedVersion,
40728
+ frame_id: model.frameId,
40729
+ placement: model.placement == null ? model.placement : FrameConsultantPlacementFromFrontToApi(model.placement)
40730
+ };
40731
+ }
40732
+ function FrameAuthoringOriginFromFrontToApi(model) {
40733
+ return {
40734
+ conversation_id: model.conversationId,
40735
+ turn_id: model.turnId
40736
+ };
40737
+ }
40738
+ function FrameCalculationDraftRequestFromFrontToApi(model) {
40739
+ return {
40740
+ answers: model.answers,
40741
+ current_draft: model.currentDraft == null ? model.currentDraft : CalculationFromFrontToApi(model.currentDraft),
40742
+ description: model.description,
40743
+ frame_id: model.frameId
40744
+ };
40745
+ }
40746
+ function FrameWriteDraftRequestFromFrontToApi(model) {
40747
+ return {
40748
+ answers: model.answers,
40749
+ description: model.description,
40750
+ frame_id: model.frameId
40751
+ };
40752
+ }
40753
+ function RestoreFramePageRequestFromFrontToApi(model) {
40754
+ return {
40755
+ expected_latest_version: model.expectedLatestVersion,
40756
+ frame_id: model.frameId,
40757
+ version: model.version
40758
+ };
40759
+ }
40760
+ function RunAppCalculationRequestFromFrontToApi(model) {
40761
+ return {
40762
+ params: model.params,
40763
+ version: model.version
40764
+ };
40765
+ }
40766
+
40222
40767
  // src/resources/app-actions.ts
40223
40768
  var AppActionsClient = class {
40224
40769
  /** @internal */
@@ -40262,6 +40807,88 @@ var AppActionsClient = class {
40262
40807
  );
40263
40808
  return decodeResponse(response, applyFromApi);
40264
40809
  }
40810
+ /**
40811
+ * Draft a calculation for a Frame the caller may edit. Saving uses the ordinary action writer and
40812
+ * repeats its current scope and definition checks.
40813
+ *
40814
+ * @param request - The request (`FrameCalculationDraftRequest`), camelCase; sent snake_case.
40815
+ * @param requestOptions - Per-call cancellation, timeout and request options.
40816
+ * @returns The engine's answer as `FrameCalculationDraftResponse`, camelCase.
40817
+ * @throws {ApiError} 403: Frame edit access required
40818
+ * @throws {ApiError} 404: Frame unavailable
40819
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
40820
+ * @throws {ApiError} 422: Invalid calculation or draft
40821
+ * @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
40822
+ * @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
40823
+ *
40824
+ * @remarks Uses POST `/api/v1/app-actions/calculations/draft`.
40825
+ *
40826
+ * @example
40827
+ * ```typescript
40828
+ * const draft = await client.appActions.draftCalculation(request);
40829
+ * ```
40830
+ */
40831
+ async draftCalculation(request, requestOptions) {
40832
+ const response = await this.api.draftFrameCalculation(
40833
+ FrameCalculationDraftRequestFromFrontToApi(request),
40834
+ toRequestParams(requestOptions)
40835
+ );
40836
+ return decodeResponse(response, FrameCalculationDraftResponseFromApiToFront);
40837
+ }
40838
+ /**
40839
+ * draftWrite
40840
+ *
40841
+ * @param request - The request (`FrameWriteDraftRequest`), camelCase; sent snake_case.
40842
+ * @param requestOptions - Per-call cancellation, timeout and request options.
40843
+ * @returns The engine's answer as `FrameWriteDraftResponse`, camelCase.
40844
+ * @throws {ApiError} 404: Frame unavailable
40845
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
40846
+ * @throws {ApiError} 422: The draft cannot be expressed with the available tables and fields
40847
+ * @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
40848
+ * @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
40849
+ *
40850
+ * @remarks Uses POST `/api/v1/app-actions/writes/draft`.
40851
+ *
40852
+ * @example
40853
+ * ```typescript
40854
+ * const draft = await client.appActions.draftWrite(request);
40855
+ * ```
40856
+ */
40857
+ async draftWrite(request, requestOptions) {
40858
+ const response = await this.api.draftFrameWrite(
40859
+ FrameWriteDraftRequestFromFrontToApi(request),
40860
+ toRequestParams(requestOptions)
40861
+ );
40862
+ return decodeResponse(response, FrameWriteDraftResponseFromApiToFront);
40863
+ }
40864
+ /**
40865
+ * Calculate with the same Frame and term visibility as the action editor.
40866
+ *
40867
+ * @param id - The calculation action.
40868
+ * @param request - The request (`RunAppCalculationRequest`), camelCase; sent snake_case.
40869
+ * @param requestOptions - Per-call cancellation, timeout and request options.
40870
+ * @returns The engine's answer as `ApplyAppActionResult`, camelCase.
40871
+ * @throws {ApiError} 403: The action is not a read-only Frame calculation
40872
+ * @throws {ApiError} 404: No Frame or calculation the caller can read
40873
+ * @throws {ApiError} 409: The calculation changed or cannot run
40874
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
40875
+ * @throws {ApiError} 422: One or more input values are invalid
40876
+ *
40877
+ * @remarks Uses POST `/api/v1/app-actions/{id}/calculate`.
40878
+ *
40879
+ * @example
40880
+ * ```typescript
40881
+ * const result = await client.appActions.calculate(actionId, { version: 2 });
40882
+ * ```
40883
+ */
40884
+ async calculate(id, request, requestOptions) {
40885
+ const response = await this.api.runAppCalculation(
40886
+ id,
40887
+ RunAppCalculationRequestFromFrontToApi(request),
40888
+ toRequestParams(requestOptions)
40889
+ );
40890
+ return decodeResponse(response, applyFromApi);
40891
+ }
40265
40892
  };
40266
40893
 
40267
40894
  // src/api-spec/generated/ActionReviews.ts
@@ -41461,7 +42088,7 @@ var Reasoning = class {
41461
42088
  ...params
41462
42089
  });
41463
42090
  /**
41464
- * @description POST /api/v1/reasoning/entailment Answers `facts ⊨ antecedent ⇒ consequent`, hierarchy-aware and graded. A clause holds in the fact base to the degree that some fact *witnesses* it — that is, to the degree the clause subsumes a fact — so a `sparrow` fact establishes the clause `animal` without an `animal` fact being supplied. The consequent is additionally established when it subsumes the antecedent it would follow from. See [`osfkb_domain::operations::homoiconic_entailment`] for the full semantics. `entails` is the crisp reading of `degree`; `degree`, `antecedent_degree` and `consequent_degree` are computed from the sort lattice (crisply, and through explicit fuzzy `⊑·` relations and approved sort similarity), never cast from the boolean.
42091
+ * @description POST /api/v1/reasoning/entailment Answers `facts ⊨ antecedent ⇒ consequent`, hierarchy-aware and graded. A clause holds in the fact base to the degree that some fact *witnesses* it — that is, to the degree the clause subsumes a fact — so a `sparrow` fact establishes the clause `animal` without an `animal` fact being supplied. The consequent is additionally established when it subsumes the antecedent it would follow from. `entails` is the crisp reading of `degree`; `degree`, `antecedent_degree` and `consequent_degree` are computed from the sort lattice (crisply, and through explicit fuzzy `⊑·` relations and approved sort similarity), never cast from the boolean.
41465
42092
  *
41466
42093
  * @tags reasoning
41467
42094
  * @name Entailment
@@ -44998,7 +45625,7 @@ var Osfql = class {
44998
45625
  ...params
44999
45626
  });
45000
45627
  /**
45001
- * @description Parses, compiles, and executes an OSFQL program against the caller's tenant-isolated knowledge base. Supports all OSFQL statement types: MATCH, INSERT, RETRACT, DERIVE, UNIFY, AWAIT, COUNTERFACTUAL, CAUSES. # Examples ```json { "query": "INSERT person(name: \"Alice\", age: 30);" } ``` ```json { "query": "MATCH person(name: ?N, age: ?A) WHERE ?A > 18;" } ```
45628
+ * @description Executes an RLQL program against the caller's tenant-isolated knowledge base. Supported statements include MATCH, INSERT, RETRACT, DERIVE, UNIFY, AWAIT, COUNTERFACTUAL and CAUSES. `SEARCH WEB` and `READ PAGE` use the Space's `web_search` setting and check its outbound policy against the call's data class. The relay reads permitted pages and the engine stores each as a `web_page` owned by the caller. Ordinary statements between two web operations form one atomic program. A diagnostic reports the term IDs each operation bound (`effect_bound`) or its refusal code. A refused operation binds no terms. # Examples ```json { "query": "INSERT person(name: \"Alice\", age: 30);" } ``` ```json { "query": "MATCH person(name: ?N, age: ?A) WHERE ?A > 18;" } ```
45002
45629
  *
45003
45630
  * @tags osfql
45004
45631
  * @name ExecuteOsfql
@@ -45387,6 +46014,150 @@ var Ui = class {
45387
46014
  });
45388
46015
  };
45389
46016
 
46017
+ // src/api-spec/generated/Skills.ts
46018
+ var Skills = class {
46019
+ http;
46020
+ constructor(http) {
46021
+ this.http = http;
46022
+ }
46023
+ /**
46024
+ * @description POST /api/v1/skills/draft-edit
46025
+ *
46026
+ * @tags skills
46027
+ * @name DraftSkillEdit
46028
+ * @summary Propose an edited SKILL.md for a requested change.
46029
+ * @request POST:/api/v1/skills/draft-edit
46030
+ * @secure
46031
+ */
46032
+ draftSkillEdit = (data, params = {}) => this.http.request({
46033
+ path: `/api/v1/skills/draft-edit`,
46034
+ method: "POST",
46035
+ body: data,
46036
+ secure: true,
46037
+ type: "application/json",
46038
+ format: "json",
46039
+ ...params
46040
+ });
46041
+ };
46042
+
46043
+ // src/api-spec/generated/Text.ts
46044
+ var Text = class {
46045
+ http;
46046
+ constructor(http) {
46047
+ this.http = http;
46048
+ }
46049
+ /**
46050
+ * @description POST /api/v1/text/proofread
46051
+ *
46052
+ * @tags text
46053
+ * @name ProofreadText
46054
+ * @summary Proofread a text: spelling, agreement and grammar only.
46055
+ * @request POST:/api/v1/text/proofread
46056
+ * @secure
46057
+ */
46058
+ proofreadText = (data, params = {}) => this.http.request({
46059
+ path: `/api/v1/text/proofread`,
46060
+ method: "POST",
46061
+ body: data,
46062
+ secure: true,
46063
+ type: "application/json",
46064
+ format: "json",
46065
+ ...params
46066
+ });
46067
+ /**
46068
+ * @description POST /api/v1/text/rewrite
46069
+ *
46070
+ * @tags text
46071
+ * @name RewriteText
46072
+ * @summary Rewrite a passage in a tone, optionally following a template.
46073
+ * @request POST:/api/v1/text/rewrite
46074
+ * @secure
46075
+ */
46076
+ rewriteText = (data, params = {}) => this.http.request({
46077
+ path: `/api/v1/text/rewrite`,
46078
+ method: "POST",
46079
+ body: data,
46080
+ secure: true,
46081
+ type: "application/json",
46082
+ format: "json",
46083
+ ...params
46084
+ });
46085
+ };
46086
+
46087
+ // src/api-spec/generated/Agent.ts
46088
+ var Agent = class {
46089
+ http;
46090
+ constructor(http) {
46091
+ this.http = http;
46092
+ }
46093
+ /**
46094
+ * @description Returns 400 for an empty task, 503 `llm_unconfigured` when no text model is configured, 502 `llm_provider_failed` when it fails, and 422 when the model does not return a parseable step. Visual grounding is best-effort: a missing screenshot or an unconfigured vision port simply falls back to the text-only DOM tree.
46095
+ *
46096
+ * @tags agent
46097
+ * @name AgentBrowserStep
46098
+ * @summary Decide the next browser action(s) for the current page state.
46099
+ * @request POST:/api/v1/agent/browser-step
46100
+ * @secure
46101
+ */
46102
+ agentBrowserStep = (data, params = {}) => this.http.request({
46103
+ path: `/api/v1/agent/browser-step`,
46104
+ method: "POST",
46105
+ body: data,
46106
+ secure: true,
46107
+ type: "application/json",
46108
+ format: "json",
46109
+ ...params
46110
+ });
46111
+ /**
46112
+ * No description
46113
+ *
46114
+ * @tags agent
46115
+ * @name BrowserAgentRun
46116
+ * @request POST:/api/v1/agent/browser-runs/{run_id}
46117
+ * @secure
46118
+ */
46119
+ browserAgentRun = (runId, data, params = {}) => this.http.request({
46120
+ path: `/api/v1/agent/browser-runs/${runId}`,
46121
+ method: "POST",
46122
+ body: data,
46123
+ secure: true,
46124
+ type: "application/json",
46125
+ format: "json",
46126
+ ...params
46127
+ });
46128
+ /**
46129
+ * No description
46130
+ *
46131
+ * @tags agent
46132
+ * @name ListBrowserAgentRuns
46133
+ * @request GET:/api/v1/agent/browser-runs
46134
+ * @secure
46135
+ */
46136
+ listBrowserAgentRuns = (params = {}) => this.http.request({
46137
+ path: `/api/v1/agent/browser-runs`,
46138
+ method: "GET",
46139
+ secure: true,
46140
+ format: "json",
46141
+ ...params
46142
+ });
46143
+ /**
46144
+ * @description Deterministic and side-effect free: the caller declares the plan and what each tool returns, and the run happens in a scratch term store. The tenant's knowledge base is read (for its sort lattice) but never written.
46145
+ *
46146
+ * @tags agent
46147
+ * @name RunAgentLoop
46148
+ * @summary `POST /api/v1/agent/loop/run` — plan → verify → dispatch → certify against the tenant's declared sort lattice.
46149
+ * @request POST:/api/v1/agent/loop/run
46150
+ */
46151
+ runAgentLoop = (data, params = {}) => this.http.request({
46152
+ path: `/api/v1/agent/loop/run`,
46153
+ method: "POST",
46154
+ body: data,
46155
+ type: "application/json",
46156
+ format: "json",
46157
+ ...params
46158
+ });
46159
+ };
46160
+
45390
46161
  // src/api-spec/generated/Compliance.ts
45391
46162
  var Compliance = class {
45392
46163
  http;
@@ -45967,7 +46738,7 @@ var Snapshots = class {
45967
46738
  ...params
45968
46739
  });
45969
46740
  /**
45970
- * @description Accepts a reasoninglayer-snapshot JSON envelope (or one an earlier release exported as osfkb-snapshot), validates the structure, and stores it as a new snapshot. Use ?name=override to rename. Reserved to the gateway's provisioning identity (an authorization context with `reservedExempt`): any other caller is refused with `403 provisioning_identity_required`.
46741
+ * @description Accepts a reasoninglayer-snapshot JSON envelope (including envelopes exported by earlier releases), validates the structure, and stores it as a new snapshot. Use ?name=override to rename. Reserved to the gateway's provisioning identity (an authorization context with `reservedExempt`): any other caller is refused with `403 provisioning_identity_required`.
45971
46742
  *
45972
46743
  * @tags snapshots
45973
46744
  * @name ImportSnapshot
@@ -46299,7 +47070,7 @@ var Operations = class {
46299
47070
  this.http = http;
46300
47071
  }
46301
47072
  /**
46302
- * @description `POST /api/v1/operations/anti-unify` Accepts two Ψ-term ids and returns the LGG term computed by the engine's [`AntiUnificationEngine`](osfkb_domain::operations::ilp::AntiUnificationEngine). The LGG is persisted in the tenant's term store; the response carries both its id and an enriched view (sort name + display name + referenced-term summaries).
47073
+ * @description `POST /api/v1/operations/anti-unify` Accepts two Ψ-term ids and returns the LGG term computed by the engine. The LGG is persisted in the tenant's term store; the response carries both its id and an enriched view (sort name + display name + referenced-term summaries).
46303
47074
  *
46304
47075
  * @tags operations
46305
47076
  * @name AntiUnify
@@ -46851,7 +47622,7 @@ var Demo = class {
46851
47622
  this.http = http;
46852
47623
  }
46853
47624
  /**
46854
- * @description Returns `404` when the SUMO files cannot be read at the configured or supplied directory, `400` when the assembled source fails to import, and `200` with the tenant's sort count + form count on success.
47625
+ * @description The seed is a client write of the request's caller, judged as `POST /api/v1/ingest/kif` with `persist: true` judges its import (#1227): it is reachable on every deployment, under the caller's own authority, not an engine seeding path. Returns `404 demo_corpus_unavailable` when the deployment's SUMO files cannot be read (the answer names no server path; the engine log does, #1229), `400` when the assembled source fails to import, the coded refusal of the one write-denial mapping when a term the seed writes is refused, and `200` with the tenant's sort count + form count on success.
46855
47626
  *
46856
47627
  * @tags demo
46857
47628
  * @name DemoSeed
@@ -47697,6 +48468,22 @@ var Boundary = class {
47697
48468
  format: "json",
47698
48469
  ...params
47699
48470
  });
48471
+ /**
48472
+ * No description
48473
+ *
48474
+ * @tags boundary
48475
+ * @name PostDecide
48476
+ * @summary `POST /api/v1/boundary/decide` — may this outbound call leave the box.
48477
+ * @request POST:/api/v1/boundary/decide
48478
+ */
48479
+ postDecide = (data, params = {}) => this.http.request({
48480
+ path: `/api/v1/boundary/decide`,
48481
+ method: "POST",
48482
+ body: data,
48483
+ type: "application/json",
48484
+ format: "json",
48485
+ ...params
48486
+ });
47700
48487
  /**
47701
48488
  * No description
47702
48489
  *
@@ -49285,6 +50072,24 @@ var Documents = class {
49285
50072
  type: "application/json",
49286
50073
  ...params
49287
50074
  });
50075
+ /**
50076
+ * @description One search over what the box holds: OSFQL hybrid search (meaning and exact words) over document passages, grouped by kind (documents, mails, conversations, meetings, synced files), and over the record sorts the request names. Rights are the caller's read view; a parent document is shown only when the caller may read it. Scores compare only inside a group. Lists items and states nothing; it is not the answer door.
50077
+ *
50078
+ * @tags documents
50079
+ * @name Find
50080
+ * @summary Find what the caller may open, grouped by kind
50081
+ * @request POST:/api/v1/find
50082
+ * @secure
50083
+ */
50084
+ find = (data, params = {}) => this.http.request({
50085
+ path: `/api/v1/find`,
50086
+ method: "POST",
50087
+ body: data,
50088
+ secure: true,
50089
+ type: "application/json",
50090
+ format: "json",
50091
+ ...params
50092
+ });
49288
50093
  /**
49289
50094
  * No description
49290
50095
  *
@@ -49390,7 +50195,7 @@ var Proof = class {
49390
50195
  this.http = http;
49391
50196
  }
49392
50197
  /**
49393
- * @description Runs the native CDCL solver with DRAT logging; on UNSAT the DRAT trace is turned into a resolution [`ProofCertificate`](osfkb_domain::operations::certified_proofs::store::ProofCertificate) and rendered in the requested format. No tenant context is required — the solver is stateless and in-process.
50198
+ * @description Runs the native CDCL solver with DRAT logging; on UNSAT the DRAT trace is turned into a resolution proof certificate and rendered in the requested format. No tenant context is required — the solver is stateless and in-process.
49394
50199
  *
49395
50200
  * @tags proof
49396
50201
  * @name ExportProof
@@ -49911,6 +50716,24 @@ var DocumentCheck = class {
49911
50716
  format: "json",
49912
50717
  ...params
49913
50718
  });
50719
+ /**
50720
+ * No description
50721
+ *
50722
+ * @tags document-check
50723
+ * @name DraftClausePolicy
50724
+ * @summary Compile an interpretation of an existing document clause without writing any facts or rules. The reviewer can use normal RLQL authorization to publish.
50725
+ * @request POST:/api/v1/documents/{document_id}/clauses/{clause_id}/policy-draft
50726
+ * @secure
50727
+ */
50728
+ draftClausePolicy = (documentId, clauseId, data, params = {}) => this.http.request({
50729
+ path: `/api/v1/documents/${documentId}/clauses/${clauseId}/policy-draft`,
50730
+ method: "POST",
50731
+ body: data,
50732
+ secure: true,
50733
+ type: "application/json",
50734
+ format: "json",
50735
+ ...params
50736
+ });
49914
50737
  };
49915
50738
 
49916
50739
  // src/api-spec/generated/Corpus.ts
@@ -50956,7 +51779,7 @@ var Research = class {
50956
51779
  this.http = http;
50957
51780
  }
50958
51781
  /**
50959
- * No description
51782
+ * @description The session's knowledge base is not written into the caller's tenant: it has a tenant of its own, named in the answer as `knowledge_base_tenant_id` (#1201). Every run, completion and session-scoped ingest writes there. That tenant comes into being with the first such write and is not removed when the session is deleted; a client that reaps the tenants it made reaps it too.
50960
51783
  *
50961
51784
  * @tags research
50962
51785
  * @name ResearchCreateSession
@@ -50974,7 +51797,7 @@ var Research = class {
50974
51797
  ...params
50975
51798
  });
50976
51799
  /**
50977
- * No description
51800
+ * @description Deletes the session record only. The session's knowledge base tenant (`knowledge_base_tenant_id`) and the corpus in it stay; deleting a tenant is the provisioning identity's act (#1201).
50978
51801
  *
50979
51802
  * @tags research
50980
51803
  * @name ResearchDeleteSession
@@ -51069,7 +51892,7 @@ var Research = class {
51069
51892
  ...params
51070
51893
  });
51071
51894
  /**
51072
- * @description With a `session_id`, a successful ingest is RECORDED on that session — see [`record_ingest_on_session`] — so the paper appears in `GET /sessions/{id}`'s `papers` and every term the ingestion touched resolves back to it. Without one, the paper is ingested under the configured owner and nothing is recorded: there is no session to attribute it to, and picking one would be a guess. The markdown itself is `paper_to_markdown`'s — the same function a cycle ingests through — over the same `fetch_full_text` lane, gated on the same `full_text_ingestion` switch. A paper ingested by hand is therefore the same document in the KB as one the pipeline found, which is the only way the two can be reasoned over together. **Which knowledge base it lands in follows the session.** With a `session_id` the paper is ingested through that session's own client (the `SessionScope` tenanted by the session id) — the KB `/run` and `/complete` drive and the one the session's own discovery reads. Without a `session_id` there is no session tenant to adopt and the configured one stands: the paper is ingested for the deployment, not for any session, and nothing is recorded either. This route used to ingest into the configured tenant unconditionally. The recorded `PaperTermLink` then named term ids in a KB the session never searches, so it resolved nothing — attribution that exists on the session row and nowhere the reasoning can reach.
51895
+ * @description With a `session_id`, a successful ingest is RECORDED on that session — see [`record_ingest_on_session`] — so the paper appears in `GET /sessions/{id}`'s `papers` and every term the ingestion touched resolves back to it. Without one, the paper is ingested into the caller's own tenant (`X-Tenant-Id`) and nothing is recorded: there is no session to attribute it to, and picking one would be a guess. The markdown itself is `paper_to_markdown`'s — the same function a cycle ingests through — over the same `fetch_full_text` lane, gated on the same `full_text_ingestion` switch. A paper ingested by hand is therefore the same document in the KB as one the pipeline found, which is the only way the two can be reasoned over together. **Which knowledge base it lands in follows the session.** With a `session_id` the paper is ingested through that session's own client (the `SessionScope` tenanted by the session id) — the KB `/run` and `/complete` drive and the one the session's own discovery reads. Without a `session_id` the paper is ingested into the caller's own tenant (`X-Tenant-Id`), not for any session, and nothing is recorded either (#1202). It is never written into the deployment's configured tenant, which every caller would share. This route used to ingest into the configured tenant unconditionally. The recorded `PaperTermLink` then named term ids in a KB the session never searches, so it resolved nothing — attribution that exists on the session row and nowhere the reasoning can reach.
51073
51896
  *
51074
51897
  * @tags research
51075
51898
  * @name ResearchIngestPaper
@@ -51169,7 +51992,7 @@ var Research = class {
51169
51992
  ...params
51170
51993
  });
51171
51994
  /**
51172
- * No description
51995
+ * @description With a `session_id` the claim is looked up and assessed in that session's own knowledge base tenant; without one, in the caller's own tenant (`X-Tenant-Id`), never in the deployment's configured tenant, which every caller would share (#1202).
51173
51996
  *
51174
51997
  * @tags research
51175
51998
  * @name ResearchVerifyClaim
@@ -55456,6 +56279,167 @@ function toTermInputDto(input) {
55456
56279
  return byName;
55457
56280
  }
55458
56281
 
56282
+ // src/normalizers/live-docs.ts
56283
+ function LiveDocStateResponseFromApiToFront(dto) {
56284
+ return {
56285
+ state: dto.state,
56286
+ stateVector: dto.state_vector,
56287
+ throughSeq: dto.through_seq
56288
+ };
56289
+ }
56290
+ function LiveDocAnchorsResponseFromApiToFront(dto) {
56291
+ return {
56292
+ passages: dto.passages.map((item0) => LiveDocPassageDtoFromApiToFront(item0)),
56293
+ throughSeq: dto.through_seq
56294
+ };
56295
+ }
56296
+ function LiveDocAnchorDtoFromFrontToApi(model) {
56297
+ return {
56298
+ end: model.end,
56299
+ start: model.start
56300
+ };
56301
+ }
56302
+ function LiveDocPassageDtoFromApiToFront(dto) {
56303
+ switch (dto.state) {
56304
+ case "attached":
56305
+ return { state: dto.state, text: dto.text, truncated: dto.truncated };
56306
+ case "removed":
56307
+ return { state: dto.state };
56308
+ case "unknown":
56309
+ return { state: dto.state };
56310
+ }
56311
+ }
56312
+ function FrameCommentCapabilitiesFromApiToFront(dto) {
56313
+ return {
56314
+ canPost: dto.can_post,
56315
+ page: dto.page
56316
+ };
56317
+ }
56318
+ function FrameCommentReceiptFromApiToFront(dto) {
56319
+ return {
56320
+ id: dto.id
56321
+ };
56322
+ }
56323
+ function LiveDocDiffResponseFromApiToFront(dto) {
56324
+ return {
56325
+ stateVector: dto.state_vector,
56326
+ throughSeq: dto.through_seq,
56327
+ update: dto.update
56328
+ };
56329
+ }
56330
+ function LiveDocUpdatesResponseFromApiToFront(dto) {
56331
+ return {
56332
+ updates: dto.updates.map((item0) => LiveDocUpdateDtoFromApiToFront(item0))
56333
+ };
56334
+ }
56335
+ function LiveDocUpdateDtoFromApiToFront(dto) {
56336
+ return {
56337
+ author: LiveDocAuthorDtoFromApiToFront(dto.author),
56338
+ seq: dto.seq,
56339
+ update: dto.update
56340
+ };
56341
+ }
56342
+ function LiveDocAuthorDtoFromApiToFront(dto) {
56343
+ return {
56344
+ agent: dto.agent,
56345
+ onBehalfOf: dto.on_behalf_of,
56346
+ person: dto.person
56347
+ };
56348
+ }
56349
+ function LiveDocSeqResponseFromApiToFront(dto) {
56350
+ return {
56351
+ seq: dto.seq
56352
+ };
56353
+ }
56354
+ function LiveDocVersionsResponseFromApiToFront(dto) {
56355
+ return {
56356
+ versions: dto.versions.map((item0) => LiveDocVersionDtoFromApiToFront(item0))
56357
+ };
56358
+ }
56359
+ function LiveDocVersionDtoFromApiToFront(dto) {
56360
+ return {
56361
+ author: LiveDocAuthorDtoFromApiToFront(dto.author),
56362
+ generation: dto.generation,
56363
+ reason: LiveDocVersionReasonDtoFromApiToFront(dto.reason),
56364
+ takenAt: dto.taken_at,
56365
+ throughSeq: dto.through_seq
56366
+ };
56367
+ }
56368
+ function LiveDocVersionReasonDtoFromApiToFront(dto) {
56369
+ switch (dto.kind) {
56370
+ case "named":
56371
+ return { kind: dto.kind, name: dto.name };
56372
+ case "before_restore":
56373
+ return { kind: dto.kind, restored: dto.restored };
56374
+ case "before_agent_edit":
56375
+ return { kind: dto.kind };
56376
+ }
56377
+ }
56378
+ function TermSnapshotsResponseFromApiToFront(dto) {
56379
+ return {
56380
+ snapshots: dto.snapshots.map((item0) => TermSnapshotSummaryFromApiToFront(item0)),
56381
+ termId: dto.term_id
56382
+ };
56383
+ }
56384
+ function TermSnapshotSummaryFromApiToFront(dto) {
56385
+ return {
56386
+ description: dto.description,
56387
+ id: dto.id,
56388
+ savedAt: dto.saved_at
56389
+ };
56390
+ }
56391
+ function TermSnapshotPreviewFromApiToFront(dto) {
56392
+ return {
56393
+ diff: VersionDiffDtoFromApiToFront(dto.diff),
56394
+ recordEtag: dto.record_etag,
56395
+ snapshotEtag: dto.snapshot_etag,
56396
+ snapshotId: dto.snapshot_id,
56397
+ termId: dto.term_id
56398
+ };
56399
+ }
56400
+ function RestoreTermSnapshotResponseFromApiToFront(dto) {
56401
+ return {
56402
+ snapshotId: dto.snapshot_id,
56403
+ termId: dto.term_id,
56404
+ version: dto.version
56405
+ };
56406
+ }
56407
+ function LiveDocAnchorsRequestFromFrontToApi(model) {
56408
+ return {
56409
+ anchors: model.anchors.map((item0) => LiveDocAnchorDtoFromFrontToApi(item0))
56410
+ };
56411
+ }
56412
+ function LiveDocApplyRequestFromFrontToApi(model) {
56413
+ return {
56414
+ update: model.update
56415
+ };
56416
+ }
56417
+ function LiveDocDiffRequestFromFrontToApi(model) {
56418
+ return {
56419
+ state_vector: model.stateVector
56420
+ };
56421
+ }
56422
+ function LiveDocNameVersionRequestFromFrontToApi(model) {
56423
+ return {
56424
+ name: model.name
56425
+ };
56426
+ }
56427
+ function NewFrameCommentFromFrontToApi(model) {
56428
+ return {
56429
+ anchor: model.anchor == null ? model.anchor : LiveDocAnchorDtoFromFrontToApi(model.anchor),
56430
+ body: model.body,
56431
+ id: model.id,
56432
+ page: model.page,
56433
+ parent: model.parent
56434
+ };
56435
+ }
56436
+ function RestoreTermSnapshotRequestFromFrontToApi(model) {
56437
+ return {
56438
+ snapshot_etag: model.snapshotEtag,
56439
+ snapshot_id: model.snapshotId
56440
+ };
56441
+ }
56442
+
55459
56443
  // src/resources/terms.ts
55460
56444
  var TermsClient = class {
55461
56445
  /** @internal */
@@ -55559,6 +56543,11 @@ var TermsClient = class {
55559
56543
  * take as `ifMatch` from the rule routes ({@link AddRuleResponse.etag},
55560
56544
  * {@link RuleEntryDto.etag}).
55561
56545
  *
56546
+ * The term is the caller's view of it (reasoninglayer#1221): a feature
56547
+ * that holds a term the caller's Read grant does not show is left out, and
56548
+ * `etag` is the tag of that view. Send it back as `ifMatch`; a `412` names
56549
+ * the current tag of the caller's view.
56550
+ *
55562
56551
  * @example
55563
56552
  * ```typescript
55564
56553
  * const asIssued = await client.terms.getTerm(orderId, { asOf: invoicedAt });
@@ -55720,7 +56709,7 @@ var TermsClient = class {
55720
56709
  * @throws {@link PreconditionFailedError} 412 when `ifMatch` is stale;
55721
56710
  * `currentEtag` carries the tag the engine holds now.
55722
56711
  * @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
55723
- * and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
56712
+ * and the deployment requires conditional writes.
55724
56713
  * @throws {@link ApiError} 404 when the term does not exist; 422 when the
55725
56714
  * patched term violates its sort's declarations (a scalar literal in a
55726
56715
  * feature whose declared range is an entity sort included); 409 when a bound
@@ -55747,7 +56736,7 @@ var TermsClient = class {
55747
56736
  * last-writer-wins, and two editors of one term silently overwrite each
55748
56737
  * other. Read the term with {@link TermsClient.getTerm}, keep its `etag`,
55749
56738
  * and send it back as `ifMatch`: a write that lost the race answers 412
55750
- * instead of overwriting. An engine started with `OSFKB_REQUIRE_IF_MATCH=1`
56739
+ * instead of overwriting. A deployment that requires conditional writes
55751
56740
  * refuses every term and rule mutation that carries no `ifMatch` (428).
55752
56741
  *
55753
56742
  * @example
@@ -55801,7 +56790,7 @@ var TermsClient = class {
55801
56790
  * rule instead; `ruleIds` names it).
55802
56791
  * @throws {@link PreconditionFailedError} 412 when `ifMatch` is stale.
55803
56792
  * @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
55804
- * and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
56793
+ * and the deployment requires conditional writes.
55805
56794
  * @throws {@link ConstraintViolationError} 409 `term_named_by_rules` under
55806
56795
  * every disposition when a rule names the term, or when a cascade's closure
55807
56796
  * reaches a rule term (withdraw the rule first); 409 `term_has_referrers`
@@ -55938,7 +56927,11 @@ var TermsClient = class {
55938
56927
  * "feature":"price","message":"Constraint violation: …"}]}`. With
55939
56928
  * `partial: true` and BOTH rows bad, the same `422`:
55940
56929
  * `"2 of 2 entries were refused; the whole batch was refused and nothing
55941
- * was written"`.
56930
+ * was written"`. A row the write guard refused carries its closed
56931
+ * `code` (`BulkRowRefusal.code`): `reference_term_unknown` for a
56932
+ * reference to a term that does not exist or that the caller's Read
56933
+ * grant does not show (reasoninglayer#1212), or the write denial a
56934
+ * single-term write answers.
55942
56935
  *
55943
56936
  * **`dryRun` runs every check and writes nothing**, and it answers in the
55944
56937
  * same two shapes. A clean dry run is `200` and reports NO `termIds` —
@@ -55981,7 +56974,7 @@ var TermsClient = class {
55981
56974
  features: convertFeatures(t.features)
55982
56975
  }))
55983
56976
  });
55984
- const response = await this.api.bulkAddTerms(wireRequest, toRequestParams(requestOptions));
56977
+ const response = await this.api.bulkAddTerms(wireRequest, toRequestParams(requestOptions)).catch(rethrowBulkRowCodes);
55985
56978
  return decodeResponse(response, BulkAddTermsResponseFromApiToFront);
55986
56979
  }
55987
56980
  /**
@@ -56147,6 +57140,347 @@ var TermsClient = class {
56147
57140
  requestOptions
56148
57141
  );
56149
57142
  }
57143
+ /**
57144
+ * Open a term's live document
57145
+ *
57146
+ * @param termId - The term (UUID) whose live document it is.
57147
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57148
+ * @returns The engine's answer as `LiveDocStateResponse`, camelCase.
57149
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57150
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57151
+ *
57152
+ * @remarks Uses GET `/api/v1/terms/{id}/live`.
57153
+ * The whole state and its state vector. A term never edited live answers an empty document at
57154
+ * `through_seq` 0.
57155
+ *
57156
+ * @example
57157
+ * ```typescript
57158
+ * const { state, throughSeq } = await client.terms.openLiveDoc(termId);
57159
+ * ```
57160
+ */
57161
+ async openLiveDoc(termId, requestOptions) {
57162
+ const response = await this.api.openLiveDoc(termId, toRequestParams(requestOptions));
57163
+ return decodeResponse(response, LiveDocStateResponseFromApiToFront);
57164
+ }
57165
+ /**
57166
+ * Read the passages comment anchors point at
57167
+ *
57168
+ * @param termId - The term (UUID) whose live document it is.
57169
+ * @param request - The request (`LiveDocAnchorsRequest`), camelCase; sent snake_case.
57170
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57171
+ * @returns The engine's answer as `LiveDocAnchorsResponse`, camelCase.
57172
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57173
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57174
+ * @throws {ApiError} 413: A position over 1 KiB
57175
+ * @throws {ApiError} 422: Over 500 anchors, or a position that does not decode
57176
+ *
57177
+ * @remarks Uses POST `/api/v1/terms/{id}/live/anchors`.
57178
+ * Each anchor is resolved against the document as it stands. A reader of the term may call it: it
57179
+ * writes nothing.
57180
+ *
57181
+ * @example
57182
+ * ```typescript
57183
+ * const { passages } = await client.terms.resolveLiveDocAnchors(termId, { anchors: [{ start, end }] });
57184
+ * ```
57185
+ */
57186
+ async resolveLiveDocAnchors(termId, request, requestOptions) {
57187
+ const response = await this.api.resolveLiveDocAnchors(
57188
+ termId,
57189
+ LiveDocAnchorsRequestFromFrontToApi(request),
57190
+ toRequestParams(requestOptions)
57191
+ );
57192
+ return decodeResponse(response, LiveDocAnchorsResponseFromApiToFront);
57193
+ }
57194
+ /**
57195
+ * Check comment support and whether the caller can open a new thread.
57196
+ *
57197
+ * @param termId - The term (UUID) whose live document it is.
57198
+ * @param options - `page`: The saved Frame page the comment would be made on.
57199
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57200
+ * @returns The engine's answer as `FrameCommentCapabilities`, camelCase.
57201
+ * @throws {ApiError} 404: Frame or comments unavailable
57202
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57203
+ *
57204
+ * @remarks Uses GET `/api/v1/terms/{id}/live/comments`.
57205
+ *
57206
+ * @example
57207
+ * ```typescript
57208
+ * const capabilities = await client.terms.getFrameCommentCapabilities(termId, { page: "home" });
57209
+ * ```
57210
+ */
57211
+ async getFrameCommentCapabilities(termId, options = {}, requestOptions) {
57212
+ const response = await this.api.getFrameCommentCapabilities(
57213
+ termId,
57214
+ { page: options.page },
57215
+ toRequestParams(requestOptions)
57216
+ );
57217
+ return decodeResponse(response, FrameCommentCapabilitiesFromApiToFront);
57218
+ }
57219
+ /**
57220
+ * Store a comment after checking access to its Frame, its sort and its parent.
57221
+ *
57222
+ * @param termId - The term (UUID) whose live document it is.
57223
+ * @param request - The request (`NewFrameComment`), camelCase; sent snake_case.
57224
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57225
+ * @returns The engine's answer as `FrameCommentReceipt`, camelCase.
57226
+ * @throws {ApiError} 404: Frame or parent unavailable
57227
+ * @throws {ApiError} 409: Comment ID is occupied or the scope changed
57228
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57229
+ * @throws {ApiError} 422: Invalid comment or selection
57230
+ *
57231
+ * @remarks Uses POST `/api/v1/terms/{id}/live/comments`.
57232
+ *
57233
+ * @example
57234
+ * ```typescript
57235
+ * const receipt = await client.terms.createFrameComment(termId, comment);
57236
+ * ```
57237
+ */
57238
+ async createFrameComment(termId, request, requestOptions) {
57239
+ const response = await this.api.createFrameComment(
57240
+ termId,
57241
+ NewFrameCommentFromFrontToApi(request),
57242
+ toRequestParams(requestOptions)
57243
+ );
57244
+ return decodeResponse(response, FrameCommentReceiptFromApiToFront);
57245
+ }
57246
+ /**
57247
+ * What a client lacks
57248
+ *
57249
+ * @param termId - The term (UUID) whose live document it is.
57250
+ * @param request - The request (`LiveDocDiffRequest`), camelCase; sent snake_case.
57251
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57252
+ * @returns The engine's answer as `LiveDocDiffResponse`, camelCase.
57253
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57254
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57255
+ * @throws {ApiError} 422: Not a Yjs state vector
57256
+ *
57257
+ * @remarks Uses POST `/api/v1/terms/{id}/live/diff`.
57258
+ * One Yjs v1 update bringing the given state vector up to date, and the server's own state vector.
57259
+ *
57260
+ * @example
57261
+ * ```typescript
57262
+ * const diff = await client.terms.diffLiveDoc(termId, { stateVector });
57263
+ * ```
57264
+ */
57265
+ async diffLiveDoc(termId, request, requestOptions) {
57266
+ const response = await this.api.diffLiveDoc(
57267
+ termId,
57268
+ LiveDocDiffRequestFromFrontToApi(request),
57269
+ toRequestParams(requestOptions)
57270
+ );
57271
+ return decodeResponse(response, LiveDocDiffResponseFromApiToFront);
57272
+ }
57273
+ /**
57274
+ * Read a live document's update log
57275
+ *
57276
+ * @param termId - The term (UUID) whose live document it is.
57277
+ * @param options - `after`: Only the updates after this sequence number.
57278
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57279
+ * @returns The engine's answer as `LiveDocUpdatesResponse`, camelCase.
57280
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57281
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57282
+ *
57283
+ * @remarks Uses GET `/api/v1/terms/{id}/live/updates`.
57284
+ * The updates numbered above `after`, oldest first.
57285
+ *
57286
+ * @example
57287
+ * ```typescript
57288
+ * const { updates } = await client.terms.listLiveDocUpdates(termId, { after: 41 });
57289
+ * ```
57290
+ */
57291
+ async listLiveDocUpdates(termId, options = {}, requestOptions) {
57292
+ const response = await this.api.listLiveDocUpdates(
57293
+ termId,
57294
+ { after: options.after },
57295
+ toRequestParams(requestOptions)
57296
+ );
57297
+ return decodeResponse(response, LiveDocUpdatesResponseFromApiToFront);
57298
+ }
57299
+ /**
57300
+ * Apply edits to a term's live document
57301
+ *
57302
+ * @param termId - The term (UUID) whose live document it is.
57303
+ * @param request - The request (`LiveDocApplyRequest`), camelCase; sent snake_case.
57304
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57305
+ * @returns The engine's answer as `LiveDocSeqResponse`, camelCase.
57306
+ * @throws {ApiError} 403: The caller may read the term but not write it
57307
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57308
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57309
+ * @throws {ApiError} 413: Over 4 MiB
57310
+ * @throws {ApiError} 422: Not a Yjs v1 update
57311
+ * @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
57312
+ *
57313
+ * @remarks Uses POST `/api/v1/terms/{id}/live/updates`.
57314
+ * Appends one Yjs v1 update, attributed to the caller, and answers its number. Live editors
57315
+ * connected to the document receive it.
57316
+ *
57317
+ * @example
57318
+ * ```typescript
57319
+ * const { seq } = await client.terms.applyLiveDocUpdate(termId, { update });
57320
+ * ```
57321
+ */
57322
+ async applyLiveDocUpdate(termId, request, requestOptions) {
57323
+ const response = await this.api.applyLiveDocUpdate(
57324
+ termId,
57325
+ LiveDocApplyRequestFromFrontToApi(request),
57326
+ toRequestParams(requestOptions)
57327
+ );
57328
+ return decodeResponse(response, LiveDocSeqResponseFromApiToFront);
57329
+ }
57330
+ /**
57331
+ * List a live document's versions
57332
+ *
57333
+ * @param termId - The term (UUID) whose live document it is.
57334
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57335
+ * @returns The engine's answer as `LiveDocVersionsResponse`, camelCase.
57336
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57337
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57338
+ *
57339
+ * @remarks Uses GET `/api/v1/terms/{id}/live/versions`.
57340
+ *
57341
+ * @example
57342
+ * ```typescript
57343
+ * const { versions } = await client.terms.listLiveDocVersions(termId);
57344
+ * ```
57345
+ */
57346
+ async listLiveDocVersions(termId, requestOptions) {
57347
+ const response = await this.api.listLiveDocVersions(termId, toRequestParams(requestOptions));
57348
+ return decodeResponse(response, LiveDocVersionsResponseFromApiToFront);
57349
+ }
57350
+ /**
57351
+ * Name a version of a live document
57352
+ *
57353
+ * @param termId - The term (UUID) whose live document it is.
57354
+ * @param request - The request (`LiveDocNameVersionRequest`), camelCase; sent snake_case.
57355
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57356
+ * @returns The engine's answer as `LiveDocVersionDto`, camelCase.
57357
+ * @throws {ApiError} 403: The caller may read the term but not write it
57358
+ * @throws {ApiError} 404: No such term, or the caller may not read it
57359
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57360
+ * @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
57361
+ *
57362
+ * @remarks Uses POST `/api/v1/terms/{id}/live/versions`.
57363
+ * Keeps the current state as a named version.
57364
+ *
57365
+ * @example
57366
+ * ```typescript
57367
+ * const version = await client.terms.nameLiveDocVersion(termId, { name: "Sent to legal" });
57368
+ * ```
57369
+ */
57370
+ async nameLiveDocVersion(termId, request, requestOptions) {
57371
+ const response = await this.api.nameLiveDocVersion(
57372
+ termId,
57373
+ LiveDocNameVersionRequestFromFrontToApi(request),
57374
+ toRequestParams(requestOptions)
57375
+ );
57376
+ return decodeResponse(response, LiveDocVersionDtoFromApiToFront);
57377
+ }
57378
+ /**
57379
+ * Restore a version of a live document (ENG-365)
57380
+ *
57381
+ * @param termId - The term (UUID) whose live document it is.
57382
+ * @param generation - The version (generation) to restore.
57383
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57384
+ * @returns The engine's answer as `LiveDocSeqResponse`, camelCase.
57385
+ * @throws {ApiError} 403: The caller may read the term but not write it
57386
+ * @throws {ApiError} 404: No such term or version, or the caller may not read the term
57387
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57388
+ * @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
57389
+ *
57390
+ * @remarks Uses POST `/api/v1/terms/{id}/live/versions/{generation}/restore`.
57391
+ * Keeps the current state as a "before restore" version, then brings the old content back as one
57392
+ * new update, so live editors converge and the history stays whole. Answers the update's number.
57393
+ *
57394
+ * @example
57395
+ * ```typescript
57396
+ * await client.terms.restoreLiveDocVersion(termId, 3);
57397
+ * ```
57398
+ */
57399
+ async restoreLiveDocVersion(termId, generation, requestOptions) {
57400
+ const response = await this.api.restoreLiveDocVersion(
57401
+ termId,
57402
+ generation,
57403
+ toRequestParams(requestOptions)
57404
+ );
57405
+ return decodeResponse(response, LiveDocSeqResponseFromApiToFront);
57406
+ }
57407
+ /**
57408
+ * Reapply a saved record snapshot under the normal record write guards.
57409
+ *
57410
+ * @param termId - The term (UUID).
57411
+ * @param request - The request (`RestoreTermSnapshotRequest`), camelCase; sent snake_case.
57412
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57413
+ * @returns The engine's answer as `RestoreTermSnapshotResponse`, camelCase.
57414
+ * @throws {ApiError} 403: The caller cannot edit the record
57415
+ * @throws {ApiError} 404: The record or matching snapshot is unavailable
57416
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57417
+ * @throws {ApiError} 412: The record changed since review
57418
+ * @throws {ApiError} 422: The snapshot has invalid or unavailable values
57419
+ * @throws {ApiError} 428: A strong record content tag is required
57420
+ * @throws {ApiError} 503: Record history is unavailable
57421
+ *
57422
+ * @remarks Uses POST `/api/v1/terms/{id}/restore-snapshot`.
57423
+ *
57424
+ * @example
57425
+ * ```typescript
57426
+ * await client.terms.restoreTermSnapshot(termId, request);
57427
+ * ```
57428
+ */
57429
+ async restoreTermSnapshot(termId, request, requestOptions) {
57430
+ const response = await this.api.restoreTermSnapshot(
57431
+ termId,
57432
+ RestoreTermSnapshotRequestFromFrontToApi(request),
57433
+ toRequestParams(requestOptions)
57434
+ );
57435
+ return decodeResponse(response, RestoreTermSnapshotResponseFromApiToFront);
57436
+ }
57437
+ /**
57438
+ * List the saved snapshots this caller can review for an editable record.
57439
+ *
57440
+ * @param termId - The term (UUID).
57441
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57442
+ * @returns The engine's answer as `TermSnapshotsResponse`, camelCase.
57443
+ * @throws {ApiError} 403: The caller cannot edit the record
57444
+ * @throws {ApiError} 404: The record is unavailable
57445
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57446
+ *
57447
+ * @remarks Uses GET `/api/v1/terms/{id}/snapshots`.
57448
+ *
57449
+ * @example
57450
+ * ```typescript
57451
+ * const { snapshots } = await client.terms.listTermSnapshots(termId);
57452
+ * ```
57453
+ */
57454
+ async listTermSnapshots(termId, requestOptions) {
57455
+ const response = await this.api.listTermSnapshots(termId, toRequestParams(requestOptions));
57456
+ return decodeResponse(response, TermSnapshotsResponseFromApiToFront);
57457
+ }
57458
+ /**
57459
+ * Compare a saved snapshot with the record before it is restored.
57460
+ *
57461
+ * @param termId - The term (UUID).
57462
+ * @param snapshot - The snapshot, as `listTermSnapshots` names it.
57463
+ * @param requestOptions - Per-call cancellation, timeout and request options.
57464
+ * @returns The engine's answer as `TermSnapshotPreview`, camelCase.
57465
+ * @throws {ApiError} 403: The caller cannot edit the record
57466
+ * @throws {ApiError} 404: The record or snapshot is unavailable
57467
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
57468
+ *
57469
+ * @remarks Uses GET `/api/v1/terms/{id}/snapshots/{snapshot}`.
57470
+ *
57471
+ * @example
57472
+ * ```typescript
57473
+ * const preview = await client.terms.previewTermSnapshot(termId, snapshot);
57474
+ * ```
57475
+ */
57476
+ async previewTermSnapshot(termId, snapshot, requestOptions) {
57477
+ const response = await this.api.previewTermSnapshot(
57478
+ termId,
57479
+ snapshot,
57480
+ toRequestParams(requestOptions)
57481
+ );
57482
+ return decodeResponse(response, TermSnapshotPreviewFromApiToFront);
57483
+ }
56150
57484
  };
56151
57485
  function withEtag(body, headers) {
56152
57486
  const etag = headers.get("etag");
@@ -56575,7 +57909,7 @@ var InferenceClient = class {
56575
57909
  * `derivations` with `ruleRefusalOf(error)`.
56576
57910
  * @throws {@link PreconditionFailedError} 412 when `ifMatch` is stale.
56577
57911
  * @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
56578
- * and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
57912
+ * and the deployment requires conditional writes.
56579
57913
  *
56580
57914
  * @remarks
56581
57915
  * A rule is not a row. Withdrawing one deletes its conclusion AND the
@@ -56637,7 +57971,7 @@ var InferenceClient = class {
56637
57971
  * `ruleRefusalOf(error)`.
56638
57972
  * @throws {@link PreconditionFailedError} 412 when `ifMatch` is stale.
56639
57973
  * @throws {@link PreconditionRequiredError} 428 when `ifMatch` is omitted
56640
- * and the engine runs with `OSFKB_REQUIRE_IF_MATCH=1`.
57974
+ * and the deployment requires conditional writes.
56641
57975
  * @throws {@link ValidationError} before the request is sent, when a term
56642
57976
  * cannot be encoded, or `antecedents` is not an array — `field` names it
56643
57977
  * (`term`, `antecedents`, `antecedents[i]`).
@@ -56774,7 +58108,7 @@ var InferenceClient = class {
56774
58108
  *
56775
58109
  * `timeoutMs` is a server-side deadline in milliseconds, checked at every
56776
58110
  * fixpoint boundary and every rule application. Omitted means the engine's own
56777
- * backstop (`OSFKB_FC_TIMEOUT_SECS`, 300 s by default); `0` opts out entirely.
58111
+ * time limit (300 s by default); `0` opts out entirely.
56778
58112
  * The route answers `504` when the deadline passes, and the body says whether
56779
58113
  * a `keepDerived` run kept the partial derivation it had reached. A
56780
58114
  * deadline-cut `keepDerived: false` run (`200` or `504`) leaves nothing
@@ -57451,7 +58785,9 @@ function UIGenerateRequestFromFrontToApi(model) {
57451
58785
  pipeline: model.pipeline ?? void 0,
57452
58786
  prompt: model.prompt,
57453
58787
  save_as_page: model.saveAsPage ?? void 0,
57454
- trace: model.trace ?? void 0
58788
+ trace: model.trace ?? void 0,
58789
+ authoring: model.authoring == null ? model.authoring : FrameAuthoringOriginFromFrontToApi(model.authoring),
58790
+ table: model.table == null ? model.table : { sort: model.table.sort, columns: [...model.table.columns] }
57455
58791
  };
57456
58792
  }
57457
58793
  function UIDataRowFromApiToFront(row) {
@@ -57565,6 +58901,9 @@ function osfqlRowFromApiToFront(row) {
57565
58901
  function ConversationMessageRequestFromFrontToApi(model) {
57566
58902
  return {
57567
58903
  source_scope: model.sourceScope,
58904
+ search_web: model.searchWeb,
58905
+ confirm_external: model.confirmExternal,
58906
+ project_id: model.projectId,
57568
58907
  follow_up_to: model.followUpTo,
57569
58908
  resume_answer: model.resumeAnswer,
57570
58909
  clarify_after_repeats: model.clarifyAfterRepeats,
@@ -57774,6 +59113,15 @@ function MatchedEntityDtoFromApiToFront(dto) {
57774
59113
  }
57775
59114
  function ReasoningStageDtoFromApiToFront(dto) {
57776
59115
  return {
59116
+ ...dto.blocked_sites === void 0 ? {} : { blockedSites: dto.blocked_sites },
59117
+ ...dto.elapsed_ms === void 0 ? {} : { elapsedMs: dto.elapsed_ms },
59118
+ ...dto.extracted === void 0 ? {} : { extracted: dto.extracted },
59119
+ ...dto.follow_up_of === void 0 ? {} : { followUpOf: dto.follow_up_of },
59120
+ ...dto.outcome === void 0 ? {} : { outcome: dto.outcome },
59121
+ ...dto.read === void 0 ? {} : { read: dto.read },
59122
+ ...dto.reading_deadline === void 0 ? {} : { readingDeadline: dto.reading_deadline },
59123
+ ...dto.reason === void 0 ? {} : { reason: dto.reason },
59124
+ ...dto.searched === void 0 ? {} : { searched: dto.searched },
57777
59125
  name: dto.name,
57778
59126
  order: dto.order,
57779
59127
  kind: dto.kind,
@@ -57794,6 +59142,7 @@ function ReasoningTraceDtoFromApiToFront(dto) {
57794
59142
  }
57795
59143
  function AbstentionFromApiToFront(dto) {
57796
59144
  const out = { reason: dto.reason };
59145
+ if (dto.cause != null) out.cause = dto.cause;
57797
59146
  if (dto.gate_code != null) out.gateCode = dto.gate_code;
57798
59147
  if (dto.osfql_tried != null) out.osfqlTried = dto.osfql_tried;
57799
59148
  if (dto.answerability != null) out.answerability = dto.answerability;
@@ -57810,6 +59159,8 @@ function ClaimProvenanceFromApiToFront(dto) {
57810
59159
  if (dto.passage_id != null) out.passageId = dto.passage_id;
57811
59160
  if (dto.section != null) out.section = dto.section;
57812
59161
  if (dto.page != null) out.page = dto.page;
59162
+ if (dto.media_start_ms != null) out.mediaStartMs = dto.media_start_ms;
59163
+ if (dto.media_end_ms != null) out.mediaEndMs = dto.media_end_ms;
57813
59164
  return out;
57814
59165
  }
57815
59166
  function ClaimStatedValueFromApiToFront(dto) {
@@ -57856,6 +59207,10 @@ function answerContractFromApiToFront(dto) {
57856
59207
  return {
57857
59208
  ...dto.answer_state != null ? { answerState: dto.answer_state } : {},
57858
59209
  ...dto.abstention != null ? { abstention: AbstentionFromApiToFront(dto.abstention) } : {},
59210
+ ...dto.to_verify === void 0 ? {} : { toVerify: dto.to_verify.map(ToVerifyPointFromApiToFront) },
59211
+ ...dto.web_sources === void 0 ? {} : { webSources: dto.web_sources.map(WebSourceFromApiToFront) },
59212
+ ...dto.unconfirmed === void 0 ? {} : { unconfirmed: dto.unconfirmed.map(UnconfirmedRecordFromApiToFront) },
59213
+ ...dto.unread_pages === void 0 ? {} : { unreadPages: dto.unread_pages.map(UnreadPagesFromApiToFront) },
57859
59214
  claims: (dto.claims ?? []).map(VerifiedClaimFromApiToFront),
57860
59215
  strippedClaims: (dto.stripped_claims ?? []).map(StrippedClaimFromApiToFront),
57861
59216
  nextQuestions: (dto.next_questions ?? []).map((q) => ({
@@ -57950,6 +59305,20 @@ function FrameAmbiguityFromApiToFront(dto) {
57950
59305
  function isJsonObject(value) {
57951
59306
  return typeof value === "object" && value !== null && !Array.isArray(value);
57952
59307
  }
59308
+ function isVerifiedClaimDto(value) {
59309
+ const nullableString2 = (item) => item == null || typeof item === "string";
59310
+ if (!isJsonObject(value)) return false;
59311
+ const { span, provenance, source_term_ids, stated, absence } = value;
59312
+ return typeof value.text === "string" && typeof value.verdict === "string" && nullableString2(value.certificate_id) && (value.wording === void 0 || value.wording === "engine" || value.wording === "model") && Array.isArray(span) && span.length === 2 && span.every(Number.isSafeInteger) && Array.isArray(source_term_ids) && source_term_ids.every((id) => typeof id === "string") && Array.isArray(provenance) && provenance.every(
59313
+ (source) => isJsonObject(source) && typeof source.source_scope === "string" && typeof source.source_sort === "string" && typeof source.source_term_id === "string" && (source.page == null || typeof source.page === "number") && [source.document_id, source.document_title, source.passage_id, source.section].every(
59314
+ nullableString2
59315
+ )
59316
+ ) && (stated === void 0 || Array.isArray(stated) && stated.every(
59317
+ (item) => isJsonObject(item) && typeof item.value === "string" && [item.feature_name, item.sort_name, item.term_id].every(nullableString2)
59318
+ )) && (absence == null || isJsonObject(absence) && [absence.declared_by, absence.osfql, absence.sort_id, absence.sort_name].every(
59319
+ (item) => typeof item === "string"
59320
+ ) && nullableString2(absence.package_id));
59321
+ }
57953
59322
  function isConversationMessageResponseDto(value) {
57954
59323
  if (!isJsonObject(value)) return false;
57955
59324
  return typeof Reflect.get(value, "assistant_message") === "string" && typeof Reflect.get(value, "conversation_id") === "string" && typeof Reflect.get(value, "intent") === "string" && typeof Reflect.get(value, "turn_id") === "string" && Array.isArray(Reflect.get(value, "produced_term_ids")) && Array.isArray(Reflect.get(value, "suggestions")) && Array.isArray(Reflect.get(value, "notices"));
@@ -57963,6 +59332,19 @@ function ConversationStreamEventFromApiToFront(event, payload) {
57963
59332
  return response === null ? null : { type: "done", response };
57964
59333
  }
57965
59334
  if (!isJsonObject(payload)) return null;
59335
+ if (event === "claim") {
59336
+ return isVerifiedClaimDto(payload) ? { type: "claim", claim: VerifiedClaimFromApiToFront(payload) } : null;
59337
+ }
59338
+ if (event === "step_start" || event === "step_end") {
59339
+ const { stage_id: stageId, kind, order, outcome } = payload;
59340
+ if (typeof stageId !== "string" || kind !== "symbolic" && kind !== "sensor" || typeof order !== "number" || !Number.isSafeInteger(order))
59341
+ return null;
59342
+ if (event === "step_start" && outcome === null)
59343
+ return { type: event, stageId, kind, order, outcome };
59344
+ if (event === "step_end" && typeof outcome === "string")
59345
+ return { type: event, stageId, kind, order, outcome };
59346
+ return null;
59347
+ }
57966
59348
  if (event === "token") {
57967
59349
  const delta = Reflect.get(payload, "delta");
57968
59350
  return typeof delta === "string" ? { type: "token", delta } : null;
@@ -57996,6 +59378,7 @@ function TurnDtoFromApiToFront(dto) {
57996
59378
  validityCertificateRuleProgramHash: dto.validity_certificate_rule_program_hash ?? void 0,
57997
59379
  validityCertificateRuleRevision: dto.validity_certificate_rule_revision ?? void 0,
57998
59380
  ...answerContractFromApiToFront(dto),
59381
+ ...dto.follow_up_of === void 0 ? {} : { followUpOf: dto.follow_up_of },
57999
59382
  framePages: (dto.frame_pages ?? []).map((page) => ({
58000
59383
  frameId: page.frame_id,
58001
59384
  page: page.page,
@@ -58113,6 +59496,68 @@ function SessionGraphDtoFromApiToFront(dto) {
58113
59496
  resolvedCoreferences: dto.resolved_coreferences.map(ResolvedCoreferenceDtoFromApiToFront)
58114
59497
  };
58115
59498
  }
59499
+ function ClaimAttestationRequestFromFrontToApi(model) {
59500
+ return { turn_id: model.turnId, point_ref: model.pointRef, kind: model.kind };
59501
+ }
59502
+ function ClaimAttestationResponseFromApiToFront(dto) {
59503
+ if (dto.kind !== "confirmed" && dto.kind !== "reported_error") {
59504
+ throw new TypeError(`Unknown claim attestation kind: ${dto.kind}`);
59505
+ }
59506
+ return {
59507
+ attestationId: dto.attestation_id,
59508
+ conversationId: dto.conversation_id,
59509
+ turnId: dto.turn_id,
59510
+ pointRef: dto.point_ref,
59511
+ kind: dto.kind,
59512
+ attestedBy: dto.attested_by,
59513
+ attestedAt: dto.attested_at
59514
+ };
59515
+ }
59516
+ function UnconfirmedRecordFromApiToFront(dto) {
59517
+ const out = { recordId: dto.record_id, sort: dto.sort };
59518
+ if (dto.document_id != null) out.documentId = dto.document_id;
59519
+ if (dto.passage_id != null) out.passageId = dto.passage_id;
59520
+ if (dto.provenance != null) out.provenance = dto.provenance;
59521
+ if (dto.status != null) out.status = dto.status;
59522
+ if (dto.text != null) out.text = dto.text;
59523
+ if (dto.start_seconds != null) out.startSeconds = dto.start_seconds;
59524
+ if (dto.end_seconds != null) out.endSeconds = dto.end_seconds;
59525
+ if (dto.page_start != null) out.pageStart = dto.page_start;
59526
+ if (dto.page_end != null) out.pageEnd = dto.page_end;
59527
+ return out;
59528
+ }
59529
+ function UnreadPagesFromApiToFront(dto) {
59530
+ return { documentId: dto.document_id, pages: [...dto.pages], reason: dto.reason };
59531
+ }
59532
+ function ToVerifyPointFromApiToFront(dto) {
59533
+ return {
59534
+ ...dto.attestations === void 0 ? {} : { attestations: dto.attestations },
59535
+ ...dto.fact_term_ids === void 0 ? {} : { factTermIds: dto.fact_term_ids },
59536
+ kind: dto.kind,
59537
+ pointRef: dto.point_ref,
59538
+ reason: dto.reason,
59539
+ ...dto.record_term_id === void 0 ? {} : { recordTermId: dto.record_term_id },
59540
+ text: dto.text
59541
+ };
59542
+ }
59543
+ function WebSourceQualificationFromApiToFront(dto) {
59544
+ return {
59545
+ ...dto.explanation === void 0 ? {} : { explanation: dto.explanation },
59546
+ level: dto.level,
59547
+ ...dto.rule_id === void 0 ? {} : { ruleId: dto.rule_id }
59548
+ };
59549
+ }
59550
+ function WebSourceFromApiToFront(dto) {
59551
+ return {
59552
+ ...dto.fetched_at === void 0 ? {} : { fetchedAt: dto.fetched_at },
59553
+ qualification: WebSourceQualificationFromApiToFront(dto.qualification),
59554
+ recordTermId: dto.record_term_id,
59555
+ ...dto.source_verdict === void 0 ? {} : { sourceVerdict: dto.source_verdict },
59556
+ ...dto.title === void 0 ? {} : { title: dto.title },
59557
+ url: dto.url,
59558
+ used: dto.used
59559
+ };
59560
+ }
58116
59561
 
58117
59562
  // src/normalizers/query.ts
58118
59563
  function TrizRecordOutcomeRequestFromFrontToApi(model) {
@@ -59469,6 +60914,135 @@ function AgentRecallAsOfResponseFromApiToFront(dto) {
59469
60914
  };
59470
60915
  }
59471
60916
 
60917
+ // src/normalizers/agent-instructions.ts
60918
+ function AgentInstructionsViewFromApiToFront(dto) {
60919
+ return {
60920
+ draft: dto.draft == null ? dto.draft : InstructionsDraftViewFromApiToFront(dto.draft),
60921
+ publishedBody: dto.published_body,
60922
+ publishedRevision: dto.published_revision
60923
+ };
60924
+ }
60925
+ function InstructionsDraftViewFromApiToFront(dto) {
60926
+ return {
60927
+ body: dto.body,
60928
+ rehearsed: dto.rehearsed,
60929
+ revision: dto.revision
60930
+ };
60931
+ }
60932
+ function AgentRehearsalViewFromApiToFront(dto) {
60933
+ return {
60934
+ answer: ConversationMessageResponseFromApiToFront(dto.answer),
60935
+ instructions: AgentInstructionsViewFromApiToFront(dto.instructions)
60936
+ };
60937
+ }
60938
+ function AgentSkillsResponseFromApiToFront(dto) {
60939
+ return {
60940
+ agentId: dto.agent_id,
60941
+ definitionVersion: dto.definition_version,
60942
+ skills: dto.skills.map((item0) => item0)
60943
+ };
60944
+ }
60945
+ function AgentSkillsRequestFromFrontToApi(model) {
60946
+ return {
60947
+ skills: model.skills.map((item0) => item0)
60948
+ };
60949
+ }
60950
+ function PublishAgentInstructionsFromFrontToApi(model) {
60951
+ return {
60952
+ revision: model.revision
60953
+ };
60954
+ }
60955
+ function RehearseAgentInstructionsFromFrontToApi(model) {
60956
+ return {
60957
+ context_term_ids: model.contextTermIds,
60958
+ conversation_id: model.conversationId,
60959
+ message: model.message,
60960
+ project_id: model.projectId,
60961
+ revision: model.revision
60962
+ };
60963
+ }
60964
+ function SaveAgentInstructionsFromFrontToApi(model) {
60965
+ return {
60966
+ body: model.body,
60967
+ expected_revision: model.expectedRevision
60968
+ };
60969
+ }
60970
+ function isAgentRehearsalView(value) {
60971
+ return componentFault(value, "AgentRehearsalView", "done") === void 0;
60972
+ }
60973
+ function AgentRehearsalEventFromApiToFront(event, payload) {
60974
+ if (event === "done") {
60975
+ return isAgentRehearsalView(payload) ? { type: "done", rehearsal: AgentRehearsalViewFromApiToFront(payload) } : null;
60976
+ }
60977
+ if (typeof payload !== "object" || payload === null) return null;
60978
+ if (event === "token") {
60979
+ const delta = Reflect.get(payload, "delta");
60980
+ return typeof delta === "string" ? { type: "token", delta } : null;
60981
+ }
60982
+ if (event === "error") {
60983
+ const error = Reflect.get(payload, "error");
60984
+ const status = Reflect.get(payload, "status");
60985
+ if (typeof error !== "string") return null;
60986
+ return typeof status === "number" ? { type: "error", error, status } : { type: "error", error };
60987
+ }
60988
+ return null;
60989
+ }
60990
+
60991
+ // src/utils/sse.ts
60992
+ var FRAME_SEPARATORS = ["\r\n\r\n", "\n\n", "\r\r"];
60993
+ var LINE_TERMINATOR = /\r\n|\n|\r/;
60994
+ async function* readSseFrames(body) {
60995
+ const reader = body.getReader();
60996
+ const decoder = new TextDecoder();
60997
+ let buffer = "";
60998
+ try {
60999
+ for (; ; ) {
61000
+ const chunk = await reader.read();
61001
+ if (chunk.done) break;
61002
+ buffer += decoder.decode(chunk.value, { stream: true });
61003
+ let boundary = findFrameBoundary(buffer);
61004
+ while (boundary !== null) {
61005
+ const frame = decodeFrame(buffer.slice(0, boundary.index));
61006
+ buffer = buffer.slice(boundary.index + boundary.length);
61007
+ if (frame !== null) yield frame;
61008
+ boundary = findFrameBoundary(buffer);
61009
+ }
61010
+ }
61011
+ buffer += decoder.decode();
61012
+ const trailing = decodeFrame(buffer);
61013
+ if (trailing !== null) yield trailing;
61014
+ } finally {
61015
+ await reader.cancel().catch(() => void 0);
61016
+ }
61017
+ }
61018
+ function findFrameBoundary(buffer) {
61019
+ let found = null;
61020
+ for (const separator of FRAME_SEPARATORS) {
61021
+ const index = buffer.indexOf(separator);
61022
+ if (index === -1) continue;
61023
+ if (found === null || index < found.index || index === found.index && separator.length > found.length) {
61024
+ found = { index, length: separator.length };
61025
+ }
61026
+ }
61027
+ return found;
61028
+ }
61029
+ function decodeFrame(text2) {
61030
+ const dataLines = [];
61031
+ let event;
61032
+ for (const line of text2.split(LINE_TERMINATOR)) {
61033
+ if (line === "" || line.startsWith(":")) continue;
61034
+ const colon = line.indexOf(":");
61035
+ const field = colon === -1 ? line : line.slice(0, colon);
61036
+ const rawValue = colon === -1 ? "" : line.slice(colon + 1);
61037
+ const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
61038
+ if (field === "data") dataLines.push(value);
61039
+ else if (field === "event") event = value;
61040
+ }
61041
+ const data = dataLines.join("\n");
61042
+ if (data === "") return null;
61043
+ return { event: event === "" ? void 0 : event, data };
61044
+ }
61045
+
59472
61046
  // src/resources/cognitive.ts
59473
61047
  var CognitiveClient = class {
59474
61048
  /** @internal */
@@ -60406,6 +61980,160 @@ var CognitiveClient = class {
60406
61980
  }
60407
61981
  };
60408
61982
  }
61983
+ /**
61984
+ * getAgentInstructions
61985
+ *
61986
+ * @param agentId - The agent (UUID).
61987
+ * @param requestOptions - Per-call cancellation, timeout and request options.
61988
+ * @returns The engine's answer as `AgentInstructionsView`, camelCase.
61989
+ * @throws {ApiError} 403: Named edit access required
61990
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
61991
+ *
61992
+ * @remarks Uses GET `/api/v1/cognitive/agents/{agent_id}/instructions`.
61993
+ *
61994
+ * @example
61995
+ * ```typescript
61996
+ * const view = await client.cognitive.getAgentInstructions(agentId);
61997
+ * ```
61998
+ */
61999
+ async getAgentInstructions(agentId, requestOptions) {
62000
+ const response = await this.api.get(agentId, toRequestParams(requestOptions));
62001
+ return decodeResponse(response, AgentInstructionsViewFromApiToFront);
62002
+ }
62003
+ /**
62004
+ * saveAgentInstructions
62005
+ *
62006
+ * @param agentId - The agent (UUID).
62007
+ * @param request - The request (`SaveAgentInstructions`), camelCase; sent snake_case.
62008
+ * @param requestOptions - Per-call cancellation, timeout and request options.
62009
+ * @returns The engine's answer as `AgentInstructionsView`, camelCase.
62010
+ * @throws {ApiError} 403: Named edit access required
62011
+ * @throws {ApiError} 409: Draft changed while it was being edited
62012
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
62013
+ *
62014
+ * @remarks Uses PUT `/api/v1/cognitive/agents/{agent_id}/instructions`.
62015
+ *
62016
+ * @example
62017
+ * ```typescript
62018
+ * await client.cognitive.saveAgentInstructions(agentId, draft);
62019
+ * ```
62020
+ */
62021
+ async saveAgentInstructions(agentId, request, requestOptions) {
62022
+ const response = await this.api.save(
62023
+ agentId,
62024
+ SaveAgentInstructionsFromFrontToApi(request),
62025
+ toRequestParams(requestOptions)
62026
+ );
62027
+ return decodeResponse(response, AgentInstructionsViewFromApiToFront);
62028
+ }
62029
+ /**
62030
+ * publishAgentInstructions
62031
+ *
62032
+ * @param agentId - The agent (UUID).
62033
+ * @param request - The request (`PublishAgentInstructions`), camelCase; sent snake_case.
62034
+ * @param requestOptions - Per-call cancellation, timeout and request options.
62035
+ * @returns The engine's answer as `AgentInstructionsView`, camelCase.
62036
+ * @throws {ApiError} 403: Named edit access required
62037
+ * @throws {ApiError} 409: The requested draft has changed
62038
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
62039
+ * @throws {ApiError} 422: Rehearse this draft before publishing
62040
+ *
62041
+ * @remarks Uses POST `/api/v1/cognitive/agents/{agent_id}/instructions/publish`.
62042
+ *
62043
+ * @example
62044
+ * ```typescript
62045
+ * await client.cognitive.publishAgentInstructions(agentId, request);
62046
+ * ```
62047
+ */
62048
+ async publishAgentInstructions(agentId, request, requestOptions) {
62049
+ const response = await this.api.publish(
62050
+ agentId,
62051
+ PublishAgentInstructionsFromFrontToApi(request),
62052
+ toRequestParams(requestOptions)
62053
+ );
62054
+ return decodeResponse(response, AgentInstructionsViewFromApiToFront);
62055
+ }
62056
+ /**
62057
+ * Rehearse a draft of an agent's instructions: the agent answers one message
62058
+ * under the draft, streamed, and the rehearsal is recorded on the draft.
62059
+ *
62060
+ * @param agentId - The agent (UUID).
62061
+ * @param request - The rehearsal (`RehearseAgentInstructions`): the draft revision and the message.
62062
+ * @param requestOptions - Per-call cancellation, timeout and request options.
62063
+ * @returns The stream's events: `token` (an answer delta), then `done` with the
62064
+ * saved instructions receipt and the answer, or `error`.
62065
+ * @throws {ApiError} 403 without named edit access and agent scope; 409 when the
62066
+ * requested draft changed; 503 when agent authoring is unavailable.
62067
+ * @throws {NetworkError} When the stream carries no event stream, a malformed
62068
+ * event, or ends without a `done` or `error` event.
62069
+ *
62070
+ * @remarks Uses POST `/api/v1/cognitive/agents/{agent_id}/instructions/rehearse`
62071
+ * (`text/event-stream`). Errors after the stream opened arrive as `error` events.
62072
+ *
62073
+ * @example
62074
+ * ```typescript
62075
+ * for await (const event of client.cognitive.rehearseAgentInstructions(agentId, request)) {
62076
+ * if (event.type === 'done') console.log(event.rehearsal.answer.assistantMessage);
62077
+ * }
62078
+ * ```
62079
+ */
62080
+ async *rehearseAgentInstructions(agentId, request, requestOptions) {
62081
+ const response = await this.api.rehearse(
62082
+ agentId,
62083
+ RehearseAgentInstructionsFromFrontToApi(request),
62084
+ mergeRequestParams({ headers: { Accept: "text/event-stream" } }, requestOptions)
62085
+ );
62086
+ const body = response.body;
62087
+ if (body === null) throw new NetworkError("Rehearsal response carried no event stream");
62088
+ for await (const frame of readSseFrames(body)) {
62089
+ if (frame.event !== "token" && frame.event !== "done" && frame.event !== "error") continue;
62090
+ let payload;
62091
+ try {
62092
+ payload = JSON.parse(frame.data);
62093
+ } catch (error) {
62094
+ throw new NetworkError(
62095
+ `Rehearsal stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
62096
+ error instanceof Error ? error : void 0
62097
+ );
62098
+ }
62099
+ const event = AgentRehearsalEventFromApiToFront(frame.event, payload);
62100
+ if (event === null) {
62101
+ throw new NetworkError(
62102
+ `Rehearsal stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
62103
+ );
62104
+ }
62105
+ yield event;
62106
+ if (event.type !== "token") return;
62107
+ }
62108
+ throw new NetworkError("Rehearsal stream ended without a done or error event");
62109
+ }
62110
+ /**
62111
+ * State an agent's skills.
62112
+ *
62113
+ * @param agentId - The agent (UUID).
62114
+ * @param request - The request (`AgentSkillsRequest`), camelCase; sent snake_case.
62115
+ * @param requestOptions - Per-call cancellation, timeout and request options.
62116
+ * @returns The engine's answer as `AgentSkillsResponse`, camelCase.
62117
+ * @throws {ApiError} 403: The caller is not the agent's Owner or a Space admin — `code: agent_skills_not_yours`
62118
+ * @throws {ApiError} 404: No such agent in this Space
62119
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
62120
+ * @throws {ApiError} 422: A skill is no task template of this Space — `code: agent_skill_unknown`
62121
+ *
62122
+ * @remarks Uses PUT `/api/v1/cognitive/agents/{agent_id}/skills`.
62123
+ *
62124
+ * @example
62125
+ * ```typescript
62126
+ * await client.cognitive.putAgentSkills(agentId, request);
62127
+ * ```
62128
+ */
62129
+ async putAgentSkills(agentId, request, requestOptions) {
62130
+ const response = await this.api.putAgentSkills(
62131
+ agentId,
62132
+ AgentSkillsRequestFromFrontToApi(request),
62133
+ toRequestParams(requestOptions)
62134
+ );
62135
+ return decodeResponse(response, AgentSkillsResponseFromApiToFront);
62136
+ }
60409
62137
  };
60410
62138
 
60411
62139
  // src/normalizers/native-goal.ts
@@ -64281,7 +66009,9 @@ function IngestionConfigDtoFromFrontToApi(model) {
64281
66009
  reject_anonymized_references: model.rejectAnonymizedReferences,
64282
66010
  skip_fingerprint: model.skipFingerprint,
64283
66011
  fresh_work: model.freshWork,
64284
- skip_relation_completion: model.skipRelationCompletion
66012
+ skip_relation_completion: model.skipRelationCompletion,
66013
+ text_provenance: model.textProvenance,
66014
+ derived_from: model.derivedFrom
64285
66015
  };
64286
66016
  }
64287
66017
  function ChunkFailureDtoFromApiToFront(dto) {
@@ -64375,6 +66105,13 @@ function IngestionWorkCacheDtoFromApiToFront(dto) {
64375
66105
  reusedRecordedTokenUsage: TokenUsageDtoFromApiToFront(dto.reused_recorded_token_usage)
64376
66106
  };
64377
66107
  }
66108
+ function IngestionValuePassDtoFromApiToFront(dto) {
66109
+ return {
66110
+ valuesRead: dto.values_read,
66111
+ valuesHeld: dto.values_held,
66112
+ passagesNotRead: dto.passages_not_read
66113
+ };
66114
+ }
64378
66115
  function AlignmentStatsDtoFromApiToFront(dto) {
64379
66116
  return {
64380
66117
  avgFuzzyRatio: dto.avg_fuzzy_ratio,
@@ -64897,7 +66634,8 @@ function DocumentStatsDtoFromApiToFront(dto) {
64897
66634
  termIds: dto.term_ids,
64898
66635
  totalTokens: dto.total_tokens,
64899
66636
  fcaDiscovery: dto.fca_discovery ? FcaIngestionReportFromApiToFront(dto.fca_discovery) : void 0,
64900
- workCache: dto.work_cache ? IngestionWorkCacheDtoFromApiToFront(dto.work_cache) : void 0
66637
+ workCache: dto.work_cache ? IngestionWorkCacheDtoFromApiToFront(dto.work_cache) : void 0,
66638
+ ...dto.value_pass ? { valuePass: IngestionValuePassDtoFromApiToFront(dto.value_pass) } : {}
64901
66639
  };
64902
66640
  }
64903
66641
  function SessionStatsResponseFromApiToFront(dto) {
@@ -65154,6 +66892,8 @@ function isIngestUrlStoreFailedBody(body) {
65154
66892
  }
65155
66893
  function WebSearchRequestFromFrontToApi(model) {
65156
66894
  const dto = { query: model.query };
66895
+ if (model.confirmExternal !== void 0) dto.confirm_external = model.confirmExternal;
66896
+ if (model.project !== void 0) dto.project = model.project;
65157
66897
  if (model.limit !== void 0) dto.limit = model.limit;
65158
66898
  return dto;
65159
66899
  }
@@ -65257,6 +66997,19 @@ function IngestAudioResponseFromApiToFront(dto) {
65257
66997
  translatedLang: dto.translated_lang ?? void 0
65258
66998
  };
65259
66999
  }
67000
+ function LiveRecordingViewFromApiToFront(dto) {
67001
+ const out = {
67002
+ id: dto.id,
67003
+ state: dto.state,
67004
+ bytes: dto.bytes,
67005
+ durationSecs: dto.duration_secs,
67006
+ finals: dto.finals.map((final) => ({ ...final }))
67007
+ };
67008
+ if (dto.audio_file_id != null) out.audioFileId = dto.audio_file_id;
67009
+ if (dto.error != null) out.error = dto.error;
67010
+ if (dto.result != null) out.result = IngestAudioResponseFromApiToFront(dto.result);
67011
+ return out;
67012
+ }
65260
67013
  function CreateRdfUploadRequestFromFrontToApi(request) {
65261
67014
  return {
65262
67015
  name: request.name,
@@ -65303,6 +67056,57 @@ function RdfUploadPauseReceiptFromApiToFront(dto) {
65303
67056
  status: dto.status
65304
67057
  };
65305
67058
  }
67059
+ function VideoIngestRequestFromFrontToApi(model) {
67060
+ const options = model.options;
67061
+ const asr = options?.asr;
67062
+ return {
67063
+ video_base64: model.videoBase64,
67064
+ ...model.filename !== void 0 ? { filename: model.filename } : {},
67065
+ ...options !== void 0 ? {
67066
+ options: {
67067
+ ...asr !== void 0 ? {
67068
+ asr: {
67069
+ ...asr.diarize !== void 0 ? { diarize: asr.diarize } : {},
67070
+ ...asr.language !== void 0 ? { language: asr.language } : {},
67071
+ ...asr.numSpeakers !== void 0 ? { num_speakers: asr.numSpeakers } : {}
67072
+ }
67073
+ } : {},
67074
+ ...options.lanes !== void 0 ? { lanes: options.lanes } : {},
67075
+ ...options.maxFrames !== void 0 ? { max_frames: options.maxFrames } : {},
67076
+ ...options.sceneThreshold !== void 0 ? { scene_threshold: options.sceneThreshold } : {},
67077
+ ...options.visionTemplate !== void 0 ? { vision_template: options.visionTemplate } : {}
67078
+ }
67079
+ } : {}
67080
+ };
67081
+ }
67082
+ function VideoIngestResponseFromApiToFront(dto) {
67083
+ return {
67084
+ stats: IngestionStatsDtoFromApiToFront(dto.stats),
67085
+ evidence: {
67086
+ documentTermId: dto.evidence.document_term_id,
67087
+ locatedTerms: dto.evidence.located_terms,
67088
+ unlocatedTermIds: dto.evidence.unlocated_term_ids
67089
+ }
67090
+ };
67091
+ }
67092
+ function RetainedOriginalFromApiToFront(dto) {
67093
+ return {
67094
+ id: dto.id,
67095
+ name: dto.name,
67096
+ size: dto.size,
67097
+ contentUrl: dto.content_url
67098
+ };
67099
+ }
67100
+ function QueuedVideoIngestResponseFromApiToFront(dto) {
67101
+ return {
67102
+ documentId: dto.document_id,
67103
+ sessionId: dto.session_id,
67104
+ status: dto.status,
67105
+ statusUrl: dto.status_url,
67106
+ originalFiles: dto.original_files.map(RetainedOriginalFromApiToFront),
67107
+ sourceText: dto.source_text
67108
+ };
67109
+ }
65306
67110
 
65307
67111
  // src/resources/ingestion-session.ts
65308
67112
  var IngestionFailedError = class extends ReasoningLayerError {
@@ -65948,15 +67752,38 @@ var IngestionClient = class {
65948
67752
  * @param request - The SUO-KIF source, an optional `goal`/`query` to
65949
67753
  * prove, and a `persist` flag (import into the tenant substrate vs an
65950
67754
  * ephemeral request-scoped world).
67755
+ * @param requestOptions - Per-call request options.
65951
67756
  * @returns Import counts (forms, facts, rules, sorts, …) plus, when a
65952
67757
  * goal/query was supplied, a `provable` verdict and the non-firing
65953
67758
  * residue breakdown.
67759
+ * @throws {GovernanceRefusedError} With `persist: true`, when the write
67760
+ * guard refuses a fact, individual or rule the import writes; nothing of
67761
+ * the import is stored. `403` `reserved_sort_write_refused`,
67762
+ * `sort_write_not_granted`, `operational_authority_denied` or
67763
+ * `operational_authority_undetermined`; `409` `authz_relation_derived`;
67764
+ * `422`
67765
+ * `operational_rule_conclusion`, `authz_rule_shape`,
67766
+ * `authz_parent_of_sort_refused` or `filing_term_unread`.
67767
+ * @throws {VocabularyRefusedError} `409` `governed_sort_write_refused`: that
67768
+ * code is in the vocabulary set too, which the SDK reads first.
67769
+ *
67770
+ * @remarks
67771
+ * Sent to `POST /api/v1/ingest/kif`; the body is snake_case on the wire.
67772
+ * The refusals are the engine's `GovernanceRefusalBody`
67773
+ * (`{ error, code, message }`), read into a typed
67774
+ * `GovernanceRefusedError`; any other failure stays the plain `ApiError`.
67775
+ *
67776
+ * @example
67777
+ * ```typescript
67778
+ * const result = await client.ingestion.ingestKif({
67779
+ * content: '(instance Socrates Human)',
67780
+ * persist: true,
67781
+ * });
67782
+ * console.log(result.facts);
67783
+ * ```
65954
67784
  */
65955
67785
  async ingestKif(request, requestOptions) {
65956
- const response = await this.api.ingestKif(
65957
- IngestKifRequestFromFrontToApi(request),
65958
- toRequestParams(requestOptions)
65959
- );
67786
+ const response = await this.api.ingestKif(IngestKifRequestFromFrontToApi(request), toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
65960
67787
  return decodeResponse(response, IngestKifResponseFromApiToFront);
65961
67788
  }
65962
67789
  /**
@@ -66387,6 +68214,10 @@ var IngestionClient = class {
66387
68214
  * @returns The pages read (created, updated or unchanged) and the pages
66388
68215
  * skipped, each with a reason.
66389
68216
  * @throws {BadRequestError} If the body is malformed.
68217
+ * @throws {ForbiddenError} `403` when the Space's boundary refuses the start host.
68218
+ * `errorBodyCode` gives the reason, such as `egress_denied`.
68219
+ * @throws {PreconditionRequiredError} `428` with `boundary_needs_confirmation`
68220
+ * when the Web connector requires confirmation before fetching the page.
66390
68221
  * @throws {ApiError} `422` if the URL is not absolute `http`/`https`, a
66391
68222
  * limit is out of range (depth above `maxDepthLimit`, pages above
66392
68223
  * `maxPagesLimit`), the body has an unknown field, or the crawl ingested
@@ -66456,13 +68287,16 @@ var IngestionClient = class {
66456
68287
  * Search the web through the deployment's search providers —
66457
68288
  * `POST /api/v1/web/search`.
66458
68289
  *
66459
- * @param request - The query and, optionally, the number of results.
68290
+ * @param request - The query, result limit, project and confirmation for this search.
66460
68291
  * @param requestOptions - Per-call request options.
66461
68292
  * @returns The trimmed query and the pages found, best first.
66462
68293
  * @throws {BadRequestError} `400` if the body is malformed.
66463
68294
  * @throws {ApiError} `422` if the query is blank or longer than
66464
68295
  * `webSearch.maxQueryChars`, the `limit` is out of range (1 to
66465
- * `webSearch.maxResultsLimit`), or the body has an unknown field.
68296
+ * `webSearch.maxResultsLimit`), the project is malformed, or the body has an unknown field.
68297
+ * @throws {ForbiddenError} `403` when the setting, boundary or connector refuses the search.
68298
+ * @throws {PreconditionRequiredError} `428` with `boundary_needs_confirmation`
68299
+ * when the boundary requires the person to confirm this call.
66466
68300
  * @throws {InternalServerError} `502` with `errorBodyCode`
66467
68301
  * `'web_search_providers_failed'` if every registered provider failed
66468
68302
  * this search. The next call can succeed.
@@ -66536,6 +68370,72 @@ var IngestionClient = class {
66536
68370
  );
66537
68371
  return decodeResponse(response, IngestAudioResponseFromApiToFront);
66538
68372
  }
68373
+ /**
68374
+ * Ingest a short video: read its timeline (speech, screen text, scenes) and
68375
+ * ingest the text with the full ontology extraction —
68376
+ * `POST /api/v1/ingest/video`.
68377
+ *
68378
+ * @param request - The clip in base64, its file name, and the timeline
68379
+ * options.
68380
+ * @param requestOptions - `sync` flag plus per-call request options. `sync`
68381
+ * defaults to `true`.
68382
+ * @returns `inline` with the statistics and the evidence receipt (HTTP 201),
68383
+ * or, with `sync: false`, `queued` with an {@link IngestionSession} and the
68384
+ * 202 body (HTTP 202).
68385
+ * @throws {BadRequestError} `400` if `videoBase64` is not standard base64,
68386
+ * or the clip is empty or over 16 MiB.
68387
+ * @throws {ForbiddenError} `403` if the caller may not write, or a
68388
+ * `sync: false` call carries no acting user
68389
+ * (`errorBodyCode(e) === 'ingestion_execution_actor_required'`).
68390
+ * @throws {InternalServerError} `500` if the timeline service failed or
68391
+ * answered invalid evidence, or the ingestion failed; nothing was
68392
+ * committed.
68393
+ * @throws {ServiceUnavailableError} `503` if no video timeline service is
68394
+ * configured.
68395
+ * @throws {IngestionQueueUnavailableError} With `sync: false`, a `503`
68396
+ * becomes this error: the deployment runs no background queue, session
68397
+ * tracking or task retention (or no timeline service).
68398
+ *
68399
+ * @remarks
68400
+ * Request body is snake_case on the wire (`video_base64`,
68401
+ * `options.max_frames`, `options.asr.num_speakers`); `sync` travels as a
68402
+ * query parameter. The run commits the document, its terms, the video
68403
+ * evidence and one passage per utterance or frame together, or none of
68404
+ * them. The SDK reads the HTTP status to tell the two answers apart.
68405
+ *
68406
+ * @example
68407
+ * ```ts
68408
+ * const outcome = await client.ingestion.ingestVideo({ videoBase64: clip, filename: 'demo.mp4' });
68409
+ * if (outcome.kind === 'inline') console.log(outcome.result.evidence.locatedTerms);
68410
+ * ```
68411
+ */
68412
+ async ingestVideo(request, requestOptions) {
68413
+ const sync = requestOptions?.sync ?? true;
68414
+ let response;
68415
+ try {
68416
+ response = await this.api.http.request({
68417
+ ...toRequestParams(requestOptions),
68418
+ path: `/api/v1/ingest/video`,
68419
+ method: "POST",
68420
+ query: { sync },
68421
+ body: VideoIngestRequestFromFrontToApi(request),
68422
+ secure: true,
68423
+ type: "application/json",
68424
+ format: "json"
68425
+ });
68426
+ } catch (error) {
68427
+ throw sync ? error : asQueueRefusal(error);
68428
+ }
68429
+ return decodeResponse(response, (data) => {
68430
+ if (response.status === 202) {
68431
+ if (!("status_url" in data)) throw contractViolation("/ingest/video", 202);
68432
+ const queued = QueuedVideoIngestResponseFromApiToFront(data);
68433
+ return { kind: "queued", session: new IngestionSession(this.api, queued), queued };
68434
+ }
68435
+ if ("status_url" in data) throw contractViolation("/ingest/video", response.status);
68436
+ return { kind: "inline", result: VideoIngestResponseFromApiToFront(data) };
68437
+ });
68438
+ }
66539
68439
  /**
66540
68440
  * Poll an audio ingestion job — `GET /api/v1/ingest/audio/jobs/{job_id}`.
66541
68441
  *
@@ -66588,6 +68488,92 @@ var IngestionClient = class {
66588
68488
  const response = await this.api.resumeAudioJob(jobId, toRequestParams(requestOptions));
66589
68489
  return decodeResponse(response, IngestAudioResponseFromApiToFront);
66590
68490
  }
68491
+ /**
68492
+ * Read a live recording — `GET /api/v1/audio/recordings/{id}`.
68493
+ *
68494
+ * @param id - The live recording id the client chose when it opened the
68495
+ * caption socket (`/ws/audio/stream?protocol_version=2&recording=<id>`).
68496
+ * @param requestOptions - Per-call request options.
68497
+ * @returns Its state, the audio held and the finals so far; once `ready`,
68498
+ * the retained original and the parse-only audio result.
68499
+ * @throws {ForbiddenError} 403 when the recording is another user's.
68500
+ * @throws {NotFoundError} 404 when there is no such recording, or it expired.
68501
+ * @throws {TenantDeletedError} 410 when the tenant was deleted.
68502
+ *
68503
+ * @remarks
68504
+ * Only the user who started a recording may read it. A ready or failed
68505
+ * recording expires after the engine's parse-only retention (a day by
68506
+ * default). `liveRecording` on `client.health.check()` says whether the
68507
+ * engine keeps live recordings at all.
68508
+ *
68509
+ * @example
68510
+ * ```ts
68511
+ * const recording = await client.ingestion.getLiveRecording(recordingId);
68512
+ * if (recording.state === 'ready') console.log(recording.result?.transcriptMarkdown);
68513
+ * ```
68514
+ */
68515
+ async getLiveRecording(id, requestOptions) {
68516
+ const response = await this.api.getLiveRecording(id, toRequestParams(requestOptions));
68517
+ return decodeResponse(response, LiveRecordingViewFromApiToFront);
68518
+ }
68519
+ /**
68520
+ * Stop a live recording whose socket is gone, and finalize it —
68521
+ * `POST /api/v1/audio/recordings/{id}/stop`.
68522
+ *
68523
+ * @param id - The live recording id.
68524
+ * @param requestOptions - Per-call request options.
68525
+ * @returns The recording: `finalizing` (HTTP 202), or as it stands when it
68526
+ * is already `ready` or `failed` (HTTP 200).
68527
+ * @throws {ForbiddenError} 403 when the recording is another user's.
68528
+ * @throws {NotFoundError} 404 when there is no such recording.
68529
+ * @throws {TenantDeletedError} 410 when the tenant was deleted.
68530
+ *
68531
+ * @remarks
68532
+ * The audio is sealed and retained as the meeting's original, then the
68533
+ * parse-only audio pipeline writes the transcript, summary and actions.
68534
+ * Idempotent: a recording already finalizing answers 202 (and finalizing
68535
+ * starts again if its worker stopped). Audio a live socket had not yet
68536
+ * written (at most about five seconds) is not kept.
68537
+ *
68538
+ * @example
68539
+ * ```ts
68540
+ * const recording = await client.ingestion.stopLiveRecording(recordingId);
68541
+ * console.log(recording.state); // 'finalizing'
68542
+ * ```
68543
+ */
68544
+ async stopLiveRecording(id, requestOptions) {
68545
+ const response = await this.api.stopLiveRecording(id, toRequestParams(requestOptions));
68546
+ return decodeResponse(response, LiveRecordingViewFromApiToFront);
68547
+ }
68548
+ /**
68549
+ * Finalize again a recording whose finalizing failed —
68550
+ * `POST /api/v1/audio/recordings/{id}/retry`.
68551
+ *
68552
+ * @param id - The live recording id of a `failed` recording.
68553
+ * @param requestOptions - Per-call request options.
68554
+ * @returns The recording: `finalizing` again (HTTP 202), or as it stands
68555
+ * when it is already `ready` (HTTP 200).
68556
+ * @throws {ForbiddenError} 403 when the recording is another user's.
68557
+ * @throws {NotFoundError} 404 when there is no such recording.
68558
+ * @throws {ConstraintViolationError} 409 when the recording is still
68559
+ * recording or finalizing.
68560
+ * @throws {TenantDeletedError} 410 when the tenant was deleted.
68561
+ *
68562
+ * @remarks
68563
+ * The engine finalizes again from the audio it kept, so no audio is resent.
68564
+ *
68565
+ * @example
68566
+ * ```ts
68567
+ * const recording = await client.ingestion.getLiveRecording(recordingId);
68568
+ * if (recording.state === 'failed') {
68569
+ * await client.ingestion.retryLiveRecording(recordingId);
68570
+ * }
68571
+ * ```
68572
+ */
68573
+ async retryLiveRecording(id, requestOptions) {
68574
+ const response = await this.api.retryLiveRecording(id, toRequestParams(requestOptions));
68575
+ return decodeResponse(response, LiveRecordingViewFromApiToFront);
68576
+ }
66591
68577
  /**
66592
68578
  * Open a resumable upload of one original RDF file —
66593
68579
  * `POST /api/v1/ingest/rdf/uploads`.
@@ -67139,6 +69125,7 @@ function ReviewSummaryFromApiToFront(dto) {
67139
69125
  totalRejected: dto.total_rejected,
67140
69126
  totalCorrected: dto.total_corrected,
67141
69127
  totalMerged: dto.total_merged,
69128
+ totalSuperseded: dto.total_superseded ?? 0,
67142
69129
  avgPendingConfidence: dto.avg_pending_confidence,
67143
69130
  ...typeof dto.oldest_pending === "string" ? { oldestPending: dto.oldest_pending } : {},
67144
69131
  byReason: byReasonFromApiToFront(dto.by_reason),
@@ -69751,7 +71738,7 @@ var SourcesClient = class {
69751
71738
  * Parquet) or `config.database_path` (SQLite) to {@link SourcesClient.register}.
69752
71739
  * @throws {BadRequestError} **400** when the engine cannot read the multipart body.
69753
71740
  * @throws {ApiError} **413** when the file is larger than the engine's
69754
- * `OSFKB_SOURCE_FILE_MAX_SIZE_MB` (256 MiB by default).
71741
+ * configured upload limit (256 MiB by default).
69755
71742
  *
69756
71743
  * @remarks
69757
71744
  * Sent to `POST /api/v1/sources/files` as `multipart/form-data` with exactly
@@ -69912,7 +71899,7 @@ var SourcesClient = class {
69912
71899
  * Sent to `GET /api/v1/sources/{source_id}/tables`. The cheap counterpart to
69913
71900
  * {@link SourcesClient.discoverSchema}: one catalog query, no per-type
69914
71901
  * introspection, and — unlike discovery — **never subject to the discovery
69915
- * cap**. A source with more tables than `OSFKB_MAX_DISCOVERED_SORTS` allows
71902
+ * cap**. A source with more tables than the configured discovery limit allows
69916
71903
  * has its discovery refused, so this listing is the un-capped payload to
69917
71904
  * narrow *from*: list the names, let the user pick, then hand the picked
69918
71905
  * subset back as the `typeFilter` of a `discoverSchema` call. The response
@@ -71045,6 +73032,11 @@ var ScenariosClient = class {
71045
73032
  * @returns Created scenario (may include interactive questions). A complete
71046
73033
  * answer's `materialization.warnings` names every rule the engine refused.
71047
73034
  * @throws {BadRequestError} If a binding in `prefixes` is malformed.
73035
+ * @throws {ForbiddenError} `403` with `errorBodyCode(e)`
73036
+ * `sort_write_not_granted` (the caller's Write grants do not cover a
73037
+ * belief, the goal or a constraint as it is stored),
73038
+ * `operational_authority_denied` or `operational_authority_undetermined`;
73039
+ * nothing is written (reasoninglayer#1227).
71048
73040
  * @throws {ConstraintViolationError} `409` if `prefixes` binds a prefix the
71049
73041
  * tenant already binds to a different namespace.
71050
73042
  * @throws {ApiError} **422** if the generated scenario is invalid — among
@@ -71096,6 +73088,12 @@ var ScenariosClient = class {
71096
73088
  * `property` name the creation gate of `sorts.createSort` refuses: a name
71097
73089
  * OSFQL cannot read (`patient-id`), or a CURIE whose prefix the tenant does
71098
73090
  * not bind canonically. Nothing is written.
73091
+ * @throws {ForbiddenError} `403` if the authorization context grants no
73092
+ * Manage on a sort the scenario writes, or with `errorBodyCode(e)`
73093
+ * `reserved_sort_write_refused` (a belief, goal or constraint names a
73094
+ * reserved sort), `sort_write_not_granted`, `operational_authority_denied`
73095
+ * or `operational_authority_undetermined`. Nothing is written
73096
+ * (reasoninglayer#1227).
71099
73097
  * @throws {ConstraintViolationError} `409` if `prefixes` binds a prefix the
71100
73098
  * tenant already binds to a different namespace. Nothing is written.
71101
73099
  * @throws {ApiError} **422** `Invalid scenario payload: …` if an item has the
@@ -71199,6 +73197,11 @@ var ScenariosClient = class {
71199
73197
  * `addSorts` mints a sort or feature name the creation gate of
71200
73198
  * `sorts.createSort` refuses. Nothing is written.
71201
73199
  * @throws {NotFoundError} If no scenario has this id.
73200
+ * @throws {ForbiddenError} `403` with `errorBodyCode(e)`
73201
+ * `sort_write_not_granted`, `reserved_sort_write_refused`,
73202
+ * `operational_authority_denied` or `operational_authority_undetermined`
73203
+ * for an added belief or constraint; nothing is written
73204
+ * (reasoninglayer#1227).
71202
73205
  * @throws {ConstraintViolationError} `409` if `prefixes` binds a prefix the
71203
73206
  * tenant already binds to a different namespace. Nothing is written.
71204
73207
  * @throws {ApiError} **422** if an added item is malformed.
@@ -76311,7 +78314,7 @@ var AnalysisClient = class {
76311
78314
  * @param requestOptions - Per-call request options.
76312
78315
  * @returns The subgroups, best first, each a concept with its positions,
76313
78316
  * extent, quality and rates; the search that ran and how far it went;
76314
- * and the derived OSF terms the concepts resolve in.
78317
+ * and the derived terms the concepts resolve in.
76315
78318
  * @throws {BadRequestError} 400 for an empty or duplicated population,
76316
78319
  * nothing in the store, a graded target or one without a measured
76317
78320
  * positive and negative, an exact strategy outside the categorical
@@ -76358,7 +78361,7 @@ var AnalysisClient = class {
76358
78361
  * @param requestOptions - Per-call request options.
76359
78362
  * @returns The distinct patterns in order of first draw, each with its
76360
78363
  * equalities, extent, exact `weight`, draw count, quality and rates; the
76361
- * `normalizer`; the order of the draws; and the derived OSF terms the
78364
+ * `normalizer`; the order of the draws; and the derived terms the
76362
78365
  * descriptions resolve in.
76363
78366
  * @throws {BadRequestError} 400 for an empty or duplicated population,
76364
78367
  * nothing in the store, a graded target or one without a measured positive
@@ -78952,7 +80955,9 @@ function EnrichedHealthResponseFromApiToFront(dto) {
78952
80955
  startedAt: dto.started_at,
78953
80956
  status: dto.status ?? "unknown",
78954
80957
  uptimeSeconds: dto.uptime_seconds,
78955
- sovereign: dto.sovereign
80958
+ sovereign: dto.sovereign,
80959
+ holdsUnprovenText: dto.holds_unproven_text,
80960
+ liveRecording: dto.live_recording
78956
80961
  };
78957
80962
  }
78958
80963
 
@@ -78965,7 +80970,7 @@ var HealthClient = class {
78965
80970
  this.api = api;
78966
80971
  }
78967
80972
  /**
78968
- * Check the health of the Reasoning Layer backend.
80973
+ * Check the health of the ReasoningLayer backend.
78969
80974
  *
78970
80975
  * @returns Enriched health response with overall status, component statuses,
78971
80976
  * build info, and the identity of the engine process (`bootId`, `startedAt`,
@@ -79198,6 +81203,26 @@ function RetirementStatusFromApiToFront(dto) {
79198
81203
  return out;
79199
81204
  }
79200
81205
 
81206
+ // src/normalizers/admin-maintenance.ts
81207
+ function RebuildSemanticIndexResponseFromApiToFront(dto) {
81208
+ return {
81209
+ failed: dto.failed,
81210
+ indexed: dto.indexed,
81211
+ tenantId: dto.tenant_id,
81212
+ termsSeen: dto.terms_seen
81213
+ };
81214
+ }
81215
+ function ConversationEraseResponseFromApiToFront(dto) {
81216
+ return {
81217
+ dryRun: dto.dry_run,
81218
+ goals: dto.goals,
81219
+ records: dto.records,
81220
+ remaining: dto.remaining,
81221
+ removed: dto.removed,
81222
+ tenantId: dto.tenant_id
81223
+ };
81224
+ }
81225
+
79201
81226
  // src/resources/admin.ts
79202
81227
  var AdminClient = class {
79203
81228
  /**
@@ -79609,6 +81634,65 @@ var AdminClient = class {
79609
81634
  ).catch(rethrowVocabularyRefusal);
79610
81635
  return decodeResponse(response, VocabularyBasePackRegistrationFromApiToFront);
79611
81636
  }
81637
+ /**
81638
+ * Rebuild a tenant's semantic search index
81639
+ *
81640
+ * @param tenantId - The tenant.
81641
+ * @param requestOptions - Per-call cancellation, timeout and request options.
81642
+ * @returns The engine's answer as `RebuildSemanticIndexResponse`, camelCase.
81643
+ * @throws {ApiError} 403: Another tenant, without the provisioning identity
81644
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
81645
+ * @throws {ApiError} 500: The terms could not be read
81646
+ *
81647
+ * @remarks Uses POST `/api/v1/admin/semantic-index/rebuild/{tenant_id}`.
81648
+ * Embeds again, with the configured embedding model, every persisted term of the tenant whose
81649
+ * semantic search point is missing or holds other content; points already identical are skipped.
81650
+ * Use after the embedding model changed (the collection is created again at the new dimension),
81651
+ * after a vector store restore, or after failed indexing. Idempotent: a second call after a
81652
+ * complete one embeds nothing. `failed` counts terms of pages that could not be indexed; call
81653
+ * again to retry them.
81654
+ *
81655
+ * @example
81656
+ * ```typescript
81657
+ * await client.admin.rebuildSemanticIndex(tenantId);
81658
+ * ```
81659
+ */
81660
+ async rebuildSemanticIndex(tenantId, requestOptions) {
81661
+ const response = await this.api.rebuildSemanticIndex(tenantId, toRequestParams(requestOptions));
81662
+ return decodeResponse(response, RebuildSemanticIndexResponseFromApiToFront);
81663
+ }
81664
+ /**
81665
+ * Erase a tenant's conversation records (temporary)
81666
+ *
81667
+ * @param tenantId - The tenant.
81668
+ * @param options - `dryRun`: Count what would be erased, and erase nothing.; `limit`: At most this many conversations.
81669
+ * @param requestOptions - Per-call cancellation, timeout and request options.
81670
+ * @returns The engine's answer as `ConversationEraseResponse`, camelCase.
81671
+ * @throws {ApiError} 403: Forbidden (not the provisioning identity)
81672
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
81673
+ * @throws {ApiError} 503: The records could not be read or removed, or exceed the erase ceiling
81674
+ *
81675
+ * @remarks Uses POST `/api/v1/admin/tenants/{tenant_id}/conversations/erase`.
81676
+ * Requires the gateway provisioning identity. Counts (dry_run, the default) or removes one batch
81677
+ * of a tenant's conversation records: sessions, conversations, turns, ratings, preferences,
81678
+ * layouts, templates, intents, quoted frames, learned definitions and their preflights,
81679
+ * certifications, the promotion policy, reports, evidence, working state, the session graph's
81680
+ * conversation memory, and definition eligibility goals. The tenant, its vocabulary, knowledge and
81681
+ * authorization rules stay. Answers counts only. Removed once every deployment has run it.
81682
+ *
81683
+ * @example
81684
+ * ```typescript
81685
+ * const report = await client.admin.eraseConversations(tenantId, { dryRun: true });
81686
+ * ```
81687
+ */
81688
+ async eraseConversations(tenantId, options = {}, requestOptions) {
81689
+ const response = await this.api.eraseConversations(
81690
+ tenantId,
81691
+ { dry_run: options.dryRun, limit: options.limit },
81692
+ toRequestParams(requestOptions)
81693
+ );
81694
+ return decodeResponse(response, ConversationEraseResponseFromApiToFront);
81695
+ }
79612
81696
  };
79613
81697
 
79614
81698
  // src/normalizers/image-extraction.ts
@@ -80158,7 +82242,8 @@ function ProvenanceDtoFromApiToFront(dto) {
80158
82242
  return {
80159
82243
  description: dto.description,
80160
82244
  location: dto.location,
80161
- sourceFactId: dto.source_fact_id
82245
+ sourceFactId: dto.source_fact_id,
82246
+ ...dto.unconfirmed !== void 0 ? { unconfirmed: dto.unconfirmed } : {}
80162
82247
  };
80163
82248
  }
80164
82249
  function DiagnosticDtoFromApiToFront(dto) {
@@ -80203,7 +82288,8 @@ function GenerateDocumentRequestFromFrontToApi(model) {
80203
82288
  metadata: model.metadata,
80204
82289
  modality: model.modality,
80205
82290
  root_term_id: model.rootTermId,
80206
- tenant_id: model.tenantId
82291
+ tenant_id: model.tenantId,
82292
+ ...model.unconfirmedSupport === void 0 ? {} : { unconfirmed_support: model.unconfirmedSupport }
80207
82293
  };
80208
82294
  }
80209
82295
  function GenerateDocumentResponseFromApiToFront(dto) {
@@ -80571,6 +82657,9 @@ function extractQueryTimeMs(dto) {
80571
82657
  function extractDerivationComplete(dto) {
80572
82658
  return dto.derivation_complete === true;
80573
82659
  }
82660
+ function extractValidBefore(dto) {
82661
+ return dto.valid_before ?? void 0;
82662
+ }
80574
82663
  function extractRuleTermId(dto) {
80575
82664
  return dto.term.term_id;
80576
82665
  }
@@ -80661,14 +82750,19 @@ var OptimizeClient = class {
80661
82750
  },
80662
82751
  toRequestParams(requestOptions)
80663
82752
  );
80664
- const { queryTimeMs, solutions, derivationComplete } = decodeResponse(bcResponse, (dto) => ({
80665
- queryTimeMs: extractQueryTimeMs(dto),
80666
- solutions: dto.solutions.slice(),
80667
- derivationComplete: extractDerivationComplete(dto)
80668
- }));
82753
+ const { queryTimeMs, solutions, derivationComplete, validBefore } = decodeResponse(
82754
+ bcResponse,
82755
+ (dto) => ({
82756
+ queryTimeMs: extractQueryTimeMs(dto),
82757
+ solutions: dto.solutions.slice(),
82758
+ derivationComplete: extractDerivationComplete(dto),
82759
+ validBefore: extractValidBefore(dto)
82760
+ })
82761
+ );
82762
+ const validity = validBefore === void 0 ? {} : { validBefore };
80669
82763
  const solution = solutions[0];
80670
82764
  if (solution === void 0) {
80671
- return derivationComplete ? { status: "infeasible", solveTimeMs: queryTimeMs } : { status: "undetermined", solveTimeMs: queryTimeMs };
82765
+ return derivationComplete ? { status: "infeasible", solveTimeMs: queryTimeMs, ...validity } : { status: "undetermined", solveTimeMs: queryTimeMs, ...validity };
80672
82766
  }
80673
82767
  const variables = {};
80674
82768
  for (const binding of solution.substitution.bindings) {
@@ -80688,7 +82782,8 @@ var OptimizeClient = class {
80688
82782
  status: "optimal",
80689
82783
  variables,
80690
82784
  objectiveValue,
80691
- solveTimeMs: queryTimeMs
82785
+ solveTimeMs: queryTimeMs,
82786
+ ...validity
80692
82787
  };
80693
82788
  } finally {
80694
82789
  if (cleanup) {
@@ -81222,6 +83317,21 @@ var FlowNetworksClient = class {
81222
83317
  }
81223
83318
  };
81224
83319
 
83320
+ // src/normalizers/osfql-dependencies.ts
83321
+ function OsfqlDependenciesResponseFromApiToFront(dto) {
83322
+ return {
83323
+ exact: dto.exact,
83324
+ reason: dto.reason,
83325
+ sorts: dto.sorts.map((item0) => item0),
83326
+ watch: dto.watch
83327
+ };
83328
+ }
83329
+ function OsfqlDependenciesRequestFromFrontToApi(model) {
83330
+ return {
83331
+ query: model.query
83332
+ };
83333
+ }
83334
+
81225
83335
  // src/resources/osfql.ts
81226
83336
  var OsfqlClient = class {
81227
83337
  /** @internal */
@@ -81237,7 +83347,8 @@ var OsfqlClient = class {
81237
83347
  * @param options - Optional execution options. Set `reactive` to fire suspended
81238
83348
  * `AWAIT` demons whose triggers the program has just satisfied, and
81239
83349
  * `semantics: 'rdf'` to run a statement {@link SparqlClient.translateQuery}
81240
- * returned.
83350
+ * returned. Set `confirmExternal` when the person has confirmed this program's
83351
+ * open-web calls.
81241
83352
  * @param requestOptions - Per-call transport options (timeout, signal, headers).
81242
83353
  * @returns The execution result including variable bindings, created and
81243
83354
  * updated term IDs, defined sort IDs, diagnostics, and statement count.
@@ -81259,6 +83370,9 @@ var OsfqlClient = class {
81259
83370
  * `PREFIX p: <iri>;` that binds a bound prefix to another namespace, and a
81260
83371
  * `DEFINE` / `AGENT CREATE SORT` of a CURIE whose prefix the tenant does
81261
83372
  * not bind, are `execution` failures (HTTP 422); the program is rolled back.
83373
+ * @throws {OsfqlError} HTTP 428 with `errorType` equal to `boundary_needs_confirmation`
83374
+ * when a `SEARCH WEB` or `READ PAGE` requires a person's confirmation. Earlier
83375
+ * statements have already run. Execution stops at the statement requiring confirmation.
81262
83376
  * @throws {OsfqlError} With `errorType: 'lock_timeout'` (HTTP 503) when other
81263
83377
  * writers kept the tenant's knowledge base locked until the request
81264
83378
  * deadline. Nothing ran, so the program is safe to retry as is; a larger
@@ -81664,6 +83778,29 @@ var OsfqlClient = class {
81664
83778
  );
81665
83779
  return decodeResponse(response, OsfqlRepairResponseFromApiToFront);
81666
83780
  }
83781
+ /**
83782
+ * Name what a statement's answer depends on, without executing it.
83783
+ *
83784
+ * @param request - The request (`OsfqlDependenciesRequest`), camelCase; sent snake_case.
83785
+ * @param requestOptions - Per-call cancellation, timeout and request options.
83786
+ * @returns The engine's answer as `OsfqlDependenciesResponse`, camelCase.
83787
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
83788
+ * @throws {ApiError} 422: The statement does not parse or compile
83789
+ *
83790
+ * @remarks Uses POST `/api/v1/osfql/dependencies`.
83791
+ *
83792
+ * @example
83793
+ * ```typescript
83794
+ * const deps = await client.osfql.dependencies({ query: 'MATCH person(?X);' });
83795
+ * ```
83796
+ */
83797
+ async dependencies(request, requestOptions) {
83798
+ const response = await this.api.osfqlDependencies(
83799
+ OsfqlDependenciesRequestFromFrontToApi(request),
83800
+ toRequestParams(requestOptions)
83801
+ );
83802
+ return decodeResponse(response, OsfqlDependenciesResponseFromApiToFront);
83803
+ }
81667
83804
  };
81668
83805
  function rethrowOsfqlFailure(error) {
81669
83806
  if (error instanceof ApiError) {
@@ -81699,6 +83836,24 @@ var Conversation = class {
81699
83836
  format: "json",
81700
83837
  ...params
81701
83838
  });
83839
+ /**
83840
+ * No description
83841
+ *
83842
+ * @tags conversation
83843
+ * @name AttestConversationPoint
83844
+ * @summary `POST /api/v1/conversation/{id}/attestations`
83845
+ * @request POST:/api/v1/conversation/{id}/attestations
83846
+ * @secure
83847
+ */
83848
+ attestConversationPoint = (id, data, params = {}) => this.http.request({
83849
+ path: `/api/v1/conversation/${id}/attestations`,
83850
+ method: "POST",
83851
+ body: data,
83852
+ secure: true,
83853
+ type: "application/json",
83854
+ format: "json",
83855
+ ...params
83856
+ });
81702
83857
  /**
81703
83858
  * @description Delete a conversation and all its turns.
81704
83859
  *
@@ -81984,64 +84139,16 @@ var Conversation = class {
81984
84139
  });
81985
84140
  };
81986
84141
 
81987
- // src/utils/sse.ts
81988
- var FRAME_SEPARATORS = ["\r\n\r\n", "\n\n", "\r\r"];
81989
- var LINE_TERMINATOR = /\r\n|\n|\r/;
81990
- async function* readSseFrames(body) {
81991
- const reader = body.getReader();
81992
- const decoder = new TextDecoder();
81993
- let buffer = "";
81994
- try {
81995
- for (; ; ) {
81996
- const chunk = await reader.read();
81997
- if (chunk.done) break;
81998
- buffer += decoder.decode(chunk.value, { stream: true });
81999
- let boundary = findFrameBoundary(buffer);
82000
- while (boundary !== null) {
82001
- const frame = decodeFrame(buffer.slice(0, boundary.index));
82002
- buffer = buffer.slice(boundary.index + boundary.length);
82003
- if (frame !== null) yield frame;
82004
- boundary = findFrameBoundary(buffer);
82005
- }
82006
- }
82007
- buffer += decoder.decode();
82008
- const trailing = decodeFrame(buffer);
82009
- if (trailing !== null) yield trailing;
82010
- } finally {
82011
- await reader.cancel().catch(() => void 0);
82012
- }
82013
- }
82014
- function findFrameBoundary(buffer) {
82015
- let found = null;
82016
- for (const separator of FRAME_SEPARATORS) {
82017
- const index = buffer.indexOf(separator);
82018
- if (index === -1) continue;
82019
- if (found === null || index < found.index || index === found.index && separator.length > found.length) {
82020
- found = { index, length: separator.length };
82021
- }
82022
- }
82023
- return found;
82024
- }
82025
- function decodeFrame(text2) {
82026
- const dataLines = [];
82027
- let event;
82028
- for (const line of text2.split(LINE_TERMINATOR)) {
82029
- if (line === "" || line.startsWith(":")) continue;
82030
- const colon = line.indexOf(":");
82031
- const field = colon === -1 ? line : line.slice(0, colon);
82032
- const rawValue = colon === -1 ? "" : line.slice(colon + 1);
82033
- const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
82034
- if (field === "data") dataLines.push(value);
82035
- else if (field === "event") event = value;
82036
- }
82037
- const data = dataLines.join("\n");
82038
- if (data === "") return null;
82039
- return { event: event === "" ? void 0 : event, data };
82040
- }
82041
-
82042
84142
  // src/resources/conversation.ts
82043
84143
  var SSE_MEDIA_TYPE = "text/event-stream";
82044
- var STREAM_EVENTS = /* @__PURE__ */ new Set(["token", "done", "error"]);
84144
+ var STREAM_EVENTS = /* @__PURE__ */ new Set([
84145
+ "token",
84146
+ "step_start",
84147
+ "step_end",
84148
+ "claim",
84149
+ "done",
84150
+ "error"
84151
+ ]);
82045
84152
  var ConversationClient = class {
82046
84153
  /** @internal */
82047
84154
  http;
@@ -82112,6 +84219,8 @@ var ConversationClient = class {
82112
84219
  * {@link ConversationClient.sendMessage} takes.
82113
84220
  * @returns An async iterable of stream events, discriminated on `type`:
82114
84221
  * - `token` — a preview chunk (`delta`) of the answer text;
84222
+ * - `step_start`, `step_end` — a pipeline stage and its outcome;
84223
+ * - `claim` — one verified claim before the full answer;
82115
84224
  * - `done` — the complete response, identical to what `sendMessage`
82116
84225
  * returns for the turn. It is authoritative: replace the previewed text
82117
84226
  * with `response.assistantMessage`;
@@ -82163,14 +84272,14 @@ var ConversationClient = class {
82163
84272
  * })) {
82164
84273
  * if (event.type === 'token') preview += event.delta;
82165
84274
  * else if (event.type === 'done') preview = event.response.assistantMessage;
82166
- * else if (event.status !== undefined) {
84275
+ * else if (event.type === 'error' && event.status !== undefined) {
82167
84276
  * // The same class sendMessage throws: InternalServerError for 500, ...
82168
84277
  * throw createApiError(
82169
84278
  * event.status,
82170
84279
  * { error: event.error, message: event.error },
82171
84280
  * new Headers(),
82172
84281
  * );
82173
- * } else throw new Error(event.error);
84282
+ * } else if (event.type === 'error') throw new Error(event.error);
82174
84283
  * }
82175
84284
  * ```
82176
84285
  */
@@ -82183,31 +84292,7 @@ var ConversationClient = class {
82183
84292
  secure: true,
82184
84293
  type: "application/json"
82185
84294
  });
82186
- const body = response.body;
82187
- if (body === null) {
82188
- throw new NetworkError("Conversation stream response carried no event stream");
82189
- }
82190
- for await (const frame of readSseFrames(body)) {
82191
- if (frame.event === void 0 || !STREAM_EVENTS.has(frame.event)) continue;
82192
- let payload;
82193
- try {
82194
- payload = JSON.parse(frame.data);
82195
- } catch (error) {
82196
- throw new NetworkError(
82197
- `Conversation stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
82198
- error instanceof Error ? error : void 0
82199
- );
82200
- }
82201
- const event = ConversationStreamEventFromApiToFront(frame.event, payload);
82202
- if (event === null) {
82203
- throw new NetworkError(
82204
- `Conversation stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
82205
- );
82206
- }
82207
- yield event;
82208
- if (event.type !== "token") return;
82209
- }
82210
- throw new NetworkError("Conversation stream ended without a done or error event");
84295
+ yield* readConversationStream(response.body);
82211
84296
  }
82212
84297
  /**
82213
84298
  * List recent conversations for the authenticated user.
@@ -82303,6 +84388,115 @@ var ConversationClient = class {
82303
84388
  });
82304
84389
  return decodeResponse(response, (dto) => (dto ?? []).map(CompareModelDtoFromApiToFront));
82305
84390
  }
84391
+ /**
84392
+ * Read the caller's private transcript with a published agent on one Frame page.
84393
+ *
84394
+ * @param agentId - The published agent (UUID).
84395
+ * @param binding - The Frame page: `frameId`, `page`, the current published
84396
+ * `pageVersion`, and optionally the `conversationId` and an `offset`.
84397
+ * @param requestOptions - Per-call cancellation, timeout and request options.
84398
+ * @returns The transcript, or `null` when no consultation has started there.
84399
+ * @throws {ApiError} 400 for an invalid Frame page binding; 403 when the named
84400
+ * agent grant is absent or revoked; 404 when the current Frame, binding or
84401
+ * pinned consultation is unavailable.
84402
+ *
84403
+ * @remarks Uses GET `/api/v1/conversation/agents/{agent_id}/frame/turns`.
84404
+ *
84405
+ * @example
84406
+ * ```typescript
84407
+ * const transcript = await client.conversation.getFrameAgentTurns(agentId, {
84408
+ * frameId, page: 'home', pageVersion: 3,
84409
+ * });
84410
+ * ```
84411
+ */
84412
+ async getFrameAgentTurns(agentId, binding, requestOptions) {
84413
+ const response = await this.api.getFrameAgentTurns(
84414
+ agentId,
84415
+ {
84416
+ frame_id: binding.frameId,
84417
+ page: binding.page,
84418
+ page_version: binding.pageVersion,
84419
+ conversation_id: binding.conversationId,
84420
+ offset: binding.offset
84421
+ },
84422
+ toRequestParams(requestOptions)
84423
+ );
84424
+ return decodeResponse(
84425
+ response,
84426
+ (dto) => dto === null ? null : ConversationTurnsResponseFromApiToFront(dto)
84427
+ );
84428
+ }
84429
+ /**
84430
+ * Read the caller's accessible consultations with a published agent on one Work task.
84431
+ *
84432
+ * @param agentId - The published agent (UUID).
84433
+ * @param scope - The task (`taskId`), and optionally one `conversationId` and an `offset`.
84434
+ * @param requestOptions - Per-call cancellation, timeout and request options.
84435
+ * @returns One transcript per consultation the caller can read.
84436
+ * @throws {ApiError} If the engine refuses the read.
84437
+ *
84438
+ * @remarks Uses GET `/api/v1/conversation/agents/{agent_id}/task/turns`.
84439
+ *
84440
+ * @example
84441
+ * ```typescript
84442
+ * const consultations = await client.conversation.getTaskAgentTurns(agentId, { taskId });
84443
+ * ```
84444
+ */
84445
+ async getTaskAgentTurns(agentId, scope, requestOptions) {
84446
+ const response = await this.api.getTaskAgentTurns(
84447
+ agentId,
84448
+ { task_id: scope.taskId, conversation_id: scope.conversationId, offset: scope.offset },
84449
+ toRequestParams(requestOptions)
84450
+ );
84451
+ return decodeResponse(response, (dto) => dto.map(ConversationTurnsResponseFromApiToFront));
84452
+ }
84453
+ /**
84454
+ * Send one message to a published agent and stream its answer, as
84455
+ * {@link ConversationClient.sendMessageStream} streams the assistant's.
84456
+ *
84457
+ * @param agentId - The published agent (UUID).
84458
+ * @param request - The message, as for `sendMessageStream`.
84459
+ * @param context - Where the consultation happens: a Frame page (`frameId`,
84460
+ * `page`, `pageVersion`) or a Work task (`taskId`, with `asLead` to require
84461
+ * the current task lead).
84462
+ * @param requestOptions - Per-call cancellation, timeout and request options.
84463
+ * @returns The same `token`, `done` and `error` events as `sendMessageStream`.
84464
+ * @throws {ApiError} 403 when the named agent grant is absent or revoked; 404
84465
+ * when no published agent of that id is in this Space.
84466
+ * @throws {NetworkError} When the stream carries no event stream, a malformed
84467
+ * event, or ends without a `done` or `error` event.
84468
+ *
84469
+ * @remarks
84470
+ * Uses POST `/api/v1/conversation/agents/{agent_id}/message/stream`
84471
+ * (`text/event-stream`). The conversation's kind is `agent_consultation`.
84472
+ *
84473
+ * @example
84474
+ * ```typescript
84475
+ * for await (const event of client.conversation.sendAgentMessageStream(agentId, {
84476
+ * message: 'Summarise the open risks.',
84477
+ * }, { taskId })) {
84478
+ * if (event.type === 'done') console.log(event.response.assistantMessage);
84479
+ * }
84480
+ * ```
84481
+ */
84482
+ async *sendAgentMessageStream(agentId, request, context = {}, requestOptions) {
84483
+ const response = await this.http.request({
84484
+ ...mergeRequestParams({ headers: { Accept: SSE_MEDIA_TYPE } }, requestOptions),
84485
+ path: `/api/v1/conversation/agents/${encodeURIComponent(agentId)}/message/stream`,
84486
+ method: "POST",
84487
+ query: {
84488
+ frame_id: context.frameId,
84489
+ page: context.page,
84490
+ page_version: context.pageVersion,
84491
+ task_id: context.taskId,
84492
+ as_lead: context.asLead
84493
+ },
84494
+ body: ConversationMessageRequestFromFrontToApi(request),
84495
+ secure: true,
84496
+ type: "application/json"
84497
+ });
84498
+ yield* readConversationStream(response.body);
84499
+ }
82306
84500
  /**
82307
84501
  * Get all turns for a conversation.
82308
84502
  *
@@ -82457,6 +84651,29 @@ var ConversationClient = class {
82457
84651
  });
82458
84652
  return decodeResponse(response, ConversationAnswerFeedbackResponseFromApiToFront);
82459
84653
  }
84654
+ /**
84655
+ * Confirm a point on an answer or report an error as the conversation's owner.
84656
+ * @param conversationId - The conversation containing the answer.
84657
+ * @param request - Answer turn, point reference and judgment.
84658
+ * @param requestOptions - Per-call transport overrides.
84659
+ * @returns The stored judgment with the signer and timestamp recorded by the engine.
84660
+ * @throws {ForbiddenError} If an agent or service account tries to attest.
84661
+ * @throws {NotFoundError} If the caller cannot see that answer or point.
84662
+ * @throws {ApiError} If the request fails.
84663
+ * @remarks The request contains `turn_id`, `point_ref` and `kind`. Authentication supplies the signer.
84664
+ * @example
84665
+ * ```typescript
84666
+ * await client.conversation.attestPoint(conversationId, { turnId, pointRef, kind: 'confirmed' });
84667
+ * ```
84668
+ */
84669
+ async attestPoint(conversationId, request, requestOptions) {
84670
+ const response = await this.api.attestConversationPoint(
84671
+ conversationId,
84672
+ ClaimAttestationRequestFromFrontToApi(request),
84673
+ toRequestParams(requestOptions)
84674
+ );
84675
+ return decodeResponse(response, ClaimAttestationResponseFromApiToFront);
84676
+ }
82460
84677
  /**
82461
84678
  * Get the session memory graph for a conversation.
82462
84679
  *
@@ -82539,6 +84756,32 @@ var ConversationClient = class {
82539
84756
  return decodeResponse(response, ConversationSummaryDtoFromApiToFront);
82540
84757
  }
82541
84758
  };
84759
+ async function* readConversationStream(body) {
84760
+ if (body === null) {
84761
+ throw new NetworkError("Conversation stream response carried no event stream");
84762
+ }
84763
+ for await (const frame of readSseFrames(body)) {
84764
+ if (frame.event === void 0 || !STREAM_EVENTS.has(frame.event)) continue;
84765
+ let payload;
84766
+ try {
84767
+ payload = JSON.parse(frame.data);
84768
+ } catch (error) {
84769
+ throw new NetworkError(
84770
+ `Conversation stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
84771
+ error instanceof Error ? error : void 0
84772
+ );
84773
+ }
84774
+ const event = ConversationStreamEventFromApiToFront(frame.event, payload);
84775
+ if (event === null) {
84776
+ throw new NetworkError(
84777
+ `Conversation stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
84778
+ );
84779
+ }
84780
+ yield event;
84781
+ if (event.type === "done" || event.type === "error") return;
84782
+ }
84783
+ throw new NetworkError("Conversation stream ended without a done or error event");
84784
+ }
82542
84785
 
82543
84786
  // src/normalizers/verification.ts
82544
84787
  var CLAIM_KINDS = [
@@ -82862,6 +85105,7 @@ function SearchPapersResponseFromApiToFront(dto) {
82862
85105
  function CreateResearchSessionResponseFromApiToFront(dto) {
82863
85106
  return {
82864
85107
  sessionId: dto.session_id,
85108
+ knowledgeBaseTenantId: dto.knowledge_base_tenant_id ?? null,
82865
85109
  status: dto.status,
82866
85110
  question: dto.question,
82867
85111
  createdAt: dto.created_at
@@ -82886,6 +85130,7 @@ function ResearchCycleResultFromApiToFront(dto) {
82886
85130
  function ResearchSessionResponseFromApiToFront(dto) {
82887
85131
  return {
82888
85132
  sessionId: dto.session_id,
85133
+ knowledgeBaseTenantId: dto.knowledge_base_tenant_id ?? null,
82889
85134
  question: dto.question,
82890
85135
  status: dto.status,
82891
85136
  error: dto.error ?? null,
@@ -85061,6 +87306,88 @@ var UiClient = class {
85061
87306
  const response = await this.api.uiCatalog(toRequestParams(requestOptions));
85062
87307
  return decodeResponse(response, UICatalogResponseFromApiToFront);
85063
87308
  }
87309
+ /**
87310
+ * addFrameConsultant
87311
+ *
87312
+ * @param name - The saved page.
87313
+ * @param agentId - The agent (UUID).
87314
+ * @param request - The request (`AddFrameConsultant`), camelCase; sent snake_case.
87315
+ * @param requestOptions - Per-call cancellation, timeout and request options.
87316
+ * @returns The engine's answer as `FrameConsultantRevision`, camelCase.
87317
+ * @throws {ApiError} 403: Agent or page edit denied
87318
+ * @throws {ApiError} 404: Published agent or page unavailable
87319
+ * @throws {ApiError} 409: The page already changed
87320
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
87321
+ * @throws {ApiError} 422: The section is missing, ambiguous, or cannot contain a consultation
87322
+ *
87323
+ * @remarks Uses POST `/api/v1/ui/pages/{name}/consultant/{agent_id}`.
87324
+ *
87325
+ * @example
87326
+ * ```typescript
87327
+ * await client.ui.addFrameConsultant("home", agentId, request);
87328
+ * ```
87329
+ */
87330
+ async addFrameConsultant(name, agentId, request, requestOptions) {
87331
+ const response = await this.api.addFrameConsultant(
87332
+ name,
87333
+ agentId,
87334
+ AddFrameConsultantFromFrontToApi(request),
87335
+ toRequestParams(requestOptions)
87336
+ );
87337
+ return decodeResponse(response, FrameConsultantRevisionFromApiToFront);
87338
+ }
87339
+ /**
87340
+ * Restore a saved layout as the next version of the same Frame page.
87341
+ *
87342
+ * @param name - The saved page.
87343
+ * @param request - The request (`RestoreFramePageRequest`), camelCase; sent snake_case.
87344
+ * @param requestOptions - Per-call cancellation, timeout and request options.
87345
+ * @returns The engine's answer as `RestoreFramePageResponse`, camelCase.
87346
+ * @throws {ApiError} 400: The requested version is not earlier than the expected current version
87347
+ * @throws {ApiError} 403: This caller cannot write to the Frame or its current page
87348
+ * @throws {ApiError} 404: The Frame or selected page version is unavailable
87349
+ * @throws {ApiError} 409: The current page version changed
87350
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
87351
+ *
87352
+ * @remarks Uses POST `/api/v1/ui/pages/{name}/restore`.
87353
+ *
87354
+ * @example
87355
+ * ```typescript
87356
+ * await client.ui.restoreFramePage("home", request);
87357
+ * ```
87358
+ */
87359
+ async restoreFramePage(name, request, requestOptions) {
87360
+ const response = await this.api.restoreFramePage(
87361
+ name,
87362
+ RestoreFramePageRequestFromFrontToApi(request),
87363
+ toRequestParams(requestOptions)
87364
+ );
87365
+ return decodeResponse(response, RestoreFramePageResponseFromApiToFront);
87366
+ }
87367
+ /**
87368
+ * listFrameTableSources
87369
+ *
87370
+ * @param frameId - The Frame.
87371
+ * @param options - `offset`: Sources to skip.; `search`: Filter by name.
87372
+ * @param requestOptions - Per-call cancellation, timeout and request options.
87373
+ * @returns The engine's answer as `UIFrameTableSources`, camelCase.
87374
+ * @throws {ApiError} 404: Frame unavailable
87375
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
87376
+ *
87377
+ * @remarks Uses GET `/api/v1/ui/table-sources`.
87378
+ *
87379
+ * @example
87380
+ * ```typescript
87381
+ * const { sources } = await client.ui.listFrameTableSources(frameId);
87382
+ * ```
87383
+ */
87384
+ async listFrameTableSources(frameId, options = {}, requestOptions) {
87385
+ const response = await this.api.frameTableSources(
87386
+ { frame_id: frameId, offset: options.offset, search: options.search },
87387
+ toRequestParams(requestOptions)
87388
+ );
87389
+ return decodeResponse(response, UIFrameTableSourcesFromApiToFront);
87390
+ }
85064
87391
  };
85065
87392
 
85066
87393
  // src/normalizers/compliance.ts
@@ -86160,10 +88487,8 @@ var SnapshotsClient = class {
86160
88487
  * @throws {@link ApiError} 404 when it does not exist; 501 when the engine runs in memory.
86161
88488
  *
86162
88489
  * @remarks
86163
- * The envelope (`format: "reasoninglayer-snapshot"`, with
86164
- * `metadata.reasoninglayer_version`) is opaque: the engine declares no schema for it, and its
86165
- * shape is the engine's to change. Treat it as a blob to hand back to
86166
- * {@link SnapshotsClient.import}, not as something to read fields out of.
88490
+ * Metadata uses the engine’s wire keys. The data payload preserves record keys
88491
+ * verbatim for offline storage and {@link SnapshotsClient.import}.
86167
88492
  *
86168
88493
  * @example
86169
88494
  * ```typescript
@@ -88158,7 +90483,8 @@ function ExecuteTranspiledResponseFromApiToFront(dto) {
88158
90483
  rowCount: dto.row_count,
88159
90484
  query: dto.query,
88160
90485
  dialect: dto.dialect,
88161
- sourceId: dto.source_id
90486
+ sourceId: dto.source_id,
90487
+ completeness: dto.completeness
88162
90488
  };
88163
90489
  }
88164
90490
  function TranspileRequestFromFrontToApi(model) {
@@ -88191,6 +90517,10 @@ var OntologyBridgeClient = class {
88191
90517
  * columns, and per-feature column mappings.
88192
90518
  * @returns Whether the binding succeeded plus the bound sort and table names.
88193
90519
  * @throws {ApiError} If the request fails.
90520
+ * @throws {InternalServerError} `502` with `errorBodyCode(e)` `source_query_failed` or
90521
+ * `source_stream_failed`, or `504` `source_timeout`, when the discovery or
90522
+ * key-count read the bind runs did not reach the end of the source's
90523
+ * answer (`LiveSourceErrorCode`, reasoninglayer#1218).
88194
90524
  *
88195
90525
  * @remarks
88196
90526
  * Sent to `POST /api/v1/ontology/bindings`. Request/response use the
@@ -88433,11 +90763,18 @@ var OntologyBridgeClient = class {
88433
90763
  * source, and the source's type decides the dialect.
88434
90764
  * @param requestOptions - Per-call request options.
88435
90765
  * @returns The rows the source returned, the native query that fetched them,
88436
- * its dialect, and the source id.
90766
+ * its dialect, the source id, and `completeness: 'complete'`: the rows are
90767
+ * the source's whole answer, so an empty list is a source with no rows.
88437
90768
  * @throws {NotFoundError} If a scanned sort does not exist, or has no binding
88438
90769
  * (404; the message says which).
88439
90770
  * @throws {ApiError} With `status` 422 if the query's sorts are bound to two
88440
90771
  * different sources, or 500 if the binding store cannot be read.
90772
+ * @throws {InternalServerError} `502` with `errorBodyCode(e)` `source_query_failed`
90773
+ * (the source refused or failed the query, or could not be reached) or
90774
+ * `source_stream_failed` (its row stream failed before its end), or `504`
90775
+ * `source_timeout` (the read passed the source's `query_timeout_secs`):
90776
+ * no partial rows are returned (`LiveSourceErrorCode`,
90777
+ * reasoninglayer#1213). `501` if the source has no native query backend.
88441
90778
  *
88442
90779
  * @remarks
88443
90780
  * Sent to `POST /api/v1/ontology/query`. The response uses the snake_case
@@ -89309,6 +91646,16 @@ var PropertyGraphClient = class _PropertyGraphClient {
89309
91646
  * @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
89310
91647
  * defined sort IDs, diagnostics, compatibility notes, and the statement count.
89311
91648
  * @throws {ApiError} If the query cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
91649
+ * @throws {ForbiddenError} `403` when a write or delete the translated
91650
+ * program makes is denied; `body.error_type` names why:
91651
+ * `reserved_sort_write_refused`, `reserved_sort_delete_refused`,
91652
+ * `sort_write_not_granted`, `sort_delete_not_granted`,
91653
+ * `operational_authority_denied` or `operational_authority_undetermined`.
91654
+ * Nothing is written.
91655
+ * @throws {ConstraintViolationError} `409` when the program mutates governed
91656
+ * schema, or writes or removes a term of a `@governed` sort
91657
+ * (`error_type: governed_sort_write_refused`) or a derived authority
91658
+ * relation (`authz_relation_derived`). Nothing is written.
89312
91659
  * @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
89313
91660
  * published {@link PropertyGraphValue} contract.
89314
91661
  *
@@ -89340,6 +91687,16 @@ var PropertyGraphClient = class _PropertyGraphClient {
89340
91687
  * @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
89341
91688
  * defined sort IDs, diagnostics, compatibility notes, and the statement count.
89342
91689
  * @throws {ApiError} If the query cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
91690
+ * @throws {ForbiddenError} `403` when a write or delete the translated
91691
+ * program makes is denied; `body.error_type` names why:
91692
+ * `reserved_sort_write_refused`, `reserved_sort_delete_refused`,
91693
+ * `sort_write_not_granted`, `sort_delete_not_granted`,
91694
+ * `operational_authority_denied` or `operational_authority_undetermined`.
91695
+ * Nothing is written.
91696
+ * @throws {ConstraintViolationError} `409` when the program mutates governed
91697
+ * schema, or writes or removes a term of a `@governed` sort
91698
+ * (`error_type: governed_sort_write_refused`) or a derived authority
91699
+ * relation (`authz_relation_derived`). Nothing is written.
89343
91700
  * @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
89344
91701
  * published {@link PropertyGraphValue} contract.
89345
91702
  *
@@ -89371,6 +91728,16 @@ var PropertyGraphClient = class _PropertyGraphClient {
89371
91728
  * @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
89372
91729
  * defined sort IDs, diagnostics, compatibility notes, and the statement count.
89373
91730
  * @throws {ApiError} If the traversal cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
91731
+ * @throws {ForbiddenError} `403` when a write or delete the translated
91732
+ * program makes is denied; `body.error_type` names why:
91733
+ * `reserved_sort_write_refused`, `reserved_sort_delete_refused`,
91734
+ * `sort_write_not_granted`, `sort_delete_not_granted`,
91735
+ * `operational_authority_denied` or `operational_authority_undetermined`.
91736
+ * Nothing is written.
91737
+ * @throws {ConstraintViolationError} `409` when the program mutates governed
91738
+ * schema, or writes or removes a term of a `@governed` sort
91739
+ * (`error_type: governed_sort_write_refused`) or a derived authority
91740
+ * relation (`authz_relation_derived`). Nothing is written.
89374
91741
  * @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
89375
91742
  * published {@link PropertyGraphValue} contract.
89376
91743
  *
@@ -89783,8 +92150,22 @@ var SparqlClient = class {
89783
92150
  * @throws {InternalServerError} `502` when a `LOAD` names a source the SSRF guard
89784
92151
  * blocks (a private or loopback address, a loopback host name such as
89785
92152
  * `localhost`, or a refused scheme): `LOAD could not retrieve <…>`.
92153
+ * @throws {ForbiddenError} `403` when a term the update writes or removes is
92154
+ * in the reserved namespace or outside the caller's grants (`error_type`
92155
+ * `reserved_sort_write_refused`, `sort_write_not_granted`,
92156
+ * `reserved_sort_delete_refused`, `sort_delete_not_granted`).
92157
+ * @throws {ConstraintViolationError} `409` when a term it writes or removes
92158
+ * is of a `@governed` sort (`governed_sort_write_refused`) or is a derived
92159
+ * authority relation (`authz_relation_derived`); when its prefixes conflict
92160
+ * with a binding another request made meanwhile (`prefix_conflict`); or
92161
+ * when an IRI-valued `INSERT DATA` names a resource the caller's Read grant
92162
+ * hides (`term_id_unavailable`, reasoninglayer#1215).
92163
+ * @throws {ApiError} `422` when a term it writes wraps a constraint the
92164
+ * update cannot read (`error_type: filing_term_unread`).
92165
+ *
92166
+ * @remarks
92167
+ * A refused update applies nothing of the update (reasoninglayer#1214).
89786
92168
  *
89787
- * @remarks
89788
92169
  * Supports `INSERT DATA` / `DELETE DATA` and `DELETE/INSERT … WHERE`; the update maps
89789
92170
  * onto tenant-scoped OSFQL `INSERT` / `RETRACT` statements. The update text is sent as
89790
92171
  * an `application/x-www-form-urlencoded` body (`update=…`).
@@ -90253,6 +92634,36 @@ function CheckDocumentResponseFromApiToFront(dto) {
90253
92634
  function CheckPassFromApiToFront(dto) {
90254
92635
  return { pass: dto.pass, status: dto.status, reason: dto.reason };
90255
92636
  }
92637
+ function ClausePolicyProposalFromFrontToApi(model) {
92638
+ return {
92639
+ evidence_sort: model.evidenceSort,
92640
+ result_sort: model.resultSort,
92641
+ branches: model.branches.map((branch) => ({
92642
+ name: branch.name,
92643
+ effect: branch.effect,
92644
+ quote: branch.quote,
92645
+ conditions: branch.conditions.map((condition) => ({
92646
+ feature: condition.feature,
92647
+ comparison: condition.comparison,
92648
+ value: condition.value,
92649
+ quote: condition.quote
92650
+ }))
92651
+ }))
92652
+ };
92653
+ }
92654
+ function ClausePolicyDraftRequestFromFrontToApi(model) {
92655
+ return {
92656
+ policy: ClausePolicyProposalFromFrontToApi(model.policy),
92657
+ ...model.supportingClauseIds !== void 0 ? { supporting_clause_ids: model.supportingClauseIds } : {}
92658
+ };
92659
+ }
92660
+ function ClausePolicyDraftFromApiToFront(dto) {
92661
+ return {
92662
+ sourceDocumentId: dto.source_document_id,
92663
+ sourceClauseId: dto.source_clause_id,
92664
+ rlql: dto.rlql
92665
+ };
92666
+ }
90256
92667
 
90257
92668
  // src/resources/document-check.ts
90258
92669
  var DocumentCheckClient = class {
@@ -90306,6 +92717,60 @@ var DocumentCheckClient = class {
90306
92717
  );
90307
92718
  return decodeResponse(response, CheckDocumentResponseFromApiToFront);
90308
92719
  }
92720
+ /**
92721
+ * Compile a reading of one extracted clause into unpublished RLQL, without
92722
+ * writing any fact or rule.
92723
+ *
92724
+ * @param documentId - The source document (UUID).
92725
+ * @param clauseId - The extracted clause the reading interprets (UUID).
92726
+ * @param request - The reading (`policy`) and other clauses of the same
92727
+ * document revision that support it.
92728
+ * @param requestOptions - Per-call request options.
92729
+ * @returns The source-anchored draft: the document, the clause and the RLQL.
92730
+ * @throws {BadRequestError} `400` if the clause selection exceeds the
92731
+ * resolution budget.
92732
+ * @throws {NotFoundError} `404` if the document or the clause is unavailable.
92733
+ * @throws {ApiError} `422` if the reading is invalid for its sorts.
92734
+ * @throws {ServiceUnavailableError} `503` if the tenant hierarchy is
92735
+ * unavailable.
92736
+ *
92737
+ * @remarks
92738
+ * Sent to `POST /api/v1/documents/{document_id}/clauses/{clause_id}/policy-draft`.
92739
+ * Plain JSON, snake_case on the wire (`evidence_sort`, `result_sort`,
92740
+ * `supporting_clause_ids`); condition values are a JSON boolean or integer.
92741
+ * A reviewer publishes the draft through the ordinary OSFQL route, under its
92742
+ * own authorization; this call writes nothing.
92743
+ *
92744
+ * @example
92745
+ * ```typescript
92746
+ * const draft = await client.documentCheck.draftClausePolicy(documentId, clauseId, {
92747
+ * policy: {
92748
+ * evidenceSort: 'invoice_case',
92749
+ * resultSort: 'invoice_policy_result',
92750
+ * branches: [
92751
+ * {
92752
+ * name: 'late',
92753
+ * effect: 'penalty_due',
92754
+ * quote: 'a penalty is due',
92755
+ * conditions: [
92756
+ * { feature: 'days_late', comparison: 'gt', value: 30, quote: 'more than thirty days' },
92757
+ * ],
92758
+ * },
92759
+ * ],
92760
+ * },
92761
+ * });
92762
+ * console.log(draft.rlql);
92763
+ * ```
92764
+ */
92765
+ async draftClausePolicy(documentId, clauseId, request, requestOptions) {
92766
+ const response = await this.api.draftClausePolicy(
92767
+ documentId,
92768
+ clauseId,
92769
+ ClausePolicyDraftRequestFromFrontToApi(request),
92770
+ toRequestParams(requestOptions)
92771
+ );
92772
+ return decodeResponse(response, ClausePolicyDraftFromApiToFront);
92773
+ }
90309
92774
  };
90310
92775
 
90311
92776
  // src/normalizers/corpus.ts
@@ -92818,7 +95283,7 @@ var AguiClient = class {
92818
95283
  * writes the store is refused without an exception or a `RUN_ERROR`: the
92819
95284
  * run emits a `CUSTOM` event named `reasoninglayer.data_load_error` whose `value` is
92820
95285
  * `{ code, message, query }`, and the `STATE_SNAPSHOT` carries the same
92821
- * object at `reasoninglayer.dataLoadError`; branch on `code`. No rows are loaded.
95286
+ * object at `snapshot.reasoninglayer.dataLoadError`; branch on `code`. No rows are loaded.
92822
95287
  *
92823
95288
  * @example
92824
95289
  * ```typescript
@@ -93114,9 +95579,7 @@ var ArgumentationClient = class {
93114
95579
 
93115
95580
  // src/normalizers/demo.ts
93116
95581
  function DemoSeedRequestFromFrontToApi(model) {
93117
- const dto = {};
93118
- if (model.sumoDir !== void 0) dto.sumo_dir = model.sumoDir;
93119
- return dto;
95582
+ return { ...model };
93120
95583
  }
93121
95584
  function DemoSeedResponseFromApiToFront(dto) {
93122
95585
  return {
@@ -93137,17 +95600,36 @@ var DemoClient = class {
93137
95600
  * Seed the request tenant's persistent substrate with full SUMO + the
93138
95601
  * demo scenario situations.
93139
95602
  *
93140
- * @param request - Optional SUMO source-directory override.
95603
+ * @param request - The empty request body (`{}`). The request names no
95604
+ * SUMO directory: the engine reads its own (reasoninglayer#1229).
95605
+ * @param requestOptions - Per-call request options.
93141
95606
  * @returns The imported form count and the tenant's total sort count.
93142
95607
  *
93143
- * @throws {ApiError} `404` if the SUMO files cannot be read, `400` if
93144
- * the assembled source fails to import.
95608
+ * @throws {NotFoundError} `404` with `errorBodyCode(e) ===
95609
+ * 'demo_corpus_unavailable'` if the deployment's SUMO files cannot be
95610
+ * read; the answer names no server path.
95611
+ * @throws {ApiError} `400` if the assembled source fails to import.
95612
+ * @throws {GovernanceRefusedError} When the write guard refuses a fact,
95613
+ * individual or rule the seed writes; nothing of the seed is stored.
95614
+ * `403` `reserved_sort_write_refused`, `sort_write_not_granted`,
95615
+ * `operational_authority_denied` or `operational_authority_undetermined`;
95616
+ * `409` `authz_relation_derived`; `422`
95617
+ * `operational_rule_conclusion`, `authz_rule_shape`,
95618
+ * `authz_parent_of_sort_refused` or `filing_term_unread` (#1227).
95619
+ * @throws {VocabularyRefusedError} `409` `governed_sort_write_refused`: that
95620
+ * code is in the vocabulary set too, which the SDK reads first.
95621
+ *
95622
+ * @remarks
95623
+ * Sent to `POST /api/v1/demo/seed` with the body `{}`; the engine refuses
95624
+ * an unknown field with `422`.
95625
+ *
95626
+ * @example
95627
+ * ```typescript
95628
+ * const { forms, sorts } = await client.demo.seed();
95629
+ * ```
93145
95630
  */
93146
95631
  async seed(request = {}, requestOptions) {
93147
- const response = await this.api.demoSeed(
93148
- DemoSeedRequestFromFrontToApi(request),
93149
- toRequestParams(requestOptions)
93150
- );
95632
+ const response = await this.api.demoSeed(DemoSeedRequestFromFrontToApi(request), toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
93151
95633
  return decodeResponse(response, DemoSeedResponseFromApiToFront);
93152
95634
  }
93153
95635
  };
@@ -95455,6 +97937,19 @@ var ConnectorsClient = class {
95455
97937
  };
95456
97938
 
95457
97939
  // src/normalizers/boundary.ts
97940
+ var decisionCodes = [
97941
+ "boundary_space_invalid",
97942
+ "boundary_registry_unreadable",
97943
+ "boundary_no_caller_credential",
97944
+ "boundary_space_forbidden",
97945
+ "boundary_policy_unreadable",
97946
+ "boundary_entry_not_allowed",
97947
+ "boundary_data_class_not_allowed",
97948
+ "egress_denied",
97949
+ "boundary_needs_confirmation",
97950
+ "boundary_quota_exhausted",
97951
+ "boundary_quota_unreadable"
97952
+ ];
95458
97953
  var privacyModes = ["off", "user", "required"];
95459
97954
  function mapEntries(record3, map) {
95460
97955
  return Object.fromEntries(
@@ -95465,7 +97960,9 @@ function mapEntries(record3, map) {
95465
97960
  );
95466
97961
  }
95467
97962
  function grantFromApi(dto) {
95468
- const grant = {};
97963
+ const grant = {
97964
+ ...dto.sites === void 0 ? {} : { sites: dto.sites }
97965
+ };
95469
97966
  if (dto.data_classes !== void 0)
95470
97967
  grant.dataClasses = dto.data_classes === null ? null : wireStringArray(dto.data_classes, "data_classes");
95471
97968
  if (dto.confirm_each_use !== void 0)
@@ -95489,6 +97986,7 @@ function BoundaryPolicyFromFrontToApi(policy) {
95489
97986
  if (policy.allowed !== void 0)
95490
97987
  out.allowed = mapEntries(policy.allowed, (grant) => {
95491
97988
  const wire = {};
97989
+ if (grant.sites !== void 0) wire.sites = grant.sites;
95492
97990
  if (grant.dataClasses !== void 0) wire.data_classes = grant.dataClasses;
95493
97991
  if (grant.confirmEachUse !== void 0) wire.confirm_each_use = grant.confirmEachUse;
95494
97992
  if (grant.outboundPrivacy !== void 0) wire.outbound_privacy = grant.outboundPrivacy;
@@ -95509,6 +98007,10 @@ function EffectiveBoundaryFromApiToFront(dto) {
95509
98007
  spaceId: wireString(dto.space_id, "space_id"),
95510
98008
  registryApplied: wireBoolean(dto.registry_applied, "registry_applied"),
95511
98009
  entries: mapEntries(dto.entries, (entry2) => ({
98010
+ badge: entry2.badge,
98011
+ ...entry2.kind === void 0 ? {} : { kind: entry2.kind },
98012
+ ...entry2.name === void 0 ? {} : { name: entry2.name },
98013
+ sites: entry2.sites,
95512
98014
  dataClasses: wireStringArray(entry2.data_classes, "data_classes"),
95513
98015
  confirmEachUse: wireBoolean(entry2.confirm_each_use, "confirm_each_use"),
95514
98016
  outboundPrivacy: mapEntries(
@@ -95559,6 +98061,43 @@ function SiteRequestFiledFromApiToFront(dto) {
95559
98061
  function SiteRequestListFromApiToFront(dto) {
95560
98062
  return dto.items.map(SiteRequestFromApiToFront);
95561
98063
  }
98064
+ function BoundaryDecideRequestFromFrontToApi(request) {
98065
+ return {
98066
+ entry_id: request.entryId,
98067
+ ...request.spaceId === void 0 ? {} : { space_id: request.spaceId },
98068
+ ...request.dataClass === void 0 ? {} : { data_class: request.dataClass },
98069
+ ...request.targetHost === void 0 ? {} : { target_host: request.targetHost },
98070
+ ...request.confirmed === void 0 ? {} : { confirmed: request.confirmed }
98071
+ };
98072
+ }
98073
+ function BoundaryDecisionFromApiToFront(dto) {
98074
+ const decision = {
98075
+ verdict: wireLiteral(dto.verdict, ["allowed", "confirm", "blocked"], "verdict"),
98076
+ sanitise: wireBoolean(dto.sanitise, "sanitise")
98077
+ };
98078
+ if (dto.code !== void 0)
98079
+ decision.code = dto.code === null ? null : wireLiteral(dto.code, decisionCodes, "code");
98080
+ if (dto.rule !== void 0)
98081
+ decision.rule = dto.rule === null ? null : wireLiteral(dto.rule, ["not_allowed_in_space", "blocked_in_space"], "rule");
98082
+ if (dto.badge !== void 0)
98083
+ decision.badge = dto.badge === null ? null : wireLiteral(dto.badge, ["on_box", "external"], "badge");
98084
+ if (dto.kind !== void 0)
98085
+ decision.kind = dto.kind === null ? null : wireString(dto.kind, "kind");
98086
+ if (dto.name !== void 0)
98087
+ decision.name = dto.name === null ? null : wireString(dto.name, "name");
98088
+ if (dto.quota !== void 0)
98089
+ decision.quota = dto.quota === null ? null : {
98090
+ limit: wireNumber(dto.quota.limit, "quota.limit"),
98091
+ used: wireNumber(dto.quota.used, "quota.used"),
98092
+ resetsAt: wireString(dto.quota.resets_at, "quota.resets_at")
98093
+ };
98094
+ if (dto.sites !== void 0)
98095
+ decision.sites = dto.sites === null ? null : {
98096
+ allow: wireStringArray(dto.sites.allow, "sites.allow"),
98097
+ block: wireStringArray(dto.sites.block, "sites.block")
98098
+ };
98099
+ return decision;
98100
+ }
95562
98101
 
95563
98102
  // src/resources/boundary.ts
95564
98103
  var BoundaryClient = class {
@@ -95567,6 +98106,23 @@ var BoundaryClient = class {
95567
98106
  this.api = api;
95568
98107
  }
95569
98108
  api;
98109
+ /** Ask the engine to decide one outbound call.
98110
+ * @param request - The registry entry and circumstances of this call.
98111
+ * @param requestOptions - Per-call cancellation, timeout and request options.
98112
+ * @returns The engine's verdict and any associated restrictions, reason and quota.
98113
+ * @throws {ApiError} When the HTTP request fails.
98114
+ * @throws {ResponseShapeError} When the decision cannot be decoded.
98115
+ * @remarks Sends snake_case JSON to `POST /api/v1/boundary/decide`.
98116
+ * The engine can count an admitted call against the entry's daily quota.
98117
+ * @example const decision = await client.boundary.decide({ entryId: 'web-search' });
98118
+ */
98119
+ async decide(request, requestOptions) {
98120
+ const response = await this.api.postDecide(
98121
+ BoundaryDecideRequestFromFrontToApi(request),
98122
+ toRequestParams(requestOptions)
98123
+ );
98124
+ return decodeResponse(response, BoundaryDecisionFromApiToFront);
98125
+ }
95570
98126
  /** Read the effective restrictions computed by the engine.
95571
98127
  * @param spaceId - Project/space identifier, or `*` for the admin cap.
95572
98128
  * @param requestOptions - Per-call cancellation, timeout and request options.
@@ -97027,6 +99583,327 @@ var ChannelsClient = class {
97027
99583
  }
97028
99584
  };
97029
99585
 
99586
+ // src/normalizers/text-editing.ts
99587
+ function TextProofreadResponseFromApiToFront(dto) {
99588
+ return {
99589
+ edits: dto.edits.map((item0) => TextProofreadEditFromApiToFront(item0)),
99590
+ promptVersion: dto.prompt_version
99591
+ };
99592
+ }
99593
+ function TextProofreadEditFromApiToFront(dto) {
99594
+ return {
99595
+ after: dto.after,
99596
+ before: dto.before,
99597
+ end: dto.end,
99598
+ start: dto.start
99599
+ };
99600
+ }
99601
+ function TextRewriteResponseFromApiToFront(dto) {
99602
+ return {
99603
+ promptVersion: dto.prompt_version,
99604
+ text: dto.text
99605
+ };
99606
+ }
99607
+ function TextProofreadRequestFromFrontToApi(model) {
99608
+ return {
99609
+ text: model.text
99610
+ };
99611
+ }
99612
+ function TextRewriteRequestFromFrontToApi(model) {
99613
+ return {
99614
+ passage: model.passage,
99615
+ style: model.style,
99616
+ template: model.template,
99617
+ tone: model.tone
99618
+ };
99619
+ }
99620
+
99621
+ // src/resources/text.ts
99622
+ var TextClient = class {
99623
+ /** @internal */
99624
+ api;
99625
+ /** @internal */
99626
+ constructor(api) {
99627
+ this.api = api;
99628
+ }
99629
+ /**
99630
+ * Proofread a text: spelling, agreement and grammar only.
99631
+ *
99632
+ * @param request - The request (`TextProofreadRequest`), camelCase; sent snake_case.
99633
+ * @param requestOptions - Per-call cancellation, timeout and request options.
99634
+ * @returns The engine's answer as `TextProofreadResponse`, camelCase.
99635
+ * @throws {ApiError} 400: Empty or too long
99636
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
99637
+ * @throws {ApiError} 422: The model's edits broke a rule (edit_location, overlap, quantity_changed, invalid_edit)
99638
+ * @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
99639
+ * @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
99640
+ *
99641
+ * @remarks Uses POST `/api/v1/text/proofread`.
99642
+ * POST /api/v1/text/proofread
99643
+ *
99644
+ * @example
99645
+ * ```typescript
99646
+ * const { edits } = await client.text.proofread({ text });
99647
+ * ```
99648
+ */
99649
+ async proofread(request, requestOptions) {
99650
+ const response = await this.api.proofreadText(
99651
+ TextProofreadRequestFromFrontToApi(request),
99652
+ toRequestParams(requestOptions)
99653
+ );
99654
+ return decodeResponse(response, TextProofreadResponseFromApiToFront);
99655
+ }
99656
+ /**
99657
+ * Rewrite a passage in a tone, optionally following a template.
99658
+ *
99659
+ * @param request - The request (`TextRewriteRequest`), camelCase; sent snake_case.
99660
+ * @param requestOptions - Per-call cancellation, timeout and request options.
99661
+ * @returns The engine's answer as `TextRewriteResponse`, camelCase.
99662
+ * @throws {ApiError} 400: Empty, too long, or style misused
99663
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
99664
+ * @throws {ApiError} 422: The rewrite changed a number, sign, separator or currency, or was empty
99665
+ * @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
99666
+ * @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
99667
+ *
99668
+ * @remarks Uses POST `/api/v1/text/rewrite`.
99669
+ * POST /api/v1/text/rewrite
99670
+ *
99671
+ * @example
99672
+ * ```typescript
99673
+ * const rewritten = await client.text.rewrite({ text, tone: 'formal' });
99674
+ * ```
99675
+ */
99676
+ async rewrite(request, requestOptions) {
99677
+ const response = await this.api.rewriteText(
99678
+ TextRewriteRequestFromFrontToApi(request),
99679
+ toRequestParams(requestOptions)
99680
+ );
99681
+ return decodeResponse(response, TextRewriteResponseFromApiToFront);
99682
+ }
99683
+ };
99684
+
99685
+ // src/normalizers/browser-agent.ts
99686
+ function opaqueAction(action) {
99687
+ return Object.fromEntries(Object.entries(action));
99688
+ }
99689
+ function BrowserLinkFromFrontToApi(model) {
99690
+ return { ref_id: model.refId, label: model.label, url: model.url };
99691
+ }
99692
+ function BrowserTabFromFrontToApi(model) {
99693
+ return {
99694
+ tab_id: model.tabId,
99695
+ ...model.current !== void 0 ? { current: model.current } : {},
99696
+ ...model.openedByAgent !== void 0 ? { opened_by_agent: model.openedByAgent } : {},
99697
+ ...model.title !== void 0 ? { title: model.title } : {},
99698
+ ...model.url !== void 0 ? { url: model.url } : {}
99699
+ };
99700
+ }
99701
+ function BrowserStepRequestFromFrontToApi(model) {
99702
+ return {
99703
+ task: model.task,
99704
+ url: model.url,
99705
+ dom_snapshot: model.domSnapshot,
99706
+ ...model.title !== void 0 ? { title: model.title } : {},
99707
+ ...model.history !== void 0 ? { history: model.history } : {},
99708
+ ...model.marks !== void 0 ? { marks: model.marks } : {},
99709
+ ...model.maxTokens !== void 0 ? { max_tokens: model.maxTokens } : {},
99710
+ ...model.memory !== void 0 ? { memory: model.memory } : {},
99711
+ ...model.navigationLinks !== void 0 ? {
99712
+ navigation_links: model.navigationLinks === null ? null : model.navigationLinks.map(BrowserLinkFromFrontToApi)
99713
+ } : {},
99714
+ ...model.screenshot !== void 0 ? { screenshot: model.screenshot } : {},
99715
+ ...model.tabs !== void 0 ? { tabs: model.tabs.map(BrowserTabFromFrontToApi) } : {}
99716
+ };
99717
+ }
99718
+ function BrowserStepResponseFromApiToFront(dto) {
99719
+ return {
99720
+ evaluationPreviousGoal: dto.evaluation_previous_goal,
99721
+ memory: dto.memory,
99722
+ nextGoal: dto.next_goal,
99723
+ actions: dto.actions.map(opaqueAction)
99724
+ };
99725
+ }
99726
+ function BrowserRunRequestFromFrontToApi(model) {
99727
+ switch (model.operation) {
99728
+ case "start":
99729
+ return { operation: "start", task: model.task, browser_session: model.browserSession };
99730
+ case "inspect":
99731
+ return { operation: "inspect" };
99732
+ case "observe":
99733
+ return {
99734
+ operation: "observe",
99735
+ revision: model.revision,
99736
+ observation: BrowserStepRequestFromFrontToApi(model.observation)
99737
+ };
99738
+ case "authorize":
99739
+ return { operation: "authorize", revision: model.revision, command: model.command };
99740
+ case "discard":
99741
+ return { operation: "discard", revision: model.revision, command: model.command };
99742
+ case "receipt":
99743
+ return {
99744
+ operation: "receipt",
99745
+ command: model.command,
99746
+ outcome: {
99747
+ ok: model.outcome.ok,
99748
+ ...model.outcome.observation !== void 0 ? { observation: model.outcome.observation } : {}
99749
+ }
99750
+ };
99751
+ case "resolve":
99752
+ return { operation: "resolve", command: model.command, outcome: model.outcome };
99753
+ case "cancel":
99754
+ return { operation: "cancel", revision: model.revision };
99755
+ }
99756
+ }
99757
+ function BrowserRunViewFromApiToFront(dto) {
99758
+ return {
99759
+ id: dto.id,
99760
+ browserSession: dto.browser_session,
99761
+ task: dto.task,
99762
+ phase: dto.phase,
99763
+ revision: dto.revision,
99764
+ step: dto.step,
99765
+ pending: dto.pending == null ? null : { command: dto.pending.command, name: dto.pending.name, intent: dto.pending.intent },
99766
+ result: dto.result == null ? null : { success: dto.result.success, text: dto.result.text }
99767
+ };
99768
+ }
99769
+ function BrowserRunResponseFromApiToFront(dto) {
99770
+ return {
99771
+ ...BrowserRunViewFromApiToFront(dto),
99772
+ proposal: dto.proposal == null ? null : { id: dto.proposal.id, action: opaqueAction(dto.proposal.action) },
99773
+ authorized: dto.authorized ?? null
99774
+ };
99775
+ }
99776
+
99777
+ // src/resources/browser-agent.ts
99778
+ var BrowserAgentClient = class {
99779
+ /** @internal */
99780
+ api;
99781
+ /** @internal */
99782
+ constructor(api) {
99783
+ this.api = api;
99784
+ }
99785
+ /**
99786
+ * Decide the next browser actions for the current page state.
99787
+ *
99788
+ * @param request - The task and the page state (`domSnapshot`, `url`, tabs,
99789
+ * optional screenshot and marks).
99790
+ * @param requestOptions - Per-call request options.
99791
+ * @returns The evaluation of the previous goal, the planner's note, the next
99792
+ * goal and the ordered actions (verbatim).
99793
+ * @throws {BadRequestError} `400` for an empty task, or a body that is not JSON.
99794
+ * @throws {ApiError} `422` if the model returned no parseable step.
99795
+ * @throws {InternalServerError} `502` `llm_provider_failed`: the model's provider failed.
99796
+ * @throws {ServiceUnavailableError} `503` `llm_unconfigured`: no text model is configured.
99797
+ *
99798
+ * @remarks
99799
+ * Sent to `POST /api/v1/agent/browser-step`, snake_case on the wire
99800
+ * (`dom_snapshot`, `navigation_links`, `max_tokens`). Visual grounding is
99801
+ * best-effort: without a screenshot or a vision port the step reads the
99802
+ * element tree alone. The engine keeps nothing between steps: carry
99803
+ * `memory` and `history` forward yourself.
99804
+ *
99805
+ * @example
99806
+ * ```typescript
99807
+ * const step = await client.browserAgent.step({
99808
+ * task: 'Find the pricing page',
99809
+ * url: 'https://example.com',
99810
+ * domSnapshot: '[e1]<a href="/pricing">Pricing</a>',
99811
+ * });
99812
+ * console.log(step.nextGoal, step.actions);
99813
+ * ```
99814
+ */
99815
+ async step(request, requestOptions) {
99816
+ const response = await this.api.agentBrowserStep(
99817
+ BrowserStepRequestFromFrontToApi(request),
99818
+ toRequestParams(requestOptions)
99819
+ );
99820
+ return decodeResponse(response, BrowserStepResponseFromApiToFront);
99821
+ }
99822
+ /**
99823
+ * List the signed-in person's resumable browser runs.
99824
+ *
99825
+ * @param requestOptions - Per-call request options.
99826
+ * @returns At most 50 runs, each `ready`, `proposed` or `in_flight`.
99827
+ * @throws {GovernanceRefusedError} `403` `browser_run_person_required` (the
99828
+ * caller is not a signed-in person) or `browser_run_access_denied`; `503`
99829
+ * `workflow_authority_unconfigured`, `browser_authority_unavailable` or
99830
+ * `browser_run_store_unavailable`.
99831
+ *
99832
+ * @remarks
99833
+ * Sent to `GET /api/v1/agent/browser-runs`; snake_case wire fields
99834
+ * (`browser_session`) are mapped to camelCase.
99835
+ *
99836
+ * @example
99837
+ * ```typescript
99838
+ * const runs = await client.browserAgent.listRuns();
99839
+ * for (const run of runs) console.log(run.id, run.phase);
99840
+ * ```
99841
+ */
99842
+ async listRuns(requestOptions) {
99843
+ const response = await this.api.listBrowserAgentRuns(toRequestParams(requestOptions)).catch(rethrowVocabularyRefusal);
99844
+ return decodeResponse(response, (runs) => runs.map(BrowserRunViewFromApiToFront));
99845
+ }
99846
+ /**
99847
+ * Run one operation on a browser run: `start`, `inspect`, `observe`,
99848
+ * `authorize`, `discard`, `receipt`, `resolve` or `cancel`.
99849
+ *
99850
+ * @param runId - The person's browser run id (UUID). A `start` names a new one.
99851
+ * @param request - The operation, discriminated by `operation`.
99852
+ * @param requestOptions - Per-call request options.
99853
+ * @returns The run, with `proposal` set only in the answer to the `observe`
99854
+ * that proposed an action, and `authorized` set only in the answer to the
99855
+ * `authorize` that won the command.
99856
+ * @throws {GovernanceRefusedError} `400` `browser_run_task_invalid` or
99857
+ * `browser_observation_out_of_bounds`; `403`
99858
+ * `browser_run_person_required` or `browser_run_access_denied`; `404`
99859
+ * `browser_run_not_found`; `409` `browser_run_conflict` (a stale revision,
99860
+ * a `start` that names another task or browser session, or a pending
99861
+ * action that needs reconciliation); `502` `llm_provider_failed`; `503`
99862
+ * `workflow_authority_unconfigured`, `browser_authority_unavailable`,
99863
+ * `browser_run_store_unavailable` or `llm_unconfigured`.
99864
+ * @throws {VocabularyRefusedError} `400` or `422` `invalid_request`: that
99865
+ * code is in the vocabulary set too, which the SDK reads first.
99866
+ * @throws {ApiError} `423` if the tenant's emergency stop is engaged (no
99867
+ * `code`); `503` without a `code` if the emergency stop could not be read.
99868
+ *
99869
+ * @remarks
99870
+ * Sent to `POST /api/v1/agent/browser-runs/{run_id}`, snake_case on the
99871
+ * wire (`browser_session`, the observation's `dom_snapshot`). The grant is
99872
+ * one-time: the run keeps the action's name and intent, never its
99873
+ * arguments, so read `proposal.action` from the `observe` answer.
99874
+ *
99875
+ * @example
99876
+ * ```typescript
99877
+ * let run = await client.browserAgent.operateRun(runId, {
99878
+ * operation: 'start',
99879
+ * task: 'Find the pricing page',
99880
+ * browserSession: sessionId,
99881
+ * });
99882
+ * run = await client.browserAgent.operateRun(runId, {
99883
+ * operation: 'observe',
99884
+ * revision: run.revision,
99885
+ * observation: { task: run.task, url, domSnapshot },
99886
+ * });
99887
+ * if (run.proposal !== null) {
99888
+ * const granted = await client.browserAgent.operateRun(runId, {
99889
+ * operation: 'authorize',
99890
+ * revision: run.revision,
99891
+ * command: run.proposal.id,
99892
+ * });
99893
+ * console.log(granted.authorized);
99894
+ * }
99895
+ * ```
99896
+ */
99897
+ async operateRun(runId, request, requestOptions) {
99898
+ const response = await this.api.browserAgentRun(
99899
+ runId,
99900
+ BrowserRunRequestFromFrontToApi(request),
99901
+ toRequestParams(requestOptions)
99902
+ ).catch(rethrowVocabularyRefusal);
99903
+ return decodeResponse(response, BrowserRunResponseFromApiToFront);
99904
+ }
99905
+ };
99906
+
97030
99907
  // src/normalizers/platform.ts
97031
99908
  function CreateBackupRequestFromFrontToApi(model) {
97032
99909
  const out = {
@@ -97160,6 +100037,95 @@ function SkillListResponseFromApiToFront(dto) {
97160
100037
  return { skills: dto.skills.map(SkillSummaryFromApiToFront) };
97161
100038
  }
97162
100039
 
100040
+ // src/normalizers/skill-scripts.ts
100041
+ function ScriptPolicyFromApiToFront(dto) {
100042
+ return {
100043
+ company: dto.company,
100044
+ enabled: dto.enabled
100045
+ };
100046
+ }
100047
+ function EditionFromApiToFront(dto) {
100048
+ return {
100049
+ entrypoint: dto.entrypoint,
100050
+ packageId: dto.package_id,
100051
+ version: dto.version,
100052
+ workflow: dto.workflow
100053
+ };
100054
+ }
100055
+ function ResultWithEditionFromApiToFront(dto) {
100056
+ return {
100057
+ edition: EditionFromApiToFront(dto.edition),
100058
+ generation: GenerateDocumentResponseFromApiToFront(dto.generation),
100059
+ rootTermId: dto.root_term_id,
100060
+ skillId: dto.skill_id
100061
+ };
100062
+ }
100063
+ function ScriptResultFromApiToFront(dto) {
100064
+ return {
100065
+ exitCode: dto.exit_code,
100066
+ files: dto.files.map((item0) => ScriptOutputFileFromApiToFront(item0)),
100067
+ reviewId: dto.review_id,
100068
+ sandboxId: dto.sandbox_id,
100069
+ stderr: dto.stderr,
100070
+ stdout: dto.stdout
100071
+ };
100072
+ }
100073
+ function ScriptOutputFileFromApiToFront(dto) {
100074
+ return {
100075
+ bytes: dto.bytes,
100076
+ path: dto.path
100077
+ };
100078
+ }
100079
+ function ScriptPreviewFromApiToFront(dto) {
100080
+ return {
100081
+ entrypoint: dto.entrypoint,
100082
+ image: dto.image,
100083
+ reviewId: dto.review_id,
100084
+ rootTermId: dto.root_term_id,
100085
+ script: dto.script,
100086
+ sha256: dto.sha256
100087
+ };
100088
+ }
100089
+ function SkillDraftEditResponseFromApiToFront(dto) {
100090
+ return {
100091
+ description: dto.description,
100092
+ markdown: dto.markdown,
100093
+ name: dto.name,
100094
+ promptVersion: dto.prompt_version
100095
+ };
100096
+ }
100097
+ function ApprovedScriptFromFrontToApi(model) {
100098
+ return {
100099
+ review_id: model.reviewId,
100100
+ selection: ScriptSelectionFromFrontToApi(model.selection)
100101
+ };
100102
+ }
100103
+ function InvocationFromFrontToApi(model) {
100104
+ return {
100105
+ package_id: model.packageId,
100106
+ root_term_id: model.rootTermId,
100107
+ version: model.version
100108
+ };
100109
+ }
100110
+ function ScriptPolicyChangeFromFrontToApi(model) {
100111
+ return {
100112
+ enabled: model.enabled
100113
+ };
100114
+ }
100115
+ function ScriptSelectionFromFrontToApi(model) {
100116
+ return {
100117
+ package_id: model.packageId,
100118
+ root_term_id: model.rootTermId,
100119
+ version: model.version
100120
+ };
100121
+ }
100122
+ function SkillDraftEditRequestFromFrontToApi(model) {
100123
+ return {
100124
+ request: model.request,
100125
+ source: model.source
100126
+ };
100127
+ }
100128
+
97163
100129
  // src/resources/platform.ts
97164
100130
  var PlatformClient = class {
97165
100131
  /** @internal */
@@ -97167,9 +100133,13 @@ var PlatformClient = class {
97167
100133
  /** @internal */
97168
100134
  tenantId;
97169
100135
  /** @internal */
97170
- constructor(api, tenantId) {
100136
+ /** @internal */
100137
+ skills;
100138
+ /** @internal */
100139
+ constructor(api, tenantId, skills) {
97171
100140
  this.api = api;
97172
100141
  this.tenantId = tenantId;
100142
+ this.skills = skills;
97173
100143
  }
97174
100144
  // ── Backups ───────────────────────────────────────────────────────────
97175
100145
  /**
@@ -97469,6 +100439,166 @@ var PlatformClient = class {
97469
100439
  const response = await this.api.listSkills(toRequestParams(requestOptions));
97470
100440
  return decodeResponse(response, SkillListResponseFromApiToFront);
97471
100441
  }
100442
+ /**
100443
+ * listSkillEditions
100444
+ *
100445
+ * @param skillId - The skill (UUID).
100446
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100447
+ * @returns The engine's answer as `Edition[]`, camelCase.
100448
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100449
+ *
100450
+ * @remarks Uses GET `/api/v1/skills/{id}/editions`.
100451
+ *
100452
+ * @example
100453
+ * ```typescript
100454
+ * const editions = await client.platform.listSkillEditions(skillId);
100455
+ * ```
100456
+ */
100457
+ async listSkillEditions(skillId, requestOptions) {
100458
+ const response = await this.api.editions(skillId, toRequestParams(requestOptions));
100459
+ return decodeResponse(response, (dto) => dto.map(EditionFromApiToFront));
100460
+ }
100461
+ /**
100462
+ * invokeSkill
100463
+ *
100464
+ * @param skillId - The skill (UUID).
100465
+ * @param request - The request (`Invocation`), camelCase; sent snake_case.
100466
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100467
+ * @returns The engine's answer as `ResultWithEdition`, camelCase.
100468
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100469
+ *
100470
+ * @remarks Uses POST `/api/v1/skills/{id}/invoke`.
100471
+ *
100472
+ * @example
100473
+ * ```typescript
100474
+ * const result = await client.platform.invokeSkill(skillId, invocation);
100475
+ * ```
100476
+ */
100477
+ async invokeSkill(skillId, request, requestOptions) {
100478
+ const response = await this.api.invoke(
100479
+ skillId,
100480
+ InvocationFromFrontToApi(request),
100481
+ toRequestParams(requestOptions)
100482
+ );
100483
+ return decodeResponse(response, ResultWithEditionFromApiToFront);
100484
+ }
100485
+ /**
100486
+ * executeSkillScript
100487
+ *
100488
+ * @param skillId - The skill (UUID).
100489
+ * @param request - The request (`ApprovedScript`), camelCase; sent snake_case.
100490
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100491
+ * @returns The engine's answer as `ScriptResult`, camelCase.
100492
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100493
+ *
100494
+ * @remarks Uses POST `/api/v1/skills/{id}/script/execute`.
100495
+ *
100496
+ * @example
100497
+ * ```typescript
100498
+ * const result = await client.platform.executeSkillScript(skillId, approved);
100499
+ * ```
100500
+ */
100501
+ async executeSkillScript(skillId, request, requestOptions) {
100502
+ const response = await this.api.execute(
100503
+ skillId,
100504
+ ApprovedScriptFromFrontToApi(request),
100505
+ toRequestParams(requestOptions)
100506
+ );
100507
+ return decodeResponse(response, ScriptResultFromApiToFront);
100508
+ }
100509
+ /**
100510
+ * prepareSkillScript
100511
+ *
100512
+ * @param skillId - The skill (UUID).
100513
+ * @param request - The request (`ScriptSelection`), camelCase; sent snake_case.
100514
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100515
+ * @returns The engine's answer as `ScriptPreview`, camelCase.
100516
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100517
+ *
100518
+ * @remarks Uses POST `/api/v1/skills/{id}/script/prepare`.
100519
+ *
100520
+ * @example
100521
+ * ```typescript
100522
+ * const preview = await client.platform.prepareSkillScript(skillId, selection);
100523
+ * ```
100524
+ */
100525
+ async prepareSkillScript(skillId, request, requestOptions) {
100526
+ const response = await this.api.prepareSkillScript(
100527
+ skillId,
100528
+ ScriptSelectionFromFrontToApi(request),
100529
+ toRequestParams(requestOptions)
100530
+ );
100531
+ return decodeResponse(response, ScriptPreviewFromApiToFront);
100532
+ }
100533
+ /**
100534
+ * getSkillScriptPolicy
100535
+ *
100536
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100537
+ * @returns The engine's answer as `ScriptPolicy`, camelCase.
100538
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100539
+ *
100540
+ * @remarks Uses GET `/api/v1/skills/script-policy`.
100541
+ *
100542
+ * @example
100543
+ * ```typescript
100544
+ * const policy = await client.platform.getSkillScriptPolicy();
100545
+ * ```
100546
+ */
100547
+ async getSkillScriptPolicy(requestOptions) {
100548
+ const response = await this.api.policy(toRequestParams(requestOptions));
100549
+ return decodeResponse(response, ScriptPolicyFromApiToFront);
100550
+ }
100551
+ /**
100552
+ * setSkillScriptPolicy
100553
+ *
100554
+ * @param organizationId - The organization.
100555
+ * @param request - The request (`ScriptPolicyChange`), camelCase; sent snake_case.
100556
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100557
+ * @returns The engine's answer as `ScriptPolicy`, camelCase.
100558
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100559
+ *
100560
+ * @remarks Uses PUT `/api/v1/skills/organizations/{id}/script-policy`.
100561
+ *
100562
+ * @example
100563
+ * ```typescript
100564
+ * await client.platform.setSkillScriptPolicy(organizationId, change);
100565
+ * ```
100566
+ */
100567
+ async setSkillScriptPolicy(organizationId, request, requestOptions) {
100568
+ const response = await this.api.setSkillScriptPolicy(
100569
+ organizationId,
100570
+ ScriptPolicyChangeFromFrontToApi(request),
100571
+ toRequestParams(requestOptions)
100572
+ );
100573
+ return decodeResponse(response, ScriptPolicyFromApiToFront);
100574
+ }
100575
+ /**
100576
+ * Propose an edited SKILL.md for a requested change.
100577
+ *
100578
+ * @param request - The request (`SkillDraftEditRequest`), camelCase; sent snake_case.
100579
+ * @param requestOptions - Per-call cancellation, timeout and request options.
100580
+ * @returns The engine's answer as `SkillDraftEditResponse`, camelCase.
100581
+ * @throws {ApiError} 400: Empty or too long
100582
+ * @throws {ApiError} 410: `tenant_deleted` (body `{"error": "tenant_deleted", "message"}`): the tenant was deleted; its id is refused on every route and cannot be reused
100583
+ * @throws {ApiError} 422: The model's file failed the package check (skill_* codes)
100584
+ * @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
100585
+ * @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
100586
+ *
100587
+ * @remarks Uses POST `/api/v1/skills/draft-edit`.
100588
+ * POST /api/v1/skills/draft-edit
100589
+ *
100590
+ * @example
100591
+ * ```typescript
100592
+ * const draft = await client.platform.draftSkillEdit(request);
100593
+ * ```
100594
+ */
100595
+ async draftSkillEdit(request, requestOptions) {
100596
+ const response = await this.skills.draftSkillEdit(
100597
+ SkillDraftEditRequestFromFrontToApi(request),
100598
+ toRequestParams(requestOptions)
100599
+ );
100600
+ return decodeResponse(response, SkillDraftEditResponseFromApiToFront);
100601
+ }
97472
100602
  };
97473
100603
 
97474
100604
  // src/normalizers/source-observations.ts
@@ -101328,6 +104458,10 @@ var ReasoningLayerClient = class {
101328
104458
  channels;
101329
104459
  /** Platform administration — backups, config sections, connector health, diagnostics, identities, onboarding, skills. */
101330
104460
  platform;
104461
+ /** Text editing with the engine's text model: proofread and rewrite. */
104462
+ text;
104463
+ /** The browser agent: planning steps and the browser runs the engine keeps for a person. */
104464
+ browserAgent;
101331
104465
  /**
101332
104466
  * Runtime native (WASM) plugins — register, list, enable, disable, delete.
101333
104467
  * Restricted to the platform provisioning identity.
@@ -101756,8 +104890,11 @@ var ReasoningLayerClient = class {
101756
104890
  );
101757
104891
  this.platform = new PlatformClient(
101758
104892
  encodePathParams(new Platform(generatedHttp)),
101759
- resolved.tenantId
104893
+ resolved.tenantId,
104894
+ encodePathParams(new Skills(generatedHttp))
101760
104895
  );
104896
+ this.text = new TextClient(encodePathParams(new Text(generatedHttp)));
104897
+ this.browserAgent = new BrowserAgentClient(encodePathParams(new Agent(generatedHttp)));
101761
104898
  this.plugins = new PluginsClient(encodePathParams(new Plugins(generatedHttp)));
101762
104899
  this.memory = new MemoryClient(encodePathParams(new Memory(generatedHttp)));
101763
104900
  }
@@ -102097,6 +105234,24 @@ var vocabulary_exports = {};
102097
105234
  // src/types/source-observations.ts
102098
105235
  var source_observations_exports = {};
102099
105236
 
105237
+ // src/types/live-docs.ts
105238
+ var live_docs_exports = {};
105239
+
105240
+ // src/types/agent-instructions.ts
105241
+ var agent_instructions_exports = {};
105242
+
105243
+ // src/types/skill-scripts.ts
105244
+ var skill_scripts_exports = {};
105245
+
105246
+ // src/types/text-editing.ts
105247
+ var text_editing_exports = {};
105248
+
105249
+ // src/types/browser-agent.ts
105250
+ var browser_agent_exports = {};
105251
+
105252
+ // src/types/frame-authoring.ts
105253
+ var frame_authoring_exports = {};
105254
+
102100
105255
  // src/types/boundary.ts
102101
105256
  var boundary_exports = {};
102102
105257
 
@@ -104923,6 +108078,7 @@ exports.AUDIT_RESPONSE_HEADERS = AUDIT_RESPONSE_HEADERS;
104923
108078
  exports.ActionReviews = action_reviews_exports;
104924
108079
  exports.Actions = actions_exports;
104925
108080
  exports.Admin = admin_exports;
108081
+ exports.AgentInstructions = agent_instructions_exports;
104926
108082
  exports.Agui = agui_exports;
104927
108083
  exports.Analysis = analysis_exports;
104928
108084
  exports.Anonymization = anonymization_exports;
@@ -104936,6 +108092,7 @@ exports.BadRequestError = BadRequestError;
104936
108092
  exports.Batch = batch_exports;
104937
108093
  exports.Boundary = boundary_exports;
104938
108094
  exports.BoundaryClient = BoundaryClient;
108095
+ exports.BrowserAgent = browser_agent_exports;
104939
108096
  exports.BrowserPhoneRehearsal = BrowserPhoneRehearsal;
104940
108097
  exports.BrowserSpeechAudio = BrowserSpeechAudio;
104941
108098
  exports.BrowserSpeechOutput = BrowserSpeechOutput;
@@ -104978,6 +108135,7 @@ exports.Flow = Flow;
104978
108135
  exports.FlowNetworks = flow_networks_exports;
104979
108136
  exports.ForbiddenError = ForbiddenError;
104980
108137
  exports.Forecast = forecast_exports;
108138
+ exports.FrameAuthoring = frame_authoring_exports;
104981
108139
  exports.Functions = functions_exports;
104982
108140
  exports.Fuzzy = fuzzy_exports;
104983
108141
  exports.FuzzyShape = FuzzyShape;
@@ -105009,6 +108167,7 @@ exports.IngestionSessionHandle = IngestionSessionHandle;
105009
108167
  exports.InternalServerError = InternalServerError;
105010
108168
  exports.LP = LP;
105011
108169
  exports.LTN = ltn_exports;
108170
+ exports.LiveDocs = live_docs_exports;
105012
108171
  exports.Marketplace = marketplace_exports;
105013
108172
  exports.Memory = memory_exports;
105014
108173
  exports.Metrics = metrics_exports;
@@ -105058,6 +108217,7 @@ exports.Scheduling = scheduling_exports;
105058
108217
  exports.ServiceUnavailableError = ServiceUnavailableError;
105059
108218
  exports.Settings = settings_exports;
105060
108219
  exports.SettingsClient = SettingsClient;
108220
+ exports.SkillScripts = skill_scripts_exports;
105061
108221
  exports.Smt = smt_exports;
105062
108222
  exports.Snapshots = snapshots_exports;
105063
108223
  exports.Solver = solver_exports;
@@ -105078,6 +108238,7 @@ exports.Synthetic = synthetic_exports;
105078
108238
  exports.Temporal = temporal_exports;
105079
108239
  exports.TenantDeletedError = TenantDeletedError;
105080
108240
  exports.Terms = terms_exports;
108241
+ exports.TextEditing = text_editing_exports;
105081
108242
  exports.Thomas = thomas_exports;
105082
108243
  exports.TimeoutError = TimeoutError;
105083
108244
  exports.UI = ui_exports;