buckyos 0.7.136 → 0.7.138
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/cli/dist/cli.mjs +29 -3
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/ai.ts +30 -1
- package/cli/version.ts +1 -1
- package/dist/aicc_client.d.ts +428 -44
- package/dist/aicc_client.d.ts.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +42 -34
- package/dist/device_identity.d.ts +1 -1
- package/dist/device_identity.d.ts.map +1 -1
- package/dist/hybrid_sso.d.ts +1 -1
- package/dist/hybrid_sso.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +42 -34
- package/dist/ndm_proxy-67651066.js +13 -0
- package/dist/ndm_proxy-67651066.js.map +1 -0
- package/dist/{ndm_proxy-b5c95488.mjs → ndm_proxy-6b03b9ec.mjs} +319 -55
- package/dist/ndm_proxy-6b03b9ec.mjs.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +42 -34
- package/dist/provision.cjs +2 -2
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +8 -4
- package/dist/provision.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/ndm_proxy-7cf15839.js +0 -13
- package/dist/ndm_proxy-7cf15839.js.map +0 -1
- package/dist/ndm_proxy-b5c95488.mjs.map +0 -1
package/cli/modules/ai.ts
CHANGED
|
@@ -27,7 +27,7 @@ const GROUPS = [
|
|
|
27
27
|
export function createAiModule(): CommandModule {
|
|
28
28
|
return {
|
|
29
29
|
name: 'ai',
|
|
30
|
-
summary: 'Read AI provider, routing, and
|
|
30
|
+
summary: 'Read AI provider, routing, usage and token quota state of the AICC service',
|
|
31
31
|
commands: [
|
|
32
32
|
readCommand({
|
|
33
33
|
verb: 'providers',
|
|
@@ -43,10 +43,39 @@ export function createAiModule(): CommandModule {
|
|
|
43
43
|
description: 'An empty routing object means the default routing of the model catalog.',
|
|
44
44
|
}),
|
|
45
45
|
usageCommand(),
|
|
46
|
+
quotaCommand(),
|
|
46
47
|
],
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
function quotaCommand(): CommandDefinition {
|
|
52
|
+
return {
|
|
53
|
+
verb: 'quota',
|
|
54
|
+
summary: "Show the token quota rules that limit the caller's AI calls and what is left",
|
|
55
|
+
description:
|
|
56
|
+
'Admin rules on the caller and the caller\'s Apps, shared App rules, and the caller\'s own App limits, each with its current window or total account. A refused call returns quota_exhausted / quota_budget_exceeded with the blocking rules.',
|
|
57
|
+
options: [
|
|
58
|
+
{ name: 'app', description: 'Only the rules that apply to calls of this App (an AppId or AgentId)', type: 'string' },
|
|
59
|
+
],
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: { app: { type: 'string', minLength: 1 } },
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
},
|
|
65
|
+
outputSchema: OBJECT_OUTPUT,
|
|
66
|
+
resultSchemaVersion: 1,
|
|
67
|
+
access: { mode: 'fixed', level: 'read' },
|
|
68
|
+
asyncMode: 'sync',
|
|
69
|
+
requiresSession: true,
|
|
70
|
+
examples: ['buckyos ai quota', 'buckyos ai quota --app aiworkspace'],
|
|
71
|
+
handler: async (ctx, input) =>
|
|
72
|
+
expectObject(
|
|
73
|
+
await callService(ctx, AICC, 'quota.query', inputString(input, 'app') ? { app_id: inputString(input, 'app') } : {}),
|
|
74
|
+
'quota.query',
|
|
75
|
+
),
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
50
79
|
function readCommand(options: {
|
|
51
80
|
verb: string
|
|
52
81
|
summary: string
|
package/cli/version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-cli-version.mjs. Do not edit.
|
|
2
|
-
export const PACKAGE_VERSION = '0.7.
|
|
2
|
+
export const PACKAGE_VERSION = '0.7.138'
|
|
3
3
|
export const TOOL_VERSION = PACKAGE_VERSION
|
|
4
4
|
export const SDK_VERSION = PACKAGE_VERSION
|
|
5
5
|
export const PROTOCOL_VERSION = '1'
|
package/dist/aicc_client.d.ts
CHANGED
|
@@ -21,9 +21,8 @@ export declare const AICC_AI_METHODS: {
|
|
|
21
21
|
readonly AUDIO_ASR: "audio.asr";
|
|
22
22
|
readonly AUDIO_MUSIC: "audio.music";
|
|
23
23
|
readonly AUDIO_ENHANCE: "audio.enhance";
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
26
|
-
readonly VIDEO_VIDEO2VIDEO: "video.video2video";
|
|
24
|
+
readonly VIDEO_GENERATE: "video.generate";
|
|
25
|
+
readonly VIDEO_EDIT: "video.edit";
|
|
27
26
|
readonly VIDEO_EXTEND: "video.extend";
|
|
28
27
|
readonly VIDEO_UPSCALE: "video.upscale";
|
|
29
28
|
readonly AGENT_COMPUTER_USE: "agent.computer_use";
|
|
@@ -32,6 +31,7 @@ export declare const AICC_CORE_METHODS: {
|
|
|
32
31
|
readonly ROUTE_RESOLVE: "route.resolve";
|
|
33
32
|
readonly HELPER_LLM_CHAT: "helper.llm_chat";
|
|
34
33
|
readonly HELPER_TEXT_TO_IMAGE: "helper.text_to_image";
|
|
34
|
+
readonly HELPER_VIDEO_GENERATE: "helper.video_generate";
|
|
35
35
|
readonly CANCEL: "cancel";
|
|
36
36
|
};
|
|
37
37
|
export declare const AICC_MANAGEMENT_METHODS: {
|
|
@@ -55,7 +55,34 @@ export declare const AICC_MANAGEMENT_METHODS: {
|
|
|
55
55
|
readonly DRIVER_METADATA_UPDATE_GET: "driver_metadata_update.get";
|
|
56
56
|
readonly DRIVER_METADATA_UPDATE_SET: "driver_metadata_update.set";
|
|
57
57
|
};
|
|
58
|
+
/** Token quota and resource visibility (product/ai_center/AI_Center_Quota_PRD.md). */
|
|
59
|
+
export declare const AICC_QUOTA_METHODS: {
|
|
60
|
+
readonly RULE_LIST: "quota.rule.list";
|
|
61
|
+
readonly RULE_GET: "quota.rule.get";
|
|
62
|
+
readonly RULE_PREVIEW: "quota.rule.preview";
|
|
63
|
+
readonly RULE_CREATE: "quota.rule.create";
|
|
64
|
+
readonly RULE_UPDATE: "quota.rule.update";
|
|
65
|
+
readonly RULE_DELETE: "quota.rule.delete";
|
|
66
|
+
readonly ACCOUNT_GET: "quota.account.get";
|
|
67
|
+
readonly ACCOUNT_RECHARGE: "quota.account.recharge";
|
|
68
|
+
readonly RECHARGE_GET: "quota.recharge.get";
|
|
69
|
+
readonly VISIBILITY_GET: "visibility.get";
|
|
70
|
+
readonly VISIBILITY_UPDATE: "visibility.update";
|
|
71
|
+
readonly VISIBILITY_PREVIEW: "visibility.preview";
|
|
72
|
+
};
|
|
58
73
|
export declare const AICC_METHODS: {
|
|
74
|
+
readonly RULE_LIST: "quota.rule.list";
|
|
75
|
+
readonly RULE_GET: "quota.rule.get";
|
|
76
|
+
readonly RULE_PREVIEW: "quota.rule.preview";
|
|
77
|
+
readonly RULE_CREATE: "quota.rule.create";
|
|
78
|
+
readonly RULE_UPDATE: "quota.rule.update";
|
|
79
|
+
readonly RULE_DELETE: "quota.rule.delete";
|
|
80
|
+
readonly ACCOUNT_GET: "quota.account.get";
|
|
81
|
+
readonly ACCOUNT_RECHARGE: "quota.account.recharge";
|
|
82
|
+
readonly RECHARGE_GET: "quota.recharge.get";
|
|
83
|
+
readonly VISIBILITY_GET: "visibility.get";
|
|
84
|
+
readonly VISIBILITY_UPDATE: "visibility.update";
|
|
85
|
+
readonly VISIBILITY_PREVIEW: "visibility.preview";
|
|
59
86
|
readonly SERVICE_RELOAD_SETTINGS: "service.reload_settings";
|
|
60
87
|
readonly QUOTA_QUERY: "quota.query";
|
|
61
88
|
readonly USAGE_QUERY: "usage.query";
|
|
@@ -78,6 +105,7 @@ export declare const AICC_METHODS: {
|
|
|
78
105
|
readonly ROUTE_RESOLVE: "route.resolve";
|
|
79
106
|
readonly HELPER_LLM_CHAT: "helper.llm_chat";
|
|
80
107
|
readonly HELPER_TEXT_TO_IMAGE: "helper.text_to_image";
|
|
108
|
+
readonly HELPER_VIDEO_GENERATE: "helper.video_generate";
|
|
81
109
|
readonly CANCEL: "cancel";
|
|
82
110
|
readonly CHAT_COMPLETIONS_CREATE: "chat.completions.create";
|
|
83
111
|
readonly IMAGES_GENERATE: "images.generate";
|
|
@@ -97,9 +125,8 @@ export declare const AICC_METHODS: {
|
|
|
97
125
|
readonly AUDIO_ASR: "audio.asr";
|
|
98
126
|
readonly AUDIO_MUSIC: "audio.music";
|
|
99
127
|
readonly AUDIO_ENHANCE: "audio.enhance";
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly VIDEO_VIDEO2VIDEO: "video.video2video";
|
|
128
|
+
readonly VIDEO_GENERATE: "video.generate";
|
|
129
|
+
readonly VIDEO_EDIT: "video.edit";
|
|
103
130
|
readonly VIDEO_EXTEND: "video.extend";
|
|
104
131
|
readonly VIDEO_UPSCALE: "video.upscale";
|
|
105
132
|
readonly AGENT_COMPUTER_USE: "agent.computer_use";
|
|
@@ -109,7 +136,7 @@ export type AiccMethod = typeof AICC_METHODS[keyof typeof AICC_METHODS];
|
|
|
109
136
|
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
110
137
|
[key: string]: JsonValue;
|
|
111
138
|
};
|
|
112
|
-
export type ApiType = 'llm' | 'embedding.text' | 'embedding.multimodal' | 'decision' | 'rerank' | 'image.txt2img' | 'image.img2img' | 'image.inpaint' | 'image.upscale' | 'image.bg_remove' | 'vision.ocr' | 'vision.caption' | 'vision.detect' | 'vision.segment' | 'audio.tts' | 'audio.asr' | 'audio.music' | 'audio.enhance' | 'video.
|
|
139
|
+
export type ApiType = 'llm' | 'embedding.text' | 'embedding.multimodal' | 'decision' | 'rerank' | 'image.txt2img' | 'image.img2img' | 'image.inpaint' | 'image.upscale' | 'image.bg_remove' | 'vision.ocr' | 'vision.caption' | 'vision.detect' | 'vision.segment' | 'audio.tts' | 'audio.asr' | 'audio.music' | 'audio.enhance' | 'video.generate' | 'video.edit' | 'video.extend' | 'video.upscale' | 'agent.computer_use';
|
|
113
140
|
export type Capability = 'llm' | 'embedding' | 'decision' | 'rerank' | 'image' | 'vision' | 'audio' | 'video' | 'agent';
|
|
114
141
|
export type Feature = string;
|
|
115
142
|
export declare const AICC_FEATURES: {
|
|
@@ -196,6 +223,9 @@ export interface AiUsage {
|
|
|
196
223
|
output_tokens?: number;
|
|
197
224
|
total_tokens?: number;
|
|
198
225
|
request_units?: number;
|
|
226
|
+
video_seconds?: number;
|
|
227
|
+
reference_images?: number;
|
|
228
|
+
reported_cost?: number;
|
|
199
229
|
}
|
|
200
230
|
export interface Money {
|
|
201
231
|
amount: number;
|
|
@@ -208,7 +238,17 @@ export interface AiArtifact {
|
|
|
208
238
|
mime?: string;
|
|
209
239
|
metadata?: JsonValue;
|
|
210
240
|
}
|
|
211
|
-
export type AiccErrorCode = 'invalid_request' | 'invalid_method' | 'schema_validation_failed' | 'invalid_model_name' | 'resource_invalid' | 'no_provider_available' | 'no_candidate_model' | 'fallback_not_allowed' | 'provider_start_failed' | 'provider_error' | 'unsupported_execution_mode' | 'timeout' | 'budget_exceeded' | 'policy_denied' | 'idempotency_conflict' | 'settings_revision_conflict' | 'cancelled' | 'internal_error'
|
|
241
|
+
export type AiccErrorCode = 'invalid_request' | 'invalid_method' | 'schema_validation_failed' | 'invalid_model_name' | 'resource_invalid' | 'no_provider_available' | 'no_candidate_model' | 'fallback_not_allowed' | 'provider_start_failed' | 'provider_error' | 'unsupported_execution_mode' | 'timeout' | 'budget_exceeded' | 'policy_denied' | 'idempotency_conflict' | 'settings_revision_conflict' | 'cancelled' | 'internal_error' |
|
|
242
|
+
/** An enabled token quota rule has nothing left (`details`: QuotaDenialDetails). */
|
|
243
|
+
'quota_exhausted' |
|
|
244
|
+
/** Tokens are left but fewer than the call reserves; lower the budget (`details`: QuotaDenialDetails). */
|
|
245
|
+
'quota_budget_exceeded' |
|
|
246
|
+
/** A configured rule could not be read or reserved; retry later, never treat it as unlimited. */
|
|
247
|
+
'quota_unavailable' |
|
|
248
|
+
/** The Provider / model is not permitted to the caller (hidden identities are not disclosed). */
|
|
249
|
+
'resource_not_permitted' |
|
|
250
|
+
/** The AICC user of a delegated run cannot be determined. */
|
|
251
|
+
'attribution_unavailable';
|
|
212
252
|
export interface AiccError {
|
|
213
253
|
code: AiccErrorCode;
|
|
214
254
|
message: string;
|
|
@@ -216,6 +256,10 @@ export interface AiccError {
|
|
|
216
256
|
retriable?: boolean;
|
|
217
257
|
details?: JsonValue;
|
|
218
258
|
}
|
|
259
|
+
/** Token quota and resource policy refusals: they reach the client as a detailed kRPC error. */
|
|
260
|
+
export declare const AICC_POLICY_REFUSAL_CODES: readonly AiccErrorCode[];
|
|
261
|
+
/** The AICC error of a refused call (its `code` and `details`), read from the structured kRPC error. */
|
|
262
|
+
export declare function aiccRefusalOf(error: unknown): AiccError | undefined;
|
|
219
263
|
export interface SettingsRevisionConflictDetails {
|
|
220
264
|
expected_revision: number;
|
|
221
265
|
actual_revision: number;
|
|
@@ -257,8 +301,9 @@ export interface ModelRequirement {
|
|
|
257
301
|
vision?: boolean;
|
|
258
302
|
image_generation?: boolean;
|
|
259
303
|
min_context_tokens?: number;
|
|
304
|
+
video?: VideoGenerationRequirement;
|
|
260
305
|
}
|
|
261
|
-
export interface ModelDisable extends Omit<ModelRequirement, "decision"> {
|
|
306
|
+
export interface ModelDisable extends Omit<ModelRequirement, "decision" | "video"> {
|
|
262
307
|
}
|
|
263
308
|
export interface HelperModelRequirement extends Omit<ModelRequirement, "decision"> {
|
|
264
309
|
}
|
|
@@ -809,31 +854,87 @@ export interface AudioEnhanceResponse extends InferenceResponse {
|
|
|
809
854
|
audio?: ResourceRef;
|
|
810
855
|
stems?: ResourceRef[];
|
|
811
856
|
}
|
|
812
|
-
export interface
|
|
813
|
-
|
|
857
|
+
export interface TimeRange {
|
|
858
|
+
start_seconds: number;
|
|
859
|
+
end_seconds: number;
|
|
860
|
+
}
|
|
861
|
+
/** Video generation inputs (doc/aicc/video_generation.md); `id` is referenced from the prompt as `@{id}`. */
|
|
862
|
+
export type KeyframePosition = 'start' | 'end';
|
|
863
|
+
export type VideoCondition = {
|
|
864
|
+
type: 'reference_image';
|
|
865
|
+
id: string;
|
|
866
|
+
resource: ResourceRef;
|
|
867
|
+
} | {
|
|
868
|
+
type: 'reference_video';
|
|
869
|
+
id: string;
|
|
870
|
+
resource: ResourceRef;
|
|
871
|
+
time_range?: TimeRange;
|
|
872
|
+
include_audio?: boolean;
|
|
873
|
+
} | {
|
|
874
|
+
type: 'reference_audio';
|
|
875
|
+
id: string;
|
|
876
|
+
resource: ResourceRef;
|
|
877
|
+
time_range?: TimeRange;
|
|
878
|
+
} | {
|
|
879
|
+
type: 'keyframe';
|
|
880
|
+
id: string;
|
|
881
|
+
resource: ResourceRef;
|
|
882
|
+
position: KeyframePosition;
|
|
883
|
+
};
|
|
884
|
+
export type VideoConditionKind = VideoCondition['type'];
|
|
885
|
+
export type VideoSize = {
|
|
886
|
+
short_edge: number;
|
|
887
|
+
} | {
|
|
888
|
+
width: number;
|
|
889
|
+
height: number;
|
|
890
|
+
};
|
|
891
|
+
export type VideoAudioMode = 'auto' | 'generate' | 'none';
|
|
892
|
+
export interface VideoOutputSpec {
|
|
814
893
|
duration_seconds?: number;
|
|
815
894
|
aspect_ratio?: string;
|
|
816
|
-
|
|
817
|
-
|
|
895
|
+
size?: VideoSize;
|
|
896
|
+
fps?: number;
|
|
897
|
+
audio?: VideoAudioMode;
|
|
898
|
+
media_type?: string;
|
|
899
|
+
}
|
|
900
|
+
/** What a video request demands of a model; used by `route.resolve`, helpers and routing alike. */
|
|
901
|
+
export interface VideoGenerationRequirement {
|
|
902
|
+
prompt?: boolean;
|
|
903
|
+
negative_prompt?: boolean;
|
|
904
|
+
seed?: boolean;
|
|
905
|
+
reference_images?: number;
|
|
906
|
+
reference_videos?: number;
|
|
907
|
+
reference_audios?: number;
|
|
908
|
+
keyframes?: KeyframePosition[];
|
|
909
|
+
reference_video_audio?: boolean;
|
|
910
|
+
time_ranges?: boolean;
|
|
911
|
+
output?: VideoOutputSpec;
|
|
912
|
+
}
|
|
913
|
+
interface VideoGenerationFields {
|
|
914
|
+
prompt?: string;
|
|
915
|
+
negative_prompt?: string;
|
|
916
|
+
conditions?: VideoCondition[];
|
|
917
|
+
output?: VideoOutputSpec;
|
|
818
918
|
seed?: number;
|
|
819
|
-
output?: AiOutputOptions;
|
|
820
919
|
}
|
|
821
|
-
export interface
|
|
822
|
-
image: ResourceRef;
|
|
823
|
-
prompt: string;
|
|
824
|
-
duration_seconds?: number;
|
|
825
|
-
aspect_ratio?: string;
|
|
826
|
-
resolution?: string;
|
|
920
|
+
export interface VideoGenerateRequest extends InferenceRequest, VideoGenerationFields {
|
|
827
921
|
}
|
|
828
|
-
export interface
|
|
829
|
-
|
|
830
|
-
|
|
922
|
+
export interface VideoGenerateHelperRequest extends VideoGenerationFields {
|
|
923
|
+
logical_model: string;
|
|
924
|
+
requirements?: HelperModelRequirement;
|
|
925
|
+
trace_id?: string;
|
|
926
|
+
execution_mode?: AiccExecutionMode;
|
|
927
|
+
disable?: ModelDisable;
|
|
928
|
+
policy?: RoutePolicy;
|
|
929
|
+
idempotency_key?: string;
|
|
930
|
+
task_options?: AiTaskOptions;
|
|
931
|
+
session_overlay?: AiccRouteOverlay;
|
|
932
|
+
session_id?: string;
|
|
831
933
|
}
|
|
832
|
-
export interface
|
|
934
|
+
export interface VideoEditRequest extends InferenceRequest {
|
|
833
935
|
video: ResourceRef;
|
|
834
936
|
prompt: string;
|
|
835
|
-
|
|
836
|
-
time_range?: TimeRange;
|
|
937
|
+
output?: VideoOutputSpec;
|
|
837
938
|
}
|
|
838
939
|
export interface VideoExtendRequest extends InferenceRequest {
|
|
839
940
|
video: ResourceRef;
|
|
@@ -849,12 +950,33 @@ export interface VideoUpscaleRequest extends InferenceRequest {
|
|
|
849
950
|
sharpen?: number;
|
|
850
951
|
output?: AiOutputOptions;
|
|
851
952
|
}
|
|
953
|
+
export interface VideoMetadata {
|
|
954
|
+
duration_seconds?: number;
|
|
955
|
+
width?: number;
|
|
956
|
+
height?: number;
|
|
957
|
+
fps?: number;
|
|
958
|
+
has_audio?: boolean;
|
|
959
|
+
}
|
|
960
|
+
export interface VideoDeviation {
|
|
961
|
+
field: string;
|
|
962
|
+
requested: JsonValue;
|
|
963
|
+
actual: JsonValue;
|
|
964
|
+
source: 'provider' | 'measured';
|
|
965
|
+
}
|
|
966
|
+
/** `provider_metadata` is what the Provider reported; `measured_metadata` is read from the file by AICC when it had the bytes. */
|
|
967
|
+
export interface GeneratedVideo {
|
|
968
|
+
resource: ResourceRef;
|
|
969
|
+
media_type?: string;
|
|
970
|
+
provider_metadata: VideoMetadata;
|
|
971
|
+
measured_metadata?: VideoMetadata;
|
|
972
|
+
last_frame?: ResourceRef;
|
|
973
|
+
deviations?: VideoDeviation[];
|
|
974
|
+
}
|
|
852
975
|
export interface VideoResponse extends InferenceResponse {
|
|
853
|
-
|
|
976
|
+
videos?: GeneratedVideo[];
|
|
854
977
|
}
|
|
855
|
-
export type
|
|
856
|
-
export type
|
|
857
|
-
export type VideoToVideoResponse = VideoResponse;
|
|
978
|
+
export type VideoGenerateResponse = VideoResponse;
|
|
979
|
+
export type VideoEditResponse = VideoResponse;
|
|
858
980
|
export type VideoExtendResponse = VideoResponse;
|
|
859
981
|
export type VideoUpscaleResponse = VideoResponse;
|
|
860
982
|
export interface ComputerEnvironment {
|
|
@@ -898,7 +1020,11 @@ export interface ComputerUseResponse extends InferenceResponse {
|
|
|
898
1020
|
export type EmptyRequest = Record<string, never>;
|
|
899
1021
|
export type ServiceReloadSettingsRequest = EmptyRequest;
|
|
900
1022
|
export type RoutingGetRequest = EmptyRequest;
|
|
901
|
-
|
|
1023
|
+
/** `use` (default): what the caller may use; `manage` (admin): the whole inventory, each model marked `accessible`. */
|
|
1024
|
+
export type AiccListView = 'use' | 'manage';
|
|
1025
|
+
export interface ListModelsRequest {
|
|
1026
|
+
view?: AiccListView;
|
|
1027
|
+
}
|
|
902
1028
|
export type ProviderCatalogRequest = EmptyRequest;
|
|
903
1029
|
export type ProtocolAdapterListRequest = EmptyRequest;
|
|
904
1030
|
export type DriverMetadataUpdateGetReq = EmptyRequest;
|
|
@@ -909,18 +1035,235 @@ export interface ServiceReloadSettingsResponse {
|
|
|
909
1035
|
ok: boolean;
|
|
910
1036
|
settings_revision: number;
|
|
911
1037
|
}
|
|
912
|
-
export
|
|
913
|
-
|
|
914
|
-
|
|
1038
|
+
export type QuotaRuleSource = 'admin' | 'user';
|
|
1039
|
+
export type QuotaObject = {
|
|
1040
|
+
type: 'user';
|
|
1041
|
+
user_id: string;
|
|
1042
|
+
} | {
|
|
1043
|
+
type: 'app';
|
|
1044
|
+
app_id: string;
|
|
1045
|
+
} | {
|
|
1046
|
+
type: 'user_app';
|
|
1047
|
+
user_id: string;
|
|
1048
|
+
app_id: string;
|
|
1049
|
+
};
|
|
1050
|
+
export type QuotaResource = {
|
|
1051
|
+
type: 'all';
|
|
1052
|
+
} | {
|
|
1053
|
+
type: 'provider';
|
|
1054
|
+
provider_instance_name: string;
|
|
1055
|
+
} | {
|
|
1056
|
+
type: 'model';
|
|
1057
|
+
exact_model: string;
|
|
1058
|
+
} | {
|
|
1059
|
+
type: 'hidden';
|
|
1060
|
+
};
|
|
1061
|
+
export type QuotaPeriod = '4h' | '24h' | '72h' | 'week';
|
|
1062
|
+
export type QuotaKind = 'periodic' | 'total';
|
|
1063
|
+
export type QuotaStatus = 'normal' | 'near_limit' | 'exhausted' | 'forbidden' | 'disabled' | 'resource_unavailable';
|
|
1064
|
+
export interface QuotaPendingPeriod {
|
|
1065
|
+
period: QuotaPeriod;
|
|
1066
|
+
effective_at_ms: number;
|
|
1067
|
+
conflict?: boolean;
|
|
1068
|
+
}
|
|
1069
|
+
export interface QuotaRule {
|
|
1070
|
+
rule_id: string;
|
|
1071
|
+
source: QuotaRuleSource;
|
|
1072
|
+
object: QuotaObject;
|
|
1073
|
+
resource: QuotaResource;
|
|
1074
|
+
kind: QuotaKind;
|
|
1075
|
+
period?: QuotaPeriod;
|
|
1076
|
+
limit_tokens?: number;
|
|
1077
|
+
account_id?: string;
|
|
1078
|
+
enabled: boolean;
|
|
1079
|
+
deleted?: boolean;
|
|
1080
|
+
pending_period?: QuotaPendingPeriod;
|
|
1081
|
+
version: number;
|
|
1082
|
+
created_by: string;
|
|
1083
|
+
created_at_ms: number;
|
|
1084
|
+
updated_by: string;
|
|
1085
|
+
updated_at_ms: number;
|
|
1086
|
+
}
|
|
1087
|
+
export interface QuotaUsageState {
|
|
1088
|
+
status: QuotaStatus;
|
|
1089
|
+
window_start_ms?: number;
|
|
1090
|
+
window_end_ms?: number;
|
|
1091
|
+
reset_at_ms: number | null;
|
|
1092
|
+
limit_tokens?: number;
|
|
1093
|
+
granted_tokens?: number;
|
|
1094
|
+
account_start_ms?: number;
|
|
1095
|
+
settled_tokens: number;
|
|
1096
|
+
reserved_tokens: number;
|
|
1097
|
+
pending_tokens: number;
|
|
1098
|
+
available_tokens: number;
|
|
1099
|
+
debt_tokens: number;
|
|
1100
|
+
updated_at_ms: number;
|
|
1101
|
+
}
|
|
1102
|
+
export interface QuotaRuleView {
|
|
1103
|
+
rule: QuotaRule;
|
|
1104
|
+
state: QuotaUsageState;
|
|
1105
|
+
editable: boolean;
|
|
915
1106
|
}
|
|
916
|
-
export interface
|
|
917
|
-
|
|
918
|
-
remaining_request_units?: number;
|
|
919
|
-
remaining_cost?: Money;
|
|
920
|
-
reset_at?: string;
|
|
1107
|
+
export interface QuotaQueryRequest {
|
|
1108
|
+
app_id?: string;
|
|
921
1109
|
}
|
|
922
1110
|
export interface QuotaQueryResponse {
|
|
923
|
-
|
|
1111
|
+
user_id: string;
|
|
1112
|
+
rules: QuotaRuleView[];
|
|
1113
|
+
near_limit_count: number;
|
|
1114
|
+
exhausted_count: number;
|
|
1115
|
+
}
|
|
1116
|
+
export interface QuotaRuleListRequest {
|
|
1117
|
+
scope?: 'mine' | 'manage';
|
|
1118
|
+
include_deleted?: boolean;
|
|
1119
|
+
}
|
|
1120
|
+
export interface QuotaRuleListResponse {
|
|
1121
|
+
rules: QuotaRuleView[];
|
|
1122
|
+
}
|
|
1123
|
+
export interface QuotaAuditRecord {
|
|
1124
|
+
audit_id: string;
|
|
1125
|
+
target_type: string;
|
|
1126
|
+
target_id: string;
|
|
1127
|
+
action: string;
|
|
1128
|
+
operator: string;
|
|
1129
|
+
before?: JsonValue;
|
|
1130
|
+
after?: JsonValue;
|
|
1131
|
+
created_at_ms: number;
|
|
1132
|
+
}
|
|
1133
|
+
export interface QuotaGrantRecord {
|
|
1134
|
+
grant_id: string;
|
|
1135
|
+
account_id: string;
|
|
1136
|
+
kind: 'initial' | 'recharge';
|
|
1137
|
+
amount_tokens: number;
|
|
1138
|
+
operator: string;
|
|
1139
|
+
note?: string;
|
|
1140
|
+
created_at_ms: number;
|
|
1141
|
+
}
|
|
1142
|
+
export interface QuotaAccountView {
|
|
1143
|
+
account_id: string;
|
|
1144
|
+
object: QuotaObject;
|
|
1145
|
+
resource: QuotaResource;
|
|
1146
|
+
granted_tokens: number;
|
|
1147
|
+
settled_tokens: number;
|
|
1148
|
+
reserved_tokens: number;
|
|
1149
|
+
pending_tokens: number;
|
|
1150
|
+
available_tokens: number;
|
|
1151
|
+
debt_tokens: number;
|
|
1152
|
+
start_at_ms: number;
|
|
1153
|
+
version: number;
|
|
1154
|
+
updated_at_ms: number;
|
|
1155
|
+
enforced: boolean;
|
|
1156
|
+
}
|
|
1157
|
+
export interface QuotaRuleDetail {
|
|
1158
|
+
rule: QuotaRuleView;
|
|
1159
|
+
constraints: QuotaRuleView[];
|
|
1160
|
+
blocking_rule_ids: string[];
|
|
1161
|
+
account?: QuotaAccountView;
|
|
1162
|
+
grants?: QuotaGrantRecord[];
|
|
1163
|
+
audit?: QuotaAuditRecord[];
|
|
1164
|
+
}
|
|
1165
|
+
export interface QuotaRuleDraft {
|
|
1166
|
+
source?: QuotaRuleSource;
|
|
1167
|
+
object: QuotaObject;
|
|
1168
|
+
resource: QuotaResource;
|
|
1169
|
+
kind: QuotaKind;
|
|
1170
|
+
period?: QuotaPeriod;
|
|
1171
|
+
limit_tokens?: number;
|
|
1172
|
+
initial_tokens?: number;
|
|
1173
|
+
}
|
|
1174
|
+
export interface QuotaRulePreviewResponse {
|
|
1175
|
+
state: QuotaUsageState;
|
|
1176
|
+
existing_account?: QuotaAccountView;
|
|
1177
|
+
conflict_rule_id?: string;
|
|
1178
|
+
other_constraints: QuotaRuleView[];
|
|
1179
|
+
}
|
|
1180
|
+
export interface QuotaRuleUpdateRequest {
|
|
1181
|
+
rule_id: string;
|
|
1182
|
+
expected_version: number;
|
|
1183
|
+
limit_tokens?: number;
|
|
1184
|
+
period?: QuotaPeriod;
|
|
1185
|
+
enabled?: boolean;
|
|
1186
|
+
cancel_pending_period?: boolean;
|
|
1187
|
+
}
|
|
1188
|
+
export interface QuotaRechargeRequest {
|
|
1189
|
+
account_id: string;
|
|
1190
|
+
recharge_id: string;
|
|
1191
|
+
amount_tokens: number;
|
|
1192
|
+
note?: string;
|
|
1193
|
+
}
|
|
1194
|
+
export interface QuotaRechargeResponse {
|
|
1195
|
+
recharge: QuotaGrantRecord;
|
|
1196
|
+
account: QuotaAccountView;
|
|
1197
|
+
replayed: boolean;
|
|
1198
|
+
}
|
|
1199
|
+
export interface QuotaBlockingRule {
|
|
1200
|
+
rule_id: string;
|
|
1201
|
+
source: QuotaRuleSource;
|
|
1202
|
+
object: QuotaObject;
|
|
1203
|
+
resource: QuotaResource;
|
|
1204
|
+
kind: QuotaKind;
|
|
1205
|
+
period?: QuotaPeriod;
|
|
1206
|
+
state: QuotaUsageState;
|
|
1207
|
+
recoverable: boolean;
|
|
1208
|
+
}
|
|
1209
|
+
/** `details` of `quota_exhausted` / `quota_budget_exceeded`. */
|
|
1210
|
+
export interface QuotaDenialDetails {
|
|
1211
|
+
required_tokens: number;
|
|
1212
|
+
max_allowed_tokens: number;
|
|
1213
|
+
provider_instance_name: string;
|
|
1214
|
+
exact_model: string;
|
|
1215
|
+
blocking: QuotaBlockingRule[];
|
|
1216
|
+
reset_at_ms: number | null;
|
|
1217
|
+
}
|
|
1218
|
+
export type VisibilityEntry = {
|
|
1219
|
+
type: 'all_providers';
|
|
1220
|
+
} | {
|
|
1221
|
+
type: 'provider_all_models';
|
|
1222
|
+
provider_instance_name: string;
|
|
1223
|
+
} | {
|
|
1224
|
+
type: 'provider_models';
|
|
1225
|
+
provider_instance_name: string;
|
|
1226
|
+
exact_models: string[];
|
|
1227
|
+
};
|
|
1228
|
+
export interface VisibilitySubjectPolicy {
|
|
1229
|
+
subject: string;
|
|
1230
|
+
entries: VisibilityEntry[];
|
|
1231
|
+
updated_by: string;
|
|
1232
|
+
updated_at_ms: number;
|
|
1233
|
+
}
|
|
1234
|
+
export interface VisibilityGetResponse {
|
|
1235
|
+
revision: number;
|
|
1236
|
+
subjects: VisibilitySubjectPolicy[];
|
|
1237
|
+
providers: {
|
|
1238
|
+
provider_instance_name: string;
|
|
1239
|
+
enabled: boolean;
|
|
1240
|
+
exact_models: string[];
|
|
1241
|
+
}[];
|
|
1242
|
+
unexposed_models: string[];
|
|
1243
|
+
}
|
|
1244
|
+
export interface VisibilityUpdateRequest {
|
|
1245
|
+
expected_revision: number;
|
|
1246
|
+
subject: string;
|
|
1247
|
+
entries: VisibilityEntry[];
|
|
1248
|
+
}
|
|
1249
|
+
export interface VisibilityPreviewRequest {
|
|
1250
|
+
user_id?: string;
|
|
1251
|
+
draft?: {
|
|
1252
|
+
subject: string;
|
|
1253
|
+
entries: VisibilityEntry[];
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
export interface VisibilityPreviewResponse {
|
|
1257
|
+
user_id: string;
|
|
1258
|
+
grants: {
|
|
1259
|
+
provider_instance_name: string;
|
|
1260
|
+
exact_model?: string;
|
|
1261
|
+
sources: string[];
|
|
1262
|
+
}[];
|
|
1263
|
+
added?: string[];
|
|
1264
|
+
removed?: string[];
|
|
1265
|
+
affected_users?: string[];
|
|
1266
|
+
caller_loses?: string[];
|
|
924
1267
|
}
|
|
925
1268
|
export interface ProviderCatalogEntry {
|
|
926
1269
|
provider_profile_id: string;
|
|
@@ -1024,6 +1367,7 @@ export interface ProviderRefreshModelsResponse {
|
|
|
1024
1367
|
}
|
|
1025
1368
|
export interface ProviderListRequest {
|
|
1026
1369
|
method?: string;
|
|
1370
|
+
view?: AiccListView;
|
|
1027
1371
|
}
|
|
1028
1372
|
export type ProviderInstanceAuthMode = 'api_key' | 'dynamic_login';
|
|
1029
1373
|
export interface ProviderInstanceAuthView {
|
|
@@ -1116,6 +1460,8 @@ export interface QueryUsageRequest {
|
|
|
1116
1460
|
output_mode?: 'summary' | 'events' | 'summary_and_events';
|
|
1117
1461
|
limit?: number;
|
|
1118
1462
|
cursor?: string;
|
|
1463
|
+
/** Admins only: every user of the Zone instead of the caller alone. */
|
|
1464
|
+
zone_wide?: boolean;
|
|
1119
1465
|
}
|
|
1120
1466
|
export interface UsageAggregate {
|
|
1121
1467
|
total_requests: number;
|
|
@@ -1145,6 +1491,8 @@ export interface AiccUsageEvent {
|
|
|
1145
1491
|
request_units?: number;
|
|
1146
1492
|
usage_json: AiUsage;
|
|
1147
1493
|
finance_snapshot_json?: JsonValue;
|
|
1494
|
+
operator_id?: string;
|
|
1495
|
+
attribution?: JsonValue;
|
|
1148
1496
|
created_at_ms: number;
|
|
1149
1497
|
}
|
|
1150
1498
|
export interface UsageGroupedRow {
|
|
@@ -1292,9 +1640,9 @@ export declare class AiccClient {
|
|
|
1292
1640
|
audioSpeechRecognition(r: AudioSpeechRecognitionRequest): Promise<AudioSpeechRecognitionResponse>;
|
|
1293
1641
|
audioMusic(r: AudioMusicRequest): Promise<AudioMusicResponse>;
|
|
1294
1642
|
audioEnhance(r: AudioEnhanceRequest): Promise<AudioEnhanceResponse>;
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1643
|
+
videoGenerate(r: VideoGenerateRequest): Promise<VideoResponse>;
|
|
1644
|
+
helperVideoGenerate(r: VideoGenerateHelperRequest): Promise<VideoResponse>;
|
|
1645
|
+
videoEdit(r: VideoEditRequest): Promise<VideoResponse>;
|
|
1298
1646
|
videoExtend(r: VideoExtendRequest): Promise<VideoResponse>;
|
|
1299
1647
|
videoUpscale(r: VideoUpscaleRequest): Promise<VideoResponse>;
|
|
1300
1648
|
computerUse(r: ComputerUseRequest): Promise<ComputerUseResponse>;
|
|
@@ -1315,12 +1663,48 @@ export declare class AiccClient {
|
|
|
1315
1663
|
updateProvider(r: ProviderUpdateRequest): Promise<ProviderUpdateResponse>;
|
|
1316
1664
|
deleteProvider(r: ProviderDeleteRequest): Promise<ProviderDeleteResponse>;
|
|
1317
1665
|
refreshProviderModels(r: ProviderRefreshModelsRequest): Promise<ProviderRefreshModelsResponse>;
|
|
1318
|
-
listModels(): Promise<JsonValue>;
|
|
1666
|
+
listModels(r?: ListModelsRequest): Promise<JsonValue>;
|
|
1667
|
+
listQuotaRules(r?: QuotaRuleListRequest): Promise<QuotaRuleListResponse>;
|
|
1668
|
+
getQuotaRule(ruleId: string): Promise<QuotaRuleDetail>;
|
|
1669
|
+
previewQuotaRule(draft: QuotaRuleDraft): Promise<QuotaRulePreviewResponse>;
|
|
1670
|
+
createQuotaRule(draft: QuotaRuleDraft): Promise<QuotaRuleView>;
|
|
1671
|
+
updateQuotaRule(r: QuotaRuleUpdateRequest): Promise<QuotaRuleView>;
|
|
1672
|
+
deleteQuotaRule(ruleId: string, expectedVersion: number): Promise<{
|
|
1673
|
+
ok: boolean;
|
|
1674
|
+
rule_id: string;
|
|
1675
|
+
}>;
|
|
1676
|
+
getQuotaAccount(accountId: string): Promise<{
|
|
1677
|
+
account: QuotaAccountView;
|
|
1678
|
+
grants: QuotaGrantRecord[];
|
|
1679
|
+
}>;
|
|
1680
|
+
rechargeQuotaAccount(r: QuotaRechargeRequest): Promise<QuotaRechargeResponse>;
|
|
1681
|
+
getQuotaRecharge(rechargeId: string): Promise<{
|
|
1682
|
+
recharge?: QuotaGrantRecord | undefined;
|
|
1683
|
+
account?: QuotaAccountView | undefined;
|
|
1684
|
+
}>;
|
|
1685
|
+
getVisibility(): Promise<VisibilityGetResponse>;
|
|
1686
|
+
updateVisibility(r: VisibilityUpdateRequest): Promise<VisibilityGetResponse>;
|
|
1687
|
+
previewVisibility(r?: VisibilityPreviewRequest): Promise<VisibilityPreviewResponse>;
|
|
1319
1688
|
getDriverMetadataUpdate(): Promise<DriverMetadataUpdateView>;
|
|
1320
1689
|
setDriverMetadataUpdate(r: DriverMetadataUpdateSetReq): Promise<DriverMetadataUpdateSetResponse>;
|
|
1321
1690
|
}
|
|
1322
1691
|
export declare function decisionRequirements(request: Pick<DecisionEvaluateRequest, 'state' | 'questions'>): ModelRequirement;
|
|
1323
1692
|
export declare function validateDecisionRequest(request: DecisionEvaluateRequest): void;
|
|
1324
1693
|
export declare function validateDecisionAnswers(request: DecisionEvaluateRequest, answers: DecisionAnswer[]): void;
|
|
1694
|
+
export type VideoPromptSegment = {
|
|
1695
|
+
text: string;
|
|
1696
|
+
} | {
|
|
1697
|
+
reference: string;
|
|
1698
|
+
};
|
|
1699
|
+
/** Splits a prompt into text and `@{id}` references; `@@` is a literal `@`, any other `@` stays as written. */
|
|
1700
|
+
export declare function parseVideoPrompt(prompt: string): VideoPromptSegment[];
|
|
1701
|
+
export declare function validateVideoOutput(output: unknown, field?: string): asserts output is VideoOutputSpec;
|
|
1702
|
+
/** Client-side check of the `video.generate` / `helper.video_generate` body, matching the server's validation. */
|
|
1703
|
+
export declare function validateVideoGeneration(request: VideoGenerationFields): void;
|
|
1704
|
+
export declare function validateVideoEdit(request: VideoEditRequest): void;
|
|
1705
|
+
/** The model requirement a video request implies, merged with a helper's `requirements.video` (which can only tighten it). */
|
|
1706
|
+
export declare function videoGenerationRequirement(request: VideoGenerationFields & {
|
|
1707
|
+
requirements?: HelperModelRequirement;
|
|
1708
|
+
}): VideoGenerationRequirement;
|
|
1325
1709
|
export {};
|
|
1326
1710
|
//# sourceMappingURL=aicc_client.d.ts.map
|