@southwind-ai/shared 0.2.3 → 0.2.4
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/index.ts +3 -0
- package/package.json +1 -1
- package/src/ai-runtime-report.ts +134 -0
- package/src/platform-settings.ts +17 -0
package/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./src/audit.js";
|
|
2
|
+
// @windy-module system.agent begin
|
|
3
|
+
export * from "./src/ai-runtime-report.js";
|
|
4
|
+
// @windy-module system.agent end
|
|
2
5
|
export * from "./src/database.js";
|
|
3
6
|
export * from "./src/data-governance.js";
|
|
4
7
|
export * from "./src/feature.js";
|
package/package.json
CHANGED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ISODateTime, PageResult } from "./primitives.js";
|
|
2
|
+
|
|
3
|
+
export type AiRuntimeReportRange = "day" | "month" | "retained";
|
|
4
|
+
export type AiRuntimeRunStatus =
|
|
5
|
+
| "accepted"
|
|
6
|
+
| "running"
|
|
7
|
+
| "awaiting-approval"
|
|
8
|
+
| "completed"
|
|
9
|
+
| "failed"
|
|
10
|
+
| "cancelled";
|
|
11
|
+
export type AiRuntimeAttemptOutcome =
|
|
12
|
+
| "running"
|
|
13
|
+
| "completed"
|
|
14
|
+
| "failed"
|
|
15
|
+
| "cancelled"
|
|
16
|
+
| "blocked"
|
|
17
|
+
| "abandoned";
|
|
18
|
+
export type AiRuntimeCacheStatus = "hit" | "miss" | "unknown";
|
|
19
|
+
export type AiRuntimeUsageSource =
|
|
20
|
+
| "provider-reported"
|
|
21
|
+
| "estimated"
|
|
22
|
+
| "unknown";
|
|
23
|
+
|
|
24
|
+
export interface AiRuntimeRunCounts {
|
|
25
|
+
total: number;
|
|
26
|
+
completed: number;
|
|
27
|
+
failed: number;
|
|
28
|
+
cancelled: number;
|
|
29
|
+
inProgress: number;
|
|
30
|
+
successRate: number | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface AiRuntimeCacheSummary {
|
|
34
|
+
hit: number;
|
|
35
|
+
miss: number;
|
|
36
|
+
unknown: number;
|
|
37
|
+
hitRate: number | null;
|
|
38
|
+
tokenRate: number | null;
|
|
39
|
+
coverageRate: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface AiRuntimeTokenSummary {
|
|
43
|
+
input: number | null;
|
|
44
|
+
output: number | null;
|
|
45
|
+
cachedInput: number | null;
|
|
46
|
+
reasoning: number | null;
|
|
47
|
+
total: number | null;
|
|
48
|
+
coverageRate: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface AiRuntimeModelUsageSummary {
|
|
52
|
+
deploymentKey: string;
|
|
53
|
+
model: string;
|
|
54
|
+
attempts: number;
|
|
55
|
+
inputTokens: number | null;
|
|
56
|
+
outputTokens: number | null;
|
|
57
|
+
cachedInputTokens: number | null;
|
|
58
|
+
reasoningTokens: number | null;
|
|
59
|
+
totalTokens: number | null;
|
|
60
|
+
unknownUsageCount: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface AiRuntimeActivityPoint {
|
|
64
|
+
date: string;
|
|
65
|
+
runs: number;
|
|
66
|
+
completed: number;
|
|
67
|
+
failed: number;
|
|
68
|
+
totalTokens: number | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface AiRuntimeReportSummary {
|
|
72
|
+
generatedAt: ISODateTime;
|
|
73
|
+
reportingAvailableFrom: ISODateTime | null;
|
|
74
|
+
retentionDays: number;
|
|
75
|
+
runs: AiRuntimeRunCounts;
|
|
76
|
+
cache: AiRuntimeCacheSummary;
|
|
77
|
+
tokens: AiRuntimeTokenSummary;
|
|
78
|
+
byModel: AiRuntimeModelUsageSummary[];
|
|
79
|
+
activity: AiRuntimeActivityPoint[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface AiRuntimeActorSummary {
|
|
83
|
+
handle: string;
|
|
84
|
+
displayName: string;
|
|
85
|
+
username?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AiRuntimeRunUsage {
|
|
89
|
+
inputTokens: number | null;
|
|
90
|
+
outputTokens: number | null;
|
|
91
|
+
cachedInputTokens: number | null;
|
|
92
|
+
reasoningTokens: number | null;
|
|
93
|
+
totalTokens: number | null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface AiRuntimeRunListItem {
|
|
97
|
+
runId: string;
|
|
98
|
+
operationKey: string;
|
|
99
|
+
actor: AiRuntimeActorSummary | null;
|
|
100
|
+
status: AiRuntimeRunStatus;
|
|
101
|
+
startedAt: ISODateTime | null;
|
|
102
|
+
finishedAt: ISODateTime | null;
|
|
103
|
+
durationMs: number | null;
|
|
104
|
+
attemptCount: number;
|
|
105
|
+
models: string[];
|
|
106
|
+
cacheStatus: AiRuntimeCacheStatus;
|
|
107
|
+
usage: AiRuntimeRunUsage;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface AiRuntimeAttemptDetail extends AiRuntimeRunUsage {
|
|
111
|
+
attemptId: string;
|
|
112
|
+
sequence: number;
|
|
113
|
+
toolRound: number;
|
|
114
|
+
deploymentKey: string;
|
|
115
|
+
model: string;
|
|
116
|
+
outcome: AiRuntimeAttemptOutcome;
|
|
117
|
+
cacheStatus: AiRuntimeCacheStatus;
|
|
118
|
+
usageSource: AiRuntimeUsageSource;
|
|
119
|
+
firstTokenLatencyMs: number | null;
|
|
120
|
+
durationMs: number | null;
|
|
121
|
+
safeErrorCode: string | null;
|
|
122
|
+
startedAt: ISODateTime;
|
|
123
|
+
finishedAt: ISODateTime | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface AiRuntimeRunDetail extends AiRuntimeRunListItem {
|
|
127
|
+
releaseId: string;
|
|
128
|
+
traceId: string;
|
|
129
|
+
safeErrorCode: string | null;
|
|
130
|
+
attempts: AiRuntimeAttemptDetail[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type AiRuntimeRunPage = PageResult<AiRuntimeRunListItem>;
|
|
134
|
+
export type AiRuntimeActorPage = PageResult<AiRuntimeActorSummary>;
|
package/src/platform-settings.ts
CHANGED
|
@@ -18,12 +18,27 @@ export const WATERMARK_CONTENT_FIELDS = [
|
|
|
18
18
|
] as const;
|
|
19
19
|
export type WatermarkContentField = (typeof WATERMARK_CONTENT_FIELDS)[number];
|
|
20
20
|
|
|
21
|
+
export const WATERMARK_OPACITY_RANGE = {
|
|
22
|
+
min: 3,
|
|
23
|
+
max: 30,
|
|
24
|
+
step: 1,
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const WATERMARK_FONT_SIZE_RANGE = {
|
|
28
|
+
min: 12,
|
|
29
|
+
max: 32,
|
|
30
|
+
step: 1,
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
21
33
|
export interface PlatformWatermarkPolicy {
|
|
22
34
|
enabled: boolean;
|
|
35
|
+
/** @deprecated 升级兼容字段,始终与 enabled 保持一致。 */
|
|
23
36
|
businessPagesEnabled: boolean;
|
|
24
37
|
density: WatermarkDensity;
|
|
25
38
|
contentFields: WatermarkContentField[];
|
|
26
39
|
customContent: string;
|
|
40
|
+
opacityPercent: number;
|
|
41
|
+
fontSize: number;
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
export const DEFAULT_PLATFORM_WATERMARK_POLICY: Readonly<PlatformWatermarkPolicy> =
|
|
@@ -33,4 +48,6 @@ export const DEFAULT_PLATFORM_WATERMARK_POLICY: Readonly<PlatformWatermarkPolicy
|
|
|
33
48
|
density: "medium",
|
|
34
49
|
contentFields: ["username", "displayName"],
|
|
35
50
|
customContent: "",
|
|
51
|
+
opacityPercent: 8,
|
|
52
|
+
fontSize: 14,
|
|
36
53
|
};
|