@kanyun-ai-infra/agenthub 1.15.0 → 1.17.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/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  本文件从 1.12.0 开始记录;更早的版本见 git 历史中的 `chore(agenthub-sdk): release X.Y.Z` 提交。
4
4
 
5
+ ## 1.17.0
6
+
7
+ 浏览器实时语音入口 `@kanyun-ai-infra/agenthub/realtime`:终止错误带上网关终止码,新增默认关闭的自动重开,以及拉取式的音量电平。主入口的方法没有变化。
8
+
9
+ ### 新增(`@kanyun-ai-infra/agenthub/realtime`)
10
+
11
+ - `onError` 的 `RealtimeVoiceError` 新增可选 `gatewayCode`:网关终止通话时给出的码,只在 `GATEWAY_ERROR` 出口与 `REOPENING` 通知上出现。取值为 11 个终止码的闭集:`write_queue_full`、`control_timeout`、`control_rejected`、`generation_expired`、`upstream_unavailable`、`resume_store_unavailable`、`renew_rejected`、`execution_expired`、`no_response`、`renew_abandoned`、`realtime_turn_lost`;未知码不带该字段。`code` 仍是 `GATEWAY_ERROR`,按旧码分支的页面不用改。`retryable: true` 且已有通话 ID 的错误仍走自动接手,不落到这里;`no_response` 的可重试提示仍以 `NO_RESPONSE` 上报,不带 `gatewayCode`。
12
+ - 新选项 `reopenOnce`(默认 `false`):开启后,SDK 对「新通话还有机会」的终止错误自动重开一次——新票、新 WebSocket、新通话 ID,复用麦克风与 `AudioContext`,每次 `start()` 最多一次。重开前发一次 `onError({ code: "REOPENING", retryable: true, gatewayCode })`;重开后的通话再次终态按普通终态处理,不再重开。
13
+ - 可重开:`no_response`、`renew_abandoned`、`realtime_turn_lost`,以及 `ready` 之前到达的可重试 `upstream_unavailable`、`resume_store_unavailable`、`write_queue_full`、`control_timeout`、`control_rejected`。
14
+ - 不重开:`generation_expired`、`renew_rejected`、`execution_expired`(通话已被接管或执行许可到期)、`call_ended`、本地 `stop()`、未知码。
15
+ - 新方法 `audioLevels()`:返回 `RealtimeVoiceLevels { input, output }`,两侧都是最近 2048 个采样(48 kHz 下约 42.7 ms,采样率不同时时长随之变化)的线性 RMS,范围 [0, 1],不做平滑。`input` 是麦克风信号,`output` 是 SDK 播放出的信号,在 `outputNode` 之前取样:不传 `outputNode` 时即用户听到的声音;页面经 `outputNode` 再做增益或处理时,读数不含这部分处理。拉取式接口,页面在自己的 `requestAnimationFrame` 里调用,SDK 不新增定时器或回调。通话外与 `stop()` 之后返回 `undefined`;`ready` 之前与断线接手期间采集暂停,`input` 为 0。
16
+ - 新导出类型 `RealtimeVoiceLevels`。
17
+ - 电平分析节点串联在音频链路上:`source → 输入分析器 → worklet → 输出分析器 → outputNode/destination`。两个分析节点都是直通,送往网关的 PCM 与播放音频不变。
18
+
19
+ ### 随共享契约内联的变化
20
+
21
+ - 工作台与发布板读模型新增可选的 Revision 序号与版本串:`WorkbenchRecentChange` 的 `revisionVersion` / `revisionSequence`,槽位摘要(含灰度摘要)的 `revisionSequence`,以及 `ReleaseBoardRow.defaultRevision` / `latestRevision` 的 `sequence`。旧服务端的响应缺这些字段,解析行为不变。
22
+ - `Environment` 的 `envVars` 新增拒绝 `PILOT_WORKLOAD_SLUG` 的大小写变体(如 `pilot_workload_slug`),在 SDK 客户端校验时就报错;大写形式此前已被 `PILOT_` 前缀规则拒绝。会话配置值与 secret `envKey` 不受影响。
23
+
24
+ ### 随包文档
25
+
26
+ - `SKILL.md` 实时段补充音量电平、网关终止码与 `reopenOnce`。
27
+
28
+ ### 迁移说明
29
+
30
+ - **类型破坏**:`RealtimeVoiceClient` 新增了必选方法 `audioLevels()`。自己实现或 mock 这个接口的代码升级后会报类型错误,要补上该方法;通过 `createRealtimeVoiceClient` 工厂拿到的客户端不受影响。
31
+ - **音频接线变化**:麦克风源不再直接接 worklet,中间多了一个直通的分析节点。页面如果通过拦截 `AudioNode.prototype.connect`、按 `source → worklet` 这条连线识别上行的分接写法,升级后上行(麦克风)拿不到,下行照旧。正路是改用 `audioLevels()`。
32
+ - `reopenOnce` 默认关闭时,终止行为与 1.16.0 一致,只多一个 `gatewayCode` 字段。
33
+
34
+ ## 1.16.0
35
+
36
+ Revision 读面改为宽容读者:服务端给 `workloads.get` / `getRevision` / `getVersion` 的响应新增字段时,已发布的客户端不再报错。这一版同时接受可选的 `sequence`,服务端读面带出后即可读取,无需再次升级 SDK。
37
+
38
+ ### 新增与变化
39
+
40
+ - `PlatformRevision` 新增可选字段 `sequence`(正整数):每个 Agent(workload)内从 1 递增的人类可读版本序号,号可以不连续。当前服务端读面尚未返回该字段;在它上线前该字段恒为 `undefined`。
41
+ - `workloads.get` / `getRevision` / `getVersion` 的响应解析改为宽容读者:schema 未声明的字段被忽略(不报错,也不出现在结果里)。此前 revision 响应是 strict,服务端多一个字段就会让所有已发布客户端抛 `MALFORMED_PLATFORM_RESPONSE`。
42
+ - 请求 schema 不变:`publishRevision` / `applyRevisionManifest` 仍拒绝未知字段,行为与 1.15.0 相同。
43
+
44
+ ### 迁移说明
45
+
46
+ - 无需迁移。升级是可选的,用于获得对服务端后续新增响应字段的兼容性;`sequence` 在服务端读面上线前读不到。
47
+
5
48
  ## 1.15.0
