@kortexya/reasoninglayer 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1881 -100
- package/dist/index.d.cts +1791 -140
- package/dist/index.d.ts +1791 -140
- package/dist/index.js +1877 -101
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/config.ts
|
|
8
|
-
var SDK_VERSION = "16.
|
|
8
|
+
var SDK_VERSION = "16.1.0";
|
|
9
9
|
function checkTimeoutMs(value, where) {
|
|
10
10
|
if (!Number.isFinite(value) || value < 0) {
|
|
11
11
|
throw new Error(
|
|
@@ -40168,28 +40168,30 @@ function definitionToApi(value) {
|
|
|
40168
40168
|
own_created_records: value.ownCreatedRecords
|
|
40169
40169
|
};
|
|
40170
40170
|
}
|
|
40171
|
+
function definitionFromApi(d) {
|
|
40172
|
+
return {
|
|
40173
|
+
name: d.name,
|
|
40174
|
+
body: d.body,
|
|
40175
|
+
params: d.params,
|
|
40176
|
+
returns: d.returns,
|
|
40177
|
+
writes: d.writes,
|
|
40178
|
+
rules: d.rules?.map(ruleFromApi),
|
|
40179
|
+
projectId: d.project_id ?? void 0,
|
|
40180
|
+
frame: d.frame ?? void 0,
|
|
40181
|
+
boundParam: d.bound_param ?? void 0,
|
|
40182
|
+
requiredRoles: d.required_roles,
|
|
40183
|
+
approval: d.approval ?? void 0,
|
|
40184
|
+
riskTier: d.risk_tier ?? void 0,
|
|
40185
|
+
ownCreatedRecords: d.own_created_records
|
|
40186
|
+
};
|
|
40187
|
+
}
|
|
40171
40188
|
function actionFromApi(dto) {
|
|
40172
|
-
const d = dto.definition;
|
|
40173
40189
|
return {
|
|
40174
40190
|
id: dto.id,
|
|
40175
40191
|
version: dto.version,
|
|
40176
40192
|
owner: dto.owner ?? void 0,
|
|
40177
40193
|
origin: dto.origin,
|
|
40178
|
-
definition:
|
|
40179
|
-
name: d.name,
|
|
40180
|
-
body: d.body,
|
|
40181
|
-
params: d.params,
|
|
40182
|
-
returns: d.returns,
|
|
40183
|
-
writes: d.writes,
|
|
40184
|
-
rules: d.rules?.map(ruleFromApi),
|
|
40185
|
-
projectId: d.project_id ?? void 0,
|
|
40186
|
-
frame: d.frame ?? void 0,
|
|
40187
|
-
boundParam: d.bound_param ?? void 0,
|
|
40188
|
-
requiredRoles: d.required_roles,
|
|
40189
|
-
approval: d.approval ?? void 0,
|
|
40190
|
-
riskTier: d.risk_tier ?? void 0,
|
|
40191
|
-
ownCreatedRecords: d.own_created_records
|
|
40192
|
-
}
|
|
40194
|
+
definition: definitionFromApi(dto.definition)
|
|
40193
40195
|
};
|
|
40194
40196
|
}
|
|
40195
40197
|
function applyFromApi(dto) {
|
|
@@ -40217,6 +40219,215 @@ function applyFromApi(dto) {
|
|
|
40217
40219
|
};
|
|
40218
40220
|
}
|
|
40219
40221
|
|
|
40222
|
+
// src/normalizers/frame-authoring.ts
|
|
40223
|
+
function FrameCalculationDraftResponseFromApiToFront(dto) {
|
|
40224
|
+
switch (dto.status) {
|
|
40225
|
+
case "needs_clarification":
|
|
40226
|
+
return {
|
|
40227
|
+
questions: dto.questions.map(
|
|
40228
|
+
(item0) => RuleDraftClarificationQuestionDtoFromApiToFront(item0)
|
|
40229
|
+
),
|
|
40230
|
+
status: dto.status
|
|
40231
|
+
};
|
|
40232
|
+
case "complete":
|
|
40233
|
+
return {
|
|
40234
|
+
definition: definitionFromApi(dto.definition),
|
|
40235
|
+
draft: CalculationFromApiToFront(dto.draft),
|
|
40236
|
+
status: dto.status
|
|
40237
|
+
};
|
|
40238
|
+
}
|
|
40239
|
+
}
|
|
40240
|
+
function CalculationFromApiToFront(dto) {
|
|
40241
|
+
return {
|
|
40242
|
+
function: dto.function,
|
|
40243
|
+
inputs: dto.inputs.map((item0) => CalculationInputFromApiToFront(item0)),
|
|
40244
|
+
name: dto.name,
|
|
40245
|
+
outputs: dto.outputs.map((item0) => CalculationOutputFromApiToFront(item0))
|
|
40246
|
+
};
|
|
40247
|
+
}
|
|
40248
|
+
function CalculationFromFrontToApi(model) {
|
|
40249
|
+
return {
|
|
40250
|
+
function: model.function,
|
|
40251
|
+
inputs: model.inputs.map((item0) => CalculationInputFromFrontToApi(item0)),
|
|
40252
|
+
name: model.name,
|
|
40253
|
+
outputs: model.outputs.map((item0) => CalculationOutputFromFrontToApi(item0))
|
|
40254
|
+
};
|
|
40255
|
+
}
|
|
40256
|
+
function CalculationInputFromApiToFront(dto) {
|
|
40257
|
+
return {
|
|
40258
|
+
integerRange: dto.integer_range == null ? dto.integer_range : IntegerRangeFromApiToFront(dto.integer_range),
|
|
40259
|
+
kind: dto.kind,
|
|
40260
|
+
name: dto.name
|
|
40261
|
+
};
|
|
40262
|
+
}
|
|
40263
|
+
function CalculationInputFromFrontToApi(model) {
|
|
40264
|
+
return {
|
|
40265
|
+
integer_range: model.integerRange == null ? model.integerRange : IntegerRangeFromFrontToApi(model.integerRange),
|
|
40266
|
+
kind: model.kind,
|
|
40267
|
+
name: model.name
|
|
40268
|
+
};
|
|
40269
|
+
}
|
|
40270
|
+
function CalculationOutputFromApiToFront(dto) {
|
|
40271
|
+
return {
|
|
40272
|
+
formula: dto.formula == null ? dto.formula : FormulaFromApiToFront(dto.formula),
|
|
40273
|
+
indices: dto.indices,
|
|
40274
|
+
kind: dto.kind,
|
|
40275
|
+
name: dto.name
|
|
40276
|
+
};
|
|
40277
|
+
}
|
|
40278
|
+
function CalculationOutputFromFrontToApi(model) {
|
|
40279
|
+
return {
|
|
40280
|
+
formula: model.formula == null ? model.formula : FormulaFromFrontToApi(model.formula),
|
|
40281
|
+
indices: model.indices,
|
|
40282
|
+
kind: model.kind,
|
|
40283
|
+
name: model.name
|
|
40284
|
+
};
|
|
40285
|
+
}
|
|
40286
|
+
function FormulaFromApiToFront(dto) {
|
|
40287
|
+
switch (dto.node) {
|
|
40288
|
+
case "input":
|
|
40289
|
+
return { name: dto.name, node: dto.node };
|
|
40290
|
+
case "number":
|
|
40291
|
+
return { node: dto.node, value: dto.value };
|
|
40292
|
+
case "arithmetic":
|
|
40293
|
+
return {
|
|
40294
|
+
left: FormulaFromApiToFront(dto.left),
|
|
40295
|
+
node: dto.node,
|
|
40296
|
+
operator: dto.operator,
|
|
40297
|
+
right: FormulaFromApiToFront(dto.right)
|
|
40298
|
+
};
|
|
40299
|
+
}
|
|
40300
|
+
}
|
|
40301
|
+
function FormulaFromFrontToApi(model) {
|
|
40302
|
+
switch (model.node) {
|
|
40303
|
+
case "input":
|
|
40304
|
+
return { name: model.name, node: model.node };
|
|
40305
|
+
case "number":
|
|
40306
|
+
return { node: model.node, value: model.value };
|
|
40307
|
+
case "arithmetic":
|
|
40308
|
+
return {
|
|
40309
|
+
left: FormulaFromFrontToApi(model.left),
|
|
40310
|
+
node: model.node,
|
|
40311
|
+
operator: model.operator,
|
|
40312
|
+
right: FormulaFromFrontToApi(model.right)
|
|
40313
|
+
};
|
|
40314
|
+
}
|
|
40315
|
+
}
|
|
40316
|
+
function IntegerRangeFromApiToFront(dto) {
|
|
40317
|
+
return {
|
|
40318
|
+
max: dto.max,
|
|
40319
|
+
min: dto.min
|
|
40320
|
+
};
|
|
40321
|
+
}
|
|
40322
|
+
function IntegerRangeFromFrontToApi(model) {
|
|
40323
|
+
return {
|
|
40324
|
+
max: model.max,
|
|
40325
|
+
min: model.min
|
|
40326
|
+
};
|
|
40327
|
+
}
|
|
40328
|
+
function FrameWriteDraftResponseFromApiToFront(dto) {
|
|
40329
|
+
switch (dto.status) {
|
|
40330
|
+
case "needs_clarification":
|
|
40331
|
+
return {
|
|
40332
|
+
questions: dto.questions.map(
|
|
40333
|
+
(item0) => RuleDraftClarificationQuestionDtoFromApiToFront(item0)
|
|
40334
|
+
),
|
|
40335
|
+
status: dto.status
|
|
40336
|
+
};
|
|
40337
|
+
case "complete":
|
|
40338
|
+
return {
|
|
40339
|
+
definition: definitionFromApi(dto.definition),
|
|
40340
|
+
draft: FrameWriteDraftFromApiToFront(dto.draft),
|
|
40341
|
+
status: dto.status
|
|
40342
|
+
};
|
|
40343
|
+
}
|
|
40344
|
+
}
|
|
40345
|
+
function FrameWriteDraftFromApiToFront(dto) {
|
|
40346
|
+
return {
|
|
40347
|
+
fields: dto.fields.map((item0) => item0),
|
|
40348
|
+
name: dto.name,
|
|
40349
|
+
operation: dto.operation,
|
|
40350
|
+
sort: dto.sort
|
|
40351
|
+
};
|
|
40352
|
+
}
|
|
40353
|
+
function FrameConsultantRevisionFromApiToFront(dto) {
|
|
40354
|
+
return {
|
|
40355
|
+
added: dto.added,
|
|
40356
|
+
frameId: dto.frame_id,
|
|
40357
|
+
moved: dto.moved,
|
|
40358
|
+
name: dto.name,
|
|
40359
|
+
version: dto.version
|
|
40360
|
+
};
|
|
40361
|
+
}
|
|
40362
|
+
function FrameConsultantPlacementFromFrontToApi(model) {
|
|
40363
|
+
return {
|
|
40364
|
+
move_existing: model.moveExisting,
|
|
40365
|
+
section: model.section
|
|
40366
|
+
};
|
|
40367
|
+
}
|
|
40368
|
+
function RestoreFramePageResponseFromApiToFront(dto) {
|
|
40369
|
+
return {
|
|
40370
|
+
frameId: dto.frame_id,
|
|
40371
|
+
name: dto.name,
|
|
40372
|
+
restoredFrom: dto.restored_from,
|
|
40373
|
+
version: dto.version
|
|
40374
|
+
};
|
|
40375
|
+
}
|
|
40376
|
+
function UIFrameTableSourcesFromApiToFront(dto) {
|
|
40377
|
+
return {
|
|
40378
|
+
sources: dto.sources.map((item0) => UIFrameTableSourceFromApiToFront(item0)),
|
|
40379
|
+
total: dto.total
|
|
40380
|
+
};
|
|
40381
|
+
}
|
|
40382
|
+
function UIFrameTableSourceFromApiToFront(dto) {
|
|
40383
|
+
return {
|
|
40384
|
+
columns: dto.columns.map((item0) => item0),
|
|
40385
|
+
sort: dto.sort
|
|
40386
|
+
};
|
|
40387
|
+
}
|
|
40388
|
+
function AddFrameConsultantFromFrontToApi(model) {
|
|
40389
|
+
return {
|
|
40390
|
+
authoring: model.authoring == null ? model.authoring : FrameAuthoringOriginFromFrontToApi(model.authoring),
|
|
40391
|
+
expected_version: model.expectedVersion,
|
|
40392
|
+
frame_id: model.frameId,
|
|
40393
|
+
placement: model.placement == null ? model.placement : FrameConsultantPlacementFromFrontToApi(model.placement)
|
|
40394
|
+
};
|
|
40395
|
+
}
|
|
40396
|
+
function FrameAuthoringOriginFromFrontToApi(model) {
|
|
40397
|
+
return {
|
|
40398
|
+
conversation_id: model.conversationId,
|
|
40399
|
+
turn_id: model.turnId
|
|
40400
|
+
};
|
|
40401
|
+
}
|
|
40402
|
+
function FrameCalculationDraftRequestFromFrontToApi(model) {
|
|
40403
|
+
return {
|
|
40404
|
+
answers: model.answers,
|
|
40405
|
+
current_draft: model.currentDraft == null ? model.currentDraft : CalculationFromFrontToApi(model.currentDraft),
|
|
40406
|
+
description: model.description,
|
|
40407
|
+
frame_id: model.frameId
|
|
40408
|
+
};
|
|
40409
|
+
}
|
|
40410
|
+
function FrameWriteDraftRequestFromFrontToApi(model) {
|
|
40411
|
+
return {
|
|
40412
|
+
answers: model.answers,
|
|
40413
|
+
description: model.description,
|
|
40414
|
+
frame_id: model.frameId
|
|
40415
|
+
};
|
|
40416
|
+
}
|
|
40417
|
+
function RestoreFramePageRequestFromFrontToApi(model) {
|
|
40418
|
+
return {
|
|
40419
|
+
expected_latest_version: model.expectedLatestVersion,
|
|
40420
|
+
frame_id: model.frameId,
|
|
40421
|
+
version: model.version
|
|
40422
|
+
};
|
|
40423
|
+
}
|
|
40424
|
+
function RunAppCalculationRequestFromFrontToApi(model) {
|
|
40425
|
+
return {
|
|
40426
|
+
params: model.params,
|
|
40427
|
+
version: model.version
|
|
40428
|
+
};
|
|
40429
|
+
}
|
|
40430
|
+
|
|
40220
40431
|
// src/resources/app-actions.ts
|
|
40221
40432
|
var AppActionsClient = class {
|
|
40222
40433
|
/** @internal */
|
|
@@ -40260,6 +40471,88 @@ var AppActionsClient = class {
|
|
|
40260
40471
|
);
|
|
40261
40472
|
return decodeResponse(response, applyFromApi);
|
|
40262
40473
|
}
|
|
40474
|
+
/**
|
|
40475
|
+
* Draft a calculation for a Frame the caller may edit. Saving uses the ordinary action writer and
|
|
40476
|
+
* repeats its current scope and definition checks.
|
|
40477
|
+
*
|
|
40478
|
+
* @param request - The request (`FrameCalculationDraftRequest`), camelCase; sent snake_case.
|
|
40479
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
40480
|
+
* @returns The engine's answer as `FrameCalculationDraftResponse`, camelCase.
|
|
40481
|
+
* @throws {ApiError} 403: Frame edit access required
|
|
40482
|
+
* @throws {ApiError} 404: Frame unavailable
|
|
40483
|
+
* @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
|
|
40484
|
+
* @throws {ApiError} 422: Invalid calculation or draft
|
|
40485
|
+
* @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
|
|
40486
|
+
* @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
|
|
40487
|
+
*
|
|
40488
|
+
* @remarks Uses POST `/api/v1/app-actions/calculations/draft`.
|
|
40489
|
+
*
|
|
40490
|
+
* @example
|
|
40491
|
+
* ```typescript
|
|
40492
|
+
* const draft = await client.appActions.draftCalculation(request);
|
|
40493
|
+
* ```
|
|
40494
|
+
*/
|
|
40495
|
+
async draftCalculation(request, requestOptions) {
|
|
40496
|
+
const response = await this.api.draftFrameCalculation(
|
|
40497
|
+
FrameCalculationDraftRequestFromFrontToApi(request),
|
|
40498
|
+
toRequestParams(requestOptions)
|
|
40499
|
+
);
|
|
40500
|
+
return decodeResponse(response, FrameCalculationDraftResponseFromApiToFront);
|
|
40501
|
+
}
|
|
40502
|
+
/**
|
|
40503
|
+
* draftWrite
|
|
40504
|
+
*
|
|
40505
|
+
* @param request - The request (`FrameWriteDraftRequest`), camelCase; sent snake_case.
|
|
40506
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
40507
|
+
* @returns The engine's answer as `FrameWriteDraftResponse`, camelCase.
|
|
40508
|
+
* @throws {ApiError} 404: Frame unavailable
|
|
40509
|
+
* @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
|
|
40510
|
+
* @throws {ApiError} 422: The draft cannot be expressed with the available tables and fields
|
|
40511
|
+
* @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
|
|
40512
|
+
* @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
|
|
40513
|
+
*
|
|
40514
|
+
* @remarks Uses POST `/api/v1/app-actions/writes/draft`.
|
|
40515
|
+
*
|
|
40516
|
+
* @example
|
|
40517
|
+
* ```typescript
|
|
40518
|
+
* const draft = await client.appActions.draftWrite(request);
|
|
40519
|
+
* ```
|
|
40520
|
+
*/
|
|
40521
|
+
async draftWrite(request, requestOptions) {
|
|
40522
|
+
const response = await this.api.draftFrameWrite(
|
|
40523
|
+
FrameWriteDraftRequestFromFrontToApi(request),
|
|
40524
|
+
toRequestParams(requestOptions)
|
|
40525
|
+
);
|
|
40526
|
+
return decodeResponse(response, FrameWriteDraftResponseFromApiToFront);
|
|
40527
|
+
}
|
|
40528
|
+
/**
|
|
40529
|
+
* Calculate with the same Frame and term visibility as the action editor.
|
|
40530
|
+
*
|
|
40531
|
+
* @param id - The calculation action.
|
|
40532
|
+
* @param request - The request (`RunAppCalculationRequest`), camelCase; sent snake_case.
|
|
40533
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
40534
|
+
* @returns The engine's answer as `ApplyAppActionResult`, camelCase.
|
|
40535
|
+
* @throws {ApiError} 403: The action is not a read-only Frame calculation
|
|
40536
|
+
* @throws {ApiError} 404: No Frame or calculation the caller can read
|
|
40537
|
+
* @throws {ApiError} 409: The calculation changed or cannot run
|
|
40538
|
+
* @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
|
|
40539
|
+
* @throws {ApiError} 422: One or more input values are invalid
|
|
40540
|
+
*
|
|
40541
|
+
* @remarks Uses POST `/api/v1/app-actions/{id}/calculate`.
|
|
40542
|
+
*
|
|
40543
|
+
* @example
|
|
40544
|
+
* ```typescript
|
|
40545
|
+
* const result = await client.appActions.calculate(actionId, { version: 2 });
|
|
40546
|
+
* ```
|
|
40547
|
+
*/
|
|
40548
|
+
async calculate(id, request, requestOptions) {
|
|
40549
|
+
const response = await this.api.runAppCalculation(
|
|
40550
|
+
id,
|
|
40551
|
+
RunAppCalculationRequestFromFrontToApi(request),
|
|
40552
|
+
toRequestParams(requestOptions)
|
|
40553
|
+
);
|
|
40554
|
+
return decodeResponse(response, applyFromApi);
|
|
40555
|
+
}
|
|
40263
40556
|
};
|
|
40264
40557
|
|
|
40265
40558
|
// src/api-spec/generated/ActionReviews.ts
|
|
@@ -45385,6 +45678,76 @@ var Ui = class {
|
|
|
45385
45678
|
});
|
|
45386
45679
|
};
|
|
45387
45680
|
|
|
45681
|
+
// src/api-spec/generated/Skills.ts
|
|
45682
|
+
var Skills = class {
|
|
45683
|
+
http;
|
|
45684
|
+
constructor(http) {
|
|
45685
|
+
this.http = http;
|
|
45686
|
+
}
|
|
45687
|
+
/**
|
|
45688
|
+
* @description POST /api/v1/skills/draft-edit
|
|
45689
|
+
*
|
|
45690
|
+
* @tags skills
|
|
45691
|
+
* @name DraftSkillEdit
|
|
45692
|
+
* @summary Propose an edited SKILL.md for a requested change.
|
|
45693
|
+
* @request POST:/api/v1/skills/draft-edit
|
|
45694
|
+
* @secure
|
|
45695
|
+
*/
|
|
45696
|
+
draftSkillEdit = (data, params = {}) => this.http.request({
|
|
45697
|
+
path: `/api/v1/skills/draft-edit`,
|
|
45698
|
+
method: "POST",
|
|
45699
|
+
body: data,
|
|
45700
|
+
secure: true,
|
|
45701
|
+
type: "application/json",
|
|
45702
|
+
format: "json",
|
|
45703
|
+
...params
|
|
45704
|
+
});
|
|
45705
|
+
};
|
|
45706
|
+
|
|
45707
|
+
// src/api-spec/generated/Text.ts
|
|
45708
|
+
var Text = class {
|
|
45709
|
+
http;
|
|
45710
|
+
constructor(http) {
|
|
45711
|
+
this.http = http;
|
|
45712
|
+
}
|
|
45713
|
+
/**
|
|
45714
|
+
* @description POST /api/v1/text/proofread
|
|
45715
|
+
*
|
|
45716
|
+
* @tags text
|
|
45717
|
+
* @name ProofreadText
|
|
45718
|
+
* @summary Proofread a text: spelling, agreement and grammar only.
|
|
45719
|
+
* @request POST:/api/v1/text/proofread
|
|
45720
|
+
* @secure
|
|
45721
|
+
*/
|
|
45722
|
+
proofreadText = (data, params = {}) => this.http.request({
|
|
45723
|
+
path: `/api/v1/text/proofread`,
|
|
45724
|
+
method: "POST",
|
|
45725
|
+
body: data,
|
|
45726
|
+
secure: true,
|
|
45727
|
+
type: "application/json",
|
|
45728
|
+
format: "json",
|
|
45729
|
+
...params
|
|
45730
|
+
});
|
|
45731
|
+
/**
|
|
45732
|
+
* @description POST /api/v1/text/rewrite
|
|
45733
|
+
*
|
|
45734
|
+
* @tags text
|
|
45735
|
+
* @name RewriteText
|
|
45736
|
+
* @summary Rewrite a passage in a tone, optionally following a template.
|
|
45737
|
+
* @request POST:/api/v1/text/rewrite
|
|
45738
|
+
* @secure
|
|
45739
|
+
*/
|
|
45740
|
+
rewriteText = (data, params = {}) => this.http.request({
|
|
45741
|
+
path: `/api/v1/text/rewrite`,
|
|
45742
|
+
method: "POST",
|
|
45743
|
+
body: data,
|
|
45744
|
+
secure: true,
|
|
45745
|
+
type: "application/json",
|
|
45746
|
+
format: "json",
|
|
45747
|
+
...params
|
|
45748
|
+
});
|
|
45749
|
+
};
|
|
45750
|
+
|
|
45388
45751
|
// src/api-spec/generated/Compliance.ts
|
|
45389
45752
|
var Compliance = class {
|
|
45390
45753
|
http;
|
|
@@ -55454,6 +55817,167 @@ function toTermInputDto(input) {
|
|
|
55454
55817
|
return byName;
|
|
55455
55818
|
}
|
|
55456
55819
|
|
|
55820
|
+
// src/normalizers/live-docs.ts
|
|
55821
|
+
function LiveDocStateResponseFromApiToFront(dto) {
|
|
55822
|
+
return {
|
|
55823
|
+
state: dto.state,
|
|
55824
|
+
stateVector: dto.state_vector,
|
|
55825
|
+
throughSeq: dto.through_seq
|
|
55826
|
+
};
|
|
55827
|
+
}
|
|
55828
|
+
function LiveDocAnchorsResponseFromApiToFront(dto) {
|
|
55829
|
+
return {
|
|
55830
|
+
passages: dto.passages.map((item0) => LiveDocPassageDtoFromApiToFront(item0)),
|
|
55831
|
+
throughSeq: dto.through_seq
|
|
55832
|
+
};
|
|
55833
|
+
}
|
|
55834
|
+
function LiveDocAnchorDtoFromFrontToApi(model) {
|
|
55835
|
+
return {
|
|
55836
|
+
end: model.end,
|
|
55837
|
+
start: model.start
|
|
55838
|
+
};
|
|
55839
|
+
}
|
|
55840
|
+
function LiveDocPassageDtoFromApiToFront(dto) {
|
|
55841
|
+
switch (dto.state) {
|
|
55842
|
+
case "attached":
|
|
55843
|
+
return { state: dto.state, text: dto.text, truncated: dto.truncated };
|
|
55844
|
+
case "removed":
|
|
55845
|
+
return { state: dto.state };
|
|
55846
|
+
case "unknown":
|
|
55847
|
+
return { state: dto.state };
|
|
55848
|
+
}
|
|
55849
|
+
}
|
|
55850
|
+
function FrameCommentCapabilitiesFromApiToFront(dto) {
|
|
55851
|
+
return {
|
|
55852
|
+
canPost: dto.can_post,
|
|
55853
|
+
page: dto.page
|
|
55854
|
+
};
|
|
55855
|
+
}
|
|
55856
|
+
function FrameCommentReceiptFromApiToFront(dto) {
|
|
55857
|
+
return {
|
|
55858
|
+
id: dto.id
|
|
55859
|
+
};
|
|
55860
|
+
}
|
|
55861
|
+
function LiveDocDiffResponseFromApiToFront(dto) {
|
|
55862
|
+
return {
|
|
55863
|
+
stateVector: dto.state_vector,
|
|
55864
|
+
throughSeq: dto.through_seq,
|
|
55865
|
+
update: dto.update
|
|
55866
|
+
};
|
|
55867
|
+
}
|
|
55868
|
+
function LiveDocUpdatesResponseFromApiToFront(dto) {
|
|
55869
|
+
return {
|
|
55870
|
+
updates: dto.updates.map((item0) => LiveDocUpdateDtoFromApiToFront(item0))
|
|
55871
|
+
};
|
|
55872
|
+
}
|
|
55873
|
+
function LiveDocUpdateDtoFromApiToFront(dto) {
|
|
55874
|
+
return {
|
|
55875
|
+
author: LiveDocAuthorDtoFromApiToFront(dto.author),
|
|
55876
|
+
seq: dto.seq,
|
|
55877
|
+
update: dto.update
|
|
55878
|
+
};
|
|
55879
|
+
}
|
|
55880
|
+
function LiveDocAuthorDtoFromApiToFront(dto) {
|
|
55881
|
+
return {
|
|
55882
|
+
agent: dto.agent,
|
|
55883
|
+
onBehalfOf: dto.on_behalf_of,
|
|
55884
|
+
person: dto.person
|
|
55885
|
+
};
|
|
55886
|
+
}
|
|
55887
|
+
function LiveDocSeqResponseFromApiToFront(dto) {
|
|
55888
|
+
return {
|
|
55889
|
+
seq: dto.seq
|
|
55890
|
+
};
|
|
55891
|
+
}
|
|
55892
|
+
function LiveDocVersionsResponseFromApiToFront(dto) {
|
|
55893
|
+
return {
|
|
55894
|
+
versions: dto.versions.map((item0) => LiveDocVersionDtoFromApiToFront(item0))
|
|
55895
|
+
};
|
|
55896
|
+
}
|
|
55897
|
+
function LiveDocVersionDtoFromApiToFront(dto) {
|
|
55898
|
+
return {
|
|
55899
|
+
author: LiveDocAuthorDtoFromApiToFront(dto.author),
|
|
55900
|
+
generation: dto.generation,
|
|
55901
|
+
reason: LiveDocVersionReasonDtoFromApiToFront(dto.reason),
|
|
55902
|
+
takenAt: dto.taken_at,
|
|
55903
|
+
throughSeq: dto.through_seq
|
|
55904
|
+
};
|
|
55905
|
+
}
|
|
55906
|
+
function LiveDocVersionReasonDtoFromApiToFront(dto) {
|
|
55907
|
+
switch (dto.kind) {
|
|
55908
|
+
case "named":
|
|
55909
|
+
return { kind: dto.kind, name: dto.name };
|
|
55910
|
+
case "before_restore":
|
|
55911
|
+
return { kind: dto.kind, restored: dto.restored };
|
|
55912
|
+
case "before_agent_edit":
|
|
55913
|
+
return { kind: dto.kind };
|
|
55914
|
+
}
|
|
55915
|
+
}
|
|
55916
|
+
function TermSnapshotsResponseFromApiToFront(dto) {
|
|
55917
|
+
return {
|
|
55918
|
+
snapshots: dto.snapshots.map((item0) => TermSnapshotSummaryFromApiToFront(item0)),
|
|
55919
|
+
termId: dto.term_id
|
|
55920
|
+
};
|
|
55921
|
+
}
|
|
55922
|
+
function TermSnapshotSummaryFromApiToFront(dto) {
|
|
55923
|
+
return {
|
|
55924
|
+
description: dto.description,
|
|
55925
|
+
id: dto.id,
|
|
55926
|
+
savedAt: dto.saved_at
|
|
55927
|
+
};
|
|
55928
|
+
}
|
|
55929
|
+
function TermSnapshotPreviewFromApiToFront(dto) {
|
|
55930
|
+
return {
|
|
55931
|
+
diff: VersionDiffDtoFromApiToFront(dto.diff),
|
|
55932
|
+
recordEtag: dto.record_etag,
|
|
55933
|
+
snapshotEtag: dto.snapshot_etag,
|
|
55934
|
+
snapshotId: dto.snapshot_id,
|
|
55935
|
+
termId: dto.term_id
|
|
55936
|
+
};
|
|
55937
|
+
}
|
|
55938
|
+
function RestoreTermSnapshotResponseFromApiToFront(dto) {
|
|
55939
|
+
return {
|
|
55940
|
+
snapshotId: dto.snapshot_id,
|
|
55941
|
+
termId: dto.term_id,
|
|
55942
|
+
version: dto.version
|
|
55943
|
+
};
|
|
55944
|
+
}
|
|
55945
|
+
function LiveDocAnchorsRequestFromFrontToApi(model) {
|
|
55946
|
+
return {
|
|
55947
|
+
anchors: model.anchors.map((item0) => LiveDocAnchorDtoFromFrontToApi(item0))
|
|
55948
|
+
};
|
|
55949
|
+
}
|
|
55950
|
+
function LiveDocApplyRequestFromFrontToApi(model) {
|
|
55951
|
+
return {
|
|
55952
|
+
update: model.update
|
|
55953
|
+
};
|
|
55954
|
+
}
|
|
55955
|
+
function LiveDocDiffRequestFromFrontToApi(model) {
|
|
55956
|
+
return {
|
|
55957
|
+
state_vector: model.stateVector
|
|
55958
|
+
};
|
|
55959
|
+
}
|
|
55960
|
+
function LiveDocNameVersionRequestFromFrontToApi(model) {
|
|
55961
|
+
return {
|
|
55962
|
+
name: model.name
|
|
55963
|
+
};
|
|
55964
|
+
}
|
|
55965
|
+
function NewFrameCommentFromFrontToApi(model) {
|
|
55966
|
+
return {
|
|
55967
|
+
anchor: model.anchor == null ? model.anchor : LiveDocAnchorDtoFromFrontToApi(model.anchor),
|
|
55968
|
+
body: model.body,
|
|
55969
|
+
id: model.id,
|
|
55970
|
+
page: model.page,
|
|
55971
|
+
parent: model.parent
|
|
55972
|
+
};
|
|
55973
|
+
}
|
|
55974
|
+
function RestoreTermSnapshotRequestFromFrontToApi(model) {
|
|
55975
|
+
return {
|
|
55976
|
+
snapshot_etag: model.snapshotEtag,
|
|
55977
|
+
snapshot_id: model.snapshotId
|
|
55978
|
+
};
|
|
55979
|
+
}
|
|
55980
|
+
|
|
55457
55981
|
// src/resources/terms.ts
|
|
55458
55982
|
var TermsClient = class {
|
|
55459
55983
|
/** @internal */
|
|
@@ -56145,6 +56669,347 @@ var TermsClient = class {
|
|
|
56145
56669
|
requestOptions
|
|
56146
56670
|
);
|
|
56147
56671
|
}
|
|
56672
|
+
/**
|
|
56673
|
+
* Open a term's live document
|
|
56674
|
+
*
|
|
56675
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56676
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56677
|
+
* @returns The engine's answer as `LiveDocStateResponse`, camelCase.
|
|
56678
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56679
|
+
* @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
|
|
56680
|
+
*
|
|
56681
|
+
* @remarks Uses GET `/api/v1/terms/{id}/live`.
|
|
56682
|
+
* The whole state and its state vector. A term never edited live answers an empty document at
|
|
56683
|
+
* `through_seq` 0.
|
|
56684
|
+
*
|
|
56685
|
+
* @example
|
|
56686
|
+
* ```typescript
|
|
56687
|
+
* const { state, throughSeq } = await client.terms.openLiveDoc(termId);
|
|
56688
|
+
* ```
|
|
56689
|
+
*/
|
|
56690
|
+
async openLiveDoc(termId, requestOptions) {
|
|
56691
|
+
const response = await this.api.openLiveDoc(termId, toRequestParams(requestOptions));
|
|
56692
|
+
return decodeResponse(response, LiveDocStateResponseFromApiToFront);
|
|
56693
|
+
}
|
|
56694
|
+
/**
|
|
56695
|
+
* Read the passages comment anchors point at
|
|
56696
|
+
*
|
|
56697
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56698
|
+
* @param request - The request (`LiveDocAnchorsRequest`), camelCase; sent snake_case.
|
|
56699
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56700
|
+
* @returns The engine's answer as `LiveDocAnchorsResponse`, camelCase.
|
|
56701
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56702
|
+
* @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
|
|
56703
|
+
* @throws {ApiError} 413: A position over 1 KiB
|
|
56704
|
+
* @throws {ApiError} 422: Over 500 anchors, or a position that does not decode
|
|
56705
|
+
*
|
|
56706
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/anchors`.
|
|
56707
|
+
* Each anchor is resolved against the document as it stands. A reader of the term may call it: it
|
|
56708
|
+
* writes nothing.
|
|
56709
|
+
*
|
|
56710
|
+
* @example
|
|
56711
|
+
* ```typescript
|
|
56712
|
+
* const { passages } = await client.terms.resolveLiveDocAnchors(termId, { anchors: [{ start, end }] });
|
|
56713
|
+
* ```
|
|
56714
|
+
*/
|
|
56715
|
+
async resolveLiveDocAnchors(termId, request, requestOptions) {
|
|
56716
|
+
const response = await this.api.resolveLiveDocAnchors(
|
|
56717
|
+
termId,
|
|
56718
|
+
LiveDocAnchorsRequestFromFrontToApi(request),
|
|
56719
|
+
toRequestParams(requestOptions)
|
|
56720
|
+
);
|
|
56721
|
+
return decodeResponse(response, LiveDocAnchorsResponseFromApiToFront);
|
|
56722
|
+
}
|
|
56723
|
+
/**
|
|
56724
|
+
* Check comment support and whether the caller can open a new thread.
|
|
56725
|
+
*
|
|
56726
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56727
|
+
* @param options - `page`: The saved Frame page the comment would be made on.
|
|
56728
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56729
|
+
* @returns The engine's answer as `FrameCommentCapabilities`, camelCase.
|
|
56730
|
+
* @throws {ApiError} 404: Frame or comments unavailable
|
|
56731
|
+
* @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
|
|
56732
|
+
*
|
|
56733
|
+
* @remarks Uses GET `/api/v1/terms/{id}/live/comments`.
|
|
56734
|
+
*
|
|
56735
|
+
* @example
|
|
56736
|
+
* ```typescript
|
|
56737
|
+
* const capabilities = await client.terms.getFrameCommentCapabilities(termId, { page: "home" });
|
|
56738
|
+
* ```
|
|
56739
|
+
*/
|
|
56740
|
+
async getFrameCommentCapabilities(termId, options = {}, requestOptions) {
|
|
56741
|
+
const response = await this.api.getFrameCommentCapabilities(
|
|
56742
|
+
termId,
|
|
56743
|
+
{ page: options.page },
|
|
56744
|
+
toRequestParams(requestOptions)
|
|
56745
|
+
);
|
|
56746
|
+
return decodeResponse(response, FrameCommentCapabilitiesFromApiToFront);
|
|
56747
|
+
}
|
|
56748
|
+
/**
|
|
56749
|
+
* Store a comment after checking access to its Frame, its sort and its parent.
|
|
56750
|
+
*
|
|
56751
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56752
|
+
* @param request - The request (`NewFrameComment`), camelCase; sent snake_case.
|
|
56753
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56754
|
+
* @returns The engine's answer as `FrameCommentReceipt`, camelCase.
|
|
56755
|
+
* @throws {ApiError} 404: Frame or parent unavailable
|
|
56756
|
+
* @throws {ApiError} 409: Comment ID is occupied or the scope changed
|
|
56757
|
+
* @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
|
|
56758
|
+
* @throws {ApiError} 422: Invalid comment or selection
|
|
56759
|
+
*
|
|
56760
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/comments`.
|
|
56761
|
+
*
|
|
56762
|
+
* @example
|
|
56763
|
+
* ```typescript
|
|
56764
|
+
* const receipt = await client.terms.createFrameComment(termId, comment);
|
|
56765
|
+
* ```
|
|
56766
|
+
*/
|
|
56767
|
+
async createFrameComment(termId, request, requestOptions) {
|
|
56768
|
+
const response = await this.api.createFrameComment(
|
|
56769
|
+
termId,
|
|
56770
|
+
NewFrameCommentFromFrontToApi(request),
|
|
56771
|
+
toRequestParams(requestOptions)
|
|
56772
|
+
);
|
|
56773
|
+
return decodeResponse(response, FrameCommentReceiptFromApiToFront);
|
|
56774
|
+
}
|
|
56775
|
+
/**
|
|
56776
|
+
* What a client lacks
|
|
56777
|
+
*
|
|
56778
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56779
|
+
* @param request - The request (`LiveDocDiffRequest`), camelCase; sent snake_case.
|
|
56780
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56781
|
+
* @returns The engine's answer as `LiveDocDiffResponse`, camelCase.
|
|
56782
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56783
|
+
* @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
|
|
56784
|
+
* @throws {ApiError} 422: Not a Yjs state vector
|
|
56785
|
+
*
|
|
56786
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/diff`.
|
|
56787
|
+
* One Yjs v1 update bringing the given state vector up to date, and the server's own state vector.
|
|
56788
|
+
*
|
|
56789
|
+
* @example
|
|
56790
|
+
* ```typescript
|
|
56791
|
+
* const diff = await client.terms.diffLiveDoc(termId, { stateVector });
|
|
56792
|
+
* ```
|
|
56793
|
+
*/
|
|
56794
|
+
async diffLiveDoc(termId, request, requestOptions) {
|
|
56795
|
+
const response = await this.api.diffLiveDoc(
|
|
56796
|
+
termId,
|
|
56797
|
+
LiveDocDiffRequestFromFrontToApi(request),
|
|
56798
|
+
toRequestParams(requestOptions)
|
|
56799
|
+
);
|
|
56800
|
+
return decodeResponse(response, LiveDocDiffResponseFromApiToFront);
|
|
56801
|
+
}
|
|
56802
|
+
/**
|
|
56803
|
+
* Read a live document's update log
|
|
56804
|
+
*
|
|
56805
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56806
|
+
* @param options - `after`: Only the updates after this sequence number.
|
|
56807
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56808
|
+
* @returns The engine's answer as `LiveDocUpdatesResponse`, camelCase.
|
|
56809
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56810
|
+
* @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
|
|
56811
|
+
*
|
|
56812
|
+
* @remarks Uses GET `/api/v1/terms/{id}/live/updates`.
|
|
56813
|
+
* The updates numbered above `after`, oldest first.
|
|
56814
|
+
*
|
|
56815
|
+
* @example
|
|
56816
|
+
* ```typescript
|
|
56817
|
+
* const { updates } = await client.terms.listLiveDocUpdates(termId, { after: 41 });
|
|
56818
|
+
* ```
|
|
56819
|
+
*/
|
|
56820
|
+
async listLiveDocUpdates(termId, options = {}, requestOptions) {
|
|
56821
|
+
const response = await this.api.listLiveDocUpdates(
|
|
56822
|
+
termId,
|
|
56823
|
+
{ after: options.after },
|
|
56824
|
+
toRequestParams(requestOptions)
|
|
56825
|
+
);
|
|
56826
|
+
return decodeResponse(response, LiveDocUpdatesResponseFromApiToFront);
|
|
56827
|
+
}
|
|
56828
|
+
/**
|
|
56829
|
+
* Apply edits to a term's live document
|
|
56830
|
+
*
|
|
56831
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56832
|
+
* @param request - The request (`LiveDocApplyRequest`), camelCase; sent snake_case.
|
|
56833
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56834
|
+
* @returns The engine's answer as `LiveDocSeqResponse`, camelCase.
|
|
56835
|
+
* @throws {ApiError} 403: The caller may read the term but not write it
|
|
56836
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56837
|
+
* @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
|
|
56838
|
+
* @throws {ApiError} 413: Over 4 MiB
|
|
56839
|
+
* @throws {ApiError} 422: Not a Yjs v1 update
|
|
56840
|
+
* @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
|
|
56841
|
+
*
|
|
56842
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/updates`.
|
|
56843
|
+
* Appends one Yjs v1 update, attributed to the caller, and answers its number. Live editors
|
|
56844
|
+
* connected to the document receive it.
|
|
56845
|
+
*
|
|
56846
|
+
* @example
|
|
56847
|
+
* ```typescript
|
|
56848
|
+
* const { seq } = await client.terms.applyLiveDocUpdate(termId, { update });
|
|
56849
|
+
* ```
|
|
56850
|
+
*/
|
|
56851
|
+
async applyLiveDocUpdate(termId, request, requestOptions) {
|
|
56852
|
+
const response = await this.api.applyLiveDocUpdate(
|
|
56853
|
+
termId,
|
|
56854
|
+
LiveDocApplyRequestFromFrontToApi(request),
|
|
56855
|
+
toRequestParams(requestOptions)
|
|
56856
|
+
);
|
|
56857
|
+
return decodeResponse(response, LiveDocSeqResponseFromApiToFront);
|
|
56858
|
+
}
|
|
56859
|
+
/**
|
|
56860
|
+
* List a live document's versions
|
|
56861
|
+
*
|
|
56862
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56863
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56864
|
+
* @returns The engine's answer as `LiveDocVersionsResponse`, camelCase.
|
|
56865
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56866
|
+
* @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
|
|
56867
|
+
*
|
|
56868
|
+
* @remarks Uses GET `/api/v1/terms/{id}/live/versions`.
|
|
56869
|
+
*
|
|
56870
|
+
* @example
|
|
56871
|
+
* ```typescript
|
|
56872
|
+
* const { versions } = await client.terms.listLiveDocVersions(termId);
|
|
56873
|
+
* ```
|
|
56874
|
+
*/
|
|
56875
|
+
async listLiveDocVersions(termId, requestOptions) {
|
|
56876
|
+
const response = await this.api.listLiveDocVersions(termId, toRequestParams(requestOptions));
|
|
56877
|
+
return decodeResponse(response, LiveDocVersionsResponseFromApiToFront);
|
|
56878
|
+
}
|
|
56879
|
+
/**
|
|
56880
|
+
* Name a version of a live document
|
|
56881
|
+
*
|
|
56882
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56883
|
+
* @param request - The request (`LiveDocNameVersionRequest`), camelCase; sent snake_case.
|
|
56884
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56885
|
+
* @returns The engine's answer as `LiveDocVersionDto`, camelCase.
|
|
56886
|
+
* @throws {ApiError} 403: The caller may read the term but not write it
|
|
56887
|
+
* @throws {ApiError} 404: No such term, or the caller may not read it
|
|
56888
|
+
* @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
|
|
56889
|
+
* @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
|
|
56890
|
+
*
|
|
56891
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/versions`.
|
|
56892
|
+
* Keeps the current state as a named version.
|
|
56893
|
+
*
|
|
56894
|
+
* @example
|
|
56895
|
+
* ```typescript
|
|
56896
|
+
* const version = await client.terms.nameLiveDocVersion(termId, { name: "Sent to legal" });
|
|
56897
|
+
* ```
|
|
56898
|
+
*/
|
|
56899
|
+
async nameLiveDocVersion(termId, request, requestOptions) {
|
|
56900
|
+
const response = await this.api.nameLiveDocVersion(
|
|
56901
|
+
termId,
|
|
56902
|
+
LiveDocNameVersionRequestFromFrontToApi(request),
|
|
56903
|
+
toRequestParams(requestOptions)
|
|
56904
|
+
);
|
|
56905
|
+
return decodeResponse(response, LiveDocVersionDtoFromApiToFront);
|
|
56906
|
+
}
|
|
56907
|
+
/**
|
|
56908
|
+
* Restore a version of a live document (ENG-365)
|
|
56909
|
+
*
|
|
56910
|
+
* @param termId - The term (UUID) whose live document it is.
|
|
56911
|
+
* @param generation - The version (generation) to restore.
|
|
56912
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56913
|
+
* @returns The engine's answer as `LiveDocSeqResponse`, camelCase.
|
|
56914
|
+
* @throws {ApiError} 403: The caller may read the term but not write it
|
|
56915
|
+
* @throws {ApiError} 404: No such term or version, or the caller may not read the term
|
|
56916
|
+
* @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
|
|
56917
|
+
* @throws {ApiError} 503: Busy with other writers; retry after the Retry-After delay
|
|
56918
|
+
*
|
|
56919
|
+
* @remarks Uses POST `/api/v1/terms/{id}/live/versions/{generation}/restore`.
|
|
56920
|
+
* Keeps the current state as a "before restore" version, then brings the old content back as one
|
|
56921
|
+
* new update, so live editors converge and the history stays whole. Answers the update's number.
|
|
56922
|
+
*
|
|
56923
|
+
* @example
|
|
56924
|
+
* ```typescript
|
|
56925
|
+
* await client.terms.restoreLiveDocVersion(termId, 3);
|
|
56926
|
+
* ```
|
|
56927
|
+
*/
|
|
56928
|
+
async restoreLiveDocVersion(termId, generation, requestOptions) {
|
|
56929
|
+
const response = await this.api.restoreLiveDocVersion(
|
|
56930
|
+
termId,
|
|
56931
|
+
generation,
|
|
56932
|
+
toRequestParams(requestOptions)
|
|
56933
|
+
);
|
|
56934
|
+
return decodeResponse(response, LiveDocSeqResponseFromApiToFront);
|
|
56935
|
+
}
|
|
56936
|
+
/**
|
|
56937
|
+
* Reapply a saved record snapshot under the normal record write guards.
|
|
56938
|
+
*
|
|
56939
|
+
* @param termId - The term (UUID).
|
|
56940
|
+
* @param request - The request (`RestoreTermSnapshotRequest`), camelCase; sent snake_case.
|
|
56941
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56942
|
+
* @returns The engine's answer as `RestoreTermSnapshotResponse`, camelCase.
|
|
56943
|
+
* @throws {ApiError} 403: The caller cannot edit the record
|
|
56944
|
+
* @throws {ApiError} 404: The record or matching snapshot is unavailable
|
|
56945
|
+
* @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
|
|
56946
|
+
* @throws {ApiError} 412: The record changed since review
|
|
56947
|
+
* @throws {ApiError} 422: The snapshot has invalid or unavailable values
|
|
56948
|
+
* @throws {ApiError} 428: A strong record content tag is required
|
|
56949
|
+
* @throws {ApiError} 503: Record history is unavailable
|
|
56950
|
+
*
|
|
56951
|
+
* @remarks Uses POST `/api/v1/terms/{id}/restore-snapshot`.
|
|
56952
|
+
*
|
|
56953
|
+
* @example
|
|
56954
|
+
* ```typescript
|
|
56955
|
+
* await client.terms.restoreTermSnapshot(termId, request);
|
|
56956
|
+
* ```
|
|
56957
|
+
*/
|
|
56958
|
+
async restoreTermSnapshot(termId, request, requestOptions) {
|
|
56959
|
+
const response = await this.api.restoreTermSnapshot(
|
|
56960
|
+
termId,
|
|
56961
|
+
RestoreTermSnapshotRequestFromFrontToApi(request),
|
|
56962
|
+
toRequestParams(requestOptions)
|
|
56963
|
+
);
|
|
56964
|
+
return decodeResponse(response, RestoreTermSnapshotResponseFromApiToFront);
|
|
56965
|
+
}
|
|
56966
|
+
/**
|
|
56967
|
+
* List the saved snapshots this caller can review for an editable record.
|
|
56968
|
+
*
|
|
56969
|
+
* @param termId - The term (UUID).
|
|
56970
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56971
|
+
* @returns The engine's answer as `TermSnapshotsResponse`, camelCase.
|
|
56972
|
+
* @throws {ApiError} 403: The caller cannot edit the record
|
|
56973
|
+
* @throws {ApiError} 404: The record is unavailable
|
|
56974
|
+
* @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
|
|
56975
|
+
*
|
|
56976
|
+
* @remarks Uses GET `/api/v1/terms/{id}/snapshots`.
|
|
56977
|
+
*
|
|
56978
|
+
* @example
|
|
56979
|
+
* ```typescript
|
|
56980
|
+
* const { snapshots } = await client.terms.listTermSnapshots(termId);
|
|
56981
|
+
* ```
|
|
56982
|
+
*/
|
|
56983
|
+
async listTermSnapshots(termId, requestOptions) {
|
|
56984
|
+
const response = await this.api.listTermSnapshots(termId, toRequestParams(requestOptions));
|
|
56985
|
+
return decodeResponse(response, TermSnapshotsResponseFromApiToFront);
|
|
56986
|
+
}
|
|
56987
|
+
/**
|
|
56988
|
+
* Compare a saved snapshot with the record before it is restored.
|
|
56989
|
+
*
|
|
56990
|
+
* @param termId - The term (UUID).
|
|
56991
|
+
* @param snapshot - The snapshot, as `listTermSnapshots` names it.
|
|
56992
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
56993
|
+
* @returns The engine's answer as `TermSnapshotPreview`, camelCase.
|
|
56994
|
+
* @throws {ApiError} 403: The caller cannot edit the record
|
|
56995
|
+
* @throws {ApiError} 404: The record or snapshot is unavailable
|
|
56996
|
+
* @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
|
|
56997
|
+
*
|
|
56998
|
+
* @remarks Uses GET `/api/v1/terms/{id}/snapshots/{snapshot}`.
|
|
56999
|
+
*
|
|
57000
|
+
* @example
|
|
57001
|
+
* ```typescript
|
|
57002
|
+
* const preview = await client.terms.previewTermSnapshot(termId, snapshot);
|
|
57003
|
+
* ```
|
|
57004
|
+
*/
|
|
57005
|
+
async previewTermSnapshot(termId, snapshot, requestOptions) {
|
|
57006
|
+
const response = await this.api.previewTermSnapshot(
|
|
57007
|
+
termId,
|
|
57008
|
+
snapshot,
|
|
57009
|
+
toRequestParams(requestOptions)
|
|
57010
|
+
);
|
|
57011
|
+
return decodeResponse(response, TermSnapshotPreviewFromApiToFront);
|
|
57012
|
+
}
|
|
56148
57013
|
};
|
|
56149
57014
|
function withEtag(body, headers) {
|
|
56150
57015
|
const etag = headers.get("etag");
|
|
@@ -57449,7 +58314,9 @@ function UIGenerateRequestFromFrontToApi(model) {
|
|
|
57449
58314
|
pipeline: model.pipeline ?? void 0,
|
|
57450
58315
|
prompt: model.prompt,
|
|
57451
58316
|
save_as_page: model.saveAsPage ?? void 0,
|
|
57452
|
-
trace: model.trace ?? void 0
|
|
58317
|
+
trace: model.trace ?? void 0,
|
|
58318
|
+
authoring: model.authoring == null ? model.authoring : FrameAuthoringOriginFromFrontToApi(model.authoring),
|
|
58319
|
+
table: model.table == null ? model.table : { sort: model.table.sort, columns: [...model.table.columns] }
|
|
57453
58320
|
};
|
|
57454
58321
|
}
|
|
57455
58322
|
function UIDataRowFromApiToFront(row) {
|
|
@@ -59467,6 +60334,135 @@ function AgentRecallAsOfResponseFromApiToFront(dto) {
|
|
|
59467
60334
|
};
|
|
59468
60335
|
}
|
|
59469
60336
|
|
|
60337
|
+
// src/normalizers/agent-instructions.ts
|
|
60338
|
+
function AgentInstructionsViewFromApiToFront(dto) {
|
|
60339
|
+
return {
|
|
60340
|
+
draft: dto.draft == null ? dto.draft : InstructionsDraftViewFromApiToFront(dto.draft),
|
|
60341
|
+
publishedBody: dto.published_body,
|
|
60342
|
+
publishedRevision: dto.published_revision
|
|
60343
|
+
};
|
|
60344
|
+
}
|
|
60345
|
+
function InstructionsDraftViewFromApiToFront(dto) {
|
|
60346
|
+
return {
|
|
60347
|
+
body: dto.body,
|
|
60348
|
+
rehearsed: dto.rehearsed,
|
|
60349
|
+
revision: dto.revision
|
|
60350
|
+
};
|
|
60351
|
+
}
|
|
60352
|
+
function AgentRehearsalViewFromApiToFront(dto) {
|
|
60353
|
+
return {
|
|
60354
|
+
answer: ConversationMessageResponseFromApiToFront(dto.answer),
|
|
60355
|
+
instructions: AgentInstructionsViewFromApiToFront(dto.instructions)
|
|
60356
|
+
};
|
|
60357
|
+
}
|
|
60358
|
+
function AgentSkillsResponseFromApiToFront(dto) {
|
|
60359
|
+
return {
|
|
60360
|
+
agentId: dto.agent_id,
|
|
60361
|
+
definitionVersion: dto.definition_version,
|
|
60362
|
+
skills: dto.skills.map((item0) => item0)
|
|
60363
|
+
};
|
|
60364
|
+
}
|
|
60365
|
+
function AgentSkillsRequestFromFrontToApi(model) {
|
|
60366
|
+
return {
|
|
60367
|
+
skills: model.skills.map((item0) => item0)
|
|
60368
|
+
};
|
|
60369
|
+
}
|
|
60370
|
+
function PublishAgentInstructionsFromFrontToApi(model) {
|
|
60371
|
+
return {
|
|
60372
|
+
revision: model.revision
|
|
60373
|
+
};
|
|
60374
|
+
}
|
|
60375
|
+
function RehearseAgentInstructionsFromFrontToApi(model) {
|
|
60376
|
+
return {
|
|
60377
|
+
context_term_ids: model.contextTermIds,
|
|
60378
|
+
conversation_id: model.conversationId,
|
|
60379
|
+
message: model.message,
|
|
60380
|
+
project_id: model.projectId,
|
|
60381
|
+
revision: model.revision
|
|
60382
|
+
};
|
|
60383
|
+
}
|
|
60384
|
+
function SaveAgentInstructionsFromFrontToApi(model) {
|
|
60385
|
+
return {
|
|
60386
|
+
body: model.body,
|
|
60387
|
+
expected_revision: model.expectedRevision
|
|
60388
|
+
};
|
|
60389
|
+
}
|
|
60390
|
+
function isAgentRehearsalView(value) {
|
|
60391
|
+
return componentFault(value, "AgentRehearsalView", "done") === void 0;
|
|
60392
|
+
}
|
|
60393
|
+
function AgentRehearsalEventFromApiToFront(event, payload) {
|
|
60394
|
+
if (event === "done") {
|
|
60395
|
+
return isAgentRehearsalView(payload) ? { type: "done", rehearsal: AgentRehearsalViewFromApiToFront(payload) } : null;
|
|
60396
|
+
}
|
|
60397
|
+
if (typeof payload !== "object" || payload === null) return null;
|
|
60398
|
+
if (event === "token") {
|
|
60399
|
+
const delta = Reflect.get(payload, "delta");
|
|
60400
|
+
return typeof delta === "string" ? { type: "token", delta } : null;
|
|
60401
|
+
}
|
|
60402
|
+
if (event === "error") {
|
|
60403
|
+
const error = Reflect.get(payload, "error");
|
|
60404
|
+
const status = Reflect.get(payload, "status");
|
|
60405
|
+
if (typeof error !== "string") return null;
|
|
60406
|
+
return typeof status === "number" ? { type: "error", error, status } : { type: "error", error };
|
|
60407
|
+
}
|
|
60408
|
+
return null;
|
|
60409
|
+
}
|
|
60410
|
+
|
|
60411
|
+
// src/utils/sse.ts
|
|
60412
|
+
var FRAME_SEPARATORS = ["\r\n\r\n", "\n\n", "\r\r"];
|
|
60413
|
+
var LINE_TERMINATOR = /\r\n|\n|\r/;
|
|
60414
|
+
async function* readSseFrames(body) {
|
|
60415
|
+
const reader = body.getReader();
|
|
60416
|
+
const decoder = new TextDecoder();
|
|
60417
|
+
let buffer = "";
|
|
60418
|
+
try {
|
|
60419
|
+
for (; ; ) {
|
|
60420
|
+
const chunk = await reader.read();
|
|
60421
|
+
if (chunk.done) break;
|
|
60422
|
+
buffer += decoder.decode(chunk.value, { stream: true });
|
|
60423
|
+
let boundary = findFrameBoundary(buffer);
|
|
60424
|
+
while (boundary !== null) {
|
|
60425
|
+
const frame = decodeFrame(buffer.slice(0, boundary.index));
|
|
60426
|
+
buffer = buffer.slice(boundary.index + boundary.length);
|
|
60427
|
+
if (frame !== null) yield frame;
|
|
60428
|
+
boundary = findFrameBoundary(buffer);
|
|
60429
|
+
}
|
|
60430
|
+
}
|
|
60431
|
+
buffer += decoder.decode();
|
|
60432
|
+
const trailing = decodeFrame(buffer);
|
|
60433
|
+
if (trailing !== null) yield trailing;
|
|
60434
|
+
} finally {
|
|
60435
|
+
await reader.cancel().catch(() => void 0);
|
|
60436
|
+
}
|
|
60437
|
+
}
|
|
60438
|
+
function findFrameBoundary(buffer) {
|
|
60439
|
+
let found = null;
|
|
60440
|
+
for (const separator of FRAME_SEPARATORS) {
|
|
60441
|
+
const index = buffer.indexOf(separator);
|
|
60442
|
+
if (index === -1) continue;
|
|
60443
|
+
if (found === null || index < found.index || index === found.index && separator.length > found.length) {
|
|
60444
|
+
found = { index, length: separator.length };
|
|
60445
|
+
}
|
|
60446
|
+
}
|
|
60447
|
+
return found;
|
|
60448
|
+
}
|
|
60449
|
+
function decodeFrame(text2) {
|
|
60450
|
+
const dataLines = [];
|
|
60451
|
+
let event;
|
|
60452
|
+
for (const line of text2.split(LINE_TERMINATOR)) {
|
|
60453
|
+
if (line === "" || line.startsWith(":")) continue;
|
|
60454
|
+
const colon = line.indexOf(":");
|
|
60455
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
60456
|
+
const rawValue = colon === -1 ? "" : line.slice(colon + 1);
|
|
60457
|
+
const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
|
|
60458
|
+
if (field === "data") dataLines.push(value);
|
|
60459
|
+
else if (field === "event") event = value;
|
|
60460
|
+
}
|
|
60461
|
+
const data = dataLines.join("\n");
|
|
60462
|
+
if (data === "") return null;
|
|
60463
|
+
return { event: event === "" ? void 0 : event, data };
|
|
60464
|
+
}
|
|
60465
|
+
|
|
59470
60466
|
// src/resources/cognitive.ts
|
|
59471
60467
|
var CognitiveClient = class {
|
|
59472
60468
|
/** @internal */
|
|
@@ -60404,6 +61400,160 @@ var CognitiveClient = class {
|
|
|
60404
61400
|
}
|
|
60405
61401
|
};
|
|
60406
61402
|
}
|
|
61403
|
+
/**
|
|
61404
|
+
* getAgentInstructions
|
|
61405
|
+
*
|
|
61406
|
+
* @param agentId - The agent (UUID).
|
|
61407
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
61408
|
+
* @returns The engine's answer as `AgentInstructionsView`, camelCase.
|
|
61409
|
+
* @throws {ApiError} 403: Named edit access required
|
|
61410
|
+
* @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
|
|
61411
|
+
*
|
|
61412
|
+
* @remarks Uses GET `/api/v1/cognitive/agents/{agent_id}/instructions`.
|
|
61413
|
+
*
|
|
61414
|
+
* @example
|
|
61415
|
+
* ```typescript
|
|
61416
|
+
* const view = await client.cognitive.getAgentInstructions(agentId);
|
|
61417
|
+
* ```
|
|
61418
|
+
*/
|
|
61419
|
+
async getAgentInstructions(agentId, requestOptions) {
|
|
61420
|
+
const response = await this.api.get(agentId, toRequestParams(requestOptions));
|
|
61421
|
+
return decodeResponse(response, AgentInstructionsViewFromApiToFront);
|
|
61422
|
+
}
|
|
61423
|
+
/**
|
|
61424
|
+
* saveAgentInstructions
|
|
61425
|
+
*
|
|
61426
|
+
* @param agentId - The agent (UUID).
|
|
61427
|
+
* @param request - The request (`SaveAgentInstructions`), camelCase; sent snake_case.
|
|
61428
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
61429
|
+
* @returns The engine's answer as `AgentInstructionsView`, camelCase.
|
|
61430
|
+
* @throws {ApiError} 403: Named edit access required
|
|
61431
|
+
* @throws {ApiError} 409: Draft changed while it was being edited
|
|
61432
|
+
* @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
|
|
61433
|
+
*
|
|
61434
|
+
* @remarks Uses PUT `/api/v1/cognitive/agents/{agent_id}/instructions`.
|
|
61435
|
+
*
|
|
61436
|
+
* @example
|
|
61437
|
+
* ```typescript
|
|
61438
|
+
* await client.cognitive.saveAgentInstructions(agentId, draft);
|
|
61439
|
+
* ```
|
|
61440
|
+
*/
|
|
61441
|
+
async saveAgentInstructions(agentId, request, requestOptions) {
|
|
61442
|
+
const response = await this.api.save(
|
|
61443
|
+
agentId,
|
|
61444
|
+
SaveAgentInstructionsFromFrontToApi(request),
|
|
61445
|
+
toRequestParams(requestOptions)
|
|
61446
|
+
);
|
|
61447
|
+
return decodeResponse(response, AgentInstructionsViewFromApiToFront);
|
|
61448
|
+
}
|
|
61449
|
+
/**
|
|
61450
|
+
* publishAgentInstructions
|
|
61451
|
+
*
|
|
61452
|
+
* @param agentId - The agent (UUID).
|
|
61453
|
+
* @param request - The request (`PublishAgentInstructions`), camelCase; sent snake_case.
|
|
61454
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
61455
|
+
* @returns The engine's answer as `AgentInstructionsView`, camelCase.
|
|
61456
|
+
* @throws {ApiError} 403: Named edit access required
|
|
61457
|
+
* @throws {ApiError} 409: The requested draft has changed
|
|
61458
|
+
* @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
|
|
61459
|
+
* @throws {ApiError} 422: Rehearse this draft before publishing
|
|
61460
|
+
*
|
|
61461
|
+
* @remarks Uses POST `/api/v1/cognitive/agents/{agent_id}/instructions/publish`.
|
|
61462
|
+
*
|
|
61463
|
+
* @example
|
|
61464
|
+
* ```typescript
|
|
61465
|
+
* await client.cognitive.publishAgentInstructions(agentId, request);
|
|
61466
|
+
* ```
|
|
61467
|
+
*/
|
|
61468
|
+
async publishAgentInstructions(agentId, request, requestOptions) {
|
|
61469
|
+
const response = await this.api.publish(
|
|
61470
|
+
agentId,
|
|
61471
|
+
PublishAgentInstructionsFromFrontToApi(request),
|
|
61472
|
+
toRequestParams(requestOptions)
|
|
61473
|
+
);
|
|
61474
|
+
return decodeResponse(response, AgentInstructionsViewFromApiToFront);
|
|
61475
|
+
}
|
|
61476
|
+
/**
|
|
61477
|
+
* Rehearse a draft of an agent's instructions: the agent answers one message
|
|
61478
|
+
* under the draft, streamed, and the rehearsal is recorded on the draft.
|
|
61479
|
+
*
|
|
61480
|
+
* @param agentId - The agent (UUID).
|
|
61481
|
+
* @param request - The rehearsal (`RehearseAgentInstructions`): the draft revision and the message.
|
|
61482
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
61483
|
+
* @returns The stream's events: `token` (an answer delta), then `done` with the
|
|
61484
|
+
* saved instructions receipt and the answer, or `error`.
|
|
61485
|
+
* @throws {ApiError} 403 without named edit access and agent scope; 409 when the
|
|
61486
|
+
* requested draft changed; 503 when agent authoring is unavailable.
|
|
61487
|
+
* @throws {NetworkError} When the stream carries no event stream, a malformed
|
|
61488
|
+
* event, or ends without a `done` or `error` event.
|
|
61489
|
+
*
|
|
61490
|
+
* @remarks Uses POST `/api/v1/cognitive/agents/{agent_id}/instructions/rehearse`
|
|
61491
|
+
* (`text/event-stream`). Errors after the stream opened arrive as `error` events.
|
|
61492
|
+
*
|
|
61493
|
+
* @example
|
|
61494
|
+
* ```typescript
|
|
61495
|
+
* for await (const event of client.cognitive.rehearseAgentInstructions(agentId, request)) {
|
|
61496
|
+
* if (event.type === 'done') console.log(event.rehearsal.answer.assistantMessage);
|
|
61497
|
+
* }
|
|
61498
|
+
* ```
|
|
61499
|
+
*/
|
|
61500
|
+
async *rehearseAgentInstructions(agentId, request, requestOptions) {
|
|
61501
|
+
const response = await this.api.rehearse(
|
|
61502
|
+
agentId,
|
|
61503
|
+
RehearseAgentInstructionsFromFrontToApi(request),
|
|
61504
|
+
mergeRequestParams({ headers: { Accept: "text/event-stream" } }, requestOptions)
|
|
61505
|
+
);
|
|
61506
|
+
const body = response.body;
|
|
61507
|
+
if (body === null) throw new NetworkError("Rehearsal response carried no event stream");
|
|
61508
|
+
for await (const frame of readSseFrames(body)) {
|
|
61509
|
+
if (frame.event !== "token" && frame.event !== "done" && frame.event !== "error") continue;
|
|
61510
|
+
let payload;
|
|
61511
|
+
try {
|
|
61512
|
+
payload = JSON.parse(frame.data);
|
|
61513
|
+
} catch (error) {
|
|
61514
|
+
throw new NetworkError(
|
|
61515
|
+
`Rehearsal stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
|
|
61516
|
+
error instanceof Error ? error : void 0
|
|
61517
|
+
);
|
|
61518
|
+
}
|
|
61519
|
+
const event = AgentRehearsalEventFromApiToFront(frame.event, payload);
|
|
61520
|
+
if (event === null) {
|
|
61521
|
+
throw new NetworkError(
|
|
61522
|
+
`Rehearsal stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
|
|
61523
|
+
);
|
|
61524
|
+
}
|
|
61525
|
+
yield event;
|
|
61526
|
+
if (event.type !== "token") return;
|
|
61527
|
+
}
|
|
61528
|
+
throw new NetworkError("Rehearsal stream ended without a done or error event");
|
|
61529
|
+
}
|
|
61530
|
+
/**
|
|
61531
|
+
* State an agent's skills.
|
|
61532
|
+
*
|
|
61533
|
+
* @param agentId - The agent (UUID).
|
|
61534
|
+
* @param request - The request (`AgentSkillsRequest`), camelCase; sent snake_case.
|
|
61535
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
61536
|
+
* @returns The engine's answer as `AgentSkillsResponse`, camelCase.
|
|
61537
|
+
* @throws {ApiError} 403: The caller is not the agent's Owner or a Space admin — `code: agent_skills_not_yours`
|
|
61538
|
+
* @throws {ApiError} 404: No such agent in this Space
|
|
61539
|
+
* @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
|
|
61540
|
+
* @throws {ApiError} 422: A skill is no task template of this Space — `code: agent_skill_unknown`
|
|
61541
|
+
*
|
|
61542
|
+
* @remarks Uses PUT `/api/v1/cognitive/agents/{agent_id}/skills`.
|
|
61543
|
+
*
|
|
61544
|
+
* @example
|
|
61545
|
+
* ```typescript
|
|
61546
|
+
* await client.cognitive.putAgentSkills(agentId, request);
|
|
61547
|
+
* ```
|
|
61548
|
+
*/
|
|
61549
|
+
async putAgentSkills(agentId, request, requestOptions) {
|
|
61550
|
+
const response = await this.api.putAgentSkills(
|
|
61551
|
+
agentId,
|
|
61552
|
+
AgentSkillsRequestFromFrontToApi(request),
|
|
61553
|
+
toRequestParams(requestOptions)
|
|
61554
|
+
);
|
|
61555
|
+
return decodeResponse(response, AgentSkillsResponseFromApiToFront);
|
|
61556
|
+
}
|
|
60407
61557
|
};
|
|
60408
61558
|
|
|
60409
61559
|
// src/normalizers/native-goal.ts
|
|
@@ -79196,6 +80346,26 @@ function RetirementStatusFromApiToFront(dto) {
|
|
|
79196
80346
|
return out;
|
|
79197
80347
|
}
|
|
79198
80348
|
|
|
80349
|
+
// src/normalizers/admin-maintenance.ts
|
|
80350
|
+
function RebuildSemanticIndexResponseFromApiToFront(dto) {
|
|
80351
|
+
return {
|
|
80352
|
+
failed: dto.failed,
|
|
80353
|
+
indexed: dto.indexed,
|
|
80354
|
+
tenantId: dto.tenant_id,
|
|
80355
|
+
termsSeen: dto.terms_seen
|
|
80356
|
+
};
|
|
80357
|
+
}
|
|
80358
|
+
function ConversationEraseResponseFromApiToFront(dto) {
|
|
80359
|
+
return {
|
|
80360
|
+
dryRun: dto.dry_run,
|
|
80361
|
+
goals: dto.goals,
|
|
80362
|
+
records: dto.records,
|
|
80363
|
+
remaining: dto.remaining,
|
|
80364
|
+
removed: dto.removed,
|
|
80365
|
+
tenantId: dto.tenant_id
|
|
80366
|
+
};
|
|
80367
|
+
}
|
|
80368
|
+
|
|
79199
80369
|
// src/resources/admin.ts
|
|
79200
80370
|
var AdminClient = class {
|
|
79201
80371
|
/**
|
|
@@ -79607,6 +80777,65 @@ var AdminClient = class {
|
|
|
79607
80777
|
).catch(rethrowVocabularyRefusal);
|
|
79608
80778
|
return decodeResponse(response, VocabularyBasePackRegistrationFromApiToFront);
|
|
79609
80779
|
}
|
|
80780
|
+
/**
|
|
80781
|
+
* Rebuild a tenant's semantic search index
|
|
80782
|
+
*
|
|
80783
|
+
* @param tenantId - The tenant.
|
|
80784
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
80785
|
+
* @returns The engine's answer as `RebuildSemanticIndexResponse`, camelCase.
|
|
80786
|
+
* @throws {ApiError} 403: Another tenant, without the provisioning identity
|
|
80787
|
+
* @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
|
|
80788
|
+
* @throws {ApiError} 500: The terms could not be read
|
|
80789
|
+
*
|
|
80790
|
+
* @remarks Uses POST `/api/v1/admin/semantic-index/rebuild/{tenant_id}`.
|
|
80791
|
+
* Embeds again, with the configured embedding model, every persisted term of the tenant whose
|
|
80792
|
+
* semantic search point is missing or holds other content; points already identical are skipped.
|
|
80793
|
+
* Use after the embedding model changed (the collection is created again at the new dimension),
|
|
80794
|
+
* after a vector store restore, or after failed indexing. Idempotent: a second call after a
|
|
80795
|
+
* complete one embeds nothing. `failed` counts terms of pages that could not be indexed; call
|
|
80796
|
+
* again to retry them.
|
|
80797
|
+
*
|
|
80798
|
+
* @example
|
|
80799
|
+
* ```typescript
|
|
80800
|
+
* await client.admin.rebuildSemanticIndex(tenantId);
|
|
80801
|
+
* ```
|
|
80802
|
+
*/
|
|
80803
|
+
async rebuildSemanticIndex(tenantId, requestOptions) {
|
|
80804
|
+
const response = await this.api.rebuildSemanticIndex(tenantId, toRequestParams(requestOptions));
|
|
80805
|
+
return decodeResponse(response, RebuildSemanticIndexResponseFromApiToFront);
|
|
80806
|
+
}
|
|
80807
|
+
/**
|
|
80808
|
+
* Erase a tenant's conversation records (temporary)
|
|
80809
|
+
*
|
|
80810
|
+
* @param tenantId - The tenant.
|
|
80811
|
+
* @param options - `dryRun`: Count what would be erased, and erase nothing.; `limit`: At most this many conversations.
|
|
80812
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
80813
|
+
* @returns The engine's answer as `ConversationEraseResponse`, camelCase.
|
|
80814
|
+
* @throws {ApiError} 403: Forbidden (not the provisioning identity)
|
|
80815
|
+
* @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
|
|
80816
|
+
* @throws {ApiError} 503: The records could not be read or removed, or exceed the erase ceiling
|
|
80817
|
+
*
|
|
80818
|
+
* @remarks Uses POST `/api/v1/admin/tenants/{tenant_id}/conversations/erase`.
|
|
80819
|
+
* Requires the gateway provisioning identity. Counts (dry_run, the default) or removes one batch
|
|
80820
|
+
* of a tenant's conversation records: sessions, conversations, turns, ratings, preferences,
|
|
80821
|
+
* layouts, templates, intents, quoted frames, learned definitions and their preflights,
|
|
80822
|
+
* certifications, the promotion policy, reports, evidence, working state, the session graph's
|
|
80823
|
+
* conversation memory, and definition eligibility goals. The tenant, its vocabulary, knowledge and
|
|
80824
|
+
* authorization rules stay. Answers counts only. Removed once every deployment has run it.
|
|
80825
|
+
*
|
|
80826
|
+
* @example
|
|
80827
|
+
* ```typescript
|
|
80828
|
+
* const report = await client.admin.eraseConversations(tenantId, { dryRun: true });
|
|
80829
|
+
* ```
|
|
80830
|
+
*/
|
|
80831
|
+
async eraseConversations(tenantId, options = {}, requestOptions) {
|
|
80832
|
+
const response = await this.api.eraseConversations(
|
|
80833
|
+
tenantId,
|
|
80834
|
+
{ dry_run: options.dryRun, limit: options.limit },
|
|
80835
|
+
toRequestParams(requestOptions)
|
|
80836
|
+
);
|
|
80837
|
+
return decodeResponse(response, ConversationEraseResponseFromApiToFront);
|
|
80838
|
+
}
|
|
79610
80839
|
};
|
|
79611
80840
|
|
|
79612
80841
|
// src/normalizers/image-extraction.ts
|
|
@@ -81220,6 +82449,21 @@ var FlowNetworksClient = class {
|
|
|
81220
82449
|
}
|
|
81221
82450
|
};
|
|
81222
82451
|
|
|
82452
|
+
// src/normalizers/osfql-dependencies.ts
|
|
82453
|
+
function OsfqlDependenciesResponseFromApiToFront(dto) {
|
|
82454
|
+
return {
|
|
82455
|
+
exact: dto.exact,
|
|
82456
|
+
reason: dto.reason,
|
|
82457
|
+
sorts: dto.sorts.map((item0) => item0),
|
|
82458
|
+
watch: dto.watch
|
|
82459
|
+
};
|
|
82460
|
+
}
|
|
82461
|
+
function OsfqlDependenciesRequestFromFrontToApi(model) {
|
|
82462
|
+
return {
|
|
82463
|
+
query: model.query
|
|
82464
|
+
};
|
|
82465
|
+
}
|
|
82466
|
+
|
|
81223
82467
|
// src/resources/osfql.ts
|
|
81224
82468
|
var OsfqlClient = class {
|
|
81225
82469
|
/** @internal */
|
|
@@ -81662,6 +82906,29 @@ var OsfqlClient = class {
|
|
|
81662
82906
|
);
|
|
81663
82907
|
return decodeResponse(response, OsfqlRepairResponseFromApiToFront);
|
|
81664
82908
|
}
|
|
82909
|
+
/**
|
|
82910
|
+
* Name what a statement's answer depends on, without executing it.
|
|
82911
|
+
*
|
|
82912
|
+
* @param request - The request (`OsfqlDependenciesRequest`), camelCase; sent snake_case.
|
|
82913
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
82914
|
+
* @returns The engine's answer as `OsfqlDependenciesResponse`, camelCase.
|
|
82915
|
+
* @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
|
|
82916
|
+
* @throws {ApiError} 422: The statement does not parse or compile
|
|
82917
|
+
*
|
|
82918
|
+
* @remarks Uses POST `/api/v1/osfql/dependencies`.
|
|
82919
|
+
*
|
|
82920
|
+
* @example
|
|
82921
|
+
* ```typescript
|
|
82922
|
+
* const deps = await client.osfql.dependencies({ query: 'MATCH person(?X);' });
|
|
82923
|
+
* ```
|
|
82924
|
+
*/
|
|
82925
|
+
async dependencies(request, requestOptions) {
|
|
82926
|
+
const response = await this.api.osfqlDependencies(
|
|
82927
|
+
OsfqlDependenciesRequestFromFrontToApi(request),
|
|
82928
|
+
toRequestParams(requestOptions)
|
|
82929
|
+
);
|
|
82930
|
+
return decodeResponse(response, OsfqlDependenciesResponseFromApiToFront);
|
|
82931
|
+
}
|
|
81665
82932
|
};
|
|
81666
82933
|
function rethrowOsfqlFailure(error) {
|
|
81667
82934
|
if (error instanceof ApiError) {
|
|
@@ -81982,61 +83249,6 @@ var Conversation = class {
|
|
|
81982
83249
|
});
|
|
81983
83250
|
};
|
|
81984
83251
|
|
|
81985
|
-
// src/utils/sse.ts
|
|
81986
|
-
var FRAME_SEPARATORS = ["\r\n\r\n", "\n\n", "\r\r"];
|
|
81987
|
-
var LINE_TERMINATOR = /\r\n|\n|\r/;
|
|
81988
|
-
async function* readSseFrames(body) {
|
|
81989
|
-
const reader = body.getReader();
|
|
81990
|
-
const decoder = new TextDecoder();
|
|
81991
|
-
let buffer = "";
|
|
81992
|
-
try {
|
|
81993
|
-
for (; ; ) {
|
|
81994
|
-
const chunk = await reader.read();
|
|
81995
|
-
if (chunk.done) break;
|
|
81996
|
-
buffer += decoder.decode(chunk.value, { stream: true });
|
|
81997
|
-
let boundary = findFrameBoundary(buffer);
|
|
81998
|
-
while (boundary !== null) {
|
|
81999
|
-
const frame = decodeFrame(buffer.slice(0, boundary.index));
|
|
82000
|
-
buffer = buffer.slice(boundary.index + boundary.length);
|
|
82001
|
-
if (frame !== null) yield frame;
|
|
82002
|
-
boundary = findFrameBoundary(buffer);
|
|
82003
|
-
}
|
|
82004
|
-
}
|
|
82005
|
-
buffer += decoder.decode();
|
|
82006
|
-
const trailing = decodeFrame(buffer);
|
|
82007
|
-
if (trailing !== null) yield trailing;
|
|
82008
|
-
} finally {
|
|
82009
|
-
await reader.cancel().catch(() => void 0);
|
|
82010
|
-
}
|
|
82011
|
-
}
|
|
82012
|
-
function findFrameBoundary(buffer) {
|
|
82013
|
-
let found = null;
|
|
82014
|
-
for (const separator of FRAME_SEPARATORS) {
|
|
82015
|
-
const index = buffer.indexOf(separator);
|
|
82016
|
-
if (index === -1) continue;
|
|
82017
|
-
if (found === null || index < found.index || index === found.index && separator.length > found.length) {
|
|
82018
|
-
found = { index, length: separator.length };
|
|
82019
|
-
}
|
|
82020
|
-
}
|
|
82021
|
-
return found;
|
|
82022
|
-
}
|
|
82023
|
-
function decodeFrame(text2) {
|
|
82024
|
-
const dataLines = [];
|
|
82025
|
-
let event;
|
|
82026
|
-
for (const line of text2.split(LINE_TERMINATOR)) {
|
|
82027
|
-
if (line === "" || line.startsWith(":")) continue;
|
|
82028
|
-
const colon = line.indexOf(":");
|
|
82029
|
-
const field = colon === -1 ? line : line.slice(0, colon);
|
|
82030
|
-
const rawValue = colon === -1 ? "" : line.slice(colon + 1);
|
|
82031
|
-
const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
|
|
82032
|
-
if (field === "data") dataLines.push(value);
|
|
82033
|
-
else if (field === "event") event = value;
|
|
82034
|
-
}
|
|
82035
|
-
const data = dataLines.join("\n");
|
|
82036
|
-
if (data === "") return null;
|
|
82037
|
-
return { event: event === "" ? void 0 : event, data };
|
|
82038
|
-
}
|
|
82039
|
-
|
|
82040
83252
|
// src/resources/conversation.ts
|
|
82041
83253
|
var SSE_MEDIA_TYPE = "text/event-stream";
|
|
82042
83254
|
var STREAM_EVENTS = /* @__PURE__ */ new Set(["token", "done", "error"]);
|
|
@@ -82181,31 +83393,7 @@ var ConversationClient = class {
|
|
|
82181
83393
|
secure: true,
|
|
82182
83394
|
type: "application/json"
|
|
82183
83395
|
});
|
|
82184
|
-
|
|
82185
|
-
if (body === null) {
|
|
82186
|
-
throw new NetworkError("Conversation stream response carried no event stream");
|
|
82187
|
-
}
|
|
82188
|
-
for await (const frame of readSseFrames(body)) {
|
|
82189
|
-
if (frame.event === void 0 || !STREAM_EVENTS.has(frame.event)) continue;
|
|
82190
|
-
let payload;
|
|
82191
|
-
try {
|
|
82192
|
-
payload = JSON.parse(frame.data);
|
|
82193
|
-
} catch (error) {
|
|
82194
|
-
throw new NetworkError(
|
|
82195
|
-
`Conversation stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
|
|
82196
|
-
error instanceof Error ? error : void 0
|
|
82197
|
-
);
|
|
82198
|
-
}
|
|
82199
|
-
const event = ConversationStreamEventFromApiToFront(frame.event, payload);
|
|
82200
|
-
if (event === null) {
|
|
82201
|
-
throw new NetworkError(
|
|
82202
|
-
`Conversation stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
|
|
82203
|
-
);
|
|
82204
|
-
}
|
|
82205
|
-
yield event;
|
|
82206
|
-
if (event.type !== "token") return;
|
|
82207
|
-
}
|
|
82208
|
-
throw new NetworkError("Conversation stream ended without a done or error event");
|
|
83396
|
+
yield* readConversationStream(response.body);
|
|
82209
83397
|
}
|
|
82210
83398
|
/**
|
|
82211
83399
|
* List recent conversations for the authenticated user.
|
|
@@ -82301,6 +83489,115 @@ var ConversationClient = class {
|
|
|
82301
83489
|
});
|
|
82302
83490
|
return decodeResponse(response, (dto) => (dto ?? []).map(CompareModelDtoFromApiToFront));
|
|
82303
83491
|
}
|
|
83492
|
+
/**
|
|
83493
|
+
* Read the caller's private transcript with a published agent on one Frame page.
|
|
83494
|
+
*
|
|
83495
|
+
* @param agentId - The published agent (UUID).
|
|
83496
|
+
* @param binding - The Frame page: `frameId`, `page`, the current published
|
|
83497
|
+
* `pageVersion`, and optionally the `conversationId` and an `offset`.
|
|
83498
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
83499
|
+
* @returns The transcript, or `null` when no consultation has started there.
|
|
83500
|
+
* @throws {ApiError} 400 for an invalid Frame page binding; 403 when the named
|
|
83501
|
+
* agent grant is absent or revoked; 404 when the current Frame, binding or
|
|
83502
|
+
* pinned consultation is unavailable.
|
|
83503
|
+
*
|
|
83504
|
+
* @remarks Uses GET `/api/v1/conversation/agents/{agent_id}/frame/turns`.
|
|
83505
|
+
*
|
|
83506
|
+
* @example
|
|
83507
|
+
* ```typescript
|
|
83508
|
+
* const transcript = await client.conversation.getFrameAgentTurns(agentId, {
|
|
83509
|
+
* frameId, page: 'home', pageVersion: 3,
|
|
83510
|
+
* });
|
|
83511
|
+
* ```
|
|
83512
|
+
*/
|
|
83513
|
+
async getFrameAgentTurns(agentId, binding, requestOptions) {
|
|
83514
|
+
const response = await this.api.getFrameAgentTurns(
|
|
83515
|
+
agentId,
|
|
83516
|
+
{
|
|
83517
|
+
frame_id: binding.frameId,
|
|
83518
|
+
page: binding.page,
|
|
83519
|
+
page_version: binding.pageVersion,
|
|
83520
|
+
conversation_id: binding.conversationId,
|
|
83521
|
+
offset: binding.offset
|
|
83522
|
+
},
|
|
83523
|
+
toRequestParams(requestOptions)
|
|
83524
|
+
);
|
|
83525
|
+
return decodeResponse(
|
|
83526
|
+
response,
|
|
83527
|
+
(dto) => dto === null ? null : ConversationTurnsResponseFromApiToFront(dto)
|
|
83528
|
+
);
|
|
83529
|
+
}
|
|
83530
|
+
/**
|
|
83531
|
+
* Read the caller's accessible consultations with a published agent on one Work task.
|
|
83532
|
+
*
|
|
83533
|
+
* @param agentId - The published agent (UUID).
|
|
83534
|
+
* @param scope - The task (`taskId`), and optionally one `conversationId` and an `offset`.
|
|
83535
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
83536
|
+
* @returns One transcript per consultation the caller can read.
|
|
83537
|
+
* @throws {ApiError} If the engine refuses the read.
|
|
83538
|
+
*
|
|
83539
|
+
* @remarks Uses GET `/api/v1/conversation/agents/{agent_id}/task/turns`.
|
|
83540
|
+
*
|
|
83541
|
+
* @example
|
|
83542
|
+
* ```typescript
|
|
83543
|
+
* const consultations = await client.conversation.getTaskAgentTurns(agentId, { taskId });
|
|
83544
|
+
* ```
|
|
83545
|
+
*/
|
|
83546
|
+
async getTaskAgentTurns(agentId, scope, requestOptions) {
|
|
83547
|
+
const response = await this.api.getTaskAgentTurns(
|
|
83548
|
+
agentId,
|
|
83549
|
+
{ task_id: scope.taskId, conversation_id: scope.conversationId, offset: scope.offset },
|
|
83550
|
+
toRequestParams(requestOptions)
|
|
83551
|
+
);
|
|
83552
|
+
return decodeResponse(response, (dto) => dto.map(ConversationTurnsResponseFromApiToFront));
|
|
83553
|
+
}
|
|
83554
|
+
/**
|
|
83555
|
+
* Send one message to a published agent and stream its answer, as
|
|
83556
|
+
* {@link ConversationClient.sendMessageStream} streams the assistant's.
|
|
83557
|
+
*
|
|
83558
|
+
* @param agentId - The published agent (UUID).
|
|
83559
|
+
* @param request - The message, as for `sendMessageStream`.
|
|
83560
|
+
* @param context - Where the consultation happens: a Frame page (`frameId`,
|
|
83561
|
+
* `page`, `pageVersion`) or a Work task (`taskId`, with `asLead` to require
|
|
83562
|
+
* the current task lead).
|
|
83563
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
83564
|
+
* @returns The same `token`, `done` and `error` events as `sendMessageStream`.
|
|
83565
|
+
* @throws {ApiError} 403 when the named agent grant is absent or revoked; 404
|
|
83566
|
+
* when no published agent of that id is in this Space.
|
|
83567
|
+
* @throws {NetworkError} When the stream carries no event stream, a malformed
|
|
83568
|
+
* event, or ends without a `done` or `error` event.
|
|
83569
|
+
*
|
|
83570
|
+
* @remarks
|
|
83571
|
+
* Uses POST `/api/v1/conversation/agents/{agent_id}/message/stream`
|
|
83572
|
+
* (`text/event-stream`). The conversation's kind is `agent_consultation`.
|
|
83573
|
+
*
|
|
83574
|
+
* @example
|
|
83575
|
+
* ```typescript
|
|
83576
|
+
* for await (const event of client.conversation.sendAgentMessageStream(agentId, {
|
|
83577
|
+
* message: 'Summarise the open risks.',
|
|
83578
|
+
* }, { taskId })) {
|
|
83579
|
+
* if (event.type === 'done') console.log(event.response.assistantMessage);
|
|
83580
|
+
* }
|
|
83581
|
+
* ```
|
|
83582
|
+
*/
|
|
83583
|
+
async *sendAgentMessageStream(agentId, request, context = {}, requestOptions) {
|
|
83584
|
+
const response = await this.http.request({
|
|
83585
|
+
...mergeRequestParams({ headers: { Accept: SSE_MEDIA_TYPE } }, requestOptions),
|
|
83586
|
+
path: `/api/v1/conversation/agents/${encodeURIComponent(agentId)}/message/stream`,
|
|
83587
|
+
method: "POST",
|
|
83588
|
+
query: {
|
|
83589
|
+
frame_id: context.frameId,
|
|
83590
|
+
page: context.page,
|
|
83591
|
+
page_version: context.pageVersion,
|
|
83592
|
+
task_id: context.taskId,
|
|
83593
|
+
as_lead: context.asLead
|
|
83594
|
+
},
|
|
83595
|
+
body: ConversationMessageRequestFromFrontToApi(request),
|
|
83596
|
+
secure: true,
|
|
83597
|
+
type: "application/json"
|
|
83598
|
+
});
|
|
83599
|
+
yield* readConversationStream(response.body);
|
|
83600
|
+
}
|
|
82304
83601
|
/**
|
|
82305
83602
|
* Get all turns for a conversation.
|
|
82306
83603
|
*
|
|
@@ -82537,6 +83834,32 @@ var ConversationClient = class {
|
|
|
82537
83834
|
return decodeResponse(response, ConversationSummaryDtoFromApiToFront);
|
|
82538
83835
|
}
|
|
82539
83836
|
};
|
|
83837
|
+
async function* readConversationStream(body) {
|
|
83838
|
+
if (body === null) {
|
|
83839
|
+
throw new NetworkError("Conversation stream response carried no event stream");
|
|
83840
|
+
}
|
|
83841
|
+
for await (const frame of readSseFrames(body)) {
|
|
83842
|
+
if (frame.event === void 0 || !STREAM_EVENTS.has(frame.event)) continue;
|
|
83843
|
+
let payload;
|
|
83844
|
+
try {
|
|
83845
|
+
payload = JSON.parse(frame.data);
|
|
83846
|
+
} catch (error) {
|
|
83847
|
+
throw new NetworkError(
|
|
83848
|
+
`Conversation stream carried a malformed JSON '${frame.event}' event: ${frame.data}`,
|
|
83849
|
+
error instanceof Error ? error : void 0
|
|
83850
|
+
);
|
|
83851
|
+
}
|
|
83852
|
+
const event = ConversationStreamEventFromApiToFront(frame.event, payload);
|
|
83853
|
+
if (event === null) {
|
|
83854
|
+
throw new NetworkError(
|
|
83855
|
+
`Conversation stream carried a '${frame.event}' event that does not fit its contract: ${frame.data}`
|
|
83856
|
+
);
|
|
83857
|
+
}
|
|
83858
|
+
yield event;
|
|
83859
|
+
if (event.type !== "token") return;
|
|
83860
|
+
}
|
|
83861
|
+
throw new NetworkError("Conversation stream ended without a done or error event");
|
|
83862
|
+
}
|
|
82540
83863
|
|
|
82541
83864
|
// src/normalizers/verification.ts
|
|
82542
83865
|
var CLAIM_KINDS = [
|
|
@@ -85059,6 +86382,88 @@ var UiClient = class {
|
|
|
85059
86382
|
const response = await this.api.uiCatalog(toRequestParams(requestOptions));
|
|
85060
86383
|
return decodeResponse(response, UICatalogResponseFromApiToFront);
|
|
85061
86384
|
}
|
|
86385
|
+
/**
|
|
86386
|
+
* addFrameConsultant
|
|
86387
|
+
*
|
|
86388
|
+
* @param name - The saved page.
|
|
86389
|
+
* @param agentId - The agent (UUID).
|
|
86390
|
+
* @param request - The request (`AddFrameConsultant`), camelCase; sent snake_case.
|
|
86391
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
86392
|
+
* @returns The engine's answer as `FrameConsultantRevision`, camelCase.
|
|
86393
|
+
* @throws {ApiError} 403: Agent or page edit denied
|
|
86394
|
+
* @throws {ApiError} 404: Published agent or page unavailable
|
|
86395
|
+
* @throws {ApiError} 409: The page already changed
|
|
86396
|
+
* @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
|
|
86397
|
+
* @throws {ApiError} 422: The section is missing, ambiguous, or cannot contain a consultation
|
|
86398
|
+
*
|
|
86399
|
+
* @remarks Uses POST `/api/v1/ui/pages/{name}/consultant/{agent_id}`.
|
|
86400
|
+
*
|
|
86401
|
+
* @example
|
|
86402
|
+
* ```typescript
|
|
86403
|
+
* await client.ui.addFrameConsultant("home", agentId, request);
|
|
86404
|
+
* ```
|
|
86405
|
+
*/
|
|
86406
|
+
async addFrameConsultant(name, agentId, request, requestOptions) {
|
|
86407
|
+
const response = await this.api.addFrameConsultant(
|
|
86408
|
+
name,
|
|
86409
|
+
agentId,
|
|
86410
|
+
AddFrameConsultantFromFrontToApi(request),
|
|
86411
|
+
toRequestParams(requestOptions)
|
|
86412
|
+
);
|
|
86413
|
+
return decodeResponse(response, FrameConsultantRevisionFromApiToFront);
|
|
86414
|
+
}
|
|
86415
|
+
/**
|
|
86416
|
+
* Restore a saved layout as the next version of the same Frame page.
|
|
86417
|
+
*
|
|
86418
|
+
* @param name - The saved page.
|
|
86419
|
+
* @param request - The request (`RestoreFramePageRequest`), camelCase; sent snake_case.
|
|
86420
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
86421
|
+
* @returns The engine's answer as `RestoreFramePageResponse`, camelCase.
|
|
86422
|
+
* @throws {ApiError} 400: The requested version is not earlier than the expected current version
|
|
86423
|
+
* @throws {ApiError} 403: This caller cannot write to the Frame or its current page
|
|
86424
|
+
* @throws {ApiError} 404: The Frame or selected page version is unavailable
|
|
86425
|
+
* @throws {ApiError} 409: The current page version changed
|
|
86426
|
+
* @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
|
|
86427
|
+
*
|
|
86428
|
+
* @remarks Uses POST `/api/v1/ui/pages/{name}/restore`.
|
|
86429
|
+
*
|
|
86430
|
+
* @example
|
|
86431
|
+
* ```typescript
|
|
86432
|
+
* await client.ui.restoreFramePage("home", request);
|
|
86433
|
+
* ```
|
|
86434
|
+
*/
|
|
86435
|
+
async restoreFramePage(name, request, requestOptions) {
|
|
86436
|
+
const response = await this.api.restoreFramePage(
|
|
86437
|
+
name,
|
|
86438
|
+
RestoreFramePageRequestFromFrontToApi(request),
|
|
86439
|
+
toRequestParams(requestOptions)
|
|
86440
|
+
);
|
|
86441
|
+
return decodeResponse(response, RestoreFramePageResponseFromApiToFront);
|
|
86442
|
+
}
|
|
86443
|
+
/**
|
|
86444
|
+
* listFrameTableSources
|
|
86445
|
+
*
|
|
86446
|
+
* @param frameId - The Frame.
|
|
86447
|
+
* @param options - `offset`: Sources to skip.; `search`: Filter by name.
|
|
86448
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
86449
|
+
* @returns The engine's answer as `UIFrameTableSources`, camelCase.
|
|
86450
|
+
* @throws {ApiError} 404: Frame unavailable
|
|
86451
|
+
* @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
|
|
86452
|
+
*
|
|
86453
|
+
* @remarks Uses GET `/api/v1/ui/table-sources`.
|
|
86454
|
+
*
|
|
86455
|
+
* @example
|
|
86456
|
+
* ```typescript
|
|
86457
|
+
* const { sources } = await client.ui.listFrameTableSources(frameId);
|
|
86458
|
+
* ```
|
|
86459
|
+
*/
|
|
86460
|
+
async listFrameTableSources(frameId, options = {}, requestOptions) {
|
|
86461
|
+
const response = await this.api.frameTableSources(
|
|
86462
|
+
{ frame_id: frameId, offset: options.offset, search: options.search },
|
|
86463
|
+
toRequestParams(requestOptions)
|
|
86464
|
+
);
|
|
86465
|
+
return decodeResponse(response, UIFrameTableSourcesFromApiToFront);
|
|
86466
|
+
}
|
|
85062
86467
|
};
|
|
85063
86468
|
|
|
85064
86469
|
// src/normalizers/compliance.ts
|
|
@@ -97025,6 +98430,105 @@ var ChannelsClient = class {
|
|
|
97025
98430
|
}
|
|
97026
98431
|
};
|
|
97027
98432
|
|
|
98433
|
+
// src/normalizers/text-editing.ts
|
|
98434
|
+
function TextProofreadResponseFromApiToFront(dto) {
|
|
98435
|
+
return {
|
|
98436
|
+
edits: dto.edits.map((item0) => TextProofreadEditFromApiToFront(item0)),
|
|
98437
|
+
promptVersion: dto.prompt_version
|
|
98438
|
+
};
|
|
98439
|
+
}
|
|
98440
|
+
function TextProofreadEditFromApiToFront(dto) {
|
|
98441
|
+
return {
|
|
98442
|
+
after: dto.after,
|
|
98443
|
+
before: dto.before,
|
|
98444
|
+
end: dto.end,
|
|
98445
|
+
start: dto.start
|
|
98446
|
+
};
|
|
98447
|
+
}
|
|
98448
|
+
function TextRewriteResponseFromApiToFront(dto) {
|
|
98449
|
+
return {
|
|
98450
|
+
promptVersion: dto.prompt_version,
|
|
98451
|
+
text: dto.text
|
|
98452
|
+
};
|
|
98453
|
+
}
|
|
98454
|
+
function TextProofreadRequestFromFrontToApi(model) {
|
|
98455
|
+
return {
|
|
98456
|
+
text: model.text
|
|
98457
|
+
};
|
|
98458
|
+
}
|
|
98459
|
+
function TextRewriteRequestFromFrontToApi(model) {
|
|
98460
|
+
return {
|
|
98461
|
+
passage: model.passage,
|
|
98462
|
+
style: model.style,
|
|
98463
|
+
template: model.template,
|
|
98464
|
+
tone: model.tone
|
|
98465
|
+
};
|
|
98466
|
+
}
|
|
98467
|
+
|
|
98468
|
+
// src/resources/text.ts
|
|
98469
|
+
var TextClient = class {
|
|
98470
|
+
/** @internal */
|
|
98471
|
+
api;
|
|
98472
|
+
/** @internal */
|
|
98473
|
+
constructor(api) {
|
|
98474
|
+
this.api = api;
|
|
98475
|
+
}
|
|
98476
|
+
/**
|
|
98477
|
+
* Proofread a text: spelling, agreement and grammar only.
|
|
98478
|
+
*
|
|
98479
|
+
* @param request - The request (`TextProofreadRequest`), camelCase; sent snake_case.
|
|
98480
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
98481
|
+
* @returns The engine's answer as `TextProofreadResponse`, camelCase.
|
|
98482
|
+
* @throws {ApiError} 400: Empty or too long
|
|
98483
|
+
* @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
|
|
98484
|
+
* @throws {ApiError} 422: The model's edits broke a rule (edit_location, overlap, quantity_changed, invalid_edit)
|
|
98485
|
+
* @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
|
|
98486
|
+
* @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
|
|
98487
|
+
*
|
|
98488
|
+
* @remarks Uses POST `/api/v1/text/proofread`.
|
|
98489
|
+
* POST /api/v1/text/proofread
|
|
98490
|
+
*
|
|
98491
|
+
* @example
|
|
98492
|
+
* ```typescript
|
|
98493
|
+
* const { edits } = await client.text.proofread({ text });
|
|
98494
|
+
* ```
|
|
98495
|
+
*/
|
|
98496
|
+
async proofread(request, requestOptions) {
|
|
98497
|
+
const response = await this.api.proofreadText(
|
|
98498
|
+
TextProofreadRequestFromFrontToApi(request),
|
|
98499
|
+
toRequestParams(requestOptions)
|
|
98500
|
+
);
|
|
98501
|
+
return decodeResponse(response, TextProofreadResponseFromApiToFront);
|
|
98502
|
+
}
|
|
98503
|
+
/**
|
|
98504
|
+
* Rewrite a passage in a tone, optionally following a template.
|
|
98505
|
+
*
|
|
98506
|
+
* @param request - The request (`TextRewriteRequest`), camelCase; sent snake_case.
|
|
98507
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
98508
|
+
* @returns The engine's answer as `TextRewriteResponse`, camelCase.
|
|
98509
|
+
* @throws {ApiError} 400: Empty, too long, or style misused
|
|
98510
|
+
* @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
|
|
98511
|
+
* @throws {ApiError} 422: The rewrite changed a number, sign, separator or currency, or was empty
|
|
98512
|
+
* @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
|
|
98513
|
+
* @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
|
|
98514
|
+
*
|
|
98515
|
+
* @remarks Uses POST `/api/v1/text/rewrite`.
|
|
98516
|
+
* POST /api/v1/text/rewrite
|
|
98517
|
+
*
|
|
98518
|
+
* @example
|
|
98519
|
+
* ```typescript
|
|
98520
|
+
* const rewritten = await client.text.rewrite({ text, tone: 'formal' });
|
|
98521
|
+
* ```
|
|
98522
|
+
*/
|
|
98523
|
+
async rewrite(request, requestOptions) {
|
|
98524
|
+
const response = await this.api.rewriteText(
|
|
98525
|
+
TextRewriteRequestFromFrontToApi(request),
|
|
98526
|
+
toRequestParams(requestOptions)
|
|
98527
|
+
);
|
|
98528
|
+
return decodeResponse(response, TextRewriteResponseFromApiToFront);
|
|
98529
|
+
}
|
|
98530
|
+
};
|
|
98531
|
+
|
|
97028
98532
|
// src/normalizers/platform.ts
|
|
97029
98533
|
function CreateBackupRequestFromFrontToApi(model) {
|
|
97030
98534
|
const out = {
|
|
@@ -97158,6 +98662,95 @@ function SkillListResponseFromApiToFront(dto) {
|
|
|
97158
98662
|
return { skills: dto.skills.map(SkillSummaryFromApiToFront) };
|
|
97159
98663
|
}
|
|
97160
98664
|
|
|
98665
|
+
// src/normalizers/skill-scripts.ts
|
|
98666
|
+
function ScriptPolicyFromApiToFront(dto) {
|
|
98667
|
+
return {
|
|
98668
|
+
company: dto.company,
|
|
98669
|
+
enabled: dto.enabled
|
|
98670
|
+
};
|
|
98671
|
+
}
|
|
98672
|
+
function EditionFromApiToFront(dto) {
|
|
98673
|
+
return {
|
|
98674
|
+
entrypoint: dto.entrypoint,
|
|
98675
|
+
packageId: dto.package_id,
|
|
98676
|
+
version: dto.version,
|
|
98677
|
+
workflow: dto.workflow
|
|
98678
|
+
};
|
|
98679
|
+
}
|
|
98680
|
+
function ResultWithEditionFromApiToFront(dto) {
|
|
98681
|
+
return {
|
|
98682
|
+
edition: EditionFromApiToFront(dto.edition),
|
|
98683
|
+
generation: GenerateDocumentResponseFromApiToFront(dto.generation),
|
|
98684
|
+
rootTermId: dto.root_term_id,
|
|
98685
|
+
skillId: dto.skill_id
|
|
98686
|
+
};
|
|
98687
|
+
}
|
|
98688
|
+
function ScriptResultFromApiToFront(dto) {
|
|
98689
|
+
return {
|
|
98690
|
+
exitCode: dto.exit_code,
|
|
98691
|
+
files: dto.files.map((item0) => ScriptOutputFileFromApiToFront(item0)),
|
|
98692
|
+
reviewId: dto.review_id,
|
|
98693
|
+
sandboxId: dto.sandbox_id,
|
|
98694
|
+
stderr: dto.stderr,
|
|
98695
|
+
stdout: dto.stdout
|
|
98696
|
+
};
|
|
98697
|
+
}
|
|
98698
|
+
function ScriptOutputFileFromApiToFront(dto) {
|
|
98699
|
+
return {
|
|
98700
|
+
bytes: dto.bytes,
|
|
98701
|
+
path: dto.path
|
|
98702
|
+
};
|
|
98703
|
+
}
|
|
98704
|
+
function ScriptPreviewFromApiToFront(dto) {
|
|
98705
|
+
return {
|
|
98706
|
+
entrypoint: dto.entrypoint,
|
|
98707
|
+
image: dto.image,
|
|
98708
|
+
reviewId: dto.review_id,
|
|
98709
|
+
rootTermId: dto.root_term_id,
|
|
98710
|
+
script: dto.script,
|
|
98711
|
+
sha256: dto.sha256
|
|
98712
|
+
};
|
|
98713
|
+
}
|
|
98714
|
+
function SkillDraftEditResponseFromApiToFront(dto) {
|
|
98715
|
+
return {
|
|
98716
|
+
description: dto.description,
|
|
98717
|
+
markdown: dto.markdown,
|
|
98718
|
+
name: dto.name,
|
|
98719
|
+
promptVersion: dto.prompt_version
|
|
98720
|
+
};
|
|
98721
|
+
}
|
|
98722
|
+
function ApprovedScriptFromFrontToApi(model) {
|
|
98723
|
+
return {
|
|
98724
|
+
review_id: model.reviewId,
|
|
98725
|
+
selection: ScriptSelectionFromFrontToApi(model.selection)
|
|
98726
|
+
};
|
|
98727
|
+
}
|
|
98728
|
+
function InvocationFromFrontToApi(model) {
|
|
98729
|
+
return {
|
|
98730
|
+
package_id: model.packageId,
|
|
98731
|
+
root_term_id: model.rootTermId,
|
|
98732
|
+
version: model.version
|
|
98733
|
+
};
|
|
98734
|
+
}
|
|
98735
|
+
function ScriptPolicyChangeFromFrontToApi(model) {
|
|
98736
|
+
return {
|
|
98737
|
+
enabled: model.enabled
|
|
98738
|
+
};
|
|
98739
|
+
}
|
|
98740
|
+
function ScriptSelectionFromFrontToApi(model) {
|
|
98741
|
+
return {
|
|
98742
|
+
package_id: model.packageId,
|
|
98743
|
+
root_term_id: model.rootTermId,
|
|
98744
|
+
version: model.version
|
|
98745
|
+
};
|
|
98746
|
+
}
|
|
98747
|
+
function SkillDraftEditRequestFromFrontToApi(model) {
|
|
98748
|
+
return {
|
|
98749
|
+
request: model.request,
|
|
98750
|
+
source: model.source
|
|
98751
|
+
};
|
|
98752
|
+
}
|
|
98753
|
+
|
|
97161
98754
|
// src/resources/platform.ts
|
|
97162
98755
|
var PlatformClient = class {
|
|
97163
98756
|
/** @internal */
|
|
@@ -97165,9 +98758,13 @@ var PlatformClient = class {
|
|
|
97165
98758
|
/** @internal */
|
|
97166
98759
|
tenantId;
|
|
97167
98760
|
/** @internal */
|
|
97168
|
-
|
|
98761
|
+
/** @internal */
|
|
98762
|
+
skills;
|
|
98763
|
+
/** @internal */
|
|
98764
|
+
constructor(api, tenantId, skills) {
|
|
97169
98765
|
this.api = api;
|
|
97170
98766
|
this.tenantId = tenantId;
|
|
98767
|
+
this.skills = skills;
|
|
97171
98768
|
}
|
|
97172
98769
|
// ── Backups ───────────────────────────────────────────────────────────
|
|
97173
98770
|
/**
|
|
@@ -97467,6 +99064,166 @@ var PlatformClient = class {
|
|
|
97467
99064
|
const response = await this.api.listSkills(toRequestParams(requestOptions));
|
|
97468
99065
|
return decodeResponse(response, SkillListResponseFromApiToFront);
|
|
97469
99066
|
}
|
|
99067
|
+
/**
|
|
99068
|
+
* listSkillEditions
|
|
99069
|
+
*
|
|
99070
|
+
* @param skillId - The skill (UUID).
|
|
99071
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99072
|
+
* @returns The engine's answer as `Edition[]`, camelCase.
|
|
99073
|
+
* @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
|
|
99074
|
+
*
|
|
99075
|
+
* @remarks Uses GET `/api/v1/skills/{id}/editions`.
|
|
99076
|
+
*
|
|
99077
|
+
* @example
|
|
99078
|
+
* ```typescript
|
|
99079
|
+
* const editions = await client.platform.listSkillEditions(skillId);
|
|
99080
|
+
* ```
|
|
99081
|
+
*/
|
|
99082
|
+
async listSkillEditions(skillId, requestOptions) {
|
|
99083
|
+
const response = await this.api.editions(skillId, toRequestParams(requestOptions));
|
|
99084
|
+
return decodeResponse(response, (dto) => dto.map(EditionFromApiToFront));
|
|
99085
|
+
}
|
|
99086
|
+
/**
|
|
99087
|
+
* invokeSkill
|
|
99088
|
+
*
|
|
99089
|
+
* @param skillId - The skill (UUID).
|
|
99090
|
+
* @param request - The request (`Invocation`), camelCase; sent snake_case.
|
|
99091
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99092
|
+
* @returns The engine's answer as `ResultWithEdition`, camelCase.
|
|
99093
|
+
* @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
|
|
99094
|
+
*
|
|
99095
|
+
* @remarks Uses POST `/api/v1/skills/{id}/invoke`.
|
|
99096
|
+
*
|
|
99097
|
+
* @example
|
|
99098
|
+
* ```typescript
|
|
99099
|
+
* const result = await client.platform.invokeSkill(skillId, invocation);
|
|
99100
|
+
* ```
|
|
99101
|
+
*/
|
|
99102
|
+
async invokeSkill(skillId, request, requestOptions) {
|
|
99103
|
+
const response = await this.api.invoke(
|
|
99104
|
+
skillId,
|
|
99105
|
+
InvocationFromFrontToApi(request),
|
|
99106
|
+
toRequestParams(requestOptions)
|
|
99107
|
+
);
|
|
99108
|
+
return decodeResponse(response, ResultWithEditionFromApiToFront);
|
|
99109
|
+
}
|
|
99110
|
+
/**
|
|
99111
|
+
* executeSkillScript
|
|
99112
|
+
*
|
|
99113
|
+
* @param skillId - The skill (UUID).
|
|
99114
|
+
* @param request - The request (`ApprovedScript`), camelCase; sent snake_case.
|
|
99115
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99116
|
+
* @returns The engine's answer as `ScriptResult`, camelCase.
|
|
99117
|
+
* @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
|
|
99118
|
+
*
|
|
99119
|
+
* @remarks Uses POST `/api/v1/skills/{id}/script/execute`.
|
|
99120
|
+
*
|
|
99121
|
+
* @example
|
|
99122
|
+
* ```typescript
|
|
99123
|
+
* const result = await client.platform.executeSkillScript(skillId, approved);
|
|
99124
|
+
* ```
|
|
99125
|
+
*/
|
|
99126
|
+
async executeSkillScript(skillId, request, requestOptions) {
|
|
99127
|
+
const response = await this.api.execute(
|
|
99128
|
+
skillId,
|
|
99129
|
+
ApprovedScriptFromFrontToApi(request),
|
|
99130
|
+
toRequestParams(requestOptions)
|
|
99131
|
+
);
|
|
99132
|
+
return decodeResponse(response, ScriptResultFromApiToFront);
|
|
99133
|
+
}
|
|
99134
|
+
/**
|
|
99135
|
+
* prepareSkillScript
|
|
99136
|
+
*
|
|
99137
|
+
* @param skillId - The skill (UUID).
|
|
99138
|
+
* @param request - The request (`ScriptSelection`), camelCase; sent snake_case.
|
|
99139
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99140
|
+
* @returns The engine's answer as `ScriptPreview`, camelCase.
|
|
99141
|
+
* @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
|
|
99142
|
+
*
|
|
99143
|
+
* @remarks Uses POST `/api/v1/skills/{id}/script/prepare`.
|
|
99144
|
+
*
|
|
99145
|
+
* @example
|
|
99146
|
+
* ```typescript
|
|
99147
|
+
* const preview = await client.platform.prepareSkillScript(skillId, selection);
|
|
99148
|
+
* ```
|
|
99149
|
+
*/
|
|
99150
|
+
async prepareSkillScript(skillId, request, requestOptions) {
|
|
99151
|
+
const response = await this.api.prepareSkillScript(
|
|
99152
|
+
skillId,
|
|
99153
|
+
ScriptSelectionFromFrontToApi(request),
|
|
99154
|
+
toRequestParams(requestOptions)
|
|
99155
|
+
);
|
|
99156
|
+
return decodeResponse(response, ScriptPreviewFromApiToFront);
|
|
99157
|
+
}
|
|
99158
|
+
/**
|
|
99159
|
+
* getSkillScriptPolicy
|
|
99160
|
+
*
|
|
99161
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99162
|
+
* @returns The engine's answer as `ScriptPolicy`, camelCase.
|
|
99163
|
+
* @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
|
|
99164
|
+
*
|
|
99165
|
+
* @remarks Uses GET `/api/v1/skills/script-policy`.
|
|
99166
|
+
*
|
|
99167
|
+
* @example
|
|
99168
|
+
* ```typescript
|
|
99169
|
+
* const policy = await client.platform.getSkillScriptPolicy();
|
|
99170
|
+
* ```
|
|
99171
|
+
*/
|
|
99172
|
+
async getSkillScriptPolicy(requestOptions) {
|
|
99173
|
+
const response = await this.api.policy(toRequestParams(requestOptions));
|
|
99174
|
+
return decodeResponse(response, ScriptPolicyFromApiToFront);
|
|
99175
|
+
}
|
|
99176
|
+
/**
|
|
99177
|
+
* setSkillScriptPolicy
|
|
99178
|
+
*
|
|
99179
|
+
* @param organizationId - The organization.
|
|
99180
|
+
* @param request - The request (`ScriptPolicyChange`), camelCase; sent snake_case.
|
|
99181
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99182
|
+
* @returns The engine's answer as `ScriptPolicy`, camelCase.
|
|
99183
|
+
* @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
|
|
99184
|
+
*
|
|
99185
|
+
* @remarks Uses PUT `/api/v1/skills/organizations/{id}/script-policy`.
|
|
99186
|
+
*
|
|
99187
|
+
* @example
|
|
99188
|
+
* ```typescript
|
|
99189
|
+
* await client.platform.setSkillScriptPolicy(organizationId, change);
|
|
99190
|
+
* ```
|
|
99191
|
+
*/
|
|
99192
|
+
async setSkillScriptPolicy(organizationId, request, requestOptions) {
|
|
99193
|
+
const response = await this.api.setSkillScriptPolicy(
|
|
99194
|
+
organizationId,
|
|
99195
|
+
ScriptPolicyChangeFromFrontToApi(request),
|
|
99196
|
+
toRequestParams(requestOptions)
|
|
99197
|
+
);
|
|
99198
|
+
return decodeResponse(response, ScriptPolicyFromApiToFront);
|
|
99199
|
+
}
|
|
99200
|
+
/**
|
|
99201
|
+
* Propose an edited SKILL.md for a requested change.
|
|
99202
|
+
*
|
|
99203
|
+
* @param request - The request (`SkillDraftEditRequest`), camelCase; sent snake_case.
|
|
99204
|
+
* @param requestOptions - Per-call cancellation, timeout and request options.
|
|
99205
|
+
* @returns The engine's answer as `SkillDraftEditResponse`, camelCase.
|
|
99206
|
+
* @throws {ApiError} 400: Empty or too long
|
|
99207
|
+
* @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
|
|
99208
|
+
* @throws {ApiError} 422: The model's file failed the package check (skill_* codes)
|
|
99209
|
+
* @throws {ApiError} 502: `llm_provider_failed` (`component`: `text_model`): the text model's provider failed or refused
|
|
99210
|
+
* @throws {ApiError} 503: `llm_unconfigured` (`component`: `text_model`): no text model is configured on this engine
|
|
99211
|
+
*
|
|
99212
|
+
* @remarks Uses POST `/api/v1/skills/draft-edit`.
|
|
99213
|
+
* POST /api/v1/skills/draft-edit
|
|
99214
|
+
*
|
|
99215
|
+
* @example
|
|
99216
|
+
* ```typescript
|
|
99217
|
+
* const draft = await client.platform.draftSkillEdit(request);
|
|
99218
|
+
* ```
|
|
99219
|
+
*/
|
|
99220
|
+
async draftSkillEdit(request, requestOptions) {
|
|
99221
|
+
const response = await this.skills.draftSkillEdit(
|
|
99222
|
+
SkillDraftEditRequestFromFrontToApi(request),
|
|
99223
|
+
toRequestParams(requestOptions)
|
|
99224
|
+
);
|
|
99225
|
+
return decodeResponse(response, SkillDraftEditResponseFromApiToFront);
|
|
99226
|
+
}
|
|
97470
99227
|
};
|
|
97471
99228
|
|
|
97472
99229
|
// src/normalizers/source-observations.ts
|
|
@@ -101326,6 +103083,8 @@ var ReasoningLayerClient = class {
|
|
|
101326
103083
|
channels;
|
|
101327
103084
|
/** Platform administration — backups, config sections, connector health, diagnostics, identities, onboarding, skills. */
|
|
101328
103085
|
platform;
|
|
103086
|
+
/** Text editing with the engine's text model: proofread and rewrite. */
|
|
103087
|
+
text;
|
|
101329
103088
|
/**
|
|
101330
103089
|
* Runtime native (WASM) plugins — register, list, enable, disable, delete.
|
|
101331
103090
|
* Restricted to the platform provisioning identity.
|
|
@@ -101754,8 +103513,10 @@ var ReasoningLayerClient = class {
|
|
|
101754
103513
|
);
|
|
101755
103514
|
this.platform = new PlatformClient(
|
|
101756
103515
|
encodePathParams(new Platform(generatedHttp)),
|
|
101757
|
-
resolved.tenantId
|
|
103516
|
+
resolved.tenantId,
|
|
103517
|
+
encodePathParams(new Skills(generatedHttp))
|
|
101758
103518
|
);
|
|
103519
|
+
this.text = new TextClient(encodePathParams(new Text(generatedHttp)));
|
|
101759
103520
|
this.plugins = new PluginsClient(encodePathParams(new Plugins(generatedHttp)));
|
|
101760
103521
|
this.memory = new MemoryClient(encodePathParams(new Memory(generatedHttp)));
|
|
101761
103522
|
}
|
|
@@ -102095,6 +103856,21 @@ var vocabulary_exports = {};
|
|
|
102095
103856
|
// src/types/source-observations.ts
|
|
102096
103857
|
var source_observations_exports = {};
|
|
102097
103858
|
|
|
103859
|
+
// src/types/live-docs.ts
|
|
103860
|
+
var live_docs_exports = {};
|
|
103861
|
+
|
|
103862
|
+
// src/types/agent-instructions.ts
|
|
103863
|
+
var agent_instructions_exports = {};
|
|
103864
|
+
|
|
103865
|
+
// src/types/skill-scripts.ts
|
|
103866
|
+
var skill_scripts_exports = {};
|
|
103867
|
+
|
|
103868
|
+
// src/types/text-editing.ts
|
|
103869
|
+
var text_editing_exports = {};
|
|
103870
|
+
|
|
103871
|
+
// src/types/frame-authoring.ts
|
|
103872
|
+
var frame_authoring_exports = {};
|
|
103873
|
+
|
|
102098
103874
|
// src/types/boundary.ts
|
|
102099
103875
|
var boundary_exports = {};
|
|
102100
103876
|
|
|
@@ -104915,6 +106691,6 @@ var BrowserPhoneRehearsal = class {
|
|
|
104915
106691
|
}
|
|
104916
106692
|
};
|
|
104917
106693
|
|
|
104918
|
-
export { ANY_ROLE, AUDIT_CAUSAL_REQUEST_HEADERS, AUDIT_RESPONSE_HEADERS, action_reviews_exports as ActionReviews, actions_exports as Actions, admin_exports as Admin, agui_exports as Agui, analysis_exports as Analysis, anonymization_exports as Anonymization, ApiError, app_actions_exports as AppActions, argumentation_exports as Argumentation, audit_exports as Audit, AuthenticationError, authz_exports as Authz, BadRequestError, batch_exports as Batch, boundary_exports as Boundary, BoundaryClient, BrowserPhoneRehearsal, BrowserSpeechAudio, BrowserSpeechOutput, BrowserSpeechSession, BrowserSpeechTranscription, BulkRefusedError, cdl_exports as CDL, causal_exports as Causal, channels_exports as Channels, chase_exports as Chase, cognitive_exports as Cognitive, coherence_exports as Coherence, collections_exports as Collections, communities_exports as Communities, compliance_exports as Compliance, compliance_markings_exports as ComplianceMarkings, conformal_exports as Conformal, conformance_exports as Conformance, connectors_exports as Connectors, Constraint, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, corpus_exports as Corpus, cron_exports as Cron, dl_exports as DL, DeadlineExceededError, demo_exports as Demo, DerivedFactWriteError, discovery_exports as Discovery, document_check_exports as DocumentCheck, documents_exports as Documents, embeddings_exports as Embeddings, engine_exports as Engine, execution_exports as Execution, extract_exports as Extract, feasibility_exports as Feasibility, Flow, flow_networks_exports as FlowNetworks, ForbiddenError, forecast_exports as Forecast, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, gateway_sessions_exports as GatewaySessions, GatewaySessionsClient, generation_exports as Generation, Geometry, GoneError, governance_exports as Governance, GovernanceClient, GovernanceRefusedError, guardrail_exports as Guardrail, health_exports as Health, homoiconic_exports as Homoiconic, hypotheses_exports as Hypotheses, ilp_exports as ILP, IdempotencyKeyRequiredError, IdempotencyKeyReusedError, image_extraction_exports as ImageExtraction, InboundWebhooksClient, inbox_exports as Inbox, inference_exports as Inference, ingestion_exports as Ingestion, IngestionBatchSession, IngestionFailedError, IngestionQueueUnavailableError, IngestionSession, IngestionSessionHandle, InternalServerError, LP, ltn_exports as LTN, marketplace_exports as Marketplace, memory_exports as Memory, metrics_exports as Metrics, MutationOutcomeUnconfirmedError, NamedConstraintViolationError, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, ontology_alignment_exports as OntologyAlignment, ontology_bridge_exports as OntologyBridge, ontology_export_exports as OntologyExport, ontology_facade_exports as OntologyFacade, operations_exports as Operations, optimize_exports as Optimize, osf_diff_exports as OsfDiff, osfql_exports as Osfql, OsfqlError, oversight_exports as Oversight, pairing_exports as Pairing, PhoneClient, plain_values_exports as PlainValues, platform_exports as Platform, plugins_exports as Plugins, PreconditionFailedError, PreconditionRequiredError, preferences_exports as Preferences, proof_engine_exports as ProofEngine, property_graph_exports as PropertyGraph, query_exports as Query, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, ResponseShapeError, reviews_exports as Reviews, reward_exports as Reward, row_exports as Row, RuleTermWriteError, SDK_VERSION, SPEECH_AUDIO_WORKLET_SOURCE, sat_exports as Sat, scenarios_exports as Scenarios, scheduling_exports as Scheduling, ServiceUnavailableError, settings_exports as Settings, SettingsClient, smt_exports as Smt, snapshots_exports as Snapshots, solver_exports as Solver, SortBuilder, sorts_exports as Sorts, source_observations_exports as SourceObservations, sources_exports as Sources, spaces_exports as Spaces, sparql_exports as Sparql, speakers_exports as Speakers, speech_exports as Speech, SpeechSessionConnection, SpeechTranscriptionConnection, statistical_exports as Statistical, streaming_exports as Streaming, subscriptions_exports as Subscriptions, synthetic_exports as Synthetic, temporal_exports as Temporal, TenantDeletedError, terms_exports as Terms, thomas_exports as Thomas, TimeoutError, ui_exports as UI, USER_DATA_FIELDS, UrlIngestStoreFailedError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, verification_exports as Verification, vision_exports as Vision, visualization_exports as Visualization, vocabulary_exports as Vocabulary, VocabularyRefusedError, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, workflows_exports as Workflows, WorkflowsClient, aggregate, allen, bind, causalRequestHeaders, collect, constrained, createApiError, decodeConversationMessage, decodeSpeechPcmFrame, discriminateFeatureValue, errorBodyCode, errorBodyComponent, featureValueToInput, functionRefusalOf, governanceRefusalOfBody, guard, isConstrainedPlainVar, isPsiTermInput, isSortRefFeatureValue, isSortRefSelectProps, isTaggedValueDto, isUuid, not, osfqlContainmentRefusalOf, paginateByOffset, paginateByPage, psi, readAuditHeaders, readCausalRefusal, ruleRefusalOf, sealPreimage, sortDeleteRefusalOf, speechTextSegments, termRefusalOf, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue, validateWorkflowOnceRequest, vocabularyRefusalOfBody, workflowEventRunId };
|
|
106694
|
+
export { ANY_ROLE, AUDIT_CAUSAL_REQUEST_HEADERS, AUDIT_RESPONSE_HEADERS, action_reviews_exports as ActionReviews, actions_exports as Actions, admin_exports as Admin, agent_instructions_exports as AgentInstructions, agui_exports as Agui, analysis_exports as Analysis, anonymization_exports as Anonymization, ApiError, app_actions_exports as AppActions, argumentation_exports as Argumentation, audit_exports as Audit, AuthenticationError, authz_exports as Authz, BadRequestError, batch_exports as Batch, boundary_exports as Boundary, BoundaryClient, BrowserPhoneRehearsal, BrowserSpeechAudio, BrowserSpeechOutput, BrowserSpeechSession, BrowserSpeechTranscription, BulkRefusedError, cdl_exports as CDL, causal_exports as Causal, channels_exports as Channels, chase_exports as Chase, cognitive_exports as Cognitive, coherence_exports as Coherence, collections_exports as Collections, communities_exports as Communities, compliance_exports as Compliance, compliance_markings_exports as ComplianceMarkings, conformal_exports as Conformal, conformance_exports as Conformance, connectors_exports as Connectors, Constraint, ConstraintViolationError, constraints_exports as Constraints, control_exports as Control, conversation_exports as Conversation, corpus_exports as Corpus, cron_exports as Cron, dl_exports as DL, DeadlineExceededError, demo_exports as Demo, DerivedFactWriteError, discovery_exports as Discovery, document_check_exports as DocumentCheck, documents_exports as Documents, embeddings_exports as Embeddings, engine_exports as Engine, execution_exports as Execution, extract_exports as Extract, feasibility_exports as Feasibility, Flow, flow_networks_exports as FlowNetworks, ForbiddenError, forecast_exports as Forecast, frame_authoring_exports as FrameAuthoring, functions_exports as Functions, fuzzy_exports as Fuzzy, FuzzyShape, gateway_sessions_exports as GatewaySessions, GatewaySessionsClient, generation_exports as Generation, Geometry, GoneError, governance_exports as Governance, GovernanceClient, GovernanceRefusedError, guardrail_exports as Guardrail, health_exports as Health, homoiconic_exports as Homoiconic, hypotheses_exports as Hypotheses, ilp_exports as ILP, IdempotencyKeyRequiredError, IdempotencyKeyReusedError, image_extraction_exports as ImageExtraction, InboundWebhooksClient, inbox_exports as Inbox, inference_exports as Inference, ingestion_exports as Ingestion, IngestionBatchSession, IngestionFailedError, IngestionQueueUnavailableError, IngestionSession, IngestionSessionHandle, InternalServerError, LP, ltn_exports as LTN, live_docs_exports as LiveDocs, marketplace_exports as Marketplace, memory_exports as Memory, metrics_exports as Metrics, MutationOutcomeUnconfirmedError, NamedConstraintViolationError, namespaces_exports as Namespaces, NetworkError, neuro_symbolic_exports as NeuroSymbolic, NotFoundError, ontology_exports as Ontology, ontology_alignment_exports as OntologyAlignment, ontology_bridge_exports as OntologyBridge, ontology_export_exports as OntologyExport, ontology_facade_exports as OntologyFacade, operations_exports as Operations, optimize_exports as Optimize, osf_diff_exports as OsfDiff, osfql_exports as Osfql, OsfqlError, oversight_exports as Oversight, pairing_exports as Pairing, PhoneClient, plain_values_exports as PlainValues, platform_exports as Platform, plugins_exports as Plugins, PreconditionFailedError, PreconditionRequiredError, preferences_exports as Preferences, proof_engine_exports as ProofEngine, property_graph_exports as PropertyGraph, query_exports as Query, RateLimitError, reasoning_exports as Reasoning, ReasoningLayerClient, ReasoningLayerError, research_exports as Research, ResponseShapeError, reviews_exports as Reviews, reward_exports as Reward, row_exports as Row, RuleTermWriteError, SDK_VERSION, SPEECH_AUDIO_WORKLET_SOURCE, sat_exports as Sat, scenarios_exports as Scenarios, scheduling_exports as Scheduling, ServiceUnavailableError, settings_exports as Settings, SettingsClient, skill_scripts_exports as SkillScripts, smt_exports as Smt, snapshots_exports as Snapshots, solver_exports as Solver, SortBuilder, sorts_exports as Sorts, source_observations_exports as SourceObservations, sources_exports as Sources, spaces_exports as Spaces, sparql_exports as Sparql, speakers_exports as Speakers, speech_exports as Speech, SpeechSessionConnection, SpeechTranscriptionConnection, statistical_exports as Statistical, streaming_exports as Streaming, subscriptions_exports as Subscriptions, synthetic_exports as Synthetic, temporal_exports as Temporal, TenantDeletedError, terms_exports as Terms, text_editing_exports as TextEditing, thomas_exports as Thomas, TimeoutError, ui_exports as UI, USER_DATA_FIELDS, UrlIngestStoreFailedError, utilities_exports as Utilities, ValidationError, Value, values_exports as Values, verification_exports as Verification, vision_exports as Vision, visualization_exports as Visualization, vocabulary_exports as Vocabulary, VocabularyRefusedError, WebSocketClient, WebSocketConnection, webhook_actions_exports as WebhookActions, workflows_exports as Workflows, WorkflowsClient, aggregate, allen, bind, causalRequestHeaders, collect, constrained, createApiError, decodeConversationMessage, decodeSpeechPcmFrame, discriminateFeatureValue, errorBodyCode, errorBodyComponent, featureValueToInput, functionRefusalOf, governanceRefusalOfBody, guard, isConstrainedPlainVar, isPsiTermInput, isSortRefFeatureValue, isSortRefSelectProps, isTaggedValueDto, isUuid, not, osfqlContainmentRefusalOf, paginateByOffset, paginateByPage, psi, readAuditHeaders, readCausalRefusal, ruleRefusalOf, sealPreimage, sortDeleteRefusalOf, speechTextSegments, termRefusalOf, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue, validateWorkflowOnceRequest, vocabularyRefusalOfBody, workflowEventRunId };
|
|
104919
106695
|
//# sourceMappingURL=index.js.map
|
|
104920
106696
|
//# sourceMappingURL=index.js.map
|