@arcships/aimux 0.2.1 → 0.5.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/error.d.ts +139 -0
- package/dist/error.js +114 -0
- package/dist/index.d.ts +162 -8
- package/dist/index.js +334 -28
- package/dist/native.d.ts +2 -0
- package/dist/native.js +46 -0
- package/dist/types/AiMuxError.d.ts +45 -13
- package/dist/types/AiMuxError.js +0 -1
- package/dist/types/ApiCallError.d.ts +75 -0
- package/dist/types/ApiCallError.js +2 -0
- package/dist/types/BreakKind.d.ts +1 -0
- package/dist/types/BreakKind.js +3 -0
- package/dist/types/CallOptions.d.ts +28 -2
- package/dist/types/CatalogueSource.d.ts +4 -0
- package/dist/types/CatalogueSource.js +3 -0
- package/dist/types/ChatCompletion.d.ts +16 -0
- package/dist/types/ChatCompletion.js +2 -0
- package/dist/types/ChatCompletionChoice.d.ts +8 -0
- package/dist/types/ChatCompletionChoice.js +2 -0
- package/dist/types/ChatCompletionChunk.d.ts +15 -0
- package/dist/types/ChatCompletionChunk.js +2 -0
- package/dist/types/ChatCompletionChunkChoice.d.ts +8 -0
- package/dist/types/ChatCompletionChunkChoice.js +2 -0
- package/dist/types/ChatCompletionChunkFunction.d.ts +4 -0
- package/dist/types/ChatCompletionChunkFunction.js +3 -0
- package/dist/types/ChatCompletionChunkToolCall.d.ts +7 -0
- package/dist/types/ChatCompletionChunkToolCall.js +2 -0
- package/dist/types/ChatCompletionDelta.d.ts +7 -0
- package/dist/types/ChatCompletionDelta.js +2 -0
- package/dist/types/ChatCompletionFunction.d.ts +4 -0
- package/dist/types/ChatCompletionFunction.js +3 -0
- package/dist/types/ChatCompletionMessage.d.ts +9 -0
- package/dist/types/ChatCompletionMessage.js +2 -0
- package/dist/types/ChatCompletionToolCall.d.ts +6 -0
- package/dist/types/ChatCompletionToolCall.js +2 -0
- package/dist/types/ChatCompletionUsage.d.ts +9 -0
- package/dist/types/ChatCompletionUsage.js +2 -0
- package/dist/types/CompletionTokensDetails.d.ts +3 -0
- package/dist/types/CompletionTokensDetails.js +3 -0
- package/dist/types/ContentPart.d.ts +6 -0
- package/dist/types/EmbeddingCallOptions.d.ts +9 -0
- package/dist/types/FilePart.d.ts +8 -0
- package/dist/types/FilePart.js +2 -0
- package/dist/types/Fingerprint.d.ts +21 -0
- package/dist/types/Fingerprint.js +3 -0
- package/dist/types/GenerateContent.d.ts +12 -1
- package/dist/types/GenerateObjectResult.d.ts +48 -0
- package/dist/types/GenerateObjectResult.js +2 -0
- package/dist/types/GenerateTextOptions.d.ts +12 -1
- package/dist/types/GenerateTextResult.d.ts +47 -0
- package/dist/types/HttpExchange.d.ts +34 -0
- package/dist/types/HttpExchange.js +2 -0
- package/dist/types/HttpRecord.d.ts +12 -0
- package/dist/types/HttpRecord.js +3 -0
- package/dist/types/ImageCallOptions.d.ts +10 -1
- package/dist/types/InputRecord.d.ts +16 -0
- package/dist/types/InputRecord.js +2 -0
- package/dist/types/Modality.d.ts +4 -0
- package/dist/types/Modality.js +3 -0
- package/dist/types/ModelCapabilities.d.ts +21 -0
- package/dist/types/ModelCapabilities.js +3 -0
- package/dist/types/ModelCost.d.ts +10 -0
- package/dist/types/ModelCost.js +3 -0
- package/dist/types/ModelLimits.d.ts +17 -0
- package/dist/types/ModelLimits.js +3 -0
- package/dist/types/ModelModalities.d.ts +8 -0
- package/dist/types/ModelModalities.js +2 -0
- package/dist/types/ModelSpec.d.ts +33 -0
- package/dist/types/ModelSpec.js +2 -0
- package/dist/types/ModelType.d.ts +4 -0
- package/dist/types/ModelType.js +3 -0
- package/dist/types/OutcomeRecord.d.ts +19 -0
- package/dist/types/OutcomeRecord.js +2 -0
- package/dist/types/OutcomeStatus.d.ts +4 -0
- package/dist/types/OutcomeStatus.js +3 -0
- package/dist/types/PrefixBreak.d.ts +11 -0
- package/dist/types/PrefixBreak.js +2 -0
- package/dist/types/PromptTokensDetails.d.ts +4 -0
- package/dist/types/PromptTokensDetails.js +3 -0
- package/dist/types/ProviderAuditSpec.d.ts +33 -0
- package/dist/types/ProviderAuditSpec.js +2 -0
- package/dist/types/ProviderFamily.d.ts +5 -0
- package/dist/types/ProviderFamily.js +3 -0
- package/dist/types/ProviderRecord.d.ts +30 -0
- package/dist/types/ProviderRecord.js +2 -0
- package/dist/types/RawToolCall.d.ts +16 -0
- package/dist/types/RawToolCall.js +2 -0
- package/dist/types/ReasoningMode.d.ts +4 -0
- package/dist/types/ReasoningMode.js +3 -0
- package/dist/types/ReasoningPart.d.ts +9 -0
- package/dist/types/ReasoningPart.js +3 -0
- package/dist/types/ReasoningSpec.d.ts +39 -0
- package/dist/types/ReasoningSpec.js +2 -0
- package/dist/types/ReasoningVisibility.d.ts +4 -0
- package/dist/types/ReasoningVisibility.js +3 -0
- package/dist/types/Recording.d.ts +56 -0
- package/dist/types/Recording.js +2 -0
- package/dist/types/RequestCacheHints.d.ts +9 -0
- package/dist/types/RequestCacheHints.js +3 -0
- package/dist/types/RerankingCallOptions.d.ts +9 -0
- package/dist/types/ResponseRecord.d.ts +13 -0
- package/dist/types/ResponseRecord.js +3 -0
- package/dist/types/RetryError.d.ts +9 -0
- package/dist/types/RetryError.js +2 -0
- package/dist/types/RetryErrorReason.d.ts +4 -0
- package/dist/types/RetryErrorReason.js +3 -0
- package/dist/types/RuntimeModel.d.ts +22 -0
- package/dist/types/RuntimeModel.js +3 -0
- package/dist/types/SearchCallOptions.d.ts +9 -0
- package/dist/types/SessionCall.d.ts +20 -0
- package/dist/types/SessionCall.js +3 -0
- package/dist/types/SessionChainView.d.ts +10 -0
- package/dist/types/SessionChainView.js +2 -0
- package/dist/types/SessionSource.d.ts +4 -0
- package/dist/types/SessionSource.js +3 -0
- package/dist/types/SessionStepStat.d.ts +27 -0
- package/dist/types/SessionStepStat.js +2 -0
- package/dist/types/SessionView.d.ts +16 -0
- package/dist/types/SessionView.js +2 -0
- package/dist/types/SourcePart.d.ts +9 -0
- package/dist/types/SourcePart.js +3 -0
- package/dist/types/SpeechCallOptions.d.ts +9 -0
- package/dist/types/StreamPart.d.ts +12 -0
- package/dist/types/StreamTextResultAggregated.d.ts +74 -0
- package/dist/types/StreamTextResultAggregated.js +2 -0
- package/dist/types/TimeoutConfiguration.d.ts +19 -0
- package/dist/types/TimeoutConfiguration.js +1 -0
- package/dist/types/TimingRecord.d.ts +7 -0
- package/dist/types/TimingRecord.js +3 -0
- package/dist/types/ToolCall.d.ts +16 -1
- package/dist/types/ToolCallRepairReply.d.ts +19 -0
- package/dist/types/ToolCallRepairReply.js +2 -0
- package/dist/types/TraceFilter.d.ts +9 -0
- package/dist/types/TraceFilter.js +3 -0
- package/dist/types/TraceRecord.d.ts +54 -0
- package/dist/types/TraceRecord.js +2 -0
- package/dist/types/TraceStats.d.ts +20 -0
- package/dist/types/TraceStats.js +3 -0
- package/dist/types/TranscriptionCallOptions.d.ts +38 -0
- package/dist/types/TranscriptionCallOptions.js +2 -0
- package/dist/types/TranscriptionRequest.d.ts +9 -0
- package/dist/types/TranscriptionRequest.js +3 -0
- package/dist/types/TranscriptionResponse.d.ts +24 -0
- package/dist/types/TranscriptionResponse.js +2 -0
- package/dist/types/TranscriptionResult.d.ts +46 -0
- package/dist/types/TranscriptionResult.js +2 -0
- package/dist/types/TranscriptionSegment.d.ts +17 -0
- package/dist/types/TranscriptionSegment.js +3 -0
- package/dist/types/TranscriptionStreamPart.d.ts +70 -0
- package/dist/types/TranscriptionStreamPart.js +2 -0
- package/dist/types/UsageSnapshot.d.ts +18 -0
- package/dist/types/UsageSnapshot.js +2 -0
- package/dist/types/Verdict.d.ts +23 -0
- package/dist/types/Verdict.js +2 -0
- package/dist/types/VerdictConfidence.d.ts +4 -0
- package/dist/types/VerdictConfidence.js +3 -0
- package/dist/types/VerdictKind.d.ts +4 -0
- package/dist/types/VerdictKind.js +3 -0
- package/dist/types/VideoCallOptions.d.ts +17 -2
- package/dist/types/VideoPollOptions.d.ts +13 -0
- package/dist/types/VideoPollOptions.js +3 -0
- package/dist/types/VideoResult.d.ts +1 -1
- package/dist/types.d.ts +71 -1
- package/dist/types.js +3 -3
- package/index.d.ts +332 -25
- package/index.js +77 -54
- package/package.json +13 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token / request limits for a model.
|
|
3
|
+
*/
|
|
4
|
+
export type ModelLimits = {
|
|
5
|
+
/**
|
|
6
|
+
* Maximum total context window (input + output), in tokens.
|
|
7
|
+
*/
|
|
8
|
+
context?: number | null;
|
|
9
|
+
/**
|
|
10
|
+
* Maximum output tokens.
|
|
11
|
+
*/
|
|
12
|
+
output?: number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum input tokens (when distinct from `context`).
|
|
15
|
+
*/
|
|
16
|
+
input?: number | null;
|
|
17
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CatalogueSource } from "./CatalogueSource";
|
|
2
|
+
import type { ModelCapabilities } from "./ModelCapabilities";
|
|
3
|
+
import type { ModelCost } from "./ModelCost";
|
|
4
|
+
import type { ModelLimits } from "./ModelLimits";
|
|
5
|
+
import type { ModelModalities } from "./ModelModalities";
|
|
6
|
+
import type { ModelType } from "./ModelType";
|
|
7
|
+
import type { ReasoningSpec } from "./ReasoningSpec";
|
|
8
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
9
|
+
/**
|
|
10
|
+
* The full static portrait for a model, supplemented from community knowledge.
|
|
11
|
+
*
|
|
12
|
+
* All fields are advisory — aimux never auto-applies them in the request path.
|
|
13
|
+
* The caller reads them to decide how to configure `GenerateTextOptions` /
|
|
14
|
+
* `bodyOverrides`.
|
|
15
|
+
*/
|
|
16
|
+
export type ModelSpec = {
|
|
17
|
+
display_name?: string | null;
|
|
18
|
+
type: ModelType;
|
|
19
|
+
limits: ModelLimits;
|
|
20
|
+
modalities: ModelModalities;
|
|
21
|
+
capabilities: ModelCapabilities;
|
|
22
|
+
reasoning?: ReasoningSpec | null;
|
|
23
|
+
cost?: ModelCost | null;
|
|
24
|
+
source: CatalogueSource;
|
|
25
|
+
/**
|
|
26
|
+
* Provider name (normalized to aimux registry spelling).
|
|
27
|
+
*/
|
|
28
|
+
provider?: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Verbatim source entry, preserved for forward compatibility / debugging.
|
|
31
|
+
*/
|
|
32
|
+
raw?: JsonValue | null;
|
|
33
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OutcomeStatus } from "./OutcomeStatus";
|
|
2
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
3
|
+
/**
|
|
4
|
+
* 最终结果摘要。
|
|
5
|
+
*/
|
|
6
|
+
export type OutcomeRecord = {
|
|
7
|
+
status: OutcomeStatus;
|
|
8
|
+
finish_reason: string | null;
|
|
9
|
+
error: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Lossless structured domain error. In particular, `RetryError.errors`
|
|
12
|
+
* keeps the complete attempt history rather than only its display text.
|
|
13
|
+
*/
|
|
14
|
+
error_value: JsonValue | null;
|
|
15
|
+
/**
|
|
16
|
+
* 序列化的 Usage。
|
|
17
|
+
*/
|
|
18
|
+
usage: JsonValue | null;
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BreakKind } from "./BreakKind";
|
|
2
|
+
/**
|
|
3
|
+
* A prefix break between two consecutive records of a session.
|
|
4
|
+
*/
|
|
5
|
+
export type PrefixBreak = {
|
|
6
|
+
at_record_id: string;
|
|
7
|
+
prev_record_id: string;
|
|
8
|
+
lcp_bytes: bigint;
|
|
9
|
+
expected_break: boolean;
|
|
10
|
+
kind: BreakKind;
|
|
11
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ProviderFamily } from "./ProviderFamily";
|
|
2
|
+
/**
|
|
3
|
+
* Provider audit parameters (RFC-0015 §7 matrix — the part that lives in
|
|
4
|
+
* core; display logic belongs to the CLI).
|
|
5
|
+
*/
|
|
6
|
+
export type ProviderAuditSpec = {
|
|
7
|
+
/**
|
|
8
|
+
* Provider family for family-specific invariants.
|
|
9
|
+
*/
|
|
10
|
+
family: ProviderFamily;
|
|
11
|
+
/**
|
|
12
|
+
* Token quantization granularity; `None` = no quantization.
|
|
13
|
+
*/
|
|
14
|
+
gran: bigint | null;
|
|
15
|
+
/**
|
|
16
|
+
* Minimum cache threshold (tokens): below it `claimed` must be 0.
|
|
17
|
+
*/
|
|
18
|
+
threshold: bigint;
|
|
19
|
+
/**
|
|
20
|
+
* TTL_idle (ms), conservative upper bound.
|
|
21
|
+
*/
|
|
22
|
+
ttl_ms: bigint;
|
|
23
|
+
/**
|
|
24
|
+
* gpt-5.6+ semantics (no quantization, implicit-breakpoint whitelist,
|
|
25
|
+
* write/read equality).
|
|
26
|
+
*/
|
|
27
|
+
model56plus: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Claimed-hit ceiling: above this multiple of the client upper bound
|
|
30
|
+
* the verdict is overclaim (W) even in shared mode. `None` = use U+τ.
|
|
31
|
+
*/
|
|
32
|
+
shared_ceiling_mult: number | null;
|
|
33
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* ② 配置侧:provider 身份(请求回放重建用)。
|
|
4
|
+
*/
|
|
5
|
+
export type ProviderRecord = {
|
|
6
|
+
/**
|
|
7
|
+
* `model.provider()`,如 "openai"。
|
|
8
|
+
*/
|
|
9
|
+
provider: string;
|
|
10
|
+
/**
|
|
11
|
+
* `model.model_id()`,如 "gpt-4o"。
|
|
12
|
+
*/
|
|
13
|
+
model_id: string;
|
|
14
|
+
/**
|
|
15
|
+
* provider 的 base_url。
|
|
16
|
+
*/
|
|
17
|
+
base_url: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* api_key 来源(不存明文):"env:OPENAI_API_KEY" / "explicit" / "none" / "unknown"。
|
|
20
|
+
*/
|
|
21
|
+
api_key_source: string;
|
|
22
|
+
/**
|
|
23
|
+
* OpenAICompatProfile(能力差异)。
|
|
24
|
+
*/
|
|
25
|
+
profile: JsonValue | null;
|
|
26
|
+
/**
|
|
27
|
+
* ProviderOptions(headers/org/project/...;已脱敏)。
|
|
28
|
+
*/
|
|
29
|
+
provider_options: JsonValue | null;
|
|
30
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
|
+
/**
|
|
3
|
+
* Provider-facing tool call before Core parses and validates its input.
|
|
4
|
+
*
|
|
5
|
+
* The wire shape matches [`ToolCall`] field for field, except that `input`
|
|
6
|
+
* is the provider's raw argument *text* rather than a parsed value.
|
|
7
|
+
*/
|
|
8
|
+
export type RawToolCall = {
|
|
9
|
+
tool_call_id: string;
|
|
10
|
+
tool_name: string;
|
|
11
|
+
input: string;
|
|
12
|
+
provider_executed?: boolean | null;
|
|
13
|
+
dynamic?: boolean | null;
|
|
14
|
+
thought_signature?: string | null;
|
|
15
|
+
provider_metadata?: JsonValue | null;
|
|
16
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReasoningMode } from "./ReasoningMode";
|
|
2
|
+
import type { ReasoningVisibility } from "./ReasoningVisibility";
|
|
3
|
+
/**
|
|
4
|
+
* Reasoning / thinking portrait for a model (advisory).
|
|
5
|
+
*/
|
|
6
|
+
export type ReasoningSpec = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the model family supports reasoning at all.
|
|
9
|
+
*/
|
|
10
|
+
supported: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether reasoning should be on by default.
|
|
13
|
+
*/
|
|
14
|
+
default_enabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Primary control mode.
|
|
17
|
+
*/
|
|
18
|
+
mode: ReasoningMode | null;
|
|
19
|
+
/**
|
|
20
|
+
* Default effort level (when `mode` is Effort/Mixed).
|
|
21
|
+
*/
|
|
22
|
+
effort_default?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Supported effort levels.
|
|
25
|
+
*/
|
|
26
|
+
effort_options?: Array<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Minimum token budget (when `mode` is Budget/Mixed).
|
|
29
|
+
*/
|
|
30
|
+
budget_min?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* Interleaved reasoning (thinking blocks between tool calls).
|
|
33
|
+
*/
|
|
34
|
+
interleaved: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Output visibility.
|
|
37
|
+
*/
|
|
38
|
+
visibility: ReasoningVisibility | null;
|
|
39
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { HttpExchange } from "./HttpExchange";
|
|
2
|
+
import type { InputRecord } from "./InputRecord";
|
|
3
|
+
import type { OutcomeRecord } from "./OutcomeRecord";
|
|
4
|
+
import type { ProviderRecord } from "./ProviderRecord";
|
|
5
|
+
/**
|
|
6
|
+
* 一次完整调用的录制记录(三层 + call_id 关联)。
|
|
7
|
+
*/
|
|
8
|
+
export type Recording = {
|
|
9
|
+
/**
|
|
10
|
+
* 格式版本。
|
|
11
|
+
*/
|
|
12
|
+
schema: number;
|
|
13
|
+
/**
|
|
14
|
+
* 暴露逻辑调用 ID,关联三层。
|
|
15
|
+
*/
|
|
16
|
+
call_id: string;
|
|
17
|
+
/**
|
|
18
|
+
* ISO 8601 时间戳。
|
|
19
|
+
*/
|
|
20
|
+
recorded_at: string;
|
|
21
|
+
/**
|
|
22
|
+
* ① 输入侧:调用参数(prompt + options)。
|
|
23
|
+
*/
|
|
24
|
+
input: InputRecord;
|
|
25
|
+
/**
|
|
26
|
+
* ② 配置侧:provider 身份与配置。
|
|
27
|
+
*/
|
|
28
|
+
provider: ProviderRecord;
|
|
29
|
+
/**
|
|
30
|
+
* ③ HTTP 侧:实际 wire 交换(per-attempt 一条)。
|
|
31
|
+
*/
|
|
32
|
+
exchanges: Array<HttpExchange>;
|
|
33
|
+
/**
|
|
34
|
+
* 最终结果摘要(状态 + finish_reason + usage)。
|
|
35
|
+
*/
|
|
36
|
+
outcome: OutcomeRecord;
|
|
37
|
+
/**
|
|
38
|
+
* wire 是否完整(流式 body 未补全时为 false;由 writer 标记)。
|
|
39
|
+
*/
|
|
40
|
+
complete: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 传输层封闭信号:层 B 声明"不再有 exchange"(P1:层 A 收尾自动发;
|
|
43
|
+
* P2:由层 B 发送)。false = 仍可能来 exchange(记录暂不可定稿)。
|
|
44
|
+
*/
|
|
45
|
+
transport_closed: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 会话归组(RFC-0024 P3):所在会话 id。None = 未归组(无 session_id 且
|
|
48
|
+
* 推断关闭)。由 `Recorder::record_session` 填充,写入 InputRecord 之前
|
|
49
|
+
* 或之后均可(writer 端按 call_id 合并)。
|
|
50
|
+
*/
|
|
51
|
+
session_id?: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* 会话内步号(0 起,由 SessionStore 分配)。与 `session_id` 同生命周期。
|
|
54
|
+
*/
|
|
55
|
+
step?: number | null;
|
|
56
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RerankingDocuments } from "./RerankingDocuments";
|
|
2
|
+
import type { TimeoutConfiguration } from "./TimeoutConfiguration";
|
|
2
3
|
import type { JsonValue } from "./serde_json/JsonValue";
|
|
3
4
|
/**
|
|
4
5
|
* Options passed to [`RerankingModel::do_rerank`].
|
|
@@ -18,6 +19,14 @@ export type RerankingCallOptions = {
|
|
|
18
19
|
* Optional limit: return only the top `n` documents.
|
|
19
20
|
*/
|
|
20
21
|
top_n: number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Per-call retry override. `None` uses the model default.
|
|
24
|
+
*/
|
|
25
|
+
max_retries: number | null;
|
|
26
|
+
/**
|
|
27
|
+
* Per-call operation timeout.
|
|
28
|
+
*/
|
|
29
|
+
timeout: TimeoutConfiguration | null;
|
|
21
30
|
/**
|
|
22
31
|
* Additional provider-specific options, keyed by provider name.
|
|
23
32
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AiMuxError } from "./AiMuxError";
|
|
2
|
+
import type { RetryErrorReason } from "./RetryErrorReason";
|
|
3
|
+
/**
|
|
4
|
+
* Complete error history for a retried model operation.
|
|
5
|
+
*/
|
|
6
|
+
export type RetryError = {
|
|
7
|
+
reason: RetryErrorReason;
|
|
8
|
+
errors: Array<AiMuxError>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model entry returned by a provider's `/models` endpoint (the sparse,
|
|
3
|
+
* account-level truth of "what this key can call").
|
|
4
|
+
*
|
|
5
|
+
* Carries only what the provider returns — typically just `id`. Configuration
|
|
6
|
+
* comes from [`ModelSpec`] (community knowledge); the host merges the two as
|
|
7
|
+
* needed (RFC-0027). aimux itself does not combine them.
|
|
8
|
+
*/
|
|
9
|
+
export type RuntimeModel = {
|
|
10
|
+
/**
|
|
11
|
+
* Model identifier, e.g. `"gpt-4o"`.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* `owned_by` field from OpenAI-compatible `/models` responses.
|
|
16
|
+
*/
|
|
17
|
+
owned_by?: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* `created` unix timestamp from OpenAI-compatible `/models` responses.
|
|
20
|
+
*/
|
|
21
|
+
created?: number | null;
|
|
22
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TimeoutConfiguration } from "./TimeoutConfiguration";
|
|
1
2
|
import type { JsonValue } from "./serde_json/JsonValue";
|
|
2
3
|
/**
|
|
3
4
|
* Options passed to [`SearchModel::do_search`].
|
|
@@ -31,6 +32,14 @@ export type SearchCallOptions = {
|
|
|
31
32
|
* Optional list of domains to exclude from results.
|
|
32
33
|
*/
|
|
33
34
|
exclude_domains: Array<string> | null;
|
|
35
|
+
/**
|
|
36
|
+
* Per-call retry override. `None` uses the model default.
|
|
37
|
+
*/
|
|
38
|
+
max_retries: number | null;
|
|
39
|
+
/**
|
|
40
|
+
* Per-call operation timeout.
|
|
41
|
+
*/
|
|
42
|
+
timeout: TimeoutConfiguration | null;
|
|
34
43
|
/**
|
|
35
44
|
* Additional provider-specific options, keyed by provider name.
|
|
36
45
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single call within a session (an index entry only — call content lives
|
|
3
|
+
* in Recording (RFC-0023) / TraceRecord (RFC-0015)).
|
|
4
|
+
*/
|
|
5
|
+
export type SessionCall = {
|
|
6
|
+
/**
|
|
7
|
+
* Call-level unique id. This is the association key for the future
|
|
8
|
+
* Recording / TraceRecord `call_id` (RFC-0015/0023): once those land,
|
|
9
|
+
* this field carries their value.
|
|
10
|
+
*/
|
|
11
|
+
call_id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Step within the session (0-based).
|
|
14
|
+
*/
|
|
15
|
+
step: number;
|
|
16
|
+
/**
|
|
17
|
+
* When the call was recorded (RFC 3339 UTC, millisecond precision).
|
|
18
|
+
*/
|
|
19
|
+
recorded_at: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PrefixBreak } from "./PrefixBreak";
|
|
2
|
+
/**
|
|
3
|
+
* Session chain view (append-only order + prefix stability, RFC-0015 §5.3).
|
|
4
|
+
*/
|
|
5
|
+
export type SessionChainView = {
|
|
6
|
+
session_id: string;
|
|
7
|
+
record_ids: Array<string>;
|
|
8
|
+
prefix_stability: number;
|
|
9
|
+
breaks: Array<PrefixBreak>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Verdict } from "./Verdict";
|
|
2
|
+
/**
|
|
3
|
+
* One step of a session's cache-hit trajectory (RFC-0024 §4.3).
|
|
4
|
+
*/
|
|
5
|
+
export type SessionStepStat = {
|
|
6
|
+
/**
|
|
7
|
+
* Step within the session (0-based, session order).
|
|
8
|
+
*/
|
|
9
|
+
step: number;
|
|
10
|
+
/**
|
|
11
|
+
* The call's id (association key into Recording / replay, RFC-0023).
|
|
12
|
+
*/
|
|
13
|
+
call_id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Reported hit rate for this step (`cache_read / input_total`); `None`
|
|
16
|
+
* when the call carried no input/cache-read usage.
|
|
17
|
+
*/
|
|
18
|
+
hit_rate?: number | null;
|
|
19
|
+
/**
|
|
20
|
+
* Audit verdict (present only when an auditor is attached).
|
|
21
|
+
*/
|
|
22
|
+
verdict?: Verdict | null;
|
|
23
|
+
/**
|
|
24
|
+
* Error string for failed calls (failures are part of the session).
|
|
25
|
+
*/
|
|
26
|
+
error?: string | null;
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SessionCall } from "./SessionCall";
|
|
2
|
+
import type { SessionSource } from "./SessionSource";
|
|
3
|
+
/**
|
|
4
|
+
* Aggregated view of one session (session_id → ordered calls).
|
|
5
|
+
*/
|
|
6
|
+
export type SessionView = {
|
|
7
|
+
session_id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Where the session id came from (first call's source).
|
|
10
|
+
*/
|
|
11
|
+
source: SessionSource;
|
|
12
|
+
/**
|
|
13
|
+
* Ordered calls (by step).
|
|
14
|
+
*/
|
|
15
|
+
calls: Array<SessionCall>;
|
|
16
|
+
};
|