@opengeni/sdk 0.15.0 → 0.20.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 +33 -6
- package/dist/index.d.ts +442 -29
- package/dist/index.js +379 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +222 -23
- package/src/index.ts +51 -0
- package/src/transcription.ts +496 -0
- package/src/types.ts +330 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Framework-agnostic TypeScript SDK for the OpenGeni API: typed client, session lifecycle, SSE event streaming with reconnect + replay-by-sequence, and proxy re-streaming helpers.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
package/src/client.ts
CHANGED
|
@@ -46,6 +46,7 @@ import type {
|
|
|
46
46
|
CreateKnowledgeMemoryRequest,
|
|
47
47
|
CreateScheduledTaskRequest,
|
|
48
48
|
CreateSessionRequest,
|
|
49
|
+
CreateSessionResponse,
|
|
49
50
|
CreateVariableSetRequest,
|
|
50
51
|
CreateRigRequest,
|
|
51
52
|
CreateWorkspaceRequest,
|
|
@@ -89,7 +90,10 @@ import type {
|
|
|
89
90
|
SessionListResponse,
|
|
90
91
|
UpdateSessionPinRequest,
|
|
91
92
|
SessionEvent,
|
|
93
|
+
SessionEventListOptions,
|
|
94
|
+
SessionEventPage,
|
|
92
95
|
SessionGoal,
|
|
96
|
+
SessionHumanInputRequest,
|
|
93
97
|
SessionLineageResponse,
|
|
94
98
|
SessionMcpCredentialUpdateInput,
|
|
95
99
|
SessionQueueSnapshot,
|
|
@@ -104,6 +108,7 @@ import type {
|
|
|
104
108
|
WorkspaceInferenceControlResponse,
|
|
105
109
|
WorkspaceControlEvent,
|
|
106
110
|
SessionTurn,
|
|
111
|
+
SubmitHumanInputResponseRequest,
|
|
107
112
|
// Stream surfacing (Phase 5): capability negotiation + viewer lifecycle + config.
|
|
108
113
|
SessionCapabilities,
|
|
109
114
|
AttachViewerRequest,
|
|
@@ -133,7 +138,7 @@ import type {
|
|
|
133
138
|
GitLogResponse,
|
|
134
139
|
GitShowRequest,
|
|
135
140
|
GitShowResponse,
|
|
136
|
-
// Workbench v2 turn-end capture reads (M2
|
|
141
|
+
// Workbench v2 turn-end capture reads (M2).
|
|
137
142
|
GetWorkspaceCaptureResponse,
|
|
138
143
|
GetWorkspaceCaptureFileResponse,
|
|
139
144
|
TerminalExecRequest,
|
|
@@ -176,6 +181,13 @@ import { OPENGENI_API_CONTRACT_HEADER, OPENGENI_API_CONTRACT_REVISION } from "./
|
|
|
176
181
|
|
|
177
182
|
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
178
183
|
|
|
184
|
+
export type WorkspaceControlEventPage = {
|
|
185
|
+
events: WorkspaceControlEvent[];
|
|
186
|
+
bytes: number;
|
|
187
|
+
truncated: boolean;
|
|
188
|
+
nextAfter: number | null;
|
|
189
|
+
};
|
|
190
|
+
|
|
179
191
|
export type OpenGeniClientOptions = {
|
|
180
192
|
/** Base URL of the OpenGeni API, e.g. `https://api.example.com`. */
|
|
181
193
|
baseUrl: string;
|
|
@@ -187,8 +199,15 @@ export type OpenGeniClientOptions = {
|
|
|
187
199
|
fetch?: FetchLike;
|
|
188
200
|
};
|
|
189
201
|
|
|
202
|
+
/** Per-request cancellation for identity-scoped, side-effect-free reads. */
|
|
203
|
+
export type OpenGeniRequestOptions = {
|
|
204
|
+
signal?: AbortSignal | undefined;
|
|
205
|
+
};
|
|
206
|
+
|
|
190
207
|
export type SendMessageInput = {
|
|
191
208
|
text: string;
|
|
209
|
+
/** System instructions scoped to this exact turn; never visible timeline text. */
|
|
210
|
+
turnInstructions?: string;
|
|
192
211
|
resources?: ResourceRef[];
|
|
193
212
|
tools?: ToolRef[];
|
|
194
213
|
model?: string;
|
|
@@ -225,8 +244,11 @@ export class OpenGeniClient {
|
|
|
225
244
|
|
|
226
245
|
// --- Session lifecycle ---------------------------------------------------
|
|
227
246
|
|
|
228
|
-
async createSession(
|
|
229
|
-
|
|
247
|
+
async createSession(
|
|
248
|
+
workspaceId: string,
|
|
249
|
+
request: CreateSessionRequest,
|
|
250
|
+
): Promise<CreateSessionResponse> {
|
|
251
|
+
return await this.requestJson<CreateSessionResponse>(
|
|
230
252
|
"POST",
|
|
231
253
|
`/v1/workspaces/${workspaceId}/sessions`,
|
|
232
254
|
request,
|
|
@@ -353,7 +375,7 @@ export class OpenGeniClient {
|
|
|
353
375
|
*/
|
|
354
376
|
async listMachines(
|
|
355
377
|
workspaceId: string,
|
|
356
|
-
options: { sessionId?: string } = {},
|
|
378
|
+
options: { sessionId?: string; signal?: AbortSignal } = {},
|
|
357
379
|
): Promise<MachinesResponse> {
|
|
358
380
|
return await this.requestJson<MachinesResponse>(
|
|
359
381
|
"GET",
|
|
@@ -362,6 +384,7 @@ export class OpenGeniClient {
|
|
|
362
384
|
{
|
|
363
385
|
...(options.sessionId !== undefined ? { sessionId: options.sessionId } : {}),
|
|
364
386
|
},
|
|
387
|
+
{ signal: options.signal },
|
|
365
388
|
);
|
|
366
389
|
}
|
|
367
390
|
|
|
@@ -493,27 +516,101 @@ export class OpenGeniClient {
|
|
|
493
516
|
// --- Events: replay, send, stream ----------------------------------------
|
|
494
517
|
|
|
495
518
|
/**
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
519
|
+
* Return the events from one bounded page. With no cursor, this uses the safe
|
|
520
|
+
* semantic monitoring tail; pass explicit forensic options and a cursor for
|
|
521
|
+
* retained audit replay. Use `listEventPage` when projection, coverage, or
|
|
522
|
+
* resume-cursor facts are required.
|
|
500
523
|
*/
|
|
501
524
|
async listEvents(
|
|
502
525
|
workspaceId: string,
|
|
503
526
|
sessionId: string,
|
|
504
|
-
options:
|
|
527
|
+
options: SessionEventListOptions = {},
|
|
505
528
|
): Promise<SessionEvent[]> {
|
|
506
|
-
return await this.
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
529
|
+
return (await this.listEventPage(workspaceId, sessionId, options)).events;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** Bounded durable/monitoring page plus exact projection and cursor facts. */
|
|
533
|
+
async listEventPage(
|
|
534
|
+
workspaceId: string,
|
|
535
|
+
sessionId: string,
|
|
536
|
+
options: SessionEventListOptions = {},
|
|
537
|
+
): Promise<SessionEventPage> {
|
|
538
|
+
if (
|
|
539
|
+
options.latest &&
|
|
540
|
+
["includeTypes", "excludeTypes", "includeClasses", "excludeClasses"].some((name) =>
|
|
541
|
+
Object.prototype.hasOwnProperty.call(options, name),
|
|
542
|
+
)
|
|
543
|
+
) {
|
|
544
|
+
throw new TypeError("latest cannot be combined with event filters");
|
|
545
|
+
}
|
|
546
|
+
const response = await this.fetchImpl(
|
|
547
|
+
this.url(`/v1/workspaces/${workspaceId}/sessions/${sessionId}/events`, {
|
|
511
548
|
...(options.after !== undefined ? { after: String(options.after) } : {}),
|
|
512
549
|
...(options.before !== undefined ? { before: String(options.before) } : {}),
|
|
513
550
|
...(options.limit !== undefined ? { limit: String(options.limit) } : {}),
|
|
514
551
|
...(options.compact ? { compact: "1" } : {}),
|
|
552
|
+
...(options.mode ? { mode: options.mode } : {}),
|
|
553
|
+
...(options.direction ? { direction: options.direction } : {}),
|
|
554
|
+
...(options.payloadMode ? { payloadMode: options.payloadMode } : {}),
|
|
555
|
+
...(options.includeTypes?.length ? { includeTypes: options.includeTypes.join(",") } : {}),
|
|
556
|
+
...(options.excludeTypes?.length ? { excludeTypes: options.excludeTypes.join(",") } : {}),
|
|
557
|
+
...(options.includeClasses?.length
|
|
558
|
+
? { includeClasses: options.includeClasses.join(",") }
|
|
559
|
+
: {}),
|
|
560
|
+
...(options.excludeClasses?.length
|
|
561
|
+
? { excludeClasses: options.excludeClasses.join(",") }
|
|
562
|
+
: {}),
|
|
563
|
+
...(options.latest ? { latest: options.latest } : {}),
|
|
564
|
+
}),
|
|
565
|
+
{
|
|
566
|
+
method: "GET",
|
|
567
|
+
headers: { ...this.headers(), Accept: "application/json" },
|
|
515
568
|
},
|
|
516
569
|
);
|
|
570
|
+
assertApiContractResponse(response);
|
|
571
|
+
if (!response.ok) throw new OpenGeniApiError(response.status, await safeText(response));
|
|
572
|
+
const events = (await response.json()) as SessionEvent[];
|
|
573
|
+
const integerHeader = (name: string): number | null => {
|
|
574
|
+
const raw = response.headers.get(name);
|
|
575
|
+
if (raw === null) return null;
|
|
576
|
+
const value = Number(raw);
|
|
577
|
+
return Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
578
|
+
};
|
|
579
|
+
const mode =
|
|
580
|
+
response.headers.get("X-OpenGeni-Event-Mode") === "forensic" ? "forensic" : "monitoring";
|
|
581
|
+
const direction =
|
|
582
|
+
response.headers.get("X-OpenGeni-Event-Direction") === "after" ? "after" : "before";
|
|
583
|
+
const payloadHeader = response.headers.get("X-OpenGeni-Payload-Mode");
|
|
584
|
+
const payloadMode =
|
|
585
|
+
payloadHeader === "none" || payloadHeader === "full" ? payloadHeader : "summary";
|
|
586
|
+
const first = integerHeader("X-OpenGeni-Covered-First");
|
|
587
|
+
const last = integerHeader("X-OpenGeni-Covered-Last");
|
|
588
|
+
const bytes =
|
|
589
|
+
integerHeader("X-OpenGeni-Page-Bytes") ??
|
|
590
|
+
new TextEncoder().encode(JSON.stringify(events)).byteLength;
|
|
591
|
+
const maxBytes = integerHeader("X-OpenGeni-Page-Max-Bytes") ?? 1024 * 1024;
|
|
592
|
+
const truncatedByHeader = response.headers.get("X-OpenGeni-Truncated-By");
|
|
593
|
+
const truncatedBy =
|
|
594
|
+
truncatedByHeader === "count" ||
|
|
595
|
+
truncatedByHeader === "bytes" ||
|
|
596
|
+
truncatedByHeader === "http_bytes"
|
|
597
|
+
? truncatedByHeader
|
|
598
|
+
: null;
|
|
599
|
+
return {
|
|
600
|
+
events,
|
|
601
|
+
mode,
|
|
602
|
+
payloadMode,
|
|
603
|
+
direction,
|
|
604
|
+
bytes,
|
|
605
|
+
maxBytes,
|
|
606
|
+
truncated: response.headers.get("X-OpenGeni-Page-Truncated") === "true",
|
|
607
|
+
hasMore: response.headers.get("X-OpenGeni-Has-More") === "true",
|
|
608
|
+
truncatedBy,
|
|
609
|
+
coveredSequence: first === null || last === null ? null : { first, last },
|
|
610
|
+
nextAfter: integerHeader("X-OpenGeni-Next-After"),
|
|
611
|
+
nextBefore: integerHeader("X-OpenGeni-Next-Before"),
|
|
612
|
+
forensicExact: response.headers.get("X-OpenGeni-Forensic-Exact") === "true",
|
|
613
|
+
};
|
|
517
614
|
}
|
|
518
615
|
|
|
519
616
|
/** POST a user/control event to the session. Returns the accepted event. */
|
|
@@ -574,6 +671,47 @@ export class OpenGeniClient {
|
|
|
574
671
|
});
|
|
575
672
|
}
|
|
576
673
|
|
|
674
|
+
async listHumanInputRequests(
|
|
675
|
+
workspaceId: string,
|
|
676
|
+
sessionId: string,
|
|
677
|
+
options: {
|
|
678
|
+
status?: SessionHumanInputRequest["status"];
|
|
679
|
+
} = {},
|
|
680
|
+
): Promise<SessionHumanInputRequest[]> {
|
|
681
|
+
const result = await this.requestJson<{ requests: SessionHumanInputRequest[] }>(
|
|
682
|
+
"GET",
|
|
683
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/human-input-requests`,
|
|
684
|
+
undefined,
|
|
685
|
+
options.status ? { status: options.status } : undefined,
|
|
686
|
+
);
|
|
687
|
+
return result.requests;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
async getHumanInputRequest(
|
|
691
|
+
workspaceId: string,
|
|
692
|
+
sessionId: string,
|
|
693
|
+
requestId: string,
|
|
694
|
+
): Promise<SessionHumanInputRequest> {
|
|
695
|
+
return await this.requestJson<SessionHumanInputRequest>(
|
|
696
|
+
"GET",
|
|
697
|
+
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/human-input-requests/${requestId}`,
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
async submitHumanInputResponse(
|
|
702
|
+
workspaceId: string,
|
|
703
|
+
sessionId: string,
|
|
704
|
+
requestId: string,
|
|
705
|
+
response: SubmitHumanInputResponseRequest,
|
|
706
|
+
options: { clientEventId?: string } = {},
|
|
707
|
+
): Promise<SessionEvent> {
|
|
708
|
+
return await this.sendEvent(workspaceId, sessionId, {
|
|
709
|
+
type: "user.humanInputResponse",
|
|
710
|
+
...(options.clientEventId ? { clientEventId: options.clientEventId } : {}),
|
|
711
|
+
payload: { requestId, response },
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
577
715
|
/**
|
|
578
716
|
* Live-stream a session's events with automatic reconnect, resume from the
|
|
579
717
|
* last seen sequence, gap backfill, and duplicate suppression. See
|
|
@@ -754,15 +892,45 @@ export class OpenGeniClient {
|
|
|
754
892
|
workspaceId: string,
|
|
755
893
|
options: { after?: number; limit?: number } = {},
|
|
756
894
|
): Promise<WorkspaceControlEvent[]> {
|
|
757
|
-
return await this.
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
895
|
+
return (await this.listWorkspaceControlEventPage(workspaceId, options)).events;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/** Count/byte-bounded page plus an explicit continuation cursor. */
|
|
899
|
+
async listWorkspaceControlEventPage(
|
|
900
|
+
workspaceId: string,
|
|
901
|
+
options: { after?: number; limit?: number } = {},
|
|
902
|
+
): Promise<WorkspaceControlEventPage> {
|
|
903
|
+
const response = await this.fetchImpl(
|
|
904
|
+
this.url(`/v1/workspaces/${workspaceId}/control-events`, {
|
|
762
905
|
...(options.after !== undefined ? { after: String(options.after) } : {}),
|
|
763
906
|
...(options.limit !== undefined ? { limit: String(options.limit) } : {}),
|
|
907
|
+
}),
|
|
908
|
+
{
|
|
909
|
+
method: "GET",
|
|
910
|
+
headers: { ...this.headers(), Accept: "application/json" },
|
|
764
911
|
},
|
|
765
912
|
);
|
|
913
|
+
assertApiContractResponse(response);
|
|
914
|
+
if (!response.ok) {
|
|
915
|
+
throw new OpenGeniApiError(response.status, await safeText(response));
|
|
916
|
+
}
|
|
917
|
+
const events = (await response.json()) as WorkspaceControlEvent[];
|
|
918
|
+
const bytesHeader = response.headers.get("X-OpenGeni-Page-Bytes");
|
|
919
|
+
const nextHeader = response.headers.get("X-OpenGeni-Next-After");
|
|
920
|
+
const parsedBytes = bytesHeader === null ? Number.NaN : Number(bytesHeader);
|
|
921
|
+
const parsedNext = nextHeader === null ? null : Number(nextHeader);
|
|
922
|
+
return {
|
|
923
|
+
events,
|
|
924
|
+
bytes:
|
|
925
|
+
Number.isSafeInteger(parsedBytes) && parsedBytes >= 0
|
|
926
|
+
? parsedBytes
|
|
927
|
+
: new TextEncoder().encode(JSON.stringify(events)).byteLength,
|
|
928
|
+
truncated: response.headers.get("X-OpenGeni-Page-Truncated") === "true",
|
|
929
|
+
nextAfter:
|
|
930
|
+
parsedNext !== null && Number.isSafeInteger(parsedNext) && parsedNext >= 0
|
|
931
|
+
? parsedNext
|
|
932
|
+
: null,
|
|
933
|
+
};
|
|
766
934
|
}
|
|
767
935
|
|
|
768
936
|
streamWorkspaceControlEvents(
|
|
@@ -903,11 +1071,14 @@ export class OpenGeniClient {
|
|
|
903
1071
|
workspaceId: string,
|
|
904
1072
|
sessionId: string,
|
|
905
1073
|
request: FsListRequest = {},
|
|
1074
|
+
options: OpenGeniRequestOptions = {},
|
|
906
1075
|
): Promise<FsListResponse> {
|
|
907
1076
|
return await this.requestJson<FsListResponse>(
|
|
908
1077
|
"POST",
|
|
909
1078
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/list`,
|
|
910
1079
|
request,
|
|
1080
|
+
{},
|
|
1081
|
+
options,
|
|
911
1082
|
);
|
|
912
1083
|
}
|
|
913
1084
|
|
|
@@ -916,11 +1087,14 @@ export class OpenGeniClient {
|
|
|
916
1087
|
workspaceId: string,
|
|
917
1088
|
sessionId: string,
|
|
918
1089
|
request: FsReadRequest,
|
|
1090
|
+
options: OpenGeniRequestOptions = {},
|
|
919
1091
|
): Promise<FsReadResponse> {
|
|
920
1092
|
return await this.requestJson<FsReadResponse>(
|
|
921
1093
|
"POST",
|
|
922
1094
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/fs/read`,
|
|
923
1095
|
request,
|
|
1096
|
+
{},
|
|
1097
|
+
options,
|
|
924
1098
|
);
|
|
925
1099
|
}
|
|
926
1100
|
|
|
@@ -981,11 +1155,14 @@ export class OpenGeniClient {
|
|
|
981
1155
|
workspaceId: string,
|
|
982
1156
|
sessionId: string,
|
|
983
1157
|
request: GitStatusRequest = {},
|
|
1158
|
+
options: OpenGeniRequestOptions = {},
|
|
984
1159
|
): Promise<GitStatusResponse> {
|
|
985
1160
|
return await this.requestJson<GitStatusResponse>(
|
|
986
1161
|
"POST",
|
|
987
1162
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/status`,
|
|
988
1163
|
request,
|
|
1164
|
+
{},
|
|
1165
|
+
options,
|
|
989
1166
|
);
|
|
990
1167
|
}
|
|
991
1168
|
|
|
@@ -994,11 +1171,14 @@ export class OpenGeniClient {
|
|
|
994
1171
|
workspaceId: string,
|
|
995
1172
|
sessionId: string,
|
|
996
1173
|
request: GitDiffRequest = {},
|
|
1174
|
+
options: OpenGeniRequestOptions = {},
|
|
997
1175
|
): Promise<GitDiffResponse> {
|
|
998
1176
|
return await this.requestJson<GitDiffResponse>(
|
|
999
1177
|
"POST",
|
|
1000
1178
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/git/diff`,
|
|
1001
1179
|
request,
|
|
1180
|
+
{},
|
|
1181
|
+
options,
|
|
1002
1182
|
);
|
|
1003
1183
|
}
|
|
1004
1184
|
|
|
@@ -1035,10 +1215,14 @@ export class OpenGeniClient {
|
|
|
1035
1215
|
async getWorkspaceCapture(
|
|
1036
1216
|
workspaceId: string,
|
|
1037
1217
|
sessionId: string,
|
|
1218
|
+
options: OpenGeniRequestOptions = {},
|
|
1038
1219
|
): Promise<GetWorkspaceCaptureResponse> {
|
|
1039
1220
|
return await this.requestJson<GetWorkspaceCaptureResponse>(
|
|
1040
1221
|
"GET",
|
|
1041
1222
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/workspace/capture`,
|
|
1223
|
+
undefined,
|
|
1224
|
+
{},
|
|
1225
|
+
options,
|
|
1042
1226
|
);
|
|
1043
1227
|
}
|
|
1044
1228
|
|
|
@@ -1050,6 +1234,7 @@ export class OpenGeniClient {
|
|
|
1050
1234
|
sessionId: string,
|
|
1051
1235
|
path: string,
|
|
1052
1236
|
revision?: number,
|
|
1237
|
+
options: OpenGeniRequestOptions = {},
|
|
1053
1238
|
): Promise<GetWorkspaceCaptureFileResponse> {
|
|
1054
1239
|
const query: Record<string, string> = { path };
|
|
1055
1240
|
if (revision !== undefined) query.revision = String(revision);
|
|
@@ -1058,6 +1243,7 @@ export class OpenGeniClient {
|
|
|
1058
1243
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/workspace/capture/file`,
|
|
1059
1244
|
undefined,
|
|
1060
1245
|
query,
|
|
1246
|
+
options,
|
|
1061
1247
|
);
|
|
1062
1248
|
}
|
|
1063
1249
|
|
|
@@ -1142,10 +1328,14 @@ export class OpenGeniClient {
|
|
|
1142
1328
|
async getStreamCapabilities(
|
|
1143
1329
|
workspaceId: string,
|
|
1144
1330
|
sessionId: string,
|
|
1331
|
+
options: OpenGeniRequestOptions = {},
|
|
1145
1332
|
): Promise<SessionCapabilities> {
|
|
1146
1333
|
return await this.requestJson<SessionCapabilities>(
|
|
1147
1334
|
"GET",
|
|
1148
1335
|
`/v1/workspaces/${workspaceId}/sessions/${sessionId}/stream-capabilities`,
|
|
1336
|
+
undefined,
|
|
1337
|
+
{},
|
|
1338
|
+
options,
|
|
1149
1339
|
);
|
|
1150
1340
|
}
|
|
1151
1341
|
|
|
@@ -2048,15 +2238,14 @@ export class OpenGeniClient {
|
|
|
2048
2238
|
|
|
2049
2239
|
// --- GitHub ----------------------------------------------------------------------------------
|
|
2050
2240
|
|
|
2051
|
-
/** GitHub App configuration status
|
|
2241
|
+
/** GitHub App configuration status; install/link URLs are null while new binding is disabled. */
|
|
2052
2242
|
async getGitHubApp(workspaceId: string): Promise<GitHubAppInfo> {
|
|
2053
2243
|
return await this.requestJson<GitHubAppInfo>("GET", `/v1/workspaces/${workspaceId}/github/app`);
|
|
2054
2244
|
}
|
|
2055
2245
|
|
|
2056
2246
|
/**
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
* `getGitHubApp().installUrl` or a github_connect_link tool.
|
|
2247
|
+
* Compatibility URL for previously issued state. New installation binding is
|
|
2248
|
+
* disabled, so the endpoint validates state and terminates with HTTP 410.
|
|
2060
2249
|
*/
|
|
2061
2250
|
githubConnectUrl(workspaceId: string, state: string): string {
|
|
2062
2251
|
return this.url(`/v1/workspaces/${workspaceId}/github/connect`, { state });
|
|
@@ -2077,6 +2266,14 @@ export class OpenGeniClient {
|
|
|
2077
2266
|
);
|
|
2078
2267
|
}
|
|
2079
2268
|
|
|
2269
|
+
/** Remove one workspace binding without uninstalling the GitHub App itself. */
|
|
2270
|
+
async unlinkGitHubInstallation(workspaceId: string, installationId: number): Promise<void> {
|
|
2271
|
+
await this.requestVoid(
|
|
2272
|
+
"DELETE",
|
|
2273
|
+
`/v1/workspaces/${workspaceId}/github/installations/${installationId}`,
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2080
2277
|
/** Build a GitHub App manifest + the GitHub URL to submit it to. */
|
|
2081
2278
|
async createGitHubAppManifest(
|
|
2082
2279
|
workspaceId: string,
|
|
@@ -2303,6 +2500,7 @@ export class OpenGeniClient {
|
|
|
2303
2500
|
path: string,
|
|
2304
2501
|
body?: unknown,
|
|
2305
2502
|
query: Record<string, string> = {},
|
|
2503
|
+
options: OpenGeniRequestOptions = {},
|
|
2306
2504
|
): Promise<T> {
|
|
2307
2505
|
const response = await this.fetchImpl(this.url(path, query), {
|
|
2308
2506
|
method,
|
|
@@ -2312,6 +2510,7 @@ export class OpenGeniClient {
|
|
|
2312
2510
|
...(body !== undefined ? { "Content-Type": "application/json" } : {}),
|
|
2313
2511
|
},
|
|
2314
2512
|
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
2513
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
2315
2514
|
});
|
|
2316
2515
|
assertApiContractResponse(response);
|
|
2317
2516
|
if (!response.ok) {
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,10 @@ export { OpenGeniClient } from "./client";
|
|
|
2
2
|
export type {
|
|
3
3
|
FetchLike,
|
|
4
4
|
OpenGeniClientOptions,
|
|
5
|
+
OpenGeniRequestOptions,
|
|
5
6
|
SendMessageInput,
|
|
6
7
|
SteerMessageResult,
|
|
8
|
+
WorkspaceControlEventPage,
|
|
7
9
|
} from "./client";
|
|
8
10
|
export {
|
|
9
11
|
OpenGeniApiContractMismatchError,
|
|
@@ -50,6 +52,34 @@ export type {
|
|
|
50
52
|
} from "./stream";
|
|
51
53
|
export { streamWorkspaceControlEvents } from "./workspace-control-stream";
|
|
52
54
|
export type { WorkspaceControlStreamTransport } from "./workspace-control-stream";
|
|
55
|
+
export {
|
|
56
|
+
DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
|
|
57
|
+
authorizeTranscriptionAdapter,
|
|
58
|
+
createTranscriptionSessionRequest,
|
|
59
|
+
resolveWorkspaceTranscriptionPolicy,
|
|
60
|
+
} from "./transcription";
|
|
61
|
+
export type {
|
|
62
|
+
TranscriptionAdapter,
|
|
63
|
+
TranscriptionAdapterDescriptor,
|
|
64
|
+
TranscriptionAdapterStartContext,
|
|
65
|
+
TranscriptionAuthorization,
|
|
66
|
+
TranscriptionCredentialMode,
|
|
67
|
+
TranscriptionDiagnostic,
|
|
68
|
+
TranscriptionErrorCode,
|
|
69
|
+
TranscriptionEvent,
|
|
70
|
+
TranscriptionEventListener,
|
|
71
|
+
TranscriptionLifecycleStatus,
|
|
72
|
+
TranscriptionPolicyBlockReason,
|
|
73
|
+
TranscriptionResultMetadata,
|
|
74
|
+
TranscriptionSession,
|
|
75
|
+
TranscriptionSessionRequest,
|
|
76
|
+
TranscriptionSpeaker,
|
|
77
|
+
TranscriptionTargetSelection,
|
|
78
|
+
TranscriptionTimeSpan,
|
|
79
|
+
TranscriptionWord,
|
|
80
|
+
WorkspaceTranscriptionPolicy,
|
|
81
|
+
WorkspaceTranscriptionTarget,
|
|
82
|
+
} from "./transcription";
|
|
53
83
|
export {
|
|
54
84
|
KNOWN_PERMISSIONS,
|
|
55
85
|
KNOWN_USAGE_EVENT_TYPES,
|
|
@@ -141,14 +171,21 @@ export type {
|
|
|
141
171
|
EntitlementValue,
|
|
142
172
|
EntitlementsMode,
|
|
143
173
|
FileAsset,
|
|
174
|
+
HumanInputAnswer,
|
|
175
|
+
HumanInputOption,
|
|
176
|
+
HumanInputQuestion,
|
|
177
|
+
HumanInputQuestionKind,
|
|
178
|
+
HumanInputResponse,
|
|
144
179
|
FileDownloadUrlResponse,
|
|
145
180
|
FileResourceRef,
|
|
146
181
|
FileStatus,
|
|
147
182
|
FileUploadData,
|
|
148
183
|
GetPackResponse,
|
|
149
184
|
GitHubAppInfo,
|
|
185
|
+
GitHubInstallationBinding,
|
|
150
186
|
GitHubRepositoriesResponse,
|
|
151
187
|
GitHubRepository,
|
|
188
|
+
GitHubRepositoryScope,
|
|
152
189
|
GoalSpec,
|
|
153
190
|
IntegrationClientMetadata,
|
|
154
191
|
KnownPermission,
|
|
@@ -161,6 +198,8 @@ export type {
|
|
|
161
198
|
KnowledgeSourceKind,
|
|
162
199
|
KnowledgeSourceRef,
|
|
163
200
|
GitCredentialProvider,
|
|
201
|
+
GitCredentialBindingId,
|
|
202
|
+
GitRepositoryAccess,
|
|
164
203
|
ListApiKeysResponse,
|
|
165
204
|
ListConnectionsResponse,
|
|
166
205
|
ListPacksResponse,
|
|
@@ -244,16 +283,27 @@ export type {
|
|
|
244
283
|
ViewerHeartbeatRequest,
|
|
245
284
|
ViewerHeartbeatResponse,
|
|
246
285
|
SessionEvent,
|
|
286
|
+
SessionEventListOptions,
|
|
287
|
+
SessionEventPage,
|
|
288
|
+
SessionEventPayloadMode,
|
|
289
|
+
SessionEventReadDirection,
|
|
290
|
+
SessionEventReadMode,
|
|
291
|
+
SessionEventSemanticClass,
|
|
247
292
|
SessionEventType,
|
|
248
293
|
SessionGoal,
|
|
249
294
|
SessionGoalCreatedBy,
|
|
250
295
|
SessionGoalStatus,
|
|
296
|
+
SessionHumanInputRequest,
|
|
251
297
|
SessionStatus,
|
|
252
298
|
SessionStatusChangedPayload,
|
|
253
299
|
SessionStructuredCapabilities,
|
|
254
300
|
SessionTurn,
|
|
301
|
+
ServiceTurnInitiator,
|
|
302
|
+
ServiceTurnInitiatorContext,
|
|
255
303
|
SessionTurnSource,
|
|
256
304
|
SessionTurnStatus,
|
|
305
|
+
SubmitHumanInputResponseRequest,
|
|
306
|
+
TurnInitiator,
|
|
257
307
|
ToolAuthNeededPayload,
|
|
258
308
|
UpdateConnectionRequest,
|
|
259
309
|
// Channel-A structured services (P4.4) — A1 payloads + A2 request/response.
|
|
@@ -327,6 +377,7 @@ export type {
|
|
|
327
377
|
UsageEvent,
|
|
328
378
|
UsageEventType,
|
|
329
379
|
UserApprovalDecisionEventInput,
|
|
380
|
+
UserHumanInputResponseEventInput,
|
|
330
381
|
UserMessageEventInput,
|
|
331
382
|
Workspace,
|
|
332
383
|
WorkspaceControlEvent,
|