6
49
 
7
50
  浏览器实时语音入口新增播放对齐、页面工具执行与播放输出节点;其余为随共享契约内联的变化。
package/README.md CHANGED
@@ -151,6 +151,11 @@ Agents 和 runtime templates 都是 **project-scoped**。Version 必须在同一
151
151
 
152
152
  > 本文一律用主词汇 **agent / version**;它们是底层 wire 名 `workload` / `revision`
153
153
  > 的别名,SDK 两套都接受,规范名与别名同传会抛 `ALIAS_CONFLICT`,细节见下方「完整参考」。
154
+ >
155
+ > 读面响应是**宽容读者**:`agents.get` / `getVersion` / `getRevision` 的响应出现 SDK
156
+ > 未声明的字段时会被忽略,不会报错;服务端新增字段不需要客户端升级。1.16.0 起
157
+ > `PlatformRevision` 接受可选的 `sequence`(每个 Agent 内从 1 递增的版本序号,号可
158
+ > 不连续);服务端读面返回它之前,该字段为 `undefined`。
154
159
 
155
160
  ## 记忆(agenthub.memories)
156
161
 
package/dist/index.cjs CHANGED
@@ -498,7 +498,8 @@ var EXECUTOR_FORMAT_REGISTRY = {
498
498
  // `declaredMcpTools` allowlist. approvals: none (`bypassPermissions`).
499
499
  capabilities: { resume: true, structuredOutput: false, toolFiltering: true, approvals: false },
500
500
  // Today's behaviour: Claude Code runs every model the platform offers.
501
- allowedModels: { kind: "any" }
501
+ allowedModels: { kind: "any" },
502
+ mcpMode: "native"
502
503
  },
