@opengeni/sdk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/next.js +2 -2
- package/dist/artifacts.js +5 -4
- package/dist/browser.js +3 -2
- package/dist/chat/index.js +6 -5
- package/dist/chat/index.js.map +1 -1
- package/dist/{chunk-E3KHK7FG.js → chunk-2NIR4WBR.js} +2 -2
- package/dist/{chunk-T6HNHCN2.js → chunk-2ULNDOLD.js} +2 -2
- package/dist/{chunk-ZBMS2HCV.js → chunk-2VPO6IQC.js} +2 -2
- package/dist/{chunk-BNZNLUD4.js → chunk-5AN2FLNC.js} +35 -2
- package/dist/chunk-5AN2FLNC.js.map +1 -0
- package/dist/{chunk-YH3W3HZZ.js → chunk-66AKEWV6.js} +2 -2
- package/dist/{chunk-ZKPY6YAJ.js → chunk-6Z5QRYHG.js} +12 -1
- package/dist/chunk-6Z5QRYHG.js.map +1 -0
- package/dist/{chunk-H6WMYN23.js → chunk-TZFJUYCT.js} +2 -2
- package/dist/chunk-VPVMLM7Q.js +15 -0
- package/dist/chunk-VPVMLM7Q.js.map +1 -0
- package/dist/{chunk-RLLUZFOW.js → chunk-WIYAB33K.js} +1 -1
- package/dist/chunk-WIYAB33K.js.map +1 -0
- package/dist/client.d.ts +12 -0
- package/dist/core.js +4 -3
- package/dist/document-authority.js +4 -3
- package/dist/editable-artifacts.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/insights-usage.d.ts +33 -0
- package/dist/insights-usage.js +7 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/model-display.d.ts +1 -1
- package/dist/model-display.js +3 -1
- package/dist/session-proxy.js +2 -2
- package/dist/site-browser-runtime.gen.d.ts +1 -1
- package/dist/site-document.js +1 -1
- package/dist/site-document.js.map +1 -1
- package/dist/site.js +4 -3
- package/dist/types.d.ts +16 -0
- package/package.json +7 -3
- package/src/client.ts +69 -0
- package/src/index.ts +2 -0
- package/src/insights-usage.ts +61 -0
- package/src/model-display.ts +1 -0
- package/src/site-browser-runtime.gen.ts +1 -1
- package/src/types.ts +39 -0
- package/dist/chunk-BNZNLUD4.js.map +0 -1
- package/dist/chunk-RLLUZFOW.js.map +0 -1
- package/dist/chunk-ZKPY6YAJ.js.map +0 -1
- /package/dist/{chunk-E3KHK7FG.js.map → chunk-2NIR4WBR.js.map} +0 -0
- /package/dist/{chunk-T6HNHCN2.js.map → chunk-2ULNDOLD.js.map} +0 -0
- /package/dist/{chunk-ZBMS2HCV.js.map → chunk-2VPO6IQC.js.map} +0 -0
- /package/dist/{chunk-YH3W3HZZ.js.map → chunk-66AKEWV6.js.map} +0 -0
- /package/dist/{chunk-H6WMYN23.js.map → chunk-TZFJUYCT.js.map} +0 -0
package/dist/site.js
CHANGED
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
sanitizeOpenGeniSiteToolCallRequest,
|
|
19
19
|
serveSiteHttp,
|
|
20
20
|
siteSessionPath
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2ULNDOLD.js";
|
|
22
22
|
import "./chunk-4SMEOV3P.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-5AN2FLNC.js";
|
|
24
|
+
import "./chunk-VPVMLM7Q.js";
|
|
24
25
|
import "./chunk-APXVSSSY.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-WIYAB33K.js";
|
|
26
27
|
import "./chunk-NC57YMUO.js";
|
|
27
28
|
import "./chunk-V6GIY62B.js";
|
|
28
29
|
export {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WorkspaceTranscriptionPolicy } from "./transcription.js";
|
|
2
|
+
export type { InsightsUsageRange, InsightsUsageGroupBy, InsightsUsagePayer, InsightsUsageSource, InsightsUsageTokens, InsightsUsageClassMicros, InsightsUsageMeasures, InsightsUsageScope, InsightsUsageGroup, InsightsUsageSeriesPoint, InsightsUsageFacets, InsightsUsageResponse, InsightsCall, InsightsCallsResponse, InsightsUsageWindowOptions, WorkspaceInsightsUsageOptions, OrganizationInsightsUsageOptions, WorkspaceInsightsCallsOptions, OrganizationInsightsCallsOptions, InsightsCallsScope, } from "./insights-usage.js";
|
|
2
3
|
export type { ClaudeSubscriptionOAuthStartResponse, ClaudeSubscriptionOAuthCompleteRequest, ClaudeSubscriptionOAuthCompleteResponse, } from "@opengeni/contracts";
|
|
3
4
|
export type { SessionMessageSearchRequest, SessionMessageSearchMatch, SessionMessageSearchResponse, SessionMessagePreview, SessionMessagePreviewReference, } from "./session-message-search.js";
|
|
4
5
|
export type BundledSkillId = "builtin:opengeni-help" | "builtin:opengeni-client" | "builtin:opengeni-visualize" | "builtin:document-parsing" | "builtin:opengeni-skills" | "builtin:opengeni-projects" | "builtin:opengeni-schedules" | "builtin:opengeni-documents" | "builtin:opengeni-spreadsheets" | "builtin:opengeni-presentations" | "builtin:opengeni-sites" | "builtin:opengeni-video-generation";
|
|
@@ -2736,6 +2737,8 @@ export type ClientModel = {
|
|
|
2736
2737
|
label: string;
|
|
2737
2738
|
/** Optional curated compact label for dense UI (e.g. mobile composer). */
|
|
2738
2739
|
shortLabel?: string | undefined;
|
|
2740
|
+
/** Optional HTTPS maker logo supplied by the model catalog. */
|
|
2741
|
+
logoUrl?: string | undefined;
|
|
2739
2742
|
/** Provider id (e.g. `openai`, `azure`, or a registry provider id). */
|
|
2740
2743
|
provider: string;
|
|
2741
2744
|
providerLabel: string;
|
|
@@ -2775,6 +2778,7 @@ export type ModelCredentialReadinessV1 = {
|
|
|
2775
2778
|
};
|
|
2776
2779
|
export type WorkspaceModelCatalogModel = ClientModel & {
|
|
2777
2780
|
credentialReadiness: ModelCredentialReadinessV1;
|
|
2781
|
+
creditFunding?: "promotional" | "general" | "unavailable" | undefined;
|
|
2778
2782
|
/** Exact workspace-policy verdict without exposing provider identity. */
|
|
2779
2783
|
policyAllowed?: boolean | undefined;
|
|
2780
2784
|
availability: ModelAvailabilityV1;
|
|
@@ -6651,11 +6655,21 @@ export type CreateGitHubAppManifestResponse = {
|
|
|
6651
6655
|
};
|
|
6652
6656
|
export type BillingMode = "disabled" | "stripe";
|
|
6653
6657
|
export type EntitlementsMode = "none" | "static" | "managed";
|
|
6658
|
+
export type PromotionalCreditScope = {
|
|
6659
|
+
label: string;
|
|
6660
|
+
eligibleModelIds: string[];
|
|
6661
|
+
};
|
|
6662
|
+
export type PromotionalCreditBalance = PromotionalCreditScope & {
|
|
6663
|
+
grantId: string;
|
|
6664
|
+
remainingMicros: number;
|
|
6665
|
+
};
|
|
6654
6666
|
export type BillingBalance = {
|
|
6655
6667
|
accountId: string;
|
|
6656
6668
|
balanceMicros: number;
|
|
6657
6669
|
currency: "usd";
|
|
6658
6670
|
updatedAt: string;
|
|
6671
|
+
generalBalanceMicros?: number | undefined;
|
|
6672
|
+
promotionalCredits?: PromotionalCreditBalance[] | undefined;
|
|
6659
6673
|
};
|
|
6660
6674
|
export declare const KNOWN_USAGE_EVENT_TYPES: readonly ["agent_run.created", "agent_run.completed", "model.tokens", "model.cost", "file.uploaded", "file.deleted", "document.indexed", "scheduled_task.fired", "knowledge_source_sync.fired", "knowledge_source_sync.completed", "knowledge_source_sync.items", "knowledge_source_sync.bytes", "api_key.request", "sandbox.warm_seconds", "sandbox.warm_cost"];
|
|
6661
6675
|
export type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];
|
|
@@ -6948,6 +6962,7 @@ export type CreateCheckoutResponse = {
|
|
|
6948
6962
|
url: string;
|
|
6949
6963
|
/** The credits this checkout grants once it completes. */
|
|
6950
6964
|
amountUsd?: number | undefined;
|
|
6965
|
+
promotionalScope?: PromotionalCreditScope | undefined;
|
|
6951
6966
|
};
|
|
6952
6967
|
/** Where one checkout stands, and whether its credits reached the balance. */
|
|
6953
6968
|
export type BillingCheckoutStatus = {
|
|
@@ -6959,6 +6974,7 @@ export type BillingCheckoutStatus = {
|
|
|
6959
6974
|
currency: "usd";
|
|
6960
6975
|
/** True when a coupon covered the whole checkout, so nothing was charged. */
|
|
6961
6976
|
free: boolean;
|
|
6977
|
+
promotionalScope?: PromotionalCreditScope | undefined;
|
|
6962
6978
|
};
|
|
6963
6979
|
balance: BillingBalance | null;
|
|
6964
6980
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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": {
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"types": "./dist/usage-allowances.d.ts",
|
|
59
59
|
"import": "./dist/usage-allowances.js"
|
|
60
60
|
},
|
|
61
|
+
"./insights-usage": {
|
|
62
|
+
"types": "./dist/insights-usage.d.ts",
|
|
63
|
+
"import": "./dist/insights-usage.js"
|
|
64
|
+
},
|
|
61
65
|
"./workspace-integrations": {
|
|
62
66
|
"types": "./dist/workspace-integrations.d.ts",
|
|
63
67
|
"import": "./dist/workspace-integrations.js"
|
|
@@ -178,8 +182,8 @@
|
|
|
178
182
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
179
183
|
},
|
|
180
184
|
"dependencies": {
|
|
181
|
-
"@opengeni/connect": "1.
|
|
182
|
-
"@opengeni/contracts": "1.
|
|
185
|
+
"@opengeni/connect": "1.2.0",
|
|
186
|
+
"@opengeni/contracts": "1.2.0"
|
|
183
187
|
},
|
|
184
188
|
"engines": {
|
|
185
189
|
"node": ">=18"
|
package/src/client.ts
CHANGED
|
@@ -5,6 +5,16 @@ import type {
|
|
|
5
5
|
ClaudeSubscriptionSetupTokenRequest,
|
|
6
6
|
SubscriptionPoolSettings,
|
|
7
7
|
} from "@opengeni/contracts";
|
|
8
|
+
import {
|
|
9
|
+
insightsUsageQueryString,
|
|
10
|
+
type WorkspaceInsightsUsageOptions,
|
|
11
|
+
type OrganizationInsightsUsageOptions,
|
|
12
|
+
type WorkspaceInsightsCallsOptions,
|
|
13
|
+
type OrganizationInsightsCallsOptions,
|
|
14
|
+
type InsightsCallsScope,
|
|
15
|
+
type InsightsUsageResponse,
|
|
16
|
+
type InsightsCallsResponse,
|
|
17
|
+
} from "./insights-usage";
|
|
8
18
|
import type {
|
|
9
19
|
ArtifactCatalogKind,
|
|
10
20
|
ArtifactCatalogListOptions,
|
|
@@ -8889,6 +8899,65 @@ export class OpenGeniClient {
|
|
|
8889
8899
|
);
|
|
8890
8900
|
}
|
|
8891
8901
|
|
|
8902
|
+
/** Shared usage under the existing workspace access gate. */
|
|
8903
|
+
async getWorkspaceInsightsUsage(
|
|
8904
|
+
workspaceId: string,
|
|
8905
|
+
options: WorkspaceInsightsUsageOptions = {},
|
|
8906
|
+
requestOptions: OpenGeniRequestOptions = {},
|
|
8907
|
+
): Promise<InsightsUsageResponse> {
|
|
8908
|
+
return await this.requestJson(
|
|
8909
|
+
"GET",
|
|
8910
|
+
`/v1/workspaces/${encodeURIComponent(workspaceId)}/insights/usage${insightsUsageQueryString(options)}`,
|
|
8911
|
+
undefined,
|
|
8912
|
+
{},
|
|
8913
|
+
requestOptions,
|
|
8914
|
+
);
|
|
8915
|
+
}
|
|
8916
|
+
|
|
8917
|
+
/** Shared usage under the existing organization access gate. */
|
|
8918
|
+
async getOrganizationInsightsUsage(
|
|
8919
|
+
accountId: string,
|
|
8920
|
+
options: OrganizationInsightsUsageOptions = {},
|
|
8921
|
+
requestOptions: OpenGeniRequestOptions = {},
|
|
8922
|
+
): Promise<InsightsUsageResponse> {
|
|
8923
|
+
return await this.requestJson(
|
|
8924
|
+
"GET",
|
|
8925
|
+
`/v1/organizations/${encodeURIComponent(accountId)}/insights/usage${insightsUsageQueryString(options)}`,
|
|
8926
|
+
undefined,
|
|
8927
|
+
{},
|
|
8928
|
+
requestOptions,
|
|
8929
|
+
);
|
|
8930
|
+
}
|
|
8931
|
+
|
|
8932
|
+
/** Visible calls only; a filter never grants access to hidden call facts. */
|
|
8933
|
+
async listInsightsCalls(
|
|
8934
|
+
scope: Extract<InsightsCallsScope, { kind: "workspace" }>,
|
|
8935
|
+
options?: WorkspaceInsightsCallsOptions,
|
|
8936
|
+
requestOptions?: OpenGeniRequestOptions,
|
|
8937
|
+
): Promise<InsightsCallsResponse>;
|
|
8938
|
+
async listInsightsCalls(
|
|
8939
|
+
scope: Extract<InsightsCallsScope, { kind: "organization" }>,
|
|
8940
|
+
options?: OrganizationInsightsCallsOptions,
|
|
8941
|
+
requestOptions?: OpenGeniRequestOptions,
|
|
8942
|
+
): Promise<InsightsCallsResponse>;
|
|
8943
|
+
async listInsightsCalls(
|
|
8944
|
+
scope: InsightsCallsScope,
|
|
8945
|
+
options: OrganizationInsightsCallsOptions = {},
|
|
8946
|
+
requestOptions: OpenGeniRequestOptions = {},
|
|
8947
|
+
): Promise<InsightsCallsResponse> {
|
|
8948
|
+
const path =
|
|
8949
|
+
scope.kind === "workspace"
|
|
8950
|
+
? `/v1/workspaces/${encodeURIComponent(scope.workspaceId)}/insights/calls`
|
|
8951
|
+
: `/v1/organizations/${encodeURIComponent(scope.accountId)}/insights/calls`;
|
|
8952
|
+
return await this.requestJson(
|
|
8953
|
+
"GET",
|
|
8954
|
+
`${path}${insightsUsageQueryString(options)}`,
|
|
8955
|
+
undefined,
|
|
8956
|
+
{},
|
|
8957
|
+
requestOptions,
|
|
8958
|
+
);
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8892
8961
|
async getBillingEntitlements(
|
|
8893
8962
|
options: { accountId?: string } = {},
|
|
8894
8963
|
): Promise<BillingEntitlementsResponse> {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Type-only references keep this opt-in SDK leaf free of zod/root contracts.
|
|
2
|
+
import type {
|
|
3
|
+
OrganizationInsightsUsageQueryInput,
|
|
4
|
+
OrganizationInsightsCallsQueryInput,
|
|
5
|
+
InsightsUsageRange,
|
|
6
|
+
InsightsUsagePayer,
|
|
7
|
+
InsightsUsageSource,
|
|
8
|
+
} from "@opengeni/contracts/insights-usage";
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
InsightsUsageRange,
|
|
12
|
+
InsightsUsageGroupBy,
|
|
13
|
+
InsightsUsagePayer,
|
|
14
|
+
InsightsUsageSource,
|
|
15
|
+
InsightsUsageTokens,
|
|
16
|
+
InsightsUsageClassMicros,
|
|
17
|
+
InsightsUsageMeasures,
|
|
18
|
+
InsightsUsageScope,
|
|
19
|
+
InsightsUsageGroup,
|
|
20
|
+
InsightsUsageSeriesPoint,
|
|
21
|
+
InsightsUsageFacets,
|
|
22
|
+
InsightsUsageResponse,
|
|
23
|
+
InsightsCall,
|
|
24
|
+
InsightsCallsResponse,
|
|
25
|
+
} from "@opengeni/contracts/insights-usage";
|
|
26
|
+
|
|
27
|
+
/** Custom selections require both inclusive UTC calendar days. */
|
|
28
|
+
export type InsightsUsageWindowOptions =
|
|
29
|
+
| { range?: Exclude<InsightsUsageRange, "custom">; from?: never; to?: never }
|
|
30
|
+
| { range: "custom"; from: string; to: string };
|
|
31
|
+
|
|
32
|
+
type FilterOptions<T> = Omit<T, "range" | "from" | "to" | "limit" | "payer" | "source"> &
|
|
33
|
+
InsightsUsageWindowOptions & {
|
|
34
|
+
limit?: number;
|
|
35
|
+
payer?: InsightsUsagePayer | InsightsUsagePayer[];
|
|
36
|
+
source?: InsightsUsageSource | InsightsUsageSource[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type OrganizationInsightsUsageOptions = FilterOptions<
|
|
40
|
+
Omit<OrganizationInsightsUsageQueryInput, "seriesGroups">
|
|
41
|
+
> & { seriesGroups?: boolean };
|
|
42
|
+
/** workspaceId is intersected with the path workspace by the existing server gate. */
|
|
43
|
+
export type WorkspaceInsightsUsageOptions = OrganizationInsightsUsageOptions;
|
|
44
|
+
export type OrganizationInsightsCallsOptions = FilterOptions<OrganizationInsightsCallsQueryInput>;
|
|
45
|
+
export type WorkspaceInsightsCallsOptions = OrganizationInsightsCallsOptions;
|
|
46
|
+
export type InsightsCallsScope =
|
|
47
|
+
| { kind: "workspace"; workspaceId: string }
|
|
48
|
+
| { kind: "organization"; accountId: string };
|
|
49
|
+
|
|
50
|
+
/** Arrays repeat; comma strings, false and opaque values round-trip unchanged. */
|
|
51
|
+
export function insightsUsageQueryString(
|
|
52
|
+
options: OrganizationInsightsUsageOptions | OrganizationInsightsCallsOptions,
|
|
53
|
+
): string {
|
|
54
|
+
const params = new URLSearchParams();
|
|
55
|
+
for (const [key, value] of Object.entries(options)) {
|
|
56
|
+
if (value === undefined) continue;
|
|
57
|
+
for (const item of Array.isArray(value) ? value : [value]) params.append(key, String(item));
|
|
58
|
+
}
|
|
59
|
+
const query = params.toString();
|
|
60
|
+
return query ? `?${query}` : "";
|
|
61
|
+
}
|