@loomcycle/client 1.139.0 → 1.141.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/cjs/client.js +116 -0
- package/dist/client.d.ts +41 -1
- package/dist/client.js +116 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +137 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -804,6 +804,47 @@ try {
|
|
|
804
804
|
}
|
|
805
805
|
```
|
|
806
806
|
|
|
807
|
+
### Speech: read-aloud and transcription
|
|
808
|
+
|
|
809
|
+
Read a reply aloud, or turn a recording into text, on the deployment's own speech engines. No run is involved; each engine request is charged to the caller and the caller's hard token budget is checked first. A chat user may call them (the scope is `runs:create`, and access control asks `use gateway:speech` / `use gateway:transcription`); a token limited to certain agents may not.
|
|
810
|
+
|
|
811
|
+
| Method | Returns | Notes |
|
|
812
|
+
|---|---|---|
|
|
813
|
+
| `speech(input, opts?)` | `Promise<SpeechResult>` | Markdown or plain text → `{bytes, contentType, language?, voice?, seconds?, chars?, pieces?}`. Options: `language`, `voice`, `format`, `model`, `signal`. Mirrors `POST /v1/audio/speech`. |
|
|
814
|
+
| `transcribe(file, opts?)` | `Promise<TranscribeResult>` | A `Blob` or `Uint8Array` → `{text, language?, duration?, segments?}`. Options: `filename`, `contentType`, `language`, `prompt`, `format` (`json` \| `verbose_json`), `signal`. Mirrors `POST /v1/audio/transcriptions`. |
|
|
815
|
+
| `speechInfo()` | `Promise<SpeechInfo>` | Per direction: whether this caller may use it, languages and voices, formats, accepted recording types, caps. Mirrors `GET /v1/_speech`. |
|
|
816
|
+
|
|
817
|
+
**Whether to show the controls.** `whoami()`'s `effective.surfaces.speech` and `.transcription` are true only when the engine is configured and the caller passes the route's gates, so a client never probes with a request that costs a ledger row.
|
|
818
|
+
|
|
819
|
+
```ts
|
|
820
|
+
const me = await client.whoami();
|
|
821
|
+
if (me.effective?.surfaces.speech) {
|
|
822
|
+
const info = await client.speechInfo();
|
|
823
|
+
const format = info.speech.formats?.includes("ogg") ? "ogg" : "wav";
|
|
824
|
+
const audio = await client.speech(reply, { format, signal: abort.signal });
|
|
825
|
+
play(new Blob([audio.bytes], { type: audio.contentType }));
|
|
826
|
+
}
|
|
827
|
+
if (me.effective?.surfaces.transcription) {
|
|
828
|
+
const { text } = await client.transcribe(wavBlob, { language: "uk" });
|
|
829
|
+
}
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
- **Pick a format from `speechInfo().speech.formats`.** It is `wav`, plus the one encoded format the deployment makes, if any; it never lists both `mp3` and `ogg`. Any other format is a 400 `speech_encode_not_configured`. `wav` always works.
|
|
833
|
+
- **A recording.** A PCM WAV of any length is cut by the deployment. A browser's own `audio/webm` or `audio/mp4` is taken when `speechInfo().transcription.accepts` lists it, up to `whole_file_max_bytes` when the deployment has no converter. `transcribe` sends `FormData` and sets no `Content-Type`, so the runtime writes the multipart boundary.
|
|
834
|
+
- **Under load a request waits** for the engine rather than being refused. Show progress, and pass `signal` for the user's cancel.
|
|
835
|
+
- **The `seconds` / `language` / `voice` metadata** comes from response headers a browser can read only on a same-origin request; cross-origin they are `undefined`.
|
|
836
|
+
|
|
837
|
+
| Status | `e.code` | What to do |
|
|
838
|
+
|---|---|---|
|
|
839
|
+
| 400 | `speech_encode_not_configured` / `unsupported_format` | Ask for a format from `speechInfo()`. |
|
|
840
|
+
| 400 | `unsupported_voice` / `unsupported_language` / `empty_input` / `model_not_allowed` / `unreadable_audio` / `unsupported_response_format` | Fix the request; the message names the fault. |
|
|
841
|
+
| 403 | `acl_denied` / `insufficient_scope` / `restricted_token` / `operator_key_restricted` | The caller may not use it. Do not retry. |
|
|
842
|
+
| 413 | `input_too_long` / `audio_too_long` / `audio_too_large` / `request_too_large` | Send it in parts. |
|
|
843
|
+
| 415 | `unsupported_media_type` | Send a PCM WAV. |
|
|
844
|
+
| 429 | `token_limit_exceeded` | The caller is at a hard token budget. |
|
|
845
|
+
| 502 | `speech_failed` / `transcription_failed` | The engine failed; try again later. |
|
|
846
|
+
| 503 | `speech_not_configured` / `transcription_not_configured` / `transcription_unavailable` | The deployment has no such engine, or it is not reachable. |
|
|
847
|
+
|
|
807
848
|
Two of these have a class of their own: a `prompt_too_large` throws `PromptTooLargeError` and a `token_limit_exceeded` throws `TokenLimitExceededError` (with the budget on `e.scope` / `e.used` / `e.limit`). For the rest, branch on `e.code`, not on the class: the class follows the HTTP status alone.
|
|
808
849
|
|
|
809
850
|
### Credentials (RFC AR)
|
package/dist/cjs/client.js
CHANGED
|
@@ -1190,6 +1190,108 @@ class LoomcycleClient {
|
|
|
1190
1190
|
async listDecisionModels(opts) {
|
|
1191
1191
|
return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_decide/models", opts);
|
|
1192
1192
|
}
|
|
1193
|
+
/** Read `input` aloud: Markdown or plain text in, audio out, whole. The
|
|
1194
|
+
* deployment normalises the Markdown (no "asterisk", no URLs), cuts the
|
|
1195
|
+
* text, speaks it with the language's voice and joins the pieces. No run
|
|
1196
|
+
* is involved; each engine request is charged to the caller. Mirrors
|
|
1197
|
+
* `POST /v1/audio/speech`.
|
|
1198
|
+
*
|
|
1199
|
+
* Under load a request waits for the engine rather than being refused, so
|
|
1200
|
+
* show progress and pass `signal` for a cancel. A refusal throws with the
|
|
1201
|
+
* code on `e.code`: 400 `speech_encode_not_configured` (a format the
|
|
1202
|
+
* deployment does not make — pick from {@link speechInfo}'s `formats`) /
|
|
1203
|
+
* `unsupported_voice` / `unsupported_language` / `empty_input` /
|
|
1204
|
+
* `model_not_allowed`, 403 (scope, access control, a token limited to
|
|
1205
|
+
* certain agents), 413 `input_too_long`, 429 `token_limit_exceeded`, 502
|
|
1206
|
+
* `speech_failed`, 503 `speech_not_configured`. */
|
|
1207
|
+
async speech(input, opts) {
|
|
1208
|
+
const body = { input };
|
|
1209
|
+
if (opts?.language !== undefined)
|
|
1210
|
+
body.language = opts.language;
|
|
1211
|
+
if (opts?.voice !== undefined)
|
|
1212
|
+
body.voice = opts.voice;
|
|
1213
|
+
if (opts?.format !== undefined)
|
|
1214
|
+
body.response_format = opts.format;
|
|
1215
|
+
if (opts?.model !== undefined)
|
|
1216
|
+
body.model = opts.model;
|
|
1217
|
+
const headers = { "Content-Type": "application/json" };
|
|
1218
|
+
if (this.ctx.authToken)
|
|
1219
|
+
headers.Authorization = `Bearer ${this.ctx.authToken}`;
|
|
1220
|
+
const resp = await this.ctx.fetchImpl(`${this.ctx.baseUrl}/v1/audio/speech`, {
|
|
1221
|
+
method: "POST",
|
|
1222
|
+
headers,
|
|
1223
|
+
body: JSON.stringify(body),
|
|
1224
|
+
signal: opts?.signal,
|
|
1225
|
+
});
|
|
1226
|
+
if (!resp.ok) {
|
|
1227
|
+
await (0, fetch_helpers_js_1.raiseFromResponse)(resp);
|
|
1228
|
+
}
|
|
1229
|
+
const num = (name) => {
|
|
1230
|
+
const v = resp.headers.get(name);
|
|
1231
|
+
if (v === null || v === "")
|
|
1232
|
+
return undefined;
|
|
1233
|
+
const n = Number(v);
|
|
1234
|
+
return Number.isFinite(n) ? n : undefined;
|
|
1235
|
+
};
|
|
1236
|
+
return {
|
|
1237
|
+
bytes: new Uint8Array(await resp.arrayBuffer()),
|
|
1238
|
+
contentType: resp.headers.get("Content-Type") ?? "",
|
|
1239
|
+
language: resp.headers.get("X-Loomcycle-Speech-Language") ?? undefined,
|
|
1240
|
+
voice: resp.headers.get("X-Loomcycle-Speech-Voice") ?? undefined,
|
|
1241
|
+
seconds: num("X-Loomcycle-Speech-Seconds"),
|
|
1242
|
+
chars: num("X-Loomcycle-Speech-Chars"),
|
|
1243
|
+
pieces: num("X-Loomcycle-Speech-Pieces"),
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
/** Transcribe a recording. A PCM WAV of any length is cut by the deployment;
|
|
1247
|
+
* a browser's own `audio/webm` / `audio/mp4` is taken when the deployment
|
|
1248
|
+
* converts or its engine reads the type whole (see {@link speechInfo}'s
|
|
1249
|
+
* `accepts`). No run is involved; each engine request is charged to the
|
|
1250
|
+
* caller. Mirrors `POST /v1/audio/transcriptions`.
|
|
1251
|
+
*
|
|
1252
|
+
* The body is `FormData` and no `Content-Type` is set, so the runtime
|
|
1253
|
+
* writes the multipart boundary. Under load a request waits for the engine
|
|
1254
|
+
* rather than being refused. A refusal throws with the code on `e.code`:
|
|
1255
|
+
* 400 `unreadable_audio` / `unsupported_language` / `model_not_allowed`,
|
|
1256
|
+
* 403, 413 `request_too_large` / `audio_too_large` / `audio_too_long`, 415
|
|
1257
|
+
* `unsupported_media_type`, 429 `token_limit_exceeded`, 502
|
|
1258
|
+
* `transcription_failed`, 503 `transcription_not_configured`. */
|
|
1259
|
+
async transcribe(file, opts) {
|
|
1260
|
+
const type = opts?.contentType ?? (file instanceof Blob ? file.type : "") ?? "";
|
|
1261
|
+
const blob = file instanceof Blob && (opts?.contentType === undefined || opts.contentType === file.type)
|
|
1262
|
+
? file
|
|
1263
|
+
: new Blob([file], type ? { type } : undefined);
|
|
1264
|
+
const form = new FormData();
|
|
1265
|
+
if (opts?.model !== undefined)
|
|
1266
|
+
form.append("model", opts.model);
|
|
1267
|
+
if (opts?.language !== undefined)
|
|
1268
|
+
form.append("language", opts.language);
|
|
1269
|
+
if (opts?.prompt !== undefined)
|
|
1270
|
+
form.append("prompt", opts.prompt);
|
|
1271
|
+
if (opts?.format !== undefined)
|
|
1272
|
+
form.append("response_format", opts.format);
|
|
1273
|
+
form.append("file", blob, opts?.filename ?? recordingName(type));
|
|
1274
|
+
const headers = { Accept: "application/json" };
|
|
1275
|
+
if (this.ctx.authToken)
|
|
1276
|
+
headers.Authorization = `Bearer ${this.ctx.authToken}`;
|
|
1277
|
+
const resp = await this.ctx.fetchImpl(`${this.ctx.baseUrl}/v1/audio/transcriptions`, {
|
|
1278
|
+
method: "POST",
|
|
1279
|
+
headers,
|
|
1280
|
+
body: form,
|
|
1281
|
+
signal: opts?.signal,
|
|
1282
|
+
});
|
|
1283
|
+
if (!resp.ok) {
|
|
1284
|
+
await (0, fetch_helpers_js_1.raiseFromResponse)(resp);
|
|
1285
|
+
}
|
|
1286
|
+
return (await resp.json());
|
|
1287
|
+
}
|
|
1288
|
+
/** What a client needs to draw its voice controls: per direction, whether
|
|
1289
|
+
* this caller may use it, the languages and voices, the formats, the types
|
|
1290
|
+
* a recording may be, and the caps. A direction that is off, or that this
|
|
1291
|
+
* caller may not use, is `{ enabled: false }`. Mirrors `GET /v1/_speech`. */
|
|
1292
|
+
async speechInfo(opts) {
|
|
1293
|
+
return (0, fetch_helpers_js_1.jsonFetch)(this.ctx, "/v1/_speech", opts);
|
|
1294
|
+
}
|
|
1193
1295
|
/** Read the full event log for a session. Each entry has seq,
|
|
1194
1296
|
* run_id, ts_ns, type, event (the providers.Event payload). */
|
|
1195
1297
|
async getTranscript(sessionId, opts) {
|
|
@@ -1399,6 +1501,8 @@ class LoomcycleClient {
|
|
|
1399
1501
|
body.max_active = opts.maxActive;
|
|
1400
1502
|
if (opts?.agents !== undefined)
|
|
1401
1503
|
body.agents = opts.agents;
|
|
1504
|
+
if (opts?.surfaces !== undefined)
|
|
1505
|
+
body.surfaces = opts.surfaces;
|
|
1402
1506
|
if (opts?.overrides !== undefined)
|
|
1403
1507
|
body.overrides = opts.overrides;
|
|
1404
1508
|
if (opts?.rate !== undefined) {
|
|
@@ -3751,6 +3855,18 @@ class LoomcycleClient {
|
|
|
3751
3855
|
exports.LoomcycleClient = LoomcycleClient;
|
|
3752
3856
|
/** The file name of an RFC 8187 `filename*=UTF-8''…` Content-Disposition, or
|
|
3753
3857
|
* a plain quoted `filename="…"`; undefined when there is neither. */
|
|
3858
|
+
/** recordingName names an upload that came without a file name, by its type,
|
|
3859
|
+
* so the runtime's type guess from the extension agrees with the bytes. */
|
|
3860
|
+
function recordingName(type) {
|
|
3861
|
+
const base = type.split(";")[0].trim().toLowerCase();
|
|
3862
|
+
const ext = {
|
|
3863
|
+
"audio/wav": ".wav", "audio/x-wav": ".wav", "audio/wave": ".wav",
|
|
3864
|
+
"audio/webm": ".webm", "video/webm": ".webm",
|
|
3865
|
+
"audio/mp4": ".m4a", "audio/x-m4a": ".m4a", "video/mp4": ".mp4",
|
|
3866
|
+
"audio/mpeg": ".mp3", "audio/ogg": ".ogg", "audio/flac": ".flac",
|
|
3867
|
+
};
|
|
3868
|
+
return "recording" + (ext[base] ?? "");
|
|
3869
|
+
}
|
|
3754
3870
|
function dispositionFilename(header) {
|
|
3755
3871
|
if (!header)
|
|
3756
3872
|
return undefined;
|
package/dist/client.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { InteractiveSession } from "./interactive.js";
|
|
27
27
|
import { LoomcycleOAuth } from "./oauth.js";
|
|
28
28
|
import { ClientToolHost, type ConnectClientToolsOptions } from "./client-tools.js";
|
|
29
|
-
import type { ChangeFeedFrame, StreamChangesOptions, DocumentFeedFrame, DocumentFeedOptions, CredentialListResponse, CredentialMeta, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, ReviewQueueFilter, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, ListRulingsResult, ApplyReviewPolicyResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, AgentOverridableResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureHookDefOptions, EnsureHookDefResult, HookDefInput, HookDefOverlay, HookDefRowResponse, CreateDefOptions, ForkDefOptions, HookDefForkOverlay, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, WebhookDefInput, WebhookDefOverlay, WebhookDefRowResponse, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, ListUserAgentsOptions, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, CreateTeamOptions, DefNamesResponse, ForkTeamOptions, ModelAliasesResponse, OperatorTokenDefNamesResponse, ProviderModelsResponse, RoutingResponse, ScheduleListResponse, SchedulePauseResult, ScheduleRunNowResult, ScheduleStateView, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamDraft, TeamDraftVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferResult, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
|
|
29
|
+
import type { ChangeFeedFrame, StreamChangesOptions, DocumentFeedFrame, DocumentFeedOptions, CredentialListResponse, CredentialMeta, CryptoKeyEncoding, CryptoKeyExport, CryptoKeyExternal, CryptoKeyType, CryptoRequest, CryptoResultByOp, DecideRequest, DecideResponse, DecisionModelsResponse, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, SpeechInfo, CredentialScope, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureReport, ErasureResult, MergeSubjectsResult, ReviewQueueFilter, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, ListRulingsResult, ApplyReviewPolicyResult, BindSubjectPrincipalResult, Agent, AgentEvent, AgentList, CancelAgentResult, ClientOptions, ContinueOptions, RunOverrideOptions, EffectiveConfigResponse, RunFileInput, RunInboxDownload, AgentOverridableResponse, RetuneRunResponse, RunConfigResponse, RunPromptResponse, CreateSnapshotOptions, EnsureCodeAgentOptions, EnsureCodeAgentResult, EnsureHookDefOptions, EnsureHookDefResult, HookDefInput, HookDefOverlay, HookDefRowResponse, CreateDefOptions, ForkDefOptions, HookDefForkOverlay, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, WebhookDefInput, WebhookDefOverlay, WebhookDefRowResponse, EnsureMcpServerOptions, EnsureMcpServerResult, HealthResponse, InterruptListResponse, InterruptStatus, ListUserAgentsOptions, WalkRunsPage, AckChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAckResult, ChannelAwaitResult, ChannelBroadcastResult, ChannelDescriptor, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelPeekResult, TeamChannelReleaseResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelSubscribeResult, CreateChannelOptions, ListChannelsResponse, PeekChannelOptions, PublishChannelOptions, ReleaseChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, SubscribeChannelOptions, UpdateChannelOptions, LibraryAgentDefinition, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, ListUsersResponse, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenSurface, ListUserTokensResponse, UserIdentitiesResponse, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentitiesResponse, GateTenantStatus, RunnableAgentsResponse, LLMChatOptions, LLMChatResponse, LLMChatStreamItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, MCPServerDefVerifyResult, MemoryEmbedStatsResponse, MemoryEntriesResponse, MemoryEntryResponse, MemoryBackfillResponse, MemoryPurgeResponse, MemoryReembedResponse, MemoryScopeIDsResponse, MemoryScopesResponse, MemorySearchInput, MemorySearchResponse, PauseResult, RetentionOverride, PersistentVolumesResponse, EphemeralVolumesResponse, ResolveInterruptOptions, ResumeResult, ResolverMatrix, CompactRunResult, RunTreeDeletion, ReplaySessionResult, CancelTurnResult, ReviewRunResult, RunBatchOptions, RunBatchResult, RunOptions, ConfiguredRun, ConfiguredRunPatch, RunStateStreamItem, RuntimeStateResponse, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotRestoreResponse, StreamUserRunStatesOptions, SubstrateToolInput, SubstrateToolResponse, CreatedTeam, CreateTeamOptions, DefNamesResponse, ForkTeamOptions, ModelAliasesResponse, OperatorTokenDefNamesResponse, ProviderModelsResponse, RoutingResponse, ScheduleListResponse, SchedulePauseResult, ScheduleRunNowResult, ScheduleStateView, ListTeamsResponse, PromotedTeam, RetiredTeam, TeamBreakpoints, TeamDefDetail, TeamRunDetached, TeamRunTarget, TeamVerification, TeamDraft, TeamDraftVerification, TeamVersionList, TeamDiagram, TeamRunResult, PathToolInput, PathToolResponse, DocumentToolInput, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferResult, HistoryToolInput, HistoryToolResponse, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationAggregate, TranscriptResponse, WhoamiResponse, UsageDimension, UsageBucket, UsageReportResponse, TokenLimit, TokenLimitsResponse, ConfigResponse, SetTokenLimitRequest, AclBinding, AclBindingListResponse, AclCatalog, AclDefInput, AclDefListResponse, AclDefNamesResponse, AclDefRow, AclRule, AclValidateResult, AuthzDecision, AuthzEvaluationRequest, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzExplainResponse, AuthzSimulateRequest, AuthzSimulateResponse, CreateAclBindingBody, CreateGroupBody, GroupDetail, GroupEffective, GroupListResponse, GroupMemberChange, GroupMemberKind, GroupRow, AppClientConfig, AppClientEntry, ClientDefInput, ClientDefListResponse, ClientDefNamesResponse, ClientDefRecord, ClientDefRetireResult, ClientDefVerifyResult, DeviceLoginOptions, DeviceLoginResult } from "./types.js";
|
|
30
30
|
export declare class LoomcycleClient {
|
|
31
31
|
private ctx;
|
|
32
32
|
private readonly tokenProvider?;
|
|
@@ -785,6 +785,42 @@ export declare class LoomcycleClient {
|
|
|
785
785
|
listDecisionModels(opts?: {
|
|
786
786
|
signal?: AbortSignal;
|
|
787
787
|
}): Promise<DecisionModelsResponse>;
|
|
788
|
+
/** Read `input` aloud: Markdown or plain text in, audio out, whole. The
|
|
789
|
+
* deployment normalises the Markdown (no "asterisk", no URLs), cuts the
|
|
790
|
+
* text, speaks it with the language's voice and joins the pieces. No run
|
|
791
|
+
* is involved; each engine request is charged to the caller. Mirrors
|
|
792
|
+
* `POST /v1/audio/speech`.
|
|
793
|
+
*
|
|
794
|
+
* Under load a request waits for the engine rather than being refused, so
|
|
795
|
+
* show progress and pass `signal` for a cancel. A refusal throws with the
|
|
796
|
+
* code on `e.code`: 400 `speech_encode_not_configured` (a format the
|
|
797
|
+
* deployment does not make — pick from {@link speechInfo}'s `formats`) /
|
|
798
|
+
* `unsupported_voice` / `unsupported_language` / `empty_input` /
|
|
799
|
+
* `model_not_allowed`, 403 (scope, access control, a token limited to
|
|
800
|
+
* certain agents), 413 `input_too_long`, 429 `token_limit_exceeded`, 502
|
|
801
|
+
* `speech_failed`, 503 `speech_not_configured`. */
|
|
802
|
+
speech(input: string, opts?: SpeechOptions): Promise<SpeechResult>;
|
|
803
|
+
/** Transcribe a recording. A PCM WAV of any length is cut by the deployment;
|
|
804
|
+
* a browser's own `audio/webm` / `audio/mp4` is taken when the deployment
|
|
805
|
+
* converts or its engine reads the type whole (see {@link speechInfo}'s
|
|
806
|
+
* `accepts`). No run is involved; each engine request is charged to the
|
|
807
|
+
* caller. Mirrors `POST /v1/audio/transcriptions`.
|
|
808
|
+
*
|
|
809
|
+
* The body is `FormData` and no `Content-Type` is set, so the runtime
|
|
810
|
+
* writes the multipart boundary. Under load a request waits for the engine
|
|
811
|
+
* rather than being refused. A refusal throws with the code on `e.code`:
|
|
812
|
+
* 400 `unreadable_audio` / `unsupported_language` / `model_not_allowed`,
|
|
813
|
+
* 403, 413 `request_too_large` / `audio_too_large` / `audio_too_long`, 415
|
|
814
|
+
* `unsupported_media_type`, 429 `token_limit_exceeded`, 502
|
|
815
|
+
* `transcription_failed`, 503 `transcription_not_configured`. */
|
|
816
|
+
transcribe(file: Blob | Uint8Array, opts?: TranscribeOptions): Promise<TranscribeResult>;
|
|
817
|
+
/** What a client needs to draw its voice controls: per direction, whether
|
|
818
|
+
* this caller may use it, the languages and voices, the formats, the types
|
|
819
|
+
* a recording may be, and the caps. A direction that is off, or that this
|
|
820
|
+
* caller may not use, is `{ enabled: false }`. Mirrors `GET /v1/_speech`. */
|
|
821
|
+
speechInfo(opts?: {
|
|
822
|
+
signal?: AbortSignal;
|
|
823
|
+
}): Promise<SpeechInfo>;
|
|
788
824
|
/** Read the full event log for a session. Each entry has seq,
|
|
789
825
|
* run_id, ts_ns, type, event (the providers.Event payload). */
|
|
790
826
|
getTranscript(sessionId: string, opts?: {
|
|
@@ -982,6 +1018,10 @@ export declare class LoomcycleClient {
|
|
|
982
1018
|
name?: string;
|
|
983
1019
|
maxActive?: number;
|
|
984
1020
|
agents?: string[];
|
|
1021
|
+
/** With `agents`: the off-run surfaces the token may still call, e.g.
|
|
1022
|
+
* `["speech", "transcription"]` for a chat bridge that exchanges voice
|
|
1023
|
+
* messages. Refused without `agents`; held to the caller's own. */
|
|
1024
|
+
surfaces?: TokenSurface[];
|
|
985
1025
|
overrides?: "none" | string[];
|
|
986
1026
|
rate?: {
|
|
987
1027
|
perMinute: number;
|
package/dist/client.js
CHANGED
|
@@ -1187,6 +1187,108 @@ export class LoomcycleClient {
|
|
|
1187
1187
|
async listDecisionModels(opts) {
|
|
1188
1188
|
return jsonFetch(this.ctx, "/v1/_decide/models", opts);
|
|
1189
1189
|
}
|
|
1190
|
+
/** Read `input` aloud: Markdown or plain text in, audio out, whole. The
|
|
1191
|
+
* deployment normalises the Markdown (no "asterisk", no URLs), cuts the
|
|
1192
|
+
* text, speaks it with the language's voice and joins the pieces. No run
|
|
1193
|
+
* is involved; each engine request is charged to the caller. Mirrors
|
|
1194
|
+
* `POST /v1/audio/speech`.
|
|
1195
|
+
*
|
|
1196
|
+
* Under load a request waits for the engine rather than being refused, so
|
|
1197
|
+
* show progress and pass `signal` for a cancel. A refusal throws with the
|
|
1198
|
+
* code on `e.code`: 400 `speech_encode_not_configured` (a format the
|
|
1199
|
+
* deployment does not make — pick from {@link speechInfo}'s `formats`) /
|
|
1200
|
+
* `unsupported_voice` / `unsupported_language` / `empty_input` /
|
|
1201
|
+
* `model_not_allowed`, 403 (scope, access control, a token limited to
|
|
1202
|
+
* certain agents), 413 `input_too_long`, 429 `token_limit_exceeded`, 502
|
|
1203
|
+
* `speech_failed`, 503 `speech_not_configured`. */
|
|
1204
|
+
async speech(input, opts) {
|
|
1205
|
+
const body = { input };
|
|
1206
|
+
if (opts?.language !== undefined)
|
|
1207
|
+
body.language = opts.language;
|
|
1208
|
+
if (opts?.voice !== undefined)
|
|
1209
|
+
body.voice = opts.voice;
|
|
1210
|
+
if (opts?.format !== undefined)
|
|
1211
|
+
body.response_format = opts.format;
|
|
1212
|
+
if (opts?.model !== undefined)
|
|
1213
|
+
body.model = opts.model;
|
|
1214
|
+
const headers = { "Content-Type": "application/json" };
|
|
1215
|
+
if (this.ctx.authToken)
|
|
1216
|
+
headers.Authorization = `Bearer ${this.ctx.authToken}`;
|
|
1217
|
+
const resp = await this.ctx.fetchImpl(`${this.ctx.baseUrl}/v1/audio/speech`, {
|
|
1218
|
+
method: "POST",
|
|
1219
|
+
headers,
|
|
1220
|
+
body: JSON.stringify(body),
|
|
1221
|
+
signal: opts?.signal,
|
|
1222
|
+
});
|
|
1223
|
+
if (!resp.ok) {
|
|
1224
|
+
await raiseFromResponse(resp);
|
|
1225
|
+
}
|
|
1226
|
+
const num = (name) => {
|
|
1227
|
+
const v = resp.headers.get(name);
|
|
1228
|
+
if (v === null || v === "")
|
|
1229
|
+
return undefined;
|
|
1230
|
+
const n = Number(v);
|
|
1231
|
+
return Number.isFinite(n) ? n : undefined;
|
|
1232
|
+
};
|
|
1233
|
+
return {
|
|
1234
|
+
bytes: new Uint8Array(await resp.arrayBuffer()),
|
|
1235
|
+
contentType: resp.headers.get("Content-Type") ?? "",
|
|
1236
|
+
language: resp.headers.get("X-Loomcycle-Speech-Language") ?? undefined,
|
|
1237
|
+
voice: resp.headers.get("X-Loomcycle-Speech-Voice") ?? undefined,
|
|
1238
|
+
seconds: num("X-Loomcycle-Speech-Seconds"),
|
|
1239
|
+
chars: num("X-Loomcycle-Speech-Chars"),
|
|
1240
|
+
pieces: num("X-Loomcycle-Speech-Pieces"),
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
/** Transcribe a recording. A PCM WAV of any length is cut by the deployment;
|
|
1244
|
+
* a browser's own `audio/webm` / `audio/mp4` is taken when the deployment
|
|
1245
|
+
* converts or its engine reads the type whole (see {@link speechInfo}'s
|
|
1246
|
+
* `accepts`). No run is involved; each engine request is charged to the
|
|
1247
|
+
* caller. Mirrors `POST /v1/audio/transcriptions`.
|
|
1248
|
+
*
|
|
1249
|
+
* The body is `FormData` and no `Content-Type` is set, so the runtime
|
|
1250
|
+
* writes the multipart boundary. Under load a request waits for the engine
|
|
1251
|
+
* rather than being refused. A refusal throws with the code on `e.code`:
|
|
1252
|
+
* 400 `unreadable_audio` / `unsupported_language` / `model_not_allowed`,
|
|
1253
|
+
* 403, 413 `request_too_large` / `audio_too_large` / `audio_too_long`, 415
|
|
1254
|
+
* `unsupported_media_type`, 429 `token_limit_exceeded`, 502
|
|
1255
|
+
* `transcription_failed`, 503 `transcription_not_configured`. */
|
|
1256
|
+
async transcribe(file, opts) {
|
|
1257
|
+
const type = opts?.contentType ?? (file instanceof Blob ? file.type : "") ?? "";
|
|
1258
|
+
const blob = file instanceof Blob && (opts?.contentType === undefined || opts.contentType === file.type)
|
|
1259
|
+
? file
|
|
1260
|
+
: new Blob([file], type ? { type } : undefined);
|
|
1261
|
+
const form = new FormData();
|
|
1262
|
+
if (opts?.model !== undefined)
|
|
1263
|
+
form.append("model", opts.model);
|
|
1264
|
+
if (opts?.language !== undefined)
|
|
1265
|
+
form.append("language", opts.language);
|
|
1266
|
+
if (opts?.prompt !== undefined)
|
|
1267
|
+
form.append("prompt", opts.prompt);
|
|
1268
|
+
if (opts?.format !== undefined)
|
|
1269
|
+
form.append("response_format", opts.format);
|
|
1270
|
+
form.append("file", blob, opts?.filename ?? recordingName(type));
|
|
1271
|
+
const headers = { Accept: "application/json" };
|
|
1272
|
+
if (this.ctx.authToken)
|
|
1273
|
+
headers.Authorization = `Bearer ${this.ctx.authToken}`;
|
|
1274
|
+
const resp = await this.ctx.fetchImpl(`${this.ctx.baseUrl}/v1/audio/transcriptions`, {
|
|
1275
|
+
method: "POST",
|
|
1276
|
+
headers,
|
|
1277
|
+
body: form,
|
|
1278
|
+
signal: opts?.signal,
|
|
1279
|
+
});
|
|
1280
|
+
if (!resp.ok) {
|
|
1281
|
+
await raiseFromResponse(resp);
|
|
1282
|
+
}
|
|
1283
|
+
return (await resp.json());
|
|
1284
|
+
}
|
|
1285
|
+
/** What a client needs to draw its voice controls: per direction, whether
|
|
1286
|
+
* this caller may use it, the languages and voices, the formats, the types
|
|
1287
|
+
* a recording may be, and the caps. A direction that is off, or that this
|
|
1288
|
+
* caller may not use, is `{ enabled: false }`. Mirrors `GET /v1/_speech`. */
|
|
1289
|
+
async speechInfo(opts) {
|
|
1290
|
+
return jsonFetch(this.ctx, "/v1/_speech", opts);
|
|
1291
|
+
}
|
|
1190
1292
|
/** Read the full event log for a session. Each entry has seq,
|
|
1191
1293
|
* run_id, ts_ns, type, event (the providers.Event payload). */
|
|
1192
1294
|
async getTranscript(sessionId, opts) {
|
|
@@ -1396,6 +1498,8 @@ export class LoomcycleClient {
|
|
|
1396
1498
|
body.max_active = opts.maxActive;
|
|
1397
1499
|
if (opts?.agents !== undefined)
|
|
1398
1500
|
body.agents = opts.agents;
|
|
1501
|
+
if (opts?.surfaces !== undefined)
|
|
1502
|
+
body.surfaces = opts.surfaces;
|
|
1399
1503
|
if (opts?.overrides !== undefined)
|
|
1400
1504
|
body.overrides = opts.overrides;
|
|
1401
1505
|
if (opts?.rate !== undefined) {
|
|
@@ -3747,6 +3851,18 @@ export class LoomcycleClient {
|
|
|
3747
3851
|
}
|
|
3748
3852
|
/** The file name of an RFC 8187 `filename*=UTF-8''…` Content-Disposition, or
|
|
3749
3853
|
* a plain quoted `filename="…"`; undefined when there is neither. */
|
|
3854
|
+
/** recordingName names an upload that came without a file name, by its type,
|
|
3855
|
+
* so the runtime's type guess from the extension agrees with the bytes. */
|
|
3856
|
+
function recordingName(type) {
|
|
3857
|
+
const base = type.split(";")[0].trim().toLowerCase();
|
|
3858
|
+
const ext = {
|
|
3859
|
+
"audio/wav": ".wav", "audio/x-wav": ".wav", "audio/wave": ".wav",
|
|
3860
|
+
"audio/webm": ".webm", "video/webm": ".webm",
|
|
3861
|
+
"audio/mp4": ".m4a", "audio/x-m4a": ".m4a", "video/mp4": ".mp4",
|
|
3862
|
+
"audio/mpeg": ".mp3", "audio/ogg": ".ogg", "audio/flac": ".flac",
|
|
3863
|
+
};
|
|
3864
|
+
return "recording" + (ext[base] ?? "");
|
|
3865
|
+
}
|
|
3750
3866
|
function dispositionFilename(header) {
|
|
3751
3867
|
if (!header)
|
|
3752
3868
|
return undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -218,5 +218,5 @@ export { ClientToolHost, clientToolsURL, CLIENT_TOOL_SUBPROTOCOL } from "./clien
|
|
|
218
218
|
export type { ClientToolSchema, ClientToolInvocation, ConnectClientToolsOptions, WebSocketLike, WebSocketCtor, } from "./client-tools.js";
|
|
219
219
|
export { LoomcycleOAuth, OAuthTokenProvider, parseAuthorizeResponse, pkceChallenge } from "./oauth.js";
|
|
220
220
|
export type { LoomcycleOAuthOptions, OAuthTokenProviderOptions } from "./oauth.js";
|
|
221
|
-
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ReviewQueueFilter, ReviewQueueGroup, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, RulingBreakdown, RulingItem, RulingSelector, RulingRecord, ListRulingsResult, PolicyRuleCount, ApplyReviewPolicyResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferEntry, DocumentTransferResult, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, GraphSnapshot, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, DocumentFeedChange, DocumentFeedChangeType, DocumentFeedFrame, DocumentFeedOptions, DocumentFeedStatus, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
|
|
221
|
+
export type { AgentEvent, ClientOptions, ContinueOptions, EventType, HostWidening, ImageMediaType, ParentContext, PromptContent, PromptSegment, RetryInfo, RunOptions, RunOverrideOptions, SamplingOptions, CompactionOptions, ContextOptions, ToolUse, Usage, CallTiming, Agent, AgentStatus, AwaitedState, AgentUsage, RunResult, RunSpec, RunSpecTeam, ConfiguredRun, ConfiguredRunPatch, ToolChoiceOptions, OutputFormatOptions, CancelAgentResult, ListAgentsResponse, ListUserAgentsOptions, AgentList, WalkRunsPage, RunBatchOptions, RunBatchResult, SpawnRunResult, CompactRunResult, RunTreeDeletion, RunTreeNotReached, DirectoryBudget, DirectoryInspection, DirectoryTenant, DirectoryUser, ErasureAccess, ErasureReport, ErasureResidue, ErasureResult, ErasureTier, MergeSubjectsResult, SubjectRef, BindSubjectPrincipalResult, ReviewQueueFilter, ReviewQueueGroup, ReviewQueueResult, RuleStatementsResult, RevertRulingResult, RulingBreakdown, RulingItem, RulingSelector, RulingRecord, ListRulingsResult, PolicyRuleCount, ApplyReviewPolicyResult, ErasureBoundSubject, ErasureTokenRef, CancelTurnResult, ReviewRunResult, ReplaySessionResult, TranscriptEvent, TranscriptResponse, HealthResponse, ListUsersResponse, UserSummary, UserStatus, UserRecord, CreateUserBody, UpdateUserBody, MintedUserToken, TokenRestrictions, TokenSurface, UserTokenMeta, ListUserTokensResponse, UserIdentity, UserIdentitiesResponse, AuthGateKind, AuthGate, AuthGateKey, AuthGateRemoval, AuthGateProbe, AuthGateListResponse, CreateInviteBody, CreatedInvite, AuthInviteState, AuthInvite, AuthInviteListResponse, CreatedPasswordReset, GateIdentity, GateIdentitiesResponse, GateTenantStatus, RunnableAgent, RunnableAgentsResponse, WhoamiResponse, WhoamiEffective, WhoamiAuth, PauseResult, RetentionOverride, ResumeResult, RuntimeStateResponse, RuntimeStateStatus, ResolverMatrix, ResolverModelStatus, ResolverProviderAvailability, CreateSnapshotOptions, SnapshotCreateResponse, SnapshotDescriptor, SnapshotEnvelope, SnapshotListResponse, SnapshotRestoreResponse, MemoryEntriesResponse, MemoryEntry, MemoryEntryResponse, MemoryScopeIDsResponse, MemoryScopeIDSummary, MemoryScopeKind, MemoryScopesResponse, MemorySearchDocumentFilter, MemorySearchInput, MemorySource, MemoryWhen, MemoryTimeFilter, MemorySearchEntry, MemorySearchResponse, MemoryEmbedModelStats, MemoryEmbedStatsResponse, MemoryReembedConfigured, MemoryReembedResponse, MemoryBackfillResponse, MemoryPurgeResponse, InterruptListResponse, InterruptRow, InterruptStatus, ResolveInterruptOptions, ChannelHookCall, ChannelHookResult, HookFailMode, HookPhase, HookToolCall, HookToolResult, PostHookCall, PostHookResult, PreHookCall, PreHookResult, SubstrateToolInput, SubstrateToolResponse, TeamNameSummary, ListTeamsResponse, TeamDiagram, CreatedTeam, PromotedTeam, RetiredTeam, TeamDefDetail, TeamVerification, TeamDraft, TeamDraftVerification, TeamIssue, TeamIssueKind, TeamVersion, TeamVersionList, TeamBreakpoints, TeamRunDetached, TeamRunResult, TeamRunTarget, CreateTeamOptions, ForkTeamOptions, DefNameSummary, DefNamesResponse, OperatorTokenDefNameSummary, OperatorTokenDefNamesResponse, ScheduleListEntry, ScheduleListResponse, ScheduleActiveRun, ScheduleStateView, ScheduleRunNowResult, SchedulePauseResult, ModelAlias, ModelAliasesResponse, RoutingResponse, RoutingUserTier, RoutingTier, RoutingCandidate, RoutingThroughput, RoutingProvider, SearchRoutingProvider, RoutingEmbedder, RoutingDecision, RoutingDecisionModel, ProviderModelsResponse, TeamRunStep, TeamDecisionHandler, TeamDecisionQuestion, TeamDecisionAnswer, PathToolInput, PathToolResponse, DocumentToolInput, DocumentEdgeEvidence, DocumentToolResponse, DocumentCopyInput, DocumentMoveInput, DocumentTransferEntry, DocumentTransferResult, DocumentSearchFilter, DocumentSearchHit, DocumentSearchResult, DocumentRelatedResult, GraphSnapshot, HistoryToolInput, HistoryToolResponse, EvaluationEmitterRole, EvaluationSubmitInput, EvaluationGetInput, EvaluationListForRunInput, EvaluationListForDefInput, EvaluationAggregateInput, EvaluationInput, EvaluationSubmitResult, EvaluationRecord, EvaluationListForRunResult, EvaluationListForDefResult, EvaluationScoreStats, EvaluationAggregate, VolumeMode, PersistentVolumeEntry, PersistentVolumesResponse, EphemeralVolumeEntry, EphemeralVolumesResponse, SystemPromptPayload, UserInputPayload, ChannelDescriptor, ListChannelsResponse, RunStateEvent, RunStateStreamClose, RunStateStreamItem, RunStateStreamOpen, StreamUserRunStatesOptions, ChangeFeedError, ChangeFeedFrame, ChangeFeedStatus, EmbedderHealth, MemoryChange, MemoryChangeScope, MemoryChangeType, StreamChangesOptions, DocumentFeedChange, DocumentFeedChangeType, DocumentFeedFrame, DocumentFeedOptions, DocumentFeedStatus, AckChannelOptions, ChannelAckResult, ChannelMessageItem, ChannelPeekResult, ListTeamChannelsOptions, PeekTeamChannelOptions, ReleaseTeamChannelOptions, TeamChannelReleaseResult, TeamChannelDeclaredIn, TeamChannelDescriptor, TeamChannelPeekResult, TeamChannelsResult, ChannelPublishResult, ChannelPurgeResult, ChannelReleaseResult, ChannelScope, ChannelSubscribeResult, PeekChannelOptions, PublishChannelOptions, SubscribeChannelOptions, AwaitChannelsOptions, BroadcastChannelsOptions, ChannelAwaitEntry, ChannelAwaitMode, ChannelAwaitResult, ChannelBroadcastEntry, ChannelBroadcastResult, CreateChannelOptions, ReleaseChannelOptions, UpdateChannelOptions, SetMemoryEntryOptions, SetMemoryEntryResponse, AgentDefRowResponse, AgentDefVerifyResult, SkillDefVerifyResult, EnsureMcpServerOptions, EnsureMcpServerResult, MCPServerDefRowResponse, MCPServerDefVerifyResult, AgentDefOverlay, AgentRouting, AgentChannelACL, AgentInterruptionACL, AgentDecision, MemoryRerank, AgentSampling, AgentCompaction, AgentTranscription, AgentSpeech, AgentContext, TierCandidate, CoreBlock, HookEvent, InlineWebhook, HookEntry, EventHooks, ToolEntry, ToolHooksByTool, EnsureCodeAgentOptions, EnsureCodeAgentResult, CreateDefOptions, ForkDefOptions, EnsureHookDefOptions, EnsureHookDefResult, HookDefBody, HookDefForkOverlay, HookDefInput, HookDefMatch, HookDefOverlay, HookDefRowResponse, HookDefVerifyResult, ScheduleDefInput, ScheduleDefOverlay, ScheduleDefRowResponse, ScheduledRunHook, ScheduledRunPromptContent, ScheduledRunPromptSegment, WebhookDefAuth, WebhookDefFilter, WebhookDefInput, WebhookDefOverlay, WebhookDefRateLimit, WebhookDefRowResponse, WebhookDefDeliveries, WebhookDefSyncResponse, LibraryAgentDefinition, LibraryEntry, LibraryListResponse, LibraryMcpServerDefinition, LibrarySkillDefinition, LLMChatContent, LLMChatMessage, LLMChatOptions, LLMChatResponse, LLMChatStreamDelta, LLMChatStreamItem, LLMChatToolCall, LLMChatUsage, LLMTool, LLMEmbeddingItem, LLMEmbeddingsOptions, LLMEmbeddingsResponse, LLMEmbeddingsUsage, UsageDimension, UsageBucket, UsageAggregate, UsageReportResponse, CapabilityInertInfo, LimitInfo, FileCapturedInfo, TranscriptionInfo, AdmissionInfo, ErrorInfo, CallFormat, CallRef, HookDecisionInfo, TeamDecisionInfo, OverrideInfo, FallbackInfo, InterruptionEventInfo, SpawnChildInfo, TurnCancelledInfo, ChannelEventInfo, ContextCompactionInfo, ContextRecapInfo, ContextStateInfo, ContextExhaustedInfo, ContextTierVerdict, ContextDistillDeclinedInfo, EffectiveConfigResponse, RunFileInput, RunFileImportSource, RunFileImportHeading, RunInboxDownload, EffectiveConfigSource, EffectiveValue, InertContextSetting, AgentOverridableResponse, OverridableField, OverrideLockReason, RetuneRunResponse, RunConfigRecord, SubagentHoldInfo, RunConfigResponse, RunPromptResponse, RunPromptSnapshot, PromptBlock, TokenLimit, TokenLimitsResponse, ConfigResponse, ConfigProvider, ConfigModel, ConfigSearch, ConfigInstance, SetTokenLimitRequest, CredentialScope, CredentialMeta, CredentialListResponse, CryptoKeyVersion, CryptoKeyExport, CryptoKeyType, CryptoKeyEncoding, CryptoKeyBackend, CryptoKeyExternal, CryptoOp, CryptoRequestBase, CryptoKeyRef, CryptoEncryptRequest, CryptoDecryptRequest, CryptoRewrapRequest, CryptoMacRequest, CryptoVerifyMacRequest, CryptoSignRequest, CryptoVerifyRequest, CryptoPublicKeyRequest, CryptoTotpRequest, CryptoHashRequest, CryptoRandomRequest, CryptoHashPasswordRequest, CryptoVerifyPasswordRequest, CryptoRequest, CryptoEncryptResult, CryptoDecryptResult, CryptoRewrapResult, CryptoMacResult, CryptoVerifyResult, CryptoSignResult, CryptoPublicJWK, CryptoPublicKeyResult, CryptoTotpResult, CryptoHashResult, CryptoRandomResult, CryptoHashPasswordResult, CryptoVerifyPasswordResult, CryptoResultByOp, CryptoResult, DecideRequest, DecideResponse, DecisionQuestion, DecisionChoiceQuestion, DecisionNoulQuestion, DecisionScoreQuestion, DecisionAnswer, DecisionChoiceAnswer, DecisionNoulAnswer, DecisionScoreAnswer, DecisionModel, DecisionModelsResponse, SpeechFormat, SpeechOptions, SpeechResult, TranscribeOptions, TranscribeResult, TranscriptSegment, SpeechInfo, SpeechDirectionInfo, SpeechLanguageInfo, TranscriptionDirectionInfo, AclMode, AclSource, AclEffect, AclSubjectKind, AclCondition, AclRule, AclList, AclDefRow, AclDefListResponse, AclDefNamesResponse, AclValidateResult, AclCatalogType, AclCatalog, AclDefOp, AclDefInput, GroupRow, GroupMemberKind, GroupMember, GroupListResponse, GroupDetail, GroupEffective, CreateGroupBody, GroupMemberChange, AclBinding, AclBindingListResponse, CreateAclBindingBody, AuthzReason, AuthzDecision, AuthzRequestContext, AuthzEvaluationRequest, AuthzEvaluationsSemantic, AuthzEvaluationsRequest, AuthzEvaluationsResponse, AuthzTrace, AuthzAppliedBinding, AuthzExplainResponse, AuthzDraftBinding, AuthzSimulateRequest, AuthzSimulateResult, AuthzSimulateResponse, OAuthServerMetadata, OAuthTokenResponse, OAuthTokenSet, BeginAuthorizeOptions, AuthorizeRequest, AuthorizeResponseParams, CompleteAuthorizeOptions, RefreshTokenOptions, RevokeTokenOptions, TokenProvider, AppClientRefresh, AppClientConfig, ClientDefInput, ClientDefRecord, ConfigAppClient, AppClientEntry, ClientDefListResponse, ClientDefVerifyResult, ClientDefRetireResult, ClientDefNameSummary, ClientDefNamesResponse, DeviceLoginPrompt, DeviceLoginOptions, DeviceLoginResult, } from "./types.js";
|
|
222
222
|
export { AclDeniedError, AgentIDInUseError, AgentNotFoundError, AlreadyPausingError, AuthError, BackpressureError, DeviceLoginError, NotFoundError, InsufficientScopeError, InvalidArgumentError, ChannelCursorRegressionError, LoomcycleError, NotPausedError, OAuthError, PauseNotConfiguredError, PerUserQuotaExhaustedError, PromptTooLargeError, RateLimitedError, RequestTooLargeError, SessionBusyError, SessionNotFoundError, SnapshotNotFoundError, SnapshotTooLargeError, SnapshotVersionError, SubstrateToolRefusedError, TokenLimitExceededError, UnavailableError, } from "./errors.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -2416,6 +2416,9 @@ export interface UserSummary {
|
|
|
2416
2416
|
access_mode?: string;
|
|
2417
2417
|
/** The registered user's status; `""` for a subject seen only in runs. */
|
|
2418
2418
|
status?: UserStatus | (string & {});
|
|
2419
|
+
/** Set when a subject erasure made the user a tombstone (RFC3339): it can
|
|
2420
|
+
* never be re-enabled, changed or deleted (409 `user_erased`). */
|
|
2421
|
+
erased_at?: string;
|
|
2419
2422
|
}
|
|
2420
2423
|
export interface ListUsersResponse {
|
|
2421
2424
|
users: UserSummary[];
|
|
@@ -2444,6 +2447,8 @@ export interface UserRecord {
|
|
|
2444
2447
|
status: UserStatus | (string & {});
|
|
2445
2448
|
created_at: string;
|
|
2446
2449
|
created_by: string;
|
|
2450
|
+
/** Set when a subject erasure made the user a tombstone (RFC3339). */
|
|
2451
|
+
erased_at?: string;
|
|
2447
2452
|
}
|
|
2448
2453
|
export interface CreateUserBody {
|
|
2449
2454
|
subject: string;
|
|
@@ -2487,6 +2492,10 @@ export interface MintedUserToken {
|
|
|
2487
2492
|
* run endpoints. */
|
|
2488
2493
|
export interface TokenRestrictions {
|
|
2489
2494
|
agents?: string[];
|
|
2495
|
+
/** Off-run calls a token with `agents` may still make (a chat bridge's
|
|
2496
|
+
* voice messages): `"speech"` opens `speech()`, `"transcription"` opens
|
|
2497
|
+
* `transcribe()`; either opens `speechInfo()`. */
|
|
2498
|
+
surfaces?: TokenSurface[];
|
|
2490
2499
|
/** `"none"` when every per-run override is locked, or the overrides the
|
|
2491
2500
|
* token may still set. Absent when nothing is locked. */
|
|
2492
2501
|
overrides?: "none" | string[];
|
|
@@ -2498,6 +2507,8 @@ export interface TokenRestrictions {
|
|
|
2498
2507
|
/** `"none"` when every run the token starts is a no-trace run. */
|
|
2499
2508
|
retention?: "none";
|
|
2500
2509
|
}
|
|
2510
|
+
/** An off-run surface an agent-limited token may be granted. */
|
|
2511
|
+
export type TokenSurface = "speech" | "transcription";
|
|
2501
2512
|
/** One token row from GET /v1/_users/{subject}/tokens — METADATA ONLY (never
|
|
2502
2513
|
* the plaintext or hash). `active` applies the auth-layer validity rule. */
|
|
2503
2514
|
export interface UserTokenMeta {
|
|
@@ -2741,7 +2752,13 @@ export interface WhoamiEffective {
|
|
|
2741
2752
|
/** Per Web UI page id (`run`, `runs`, `channels`, `access`, `users`, …),
|
|
2742
2753
|
* whether a request to the route the page loads first would pass the
|
|
2743
2754
|
* route's scope gate and its access-control question in the current mode.
|
|
2744
|
-
* Every page is true in open mode.
|
|
2755
|
+
* Every page is true in open mode.
|
|
2756
|
+
*
|
|
2757
|
+
* Two ids are calls rather than pages: `speech` ({@link LoomcycleClient.speech})
|
|
2758
|
+
* and `transcription` ({@link LoomcycleClient.transcribe}). Each is true
|
|
2759
|
+
* only when its engine is configured AND the caller would pass its route's
|
|
2760
|
+
* gates, so a client shows a read-aloud button or a microphone without
|
|
2761
|
+
* probing. */
|
|
2745
2762
|
surfaces: Record<string, boolean>;
|
|
2746
2763
|
}
|
|
2747
2764
|
export type RuntimeStateStatus = "running" | "pausing" | "paused";
|
|
@@ -7030,6 +7047,121 @@ export interface DecisionModelsResponse {
|
|
|
7030
7047
|
default: string;
|
|
7031
7048
|
models: DecisionModel[];
|
|
7032
7049
|
}
|
|
7050
|
+
/** The audio a read-aloud can come back as: `wav` always, `mp3` or `ogg` only
|
|
7051
|
+
* when the deployment encodes to it (see {@link SpeechDirectionInfo.formats}).
|
|
7052
|
+
* `opus` is accepted as another name for `ogg`. */
|
|
7053
|
+
export type SpeechFormat = "wav" | "mp3" | "ogg" | "opus";
|
|
7054
|
+
/** Options of {@link LoomcycleClient.speech}. */
|
|
7055
|
+
export interface SpeechOptions {
|
|
7056
|
+
/** A language code from {@link SpeechDirectionInfo.languages}; omitted, the
|
|
7057
|
+
* text's script decides, else the deployment's default language. */
|
|
7058
|
+
language?: string;
|
|
7059
|
+
/** One of the language's voices; omitted, its default voice. */
|
|
7060
|
+
voice?: string;
|
|
7061
|
+
/** Omitted, the deployment's own format. Ask only for one listed in
|
|
7062
|
+
* {@link SpeechDirectionInfo.formats}: another is a 400
|
|
7063
|
+
* `speech_encode_not_configured`. */
|
|
7064
|
+
format?: SpeechFormat;
|
|
7065
|
+
/** A `models:` alias of kind `synthesizer`; omitted, the language's. */
|
|
7066
|
+
model?: string;
|
|
7067
|
+
signal?: AbortSignal;
|
|
7068
|
+
}
|
|
7069
|
+
/** What {@link LoomcycleClient.speech} returns: the audio, whole. The
|
|
7070
|
+
* metadata comes from `X-Loomcycle-Speech-*` headers, which a browser can
|
|
7071
|
+
* read only on a same-origin request (the runtime exposes no CORS headers);
|
|
7072
|
+
* cross-origin they are undefined. */
|
|
7073
|
+
export interface SpeechResult {
|
|
7074
|
+
bytes: Uint8Array;
|
|
7075
|
+
/** `audio/wav`, `audio/mpeg` or `audio/ogg`. */
|
|
7076
|
+
contentType: string;
|
|
7077
|
+
language?: string;
|
|
7078
|
+
voice?: string;
|
|
7079
|
+
/** How long the audio lasts, pauses included. */
|
|
7080
|
+
seconds?: number;
|
|
7081
|
+
/** The characters spoken, after Markdown was normalised. */
|
|
7082
|
+
chars?: number;
|
|
7083
|
+
/** How many engine requests the text was cut into. */
|
|
7084
|
+
pieces?: number;
|
|
7085
|
+
}
|
|
7086
|
+
/** Options of {@link LoomcycleClient.transcribe}. */
|
|
7087
|
+
export interface TranscribeOptions {
|
|
7088
|
+
/** The file name sent with the upload; defaults to `recording` with an
|
|
7089
|
+
* extension from the content type. */
|
|
7090
|
+
filename?: string;
|
|
7091
|
+
/** The recording's type, e.g. `audio/wav` or `audio/webm`; a Blob's own
|
|
7092
|
+
* type is used when omitted. */
|
|
7093
|
+
contentType?: string;
|
|
7094
|
+
/** An ISO 639-1 code; omitted, the deployment's default or the engine's
|
|
7095
|
+
* guess. */
|
|
7096
|
+
language?: string;
|
|
7097
|
+
/** Names and terms the engine should expect. */
|
|
7098
|
+
prompt?: string;
|
|
7099
|
+
/** Must be the deployment's speech-to-text model when given; omit it. */
|
|
7100
|
+
model?: string;
|
|
7101
|
+
/** `json` (the default) or `verbose_json`, which adds `segments`. */
|
|
7102
|
+
format?: "json" | "verbose_json";
|
|
7103
|
+
signal?: AbortSignal;
|
|
7104
|
+
}
|
|
7105
|
+
/** One stretch of a transcript, in seconds from the start of the recording. */
|
|
7106
|
+
export interface TranscriptSegment {
|
|
7107
|
+
start: number;
|
|
7108
|
+
end: number;
|
|
7109
|
+
text: string;
|
|
7110
|
+
/** Present when the engine labels speakers. */
|
|
7111
|
+
speaker?: string;
|
|
7112
|
+
}
|
|
7113
|
+
/** What {@link LoomcycleClient.transcribe} returns. */
|
|
7114
|
+
export interface TranscribeResult {
|
|
7115
|
+
text: string;
|
|
7116
|
+
language?: string;
|
|
7117
|
+
/** The recording's length in seconds. */
|
|
7118
|
+
duration?: number;
|
|
7119
|
+
/** With `format: "verbose_json"`. */
|
|
7120
|
+
segments?: TranscriptSegment[];
|
|
7121
|
+
}
|
|
7122
|
+
/** One language a read-aloud can speak, and the voices a caller may pick. */
|
|
7123
|
+
export interface SpeechLanguageInfo {
|
|
7124
|
+
voices: string[];
|
|
7125
|
+
default_voice: string;
|
|
7126
|
+
}
|
|
7127
|
+
/** The read-aloud half of {@link SpeechInfo}. Only `enabled` is present when
|
|
7128
|
+
* it is off, or when the caller may not use it. */
|
|
7129
|
+
export interface SpeechDirectionInfo {
|
|
7130
|
+
enabled: boolean;
|
|
7131
|
+
default_language?: string;
|
|
7132
|
+
languages?: Record<string, SpeechLanguageInfo>;
|
|
7133
|
+
/** `wav`, plus the one encoded format the deployment makes, if any. */
|
|
7134
|
+
formats?: string[];
|
|
7135
|
+
/** The size of each piece sent to the engine (information only). */
|
|
7136
|
+
max_chars_per_call?: number;
|
|
7137
|
+
/** What one request may carry; longer text is a 413 `input_too_long`. */
|
|
7138
|
+
max_chars_per_request?: number;
|
|
7139
|
+
max_seconds_per_request?: number;
|
|
7140
|
+
}
|
|
7141
|
+
/** The transcription half of {@link SpeechInfo}. Only `enabled` is present
|
|
7142
|
+
* when it is off, or when the caller may not use it. */
|
|
7143
|
+
export interface TranscriptionDirectionInfo {
|
|
7144
|
+
enabled: boolean;
|
|
7145
|
+
default_language?: string;
|
|
7146
|
+
/** The recording types the route takes. `audio/wav` always; with a
|
|
7147
|
+
* converter, `audio/*` and `video/*`; without one, the types the engine
|
|
7148
|
+
* reads whole. */
|
|
7149
|
+
accepts?: string[];
|
|
7150
|
+
/** The upload limit (LOOMCYCLE_MAX_REQUEST_BYTES). */
|
|
7151
|
+
max_upload_bytes?: number;
|
|
7152
|
+
max_seconds_per_call?: number;
|
|
7153
|
+
/** How long one upload may last; longer is a 413 `audio_too_long`. */
|
|
7154
|
+
max_seconds_per_request?: number;
|
|
7155
|
+
/** Without a converter: the largest non-WAV file the engine takes whole. A
|
|
7156
|
+
* PCM WAV is cut instead, so it is not bound by this. */
|
|
7157
|
+
whole_file_max_bytes?: number;
|
|
7158
|
+
}
|
|
7159
|
+
/** GET /v1/_speech: what a client needs to draw its voice controls. Names no
|
|
7160
|
+
* engine URL, provider or model. */
|
|
7161
|
+
export interface SpeechInfo {
|
|
7162
|
+
speech: SpeechDirectionInfo;
|
|
7163
|
+
transcription: TranscriptionDirectionInfo;
|
|
7164
|
+
}
|
|
7033
7165
|
/** One name's version roll-up from a `list*DefNames` method. Shared by every
|
|
7034
7166
|
* def family except OperatorTokenDef ({@link OperatorTokenDefNameSummary}). */
|
|
7035
7167
|
export interface DefNameSummary {
|
|
@@ -7152,8 +7284,8 @@ export interface SchedulePauseResult {
|
|
|
7152
7284
|
export interface ModelAlias {
|
|
7153
7285
|
provider: string;
|
|
7154
7286
|
model: string;
|
|
7155
|
-
/** chat | decision | embedder. Absent for an
|
|
7156
|
-
* model. */
|
|
7287
|
+
/** chat | decision | embedder | transcriber | synthesizer. Absent for an
|
|
7288
|
+
* untagged alias, which is a chat model. */
|
|
7157
7289
|
kind?: string;
|
|
7158
7290
|
}
|
|
7159
7291
|
/** Response of {@link LoomcycleClient.listModels}: alias name → target. */
|
|
@@ -7706,6 +7838,8 @@ export interface AuthzRequestContext {
|
|
|
7706
7838
|
user_tier?: string;
|
|
7707
7839
|
agent?: string;
|
|
7708
7840
|
depth?: number;
|
|
7841
|
+
/** The client address a `source_cidr` condition reads, e.g. `203.0.113.7`. */
|
|
7842
|
+
source_ip?: string;
|
|
7709
7843
|
}
|
|
7710
7844
|
/** One question: may `subject` do `action` to `resource`? An omitted
|
|
7711
7845
|
* `subject` (or one naming the caller) asks about the caller; naming another
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcycle/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.141.0",
|
|
4
4
|
"description": "TypeScript client for the loomcycle sidecar (HTTP+SSE). 71 methods covering run streaming, agent metadata, pause/resume/state, resolver re-probe (resolveProbe — issue #88 operator escape hatch), operator-token admin (operatorTokenDef — RFC L OSS multi-tenant auth) + whoami (RFC L authoritative principal, v0.17.0) + tenant-scoped listUsers / listUserAgents, dynamic MCP registration (mcpServerDef + v0.18.0 typed mcpServerDefVerify + ensureMcpServer idempotent register-if-changed), snapshot lifecycle, memory admin (incl. v0.9.0 Vector Memory embed_stats + reembed AND v0.11.5 setMemoryEntry + deleteMemoryEntry), interruption resolve, hook management, v0.8.22 substrate admin (agentDef + skillDef), v0.9.x n8n Phase 0 (listChannels + streamUserRunStates), v0.9.x Channel CRUD (publishChannel + subscribeChannel + peekChannel + ackChannel), v0.11.5 Channel admin CRUD (createChannel + updateChannel + deleteChannel — runtime substrate; yaml channels refuse mutation with HTTP 409), v0.9.x content_sha256 verify, v0.9.1 transcript first-cycle, v0.9.x dynamic MCP server registration (mcpServerDef + MCPServerDefVerifyResult), v0.10.3 Library v2 enumeration (listLibraryAgents + listLibrarySkills + listLibraryMcpServers), and v0.11.0 LLM Gateway (llmChat + llmStream — direct provider routing without agent overhead; primary target is n8n's LoomCycleChatModel AI Agent sub-node and any LangChain-compatible consumer). v0.10.1 — dual ESM + CommonJS distribution (additive — ESM consumers unchanged; CJS consumers like n8n's community-node loader now work). v0.19.0 — typed inline code-js agent ingestion (AgentDefOverlay.code_body + ensureCodeAgent — register a deterministic code agent through the substrate with no host filesystem bind; RFC J). v0.20.0 — ensureMcpServer surfaces discoveredToolCount straight from create (loomcycle now auto-discovers MCP tools at ingestion); rediscover is now an explicit force-refresh. v0.21.0 — run/continue accept optional non-secret `metadata` (repo name, review policy, …) passed to the agent, symmetric with the WebHook/Schedule trigger paths. v0.22.0 — version-aligned lockstep release; no client-surface change (RFC N tenant isolation of the agent/skill/MCP/Schedule/Webhook definition plane + real op-schemas on the builtin MCP meta-tools are both server-side). v0.23.0 — version-aligned lockstep release; no client-surface change (RFCs O/P/R MCP-server hardening + thin client and the RFC Q DeepSeek tool-content fix are all server-side / MCP-transport-side). v0.24.0 — purgeChannel clears a channel's buffered messages without deleting its definition (allowed on yaml-declared channels too, unlike deleteChannel — F20); AgentDefOverlay gains channels / evaluation_scopes / interruption so a COMPLETE interactive/multi-agent agent round-trips over the substrate (F14). (Consolidates the interim 0.24/0.25 package bumps, which were never tag-published, back into lockstep with the loomcycle v0.24.0 tag.) v0.25.0 — adds the RFC S channel fan-in/fan-out client twins: awaitChannels() (wait for any/all/at_least N messages across channels, or a timeout — non-committing) + broadcastChannels() (publish one payload to N channels in one atomic-pre-flight call), the client-facing counterparts of the in-band Channel.await / Channel.broadcast tool ops (the rest of v0.25.0 — the manual-management Web UI console + Context op=time + max_fires self-retiring schedules — is server-side / in-band, no client-surface change). v0.29.1 — Usage gains optional `max_context_tokens` (the serving model's context-window ceiling, stamped by the loop from Provider.Capabilities() on each usage event) so a consumer can render a 'context used / max' gauge without a hard-coded per-model table; additive + optional, no behavior change. (Lockstep catch-up: the field landed in loomcycle v0.29.0 but the adapter publish skipped on a version mismatch; v0.29.1 realigns the package version with the release tag so it publishes.) v0.33.0 — gRPC + TS client parity for the RFC Y external fan-out and the compaction surface: spawnRunBatch() (POST /v1/runs:batch — spawn up to 32 fresh runs concurrently in one call, combined index-aligned envelope, per-child failures in-envelope) + compactRun(runId) (POST /v1/runs/{run_id}/compact — summarize a parked run's context); plus per-run sampling + compaction overrides now accepted on runStreaming / continueSession (an explicit temperature 0 is preserved as deterministic, not dropped as falsy). (The gRPC half adds the matching SpawnRunBatch / CompactRun RPCs + the sampling/compaction fields on RunRequest/ContinueRequest — server-side.) v0.34.0 — version-aligned lockstep release; no client-surface change (context-transform plugins / RFC Z Phase 1a are server-side config; the exp7 hardening pass is server-side; the R2 cross-provider thinking-model downgrade surfaces a new `model_downgraded` SSE event the generic stream passes through unchanged). v0.35.0 — RFC AH dynamic filesystem volumes: volumeDef() (POST /v1/_volumedef — op-discriminated create/get/list/delete/purge; a Volume is flat, so delete unmaps + purge RemoveAll's, no retire/promote/fork) + listVolumes() / listEphemeralVolumes() (GET /v1/_volumes[/ephemeral] — tenant-scoped; host paths redacted for non-operator callers). Tenant-confined; the runtime derives the path inside an operator-blessed dynamic_root, so callers pass name + mode, never a host path. v1.1.1 — RFC AI interactive agentic sessions: an `interactive: true` flag on runStreaming/continueSession (a run that parks at end_turn for steering) + sendRunInput(runId, text) (POST /v1/runs/{id}/input — steer a live run) + streamRunByID(runId, {fromSeq}) (GET /v1/runs/{id}/stream — re-attach by run_id; the operator's prior turns replay as `steer` events so a cold client reconstructs the whole conversation) + a high-level InteractiveSession driver (client.interactiveSession / attachInteractiveSession — events()/send()/cancel(), the adapter port of the Web UI run terminal). The AgentEvent union gains awaiting_input/steer/context_compaction frames. Version-aligned with the loomcycle v1.1.x line so the v1.1.1 tag publishes it (also carrying the previously-unpublished v0.35.0 volume surface). v1.4.0 — RFC AL Path VFS + RFC AK Document on the wire: path(input) (POST /v1/_path — a Unix-like filesystem over Memory/Volumes/Documents; resolve/ls/stat/mkdir/mv/rm) + document(input) (POST /v1/_document — chunked-graph documents; 13 ops, needs SQL Memory on the sidecar). Scope (agent/user/tenant) + tenant are resolved server-side from the authenticated principal, never the wire; an off-run scope:'user' op keys on the principal subject so it interoperates with that user's agent runs. New PathToolInput / DocumentToolInput types; responses are op-varying (unknown — narrow as needed). v1.7.0 — RFC AT image/vision input: the PromptContent union gains an `image` variant ({ type:'image'; media_type: ImageMediaType; data: base64-no-prefix }) accepted in a user segment by runStreaming / continueSession (segments pass through unchanged — no method change). The model must be vision-capable or the run errors before the call. New ImageMediaType type (image/png|jpeg|gif|webp). v1.12.1 — Path/Document browse-by-subject + the full Document op set (RFC AS/AK): path(input, opts) / document(input, opts) accept optional scopeId / tenant browse overrides sent as ?scope_id= / ?tenant= query params (server reads them from the URL, re-checks authorization; omit both to browse your own subject — byte-identical to the pre-RFC-AS request), and DocumentToolInput.op now covers all 16 backend ops (adds set_path, export_md, import_md) with the matching include_metadata / markdown fields. Additive — existing path() / document() callers are unchanged. v1.16.0 — RFC BC client-executed tools (local tool host): connectClientTools({tools,onInvoke}) opens a persistent WebSocket to /v1/client-tools, registers tools this client runs on the user's machine (browser DOM / files / shell), and answers the invoke frames loomcycle routes when an agent of your principal calls a client:<tool> — returning your reply as an ordinary tool result. Returns a ClientToolHost driver (.close() to stop; auto-reconnect); dependency-free (global WebSocket in browsers / Node 22+, or an injected WebSocketImpl like the ws package on older Node); the bearer rides the Sec-WebSocket-Protocol subprotocol (browsers can't set an Authorization header on a WebSocket). The runtime's first WebSocket surface. v1.45.0 — RFC BL P5 subject erasure: erasureReport(subject, {tenant}) (GET /v1/_erasure — what this deployment holds about one subject, in three tiers: deletable with existing primitives, subject-keyed but not deletable, and facts ABOUT the subject in scopes they do not own) + erasureExecute(subject, {dryRun, confirm, tenant}) (POST /v1/_erasure — removes tiers 1 and 2). DEFAULTS TO A DRY RUN: dryRun defaults true and a live run also requires confirm === subject. The tier-3 residue is traceable only through the subject's chats, which a live run deletes, so a report afterwards shows rows: 0 while those facts remain — the returned object is the only durable record of what was not reached; persist it. New ErasureReport / ErasureResult / ErasureTier / ErasureResidue types. v1.47.0 — RFC BV memory-view SDK: memorySearch() (POST /v1/_memory/search — off-run unified semantic search spanning k/v entries AND document-chunk bodies in one ranked list, each hit tagged kind memory|document with chunk_id on document hits) + memoryEmbedStats(scope) + reembedMemory(scope, scopeId, {dryRun,limit}) (the Vector Memory embed-admin reads the memory-view console needs; dry_run defaults true). Fact reads (list_facts + get_chunk's entity block) ride the existing document() passthrough. Additive — existing callers unchanged. v1.61.0 — RFC CJ per-run context-window override: runStreaming / continueSession accept an optional maxContextTokens (integer tokens) that wins over the agent's own max_context_tokens; omitted inherits it (which defers to the provider/driver default). Distinct from a model's output cap; primarily for local inference (Ollama num_ctx). Serialized as the snake_case max_context_tokens field on POST /v1/runs + the continuation body; additive, existing callers unchanged. v1.72.1 — the TeamDef version lifecycle: listTeamVersions(name) (op=list — every version of one team, newest first), promoteTeam(defId) (op=promote — point the active pointer, which is what a run BY NAME executes; forkTeam defaults to promote:false, so authoring and putting in force stay two steps), retireTeam(defId, retired) (op=retire — reversible and version-scoped, unlike deleteTeam) and verifyTeam(name, contentSha256) (op=verify — the drift check for a workflow kept in source control and pushed to several deployments; an absent team answers deployed:false rather than raising). The ops existed on the substrate and over HTTP; a client that could author a team could not put one in force.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|