503
504
  pi: {
504
505
  descriptor: { kind: "harness", adapterId: "pi", protocolVersion: "1" },
@@ -519,7 +520,10 @@ var EXECUTOR_FORMAT_REGISTRY = {
519
520
  },
520
521
  // Provisional until #3843 / #3670: no model family decided yet, so none
521
522
  // is offered (fails closed; pi is not publishable before then anyway).
522
- allowedModels: { kind: "idPrefixes", idPrefixes: [] }
523
+ allowedModels: { kind: "idPrefixes", idPrefixes: [] },
524
+ // Pi's MCP goes through managed MCP only (owner 2026-09-28): no rush
525
+ // direct references, no self-loaded MCP client extension.
526
+ mcpMode: "bridge"
523
527
  }
524
528
  };
525
529
  var ReservedExecutorValueSchema = import_zod5.z.never();
@@ -580,6 +584,10 @@ var RecordImageCapabilityDeclarationRequestSchema = import_zod5.z.object({
580
584
  declaration: ImageCapabilityDeclarationSchema,
581
585
  source: import_zod5.z.enum(IMAGE_CAPABILITY_DECLARATION_SOURCES)
582
586
  }).strict();
587
+ var FrozenSessionExecutorSchema = import_zod5.z.object({
588
+ format: import_zod5.z.string().min(1),
589
+ protocolVersion: import_zod5.z.string()
590
+ });
583
591
  var SESSION_ENVIRONMENT_OUTDATED = "SESSION_ENVIRONMENT_OUTDATED";
