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