584
592
  var SessionEnvironmentOutdatedPayloadSchema = import_zod5.z.object({
585
593
  code: import_zod5.z.literal(SESSION_ENVIRONMENT_OUTDATED),
@@ -1549,7 +1557,16 @@ var ModelCallsPullResponseSchema = import_zod16.z.object({
1549
1557
  activeCalls: count(),
1550
1558
  sessionActiveCalls: count(),
1551
1559
  droppedRecords: count(),
1552
- truncated: import_zod16.z.boolean().optional()
1560
+ truncated: import_zod16.z.boolean().optional(),
1561
+ /**
1562
+ * Metering faults the pod-agent INSTANCE has swallowed so far (not scoped to
1563
+ * the session or query: pre-warm and earlier sessions count too).
1564
+ * `observer` = the store's own guard caught a throw; `hook` = the
1565
+ * forwarder's fail-open wrapper caught one (at most one per call). pod-agent
1566
+ * console logs never reach Octopus, so the host's sweep turns an increase
1567
+ * into a worker-side warn. Absent from an older pod-agent.
1568
+ */
1569
+ meteringFaults: import_zod16.z.object({ observer: count(), hook: count() }).optional()
1553
1570
  });
1554
1571
  var ModelCallsBlockSchema = import_zod16.z.object({
1555
1572
  accounting: label(),
@@ -3019,6 +3036,7 @@ var PROTECTED_WORKER_ENV_KEYS = /* @__PURE__ */ new Set([
3019
3036
  "PILOT_RUNTIME_BINDING_ID",
3020
3037
  "PILOT_STAGE",
3021
3038
  "PILOT_WORKLOAD_ID",
3039
+ "PILOT_WORKLOAD_SLUG",
3022
3040
  "PILOT_WORKSPACE_SNAPSHOT",
3023
3041
  // Managed-agent prewarming — seed toolbox, projected via the typed startWorker
3024
3042
  // request, never via business env.
@@ -3472,7 +3490,18 @@ var PodAgentStartWorkerRequestSchema = import_zod10.z.object({
3472
3490
  * Strict `z.string().uuid()` rejects it (version nibble 0) and rejected every
3473
3491
  * such start request at the pre-flight check in control-worker.
3474
3492
  */
3475
- projectId: import_zod10.z.union([import_zod10.z.string().uuid(), import_zod10.z.literal(PLATFORM_DEFAULT_PROJECT_ID)]).optional()
3493
+ projectId: import_zod10.z.union([import_zod10.z.string().uuid(), import_zod10.z.literal(PLATFORM_DEFAULT_PROJECT_ID)]).optional(),
3494
+ /**
3495
+ * Observability provenance (obs sandbox inject) — the workload's human-readable
3496
+ * slug (`workloads.slug`, unique within the owner project), forwarded into the
3497
+ * spawned child as `PILOT_WORKLOAD_SLUG` for the `pilot.workload_slug` OTel
3498
+ * resource attribute (Octopus LLM-dashboard agent dimension). control-plane
3499
+ * resolves it from the `workloads` catalog at `startWorker` time, alongside
3500
+ * `projectId`. Optional — omitted → pod-agent omits the env var. Injected ONLY
3501
+ * via this typed field, never via user `env` (guarded by
3502
+ * `PROTECTED_WORKER_ENV_KEYS` → `PILOT_WORKLOAD_SLUG`).
3503
+ */
3504
+ agentSlug: import_zod10.z.string().min(1).max(100).optional()
3476
3505
  // NOTE: `agentWorkerBundleUrl` (v2 hot-deploy) was REMOVED here — #1070 P2
3477
3506
  // retired the OSS bundle path; agent-worker is now baked into the sandbox
3478
3507
  // image and pod-agent always spawns the baked dist. This schema keeps zod's
@@ -4158,6 +4187,24 @@ var WorkloadManifestErrorCodeSchema = import_zod4.z.enum([
4158
4187
  // the `statusForManifestError` default) and additive-widening note as the
4159
4188
  // four codes above.
4160
4189
  "EXECUTOR_NOT_APPLICABLE_TO_LIVE",
4190
+ // HX-T7 (spec `pilot-v2-executor-host-contract.md` §6): a bridge-mode
4191
+ // executor's Revision whose frozen snapshot carries a non-platform MCP
4192
+ // source (rush `enabledMcpServers`). The bridge never connects those
4193
+ // entries, so publishing would silently drop them; the remediation is
4194
+ // managed MCP. Thrown by `applyRevisionManifest` (400, the
4195
+ // `statusForManifestError` default) and by the stage-binding gate (422,
4196
+ // control-plane `WorkloadStageServiceErrorCode`). Additive widening = patch.
4197
+ "EXECUTOR_NON_PLATFORM_MCP_UNSUPPORTED",
4198
+ // EXP-1c (spec `pilot-v2-executor-identity.md` §3, #3668 D6a): the merged,
4199
+ // normalised executor format's registry entry declares a worker contract
4200
+ // kind the Revision does not match (today every entry declares
4201
+ // `managed_agent`, so this fires on a `self_managed` Revision that
4202
+ // inherits a non-default executor — the revision-level snapshot key is
4203
+ // schema-blocked for self_managed, so the reachable channel is workload
4204
+ // `spec.defaults.executor` inheritance). Thrown by `applyRevisionManifest`
4205
+ // (400, the `statusForManifestError` default), judged in
4206
+ // `assertExecutorPublishGate` after EXP-1. Additive widening = patch.
4207
+ "EXECUTOR_NOT_APPLICABLE_TO_SELF_MANAGED",
4161
4208
  // `format: live` publish admission (#4625 PR-1, spec
4162
4209
  // pilot-v2-managed-agent-profile.md §11 MAP-VL3), both thrown by
4163
4210
  // `applyRevisionManifest` and mapped to 400 by the default branch of
@@ -9191,8 +9238,7 @@ var ManagedAgentProfileV1RuntimeSchema = import_zod60.z.object({
9191
9238
  // rejects the profile instead of dropping the selection (why:
9192
9239
  // `.agents/notes/proposed/architecture/
9193
9240
  // 2026-09-28-executor-keys-reserved-until-gates.md`).
9194
- // The profile→defaults projection and the form selector are #3843; the
9195
- // publish-side gate (EXP) judging the frozen executor is already live in
9241
+ // The publish-side gate (EXP) judging the frozen executor lives in
9196
9242
  // `applyRevisionManifest`, so a pi selection cannot reach a Revision while
9197
9243
  // its publishable switch is off.
9198
9244
  executor: ProfileExecutorSchema.optional()
@@ -10022,12 +10068,13 @@ var PlatformRevisionSchema = import_zod66.z.object({
10022
10068
  workloadSlug: WorkloadManifestNameSchema.optional(),
10023
10069
  version: WorkloadManifestNameSchema,
10024
10070
  runtimeSnapshotHash: import_zod66.z.string().nullable().optional(),
10025
- createdAt: import_zod66.z.string().optional()
10026
- }).strict();
10071
+ createdAt: import_zod66.z.string().optional(),
10072
+ sequence: import_zod66.z.number().int().positive().optional()
10073
+ }).strip();
10027
10074
  var GetPlatformWorkloadResponseSchema = PlatformWorkloadSchema.extend({
10028
10075
  kind: WorkloadKindSchema,
10029
10076
  defaultRevision: PlatformRevisionSchema.nullable()
10030
- });
10077
+ }).strip();
10031
10078
  var GetPlatformRevisionResponseSchema = PlatformRevisionSchema;
10032
10079
  var GetPlatformSessionResponseSchema = import_zod66.z.object({
10033
10080
  id: import_zod66.z.string().uuid(),
@@ -10739,6 +10786,11 @@ var SlotCanarySummarySchema = import_zod75.z.object({
10739
10786
  revisionId: import_zod75.z.string(),
10740
10787
  /** canary revision 的人可读版本短名;revision 行缺失时 null(降级显示 id 前缀)。 */
10741
10788
  revisionLabel: import_zod75.z.string().nullable(),
10789
+ /**
10790
+ * canary 版本在该 Agent 内的落库序号(#5057 PR-B)。主显 `#n`、原串进
10791
+ * `title`。optional = 旧服务端响应没有它(滚动发版兼容)。
10792
+ */
10793
+ revisionSequence: import_zod75.z.number().int().nullable().optional(),
10742
10794
  /** 0..99;0 = 冻结观察态(仅名单命中仍入 canary)。 */
10743
10795
  percentage: import_zod75.z.number().int(),
10744
10796
  /** ldap 名单人数(徽章"名单 N 人";0 = 无名单)。 */
@@ -10750,6 +10802,12 @@ var SlotSummarySchema = import_zod75.z.object({
10750
10802
  revisionId: import_zod75.z.string().nullable(),
10751
10803
  /** 人可读的版本标识(revision name/number);无部署时 null。 */
10752
10804
  revisionLabel: import_zod75.z.string().nullable(),
10805
+ /**
10806
+ * 槽位所指 Revision 在该 Agent 内的落库序号(#5057 PR-B)。UI 主显 `#n`、
10807
+ * `revisionLabel` 留在 `title` 与复制按钮。optional = 旧服务端 / 未报告的
10808
+ * 生产方(滚动发版兼容)。
10809
+ */
10810
+ revisionSequence: import_zod75.z.number().int().nullable().optional(),
10753
10811
  environmentId: import_zod75.z.string().nullable(),
10754
10812
  environmentName: import_zod75.z.string().nullable(),
10755
10813
  environmentVersion: import_zod75.z.number().int().nullable(),
@@ -10769,6 +10827,34 @@ var SlotSummarySchema = import_zod75.z.object({
10769
10827
  */
10770
10828
  canary: SlotCanarySummarySchema.nullable().optional()
10771
10829
  });
10830
+ var AttentionReasonKindSchema = import_zod75.z.enum([
10831
+ "startup_failed",
10832
+ "required_gate_failed",
10833
+ "repeated_revision_failure",
10834
+ "runtime_failed",
10835
+ "unhealthy_instance",
10836
+ "warm_pool_underfilled"
10837
+ ]);
10838
+ var AttentionReasonBasisSchema = import_zod75.z.enum(["window", "current"]);
10839
+ var AttentionReasonSchema = import_zod75.z.object({
10840
+ kind: AttentionReasonKindSchema,
10841
+ count: import_zod75.z.number().int().nonnegative(),
10842
+ basis: AttentionReasonBasisSchema
10843
+ });
10844
+ var AttentionSeveritySchema = import_zod75.z.enum(["ok", "info", "warn", "critical"]);
10845
+ var WorkloadAttentionSchema = import_zod75.z.object({
10846
+ workloadId: import_zod75.z.string(),
10847
+ workloadSlug: import_zod75.z.string(),
10848
+ workloadDisplayName: import_zod75.z.string(),
10849
+ severity: AttentionSeveritySchema,
10850
+ score: import_zod75.z.number(),
10851
+ reasonDetails: import_zod75.z.array(AttentionReasonSchema)
10852
+ });
10853
+ var ProjectAttentionSummarySchema = import_zod75.z.object({
10854
+ severity: AttentionSeveritySchema,
10855
+ workloadCount: import_zod75.z.number().int().nonnegative(),
10856
+ reasonDetails: import_zod75.z.array(AttentionReasonSchema)
10857
+ });
10772
10858
  var WorkbenchStageDriftKindSchema = import_zod75.z.enum([
10773
10859
  /** test 指向新于 production(待晋级)。 */
10774
10860
  "test_ahead",
@@ -10824,8 +10910,15 @@ var WorkbenchRecentChangeSchema = import_zod75.z.object({
10824
10910
  * 降级为无 slug,而不是整个 DTO 校验失败。
10825
10911
  */
10826
10912
  subjectSlug: import_zod75.z.string().nullable().optional(),
10827
- /** 一句话变更描述(如 "production → rev-12" / "环境 v3 创建")。 */
10913
+ /** 一句话变更描述(如 "production → #12" / "环境 v3 创建")。 */
10828
10914
  detail: import_zod75.z.string(),
10915
+ /**
10916
+ * workload 类变更指到的 Revision 原版本串与序号(#5057 PR-B)。环境类变更、
10917
+ * 以及旧服务端都缺席;`detail` 已按可读序号拼好,这两个字段供 UI 把 `#n`
10918
+ * 主显、把原版本串放进 `title`。optional = 滚动发版兼容(同 subjectSlug)。
10919
+ */
10920
+ revisionVersion: import_zod75.z.string().nullable().optional(),
10921
+ revisionSequence: import_zod75.z.number().int().nullable().optional(),
10829
10922
  occurredAt: import_zod75.z.string()
10830
10923
  });
10831
10924
  var WorkbenchSessionStatsSchema = import_zod75.z.object({
@@ -10919,7 +11012,13 @@ var ReleaseBoardRowSchema = import_zod75.z.object({
10919
11012
  * 新消费方一律读 `latestRevision`(前端回退链 latestRevision ?? defaultRevision
10920
11013
  * 只为兼容旧服务端缺字段,不表示两者同义)。
10921
11014
  */
10922
- defaultRevision: import_zod75.z.object({ id: import_zod75.z.string(), version: import_zod75.z.string(), createdAt: import_zod75.z.string() }).nullable(),
11015
+ defaultRevision: import_zod75.z.object({
11016
+ id: import_zod75.z.string(),
11017
+ version: import_zod75.z.string(),
11018
+ /** 落库序号(#5057 PR-B);optional = 旧服务端。 */
11019
+ sequence: import_zod75.z.number().int().nullable().optional(),
11020
+ createdAt: import_zod75.z.string()
11021
+ }).nullable(),
10923
11022
  /**
10924
11023
  * Workload 最近发布的 Revision(createdAt 最新;并列时 id 大者,保证确定性)。
10925
11024
  * 发布板用它判断"有新版本尚未部署到 test"(latestRevision.id ≠
@@ -10935,6 +11034,8 @@ var ReleaseBoardRowSchema = import_zod75.z.object({
10935
11034
  latestRevision: import_zod75.z.object({
10936
11035
  id: import_zod75.z.string(),
10937
11036
  version: import_zod75.z.string(),
11037
+ /** 落库序号(#5057 PR-B);optional = 旧服务端。 */
11038
+ sequence: import_zod75.z.number().int().nullable().optional(),
10938
11039
  createdAt: import_zod75.z.string(),
10939
11040
  /** 真实发布时间;optional 仅用于新旧服务端滚动窗口兼容。 */
10940
11041
  publishedAt: import_zod75.z.string().optional()
@@ -13146,15 +13247,13 @@ var OnlineSessionPreconditionSchema = import_zod83.z.union([
13146
13247
  fileExistsPrecondition,
13147
13248
  toolCalledPrecondition
13148
13249
  ]);
13149
- var forbiddenThreshold = import_zod83.z.never({
13150
- error: "threshold is only valid on llm graders \u2014 boolean graders (transcript/reply/file/script) pass or fail, there is no score to threshold"
13151
- }).optional();
13250
+ var optionalBooleanThreshold = import_zod83.z.number().min(0).max(1).optional();
13152
13251
  var OnlineTranscriptGraderSchema = EvalTranscriptGraderSchema.pick({
13153
13252
  type: true,
13154
13253
  label: true
13155
13254
  }).extend({
13156
13255
  precondition: OnlineTurnPreconditionSchema.optional(),
13157
- threshold: forbiddenThreshold,
13256
+ threshold: optionalBooleanThreshold,
13158
13257
  expect: EvalTranscriptExpectSchema.pick({
13159
13258
  completed: true,
13160
13259
  forbiddenTools: true,
@@ -13166,7 +13265,7 @@ var OnlineTranscriptGraderSchema = EvalTranscriptGraderSchema.pick({
13166
13265
  }).strict();
13167
13266
  var OnlineReplyGraderSchema = EvalReplyGraderSchema.pick({ type: true, label: true }).extend({
13168
13267
  precondition: OnlineTurnPreconditionSchema.optional(),
13169
- threshold: forbiddenThreshold,
13268
+ threshold: optionalBooleanThreshold,
13170
13269
  expect: EvalReplyExpectSchema.pick({ excludes: true, matches: true })
13171
13270
  }).strict();
13172
13271
  var OnlineLlmToolsSchema = EvalLlmToolsSchema;
@@ -13190,7 +13289,7 @@ var OnlineFileGraderSchema = import_zod83.z.object({
13190
13289
  type: import_zod83.z.literal("file"),
13191
13290
  label: EvalGraderLabelSchema,
13192
13291
  precondition: OnlineSessionPreconditionSchema,
13193
- threshold: forbiddenThreshold,
13292
+ threshold: optionalBooleanThreshold,
13194
13293
  path: EvalRelativePathSchema,
13195
13294
  expect: EvalReplyExpectSchema.pick({ excludes: true }).required()
13196
13295
  }).strict();
@@ -13201,7 +13300,7 @@ var OnlineScriptGraderSchema = EvalScriptGraderSchema.pick({
13201
13300
  timeout: true
13202
13301
  }).extend({
13203
13302
  precondition: OnlineSessionPreconditionSchema,
13204
- threshold: forbiddenThreshold,
13303
+ threshold: optionalBooleanThreshold,
13205
13304
  expect: EvalScriptExpectSchema.optional()
13206
13305
  }).strict();
13207
13306
  var OnlineTurnGraderSpecSchema = import_zod83.z.discriminatedUnion("type", [
@@ -13404,6 +13503,85 @@ var SessionWorkspaceSnapshotRecordSchema = import_zod83.z.object({
13404
13503
  path: ["capturedAtTurn"],
13405
13504
  message: "capturedAtTurn must equal envelope.capturedAtTurn (the row key is the envelope's own cursor)"
13406
13505
  });
13506
+ var OnlineGraderSummaryItemSchema = import_zod83.z.object({
13507
+ key: import_zod83.z.string(),
13508
+ type: import_zod83.z.string(),
13509
+ level: import_zod83.z.enum(["turn", "session"]),
13510
+ threshold: import_zod83.z.number().nullable()
13511
+ }).strict();
13512
+ var OnlineSetInspectionSchema = import_zod83.z.object({
13513
+ kind: import_zod83.z.enum(["absent", "invalid", "unreadable", "ok"]),
13514
+ graderSummary: import_zod83.z.array(OnlineGraderSummaryItemSchema),
13515
+ digest: import_zod83.z.string().nullable(),
13516
+ error: import_zod83.z.string().nullable()
13517
+ }).strict();
13518
+ var OnlineConfigViewSchema = import_zod83.z.object({
13519
+ agentId: import_zod83.z.string().uuid(),
13520
+ stage: import_zod83.z.string(),
13521
+ enabled: import_zod83.z.boolean(),
13522
+ tier1Rate: import_zod83.z.number(),
13523
+ alertEnabled: import_zod83.z.boolean(),
13524
+ alertWindowHours: import_zod83.z.number().int(),
13525
+ alertMinSamples: import_zod83.z.number().int(),
13526
+ dailyCandidateCap: import_zod83.z.number().int(),
13527
+ updatedAt: import_zod83.z.string(),
13528
+ last7dScoreRows: import_zod83.z.number().int(),
13529
+ lastGradedAt: import_zod83.z.string().nullable()
13530
+ }).strict();
13531
+ var OnlineStatusDotSchema = import_zod83.z.object({
13532
+ lit: import_zod83.z.boolean(),
13533
+ mismatch: import_zod83.z.array(
13534
+ import_zod83.z.object({
13535
+ agentId: import_zod83.z.string().uuid(),
13536
+ stage: import_zod83.z.string(),
13537
+ kind: import_zod83.z.enum(["absent", "invalid"]),
13538
+ error: import_zod83.z.string().nullable()
13539
+ }).strict()
13540
+ ),
13541
+ alerts: import_zod83.z.array(
13542
+ import_zod83.z.object({
13543
+ agentId: import_zod83.z.string().uuid(),
13544
+ stage: import_zod83.z.string(),
13545
+ graderKey: import_zod83.z.string(),
13546
+ metric: import_zod83.z.number(),
13547
+ threshold: import_zod83.z.number(),
13548
+ samples: import_zod83.z.number().int()
13549
+ }).strict()
13550
+ )
13551
+ }).strict();
13552
+ var EvalOnlineOverviewResponseSchema = import_zod83.z.object({
13553
+ configs: import_zod83.z.array(OnlineConfigViewSchema),
13554
+ statusDot: OnlineStatusDotSchema
13555
+ }).strict();
13556
+ var EvalOnlineConfigDetailResponseSchema = import_zod83.z.object({
13557
+ config: OnlineConfigViewSchema.nullable(),
13558
+ inspection: OnlineSetInspectionSchema
13559
+ }).strict();
13560
+ var EvalOnlineConfigUpsertResponseSchema = import_zod83.z.object({
13561
+ ok: import_zod83.z.literal(true),
13562
+ graderSummary: import_zod83.z.array(OnlineGraderSummaryItemSchema).nullable()
13563
+ }).strict();
13564
+ var EvalOnlineTrendResponseSchema = import_zod83.z.object({
13565
+ rangeDays: import_zod83.z.number().int(),
13566
+ dailyFromDay: import_zod83.z.string(),
13567
+ graders: import_zod83.z.array(
13568
+ import_zod83.z.object({
13569
+ graderKey: import_zod83.z.string(),
13570
+ graderType: import_zod83.z.string(),
13571
+ level: import_zod83.z.enum(["turn", "session"]),
13572
+ points: import_zod83.z.object({
13573
+ day: import_zod83.z.string(),
13574
+ metric: import_zod83.z.number(),
13575
+ judged: import_zod83.z.number().int()
13576
+ }).strict().array(),
13577
+ switches: import_zod83.z.object({
13578
+ day: import_zod83.z.string(),
13579
+ graderRevisionId: import_zod83.z.string().uuid(),
13580
+ graderSetDigest: import_zod83.z.string()
13581
+ }).strict().array()
13582
+ }).strict()
13583
+ )
13584
+ }).strict();
13407
13585
  var PIPELINE_COMMIT_SHA_RE = /^[0-9a-f]{7,64}$/i;
13408
13586
  var CommitShaSchema = import_zod84.z.string().regex(PIPELINE_COMMIT_SHA_RE, {
13409
13587
  message: "commitSha must be 7-64 hexadecimal characters"
@@ -14121,6 +14299,19 @@ var REALTIME_RECOVERY_REASONS = Object.freeze([
14121
14299
  "response_incomplete",
14122
14300
  "connection_interrupted"
14123
14301
  ]);
14302
+ var REALTIME_TERMINAL_ERROR_CODES = Object.freeze([
14303
+ "write_queue_full",
14304
+ "control_timeout",
14305
+ "control_rejected",
14306
+ "generation_expired",
14307
+ "upstream_unavailable",
14308
+ "resume_store_unavailable",
14309
+ "renew_rejected",
14310
+ "execution_expired",
14311
+ "no_response",
14312
+ "renew_abandoned",
14313
+ "realtime_turn_lost"
14314
+ ]);
14124
14315
  var PILOT_PERMISSION_MODES = ["manual", "auto", "accept_edits", "bypass"];
14125
14316
  var PilotPermissionModeSchema = import_zod90.z.enum(PILOT_PERMISSION_MODES);
14126
14317
  var PilotPlanSegmentJobSchema = import_zod91.z.object({ tenantId: import_zod91.z.string().min(1), planId: import_zod91.z.string().uuid() }).strict();