@kanyun-ai-infra/agenthub 1.5.0 → 1.6.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/index.cjs +1750 -1066
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +954 -35
- package/dist/index.d.ts +954 -35
- package/dist/index.js +1736 -1065
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -107,10 +107,20 @@ __export(index_exports, {
|
|
|
107
107
|
SessionFileResourceSchema: () => SessionFileResourceSchema,
|
|
108
108
|
SessionMemorySubjectDeclarationSchema: () => SessionMemorySubjectDeclarationSchema,
|
|
109
109
|
SessionResourcesSchema: () => SessionResourcesSchema,
|
|
110
|
+
SessionTurnsResource: () => SessionTurnsResource,
|
|
110
111
|
SessionsResource: () => SessionsResource,
|
|
111
112
|
StageSchema: () => StageSchema,
|
|
112
113
|
StageSlotViewSchema: () => StageSlotViewSchema,
|
|
113
114
|
StoredMemorySubjectPolicySchema: () => StoredMemorySubjectPolicySchema,
|
|
115
|
+
TERMINAL_TURN_STATUSES: () => TERMINAL_TURN_STATUSES,
|
|
116
|
+
TURN_LIST_DEFAULT_LIMIT: () => TURN_LIST_DEFAULT_LIMIT,
|
|
117
|
+
TURN_LIST_MAX_LIMIT: () => TURN_LIST_MAX_LIMIT,
|
|
118
|
+
TurnAssistantPartSchema: () => TurnAssistantPartSchema,
|
|
119
|
+
TurnKindSchema: () => TurnKindSchema,
|
|
120
|
+
TurnListQuerySchema: () => TurnListQuerySchema,
|
|
121
|
+
TurnListResponseDataSchema: () => TurnListResponseDataSchema,
|
|
122
|
+
TurnSchema: () => TurnSchema,
|
|
123
|
+
TurnStatusSchema: () => TurnStatusSchema,
|
|
114
124
|
UpdateEnvironmentInputSchema: () => UpdateEnvironmentInputSchema,
|
|
115
125
|
WorkbenchDTOSchema: () => WorkbenchDTOSchema,
|
|
116
126
|
WorkloadStageCanaryResource: () => WorkloadStageCanaryResource,
|
|
@@ -120,9 +130,12 @@ __export(index_exports, {
|
|
|
120
130
|
WriteMemoriesRequestSchema: () => WriteMemoriesRequestSchema,
|
|
121
131
|
WriteMemoriesResultSchema: () => WriteMemoriesResultSchema,
|
|
122
132
|
WriteMemoryItemSchema: () => WriteMemoryItemSchema,
|
|
133
|
+
isTerminalTurnStatus: () => isTerminalTurnStatus,
|
|
123
134
|
pilotPlatformErrorFromResponse: () => pilotPlatformErrorFromResponse,
|
|
124
135
|
platformRevisionPublishToManifest: () => platformRevisionPublishToManifest,
|
|
125
|
-
platformWorkloadCreateToManifest: () => platformWorkloadCreateToManifest
|
|
136
|
+
platformWorkloadCreateToManifest: () => platformWorkloadCreateToManifest,
|
|
137
|
+
toUIMessages: () => toUIMessages,
|
|
138
|
+
turnMessageIds: () => turnMessageIds
|
|
126
139
|
});
|
|
127
140
|
module.exports = __toCommonJS(index_exports);
|
|
128
141
|
|
|
@@ -218,6 +231,9 @@ var import_zod67 = require("zod");
|
|
|
218
231
|
var import_zod68 = require("zod");
|
|
219
232
|
var import_zod69 = require("zod");
|
|
220
233
|
var import_zod70 = require("zod");
|
|
234
|
+
var import_zod71 = require("zod");
|
|
235
|
+
var import_zod72 = require("zod");
|
|
236
|
+
var import_zod73 = require("zod");
|
|
221
237
|
var MODELGATE_VENDOR_TYPES = [
|
|
222
238
|
"anthropic",
|
|
223
239
|
"openai",
|
|
@@ -5171,7 +5187,45 @@ var WorkerProtocolFailedPayloadSchema = import_zod44.z.object({
|
|
|
5171
5187
|
}).strict().refine((p) => p.reason !== "wp_aborted_by_signal" || p.abortContext !== void 0, {
|
|
5172
5188
|
message: "abortContext required when reason = wp_aborted_by_signal"
|
|
5173
5189
|
});
|
|
5190
|
+
var TurnUsageSchema = import_zod44.z.object({
|
|
5191
|
+
/** Whether the provider reported any token counts for this turn. */
|
|
5192
|
+
usageSource: import_zod44.z.enum(["provider", "missing"]),
|
|
5193
|
+
/** Prompt tokens, cache reads/writes included. */
|
|
5194
|
+
inputTokens: import_zod44.z.number().int().nonnegative().optional(),
|
|
5195
|
+
outputTokens: import_zod44.z.number().int().nonnegative().optional(),
|
|
5196
|
+
/** `inputTokens + outputTokens`. */
|
|
5197
|
+
totalTokens: import_zod44.z.number().int().nonnegative().optional(),
|
|
5198
|
+
/** Breakdown of `inputTokens` — cached prompt tokens read back. */
|
|
5199
|
+
cacheReadInputTokens: import_zod44.z.number().int().nonnegative().optional(),
|
|
5200
|
+
/** Breakdown of `inputTokens` — prompt tokens written into the cache. */
|
|
5201
|
+
cacheWriteInputTokens: import_zod44.z.number().int().nonnegative().optional(),
|
|
5202
|
+
/** Provider-stream duration; see the timing note above. */
|
|
5203
|
+
durationMs: import_zod44.z.number().int().nonnegative().optional(),
|
|
5204
|
+
timeToFirstTokenMs: import_zod44.z.number().int().nonnegative().optional(),
|
|
5205
|
+
/** AI SDK `finishReason` of the last step ("stop" / "tool-calls" / …). */
|
|
5206
|
+
finishReason: import_zod44.z.string().min(1).optional(),
|
|
5207
|
+
/** Absent whenever `usageSource === "missing"`. */
|
|
5208
|
+
costUsd: import_zod44.z.number().nonnegative().optional(),
|
|
5209
|
+
/** Which upstream reported `costUsd`; paired with it, absent without it. */
|
|
5210
|
+
costSource: import_zod44.z.literal("claude_code_cli").optional(),
|
|
5211
|
+
/** Provider steps observed in the turn — 2 after a mid-turn stream resume. */
|
|
5212
|
+
stepCount: import_zod44.z.number().int().nonnegative().optional()
|
|
5213
|
+
});
|
|
5174
5214
|
var WorkerProtocolCompletedPayloadSchema = import_zod44.z.record(import_zod44.z.string(), import_zod44.z.unknown());
|
|
5215
|
+
var SessionUsageSummarySchema = import_zod44.z.object({
|
|
5216
|
+
turnsWithUsage: import_zod44.z.number().int().nonnegative(),
|
|
5217
|
+
turnsMissingUsage: import_zod44.z.number().int().nonnegative(),
|
|
5218
|
+
inputTokens: import_zod44.z.number().int().nonnegative(),
|
|
5219
|
+
outputTokens: import_zod44.z.number().int().nonnegative(),
|
|
5220
|
+
totalTokens: import_zod44.z.number().int().nonnegative(),
|
|
5221
|
+
cacheReadInputTokens: import_zod44.z.number().int().nonnegative(),
|
|
5222
|
+
cacheWriteInputTokens: import_zod44.z.number().int().nonnegative(),
|
|
5223
|
+
/** `null` when no contributing turn reported a cost. */
|
|
5224
|
+
costUsd: import_zod44.z.number().nonnegative().nullable(),
|
|
5225
|
+
costSource: import_zod44.z.literal("claude_code_cli").nullable(),
|
|
5226
|
+
/** ISO timestamp of the latest completed turn that contributed usage. */
|
|
5227
|
+
lastUpdatedAt: import_zod44.z.string().nullable()
|
|
5228
|
+
});
|
|
5175
5229
|
var EVENT_TYPE_REGEX = /^([a-z][a-z0-9_]*)\.([a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)?)$/;
|
|
5176
5230
|
var EventTypeSchema = import_zod43.z.string().min(1).max(100, "event_type must not exceed SESSION_EVENT_TYPE_MAX_LENGTH (100)").regex(EVENT_TYPE_REGEX, "event_type must be {domain}.{action} in lowercase snake_case");
|
|
5177
5231
|
var EVENT_DOMAINS = [
|
|
@@ -5558,35 +5612,41 @@ var SessionDeliveryEnvelopeSchema = import_zod47.z.object({
|
|
|
5558
5612
|
/** ISO-8601 last-write time; the latest-wins ordering key. */
|
|
5559
5613
|
updatedAt: import_zod47.z.string().min(1)
|
|
5560
5614
|
}).strict();
|
|
5615
|
+
var SESSION_INCLUDE_FIELDS = ["streamCursor"];
|
|
5616
|
+
var SessionIncludeQuerySchema = import_zod48.z.object({
|
|
5617
|
+
include: import_zod48.z.string().optional().transform(
|
|
5618
|
+
(raw) => raw ? raw.split(",").map((value) => value.trim()).filter(Boolean) : []
|
|
5619
|
+
).pipe(import_zod48.z.array(import_zod48.z.enum(SESSION_INCLUDE_FIELDS)))
|
|
5620
|
+
});
|
|
5561
5621
|
var SECRET_VALUE_MAX_LENGTH = 65536;
|
|
5562
5622
|
var SECRET_DISPLAY_NAME_MAX_LENGTH = 200;
|
|
5563
|
-
var SecretEnvKeySchema =
|
|
5564
|
-
var CreateSecretRequestSchema =
|
|
5565
|
-
delivery:
|
|
5566
|
-
displayName:
|
|
5623
|
+
var SecretEnvKeySchema = import_zod49.z.string().min(1).max(SECRET_ENV_KEY_MAX_LENGTH).regex(SECRET_ENV_KEY_REGEX, "envKey must look like an environment variable name").refine((key) => !isDisallowedWorkerConfigEnvKey(key), { message: "ENV_KEY_FORBIDDEN" });
|
|
5624
|
+
var CreateSecretRequestSchema = import_zod49.z.object({
|
|
5625
|
+
delivery: import_zod49.z.literal("env_jit"),
|
|
5626
|
+
displayName: import_zod49.z.string().min(1).max(SECRET_DISPLAY_NAME_MAX_LENGTH),
|
|
5567
5627
|
envKey: SecretEnvKeySchema,
|
|
5568
5628
|
/** Plaintext, write-only; bounded so a blob cannot bloat the envelope. */
|
|
5569
|
-
value:
|
|
5629
|
+
value: import_zod49.z.string().min(1).max(SECRET_VALUE_MAX_LENGTH)
|
|
5570
5630
|
}).strict();
|
|
5571
|
-
var RotateSecretRequestSchema =
|
|
5572
|
-
value:
|
|
5631
|
+
var RotateSecretRequestSchema = import_zod49.z.object({
|
|
5632
|
+
value: import_zod49.z.string().min(1).max(SECRET_VALUE_MAX_LENGTH)
|
|
5573
5633
|
}).strict();
|
|
5574
|
-
var SecretRecordSchema =
|
|
5634
|
+
var SecretRecordSchema = import_zod49.z.object({
|
|
5575
5635
|
publicId: SecretPublicIdSchema,
|
|
5576
|
-
displayName:
|
|
5636
|
+
displayName: import_zod49.z.string(),
|
|
5577
5637
|
delivery: SecretDeliverySchema,
|
|
5578
5638
|
/** env_jit: target env var name; proxy_inject (P2): null. */
|
|
5579
|
-
envKey:
|
|
5580
|
-
createdAt:
|
|
5581
|
-
updatedAt:
|
|
5582
|
-
archivedAt:
|
|
5639
|
+
envKey: import_zod49.z.string().nullable(),
|
|
5640
|
+
createdAt: import_zod49.z.string(),
|
|
5641
|
+
updatedAt: import_zod49.z.string(),
|
|
5642
|
+
archivedAt: import_zod49.z.string().nullable()
|
|
5583
5643
|
}).strict();
|
|
5584
|
-
var SecretPickItemSchema =
|
|
5644
|
+
var SecretPickItemSchema = import_zod49.z.object({
|
|
5585
5645
|
publicId: SecretPublicIdSchema,
|
|
5586
|
-
displayName:
|
|
5587
|
-
envKey:
|
|
5646
|
+
displayName: import_zod49.z.string(),
|
|
5647
|
+
envKey: import_zod49.z.string().nullable()
|
|
5588
5648
|
}).strict();
|
|
5589
|
-
var RecordWorkspaceSnapshotRequestSchema =
|
|
5649
|
+
var RecordWorkspaceSnapshotRequestSchema = import_zod50.z.object({
|
|
5590
5650
|
/**
|
|
5591
5651
|
* The split workspace snapshot produced at the prior turn's end. Both
|
|
5592
5652
|
* parts may be null ("nothing to restore" — a valid no-op snapshot, NOT
|
|
@@ -5594,14 +5654,14 @@ var RecordWorkspaceSnapshotRequestSchema = import_zod49.z.object({
|
|
|
5594
5654
|
*/
|
|
5595
5655
|
snapshot: WorkspaceSnapshotSchema
|
|
5596
5656
|
}).strict();
|
|
5597
|
-
var RecordWorkspaceSnapshotResponseSchema =
|
|
5598
|
-
success:
|
|
5599
|
-
data:
|
|
5600
|
-
applied:
|
|
5601
|
-
gateInjected:
|
|
5657
|
+
var RecordWorkspaceSnapshotResponseSchema = import_zod50.z.object({
|
|
5658
|
+
success: import_zod50.z.literal(true),
|
|
5659
|
+
data: import_zod50.z.object({
|
|
5660
|
+
applied: import_zod50.z.boolean(),
|
|
5661
|
+
gateInjected: import_zod50.z.boolean()
|
|
5602
5662
|
})
|
|
5603
5663
|
});
|
|
5604
|
-
var RecordWorkspaceSnapshotErrorCodeSchema =
|
|
5664
|
+
var RecordWorkspaceSnapshotErrorCodeSchema = import_zod50.z.enum([
|
|
5605
5665
|
// 400 — request was malformed or schema-invalid
|
|
5606
5666
|
"VALIDATION_ERROR",
|
|
5607
5667
|
// 401 — Authorization header missing or session token invalid/expired
|
|
@@ -5618,12 +5678,12 @@ var RecordWorkspaceSnapshotErrorCodeSchema = import_zod49.z.enum([
|
|
|
5618
5678
|
]);
|
|
5619
5679
|
var WorkspaceExportPartSchema = WorkspaceSnapshotPartSchema.extend({
|
|
5620
5680
|
/** Presigned OSS download URL, valid for `WORKSPACE_EXPORT_URL_TTL_SECONDS`. */
|
|
5621
|
-
downloadUrl:
|
|
5681
|
+
downloadUrl: import_zod50.z.string().min(1),
|
|
5622
5682
|
/** ISO-8601 instant at which `downloadUrl` stops working. */
|
|
5623
|
-
expiresAt:
|
|
5683
|
+
expiresAt: import_zod50.z.string().min(1)
|
|
5624
5684
|
}).strip();
|
|
5625
|
-
var WorkspaceExportDataSchema =
|
|
5626
|
-
version:
|
|
5685
|
+
var WorkspaceExportDataSchema = import_zod50.z.object({
|
|
5686
|
+
version: import_zod50.z.literal("v1"),
|
|
5627
5687
|
/**
|
|
5628
5688
|
* Opaque monotonic cursor identifying this capture. **Not a turn ordinal**
|
|
5629
5689
|
* despite the name: the capture side sets it to `capturedAt.getTime()`
|
|
@@ -5660,19 +5720,19 @@ var WorkspaceExportDataSchema = import_zod49.z.object({
|
|
|
5660
5720
|
* from "nothing was produced". Anchoring the snapshot to a turn identity
|
|
5661
5721
|
* rather than a timestamp is the real fix — see the spec's follow-ups.
|
|
5662
5722
|
*/
|
|
5663
|
-
capturedAtTurn:
|
|
5723
|
+
capturedAtTurn: import_zod50.z.number().int().nonnegative(),
|
|
5664
5724
|
/** ISO-8601 capture time — the field to show a human. */
|
|
5665
|
-
capturedAt:
|
|
5666
|
-
parts:
|
|
5725
|
+
capturedAt: import_zod50.z.string().min(1),
|
|
5726
|
+
parts: import_zod50.z.object({
|
|
5667
5727
|
repoBundle: WorkspaceExportPartSchema.nullable(),
|
|
5668
5728
|
externalArchive: WorkspaceExportPartSchema.nullable()
|
|
5669
5729
|
})
|
|
5670
5730
|
});
|
|
5671
|
-
var WorkspaceExportResponseSchema =
|
|
5672
|
-
success:
|
|
5731
|
+
var WorkspaceExportResponseSchema = import_zod50.z.object({
|
|
5732
|
+
success: import_zod50.z.literal(true),
|
|
5673
5733
|
data: WorkspaceExportDataSchema
|
|
5674
5734
|
});
|
|
5675
|
-
var WorkspaceExportErrorCodeSchema =
|
|
5735
|
+
var WorkspaceExportErrorCodeSchema = import_zod50.z.enum([
|
|
5676
5736
|
// 400 — the URL session id is not a well-formed uuid
|
|
5677
5737
|
"VALIDATION_ERROR",
|
|
5678
5738
|
// 404 — no such session, or it is not visible to this caller
|
|
@@ -5702,25 +5762,25 @@ var WorkspaceExportErrorCodeSchema = import_zod49.z.enum([
|
|
|
5702
5762
|
var SESSION_ARTIFACT_MAX_BUNDLE_COMPRESSED_BYTES = 8 * 1024 * 1024;
|
|
5703
5763
|
var SESSION_ARTIFACT_MAX_ENTRY_BYTES = 8 * 1024 * 1024;
|
|
5704
5764
|
var SESSION_ARTIFACT_MAX_TOTAL_UNCOMPRESSED_BYTES = 16 * 1024 * 1024;
|
|
5705
|
-
var ScheduleTargetKindSchema =
|
|
5706
|
-
var ScheduleApiVersionPreferenceSchema =
|
|
5707
|
-
var ScheduleLifecycleStatusSchema =
|
|
5708
|
-
var ScheduleConcurrencyPolicySchema =
|
|
5709
|
-
var ScheduleMisfirePolicySchema =
|
|
5710
|
-
var ScheduleTriggerSourceSchema =
|
|
5711
|
-
var ScheduleTriggerStatusSchema =
|
|
5765
|
+
var ScheduleTargetKindSchema = import_zod51.z.enum(["workload", "agent", "inline_v1", "inline_v2"]);
|
|
5766
|
+
var ScheduleApiVersionPreferenceSchema = import_zod51.z.enum(["v1", "v2"]);
|
|
5767
|
+
var ScheduleLifecycleStatusSchema = import_zod51.z.enum(["active", "disabled", "deleted"]);
|
|
5768
|
+
var ScheduleConcurrencyPolicySchema = import_zod51.z.enum(["allow", "forbid"]);
|
|
5769
|
+
var ScheduleMisfirePolicySchema = import_zod51.z.enum(["skip", "fire_once_immediately"]);
|
|
5770
|
+
var ScheduleTriggerSourceSchema = import_zod51.z.enum(["cron", "manual"]);
|
|
5771
|
+
var ScheduleTriggerStatusSchema = import_zod51.z.enum([
|
|
5712
5772
|
"pending",
|
|
5713
5773
|
"dispatched",
|
|
5714
5774
|
"skipped",
|
|
5715
5775
|
"failed_to_dispatch"
|
|
5716
5776
|
]);
|
|
5717
|
-
var ScheduleSkippedReasonSchema =
|
|
5777
|
+
var ScheduleSkippedReasonSchema = import_zod51.z.enum([
|
|
5718
5778
|
"misfire",
|
|
5719
5779
|
"concurrency_forbidden",
|
|
5720
5780
|
"schedule_disabled",
|
|
5721
5781
|
"out_of_window"
|
|
5722
5782
|
]);
|
|
5723
|
-
var ScheduleFailureReasonCodeSchema =
|
|
5783
|
+
var ScheduleFailureReasonCodeSchema = import_zod51.z.enum([
|
|
5724
5784
|
"TARGET_NOT_FOUND",
|
|
5725
5785
|
"TARGET_DISABLED",
|
|
5726
5786
|
"REVISION_NOT_FOUND",
|
|
@@ -5731,7 +5791,7 @@ var ScheduleFailureReasonCodeSchema = import_zod50.z.enum([
|
|
|
5731
5791
|
"STAGE_NOT_DEPLOYED",
|
|
5732
5792
|
"UNKNOWN_DISPATCH_FAILURE"
|
|
5733
5793
|
]);
|
|
5734
|
-
var ScheduleApiErrorCodeSchema =
|
|
5794
|
+
var ScheduleApiErrorCodeSchema = import_zod51.z.enum([
|
|
5735
5795
|
"INVALID_CRON",
|
|
5736
5796
|
"INVALID_TIMEZONE",
|
|
5737
5797
|
"INVALID_TARGET",
|
|
@@ -5788,16 +5848,16 @@ function isCronStructurallyValid(value) {
|
|
|
5788
5848
|
const segments = trimmed.split(/\s+/);
|
|
5789
5849
|
return segments.length === 5 || segments.length === 6;
|
|
5790
5850
|
}
|
|
5791
|
-
var TimezoneStringSchema =
|
|
5792
|
-
var CronExpressionSchema =
|
|
5793
|
-
var IsoDatetimeSchema =
|
|
5851
|
+
var TimezoneStringSchema = import_zod51.z.string().min(1, "timezone must be a non-empty IANA identifier").refine(isValidIanaTimezone, "timezone must be a valid IANA identifier");
|
|
5852
|
+
var CronExpressionSchema = import_zod51.z.string().min(1, "cronExpression must be non-empty").max(200, "cronExpression must be at most 200 characters").refine(isCronStructurallyValid, "cronExpression must have 5 or 6 whitespace-separated segments");
|
|
5853
|
+
var IsoDatetimeSchema = import_zod51.z.string().datetime({ offset: true });
|
|
5794
5854
|
var SCHEDULE_PAYLOAD_PROMPT_MAX_LENGTH = 5e4;
|
|
5795
|
-
var SchedulePayloadV1Schema =
|
|
5855
|
+
var SchedulePayloadV1Schema = import_zod51.z.object({
|
|
5796
5856
|
/** Required for v1 — `RunService.createRun` rejects empty prompts. */
|
|
5797
|
-
prompt:
|
|
5798
|
-
repo:
|
|
5799
|
-
ref:
|
|
5800
|
-
model:
|
|
5857
|
+
prompt: import_zod51.z.string().min(1).max(SCHEDULE_PAYLOAD_PROMPT_MAX_LENGTH),
|
|
5858
|
+
repo: import_zod51.z.string().max(2048).optional(),
|
|
5859
|
+
ref: import_zod51.z.string().max(255).optional(),
|
|
5860
|
+
model: import_zod51.z.string().max(255).optional(),
|
|
5801
5861
|
/**
|
|
5802
5862
|
* P1.6: tightened from `z.string().max(64).optional()` to
|
|
5803
5863
|
* `ProviderTypeSchema.optional()`. Catches invalid provider strings
|
|
@@ -5813,31 +5873,31 @@ var SchedulePayloadV1Schema = import_zod50.z.object({
|
|
|
5813
5873
|
* cron-triggered runs. Null / undefined falls back to the
|
|
5814
5874
|
* service-level Bedrock key.
|
|
5815
5875
|
*/
|
|
5816
|
-
triggerUserLdap:
|
|
5876
|
+
triggerUserLdap: import_zod51.z.string().min(1).max(255).optional()
|
|
5817
5877
|
}).strict();
|
|
5818
|
-
var SchedulePayloadV2Schema =
|
|
5878
|
+
var SchedulePayloadV2Schema = import_zod51.z.object({
|
|
5819
5879
|
/**
|
|
5820
5880
|
* Sandbox-environment overrides forwarded to
|
|
5821
5881
|
* `CreateSessionRequest.configValues`. Reserved-env-key sanitization
|
|
5822
5882
|
* is enforced at the SessionStartupService boundary; the schema
|
|
5823
5883
|
* here keeps the shape opaque to avoid duplicating that policy.
|
|
5824
5884
|
*/
|
|
5825
|
-
configValues:
|
|
5885
|
+
configValues: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.string()).optional(),
|
|
5826
5886
|
/** Free-form audit metadata; non-functional. */
|
|
5827
|
-
metadata:
|
|
5887
|
+
metadata: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.unknown()).optional()
|
|
5828
5888
|
}).strict();
|
|
5829
|
-
var ScheduleInlineV1PayloadSchema =
|
|
5830
|
-
prompt:
|
|
5831
|
-
repo:
|
|
5832
|
-
ref:
|
|
5833
|
-
model:
|
|
5889
|
+
var ScheduleInlineV1PayloadSchema = import_zod51.z.object({
|
|
5890
|
+
prompt: import_zod51.z.string().min(1).max(SCHEDULE_PAYLOAD_PROMPT_MAX_LENGTH),
|
|
5891
|
+
repo: import_zod51.z.string().min(1).max(2048).optional(),
|
|
5892
|
+
ref: import_zod51.z.string().min(1).max(255).optional(),
|
|
5893
|
+
model: import_zod51.z.string().max(255).optional(),
|
|
5834
5894
|
/**
|
|
5835
5895
|
* P1.6: see `SchedulePayloadV1Schema.provider` — same rationale.
|
|
5836
5896
|
* Closes the unsafe `as RunSpec["provider"]` cast in
|
|
5837
5897
|
* `schedule-dispatcher.ts dispatchInlineV1` (P1.3 review [CONSIDER]).
|
|
5838
5898
|
*/
|
|
5839
5899
|
provider: ProviderTypeSchema.optional(),
|
|
5840
|
-
triggerUserLdap:
|
|
5900
|
+
triggerUserLdap: import_zod51.z.string().min(1).max(255).optional(),
|
|
5841
5901
|
/**
|
|
5842
5902
|
* Per-fire MCP / Skills enable lists — same wire shape the home
|
|
5843
5903
|
* composer sends to `POST /api/agents` (run-level override, spec
|
|
@@ -5861,20 +5921,20 @@ var ScheduleInlineV1PayloadSchema = import_zod50.z.object({
|
|
|
5861
5921
|
* onto every synthesised `RunSpec`, so each cron-created Run sees
|
|
5862
5922
|
* the same attachments. Capped at 5 to match `RunSpec.attachments`.
|
|
5863
5923
|
*/
|
|
5864
|
-
attachments:
|
|
5924
|
+
attachments: import_zod51.z.array(AttachmentMetaSchema).max(5).optional()
|
|
5865
5925
|
}).strict();
|
|
5866
5926
|
var SCHEDULE_INLINE_V2_WORKLOAD_SLUG_REGEX = /^[a-z0-9][a-z0-9-]{0,127}$/;
|
|
5867
|
-
var ScheduleInlineV2PayloadSchema =
|
|
5868
|
-
workloadSlug:
|
|
5927
|
+
var ScheduleInlineV2PayloadSchema = import_zod51.z.object({
|
|
5928
|
+
workloadSlug: import_zod51.z.string().min(1).max(128).refine(
|
|
5869
5929
|
(s) => SCHEDULE_INLINE_V2_WORKLOAD_SLUG_REGEX.test(s),
|
|
5870
5930
|
"workloadSlug must be lowercase alphanumeric / dashes (1..128 chars)"
|
|
5871
5931
|
),
|
|
5872
5932
|
/** Default `"latest"`; UUID strings are treated as revision pin. */
|
|
5873
|
-
revisionSelector:
|
|
5874
|
-
configValues:
|
|
5875
|
-
metadata:
|
|
5933
|
+
revisionSelector: import_zod51.z.union([import_zod51.z.literal("latest"), import_zod51.z.string().uuid()]).default("latest"),
|
|
5934
|
+
configValues: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.string()).optional(),
|
|
5935
|
+
metadata: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.unknown()).optional()
|
|
5876
5936
|
}).strict();
|
|
5877
|
-
var RawPayloadSchema =
|
|
5937
|
+
var RawPayloadSchema = import_zod51.z.record(import_zod51.z.string(), import_zod51.z.unknown());
|
|
5878
5938
|
var ADMISSIBLE_TARGET_VERSION_COMBOS = ["workload:v2", "agent:v1", "inline_v1:v1", "inline_v1:v2", "inline_v2:v2"];
|
|
5879
5939
|
function refineTargetFields(schema) {
|
|
5880
5940
|
return schema.superRefine((value, ctx) => {
|
|
@@ -5882,14 +5942,14 @@ function refineTargetFields(schema) {
|
|
|
5882
5942
|
case "workload": {
|
|
5883
5943
|
if (!value.targetWorkloadId) {
|
|
5884
5944
|
ctx.addIssue({
|
|
5885
|
-
code:
|
|
5945
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5886
5946
|
message: "targetWorkloadId is required when targetKind is 'workload'",
|
|
5887
5947
|
path: ["targetWorkloadId"]
|
|
5888
5948
|
});
|
|
5889
5949
|
}
|
|
5890
5950
|
if (value.targetAgentId) {
|
|
5891
5951
|
ctx.addIssue({
|
|
5892
|
-
code:
|
|
5952
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5893
5953
|
message: "targetAgentId must be omitted when targetKind is 'workload'",
|
|
5894
5954
|
path: ["targetAgentId"]
|
|
5895
5955
|
});
|
|
@@ -5899,21 +5959,21 @@ function refineTargetFields(schema) {
|
|
|
5899
5959
|
case "agent": {
|
|
5900
5960
|
if (!value.targetAgentId) {
|
|
5901
5961
|
ctx.addIssue({
|
|
5902
|
-
code:
|
|
5962
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5903
5963
|
message: "targetAgentId is required when targetKind is 'agent'",
|
|
5904
5964
|
path: ["targetAgentId"]
|
|
5905
5965
|
});
|
|
5906
5966
|
}
|
|
5907
5967
|
if (value.targetWorkloadId) {
|
|
5908
5968
|
ctx.addIssue({
|
|
5909
|
-
code:
|
|
5969
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5910
5970
|
message: "targetWorkloadId must be omitted when targetKind is 'agent'",
|
|
5911
5971
|
path: ["targetWorkloadId"]
|
|
5912
5972
|
});
|
|
5913
5973
|
}
|
|
5914
5974
|
if (value.targetRevisionId) {
|
|
5915
5975
|
ctx.addIssue({
|
|
5916
|
-
code:
|
|
5976
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5917
5977
|
message: "targetRevisionId is only allowed when targetKind is 'workload'",
|
|
5918
5978
|
path: ["targetRevisionId"]
|
|
5919
5979
|
});
|
|
@@ -5924,21 +5984,21 @@ function refineTargetFields(schema) {
|
|
|
5924
5984
|
case "inline_v2": {
|
|
5925
5985
|
if (value.targetWorkloadId) {
|
|
5926
5986
|
ctx.addIssue({
|
|
5927
|
-
code:
|
|
5987
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5928
5988
|
message: `targetWorkloadId must be omitted when targetKind is '${value.targetKind}'`,
|
|
5929
5989
|
path: ["targetWorkloadId"]
|
|
5930
5990
|
});
|
|
5931
5991
|
}
|
|
5932
5992
|
if (value.targetAgentId) {
|
|
5933
5993
|
ctx.addIssue({
|
|
5934
|
-
code:
|
|
5994
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5935
5995
|
message: `targetAgentId must be omitted when targetKind is '${value.targetKind}'`,
|
|
5936
5996
|
path: ["targetAgentId"]
|
|
5937
5997
|
});
|
|
5938
5998
|
}
|
|
5939
5999
|
if (value.targetRevisionId) {
|
|
5940
6000
|
ctx.addIssue({
|
|
5941
|
-
code:
|
|
6001
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5942
6002
|
message: `targetRevisionId must be omitted when targetKind is '${value.targetKind}' (use payload.revisionSelector for inline_v2)`,
|
|
5943
6003
|
path: ["targetRevisionId"]
|
|
5944
6004
|
});
|
|
@@ -5949,7 +6009,7 @@ function refineTargetFields(schema) {
|
|
|
5949
6009
|
const combo = `${value.targetKind}:${value.pilotApiVersionPreference}`;
|
|
5950
6010
|
if (!ADMISSIBLE_TARGET_VERSION_COMBOS.includes(combo)) {
|
|
5951
6011
|
ctx.addIssue({
|
|
5952
|
-
code:
|
|
6012
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5953
6013
|
message: `Unsupported (targetKind, pilotApiVersionPreference) combination. Admissible: ${ADMISSIBLE_TARGET_VERSION_COMBOS.join(
|
|
5954
6014
|
", "
|
|
5955
6015
|
)}`,
|
|
@@ -5959,7 +6019,7 @@ function refineTargetFields(schema) {
|
|
|
5959
6019
|
const isInline = value.targetKind === "inline_v1" || value.targetKind === "inline_v2";
|
|
5960
6020
|
if (!isInline && !value.projectId) {
|
|
5961
6021
|
ctx.addIssue({
|
|
5962
|
-
code:
|
|
6022
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5963
6023
|
message: `projectId is required when targetKind is '${value.targetKind}'`,
|
|
5964
6024
|
path: ["projectId"]
|
|
5965
6025
|
});
|
|
@@ -5968,7 +6028,7 @@ function refineTargetFields(schema) {
|
|
|
5968
6028
|
const hasOwner = Boolean(value.ownerLdap && value.ownerLdap.length > 0);
|
|
5969
6029
|
if (!hasProject && !hasOwner) {
|
|
5970
6030
|
ctx.addIssue({
|
|
5971
|
-
code:
|
|
6031
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5972
6032
|
message: "At least one of projectId / ownerLdap must be present (project-or-owner anchor)",
|
|
5973
6033
|
path: ["ownerLdap"]
|
|
5974
6034
|
});
|
|
@@ -5982,7 +6042,7 @@ function refineLifecycleWindow(schema) {
|
|
|
5982
6042
|
const end = Date.parse(value.endAt);
|
|
5983
6043
|
if (Number.isFinite(start) && Number.isFinite(end) && end <= start) {
|
|
5984
6044
|
ctx.addIssue({
|
|
5985
|
-
code:
|
|
6045
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
5986
6046
|
message: "endAt must be strictly later than startAt",
|
|
5987
6047
|
path: ["endAt"]
|
|
5988
6048
|
});
|
|
@@ -5990,13 +6050,13 @@ function refineLifecycleWindow(schema) {
|
|
|
5990
6050
|
}
|
|
5991
6051
|
});
|
|
5992
6052
|
}
|
|
5993
|
-
var CreateScheduleRequestBaseSchema =
|
|
6053
|
+
var CreateScheduleRequestBaseSchema = import_zod51.z.object({
|
|
5994
6054
|
/**
|
|
5995
6055
|
* Host project. Required for `targetKind ∈ {workload, agent}` (P0
|
|
5996
6056
|
* shape); MAY be null for `inline_v1` / `inline_v2`. When null, the
|
|
5997
6057
|
* `ownerLdap` field becomes the sole authorization anchor.
|
|
5998
6058
|
*/
|
|
5999
|
-
projectId:
|
|
6059
|
+
projectId: import_zod51.z.string().uuid().nullable().optional(),
|
|
6000
6060
|
/**
|
|
6001
6061
|
* LDAP of the schedule owner (P1.2). Distinct from the implicit
|
|
6002
6062
|
* `createdBy` which is captured server-side from the auth context.
|
|
@@ -6004,20 +6064,20 @@ var CreateScheduleRequestBaseSchema = import_zod50.z.object({
|
|
|
6004
6064
|
* authoritative for enforcing "createdBy === ownerLdap" on create
|
|
6005
6065
|
* (delegation / ownership transfer is an explicit follow-up).
|
|
6006
6066
|
*/
|
|
6007
|
-
ownerLdap:
|
|
6008
|
-
displayName:
|
|
6009
|
-
description:
|
|
6067
|
+
ownerLdap: import_zod51.z.string().min(1).max(255).optional(),
|
|
6068
|
+
displayName: import_zod51.z.string().min(1, "displayName must be non-empty").max(SCHEDULE_DISPLAY_NAME_MAX_LENGTH),
|
|
6069
|
+
description: import_zod51.z.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
6010
6070
|
cronExpression: CronExpressionSchema,
|
|
6011
6071
|
timezone: TimezoneStringSchema,
|
|
6012
6072
|
targetKind: ScheduleTargetKindSchema,
|
|
6013
|
-
targetWorkloadId:
|
|
6014
|
-
targetRevisionId:
|
|
6015
|
-
targetAgentId:
|
|
6073
|
+
targetWorkloadId: import_zod51.z.string().uuid().optional(),
|
|
6074
|
+
targetRevisionId: import_zod51.z.string().uuid().optional(),
|
|
6075
|
+
targetAgentId: import_zod51.z.string().uuid().optional(),
|
|
6016
6076
|
pilotApiVersionPreference: ScheduleApiVersionPreferenceSchema,
|
|
6017
6077
|
concurrencyPolicy: ScheduleConcurrencyPolicySchema.default("allow"),
|
|
6018
6078
|
misfirePolicy: ScheduleMisfirePolicySchema.default("skip"),
|
|
6019
|
-
misfireGraceSeconds:
|
|
6020
|
-
consecutiveFailureThreshold:
|
|
6079
|
+
misfireGraceSeconds: import_zod51.z.number().int().min(SCHEDULE_MISFIRE_GRACE_SECONDS_MIN).max(SCHEDULE_MISFIRE_GRACE_SECONDS_MAX).default(SCHEDULE_MISFIRE_GRACE_SECONDS_DEFAULT),
|
|
6080
|
+
consecutiveFailureThreshold: import_zod51.z.number().int().min(SCHEDULE_FAILURE_THRESHOLD_MIN).max(SCHEDULE_FAILURE_THRESHOLD_MAX).default(SCHEDULE_FAILURE_THRESHOLD_DEFAULT),
|
|
6021
6081
|
startAt: IsoDatetimeSchema.optional(),
|
|
6022
6082
|
endAt: IsoDatetimeSchema.optional(),
|
|
6023
6083
|
/**
|
|
@@ -6048,7 +6108,7 @@ function refinePayload(schema) {
|
|
|
6048
6108
|
if (!result.success) {
|
|
6049
6109
|
for (const issue of result.error.issues) {
|
|
6050
6110
|
ctx.addIssue({
|
|
6051
|
-
code:
|
|
6111
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6052
6112
|
message: issue.message,
|
|
6053
6113
|
path: ["payload", ...issue.path]
|
|
6054
6114
|
});
|
|
@@ -6059,21 +6119,21 @@ function refinePayload(schema) {
|
|
|
6059
6119
|
var CreateScheduleRequestSchema = refinePayload(
|
|
6060
6120
|
refineLifecycleWindow(refineTargetFields(CreateScheduleRequestBaseSchema))
|
|
6061
6121
|
);
|
|
6062
|
-
var UpdateScheduleRequestBaseSchema =
|
|
6063
|
-
displayName:
|
|
6064
|
-
description:
|
|
6122
|
+
var UpdateScheduleRequestBaseSchema = import_zod51.z.object({
|
|
6123
|
+
displayName: import_zod51.z.string().min(1).max(SCHEDULE_DISPLAY_NAME_MAX_LENGTH).optional(),
|
|
6124
|
+
description: import_zod51.z.string().max(SCHEDULE_DESCRIPTION_MAX_LENGTH).nullable().optional(),
|
|
6065
6125
|
/**
|
|
6066
6126
|
* Convenience field — `true` ⇒ lifecycle_status='active',
|
|
6067
6127
|
* `false` ⇒ lifecycle_status='disabled'. Cannot reach `deleted`
|
|
6068
6128
|
* via PATCH (use DELETE).
|
|
6069
6129
|
*/
|
|
6070
|
-
enabled:
|
|
6130
|
+
enabled: import_zod51.z.boolean().optional(),
|
|
6071
6131
|
cronExpression: CronExpressionSchema.optional(),
|
|
6072
6132
|
timezone: TimezoneStringSchema.optional(),
|
|
6073
6133
|
concurrencyPolicy: ScheduleConcurrencyPolicySchema.optional(),
|
|
6074
6134
|
misfirePolicy: ScheduleMisfirePolicySchema.optional(),
|
|
6075
|
-
misfireGraceSeconds:
|
|
6076
|
-
consecutiveFailureThreshold:
|
|
6135
|
+
misfireGraceSeconds: import_zod51.z.number().int().min(SCHEDULE_MISFIRE_GRACE_SECONDS_MIN).max(SCHEDULE_MISFIRE_GRACE_SECONDS_MAX).optional(),
|
|
6136
|
+
consecutiveFailureThreshold: import_zod51.z.number().int().min(SCHEDULE_FAILURE_THRESHOLD_MIN).max(SCHEDULE_FAILURE_THRESHOLD_MAX).optional(),
|
|
6077
6137
|
endAt: IsoDatetimeSchema.nullable().optional(),
|
|
6078
6138
|
/**
|
|
6079
6139
|
* Replaces the entire dispatch payload. Null is forbidden — to
|
|
@@ -6088,41 +6148,41 @@ var UpdateScheduleRequestSchema = UpdateScheduleRequestBaseSchema.refine(
|
|
|
6088
6148
|
(data) => Object.keys(data).length > 0,
|
|
6089
6149
|
{ message: "PATCH body must contain at least one field" }
|
|
6090
6150
|
);
|
|
6091
|
-
var ScheduleViewBaseSchema =
|
|
6092
|
-
id:
|
|
6151
|
+
var ScheduleViewBaseSchema = import_zod51.z.object({
|
|
6152
|
+
id: import_zod51.z.string().uuid(),
|
|
6093
6153
|
/**
|
|
6094
6154
|
* Nullable since P1.2 — only inline kinds may have null projectId in
|
|
6095
6155
|
* persisted form; workload / agent kinds keep it set (enforced at
|
|
6096
6156
|
* create time and by DB shape CHECK).
|
|
6097
6157
|
*/
|
|
6098
|
-
projectId:
|
|
6158
|
+
projectId: import_zod51.z.string().uuid().nullable(),
|
|
6099
6159
|
/**
|
|
6100
6160
|
* Owner LDAP (P1.2). NOT NULL in DB; the read shape exposes it for
|
|
6101
6161
|
* UI to render "owned by" labels and for permission checks on
|
|
6102
6162
|
* project-less schedules.
|
|
6103
6163
|
*/
|
|
6104
|
-
ownerLdap:
|
|
6105
|
-
displayName:
|
|
6106
|
-
description:
|
|
6107
|
-
cronExpression:
|
|
6108
|
-
timezone:
|
|
6164
|
+
ownerLdap: import_zod51.z.string(),
|
|
6165
|
+
displayName: import_zod51.z.string(),
|
|
6166
|
+
description: import_zod51.z.string().nullable(),
|
|
6167
|
+
cronExpression: import_zod51.z.string(),
|
|
6168
|
+
timezone: import_zod51.z.string(),
|
|
6109
6169
|
targetKind: ScheduleTargetKindSchema,
|
|
6110
|
-
targetWorkloadId:
|
|
6111
|
-
targetRevisionId:
|
|
6112
|
-
targetAgentId:
|
|
6170
|
+
targetWorkloadId: import_zod51.z.string().uuid().nullable(),
|
|
6171
|
+
targetRevisionId: import_zod51.z.string().uuid().nullable(),
|
|
6172
|
+
targetAgentId: import_zod51.z.string().uuid().nullable(),
|
|
6113
6173
|
pilotApiVersionPreference: ScheduleApiVersionPreferenceSchema,
|
|
6114
6174
|
lifecycleStatus: ScheduleLifecycleStatusSchema,
|
|
6115
6175
|
concurrencyPolicy: ScheduleConcurrencyPolicySchema,
|
|
6116
6176
|
misfirePolicy: ScheduleMisfirePolicySchema,
|
|
6117
|
-
misfireGraceSeconds:
|
|
6177
|
+
misfireGraceSeconds: import_zod51.z.number().int().nonnegative(),
|
|
6118
6178
|
startAt: IsoDatetimeSchema.nullable(),
|
|
6119
6179
|
endAt: IsoDatetimeSchema.nullable(),
|
|
6120
6180
|
payload: RawPayloadSchema,
|
|
6121
|
-
consecutiveFailureCount:
|
|
6122
|
-
consecutiveFailureThreshold:
|
|
6181
|
+
consecutiveFailureCount: import_zod51.z.number().int().nonnegative(),
|
|
6182
|
+
consecutiveFailureThreshold: import_zod51.z.number().int().positive(),
|
|
6123
6183
|
lastTriggerAt: IsoDatetimeSchema.nullable(),
|
|
6124
6184
|
nextFireAt: IsoDatetimeSchema.nullable(),
|
|
6125
|
-
createdBy:
|
|
6185
|
+
createdBy: import_zod51.z.string(),
|
|
6126
6186
|
createdAt: IsoDatetimeSchema,
|
|
6127
6187
|
updatedAt: IsoDatetimeSchema,
|
|
6128
6188
|
deletedAt: IsoDatetimeSchema.nullable()
|
|
@@ -6147,37 +6207,37 @@ var ScheduleListItemSchema = ScheduleViewBaseSchema.pick({
|
|
|
6147
6207
|
createdAt: true,
|
|
6148
6208
|
updatedAt: true
|
|
6149
6209
|
});
|
|
6150
|
-
var ScheduleListResponseSchema =
|
|
6151
|
-
items:
|
|
6152
|
-
nextCursor:
|
|
6210
|
+
var ScheduleListResponseSchema = import_zod51.z.object({
|
|
6211
|
+
items: import_zod51.z.array(ScheduleListItemSchema),
|
|
6212
|
+
nextCursor: import_zod51.z.string().optional()
|
|
6153
6213
|
});
|
|
6154
|
-
var ScheduleTriggerViewSchema =
|
|
6155
|
-
id:
|
|
6156
|
-
scheduleId:
|
|
6214
|
+
var ScheduleTriggerViewSchema = import_zod51.z.object({
|
|
6215
|
+
id: import_zod51.z.string().uuid(),
|
|
6216
|
+
scheduleId: import_zod51.z.string().uuid(),
|
|
6157
6217
|
firedAt: IsoDatetimeSchema,
|
|
6158
6218
|
triggerSource: ScheduleTriggerSourceSchema,
|
|
6159
6219
|
status: ScheduleTriggerStatusSchema,
|
|
6160
6220
|
dispatchedAt: IsoDatetimeSchema.nullable(),
|
|
6161
|
-
dispatchedRunId:
|
|
6162
|
-
dispatchedSessionId:
|
|
6221
|
+
dispatchedRunId: import_zod51.z.string().uuid().nullable(),
|
|
6222
|
+
dispatchedSessionId: import_zod51.z.string().uuid().nullable(),
|
|
6163
6223
|
/**
|
|
6164
6224
|
* Owning agent of the dispatched Run / Session, when one exists.
|
|
6165
6225
|
* Run IDs join `runs.id`; Session IDs join `runs.session_id` with a
|
|
6166
6226
|
* cold-start legacy fallback to the matching run ID.
|
|
6167
6227
|
*/
|
|
6168
|
-
dispatchedAgentId:
|
|
6228
|
+
dispatchedAgentId: import_zod51.z.string().uuid().nullable(),
|
|
6169
6229
|
skippedReason: ScheduleSkippedReasonSchema.nullable(),
|
|
6170
6230
|
failureReasonCode: ScheduleFailureReasonCodeSchema.nullable(),
|
|
6171
|
-
failureReasonMessage:
|
|
6172
|
-
idempotencyKey:
|
|
6173
|
-
attemptCount:
|
|
6174
|
-
blockingTriggerId:
|
|
6231
|
+
failureReasonMessage: import_zod51.z.string().max(SCHEDULE_FAILURE_REASON_MESSAGE_MAX_LENGTH).nullable(),
|
|
6232
|
+
idempotencyKey: import_zod51.z.string(),
|
|
6233
|
+
attemptCount: import_zod51.z.number().int().nonnegative(),
|
|
6234
|
+
blockingTriggerId: import_zod51.z.string().uuid().nullable(),
|
|
6175
6235
|
createdAt: IsoDatetimeSchema
|
|
6176
6236
|
}).superRefine((trigger, ctx) => {
|
|
6177
6237
|
if (trigger.status === "dispatched") {
|
|
6178
6238
|
if (!trigger.dispatchedAt) {
|
|
6179
6239
|
ctx.addIssue({
|
|
6180
|
-
code:
|
|
6240
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6181
6241
|
message: "dispatchedAt is required when status is 'dispatched'",
|
|
6182
6242
|
path: ["dispatchedAt"]
|
|
6183
6243
|
});
|
|
@@ -6186,7 +6246,7 @@ var ScheduleTriggerViewSchema = import_zod50.z.object({
|
|
|
6186
6246
|
const hasSession = trigger.dispatchedSessionId !== null;
|
|
6187
6247
|
if (hasRun === hasSession) {
|
|
6188
6248
|
ctx.addIssue({
|
|
6189
|
-
code:
|
|
6249
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6190
6250
|
message: "Exactly one of dispatchedRunId / dispatchedSessionId must be set when status is 'dispatched'",
|
|
6191
6251
|
path: ["dispatchedRunId"]
|
|
6192
6252
|
});
|
|
@@ -6194,7 +6254,7 @@ var ScheduleTriggerViewSchema = import_zod50.z.object({
|
|
|
6194
6254
|
} else {
|
|
6195
6255
|
if (trigger.dispatchedAt !== null) {
|
|
6196
6256
|
ctx.addIssue({
|
|
6197
|
-
code:
|
|
6257
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6198
6258
|
message: "dispatchedAt must be null when status is not 'dispatched'",
|
|
6199
6259
|
path: ["dispatchedAt"]
|
|
6200
6260
|
});
|
|
@@ -6202,74 +6262,74 @@ var ScheduleTriggerViewSchema = import_zod50.z.object({
|
|
|
6202
6262
|
}
|
|
6203
6263
|
if (trigger.status === "skipped" && trigger.skippedReason === null) {
|
|
6204
6264
|
ctx.addIssue({
|
|
6205
|
-
code:
|
|
6265
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6206
6266
|
message: "skippedReason is required when status is 'skipped'",
|
|
6207
6267
|
path: ["skippedReason"]
|
|
6208
6268
|
});
|
|
6209
6269
|
}
|
|
6210
6270
|
if (trigger.status !== "skipped" && trigger.skippedReason !== null) {
|
|
6211
6271
|
ctx.addIssue({
|
|
6212
|
-
code:
|
|
6272
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6213
6273
|
message: "skippedReason must be null when status is not 'skipped'",
|
|
6214
6274
|
path: ["skippedReason"]
|
|
6215
6275
|
});
|
|
6216
6276
|
}
|
|
6217
6277
|
if (trigger.status === "failed_to_dispatch" && trigger.failureReasonCode === null) {
|
|
6218
6278
|
ctx.addIssue({
|
|
6219
|
-
code:
|
|
6279
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6220
6280
|
message: "failureReasonCode is required when status is 'failed_to_dispatch'",
|
|
6221
6281
|
path: ["failureReasonCode"]
|
|
6222
6282
|
});
|
|
6223
6283
|
}
|
|
6224
6284
|
if (trigger.status !== "failed_to_dispatch" && trigger.failureReasonCode !== null) {
|
|
6225
6285
|
ctx.addIssue({
|
|
6226
|
-
code:
|
|
6286
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6227
6287
|
message: "failureReasonCode must be null when status is not 'failed_to_dispatch'",
|
|
6228
6288
|
path: ["failureReasonCode"]
|
|
6229
6289
|
});
|
|
6230
6290
|
}
|
|
6231
6291
|
if (trigger.blockingTriggerId !== null && !(trigger.status === "skipped" && trigger.skippedReason === "concurrency_forbidden")) {
|
|
6232
6292
|
ctx.addIssue({
|
|
6233
|
-
code:
|
|
6293
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6234
6294
|
message: "blockingTriggerId is only meaningful for skipped+concurrency_forbidden rows",
|
|
6235
6295
|
path: ["blockingTriggerId"]
|
|
6236
6296
|
});
|
|
6237
6297
|
}
|
|
6238
6298
|
});
|
|
6239
|
-
var ScheduleTriggerListResponseSchema =
|
|
6240
|
-
items:
|
|
6241
|
-
nextCursor:
|
|
6299
|
+
var ScheduleTriggerListResponseSchema = import_zod51.z.object({
|
|
6300
|
+
items: import_zod51.z.array(ScheduleTriggerViewSchema),
|
|
6301
|
+
nextCursor: import_zod51.z.string().optional()
|
|
6242
6302
|
});
|
|
6243
|
-
var RunScheduleResponseSchema =
|
|
6244
|
-
triggerId:
|
|
6245
|
-
dispatchedRunId:
|
|
6246
|
-
dispatchedSessionId:
|
|
6303
|
+
var RunScheduleResponseSchema = import_zod51.z.object({
|
|
6304
|
+
triggerId: import_zod51.z.string().uuid(),
|
|
6305
|
+
dispatchedRunId: import_zod51.z.string().uuid().optional(),
|
|
6306
|
+
dispatchedSessionId: import_zod51.z.string().uuid().optional()
|
|
6247
6307
|
}).superRefine((value, ctx) => {
|
|
6248
6308
|
const hasRun = value.dispatchedRunId !== void 0;
|
|
6249
6309
|
const hasSession = value.dispatchedSessionId !== void 0;
|
|
6250
6310
|
if (hasRun === hasSession) {
|
|
6251
6311
|
ctx.addIssue({
|
|
6252
|
-
code:
|
|
6312
|
+
code: import_zod51.z.ZodIssueCode.custom,
|
|
6253
6313
|
message: "Exactly one of dispatchedRunId / dispatchedSessionId must be present in run-now response"
|
|
6254
6314
|
});
|
|
6255
6315
|
}
|
|
6256
6316
|
});
|
|
6257
|
-
var ScheduleApiErrorBodySchema =
|
|
6258
|
-
error:
|
|
6317
|
+
var ScheduleApiErrorBodySchema = import_zod51.z.object({
|
|
6318
|
+
error: import_zod51.z.object({
|
|
6259
6319
|
code: ScheduleApiErrorCodeSchema,
|
|
6260
|
-
message:
|
|
6261
|
-
details:
|
|
6320
|
+
message: import_zod51.z.string(),
|
|
6321
|
+
details: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.unknown()).optional()
|
|
6262
6322
|
})
|
|
6263
6323
|
});
|
|
6264
|
-
var EnvChangeFanoutJobSchema =
|
|
6265
|
-
environmentId:
|
|
6266
|
-
projectId:
|
|
6267
|
-
trigger:
|
|
6324
|
+
var EnvChangeFanoutJobSchema = import_zod52.z.object({
|
|
6325
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6326
|
+
projectId: import_zod52.z.string().uuid(),
|
|
6327
|
+
trigger: import_zod52.z.enum(["env_change", "rebake"]).default("env_change")
|
|
6268
6328
|
}).strict();
|
|
6269
|
-
var EnvironmentReleasePropagationJobSchema =
|
|
6270
|
-
environmentId:
|
|
6329
|
+
var EnvironmentReleasePropagationJobSchema = import_zod52.z.object({
|
|
6330
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6271
6331
|
/** Released base template name (patch source + mirror-refresh pairing key). */
|
|
6272
|
-
baseTemplateName:
|
|
6332
|
+
baseTemplateName: import_zod52.z.string().min(1),
|
|
6273
6333
|
/**
|
|
6274
6334
|
* Release identity (E-DEC6): the `platform_release` version's idempotency
|
|
6275
6335
|
* key — a redelivered job never creates a duplicate version (template
|
|
@@ -6277,46 +6337,46 @@ var EnvironmentReleasePropagationJobSchema = import_zod51.z.object({
|
|
|
6277
6337
|
* deploy-window compatibility with in-flight pre-E-DEC6 jobs; the worker
|
|
6278
6338
|
* falls back to `legacy:<baseTemplateName>`.
|
|
6279
6339
|
*/
|
|
6280
|
-
releaseRef:
|
|
6340
|
+
releaseRef: import_zod52.z.string().min(1).optional()
|
|
6281
6341
|
}).strict();
|
|
6282
|
-
var EnvironmentPackagesBuildJobSchema =
|
|
6283
|
-
environmentId:
|
|
6342
|
+
var EnvironmentPackagesBuildJobSchema = import_zod52.z.object({
|
|
6343
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6284
6344
|
/**
|
|
6285
6345
|
* The building version. Its predecessor (version - 1, or none when this
|
|
6286
6346
|
* is v1) is the CAS `fromVersion` of the deferred second-phase repoint
|
|
6287
6347
|
* (PKG-D3) — versions are strictly monotonic (+1 under the env row
|
|
6288
6348
|
* lock), so it is derived, not carried.
|
|
6289
6349
|
*/
|
|
6290
|
-
version:
|
|
6350
|
+
version: import_zod52.z.number().int().positive(),
|
|
6291
6351
|
/** Who initiated the edit (repoint ledger actor on the second phase). */
|
|
6292
|
-
actor:
|
|
6352
|
+
actor: import_zod52.z.string().nullable(),
|
|
6293
6353
|
/**
|
|
6294
6354
|
* ENV-V5 flag captured at the edit: false = advanced create-only path —
|
|
6295
6355
|
* the second phase skips the repoint even after a successful build.
|
|
6296
6356
|
*/
|
|
6297
|
-
repointReferences:
|
|
6357
|
+
repointReferences: import_zod52.z.boolean().default(true),
|
|
6298
6358
|
/**
|
|
6299
6359
|
* Ledger source of the second-phase repoint: user_edit for interactive
|
|
6300
6360
|
* edits, platform_release for the PKG-D7 rebake pipeline.
|
|
6301
6361
|
*/
|
|
6302
|
-
repointSource:
|
|
6362
|
+
repointSource: import_zod52.z.enum(["user_edit", "platform_release"]).default("user_edit"),
|
|
6303
6363
|
/** trigger = generate+start the build; poll = check build status. */
|
|
6304
|
-
phase:
|
|
6364
|
+
phase: import_zod52.z.enum(["trigger", "poll"]).default("trigger")
|
|
6305
6365
|
}).strict();
|
|
6306
|
-
var EnvironmentDeleteCleanupJobSchema =
|
|
6307
|
-
projectId:
|
|
6308
|
-
environmentId:
|
|
6366
|
+
var EnvironmentDeleteCleanupJobSchema = import_zod52.z.object({
|
|
6367
|
+
projectId: import_zod52.z.string().uuid(),
|
|
6368
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6309
6369
|
/** Archived Dockerfile paths captured from `environment_versions` right before the delete. */
|
|
6310
|
-
dockerfilePaths:
|
|
6370
|
+
dockerfilePaths: import_zod52.z.array(import_zod52.z.string().min(1)).min(1)
|
|
6311
6371
|
}).strict();
|
|
6312
|
-
var EnvironmentStatusSchema =
|
|
6313
|
-
var EnvironmentVersionSourceSchema =
|
|
6372
|
+
var EnvironmentStatusSchema = import_zod52.z.enum(["active", "archived"]);
|
|
6373
|
+
var EnvironmentVersionSourceSchema = import_zod52.z.enum([
|
|
6314
6374
|
"user_edit",
|
|
6315
6375
|
"platform_release",
|
|
6316
6376
|
"seed",
|
|
6317
6377
|
"backfill"
|
|
6318
6378
|
]);
|
|
6319
|
-
var EnvironmentRepointSourceSchema =
|
|
6379
|
+
var EnvironmentRepointSourceSchema = import_zod52.z.enum([
|
|
6320
6380
|
"user_edit",
|
|
6321
6381
|
"platform_release",
|
|
6322
6382
|
"stage_binding",
|
|
@@ -6325,9 +6385,9 @@ var EnvironmentRepointSourceSchema = import_zod51.z.enum([
|
|
|
6325
6385
|
]);
|
|
6326
6386
|
var ENVIRONMENT_CPU_QUANTITY_RE = /^\d+(\.\d+)?m?$/;
|
|
6327
6387
|
var ENVIRONMENT_MEMORY_QUANTITY_RE = /^\d+(\.\d+)?(Ki|Mi|Gi|Ti|K|M|G|T)$/;
|
|
6328
|
-
var EnvironmentResourcesSchema =
|
|
6329
|
-
cpu:
|
|
6330
|
-
memory:
|
|
6388
|
+
var EnvironmentResourcesSchema = import_zod52.z.object({
|
|
6389
|
+
cpu: import_zod52.z.string().regex(ENVIRONMENT_CPU_QUANTITY_RE, 'cpu must be a K8s quantity like "2", "0.5" or "500m"'),
|
|
6390
|
+
memory: import_zod52.z.string().regex(ENVIRONMENT_MEMORY_QUANTITY_RE, 'memory must be a K8s quantity like "4Gi" or "512Mi"')
|
|
6331
6391
|
}).strict();
|
|
6332
6392
|
var RESERVED_ENVIRONMENT_ENV_PREFIXES = [
|
|
6333
6393
|
"POD_AGENT_",
|
|
@@ -6363,14 +6423,14 @@ function findReservedEnvironmentEnvKey(envVars) {
|
|
|
6363
6423
|
return null;
|
|
6364
6424
|
}
|
|
6365
6425
|
var ENVIRONMENT_ENV_VAR_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
6366
|
-
var EnvironmentEnvVarsSchema =
|
|
6367
|
-
|
|
6368
|
-
|
|
6426
|
+
var EnvironmentEnvVarsSchema = import_zod52.z.record(
|
|
6427
|
+
import_zod52.z.string().regex(ENVIRONMENT_ENV_VAR_KEY_RE, "env var keys must match [A-Za-z_][A-Za-z0-9_]*"),
|
|
6428
|
+
import_zod52.z.string().max(4e3)
|
|
6369
6429
|
).superRefine((envVars, ctx) => {
|
|
6370
6430
|
const reserved = findReservedEnvironmentEnvKey(envVars);
|
|
6371
6431
|
if (reserved) {
|
|
6372
6432
|
ctx.addIssue({
|
|
6373
|
-
code:
|
|
6433
|
+
code: import_zod52.z.ZodIssueCode.custom,
|
|
6374
6434
|
path: [reserved],
|
|
6375
6435
|
// `params.pilotPolicyCode` is LOAD-BEARING: `classifyEnvironmentInputIssues`
|
|
6376
6436
|
// (below) reads it so the four environment routes (agent-hub +
|
|
@@ -6387,14 +6447,14 @@ var EnvironmentEnvVarsSchema = import_zod51.z.record(
|
|
|
6387
6447
|
});
|
|
6388
6448
|
}
|
|
6389
6449
|
});
|
|
6390
|
-
var EnvironmentDefaultTtlSecondsSchema =
|
|
6450
|
+
var EnvironmentDefaultTtlSecondsSchema = import_zod52.z.number().int().positive().max(30 * 24 * 60 * 60);
|
|
6391
6451
|
var ENVIRONMENT_PACKAGE_ENTRY_PATTERN = /^[A-Za-z0-9@_][A-Za-z0-9@._/:+,[\]<>=!~^*-]*$/;
|
|
6392
|
-
var EnvironmentPackageEntrySchema =
|
|
6452
|
+
var EnvironmentPackageEntrySchema = import_zod52.z.string().min(1).max(128).regex(
|
|
6393
6453
|
ENVIRONMENT_PACKAGE_ENTRY_PATTERN,
|
|
6394
6454
|
"package entries must not contain whitespace or shell metacharacters (PKG-D1)"
|
|
6395
6455
|
);
|
|
6396
|
-
var environmentPackageListSchema =
|
|
6397
|
-
var EnvironmentPackagesSchema =
|
|
6456
|
+
var environmentPackageListSchema = import_zod52.z.array(EnvironmentPackageEntrySchema).max(64);
|
|
6457
|
+
var EnvironmentPackagesSchema = import_zod52.z.object({
|
|
6398
6458
|
pip: environmentPackageListSchema.optional(),
|
|
6399
6459
|
npm: environmentPackageListSchema.optional(),
|
|
6400
6460
|
apt: environmentPackageListSchema.optional(),
|
|
@@ -6407,7 +6467,7 @@ function normalizeEnvironmentPackages(value) {
|
|
|
6407
6467
|
const entries = Object.entries(value).filter(([, list]) => list !== void 0 && list.length > 0);
|
|
6408
6468
|
return entries.length > 0 ? Object.fromEntries(entries) : null;
|
|
6409
6469
|
}
|
|
6410
|
-
var EnvironmentConfigSchema =
|
|
6470
|
+
var EnvironmentConfigSchema = import_zod52.z.object({
|
|
6411
6471
|
// PKG-D1 shape + PKG-D2 gate: malformed packages → 400 here; a VALID
|
|
6412
6472
|
// non-null value still 422s via findUnsupportedEnvironmentConfigField
|
|
6413
6473
|
// until the P2.1-A2 pipeline PR flips the gate. Tightening from
|
|
@@ -6417,7 +6477,7 @@ var EnvironmentConfigSchema = import_zod51.z.object({
|
|
|
6417
6477
|
// drops the optional mark) — `.optional()` restores the v3 inference so
|
|
6418
6478
|
// callers can construct partial configs; runtime behavior is unchanged.
|
|
6419
6479
|
packages: EnvironmentPackagesSchema.nullish().transform(normalizeEnvironmentPackages).optional(),
|
|
6420
|
-
networking:
|
|
6480
|
+
networking: import_zod52.z.unknown().nullish(),
|
|
6421
6481
|
resources: EnvironmentResourcesSchema.nullish(),
|
|
6422
6482
|
// Normalize an empty `{}` to `null` (E-DEC4 null-representation LOCK — the
|
|
6423
6483
|
// pool-fingerprint hash must not see `{}` vs `null` as different). Preserve
|
|
@@ -6428,72 +6488,72 @@ var EnvironmentConfigSchema = import_zod51.z.object({
|
|
|
6428
6488
|
).optional(),
|
|
6429
6489
|
defaultTtlSeconds: EnvironmentDefaultTtlSecondsSchema.nullish()
|
|
6430
6490
|
}).strict();
|
|
6431
|
-
var EnvironmentVersionConfigSchema =
|
|
6432
|
-
provider:
|
|
6433
|
-
providerPoolName:
|
|
6491
|
+
var EnvironmentVersionConfigSchema = import_zod52.z.object({
|
|
6492
|
+
provider: import_zod52.z.string(),
|
|
6493
|
+
providerPoolName: import_zod52.z.string().nullish(),
|
|
6434
6494
|
/** Base identity at version creation (null = the row itself is a base). */
|
|
6435
|
-
baseProviderTemplateName:
|
|
6436
|
-
resources:
|
|
6495
|
+
baseProviderTemplateName: import_zod52.z.string().nullish(),
|
|
6496
|
+
resources: import_zod52.z.object({ cpu: import_zod52.z.string(), memory: import_zod52.z.string() }).nullish(),
|
|
6437
6497
|
/** RAW record — no reserved-key refinement on the frozen read path. */
|
|
6438
|
-
envVars:
|
|
6439
|
-
defaultTtlSeconds:
|
|
6440
|
-
packages:
|
|
6441
|
-
networking:
|
|
6498
|
+
envVars: import_zod52.z.record(import_zod52.z.string(), import_zod52.z.string()).nullish(),
|
|
6499
|
+
defaultTtlSeconds: import_zod52.z.number().int().nullish(),
|
|
6500
|
+
packages: import_zod52.z.unknown().nullish(),
|
|
6501
|
+
networking: import_zod52.z.unknown().nullish()
|
|
6442
6502
|
}).passthrough();
|
|
6443
|
-
var EnvironmentVersionMaterializationStatusSchema =
|
|
6503
|
+
var EnvironmentVersionMaterializationStatusSchema = import_zod52.z.enum([
|
|
6444
6504
|
"building",
|
|
6445
6505
|
"ready",
|
|
6446
6506
|
"failed",
|
|
6447
6507
|
"superseded"
|
|
6448
6508
|
]);
|
|
6449
|
-
var EnvironmentVersionSchema =
|
|
6450
|
-
environmentId:
|
|
6451
|
-
version:
|
|
6509
|
+
var EnvironmentVersionSchema = import_zod52.z.object({
|
|
6510
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6511
|
+
version: import_zod52.z.number().int().positive(),
|
|
6452
6512
|
config: EnvironmentVersionConfigSchema,
|
|
6453
6513
|
source: EnvironmentVersionSourceSchema,
|
|
6454
6514
|
/** Idempotency ref for machine producers (platform_release); null otherwise. */
|
|
6455
|
-
sourceRef:
|
|
6456
|
-
createdBy:
|
|
6457
|
-
createdAt:
|
|
6458
|
-
providerTemplateName:
|
|
6515
|
+
sourceRef: import_zod52.z.string().nullable(),
|
|
6516
|
+
createdBy: import_zod52.z.string().nullable(),
|
|
6517
|
+
createdAt: import_zod52.z.coerce.date(),
|
|
6518
|
+
providerTemplateName: import_zod52.z.string().nullable(),
|
|
6459
6519
|
/** null = pre-E-DEC7 version (ready semantics). */
|
|
6460
6520
|
materializationStatus: EnvironmentVersionMaterializationStatusSchema.nullable(),
|
|
6461
6521
|
/** Failure reason for the UI (PKG-D4); null unless failed. */
|
|
6462
|
-
materializationDetail:
|
|
6522
|
+
materializationDetail: import_zod52.z.string().nullable(),
|
|
6463
6523
|
/** Baked image ref (repository:tag@digest) once built (PKG-D6/D9). */
|
|
6464
|
-
imageRef:
|
|
6524
|
+
imageRef: import_zod52.z.string().nullable(),
|
|
6465
6525
|
/** Generated Dockerfile archived verbatim (PKG-D9, audit-only). */
|
|
6466
|
-
dockerfile:
|
|
6526
|
+
dockerfile: import_zod52.z.string().nullable()
|
|
6467
6527
|
}).strict();
|
|
6468
|
-
var EnvironmentRepointRecordSchema =
|
|
6469
|
-
id:
|
|
6470
|
-
environmentId:
|
|
6471
|
-
workloadId:
|
|
6472
|
-
workloadStageId:
|
|
6528
|
+
var EnvironmentRepointRecordSchema = import_zod52.z.object({
|
|
6529
|
+
id: import_zod52.z.string().uuid(),
|
|
6530
|
+
environmentId: import_zod52.z.string().uuid(),
|
|
6531
|
+
workloadId: import_zod52.z.string().uuid(),
|
|
6532
|
+
workloadStageId: import_zod52.z.string().uuid(),
|
|
6473
6533
|
stage: StageSchema,
|
|
6474
6534
|
/** null = first pin (the slot had no pinned version yet). */
|
|
6475
|
-
fromVersion:
|
|
6476
|
-
toVersion:
|
|
6535
|
+
fromVersion: import_zod52.z.number().int().positive().nullable(),
|
|
6536
|
+
toVersion: import_zod52.z.number().int().positive(),
|
|
6477
6537
|
source: EnvironmentRepointSourceSchema,
|
|
6478
|
-
actor:
|
|
6479
|
-
createdAt:
|
|
6538
|
+
actor: import_zod52.z.string().nullable(),
|
|
6539
|
+
createdAt: import_zod52.z.coerce.date()
|
|
6480
6540
|
}).strict();
|
|
6481
|
-
var EnvironmentReferenceSchema =
|
|
6482
|
-
workloadId:
|
|
6483
|
-
workloadSlug:
|
|
6541
|
+
var EnvironmentReferenceSchema = import_zod52.z.object({
|
|
6542
|
+
workloadId: import_zod52.z.string().uuid(),
|
|
6543
|
+
workloadSlug: import_zod52.z.string(),
|
|
6484
6544
|
stage: StageSchema,
|
|
6485
6545
|
/**
|
|
6486
6546
|
* Pinned environment version of this slot (ENV-V2). null = legacy pin
|
|
6487
6547
|
* written before the version line landed (deploy window) — resolution
|
|
6488
6548
|
* falls back to the tip version for those.
|
|
6489
6549
|
*/
|
|
6490
|
-
environmentVersion:
|
|
6550
|
+
environmentVersion: import_zod52.z.number().int().positive().nullable()
|
|
6491
6551
|
}).strict();
|
|
6492
|
-
var EnvironmentSchema =
|
|
6493
|
-
id:
|
|
6494
|
-
projectId:
|
|
6495
|
-
name:
|
|
6496
|
-
description:
|
|
6552
|
+
var EnvironmentSchema = import_zod52.z.object({
|
|
6553
|
+
id: import_zod52.z.string().uuid(),
|
|
6554
|
+
projectId: import_zod52.z.string().uuid(),
|
|
6555
|
+
name: import_zod52.z.string().min(1).max(255),
|
|
6556
|
+
description: import_zod52.z.string().nullish(),
|
|
6497
6557
|
status: EnvironmentStatusSchema,
|
|
6498
6558
|
config: EnvironmentConfigSchema,
|
|
6499
6559
|
/**
|
|
@@ -6502,19 +6562,19 @@ var EnvironmentSchema = import_zod51.z.object({
|
|
|
6502
6562
|
* `providerTemplateName` verbatim (no dedicated Kanyun template until the
|
|
6503
6563
|
* config first diverges, E5/P2.1).
|
|
6504
6564
|
*/
|
|
6505
|
-
base:
|
|
6506
|
-
referencedBy:
|
|
6565
|
+
base: import_zod52.z.object({ platformTemplateName: import_zod52.z.string() }).strict(),
|
|
6566
|
+
referencedBy: import_zod52.z.array(EnvironmentReferenceSchema),
|
|
6507
6567
|
/** Platform-shared environments are project-agnostic and admin-managed. */
|
|
6508
|
-
isPlatformShared:
|
|
6568
|
+
isPlatformShared: import_zod52.z.boolean(),
|
|
6509
6569
|
/**
|
|
6510
6570
|
* Tip of the version line (E-DEC6): the latest immutable version number.
|
|
6511
6571
|
* The row's config columns always mirror this version. null only for
|
|
6512
6572
|
* legacy rows created by pre-E-DEC6 writers during the deploy window
|
|
6513
6573
|
* (their first config write creates v1).
|
|
6514
6574
|
*/
|
|
6515
|
-
currentVersion:
|
|
6516
|
-
createdAt:
|
|
6517
|
-
updatedAt:
|
|
6575
|
+
currentVersion: import_zod52.z.number().int().positive().nullable(),
|
|
6576
|
+
createdAt: import_zod52.z.coerce.date(),
|
|
6577
|
+
updatedAt: import_zod52.z.coerce.date()
|
|
6518
6578
|
}).strict();
|
|
6519
6579
|
function findUnsupportedEnvironmentConfigField(config) {
|
|
6520
6580
|
if (!config) return null;
|
|
@@ -6525,7 +6585,7 @@ function rejectReservedConfigFields(config, ctx) {
|
|
|
6525
6585
|
const field = findUnsupportedEnvironmentConfigField(config);
|
|
6526
6586
|
if (field) {
|
|
6527
6587
|
ctx.addIssue({
|
|
6528
|
-
code:
|
|
6588
|
+
code: import_zod52.z.ZodIssueCode.custom,
|
|
6529
6589
|
path: ["config", field],
|
|
6530
6590
|
// `params.pilotPolicyCode` is what `classifyEnvironmentInputIssues` keys
|
|
6531
6591
|
// on (structural, spoof-proof) — see the env-var superRefine above.
|
|
@@ -6534,16 +6594,16 @@ function rejectReservedConfigFields(config, ctx) {
|
|
|
6534
6594
|
});
|
|
6535
6595
|
}
|
|
6536
6596
|
}
|
|
6537
|
-
var CreateEnvironmentInputSchema =
|
|
6538
|
-
name:
|
|
6539
|
-
description:
|
|
6540
|
-
base:
|
|
6597
|
+
var CreateEnvironmentInputSchema = import_zod52.z.object({
|
|
6598
|
+
name: import_zod52.z.string().min(1).max(255),
|
|
6599
|
+
description: import_zod52.z.string().max(4e3).optional(),
|
|
6600
|
+
base: import_zod52.z.object({ platformTemplateName: import_zod52.z.string().min(1) }).strict(),
|
|
6541
6601
|
config: EnvironmentConfigSchema.optional()
|
|
6542
6602
|
}).strict().superRefine((input, ctx) => rejectReservedConfigFields(input.config, ctx));
|
|
6543
|
-
var UpdateEnvironmentInputSchema =
|
|
6544
|
-
name:
|
|
6603
|
+
var UpdateEnvironmentInputSchema = import_zod52.z.object({
|
|
6604
|
+
name: import_zod52.z.string().min(1).max(255).optional(),
|
|
6545
6605
|
/** `null` clears the description; omitted keeps the stored value. */
|
|
6546
|
-
description:
|
|
6606
|
+
description: import_zod52.z.string().max(4e3).nullish(),
|
|
6547
6607
|
config: EnvironmentConfigSchema.optional(),
|
|
6548
6608
|
/**
|
|
6549
6609
|
* ENV-V5: a config-face change creates a new immutable version. Default
|
|
@@ -6553,11 +6613,11 @@ var UpdateEnvironmentInputSchema = import_zod51.z.object({
|
|
|
6553
6613
|
* dial slots individually via the repoint endpoint (canary/rollback).
|
|
6554
6614
|
* Ignored for metadata-only writes (name/description never version).
|
|
6555
6615
|
*/
|
|
6556
|
-
repointReferences:
|
|
6616
|
+
repointReferences: import_zod52.z.boolean().optional()
|
|
6557
6617
|
}).strict().superRefine((input, ctx) => rejectReservedConfigFields(input.config, ctx));
|
|
6558
|
-
var RepointEnvironmentInputSchema =
|
|
6559
|
-
toVersion:
|
|
6560
|
-
slots:
|
|
6618
|
+
var RepointEnvironmentInputSchema = import_zod52.z.object({
|
|
6619
|
+
toVersion: import_zod52.z.number().int().positive(),
|
|
6620
|
+
slots: import_zod52.z.array(import_zod52.z.object({ workloadId: import_zod52.z.string().uuid(), stage: StageSchema }).strict()).min(1).optional(),
|
|
6561
6621
|
/**
|
|
6562
6622
|
* TOCTOU guard (codex #7 residual, §4 impact-confirmation dialog): the
|
|
6563
6623
|
* FULL `(workloadId, stage)` set the caller observed as "affected" when
|
|
@@ -6574,7 +6634,7 @@ var RepointEnvironmentInputSchema = import_zod51.z.object({
|
|
|
6574
6634
|
* (backward compatible: platform/manifest callers that don't render a
|
|
6575
6635
|
* confirmation dialog are unaffected).
|
|
6576
6636
|
*/
|
|
6577
|
-
expectedSlots:
|
|
6637
|
+
expectedSlots: import_zod52.z.array(import_zod52.z.object({ workloadId: import_zod52.z.string().uuid(), stage: StageSchema }).strict()).optional()
|
|
6578
6638
|
}).strict();
|
|
6579
6639
|
var WORKER_PROTOCOL_TERMINAL_EVENT_TYPES = [
|
|
6580
6640
|
"worker_protocol.prompt.completed",
|
|
@@ -6589,13 +6649,13 @@ var LEAK_RECONCILER_INTERVAL_MS = 30 * 60 * 1e3;
|
|
|
6589
6649
|
var SESSION_STARTUP_LEASE_MS = 10 * 6e4;
|
|
6590
6650
|
var INSTRUCTIONS_JOIN_SEPARATOR = "\n\n";
|
|
6591
6651
|
var MANAGED_AGENT_PROFILE_KIND = "ManagedAgentProfile";
|
|
6592
|
-
var ManagedAgentProfileMetadataSchema =
|
|
6652
|
+
var ManagedAgentProfileMetadataSchema = import_zod53.z.object({
|
|
6593
6653
|
name: WorkloadManifestNameSchema,
|
|
6594
6654
|
displayName: WorkloadManifestDisplayNameSchema,
|
|
6595
|
-
labels:
|
|
6596
|
-
annotations:
|
|
6655
|
+
labels: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).optional(),
|
|
6656
|
+
annotations: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).optional()
|
|
6597
6657
|
}).strict();
|
|
6598
|
-
var ManagedAgentProfileSpecSchema =
|
|
6658
|
+
var ManagedAgentProfileSpecSchema = import_zod53.z.object({
|
|
6599
6659
|
runtimeTemplateRef: WorkloadManifestObjectRefSchema,
|
|
6600
6660
|
env: SessionConfigValuesSchema.optional(),
|
|
6601
6661
|
ui: WorkloadManifestUiHintSchema.optional(),
|
|
@@ -6617,7 +6677,7 @@ var ManagedAgentProfileSpecSchema = import_zod52.z.object({
|
|
|
6617
6677
|
// `agents.enabled_skills` at agent creation when the caller omits
|
|
6618
6678
|
// skills. See `specs/features/pilot-v2-managed-agent-profile.md`
|
|
6619
6679
|
// §"Phase C".
|
|
6620
|
-
skills:
|
|
6680
|
+
skills: import_zod53.z.array(import_zod53.z.string().min(1)).optional(),
|
|
6621
6681
|
// Phase C2/C3 (🟡): workload-level default MCP servers as friendly rush
|
|
6622
6682
|
// MCP ids (e.g. `github`). Projected to
|
|
6623
6683
|
// `manifest.spec.defaults.enabledMcpServers` as `EnabledMcpRef[]`. At
|
|
@@ -6627,7 +6687,7 @@ var ManagedAgentProfileSpecSchema = import_zod52.z.object({
|
|
|
6627
6687
|
// user at bootstrap (C3). Seeded into `agents.enabled_mcp_servers` at
|
|
6628
6688
|
// agent creation when the caller omits MCP servers. See
|
|
6629
6689
|
// `specs/features/pilot-v2-managed-agent-profile.md` §"Phase C".
|
|
6630
|
-
mcpServers:
|
|
6690
|
+
mcpServers: import_zod53.z.array(import_zod53.z.string().min(1)).optional(),
|
|
6631
6691
|
// Phase D: workload-level default system prompt. Projected to
|
|
6632
6692
|
// `manifest.spec.defaults.systemPrompt`, seeded onto
|
|
6633
6693
|
// `agents.system_prompt` at agent creation, and forwarded per-run as
|
|
@@ -6641,14 +6701,14 @@ var ManagedAgentProfileSpecSchema = import_zod52.z.object({
|
|
|
6641
6701
|
resources: SessionResourcesSchema.optional(),
|
|
6642
6702
|
agentPackage: AgentPackageSchema.optional()
|
|
6643
6703
|
}).strict();
|
|
6644
|
-
var ManagedAgentProfileSchema =
|
|
6704
|
+
var ManagedAgentProfileSchema = import_zod53.z.object({
|
|
6645
6705
|
apiVersion: PilotWorkloadManifestApiVersionSchema,
|
|
6646
|
-
kind:
|
|
6706
|
+
kind: import_zod53.z.literal(MANAGED_AGENT_PROFILE_KIND),
|
|
6647
6707
|
metadata: ManagedAgentProfileMetadataSchema,
|
|
6648
6708
|
spec: ManagedAgentProfileSpecSchema
|
|
6649
6709
|
}).strict();
|
|
6650
6710
|
var MANAGED_AGENT_PROFILE_V1_API_VERSION = "pilot.zhenguanyu.com/v1alpha1";
|
|
6651
|
-
var ManagedAgentProfileV1RuntimeSchema =
|
|
6711
|
+
var ManagedAgentProfileV1RuntimeSchema = import_zod53.z.object({
|
|
6652
6712
|
templateRef: WorkloadManifestObjectRefSchema.optional(),
|
|
6653
6713
|
environmentRef: WorkloadManifestObjectRefSchema.optional(),
|
|
6654
6714
|
env: SessionConfigValuesSchema.optional(),
|
|
@@ -6662,65 +6722,65 @@ var ManagedAgentProfileV1RuntimeSchema = import_zod52.z.object({
|
|
|
6662
6722
|
}).strict().superRefine((runtime, ctx) => {
|
|
6663
6723
|
if (!runtime.templateRef && !runtime.environmentRef) {
|
|
6664
6724
|
ctx.addIssue({
|
|
6665
|
-
code:
|
|
6725
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6666
6726
|
path: ["templateRef"],
|
|
6667
6727
|
message: "runtime group requires exactly one of `templateRef` / `environmentRef`"
|
|
6668
6728
|
});
|
|
6669
6729
|
}
|
|
6670
6730
|
if (runtime.templateRef && runtime.environmentRef) {
|
|
6671
6731
|
ctx.addIssue({
|
|
6672
|
-
code:
|
|
6732
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6673
6733
|
path: ["environmentRef"],
|
|
6674
6734
|
message: "runtime.environmentRef is mutually exclusive with runtime.templateRef"
|
|
6675
6735
|
});
|
|
6676
6736
|
}
|
|
6677
6737
|
});
|
|
6678
|
-
var ManagedAgentProfileV1ModelSchema =
|
|
6738
|
+
var ManagedAgentProfileV1ModelSchema = import_zod53.z.object({
|
|
6679
6739
|
primary: WorkloadManifestModelSchema.optional(),
|
|
6680
6740
|
providerRef: LlmProviderConfigPublicIdSchema.optional()
|
|
6681
6741
|
}).strict().refine((model) => model.primary !== void 0 || model.providerRef !== void 0, {
|
|
6682
6742
|
message: "model group requires at least one of `primary` / `providerRef`"
|
|
6683
6743
|
});
|
|
6684
|
-
var ManagedAgentProfileV1InstructionItemSchema =
|
|
6744
|
+
var ManagedAgentProfileV1InstructionItemSchema = import_zod53.z.object({
|
|
6685
6745
|
inline: WorkloadManifestSystemPromptSchema
|
|
6686
6746
|
}).strict();
|
|
6687
|
-
var ManagedAgentProfileV1InstructionsSchema =
|
|
6747
|
+
var ManagedAgentProfileV1InstructionsSchema = import_zod53.z.union([
|
|
6688
6748
|
WorkloadManifestSystemPromptSchema,
|
|
6689
|
-
|
|
6749
|
+
import_zod53.z.array(ManagedAgentProfileV1InstructionItemSchema).min(1).superRefine((blocks, ctx) => {
|
|
6690
6750
|
const joinedLength = blocks.reduce((sum, b) => sum + b.inline.length, 0) + INSTRUCTIONS_JOIN_SEPARATOR.length * Math.max(0, blocks.length - 1);
|
|
6691
6751
|
if (joinedLength > WORKLOAD_MANIFEST_SYSTEM_PROMPT_MAX_LENGTH) {
|
|
6692
6752
|
ctx.addIssue({
|
|
6693
|
-
code:
|
|
6753
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6694
6754
|
message: `joined instructions length ${joinedLength} exceeds the ${WORKLOAD_MANIFEST_SYSTEM_PROMPT_MAX_LENGTH} system-prompt limit`
|
|
6695
6755
|
});
|
|
6696
6756
|
}
|
|
6697
6757
|
})
|
|
6698
6758
|
]);
|
|
6699
|
-
var ManagedAgentProfileV1SkillRefSchema =
|
|
6700
|
-
source:
|
|
6701
|
-
name:
|
|
6759
|
+
var ManagedAgentProfileV1SkillRefSchema = import_zod53.z.object({
|
|
6760
|
+
source: import_zod53.z.literal("ref"),
|
|
6761
|
+
name: import_zod53.z.string().min(1)
|
|
6702
6762
|
}).strict();
|
|
6703
|
-
var ManagedAgentProfileV1SkillInlineSchema =
|
|
6704
|
-
source:
|
|
6763
|
+
var ManagedAgentProfileV1SkillInlineSchema = import_zod53.z.object({
|
|
6764
|
+
source: import_zod53.z.literal("inline"),
|
|
6705
6765
|
/** Skill file path inside the package, e.g. `SKILL.md`. */
|
|
6706
|
-
path:
|
|
6707
|
-
content:
|
|
6766
|
+
path: import_zod53.z.string().min(1),
|
|
6767
|
+
content: import_zod53.z.string().min(1)
|
|
6708
6768
|
}).strict();
|
|
6709
|
-
var ManagedAgentProfileV1SkillSchema =
|
|
6769
|
+
var ManagedAgentProfileV1SkillSchema = import_zod53.z.discriminatedUnion("source", [
|
|
6710
6770
|
ManagedAgentProfileV1SkillRefSchema,
|
|
6711
6771
|
ManagedAgentProfileV1SkillInlineSchema
|
|
6712
6772
|
]);
|
|
6713
|
-
var ManagedAgentProfileV1McpRefSchema =
|
|
6714
|
-
source:
|
|
6715
|
-
rushMcpId:
|
|
6773
|
+
var ManagedAgentProfileV1McpRefSchema = import_zod53.z.object({
|
|
6774
|
+
source: import_zod53.z.literal("ref"),
|
|
6775
|
+
rushMcpId: import_zod53.z.string().min(1)
|
|
6716
6776
|
}).strict();
|
|
6717
|
-
var ManagedAgentProfileV1CapabilitiesSchema =
|
|
6718
|
-
skills:
|
|
6719
|
-
mcpServers:
|
|
6777
|
+
var ManagedAgentProfileV1CapabilitiesSchema = import_zod53.z.object({
|
|
6778
|
+
skills: import_zod53.z.array(ManagedAgentProfileV1SkillSchema).optional(),
|
|
6779
|
+
mcpServers: import_zod53.z.array(ManagedAgentProfileV1McpRefSchema).optional()
|
|
6720
6780
|
}).strict();
|
|
6721
|
-
var ManagedAgentProfileV1EvalsSchema =
|
|
6722
|
-
suiteRef:
|
|
6723
|
-
name:
|
|
6781
|
+
var ManagedAgentProfileV1EvalsSchema = import_zod53.z.object({
|
|
6782
|
+
suiteRef: import_zod53.z.object({
|
|
6783
|
+
name: import_zod53.z.string().min(1)
|
|
6724
6784
|
}).strict()
|
|
6725
6785
|
}).strict();
|
|
6726
6786
|
var MANAGED_AGENT_PROFILE_V1_KNOWN_SPEC_KEYS = [
|
|
@@ -6771,7 +6831,7 @@ function validateXExtensionValueShape(value) {
|
|
|
6771
6831
|
return "x-* value must be a scalar or a one-level object of scalars";
|
|
6772
6832
|
}
|
|
6773
6833
|
var ManagedAgentProfileV1MemorySchema = WorkloadManifestMemorySchema;
|
|
6774
|
-
var ManagedAgentProfileV1SpecSchema =
|
|
6834
|
+
var ManagedAgentProfileV1SpecSchema = import_zod53.z.object({
|
|
6775
6835
|
runtime: ManagedAgentProfileV1RuntimeSchema,
|
|
6776
6836
|
model: ManagedAgentProfileV1ModelSchema.optional(),
|
|
6777
6837
|
instructions: ManagedAgentProfileV1InstructionsSchema.optional(),
|
|
@@ -6795,7 +6855,7 @@ var ManagedAgentProfileV1SpecSchema = import_zod52.z.object({
|
|
|
6795
6855
|
var _a, _b, _c, _d;
|
|
6796
6856
|
if (((_b = (_a = spec.vaultMcpBindings) == null ? void 0 : _a.length) != null ? _b : 0) > 0 && ((_d = (_c = spec.managedMcpBindings) == null ? void 0 : _c.length) != null ? _d : 0) > 0) {
|
|
6797
6857
|
ctx.addIssue({
|
|
6798
|
-
code:
|
|
6858
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6799
6859
|
path: ["managedMcpBindings"],
|
|
6800
6860
|
message: "managedMcpBindings and vaultMcpBindings are mutually exclusive (#1469 D2) \u2014 declare only one binding granularity"
|
|
6801
6861
|
});
|
|
@@ -6807,7 +6867,7 @@ var ManagedAgentProfileV1SpecSchema = import_zod52.z.object({
|
|
|
6807
6867
|
if (known.has(key)) continue;
|
|
6808
6868
|
if (!X_EXTENSION_KEY_PATTERN.test(key)) {
|
|
6809
6869
|
ctx.addIssue({
|
|
6810
|
-
code:
|
|
6870
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6811
6871
|
path: [key],
|
|
6812
6872
|
message: `unknown key "${key}" \u2014 spec only allows known capability groups or x-* extension keys`
|
|
6813
6873
|
});
|
|
@@ -6817,34 +6877,34 @@ var ManagedAgentProfileV1SpecSchema = import_zod52.z.object({
|
|
|
6817
6877
|
const value = spec[key];
|
|
6818
6878
|
const shapeError = validateXExtensionValueShape(value);
|
|
6819
6879
|
if (shapeError) {
|
|
6820
|
-
ctx.addIssue({ code:
|
|
6880
|
+
ctx.addIssue({ code: import_zod53.z.ZodIssueCode.custom, path: [key], message: shapeError });
|
|
6821
6881
|
continue;
|
|
6822
6882
|
}
|
|
6823
6883
|
xTotalBytes += utf8ByteLength(JSON.stringify(value));
|
|
6824
6884
|
}
|
|
6825
6885
|
if (xKeyCount > X_EXTENSION_MAX_KEYS) {
|
|
6826
6886
|
ctx.addIssue({
|
|
6827
|
-
code:
|
|
6887
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6828
6888
|
path: [],
|
|
6829
6889
|
message: `too many x-* extension keys (${xKeyCount} > ${X_EXTENSION_MAX_KEYS})`
|
|
6830
6890
|
});
|
|
6831
6891
|
}
|
|
6832
6892
|
if (xTotalBytes > X_EXTENSION_MAX_TOTAL_BYTES) {
|
|
6833
6893
|
ctx.addIssue({
|
|
6834
|
-
code:
|
|
6894
|
+
code: import_zod53.z.ZodIssueCode.custom,
|
|
6835
6895
|
path: [],
|
|
6836
6896
|
message: `x-* extension total size ${xTotalBytes} bytes exceeds ${X_EXTENSION_MAX_TOTAL_BYTES}`
|
|
6837
6897
|
});
|
|
6838
6898
|
}
|
|
6839
6899
|
});
|
|
6840
|
-
var ManagedAgentProfileV1Schema =
|
|
6841
|
-
apiVersion:
|
|
6842
|
-
kind:
|
|
6900
|
+
var ManagedAgentProfileV1Schema = import_zod53.z.object({
|
|
6901
|
+
apiVersion: import_zod53.z.literal(MANAGED_AGENT_PROFILE_V1_API_VERSION),
|
|
6902
|
+
kind: import_zod53.z.literal(MANAGED_AGENT_PROFILE_KIND),
|
|
6843
6903
|
metadata: ManagedAgentProfileMetadataSchema,
|
|
6844
6904
|
spec: ManagedAgentProfileV1SpecSchema
|
|
6845
6905
|
}).strict();
|
|
6846
|
-
var CanaryArmSchema =
|
|
6847
|
-
var CanaryDecisionReasonSchema =
|
|
6906
|
+
var CanaryArmSchema = import_zod54.z.enum(["stable", "canary"]);
|
|
6907
|
+
var CanaryDecisionReasonSchema = import_zod54.z.enum([
|
|
6848
6908
|
"kill_switch",
|
|
6849
6909
|
"fail_safe",
|
|
6850
6910
|
"pool_exempt",
|
|
@@ -6855,25 +6915,25 @@ var CanaryDecisionReasonSchema = import_zod53.z.enum([
|
|
|
6855
6915
|
"percentage_miss",
|
|
6856
6916
|
"pool_canary"
|
|
6857
6917
|
]);
|
|
6858
|
-
var StageCanaryStateSchema =
|
|
6918
|
+
var StageCanaryStateSchema = import_zod54.z.object({
|
|
6859
6919
|
/** 灰度 revision。与主指针同 workload(跨 workload 引用在写路径被拒)。 */
|
|
6860
|
-
revisionId:
|
|
6920
|
+
revisionId: import_zod54.z.string().uuid(),
|
|
6861
6921
|
/**
|
|
6862
6922
|
* 灰度百分比 0..99。100 不是灰度态(那是 promote);0 = 冻结观察态:
|
|
6863
6923
|
* hash 全 miss,仅名单命中仍走 canary 臂。
|
|
6864
6924
|
*/
|
|
6865
|
-
percentage:
|
|
6925
|
+
percentage: import_zod54.z.number().int().min(0).max(99),
|
|
6866
6926
|
/** ldap 精确匹配名单(命中优先于百分比)。缺省解析为 `[]`。 */
|
|
6867
|
-
userAllowlist:
|
|
6927
|
+
userAllowlist: import_zod54.z.array(import_zod54.z.string()).default([]),
|
|
6868
6928
|
/** 灰度开始时间(ISO)。`null` = 存量行无记录。 */
|
|
6869
|
-
startedAt:
|
|
6929
|
+
startedAt: import_zod54.z.string().nullable(),
|
|
6870
6930
|
/** 灰度发起人。`null` = 非请求上下文写入。 */
|
|
6871
|
-
startedBy:
|
|
6931
|
+
startedBy: import_zod54.z.string().nullable()
|
|
6872
6932
|
}).strict();
|
|
6873
|
-
var StageSlotViewSchema =
|
|
6933
|
+
var StageSlotViewSchema = import_zod54.z.object({
|
|
6874
6934
|
stage: StageSchema,
|
|
6875
6935
|
/** 槽位当前指针;同 workload 的 revision(跨 workload 引用在写路径被拒)。 */
|
|
6876
|
-
revisionId:
|
|
6936
|
+
revisionId: import_zod54.z.string().uuid(),
|
|
6877
6937
|
/**
|
|
6878
6938
|
* Stage-level runtime overrides layered on top of the revision snapshot
|
|
6879
6939
|
* (top-level key replace, no deep merge — STG-R3). `null` → none stored.
|
|
@@ -6886,20 +6946,20 @@ var StageSlotViewSchema = import_zod53.z.object({
|
|
|
6886
6946
|
* and re-running them on read could brick `GET /stages` for rows written
|
|
6887
6947
|
* before a rule tightened.
|
|
6888
6948
|
*/
|
|
6889
|
-
configValues:
|
|
6949
|
+
configValues: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).nullable(),
|
|
6890
6950
|
/**
|
|
6891
6951
|
* Environment binding(P2, spec §6.3)。`null` = 槽位以 revision 快照为
|
|
6892
6952
|
* 基底(P1 行为);非空 = 会话创建按 E-DEC2 字段组组合解析(PR-E3)。
|
|
6893
6953
|
* P1 的 `z.null()` 锁死已按计划放开。
|
|
6894
6954
|
*/
|
|
6895
|
-
environmentId:
|
|
6955
|
+
environmentId: import_zod54.z.string().uuid().nullable(),
|
|
6896
6956
|
/**
|
|
6897
6957
|
* Pinned environment version(E-DEC6 ENV-V2):引用是 (environmentId,
|
|
6898
6958
|
* environmentVersion) 对。`null` 且 environmentId 非空 = legacy 钉
|
|
6899
6959
|
* (部署窗口写入,解析回退 tip)。Optional so existing fixtures that
|
|
6900
6960
|
* predate this field keep parsing.
|
|
6901
6961
|
*/
|
|
6902
|
-
environmentVersion:
|
|
6962
|
+
environmentVersion: import_zod54.z.number().int().positive().nullable().optional(),
|
|
6903
6963
|
/**
|
|
6904
6964
|
* Display name hydrated for an EXISTING `environmentId` reference
|
|
6905
6965
|
* (UI-11). Deliberately independent of the environment-picker's active
|
|
@@ -6911,19 +6971,19 @@ var StageSlotViewSchema = import_zod53.z.object({
|
|
|
6911
6971
|
* no longer exists (e.g. hard-deleted). Optional so existing fixtures
|
|
6912
6972
|
* that predate this field keep parsing.
|
|
6913
6973
|
*/
|
|
6914
|
-
environmentName:
|
|
6974
|
+
environmentName: import_zod54.z.string().nullable().optional(),
|
|
6915
6975
|
/**
|
|
6916
6976
|
* 活跃灰度状态(#1214 canary rollout)。`null` = 无灰度(绝大多数槽位)。
|
|
6917
6977
|
* 必填字段:read 端总是显式报告 null,而非靠省略表达「无灰度」。
|
|
6918
6978
|
*/
|
|
6919
6979
|
canary: StageCanaryStateSchema.nullable(),
|
|
6920
6980
|
/** ISO timestamp of the last pointer/overrides/config change (STG-D2 audit baseline). */
|
|
6921
|
-
deployedAt:
|
|
6981
|
+
deployedAt: import_zod54.z.string(),
|
|
6922
6982
|
/**
|
|
6923
6983
|
* Actor of the last change. `null` only for rows created outside a
|
|
6924
6984
|
* request context (e.g. the STG-M1 backfill migration).
|
|
6925
6985
|
*/
|
|
6926
|
-
deployedBy:
|
|
6986
|
+
deployedBy: import_zod54.z.string().nullable(),
|
|
6927
6987
|
/**
|
|
6928
6988
|
* ISO timestamp of the slot row's last write — the UI-5 optimistic
|
|
6929
6989
|
* concurrency token. Confirm dialogs MUST echo this back as
|
|
@@ -6931,10 +6991,10 @@ var StageSlotViewSchema = import_zod53.z.object({
|
|
|
6931
6991
|
* (someone else wrote the slot in between) is a 409 `STAGE_CONFLICT` that
|
|
6932
6992
|
* requires re-fetching the preview. Never null — the row always has one.
|
|
6933
6993
|
*/
|
|
6934
|
-
updatedAt:
|
|
6994
|
+
updatedAt: import_zod54.z.string()
|
|
6935
6995
|
}).strict();
|
|
6936
|
-
var ListStagesResponseSchema =
|
|
6937
|
-
stages:
|
|
6996
|
+
var ListStagesResponseSchema = import_zod54.z.object({
|
|
6997
|
+
stages: import_zod54.z.array(StageSlotViewSchema)
|
|
6938
6998
|
}).strict();
|
|
6939
6999
|
function findFrozenStagePutField(rawBody) {
|
|
6940
7000
|
if (typeof rawBody !== "object" || rawBody === null) return null;
|
|
@@ -6959,9 +7019,9 @@ function parsePutStageRequest(rawBody) {
|
|
|
6959
7019
|
}
|
|
6960
7020
|
return { ok: true, data: parsed.data };
|
|
6961
7021
|
}
|
|
6962
|
-
var PutStageRequestSchema =
|
|
7022
|
+
var PutStageRequestSchema = import_zod54.z.object({
|
|
6963
7023
|
/** 必填:槽位指针。MUST 属于路径上的 workload(服务层校验跨 workload 引用)。 */
|
|
6964
|
-
revisionId:
|
|
7024
|
+
revisionId: import_zod54.z.string().uuid(),
|
|
6965
7025
|
/**
|
|
6966
7026
|
* Stage-level runtime overrides. Reuses the shipped revision overrides
|
|
6967
7027
|
* contract (`pilot-v2-workload-manifest.ts`) — same shape, same
|
|
@@ -6985,7 +7045,7 @@ var PutStageRequestSchema = import_zod53.z.object({
|
|
|
6985
7045
|
* 回退 revision 快照基底;UUID = 绑定该 environment(服务层校验存在 /
|
|
6986
7046
|
* 同 project 或平台共享 / 未 archived)。
|
|
6987
7047
|
*/
|
|
6988
|
-
environmentId:
|
|
7048
|
+
environmentId: import_zod54.z.string().uuid().nullable().optional(),
|
|
6989
7049
|
/**
|
|
6990
7050
|
* UI-5 乐观并发 token(可选)。语义:
|
|
6991
7051
|
*
|
|
@@ -6996,12 +7056,12 @@ var PutStageRequestSchema = import_zod53.z.object({
|
|
|
6996
7056
|
*
|
|
6997
7057
|
* 任一期望落空 → 409 `STAGE_CONFLICT`,须重新拉取预览。
|
|
6998
7058
|
*/
|
|
6999
|
-
expectedUpdatedAt:
|
|
7059
|
+
expectedUpdatedAt: import_zod54.z.string().datetime().nullable().optional()
|
|
7000
7060
|
}).strict().superRefine((input, ctx) => {
|
|
7001
7061
|
for (const field of ["runtimeOverrides", "configValues"]) {
|
|
7002
7062
|
if (input[field] != null) {
|
|
7003
7063
|
ctx.addIssue({
|
|
7004
|
-
code:
|
|
7064
|
+
code: import_zod54.z.ZodIssueCode.custom,
|
|
7005
7065
|
path: [field],
|
|
7006
7066
|
// `params.pilotPolicyCode` is LOAD-BEARING: `classifyStageInputIssues`
|
|
7007
7067
|
// (above) keys on it so the stage PUT routes map this rejection to
|
|
@@ -7014,17 +7074,17 @@ var PutStageRequestSchema = import_zod53.z.object({
|
|
|
7014
7074
|
}
|
|
7015
7075
|
});
|
|
7016
7076
|
var PutStageResponseSchema = StageSlotViewSchema;
|
|
7017
|
-
var PromoteRequestSchema =
|
|
7018
|
-
expectedUpdatedAt:
|
|
7077
|
+
var PromoteRequestSchema = import_zod54.z.object({
|
|
7078
|
+
expectedUpdatedAt: import_zod54.z.string().datetime().nullable().optional(),
|
|
7019
7079
|
/**
|
|
7020
7080
|
* Environment binding for the production slot(P2 §6.3):omitted = 保留
|
|
7021
7081
|
* production 槽位现值;`null` = 清引用;UUID = 绑定(同 PUT 语义)。
|
|
7022
7082
|
*/
|
|
7023
|
-
environmentId:
|
|
7083
|
+
environmentId: import_zod54.z.string().uuid().nullable().optional(),
|
|
7024
7084
|
/** 弹窗快照的 test 槽位 revision(预览与确认针对的对象)。 */
|
|
7025
|
-
sourceRevisionId:
|
|
7085
|
+
sourceRevisionId: import_zod54.z.string().uuid().optional(),
|
|
7026
7086
|
/** 弹窗快照的 test 槽位 `updatedAt`(`StageSlotView.updatedAt` 原样回传)。 */
|
|
7027
|
-
expectedTestUpdatedAt:
|
|
7087
|
+
expectedTestUpdatedAt: import_zod54.z.string().datetime().optional(),
|
|
7028
7088
|
/**
|
|
7029
7089
|
* 人工 override pipeline 门禁(§5.6 / §5.1 per-agent 判据):门禁开启
|
|
7030
7090
|
* (`promote_gate_enabled`)时,被晋级的 revision 所属 agent 在其挂过的
|
|
@@ -7033,120 +7093,120 @@ var PromoteRequestSchema = import_zod53.z.object({
|
|
|
7033
7093
|
* `PIPELINE_GATE_NOT_PASSED` 拒;带 override(必须给出 `reason`)可显式
|
|
7034
7094
|
* 放行并落审计。门禁关闭时忽略。
|
|
7035
7095
|
*/
|
|
7036
|
-
override:
|
|
7096
|
+
override: import_zod54.z.object({ reason: import_zod54.z.string().min(1) }).strict().optional()
|
|
7037
7097
|
}).strict();
|
|
7038
|
-
var PromoteResponseSchema =
|
|
7098
|
+
var PromoteResponseSchema = import_zod54.z.object({
|
|
7039
7099
|
/** production 槽位晋级后的视图。 */
|
|
7040
7100
|
production: StageSlotViewSchema,
|
|
7041
7101
|
/** 晋级前 production 指针;production 槽位此前不存在时为 `null`。 */
|
|
7042
|
-
fromRevisionId:
|
|
7102
|
+
fromRevisionId: import_zod54.z.string().uuid().nullable(),
|
|
7043
7103
|
/** = 事务读取时 test 槽位所指 revision。 */
|
|
7044
|
-
toRevisionId:
|
|
7104
|
+
toRevisionId: import_zod54.z.string().uuid()
|
|
7045
7105
|
}).strict();
|
|
7046
|
-
var PreviewStageResolutionRequestSchema =
|
|
7106
|
+
var PreviewStageResolutionRequestSchema = import_zod54.z.object({
|
|
7047
7107
|
/** 预览基底 revision。MUST 属于路径上的 workload(跨 workload 拒绝)。 */
|
|
7048
|
-
revisionId:
|
|
7108
|
+
revisionId: import_zod54.z.string().uuid(),
|
|
7049
7109
|
/** 槽位 runtime overrides(顶层键整体替换,STG-R3)。`null`/omitted = 无叠加。 */
|
|
7050
7110
|
runtimeOverrides: RevisionRuntimeEnvironmentOverridesSchema.nullable().optional(),
|
|
7051
7111
|
/** 槽位 config values(key 级整体替换,叠加到 revision 级之上)。 */
|
|
7052
|
-
configValues:
|
|
7112
|
+
configValues: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).nullable().optional(),
|
|
7053
7113
|
/**
|
|
7054
7114
|
* Environment binding to preview(P2 §6.3 / E-DEC2)。`null`/omitted =
|
|
7055
7115
|
* revision 快照基底;UUID = 按字段组组合预览(可引用性同写路径校验)。
|
|
7056
7116
|
*/
|
|
7057
|
-
environmentId:
|
|
7117
|
+
environmentId: import_zod54.z.string().uuid().nullable().optional()
|
|
7058
7118
|
}).strict();
|
|
7059
|
-
var PreviewStageResolutionResponseSchema =
|
|
7119
|
+
var PreviewStageResolutionResponseSchema = import_zod54.z.object({
|
|
7060
7120
|
/** revision 快照 ⊕ environment 字段组 ⊕ overrides(E-DEC2)后的最终 runtime 配置。 */
|
|
7061
7121
|
runtimeSnapshot: RuntimeTemplateSnapshotSchema,
|
|
7062
7122
|
/** revision 级 configValues + 槽位 configValues 合并结果(revision < slot)。 */
|
|
7063
|
-
configValues:
|
|
7123
|
+
configValues: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()),
|
|
7064
7124
|
/** 解析基底来源(§6.3):绑定 environment 时 = "environment"。 */
|
|
7065
|
-
base:
|
|
7125
|
+
base: import_zod54.z.enum(["revision_snapshot", "environment"]),
|
|
7066
7126
|
/** 基底环境摘要(UI-5 展示;base = "environment" 时非 null)。 */
|
|
7067
|
-
environment:
|
|
7127
|
+
environment: import_zod54.z.object({ id: import_zod54.z.string().uuid(), name: import_zod54.z.string(), updatedAt: import_zod54.z.string() }).strict().nullable()
|
|
7068
7128
|
}).strict();
|
|
7069
|
-
var StartCanaryRequestSchema =
|
|
7129
|
+
var StartCanaryRequestSchema = import_zod54.z.object({
|
|
7070
7130
|
/** 灰度 revision。MUST 属于路径上的 workload;= 主指针时 422 `CANARY_SAME_REVISION`。 */
|
|
7071
|
-
revisionId:
|
|
7131
|
+
revisionId: import_zod54.z.string().uuid(),
|
|
7072
7132
|
/** 0..99(100 = promote,走 promote 端点;0 = 冻结观察,仅名单命中)。 */
|
|
7073
|
-
percentage:
|
|
7133
|
+
percentage: import_zod54.z.number().int().min(0).max(99),
|
|
7074
7134
|
/** ldap 精确匹配名单(≤200 条,条目非空)。 */
|
|
7075
|
-
userAllowlist:
|
|
7076
|
-
expectedUpdatedAt:
|
|
7135
|
+
userAllowlist: import_zod54.z.array(import_zod54.z.string().min(1)).max(200).optional(),
|
|
7136
|
+
expectedUpdatedAt: import_zod54.z.string().nullable().optional()
|
|
7077
7137
|
}).strict();
|
|
7078
|
-
var CanaryPromoteRequestSchema =
|
|
7079
|
-
expectedUpdatedAt:
|
|
7138
|
+
var CanaryPromoteRequestSchema = import_zod54.z.object({
|
|
7139
|
+
expectedUpdatedAt: import_zod54.z.string().nullable().optional()
|
|
7080
7140
|
}).strict();
|
|
7081
7141
|
var CanaryAbortRequestSchema = CanaryPromoteRequestSchema;
|
|
7082
|
-
var RolloutEventActionSchema =
|
|
7142
|
+
var RolloutEventActionSchema = import_zod54.z.enum([
|
|
7083
7143
|
"start",
|
|
7084
7144
|
"adjust",
|
|
7085
7145
|
"promote",
|
|
7086
7146
|
"abort",
|
|
7087
7147
|
"cascade_abort"
|
|
7088
7148
|
]);
|
|
7089
|
-
var CanaryArmSessionMetricsSchema =
|
|
7090
|
-
total:
|
|
7091
|
-
ready:
|
|
7092
|
-
failed:
|
|
7093
|
-
terminated:
|
|
7094
|
-
}).strict();
|
|
7095
|
-
var CanaryRolloutTimelineEntrySchema =
|
|
7096
|
-
id:
|
|
7149
|
+
var CanaryArmSessionMetricsSchema = import_zod54.z.object({
|
|
7150
|
+
total: import_zod54.z.number().int().min(0),
|
|
7151
|
+
ready: import_zod54.z.number().int().min(0),
|
|
7152
|
+
failed: import_zod54.z.number().int().min(0),
|
|
7153
|
+
terminated: import_zod54.z.number().int().min(0)
|
|
7154
|
+
}).strict();
|
|
7155
|
+
var CanaryRolloutTimelineEntrySchema = import_zod54.z.object({
|
|
7156
|
+
id: import_zod54.z.string().uuid(),
|
|
7097
7157
|
action: RolloutEventActionSchema,
|
|
7098
|
-
fromPercentage:
|
|
7099
|
-
toPercentage:
|
|
7158
|
+
fromPercentage: import_zod54.z.number().int().nullable(),
|
|
7159
|
+
toPercentage: import_zod54.z.number().int().nullable(),
|
|
7100
7160
|
/** to 侧 canary revision 短名(join revisions 解析);无 to 臂 / 解析不到为 null。 */
|
|
7101
|
-
toRevisionLabel:
|
|
7102
|
-
actor:
|
|
7103
|
-
createdAt:
|
|
7161
|
+
toRevisionLabel: import_zod54.z.string().nullable(),
|
|
7162
|
+
actor: import_zod54.z.string().nullable(),
|
|
7163
|
+
createdAt: import_zod54.z.string()
|
|
7104
7164
|
}).strict();
|
|
7105
|
-
var CanaryObservationSchema =
|
|
7165
|
+
var CanaryObservationSchema = import_zod54.z.object({
|
|
7106
7166
|
/** 活跃灰度状态快照(与 `StageSlotView.canary` 同 shape)。 */
|
|
7107
7167
|
canary: StageCanaryStateSchema,
|
|
7108
7168
|
/**
|
|
7109
7169
|
* 会话聚合窗口起点 = 本轮灰度 `startedAt`(CNR-D3 生命周期基线,adjust
|
|
7110
7170
|
* 不重置);存量行无记录时为 null(退化为全量打标行聚合)。
|
|
7111
7171
|
*/
|
|
7112
|
-
observedSince:
|
|
7172
|
+
observedSince: import_zod54.z.string().nullable(),
|
|
7113
7173
|
/**
|
|
7114
7174
|
* 两臂对比。聚合口径:`canary_arm` 非 NULL 的会话(含池补给
|
|
7115
7175
|
* pool_exempt / pool_canary 打标行——池行 provisioning 失败同样是臂
|
|
7116
7176
|
* 健康信号;决策 reason 明细在会话 `metadata.canaryDecision`,不进聚合)。
|
|
7117
7177
|
*/
|
|
7118
|
-
arms:
|
|
7178
|
+
arms: import_zod54.z.object({
|
|
7119
7179
|
stable: CanaryArmSessionMetricsSchema,
|
|
7120
7180
|
canary: CanaryArmSessionMetricsSchema
|
|
7121
7181
|
}).strict(),
|
|
7122
7182
|
/** rollout 账表时间线,`createdAt` 降序,最多 `CANARY_OBSERVATION_TIMELINE_LIMIT` 条。 */
|
|
7123
|
-
timeline:
|
|
7183
|
+
timeline: import_zod54.z.array(CanaryRolloutTimelineEntrySchema)
|
|
7124
7184
|
}).strict();
|
|
7125
|
-
var ProfileNameSchema =
|
|
7185
|
+
var ProfileNameSchema = import_zod55.z.string().regex(
|
|
7126
7186
|
/^@[a-z0-9-]{1,40}\/[a-z0-9-]{1,60}$/,
|
|
7127
7187
|
"Profile name must be a scoped lowercase slug like @scope/name"
|
|
7128
7188
|
);
|
|
7129
|
-
var SemverSchema =
|
|
7189
|
+
var SemverSchema = import_zod55.z.string().regex(
|
|
7130
7190
|
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,
|
|
7131
7191
|
"Version must be semver major.minor.patch (no leading zeros; pre-release segments non-empty)"
|
|
7132
7192
|
);
|
|
7133
|
-
var ProfileSchemaVersionSchema =
|
|
7193
|
+
var ProfileSchemaVersionSchema = import_zod55.z.string().regex(
|
|
7134
7194
|
/^[a-z0-9]([a-z0-9.-]*[a-z0-9])?\/v\d+[a-z0-9]*$/,
|
|
7135
7195
|
"schemaVersion must be a k8s-style apiVersion like pilot.zhenguanyu.com/v0alpha1"
|
|
7136
7196
|
);
|
|
7137
|
-
var ProfileIntegritySchema =
|
|
7197
|
+
var ProfileIntegritySchema = import_zod55.z.string().regex(
|
|
7138
7198
|
/^sha256-[A-Za-z0-9+/]{43}=$/,
|
|
7139
7199
|
"Integrity must be an SRI sha256-<base64> of a 32-byte digest"
|
|
7140
7200
|
);
|
|
7141
|
-
var ProfileVersionStatusSchema =
|
|
7142
|
-
var ProfileVisibilitySchema =
|
|
7143
|
-
var ProfileLdapSchema =
|
|
7144
|
-
var WorkloadBindKindSchema =
|
|
7145
|
-
var WorkloadProfileRefSchema =
|
|
7201
|
+
var ProfileVersionStatusSchema = import_zod55.z.enum(["published", "yanked"]);
|
|
7202
|
+
var ProfileVisibilitySchema = import_zod55.z.enum(["public", "private"]);
|
|
7203
|
+
var ProfileLdapSchema = import_zod55.z.string().min(1).max(64);
|
|
7204
|
+
var WorkloadBindKindSchema = import_zod55.z.enum(["profile", "legacy_direct_bind"]);
|
|
7205
|
+
var WorkloadProfileRefSchema = import_zod55.z.object({
|
|
7146
7206
|
bindKind: WorkloadBindKindSchema.default("profile"),
|
|
7147
7207
|
profileName: ProfileNameSchema.optional(),
|
|
7148
7208
|
resolvedVersion: SemverSchema.optional(),
|
|
7149
|
-
resolvedAt:
|
|
7209
|
+
resolvedAt: import_zod55.z.string().datetime().optional(),
|
|
7150
7210
|
integrity: ProfileIntegritySchema.optional()
|
|
7151
7211
|
}).strict().superRefine((ref, ctx) => {
|
|
7152
7212
|
if (ref.bindKind === "profile") {
|
|
@@ -7154,7 +7214,7 @@ var WorkloadProfileRefSchema = import_zod54.z.object({
|
|
|
7154
7214
|
for (const field of required) {
|
|
7155
7215
|
if (ref[field] === void 0) {
|
|
7156
7216
|
ctx.addIssue({
|
|
7157
|
-
code:
|
|
7217
|
+
code: import_zod55.z.ZodIssueCode.custom,
|
|
7158
7218
|
path: [field],
|
|
7159
7219
|
message: `profile bind requires ${field} for audit`
|
|
7160
7220
|
});
|
|
@@ -7164,7 +7224,7 @@ var WorkloadProfileRefSchema = import_zod54.z.object({
|
|
|
7164
7224
|
for (const field of ["profileName", "resolvedVersion", "resolvedAt", "integrity"]) {
|
|
7165
7225
|
if (ref[field] !== void 0) {
|
|
7166
7226
|
ctx.addIssue({
|
|
7167
|
-
code:
|
|
7227
|
+
code: import_zod55.z.ZodIssueCode.custom,
|
|
7168
7228
|
path: [field],
|
|
7169
7229
|
message: `legacy_direct_bind must not carry ${field}`
|
|
7170
7230
|
});
|
|
@@ -7172,139 +7232,139 @@ var WorkloadProfileRefSchema = import_zod54.z.object({
|
|
|
7172
7232
|
}
|
|
7173
7233
|
}
|
|
7174
7234
|
});
|
|
7175
|
-
var CreateProfileRequestSchema =
|
|
7235
|
+
var CreateProfileRequestSchema = import_zod55.z.object({
|
|
7176
7236
|
name: ProfileNameSchema,
|
|
7177
|
-
displayName:
|
|
7178
|
-
description:
|
|
7237
|
+
displayName: import_zod55.z.string().min(1).max(255),
|
|
7238
|
+
description: import_zod55.z.string().max(4096).optional(),
|
|
7179
7239
|
visibility: ProfileVisibilitySchema.default("private"),
|
|
7180
|
-
whitelistLdaps:
|
|
7240
|
+
whitelistLdaps: import_zod55.z.array(ProfileLdapSchema).max(256).optional()
|
|
7181
7241
|
}).strict();
|
|
7182
|
-
var SetVisibilityRequestSchema =
|
|
7242
|
+
var SetVisibilityRequestSchema = import_zod55.z.object({
|
|
7183
7243
|
visibility: ProfileVisibilitySchema,
|
|
7184
|
-
whitelistLdaps:
|
|
7244
|
+
whitelistLdaps: import_zod55.z.array(ProfileLdapSchema).max(256).optional()
|
|
7185
7245
|
}).strict();
|
|
7186
|
-
var PublishProfileVersionRequestSchema =
|
|
7246
|
+
var PublishProfileVersionRequestSchema = import_zod55.z.object({
|
|
7187
7247
|
version: SemverSchema,
|
|
7188
7248
|
schemaVersion: ProfileSchemaVersionSchema,
|
|
7189
|
-
content:
|
|
7249
|
+
content: import_zod55.z.record(import_zod55.z.string(), import_zod55.z.unknown()),
|
|
7190
7250
|
integrity: ProfileIntegritySchema.optional()
|
|
7191
7251
|
}).strict();
|
|
7192
|
-
var SetStableRequestSchema =
|
|
7252
|
+
var SetStableRequestSchema = import_zod55.z.object({
|
|
7193
7253
|
version: SemverSchema
|
|
7194
7254
|
}).strict();
|
|
7195
|
-
var YankVersionRequestSchema =
|
|
7196
|
-
reason:
|
|
7255
|
+
var YankVersionRequestSchema = import_zod55.z.object({
|
|
7256
|
+
reason: import_zod55.z.string().max(1024).optional()
|
|
7197
7257
|
}).strict();
|
|
7198
|
-
var ResolveReasonSchema =
|
|
7199
|
-
var ResolveResultSchema =
|
|
7258
|
+
var ResolveReasonSchema = import_zod55.z.enum(["stable", "pinned", "no_stable", "yanked", "not_found"]);
|
|
7259
|
+
var ResolveResultSchema = import_zod55.z.object({
|
|
7200
7260
|
profileName: ProfileNameSchema,
|
|
7201
7261
|
requestedVersion: SemverSchema.nullable(),
|
|
7202
7262
|
resolvedVersion: SemverSchema.nullable(),
|
|
7203
7263
|
integrity: ProfileIntegritySchema.nullable(),
|
|
7204
7264
|
reason: ResolveReasonSchema
|
|
7205
7265
|
});
|
|
7206
|
-
var PlatformProjectSchema =
|
|
7207
|
-
id:
|
|
7266
|
+
var PlatformProjectSchema = import_zod56.z.object({
|
|
7267
|
+
id: import_zod56.z.string().uuid(),
|
|
7208
7268
|
slug: WorkloadManifestNameSchema,
|
|
7209
7269
|
displayName: WorkloadManifestDisplayNameSchema,
|
|
7210
|
-
description:
|
|
7270
|
+
description: import_zod56.z.string().nullable().optional(),
|
|
7211
7271
|
defaultRuntimeTemplateRefName: WorkloadManifestRefNameSchema.nullable().optional(),
|
|
7212
|
-
createdAt:
|
|
7213
|
-
updatedAt:
|
|
7272
|
+
createdAt: import_zod56.z.string().optional(),
|
|
7273
|
+
updatedAt: import_zod56.z.string().optional()
|
|
7214
7274
|
}).strict();
|
|
7215
|
-
var CreatePlatformProjectRequestSchema =
|
|
7275
|
+
var CreatePlatformProjectRequestSchema = import_zod56.z.object({
|
|
7216
7276
|
slug: WorkloadManifestNameSchema,
|
|
7217
7277
|
displayName: WorkloadManifestDisplayNameSchema,
|
|
7218
|
-
description:
|
|
7278
|
+
description: import_zod56.z.string().max(2e3).optional(),
|
|
7219
7279
|
defaultRuntimeTemplateRefName: WorkloadManifestRefNameSchema.optional()
|
|
7220
7280
|
}).strict();
|
|
7221
|
-
var ListPlatformProjectsResponseSchema =
|
|
7222
|
-
projects:
|
|
7281
|
+
var ListPlatformProjectsResponseSchema = import_zod56.z.object({
|
|
7282
|
+
projects: import_zod56.z.array(PlatformProjectSchema)
|
|
7223
7283
|
}).strict();
|
|
7224
|
-
var DeletePlatformProjectResponseSchema =
|
|
7225
|
-
action:
|
|
7226
|
-
projectId:
|
|
7284
|
+
var DeletePlatformProjectResponseSchema = import_zod56.z.object({
|
|
7285
|
+
action: import_zod56.z.literal("deactivated"),
|
|
7286
|
+
projectId: import_zod56.z.string().uuid()
|
|
7227
7287
|
}).strict();
|
|
7228
|
-
var PlatformWorkloadDefaultsSchema =
|
|
7288
|
+
var PlatformWorkloadDefaultsSchema = import_zod56.z.object({
|
|
7229
7289
|
workerContract: WorkloadManifestWorkerContractDefaultsSchema.optional(),
|
|
7230
7290
|
configValues: SessionConfigValuesSchema.optional(),
|
|
7231
|
-
model:
|
|
7232
|
-
systemPrompt:
|
|
7291
|
+
model: import_zod56.z.string().min(1).max(255).optional(),
|
|
7292
|
+
systemPrompt: import_zod56.z.string().min(1).max(32768).optional(),
|
|
7233
7293
|
enabledSkills: EnabledSkillEntryListSchema.optional(),
|
|
7234
7294
|
enabledMcpServers: EnabledMcpEntryListSchema.optional(),
|
|
7235
7295
|
agentOptions: AgentOptionsSchema.optional(),
|
|
7236
7296
|
agentPackage: AgentPackageSchema.optional()
|
|
7237
7297
|
}).strict();
|
|
7238
|
-
var CreatePlatformWorkloadRequestSchema =
|
|
7239
|
-
projectId:
|
|
7298
|
+
var CreatePlatformWorkloadRequestSchema = import_zod56.z.object({
|
|
7299
|
+
projectId: import_zod56.z.string().uuid(),
|
|
7240
7300
|
slug: WorkloadManifestNameSchema,
|
|
7241
7301
|
displayName: WorkloadManifestDisplayNameSchema,
|
|
7242
7302
|
kind: ActiveWorkloadKindSchema,
|
|
7243
7303
|
defaults: PlatformWorkloadDefaultsSchema.optional(),
|
|
7244
7304
|
ui: WorkloadManifestUiHintSchema.optional()
|
|
7245
7305
|
}).strict();
|
|
7246
|
-
var PlatformWorkloadSchema =
|
|
7247
|
-
id:
|
|
7248
|
-
projectId:
|
|
7306
|
+
var PlatformWorkloadSchema = import_zod56.z.object({
|
|
7307
|
+
id: import_zod56.z.string().uuid(),
|
|
7308
|
+
projectId: import_zod56.z.string().uuid(),
|
|
7249
7309
|
slug: WorkloadManifestNameSchema,
|
|
7250
7310
|
displayName: WorkloadManifestDisplayNameSchema,
|
|
7251
7311
|
kind: ActiveWorkloadKindSchema,
|
|
7252
|
-
defaultRevisionId:
|
|
7253
|
-
createdAt:
|
|
7254
|
-
updatedAt:
|
|
7312
|
+
defaultRevisionId: import_zod56.z.string().uuid().nullable().optional(),
|
|
7313
|
+
createdAt: import_zod56.z.string().optional(),
|
|
7314
|
+
updatedAt: import_zod56.z.string().optional()
|
|
7255
7315
|
}).strict();
|
|
7256
|
-
var PublishPlatformRevisionWorkerContractSchema =
|
|
7316
|
+
var PublishPlatformRevisionWorkerContractSchema = import_zod56.z.object({
|
|
7257
7317
|
kind: ActiveWorkloadKindSchema,
|
|
7258
7318
|
name: WorkloadManifestRefNameSchema.optional(),
|
|
7259
|
-
version:
|
|
7319
|
+
version: import_zod56.z.string().min(1).max(100).optional()
|
|
7260
7320
|
}).strict();
|
|
7261
|
-
var PublishPlatformRevisionRequestSchema =
|
|
7262
|
-
projectId:
|
|
7321
|
+
var PublishPlatformRevisionRequestSchema = import_zod56.z.object({
|
|
7322
|
+
projectId: import_zod56.z.string().uuid(),
|
|
7263
7323
|
workloadSlug: WorkloadManifestNameSchema,
|
|
7264
7324
|
version: WorkloadManifestNameSchema,
|
|
7265
7325
|
workerContract: PublishPlatformRevisionWorkerContractSchema,
|
|
7266
|
-
setDefault:
|
|
7267
|
-
startup:
|
|
7268
|
-
requiredGates:
|
|
7269
|
-
optionalGates:
|
|
7326
|
+
setDefault: import_zod56.z.boolean().default(true),
|
|
7327
|
+
startup: import_zod56.z.object({
|
|
7328
|
+
requiredGates: import_zod56.z.array(import_zod56.z.string().min(1)).optional(),
|
|
7329
|
+
optionalGates: import_zod56.z.array(import_zod56.z.string().min(1)).optional()
|
|
7270
7330
|
}).strict().optional(),
|
|
7271
7331
|
configValues: SessionConfigValuesSchema.optional(),
|
|
7272
7332
|
managedAgentProfileSnapshot: ManagedAgentProfileSnapshotSchema.optional(),
|
|
7273
7333
|
runtime: RevisionRuntimeSchema.optional()
|
|
7274
7334
|
}).strict();
|
|
7275
|
-
var PlatformRevisionSchema =
|
|
7276
|
-
id:
|
|
7277
|
-
projectId:
|
|
7278
|
-
workloadId:
|
|
7335
|
+
var PlatformRevisionSchema = import_zod56.z.object({
|
|
7336
|
+
id: import_zod56.z.string().uuid(),
|
|
7337
|
+
projectId: import_zod56.z.string().uuid(),
|
|
7338
|
+
workloadId: import_zod56.z.string().uuid(),
|
|
7279
7339
|
workloadSlug: WorkloadManifestNameSchema.optional(),
|
|
7280
7340
|
version: WorkloadManifestNameSchema,
|
|
7281
|
-
runtimeSnapshotHash:
|
|
7282
|
-
createdAt:
|
|
7341
|
+
runtimeSnapshotHash: import_zod56.z.string().nullable().optional(),
|
|
7342
|
+
createdAt: import_zod56.z.string().optional()
|
|
7283
7343
|
}).strict();
|
|
7284
7344
|
var GetPlatformWorkloadResponseSchema = PlatformWorkloadSchema.extend({
|
|
7285
7345
|
kind: WorkloadKindSchema,
|
|
7286
7346
|
defaultRevision: PlatformRevisionSchema.nullable()
|
|
7287
7347
|
});
|
|
7288
7348
|
var GetPlatformRevisionResponseSchema = PlatformRevisionSchema;
|
|
7289
|
-
var GetPlatformSessionResponseSchema =
|
|
7290
|
-
id:
|
|
7291
|
-
projectId:
|
|
7292
|
-
workloadId:
|
|
7293
|
-
revisionId:
|
|
7349
|
+
var GetPlatformSessionResponseSchema = import_zod56.z.object({
|
|
7350
|
+
id: import_zod56.z.string().uuid(),
|
|
7351
|
+
projectId: import_zod56.z.string().uuid(),
|
|
7352
|
+
workloadId: import_zod56.z.string().uuid(),
|
|
7353
|
+
revisionId: import_zod56.z.string().uuid(),
|
|
7294
7354
|
status: SessionStatusSchema,
|
|
7295
|
-
createdAt:
|
|
7296
|
-
updatedAt:
|
|
7355
|
+
createdAt: import_zod56.z.string().optional(),
|
|
7356
|
+
updatedAt: import_zod56.z.string().optional()
|
|
7297
7357
|
}).strict();
|
|
7298
7358
|
var CreatePlatformSessionRequestSchema = CreateSessionRequestSchema;
|
|
7299
7359
|
var CreatePlatformSessionResponseSchema = CreateSessionResponseSchema;
|
|
7300
|
-
var ReleaseSandboxResponseSchema =
|
|
7301
|
-
released:
|
|
7302
|
-
sandboxId:
|
|
7303
|
-
sandboxDestroyed:
|
|
7304
|
-
destroyError:
|
|
7360
|
+
var ReleaseSandboxResponseSchema = import_zod56.z.object({
|
|
7361
|
+
released: import_zod56.z.literal(true),
|
|
7362
|
+
sandboxId: import_zod56.z.string().nullable(),
|
|
7363
|
+
sandboxDestroyed: import_zod56.z.boolean(),
|
|
7364
|
+
destroyError: import_zod56.z.string().optional()
|
|
7305
7365
|
}).strict();
|
|
7306
7366
|
var PlatformFileUploadResponseSchema = AttachmentMetaSchema.extend({
|
|
7307
|
-
url:
|
|
7367
|
+
url: import_zod56.z.string()
|
|
7308
7368
|
});
|
|
7309
7369
|
function platformWorkloadCreateToManifest(input) {
|
|
7310
7370
|
const defaults = input.defaults ? omitUndefined(input.defaults) : void 0;
|
|
@@ -7339,29 +7399,285 @@ function platformRevisionPublishToManifest(input) {
|
|
|
7339
7399
|
}), input.startup ? { startup: input.startup } : {}), input.configValues ? { configValues: input.configValues } : {}), input.managedAgentProfileSnapshot ? { managedAgentProfileSnapshot: input.managedAgentProfileSnapshot } : {})
|
|
7340
7400
|
});
|
|
7341
7401
|
}
|
|
7342
|
-
var SessionTurnRequestSchema =
|
|
7343
|
-
text:
|
|
7402
|
+
var SessionTurnRequestSchema = import_zod57.z.object({
|
|
7403
|
+
text: import_zod57.z.string().min(1).max(5e4),
|
|
7344
7404
|
/**
|
|
7345
7405
|
* Optional attachments uploaded via `POST /api/files/upload`. The Worker
|
|
7346
7406
|
* Protocol envelope itself does not carry attachments, so the handler
|
|
7347
7407
|
* splices the URLs into `promptText` as a trailing context block; the
|
|
7348
7408
|
* worker (LLM) treats them as references it can fetch.
|
|
7349
7409
|
*/
|
|
7350
|
-
attachments:
|
|
7410
|
+
attachments: import_zod57.z.array(AttachmentMetaSchema).max(20).optional()
|
|
7351
7411
|
}).strict();
|
|
7352
|
-
var SessionTurnDispatchedResponseSchema =
|
|
7353
|
-
success:
|
|
7354
|
-
data:
|
|
7412
|
+
var SessionTurnDispatchedResponseSchema = import_zod57.z.object({
|
|
7413
|
+
success: import_zod57.z.literal(true),
|
|
7414
|
+
data: import_zod57.z.object({
|
|
7415
|
+
outcome: DispatchOutcomeSchema,
|
|
7416
|
+
turn: import_zod57.z.object({
|
|
7417
|
+
turnId: import_zod57.z.string().min(1),
|
|
7418
|
+
status: import_zod57.z.literal("dispatched")
|
|
7419
|
+
}).optional()
|
|
7420
|
+
})
|
|
7421
|
+
});
|
|
7422
|
+
var SessionTurnRevivalResponseSchema = import_zod57.z.object({
|
|
7423
|
+
success: import_zod57.z.literal(false),
|
|
7424
|
+
revivalInProgress: import_zod57.z.literal(true),
|
|
7425
|
+
sessionId: import_zod57.z.string(),
|
|
7426
|
+
attemptId: import_zod57.z.string(),
|
|
7427
|
+
turnId: import_zod57.z.string().optional()
|
|
7428
|
+
});
|
|
7429
|
+
var TurnStatusSchema = import_zod58.z.enum([
|
|
7430
|
+
"dispatched",
|
|
7431
|
+
"running",
|
|
7432
|
+
"completed",
|
|
7433
|
+
"failed",
|
|
7434
|
+
"rejected",
|
|
7435
|
+
"aborted",
|
|
7436
|
+
"interrupted"
|
|
7437
|
+
]);
|
|
7438
|
+
var TERMINAL_TURN_STATUSES = [
|
|
7439
|
+
"completed",
|
|
7440
|
+
"failed",
|
|
7441
|
+
"rejected",
|
|
7442
|
+
"aborted",
|
|
7443
|
+
"interrupted"
|
|
7444
|
+
];
|
|
7445
|
+
function isTerminalTurnStatus(status) {
|
|
7446
|
+
return TERMINAL_TURN_STATUSES.includes(status);
|
|
7447
|
+
}
|
|
7448
|
+
var TurnKindSchema = import_zod58.z.enum(["prompt", "followup"]);
|
|
7449
|
+
var TurnPhaseSchema = import_zod58.z.enum(["generating", "delivering"]);
|
|
7450
|
+
var AssistantMessageStateSchema = import_zod58.z.enum(["streaming", "complete", "truncated"]);
|
|
7451
|
+
var DeliveryStateSchema = import_zod58.z.enum([
|
|
7452
|
+
"not_started",
|
|
7453
|
+
"in_progress",
|
|
7454
|
+
"completed",
|
|
7455
|
+
"failed",
|
|
7456
|
+
"interrupted"
|
|
7457
|
+
]);
|
|
7458
|
+
var ArtifactBundleStateSchema = import_zod58.z.enum([
|
|
7459
|
+
"collecting",
|
|
7460
|
+
"available",
|
|
7461
|
+
"superseded_by_retry",
|
|
7462
|
+
"rejected"
|
|
7463
|
+
]);
|
|
7464
|
+
var DELIVERY_PROGRESS_STEPS = ["git_push", "create_mr", "upload_artifact"];
|
|
7465
|
+
var DeliveryProgressStepSchema = import_zod58.z.enum(DELIVERY_PROGRESS_STEPS);
|
|
7466
|
+
var TurnAnomalySchema = import_zod58.z.object({
|
|
7467
|
+
code: import_zod58.z.string().min(1),
|
|
7468
|
+
/** `session_events.id` of the row that triggered it, when there is one. */
|
|
7469
|
+
eventId: import_zod58.z.string().optional(),
|
|
7470
|
+
detail: import_zod58.z.string().optional()
|
|
7471
|
+
});
|
|
7472
|
+
var TurnAssistantPartStateSchema = import_zod58.z.enum(["streaming", "done"]);
|
|
7473
|
+
var TurnToolPartStateSchema = import_zod58.z.enum([
|
|
7474
|
+
"input-streaming",
|
|
7475
|
+
"input-available",
|
|
7476
|
+
"output-available",
|
|
7477
|
+
"output-error"
|
|
7478
|
+
]);
|
|
7479
|
+
var TurnAssistantTextPartSchema = import_zod58.z.object({
|
|
7480
|
+
type: import_zod58.z.literal("text"),
|
|
7481
|
+
text: import_zod58.z.string(),
|
|
7482
|
+
state: TurnAssistantPartStateSchema.optional()
|
|
7483
|
+
});
|
|
7484
|
+
var TurnAssistantReasoningPartSchema = import_zod58.z.object({
|
|
7485
|
+
type: import_zod58.z.literal("reasoning"),
|
|
7486
|
+
text: import_zod58.z.string(),
|
|
7487
|
+
state: TurnAssistantPartStateSchema.optional()
|
|
7488
|
+
});
|
|
7489
|
+
var TurnAssistantToolPartSchema = import_zod58.z.object({
|
|
7490
|
+
type: import_zod58.z.literal("dynamic-tool"),
|
|
7491
|
+
toolName: import_zod58.z.string(),
|
|
7492
|
+
toolCallId: import_zod58.z.string(),
|
|
7493
|
+
state: TurnToolPartStateSchema,
|
|
7494
|
+
input: import_zod58.z.unknown().optional(),
|
|
7495
|
+
output: import_zod58.z.unknown().optional(),
|
|
7496
|
+
errorText: import_zod58.z.string().optional()
|
|
7497
|
+
});
|
|
7498
|
+
var TurnAssistantStepPartSchema = import_zod58.z.object({
|
|
7499
|
+
type: import_zod58.z.literal("step-start")
|
|
7500
|
+
});
|
|
7501
|
+
var TurnAssistantPartSchema = import_zod58.z.discriminatedUnion("type", [
|
|
7502
|
+
TurnAssistantTextPartSchema,
|
|
7503
|
+
TurnAssistantReasoningPartSchema,
|
|
7504
|
+
TurnAssistantToolPartSchema,
|
|
7505
|
+
TurnAssistantStepPartSchema
|
|
7506
|
+
]);
|
|
7507
|
+
var TurnUserMessageSchema = import_zod58.z.object({
|
|
7508
|
+
messageId: import_zod58.z.string(),
|
|
7509
|
+
text: import_zod58.z.string(),
|
|
7510
|
+
attachments: import_zod58.z.array(AttachmentMetaSchema),
|
|
7511
|
+
createdAt: import_zod58.z.string()
|
|
7512
|
+
});
|
|
7513
|
+
var TurnAssistantMessageSchema = import_zod58.z.object({
|
|
7514
|
+
messageId: import_zod58.z.string(),
|
|
7515
|
+
state: AssistantMessageStateSchema,
|
|
7516
|
+
parts: import_zod58.z.array(TurnAssistantPartSchema),
|
|
7517
|
+
/** Chunks the fold could not interpret. Non-zero means data loss. */
|
|
7518
|
+
droppedChunks: import_zod58.z.number().int().nonnegative(),
|
|
7519
|
+
/**
|
|
7520
|
+
* `retained` marks an assistant message whose source chunks were deleted by
|
|
7521
|
+
* the event retention sweep: this row IS the record now, and a projection
|
|
7522
|
+
* re-run may add to it but must never blank it (T-INV-9).
|
|
7523
|
+
*/
|
|
7524
|
+
source: import_zod58.z.literal("retained").optional()
|
|
7525
|
+
});
|
|
7526
|
+
var TurnDeliverySchema = import_zod58.z.object({
|
|
7527
|
+
state: DeliveryStateSchema,
|
|
7528
|
+
/** Last observed wire step; `z.string()` so an unknown value still reads. */
|
|
7529
|
+
step: import_zod58.z.string().optional(),
|
|
7530
|
+
attempts: import_zod58.z.number().int().nonnegative(),
|
|
7531
|
+
pullRequestUrl: import_zod58.z.string().optional(),
|
|
7532
|
+
failedReason: import_zod58.z.string().optional(),
|
|
7533
|
+
failedAt: import_zod58.z.string().optional()
|
|
7534
|
+
});
|
|
7535
|
+
var TurnArtifactBundleSchema = import_zod58.z.object({
|
|
7536
|
+
/** Absent for a `rejected` bundle — nothing was uploaded, so there is no row. */
|
|
7537
|
+
artifactId: import_zod58.z.string().optional(),
|
|
7538
|
+
state: ArtifactBundleStateSchema,
|
|
7539
|
+
entryCount: import_zod58.z.number().int().nonnegative(),
|
|
7540
|
+
createdAt: import_zod58.z.string(),
|
|
7541
|
+
reason: import_zod58.z.string().optional()
|
|
7542
|
+
});
|
|
7543
|
+
var TurnArtifactsSchema = import_zod58.z.object({
|
|
7544
|
+
bundles: import_zod58.z.array(TurnArtifactBundleSchema),
|
|
7545
|
+
incrementalHref: import_zod58.z.string(),
|
|
7546
|
+
cumulativeHref: import_zod58.z.string()
|
|
7547
|
+
});
|
|
7548
|
+
var TurnStatusReasonSchema = import_zod58.z.object({
|
|
7549
|
+
code: import_zod58.z.string(),
|
|
7550
|
+
message: import_zod58.z.string()
|
|
7551
|
+
});
|
|
7552
|
+
var TurnAbortRequestSchema = import_zod58.z.object({
|
|
7553
|
+
requestedAt: import_zod58.z.string(),
|
|
7554
|
+
eventId: import_zod58.z.string()
|
|
7555
|
+
});
|
|
7556
|
+
var TurnSeqRangeSchema = import_zod58.z.object({
|
|
7557
|
+
start: import_zod58.z.number().int().nullable(),
|
|
7558
|
+
end: import_zod58.z.number().int().nullable()
|
|
7559
|
+
});
|
|
7560
|
+
var TurnContextStateSchema = import_zod58.z.enum(["live", "compacted"]);
|
|
7561
|
+
var TurnMemoryRecallStateSchema = import_zod58.z.enum([
|
|
7562
|
+
"selected",
|
|
7563
|
+
"empty",
|
|
7564
|
+
"recall_failed",
|
|
7565
|
+
"unavailable",
|
|
7566
|
+
"legacy"
|
|
7567
|
+
]);
|
|
7568
|
+
var TurnSchema = import_zod58.z.object({
|
|
7569
|
+
turnId: import_zod58.z.string(),
|
|
7570
|
+
kind: TurnKindSchema,
|
|
7571
|
+
parentTurnId: import_zod58.z.string().nullable(),
|
|
7572
|
+
/** Pairs the turn with `${kind}:${idempotencyKey}`-shaped side events. */
|
|
7573
|
+
idempotencyKey: import_zod58.z.string(),
|
|
7574
|
+
status: TurnStatusSchema,
|
|
7575
|
+
revival: import_zod58.z.object({ attemptId: import_zod58.z.string() }).optional(),
|
|
7576
|
+
phase: TurnPhaseSchema.optional(),
|
|
7577
|
+
statusReason: TurnStatusReasonSchema.optional(),
|
|
7578
|
+
user: TurnUserMessageSchema,
|
|
7579
|
+
assistant: TurnAssistantMessageSchema.nullable(),
|
|
7580
|
+
delivery: TurnDeliverySchema.nullable(),
|
|
7581
|
+
/**
|
|
7582
|
+
* Returned from P2 on, once `artifacts.turn_id` exists — attribution before
|
|
7583
|
+
* that column is a path regex, and shipping a guessed answer would teach
|
|
7584
|
+
* consumers to trust it. Absent means "not populated yet", never "no
|
|
7585
|
+
* artifacts".
|
|
7586
|
+
*/
|
|
7587
|
+
artifacts: TurnArtifactsSchema.optional(),
|
|
7588
|
+
/**
|
|
7589
|
+
* Returned from P2 on, with the `POST /workspace-snapshot` envelope's
|
|
7590
|
+
* `turnId` (T-INV-6). Absent means "not populated yet"; `null` means this
|
|
7591
|
+
* turn is not the source of the session's current snapshot.
|
|
7592
|
+
*/
|
|
7593
|
+
workspaceSnapshot: import_zod58.z.object({ capturedAt: import_zod58.z.string() }).nullable().optional(),
|
|
7594
|
+
context: import_zod58.z.object({ state: TurnContextStateSchema }),
|
|
7595
|
+
memoryRecall: import_zod58.z.object({ state: TurnMemoryRecallStateSchema }).optional(),
|
|
7596
|
+
abort: TurnAbortRequestSchema.nullable(),
|
|
7597
|
+
seqRange: TurnSeqRangeSchema,
|
|
7598
|
+
traceId: import_zod58.z.string().nullable(),
|
|
7599
|
+
anomalies: import_zod58.z.array(TurnAnomalySchema),
|
|
7600
|
+
dispatchedAt: import_zod58.z.string(),
|
|
7601
|
+
acceptedAt: import_zod58.z.string().optional(),
|
|
7602
|
+
completedAt: import_zod58.z.string().optional()
|
|
7603
|
+
});
|
|
7604
|
+
var TurnListResponseDataSchema = import_zod58.z.object({
|
|
7605
|
+
turns: import_zod58.z.array(TurnSchema),
|
|
7606
|
+
hasMore: import_zod58.z.boolean(),
|
|
7607
|
+
nextCursor: import_zod58.z.string().nullable(),
|
|
7608
|
+
prevCursor: import_zod58.z.string().nullable(),
|
|
7609
|
+
/** Session-wide `max(__seq)`; usable directly as `Last-Event-ID`. */
|
|
7610
|
+
streamCursor: import_zod58.z.number().int().nullable()
|
|
7611
|
+
});
|
|
7612
|
+
var TURN_LIST_DEFAULT_LIMIT = 20;
|
|
7613
|
+
var TURN_LIST_MAX_LIMIT = 100;
|
|
7614
|
+
var TurnListQuerySchema = import_zod58.z.object({
|
|
7615
|
+
limit: import_zod58.z.coerce.number().int().min(1).max(TURN_LIST_MAX_LIMIT).default(TURN_LIST_DEFAULT_LIMIT),
|
|
7616
|
+
order: import_zod58.z.enum(["desc", "asc"]).default("desc"),
|
|
7617
|
+
before: import_zod58.z.string().min(1).optional(),
|
|
7618
|
+
after: import_zod58.z.string().min(1).optional(),
|
|
7619
|
+
/**
|
|
7620
|
+
* Comma-separated status filter, e.g. `status=completed,failed`. Same wire
|
|
7621
|
+
* form as `SessionEventsQuerySchema.types`: every route mount parses its
|
|
7622
|
+
* query via `Object.fromEntries(new URL(url).searchParams)`, which keeps
|
|
7623
|
+
* only the LAST value of a repeated key, so `status=a&status=b` would
|
|
7624
|
+
* silently filter for `b` alone. Each item must be a `TurnStatus`.
|
|
7625
|
+
*/
|
|
7626
|
+
status: import_zod58.z.string().optional().transform((value, ctx) => {
|
|
7627
|
+
if (value === void 0) return void 0;
|
|
7628
|
+
const items = value.split(",").filter((s) => s.length > 0);
|
|
7629
|
+
const parsed = import_zod58.z.array(TurnStatusSchema).safeParse(items);
|
|
7630
|
+
if (!parsed.success) {
|
|
7631
|
+
ctx.addIssue({ code: "custom", message: `unknown turn status in: ${value}` });
|
|
7632
|
+
return import_zod58.z.NEVER;
|
|
7633
|
+
}
|
|
7634
|
+
return parsed.data;
|
|
7635
|
+
}),
|
|
7636
|
+
revivalAttemptId: import_zod58.z.string().uuid().optional()
|
|
7637
|
+
}).refine((q) => !(q.before !== void 0 && q.after !== void 0), {
|
|
7638
|
+
message: "before and after are mutually exclusive",
|
|
7639
|
+
path: ["before"]
|
|
7640
|
+
});
|
|
7641
|
+
function turnMessageIds(turnId) {
|
|
7642
|
+
return { user: `${turnId}:u`, assistant: `${turnId}:a` };
|
|
7643
|
+
}
|
|
7644
|
+
var SESSION_EVENTS_DEFAULT_LIMIT = 100;
|
|
7645
|
+
var SESSION_EVENTS_MAX_LIMIT = 500;
|
|
7646
|
+
var SessionEventsQuerySchema = import_zod59.z.object({
|
|
7647
|
+
afterEventId: import_zod59.z.string().min(1).optional(),
|
|
7648
|
+
limit: import_zod59.z.coerce.number().int().min(1).max(SESSION_EVENTS_MAX_LIMIT).default(SESSION_EVENTS_DEFAULT_LIMIT),
|
|
7649
|
+
turnId: import_zod59.z.string().uuid().optional(),
|
|
7650
|
+
/**
|
|
7651
|
+
* Comma-separated `event_type` values, e.g.
|
|
7652
|
+
* `types=worker_protocol.prompt.dispatched,pilot_coder.chunk`.
|
|
7653
|
+
*
|
|
7654
|
+
* NOT `types=a&types=b` (repeated keys): every route mount parses its
|
|
7655
|
+
* query string via `Object.fromEntries(new URL(request.url).searchParams)`,
|
|
7656
|
+
* which keeps only the LAST value for a repeated key — a `types=a&types=b`
|
|
7657
|
+
* request would silently filter for `b` alone. Comma-separated is the one
|
|
7658
|
+
* form that survives that parsing unchanged.
|
|
7659
|
+
*/
|
|
7660
|
+
types: import_zod59.z.string().optional().transform(
|
|
7661
|
+
(value) => value === void 0 ? void 0 : value.split(",").filter((t) => t.length > 0)
|
|
7662
|
+
)
|
|
7663
|
+
});
|
|
7664
|
+
var SessionEventsPageDataSchema = import_zod59.z.object({
|
|
7665
|
+
events: import_zod59.z.array(SessionEventSchema),
|
|
7666
|
+
hasMore: import_zod59.z.boolean(),
|
|
7667
|
+
/**
|
|
7668
|
+
* Set `true` only when `afterEventId` was given but matched neither the
|
|
7669
|
+
* `event_id` column nor a row's primary key (e.g. the referenced chunk
|
|
7670
|
+
* was pruned by retention) — the response falls back to the first page
|
|
7671
|
+
* instead of the pre-existing silent fallback. Omitted (not `false`)
|
|
7672
|
+
* otherwise.
|
|
7673
|
+
*/
|
|
7674
|
+
cursorReset: import_zod59.z.boolean().optional()
|
|
7355
7675
|
});
|
|
7356
|
-
var
|
|
7357
|
-
success:
|
|
7358
|
-
|
|
7359
|
-
sessionId: import_zod56.z.string(),
|
|
7360
|
-
attemptId: import_zod56.z.string(),
|
|
7361
|
-
alreadyReviving: import_zod56.z.boolean().optional(),
|
|
7362
|
-
turnId: import_zod56.z.string().optional()
|
|
7676
|
+
var SessionEventsPageResponseSchema = import_zod59.z.object({
|
|
7677
|
+
success: import_zod59.z.literal(true),
|
|
7678
|
+
data: SessionEventsPageDataSchema
|
|
7363
7679
|
});
|
|
7364
|
-
var GatewayErrorCodeSchema =
|
|
7680
|
+
var GatewayErrorCodeSchema = import_zod60.z.enum([
|
|
7365
7681
|
"gateway_invalid_session_token",
|
|
7366
7682
|
"gateway_session_not_found",
|
|
7367
7683
|
"gateway_missing_mcp_target",
|
|
@@ -7404,7 +7720,7 @@ var GatewayErrorCodeSchema = import_zod57.z.enum([
|
|
|
7404
7720
|
"gateway_request_too_large",
|
|
7405
7721
|
"gateway_response_too_large"
|
|
7406
7722
|
]);
|
|
7407
|
-
var WebhookEventTypeSchema =
|
|
7723
|
+
var WebhookEventTypeSchema = import_zod61.z.enum([
|
|
7408
7724
|
/** v1/v2 Run reached terminal `completed`. */
|
|
7409
7725
|
"run.completed",
|
|
7410
7726
|
/** v1/v2 Run reached terminal `failed`. */
|
|
@@ -7437,43 +7753,43 @@ var WebhookEventTypeSchema = import_zod58.z.enum([
|
|
|
7437
7753
|
]);
|
|
7438
7754
|
var WEBHOOK_EVENT_TYPES = WebhookEventTypeSchema.options;
|
|
7439
7755
|
var MAX_WEBHOOK_EVENT_ID_LENGTH = 255;
|
|
7440
|
-
var WebhookEventPayloadSchema =
|
|
7441
|
-
event_id:
|
|
7756
|
+
var WebhookEventPayloadSchema = import_zod61.z.object({
|
|
7757
|
+
event_id: import_zod61.z.string().min(1).max(MAX_WEBHOOK_EVENT_ID_LENGTH),
|
|
7442
7758
|
event_type: WebhookEventTypeSchema,
|
|
7443
7759
|
/** ISO-8601 instant at which the transition was recorded. */
|
|
7444
|
-
occurred_at:
|
|
7445
|
-
project_id:
|
|
7446
|
-
run_id:
|
|
7447
|
-
agent_id:
|
|
7448
|
-
session_id:
|
|
7760
|
+
occurred_at: import_zod61.z.string(),
|
|
7761
|
+
project_id: import_zod61.z.string().uuid(),
|
|
7762
|
+
run_id: import_zod61.z.string().uuid().optional(),
|
|
7763
|
+
agent_id: import_zod61.z.string().uuid().optional(),
|
|
7764
|
+
session_id: import_zod61.z.string().uuid().optional(),
|
|
7449
7765
|
/**
|
|
7450
7766
|
* Worker turn id of a `turn.*` event, paired with `session_id`.
|
|
7451
7767
|
* NOT a uuid: `deriveWorkerTurnId` yields a uuid-v5, but other
|
|
7452
7768
|
* emitters use composite forms (`${kind}:${idempotencyKey}`), so the
|
|
7453
7769
|
* wire type stays an opaque string.
|
|
7454
7770
|
*/
|
|
7455
|
-
turn_id:
|
|
7456
|
-
lifecycle_phase:
|
|
7457
|
-
lifecycle_transition_id:
|
|
7458
|
-
idle_since:
|
|
7459
|
-
grace_deadline:
|
|
7460
|
-
reason:
|
|
7461
|
-
terminate_deadline:
|
|
7462
|
-
}).strict();
|
|
7463
|
-
var WebhookSubscriptionStatusSchema =
|
|
7464
|
-
var CreateWebhookSubscriptionRequestSchema =
|
|
7465
|
-
projectId:
|
|
7771
|
+
turn_id: import_zod61.z.string().min(1).optional(),
|
|
7772
|
+
lifecycle_phase: import_zod61.z.enum(["idle", "terminating", "terminated"]).optional(),
|
|
7773
|
+
lifecycle_transition_id: import_zod61.z.string().uuid().optional(),
|
|
7774
|
+
idle_since: import_zod61.z.string().optional(),
|
|
7775
|
+
grace_deadline: import_zod61.z.string().optional(),
|
|
7776
|
+
reason: import_zod61.z.string().optional(),
|
|
7777
|
+
terminate_deadline: import_zod61.z.string().optional()
|
|
7778
|
+
}).strict();
|
|
7779
|
+
var WebhookSubscriptionStatusSchema = import_zod61.z.enum(["active", "disabled"]);
|
|
7780
|
+
var CreateWebhookSubscriptionRequestSchema = import_zod61.z.object({
|
|
7781
|
+
projectId: import_zod61.z.string().uuid(),
|
|
7466
7782
|
/** Subscriber endpoint. https required outside dev; SSRF-validated. */
|
|
7467
|
-
url:
|
|
7783
|
+
url: import_zod61.z.string().url().max(1024),
|
|
7468
7784
|
/** Event types to deliver. At least one. */
|
|
7469
|
-
events:
|
|
7785
|
+
events: import_zod61.z.array(WebhookEventTypeSchema).min(1).max(WEBHOOK_EVENT_TYPES.length),
|
|
7470
7786
|
/** Optional operator note shown in list responses. */
|
|
7471
|
-
description:
|
|
7787
|
+
description: import_zod61.z.string().max(512).optional()
|
|
7472
7788
|
}).strict();
|
|
7473
|
-
var UpdateWebhookSubscriptionRequestSchema =
|
|
7474
|
-
url:
|
|
7475
|
-
events:
|
|
7476
|
-
description:
|
|
7789
|
+
var UpdateWebhookSubscriptionRequestSchema = import_zod61.z.object({
|
|
7790
|
+
url: import_zod61.z.string().url().max(1024).optional(),
|
|
7791
|
+
events: import_zod61.z.array(WebhookEventTypeSchema).min(1).max(WEBHOOK_EVENT_TYPES.length).optional(),
|
|
7792
|
+
description: import_zod61.z.string().max(512).nullable().optional(),
|
|
7477
7793
|
/**
|
|
7478
7794
|
* `active` re-enables a subscription that was auto-disabled after
|
|
7479
7795
|
* consecutive failures (resets the failure counter); `disabled`
|
|
@@ -7484,23 +7800,23 @@ var UpdateWebhookSubscriptionRequestSchema = import_zod58.z.object({
|
|
|
7484
7800
|
(data) => data.url !== void 0 || data.events !== void 0 || data.description !== void 0 || data.status !== void 0,
|
|
7485
7801
|
{ message: "At least one of url / events / description / status MUST be provided" }
|
|
7486
7802
|
);
|
|
7487
|
-
var WebhookSubscriptionSchema =
|
|
7488
|
-
id:
|
|
7489
|
-
projectId:
|
|
7490
|
-
url:
|
|
7491
|
-
events:
|
|
7492
|
-
description:
|
|
7803
|
+
var WebhookSubscriptionSchema = import_zod61.z.object({
|
|
7804
|
+
id: import_zod61.z.string().uuid(),
|
|
7805
|
+
projectId: import_zod61.z.string().uuid(),
|
|
7806
|
+
url: import_zod61.z.string(),
|
|
7807
|
+
events: import_zod61.z.array(WebhookEventTypeSchema),
|
|
7808
|
+
description: import_zod61.z.string().nullable(),
|
|
7493
7809
|
status: WebhookSubscriptionStatusSchema,
|
|
7494
|
-
consecutiveFailures:
|
|
7495
|
-
createdBy:
|
|
7496
|
-
createdAt:
|
|
7497
|
-
updatedAt:
|
|
7810
|
+
consecutiveFailures: import_zod61.z.number().int().nonnegative(),
|
|
7811
|
+
createdBy: import_zod61.z.string(),
|
|
7812
|
+
createdAt: import_zod61.z.string(),
|
|
7813
|
+
updatedAt: import_zod61.z.string()
|
|
7498
7814
|
});
|
|
7499
|
-
var WebhookSubscriptionWithSecretSchema =
|
|
7815
|
+
var WebhookSubscriptionWithSecretSchema = import_zod61.z.object({
|
|
7500
7816
|
subscription: WebhookSubscriptionSchema,
|
|
7501
|
-
secret:
|
|
7817
|
+
secret: import_zod61.z.string()
|
|
7502
7818
|
});
|
|
7503
|
-
var WebhookSubscriptionErrorCodeSchema =
|
|
7819
|
+
var WebhookSubscriptionErrorCodeSchema = import_zod61.z.enum([
|
|
7504
7820
|
// 400
|
|
7505
7821
|
"VALIDATION_ERROR",
|
|
7506
7822
|
/** URL failed SSRF policy (non-https, private/loopback/link-local IP…). */
|
|
@@ -7513,117 +7829,125 @@ var WebhookSubscriptionErrorCodeSchema = import_zod58.z.enum([
|
|
|
7513
7829
|
// 500
|
|
7514
7830
|
"INTERNAL_ERROR"
|
|
7515
7831
|
]);
|
|
7516
|
-
var SessionPrewarmingIdentitySchema =
|
|
7517
|
-
projectIdGenerator:
|
|
7518
|
-
claimNameTemplate:
|
|
7519
|
-
idempotencyScopePrefix:
|
|
7520
|
-
}).strict();
|
|
7521
|
-
var SessionPrewarmingSessionTemplateSchema =
|
|
7522
|
-
configValues:
|
|
7523
|
-
metadata:
|
|
7524
|
-
}).strict();
|
|
7525
|
-
var BusinessReadyProbeSchema =
|
|
7526
|
-
endpointName:
|
|
7527
|
-
path:
|
|
7528
|
-
successCodes:
|
|
7529
|
-
timeoutMs:
|
|
7530
|
-
}).strict();
|
|
7531
|
-
var SessionPrewarmingSpecSchema =
|
|
7532
|
-
targetReadyCount:
|
|
7533
|
-
reVerifyIntervalSeconds:
|
|
7534
|
-
warmingTimeoutSeconds:
|
|
7535
|
-
claimingLeaseTtlSeconds:
|
|
7536
|
-
replenishIntervalSeconds:
|
|
7537
|
-
maxConcurrentWarming:
|
|
7832
|
+
var SessionPrewarmingIdentitySchema = import_zod62.z.object({
|
|
7833
|
+
projectIdGenerator: import_zod62.z.literal("nanoid"),
|
|
7834
|
+
claimNameTemplate: import_zod62.z.string().min(1),
|
|
7835
|
+
idempotencyScopePrefix: import_zod62.z.string().min(1)
|
|
7836
|
+
}).strict();
|
|
7837
|
+
var SessionPrewarmingSessionTemplateSchema = import_zod62.z.object({
|
|
7838
|
+
configValues: import_zod62.z.record(import_zod62.z.string(), import_zod62.z.string()),
|
|
7839
|
+
metadata: import_zod62.z.record(import_zod62.z.string(), import_zod62.z.unknown()).optional()
|
|
7840
|
+
}).strict();
|
|
7841
|
+
var BusinessReadyProbeSchema = import_zod62.z.object({
|
|
7842
|
+
endpointName: import_zod62.z.enum(["api", "preview"]),
|
|
7843
|
+
path: import_zod62.z.string().min(1),
|
|
7844
|
+
successCodes: import_zod62.z.array(import_zod62.z.number().int().min(100).max(599)).min(1),
|
|
7845
|
+
timeoutMs: import_zod62.z.number().int().min(500).max(3e4)
|
|
7846
|
+
}).strict();
|
|
7847
|
+
var SessionPrewarmingSpecSchema = import_zod62.z.object({
|
|
7848
|
+
targetReadyCount: import_zod62.z.number().int().min(1).max(50),
|
|
7849
|
+
reVerifyIntervalSeconds: import_zod62.z.number().int().min(60).max(3600),
|
|
7850
|
+
warmingTimeoutSeconds: import_zod62.z.number().int().min(60).max(600),
|
|
7851
|
+
claimingLeaseTtlSeconds: import_zod62.z.number().int().min(10).max(120),
|
|
7852
|
+
replenishIntervalSeconds: import_zod62.z.number().int().min(5).max(300),
|
|
7853
|
+
maxConcurrentWarming: import_zod62.z.number().int().min(1).max(10),
|
|
7538
7854
|
identity: SessionPrewarmingIdentitySchema,
|
|
7539
7855
|
sessionTemplate: SessionPrewarmingSessionTemplateSchema,
|
|
7540
7856
|
businessReadyProbe: BusinessReadyProbeSchema.optional()
|
|
7541
7857
|
}).strict();
|
|
7542
|
-
var AcquireSessionRequestSchema =
|
|
7543
|
-
workloadId:
|
|
7544
|
-
clientMutationId:
|
|
7545
|
-
}).strict();
|
|
7546
|
-
var AcquireSessionResponseSchema =
|
|
7547
|
-
leaseToken:
|
|
7548
|
-
leaseExpiresAt:
|
|
7549
|
-
sessionId:
|
|
7550
|
-
projectId:
|
|
7551
|
-
runtimeClaimName:
|
|
7552
|
-
configValues:
|
|
7858
|
+
var AcquireSessionRequestSchema = import_zod62.z.object({
|
|
7859
|
+
workloadId: import_zod62.z.string().uuid(),
|
|
7860
|
+
clientMutationId: import_zod62.z.string().min(1).max(255)
|
|
7861
|
+
}).strict();
|
|
7862
|
+
var AcquireSessionResponseSchema = import_zod62.z.object({
|
|
7863
|
+
leaseToken: import_zod62.z.string().min(1),
|
|
7864
|
+
leaseExpiresAt: import_zod62.z.string().datetime(),
|
|
7865
|
+
sessionId: import_zod62.z.string().uuid(),
|
|
7866
|
+
projectId: import_zod62.z.string().min(1),
|
|
7867
|
+
runtimeClaimName: import_zod62.z.string().min(1),
|
|
7868
|
+
configValues: import_zod62.z.record(import_zod62.z.string(), import_zod62.z.string()),
|
|
7553
7869
|
// Optional: outbox-protocol workloads (`managed_agent`) expose no public HTTP
|
|
7554
7870
|
// endpoint, so a ready slot is claimable with no `apiUrl`. self_managed
|
|
7555
7871
|
// (rush-app) slots always carry it. Omitted (not null) when absent — mirrors
|
|
7556
7872
|
// `previewUrl`. See `pilot-v2-managed-agent-prewarming.md` § Readiness and
|
|
7557
7873
|
// `SessionPoolService.buildAcquireResponse`.
|
|
7558
|
-
apiUrl:
|
|
7559
|
-
previewUrl:
|
|
7874
|
+
apiUrl: import_zod62.z.string().url().optional(),
|
|
7875
|
+
previewUrl: import_zod62.z.string().url().optional()
|
|
7560
7876
|
}).strict();
|
|
7561
|
-
var FinalizeAcquireRequestSchema =
|
|
7562
|
-
leaseToken:
|
|
7563
|
-
sessionId:
|
|
7564
|
-
clientMutationId:
|
|
7877
|
+
var FinalizeAcquireRequestSchema = import_zod62.z.object({
|
|
7878
|
+
leaseToken: import_zod62.z.string().min(1),
|
|
7879
|
+
sessionId: import_zod62.z.string().uuid(),
|
|
7880
|
+
clientMutationId: import_zod62.z.string().min(1).max(255).optional()
|
|
7565
7881
|
}).strict();
|
|
7566
|
-
var AbortAcquireRequestSchema =
|
|
7567
|
-
leaseToken:
|
|
7568
|
-
sessionId:
|
|
7882
|
+
var AbortAcquireRequestSchema = import_zod62.z.object({
|
|
7883
|
+
leaseToken: import_zod62.z.string().min(1),
|
|
7884
|
+
sessionId: import_zod62.z.string().uuid()
|
|
7569
7885
|
}).strict();
|
|
7570
|
-
var WorkloadLifecycleKindSchema =
|
|
7571
|
-
var WorkloadLifecycleConfigSchema =
|
|
7572
|
-
idleEnabled:
|
|
7573
|
-
idleAfterSeconds:
|
|
7574
|
-
idleGraceSeconds:
|
|
7575
|
-
maxSessionLifetimeMs:
|
|
7886
|
+
var WorkloadLifecycleKindSchema = import_zod63.z.enum(["managed_agent", "self_managed"]);
|
|
7887
|
+
var WorkloadLifecycleConfigSchema = import_zod63.z.object({
|
|
7888
|
+
idleEnabled: import_zod63.z.boolean().nullable(),
|
|
7889
|
+
idleAfterSeconds: import_zod63.z.number().int().min(300).max(86400).nullable(),
|
|
7890
|
+
idleGraceSeconds: import_zod63.z.number().int().min(60).max(3600).nullable(),
|
|
7891
|
+
maxSessionLifetimeMs: import_zod63.z.number().int().min(36e5).max(6048e5).nullable()
|
|
7576
7892
|
}).strict();
|
|
7577
7893
|
var WorkloadLifecycleConfigUpdateSchema = WorkloadLifecycleConfigSchema.partial().strict();
|
|
7578
|
-
var EffectiveWorkloadLifecycleConfigSchema =
|
|
7579
|
-
idleEnabled:
|
|
7580
|
-
idleAfterSeconds:
|
|
7581
|
-
idleGraceSeconds:
|
|
7582
|
-
maxSessionLifetimeMs:
|
|
7583
|
-
}).strict();
|
|
7584
|
-
var WorkloadLifecycleConfigResponseSchema =
|
|
7585
|
-
workloadId:
|
|
7894
|
+
var EffectiveWorkloadLifecycleConfigSchema = import_zod63.z.object({
|
|
7895
|
+
idleEnabled: import_zod63.z.boolean(),
|
|
7896
|
+
idleAfterSeconds: import_zod63.z.number().int().min(300).max(86400),
|
|
7897
|
+
idleGraceSeconds: import_zod63.z.number().int().min(60).max(3600),
|
|
7898
|
+
maxSessionLifetimeMs: import_zod63.z.number().int().min(36e5).max(6048e5)
|
|
7899
|
+
}).strict();
|
|
7900
|
+
var WorkloadLifecycleConfigResponseSchema = import_zod63.z.object({
|
|
7901
|
+
workloadId: import_zod63.z.string().uuid(),
|
|
7586
7902
|
kind: WorkloadLifecycleKindSchema,
|
|
7587
7903
|
config: WorkloadLifecycleConfigSchema,
|
|
7588
7904
|
effective: EffectiveWorkloadLifecycleConfigSchema
|
|
7589
7905
|
}).strict();
|
|
7590
|
-
var OtelJobContextSchema =
|
|
7906
|
+
var OtelJobContextSchema = import_zod64.z.object({
|
|
7591
7907
|
/** W3C Trace Context `traceparent` header value. */
|
|
7592
|
-
traceparent:
|
|
7908
|
+
traceparent: import_zod64.z.string().optional(),
|
|
7593
7909
|
/** W3C Trace Context `tracestate` header value. */
|
|
7594
|
-
tracestate:
|
|
7910
|
+
tracestate: import_zod64.z.string().optional(),
|
|
7595
7911
|
/** W3C Baggage header value. */
|
|
7596
|
-
baggage:
|
|
7912
|
+
baggage: import_zod64.z.string().optional()
|
|
7597
7913
|
}).passthrough();
|
|
7598
|
-
var LifecycleStageNameSchema =
|
|
7599
|
-
var SlotCanarySummarySchema =
|
|
7914
|
+
var LifecycleStageNameSchema = import_zod65.z.enum(["test", "production"]);
|
|
7915
|
+
var SlotCanarySummarySchema = import_zod65.z.object({
|
|
7600
7916
|
/** canary 臂 revision id。 */
|
|
7601
|
-
revisionId:
|
|
7917
|
+
revisionId: import_zod65.z.string(),
|
|
7602
7918
|
/** canary revision 的人可读版本短名;revision 行缺失时 null(降级显示 id 前缀)。 */
|
|
7603
|
-
revisionLabel:
|
|
7919
|
+
revisionLabel: import_zod65.z.string().nullable(),
|
|
7604
7920
|
/** 0..99;0 = 冻结观察态(仅名单命中仍入 canary)。 */
|
|
7605
|
-
percentage:
|
|
7921
|
+
percentage: import_zod65.z.number().int(),
|
|
7606
7922
|
/** ldap 名单人数(徽章"名单 N 人";0 = 无名单)。 */
|
|
7607
|
-
userAllowlistCount:
|
|
7923
|
+
userAllowlistCount: import_zod65.z.number().int(),
|
|
7608
7924
|
/** 本轮灰度开始时间(ISO);存量行无记录时 null。 */
|
|
7609
|
-
startedAt:
|
|
7925
|
+
startedAt: import_zod65.z.string().nullable()
|
|
7610
7926
|
});
|
|
7611
|
-
var SlotSummarySchema =
|
|
7612
|
-
revisionId:
|
|
7927
|
+
var SlotSummarySchema = import_zod65.z.object({
|
|
7928
|
+
revisionId: import_zod65.z.string().nullable(),
|
|
7613
7929
|
/** 人可读的版本标识(revision name/number);无部署时 null。 */
|
|
7614
|
-
revisionLabel:
|
|
7615
|
-
environmentId:
|
|
7616
|
-
environmentName:
|
|
7617
|
-
environmentVersion:
|
|
7930
|
+
revisionLabel: import_zod65.z.string().nullable(),
|
|
7931
|
+
environmentId: import_zod65.z.string().nullable(),
|
|
7932
|
+
environmentName: import_zod65.z.string().nullable(),
|
|
7933
|
+
environmentVersion: import_zod65.z.number().int().nullable(),
|
|
7934
|
+
/**
|
|
7935
|
+
* 槽位所指 revision 自带的运行环境(`revisions.runtime_template_id` 及其名字)。
|
|
7936
|
+
* 槽位 `environmentId` 为 NULL(存量未绑定行)时会话实际跑的就是它——读侧用
|
|
7937
|
+
* 它兜底显示,不再渲染「内置于版本」伪状态(ENV-R1a)。发布板读模型必带;
|
|
7938
|
+
* 工作台等其它 SlotSummary 生产方可省略(省略 = 未报告)。
|
|
7939
|
+
*/
|
|
7940
|
+
revisionEnvironmentId: import_zod65.z.string().nullable().optional(),
|
|
7941
|
+
revisionEnvironmentName: import_zod65.z.string().nullable().optional(),
|
|
7618
7942
|
/** 槽位最近一次变更时间(ISO);数据缺口约定:仅当前指针,无历史流水。 */
|
|
7619
|
-
updatedAt:
|
|
7943
|
+
updatedAt: import_zod65.z.string().nullable(),
|
|
7620
7944
|
/**
|
|
7621
7945
|
* 活跃灰度摘要(#1214)。目前仅发布板读模型的槽位显式带出(null = 无灰度);
|
|
7622
7946
|
* 工作台等其它 SlotSummary 生产方不带(optional,省略 = 未报告)。
|
|
7623
7947
|
*/
|
|
7624
7948
|
canary: SlotCanarySummarySchema.nullable().optional()
|
|
7625
7949
|
});
|
|
7626
|
-
var WorkbenchStageDriftKindSchema =
|
|
7950
|
+
var WorkbenchStageDriftKindSchema = import_zod65.z.enum([
|
|
7627
7951
|
/** test 指向新于 production(待晋级)。 */
|
|
7628
7952
|
"test_ahead",
|
|
7629
7953
|
/** 只有 test 有部署(从未上过 production)。 */
|
|
@@ -7646,27 +7970,27 @@ var WorkbenchStageDriftKindSchema = import_zod62.z.enum([
|
|
|
7646
7970
|
*/
|
|
7647
7971
|
"diverged"
|
|
7648
7972
|
]);
|
|
7649
|
-
var WorkbenchStageDriftItemSchema =
|
|
7650
|
-
workloadId:
|
|
7651
|
-
workloadName:
|
|
7652
|
-
workloadSlug:
|
|
7973
|
+
var WorkbenchStageDriftItemSchema = import_zod65.z.object({
|
|
7974
|
+
workloadId: import_zod65.z.string(),
|
|
7975
|
+
workloadName: import_zod65.z.string(),
|
|
7976
|
+
workloadSlug: import_zod65.z.string().nullable(),
|
|
7653
7977
|
kind: WorkbenchStageDriftKindSchema,
|
|
7654
7978
|
test: SlotSummarySchema.nullable(),
|
|
7655
7979
|
production: SlotSummarySchema.nullable(),
|
|
7656
7980
|
/** 差异开始的近似时间 = 领先侧槽位的 updatedAt(ISO)。 */
|
|
7657
|
-
since:
|
|
7981
|
+
since: import_zod65.z.string().nullable()
|
|
7658
7982
|
});
|
|
7659
|
-
var WorkbenchRecentChangeKindSchema =
|
|
7983
|
+
var WorkbenchRecentChangeKindSchema = import_zod65.z.enum([
|
|
7660
7984
|
"stage_updated",
|
|
7661
7985
|
"revision_published",
|
|
7662
7986
|
"environment_version_created"
|
|
7663
7987
|
]);
|
|
7664
|
-
var WorkbenchRecentChangeSchema =
|
|
7988
|
+
var WorkbenchRecentChangeSchema = import_zod65.z.object({
|
|
7665
7989
|
kind: WorkbenchRecentChangeKindSchema,
|
|
7666
7990
|
/** 变更主体的可读标题(如 workload 名 / 环境名)。 */
|
|
7667
|
-
subject:
|
|
7991
|
+
subject: import_zod65.z.string(),
|
|
7668
7992
|
/** 主体 id(workloadId / environmentId),用于前端拼详情链接。 */
|
|
7669
|
-
subjectId:
|
|
7993
|
+
subjectId: import_zod65.z.string(),
|
|
7670
7994
|
/**
|
|
7671
7995
|
* workload 类变更(stage_updated / revision_published)的 slug——详情路由
|
|
7672
7996
|
* UUID / slug 双形态均可达,前端优先用可读的 slug 拼链接,缺失时回退
|
|
@@ -7677,26 +8001,26 @@ var WorkbenchRecentChangeSchema = import_zod62.z.object({
|
|
|
7677
8001
|
* agenthub-sdk 对 WorkbenchDTO 的硬 parse)在滚动发版遇到旧产出时
|
|
7678
8002
|
* 降级为无 slug,而不是整个 DTO 校验失败。
|
|
7679
8003
|
*/
|
|
7680
|
-
subjectSlug:
|
|
8004
|
+
subjectSlug: import_zod65.z.string().nullable().optional(),
|
|
7681
8005
|
/** 一句话变更描述(如 "production → rev-12" / "环境 v3 创建")。 */
|
|
7682
|
-
detail:
|
|
7683
|
-
occurredAt:
|
|
8006
|
+
detail: import_zod65.z.string(),
|
|
8007
|
+
occurredAt: import_zod65.z.string()
|
|
7684
8008
|
});
|
|
7685
|
-
var WorkbenchSessionStatsSchema =
|
|
7686
|
-
running:
|
|
7687
|
-
failed24h:
|
|
7688
|
-
total24h:
|
|
8009
|
+
var WorkbenchSessionStatsSchema = import_zod65.z.object({
|
|
8010
|
+
running: import_zod65.z.number().int(),
|
|
8011
|
+
failed24h: import_zod65.z.number().int(),
|
|
8012
|
+
total24h: import_zod65.z.number().int()
|
|
7689
8013
|
});
|
|
7690
|
-
var WorkbenchDTOSchema =
|
|
7691
|
-
workloadCount:
|
|
8014
|
+
var WorkbenchDTOSchema = import_zod65.z.object({
|
|
8015
|
+
workloadCount: import_zod65.z.number().int(),
|
|
7692
8016
|
sessionStats: WorkbenchSessionStatsSchema,
|
|
7693
|
-
stageDrift:
|
|
7694
|
-
recentChanges:
|
|
8017
|
+
stageDrift: import_zod65.z.array(WorkbenchStageDriftItemSchema),
|
|
8018
|
+
recentChanges: import_zod65.z.array(WorkbenchRecentChangeSchema)
|
|
7695
8019
|
});
|
|
7696
|
-
var ReleaseBoardRowSchema =
|
|
7697
|
-
workloadId:
|
|
7698
|
-
workloadName:
|
|
7699
|
-
workloadSlug:
|
|
8020
|
+
var ReleaseBoardRowSchema = import_zod65.z.object({
|
|
8021
|
+
workloadId: import_zod65.z.string(),
|
|
8022
|
+
workloadName: import_zod65.z.string(),
|
|
8023
|
+
workloadSlug: import_zod65.z.string().nullable(),
|
|
7700
8024
|
/**
|
|
7701
8025
|
* @deprecated Workload 当前默认指针(`default_revision_id`,production 部署
|
|
7702
8026
|
* 从写)。指针收敛(2026-08-02)后发布 UI 不再移动它,本字段随删列窗口结束
|
|
@@ -7705,7 +8029,7 @@ var ReleaseBoardRowSchema = import_zod62.z.object({
|
|
|
7705
8029
|
* 新消费方一律读 `latestRevision`(前端回退链 latestRevision ?? defaultRevision
|
|
7706
8030
|
* 只为兼容旧服务端缺字段,不表示两者同义)。
|
|
7707
8031
|
*/
|
|
7708
|
-
defaultRevision:
|
|
8032
|
+
defaultRevision: import_zod65.z.object({ id: import_zod65.z.string(), version: import_zod65.z.string(), createdAt: import_zod65.z.string() }).nullable(),
|
|
7709
8033
|
/**
|
|
7710
8034
|
* Workload 最近发布的 Revision(createdAt 最新;并列时 id 大者,保证确定性)。
|
|
7711
8035
|
* 发布板用它判断"有新版本尚未部署到 test"(latestRevision.id ≠
|
|
@@ -7718,12 +8042,12 @@ var ReleaseBoardRowSchema = import_zod62.z.object({
|
|
|
7718
8042
|
* pendingRevision)一直想要的一致。**optional**:旧服务端的响应没有此字段,
|
|
7719
8043
|
* 新 client 解析须容忍(双向滚动窗口兼容),缺席时回退读 defaultRevision。
|
|
7720
8044
|
*/
|
|
7721
|
-
latestRevision:
|
|
7722
|
-
id:
|
|
7723
|
-
version:
|
|
7724
|
-
createdAt:
|
|
8045
|
+
latestRevision: import_zod65.z.object({
|
|
8046
|
+
id: import_zod65.z.string(),
|
|
8047
|
+
version: import_zod65.z.string(),
|
|
8048
|
+
createdAt: import_zod65.z.string(),
|
|
7725
8049
|
/** 真实发布时间;optional 仅用于新旧服务端滚动窗口兼容。 */
|
|
7726
|
-
publishedAt:
|
|
8050
|
+
publishedAt: import_zod65.z.string().optional()
|
|
7727
8051
|
}).nullable().optional(),
|
|
7728
8052
|
/**
|
|
7729
8053
|
* 用户当前有理由继续使用的 Revision(latestRevision、test、production)中,
|
|
@@ -7731,30 +8055,35 @@ var ReleaseBoardRowSchema = import_zod62.z.object({
|
|
|
7731
8055
|
* latestRevision;具体复制哪份配置由升级弹窗显式选择。optional 仅用于
|
|
7732
8056
|
* 新旧服务端滚动窗口兼容。
|
|
7733
8057
|
*/
|
|
7734
|
-
runtimeUpgradeAvailable:
|
|
8058
|
+
runtimeUpgradeAvailable: import_zod65.z.boolean().optional(),
|
|
7735
8059
|
test: SlotSummarySchema.nullable(),
|
|
7736
8060
|
production: SlotSummarySchema.nullable(),
|
|
7737
|
-
/**
|
|
7738
|
-
|
|
8061
|
+
/**
|
|
8062
|
+
* test 与 production 指向不同 revision,或**有效环境**不同
|
|
8063
|
+
* (`environmentId ?? revisionEnvironmentId`,ENV-R1a);环境版本号只在两侧
|
|
8064
|
+
* 都显式绑定时参与比较——任一侧是兜底态(槽位未绑、跑版本自带环境)时
|
|
8065
|
+
* 没有可比的版本钉。发布板展开面板的环境行高亮与本字段同口径。
|
|
8066
|
+
*/
|
|
8067
|
+
drift: import_zod65.z.boolean(),
|
|
7739
8068
|
/** 两槽位 updatedAt 的较新者(ISO);均空则 null。 */
|
|
7740
|
-
lastChangedAt:
|
|
7741
|
-
});
|
|
7742
|
-
var ReleaseBoardDTOSchema =
|
|
7743
|
-
rows:
|
|
7744
|
-
});
|
|
7745
|
-
var SessionDiagnosisSessionSchema =
|
|
7746
|
-
id:
|
|
7747
|
-
workloadId:
|
|
7748
|
-
workloadName:
|
|
7749
|
-
workloadSlug:
|
|
7750
|
-
status:
|
|
7751
|
-
lifecyclePhase:
|
|
7752
|
-
model:
|
|
7753
|
-
createdAt:
|
|
7754
|
-
readyAt:
|
|
7755
|
-
endedAt:
|
|
8069
|
+
lastChangedAt: import_zod65.z.string().nullable()
|
|
8070
|
+
});
|
|
8071
|
+
var ReleaseBoardDTOSchema = import_zod65.z.object({
|
|
8072
|
+
rows: import_zod65.z.array(ReleaseBoardRowSchema)
|
|
8073
|
+
});
|
|
8074
|
+
var SessionDiagnosisSessionSchema = import_zod65.z.object({
|
|
8075
|
+
id: import_zod65.z.string(),
|
|
8076
|
+
workloadId: import_zod65.z.string().nullable(),
|
|
8077
|
+
workloadName: import_zod65.z.string().nullable(),
|
|
8078
|
+
workloadSlug: import_zod65.z.string().nullable(),
|
|
8079
|
+
status: import_zod65.z.string(),
|
|
8080
|
+
lifecyclePhase: import_zod65.z.string().nullable(),
|
|
8081
|
+
model: import_zod65.z.string().nullable(),
|
|
8082
|
+
createdAt: import_zod65.z.string(),
|
|
8083
|
+
readyAt: import_zod65.z.string().nullable(),
|
|
8084
|
+
endedAt: import_zod65.z.string().nullable(),
|
|
7756
8085
|
/** 会话创建链路 trace(Octopus 深链"启动 Trace"数据源)。 */
|
|
7757
|
-
rootTraceId:
|
|
8086
|
+
rootTraceId: import_zod65.z.string().nullable(),
|
|
7758
8087
|
/**
|
|
7759
8088
|
* 该会话能不能点进对话面(`/p/<pid>/s/<sid>`)。**由服务端算好下发,前端不要
|
|
7760
8089
|
* 自己按 `usageKind` 重推** —— `usage_kind` 是会话创建时写死的名字、认领后
|
|
@@ -7762,37 +8091,37 @@ var SessionDiagnosisSessionSchema = import_zod62.z.object({
|
|
|
7762
8091
|
* `packages/control-plane/src/session-lifecycle/session-chat-entry.ts`,
|
|
7763
8092
|
* 排障列表的 `chatHref` 走的是同一个函数。
|
|
7764
8093
|
*/
|
|
7765
|
-
canOpenChat:
|
|
8094
|
+
canOpenChat: import_zod65.z.boolean()
|
|
7766
8095
|
});
|
|
7767
|
-
var SessionDiagnosisFailureSchema =
|
|
7768
|
-
kind:
|
|
7769
|
-
message:
|
|
7770
|
-
occurredAt:
|
|
8096
|
+
var SessionDiagnosisFailureSchema = import_zod65.z.object({
|
|
8097
|
+
kind: import_zod65.z.string().nullable(),
|
|
8098
|
+
message: import_zod65.z.string().nullable(),
|
|
8099
|
+
occurredAt: import_zod65.z.string().nullable()
|
|
7771
8100
|
});
|
|
7772
|
-
var SessionDiagnosisEventSchema =
|
|
7773
|
-
id:
|
|
7774
|
-
type:
|
|
8101
|
+
var SessionDiagnosisEventSchema = import_zod65.z.object({
|
|
8102
|
+
id: import_zod65.z.string(),
|
|
8103
|
+
type: import_zod65.z.string(),
|
|
7775
8104
|
/** 该轮 dispatch trace(每条用户消息的 Octopus 深链数据源);非 dispatch 事件为 null。 */
|
|
7776
|
-
traceId:
|
|
7777
|
-
summary:
|
|
7778
|
-
occurredAt:
|
|
8105
|
+
traceId: import_zod65.z.string().nullable(),
|
|
8106
|
+
summary: import_zod65.z.string().nullable(),
|
|
8107
|
+
occurredAt: import_zod65.z.string()
|
|
7779
8108
|
});
|
|
7780
|
-
var SessionDiagnosisSandboxSchema =
|
|
7781
|
-
id:
|
|
7782
|
-
status:
|
|
7783
|
-
expiresAt:
|
|
7784
|
-
createdAt:
|
|
8109
|
+
var SessionDiagnosisSandboxSchema = import_zod65.z.object({
|
|
8110
|
+
id: import_zod65.z.string(),
|
|
8111
|
+
status: import_zod65.z.string(),
|
|
8112
|
+
expiresAt: import_zod65.z.string().nullable(),
|
|
8113
|
+
createdAt: import_zod65.z.string().nullable()
|
|
7785
8114
|
});
|
|
7786
|
-
var SessionDiagnosisDTOSchema =
|
|
8115
|
+
var SessionDiagnosisDTOSchema = import_zod65.z.object({
|
|
7787
8116
|
session: SessionDiagnosisSessionSchema,
|
|
7788
8117
|
failure: SessionDiagnosisFailureSchema.nullable(),
|
|
7789
|
-
events:
|
|
8118
|
+
events: import_zod65.z.array(SessionDiagnosisEventSchema).nullable(),
|
|
7790
8119
|
sandbox: SessionDiagnosisSandboxSchema.nullable(),
|
|
7791
8120
|
// zod v4 infers `z.record(enum, string)` as a FULL `Record` (all keys
|
|
7792
8121
|
// present) instead of v3's `Partial` — but only failing blocks appear here.
|
|
7793
8122
|
// Explicit partial object keeps the v3 inference; runtime behavior matches
|
|
7794
8123
|
// the record form (any key subset accepted, extras rejected).
|
|
7795
|
-
blockErrors:
|
|
8124
|
+
blockErrors: import_zod65.z.object({ failure: import_zod65.z.string(), events: import_zod65.z.string(), sandbox: import_zod65.z.string() }).partial().optional()
|
|
7796
8125
|
});
|
|
7797
8126
|
var PIPELINE_TRIGGERS = ["push", "merge", "manual", "env_change", "rebake"];
|
|
7798
8127
|
var PIPELINE_RUN_STATUSES = [
|
|
@@ -7834,12 +8163,12 @@ var PIPELINE_FULL_FACE_TRIGGERS = Object.keys(PIPELINE_TRIGGER_STAGES).filter((t
|
|
|
7834
8163
|
return set.length === PIPELINE_STEPS.length && PIPELINE_STEPS.every((s) => set.includes(s));
|
|
7835
8164
|
});
|
|
7836
8165
|
var IMAGE_FINGERPRINT_RE = /^fp_[0-9a-f]{64}$/;
|
|
7837
|
-
var BakeInputsSchema =
|
|
7838
|
-
v:
|
|
7839
|
-
fingerprint:
|
|
7840
|
-
baseImage:
|
|
8166
|
+
var BakeInputsSchema = import_zod66.z.object({
|
|
8167
|
+
v: import_zod66.z.literal(1),
|
|
8168
|
+
fingerprint: import_zod66.z.string().regex(IMAGE_FINGERPRINT_RE),
|
|
8169
|
+
baseImage: import_zod66.z.string().min(1),
|
|
7841
8170
|
packages: EnvironmentPackagesSchema.nullable(),
|
|
7842
|
-
generatorVersion:
|
|
8171
|
+
generatorVersion: import_zod66.z.number().int().positive()
|
|
7843
8172
|
}).strict();
|
|
7844
8173
|
var BAKE_IMAGE_BUILD_TIMEOUT_MS = 45 * 60 * 1e3;
|
|
7845
8174
|
var BAKE_MATERIALIZE_WAIT_MS = 30 * 60 * 1e3;
|
|
@@ -7857,7 +8186,7 @@ var FILE_AGENT_REFERENCE_NAME_MAX_LENGTH = 200;
|
|
|
7857
8186
|
var FILE_AGENT_REFERENCE_LIST_MAX_LENGTH = 100;
|
|
7858
8187
|
var FILE_AGENT_PACKAGE_FILE_CHAR_WHITELIST = /^[A-Za-z0-9._/-]+$/;
|
|
7859
8188
|
function packageFilePathSchema(fieldName) {
|
|
7860
|
-
return
|
|
8189
|
+
return import_zod67.z.string().min(1).max(FILE_AGENT_PACKAGE_FILE_PATH_MAX_LENGTH).refine((value) => FILE_AGENT_PACKAGE_FILE_CHAR_WHITELIST.test(value), {
|
|
7861
8190
|
message: `${fieldName} may only contain [A-Za-z0-9._/-]`
|
|
7862
8191
|
}).refine((value) => !value.startsWith("/"), {
|
|
7863
8192
|
message: `${fieldName} must be a relative path`
|
|
@@ -7873,11 +8202,11 @@ function packageFilePathSchema(fieldName) {
|
|
|
7873
8202
|
var FileAgentSystemPromptFileSchema = packageFilePathSchema("systemPromptFile");
|
|
7874
8203
|
var FileAgentSetupScriptFileSchema = packageFilePathSchema("setupScriptFile");
|
|
7875
8204
|
var FILE_AGENT_RUSH_NAME_WHITELIST = /^(@[A-Za-z0-9][A-Za-z0-9._-]*\/)?[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
7876
|
-
var FileAgentReferenceNameSchema =
|
|
8205
|
+
var FileAgentReferenceNameSchema = import_zod67.z.string().min(1).max(FILE_AGENT_REFERENCE_NAME_MAX_LENGTH).refine((value) => FILE_AGENT_RUSH_NAME_WHITELIST.test(value), {
|
|
7877
8206
|
message: "rush registry name must match (@scope/)?name using only [A-Za-z0-9._-] (no spaces or invisible characters)"
|
|
7878
8207
|
});
|
|
7879
8208
|
function platformEntityNameSchema(fieldName) {
|
|
7880
|
-
return
|
|
8209
|
+
return import_zod67.z.string().min(1).max(FILE_AGENT_REFERENCE_NAME_MAX_LENGTH).refine((value) => value.trim() === value, {
|
|
7881
8210
|
message: `${fieldName} name must not have leading or trailing whitespace`
|
|
7882
8211
|
}).refine((value) => !/[\p{Cc}\p{Cf}]/u.test(value), {
|
|
7883
8212
|
message: `${fieldName} name must not contain control or invisible format characters`
|
|
@@ -7885,29 +8214,30 @@ function platformEntityNameSchema(fieldName) {
|
|
|
7885
8214
|
}
|
|
7886
8215
|
var FileAgentEnvironmentNameSchema = platformEntityNameSchema("environment");
|
|
7887
8216
|
var FileAgentModelServiceNameSchema = platformEntityNameSchema("modelService");
|
|
7888
|
-
var FileAgentMcpServerEntrySchema =
|
|
8217
|
+
var FileAgentMcpServerEntrySchema = import_zod67.z.union([
|
|
7889
8218
|
ManagedMcpIdSchema,
|
|
7890
|
-
|
|
8219
|
+
import_zod67.z.object({
|
|
7891
8220
|
id: ManagedMcpIdSchema,
|
|
7892
|
-
disabled:
|
|
8221
|
+
disabled: import_zod67.z.boolean().optional()
|
|
7893
8222
|
}).strict()
|
|
7894
8223
|
]);
|
|
7895
8224
|
function mcpEntryId(entry) {
|
|
7896
8225
|
return typeof entry === "string" ? entry : entry.id;
|
|
7897
8226
|
}
|
|
7898
|
-
var FileAgentMcpServerListSchema =
|
|
8227
|
+
var FileAgentMcpServerListSchema = import_zod67.z.array(FileAgentMcpServerEntrySchema).max(FILE_AGENT_REFERENCE_LIST_MAX_LENGTH).refine(
|
|
7899
8228
|
(list) => {
|
|
7900
8229
|
const ids = list.map(mcpEntryId);
|
|
7901
8230
|
return new Set(ids).size === ids.length;
|
|
7902
8231
|
},
|
|
7903
8232
|
{ message: "must not contain duplicate mcpServers entries (compared by id)" }
|
|
7904
8233
|
);
|
|
7905
|
-
var FileAgentClaudeCodeSectionSchema =
|
|
8234
|
+
var FileAgentClaudeCodeSectionSchema = import_zod67.z.object({
|
|
7906
8235
|
entryCommand: ClaudeCodeAgentPackageEntryCommandSchema.optional()
|
|
7907
8236
|
}).strict();
|
|
7908
|
-
var
|
|
7909
|
-
|
|
7910
|
-
|
|
8237
|
+
var FileAgentMemorySchema = WorkloadManifestMemorySchema.pick({ enabled: true }).strict();
|
|
8238
|
+
var FileAgentClaudeCodeDefinitionSchema = import_zod67.z.object({
|
|
8239
|
+
apiVersion: import_zod67.z.literal(FILE_AGENT_API_VERSION),
|
|
8240
|
+
format: import_zod67.z.literal("claude_code"),
|
|
7911
8241
|
model: WorkloadManifestModelSchema.optional(),
|
|
7912
8242
|
/**
|
|
7913
8243
|
* **待退场旧入口**(owner 2026-08-11 拍板,见
|
|
@@ -7971,25 +8301,40 @@ var FileAgentClaudeCodeDefinitionSchema = import_zod64.z.object({
|
|
|
7971
8301
|
* 沿用既有 `assertLlmProviderModelExclusive` 在解析层触发。
|
|
7972
8302
|
*/
|
|
7973
8303
|
modelService: FileAgentModelServiceNameSchema.optional(),
|
|
8304
|
+
/**
|
|
8305
|
+
* per-agent 记忆闸(#1873)。**缺省 = 开**:不写这一段与写 `enabled: true`
|
|
8306
|
+
* 在运行时等价,区别只在快照里有没有这个键(缺省不投影,见转换器)。
|
|
8307
|
+
*
|
|
8308
|
+
* `enabled: false` 关掉的是这个 Agent 的**全部**记忆面(spec §10 第三层与门):
|
|
8309
|
+
* 召回不带入任何记忆——`memory/` 里的记忆文档与运行时条目**一起**不进 prompt;
|
|
8310
|
+
* `memory_search` 工具查到空;写入面(抽取 / 直写 / 转达晋升)一律回
|
|
8311
|
+
* `agent_disabled`;对话内容不被记录,声明的业务主体也不写。
|
|
8312
|
+
*
|
|
8313
|
+
* 记忆文档的**物化**不受此声明 gating(它是构建产物,照常打进包里),关的是
|
|
8314
|
+
* "带不带进上下文"。
|
|
8315
|
+
*
|
|
8316
|
+
* 与总闸 `v2_managed_memory_enabled` 是 AND 关系:这里写 `true` 打不开总闸。
|
|
8317
|
+
*/
|
|
8318
|
+
memory: FileAgentMemorySchema.optional(),
|
|
7974
8319
|
claudeCode: FileAgentClaudeCodeSectionSchema.optional()
|
|
7975
8320
|
}).strict();
|
|
7976
|
-
var FileAgentDefinitionSchema =
|
|
8321
|
+
var FileAgentDefinitionSchema = import_zod67.z.discriminatedUnion("format", [FileAgentClaudeCodeDefinitionSchema]).superRefine((definition, ctx) => {
|
|
7977
8322
|
if (definition.systemPrompt !== void 0 && definition.systemPromptFile !== void 0) {
|
|
7978
8323
|
ctx.addIssue({
|
|
7979
|
-
code:
|
|
8324
|
+
code: import_zod67.z.ZodIssueCode.custom,
|
|
7980
8325
|
path: ["systemPromptFile"],
|
|
7981
8326
|
message: "systemPrompt and systemPromptFile are mutually exclusive (D18)"
|
|
7982
8327
|
});
|
|
7983
8328
|
}
|
|
7984
8329
|
if (definition.setupScript !== void 0 && definition.setupScriptFile !== void 0) {
|
|
7985
8330
|
ctx.addIssue({
|
|
7986
|
-
code:
|
|
8331
|
+
code: import_zod67.z.ZodIssueCode.custom,
|
|
7987
8332
|
path: ["setupScriptFile"],
|
|
7988
8333
|
message: "setupScript and setupScriptFile are mutually exclusive (D21)"
|
|
7989
8334
|
});
|
|
7990
8335
|
}
|
|
7991
8336
|
});
|
|
7992
|
-
var FileAgentErrorCodeSchema =
|
|
8337
|
+
var FileAgentErrorCodeSchema = import_zod67.z.enum([
|
|
7993
8338
|
/** agent.yaml failed schema validation (unknown/reserved key, apiVersion boundary, field shape). */
|
|
7994
8339
|
"FILE_AGENT_INVALID",
|
|
7995
8340
|
/**
|
|
@@ -8007,6 +8352,16 @@ var FileAgentErrorCodeSchema = import_zod64.z.enum([
|
|
|
8007
8352
|
* operator sees WHICH declaration is broken without parsing the message.
|
|
8008
8353
|
*/
|
|
8009
8354
|
"FILE_AGENT_SETUP_SCRIPT_FILE_UNRESOLVED",
|
|
8355
|
+
/**
|
|
8356
|
+
* A definition doc (`CLAUDE.md`/`AGENTS.md`, see
|
|
8357
|
+
* {@link verdictForFileAgentDefinitionDocCandidate}) resolved to content
|
|
8358
|
+
* over {@link WORKLOAD_MANIFEST_SYSTEM_PROMPT_MAX_LENGTH} characters — but
|
|
8359
|
+
* ONLY for the FIRST doc in `FILE_AGENT_DEFINITION_DOCS` order (the
|
|
8360
|
+
* author's primary declared prompt). An oversize FALLBACK doc is treated
|
|
8361
|
+
* as absent instead (see that function's jsdoc), so this code is never
|
|
8362
|
+
* raised for `AGENTS.md` while `CLAUDE.md` is present.
|
|
8363
|
+
*/
|
|
8364
|
+
"FILE_AGENT_DEFINITION_DOC_OVERSIZE",
|
|
8010
8365
|
/**
|
|
8011
8366
|
* `modelService` is declared but the caller supplied no resolved
|
|
8012
8367
|
* `llmProviderRef` id (or supplied one without a declaration). The converter
|
|
@@ -8025,7 +8380,7 @@ var FileAgentErrorCodeSchema = import_zod64.z.enum([
|
|
|
8025
8380
|
/** Converted output failed `RevisionManifestSchema` — a pipeline-context input is invalid (e.g. a non-endorsed package URL). */
|
|
8026
8381
|
"FILE_AGENT_REVISION_INVALID"
|
|
8027
8382
|
]);
|
|
8028
|
-
var BindProjectRepoRequestSchema =
|
|
8383
|
+
var BindProjectRepoRequestSchema = import_zod68.z.object({
|
|
8029
8384
|
/**
|
|
8030
8385
|
* Project uuid — the ONLY form accepted (#1635). Slugs used to be
|
|
8031
8386
|
* resolved here (exact `slug` column, then derived-from-`name` fallback
|
|
@@ -8034,8 +8389,8 @@ var BindProjectRepoRequestSchema = import_zod65.z.object({
|
|
|
8034
8389
|
* scan was a full-table fallback with no ordering. Identity is uuid-only;
|
|
8035
8390
|
* slugs are display-only and never resolve.
|
|
8036
8391
|
*/
|
|
8037
|
-
project:
|
|
8038
|
-
repoUrl:
|
|
8392
|
+
project: import_zod68.z.string().uuid(),
|
|
8393
|
+
repoUrl: import_zod68.z.string().min(1).max(1024),
|
|
8039
8394
|
/**
|
|
8040
8395
|
* Repoint a project that already names a DIFFERENT repo.
|
|
8041
8396
|
*
|
|
@@ -8044,53 +8399,53 @@ var BindProjectRepoRequestSchema = import_zod65.z.object({
|
|
|
8044
8399
|
* next release publish agent definitions from another repository, under
|
|
8045
8400
|
* the same project, with no visible signal.
|
|
8046
8401
|
*/
|
|
8047
|
-
allowRebind:
|
|
8402
|
+
allowRebind: import_zod68.z.boolean().optional()
|
|
8048
8403
|
}).strict();
|
|
8049
|
-
var BindProjectRepoResponseSchema =
|
|
8050
|
-
|
|
8404
|
+
var BindProjectRepoResponseSchema = import_zod68.z.discriminatedUnion("outcome", [
|
|
8405
|
+
import_zod68.z.object({ outcome: import_zod68.z.literal("bound"), projectId: import_zod68.z.string().uuid(), repoUrl: import_zod68.z.string() }).strict(),
|
|
8051
8406
|
/** Idempotent re-run: already bound to this repo, nothing written. */
|
|
8052
|
-
|
|
8407
|
+
import_zod68.z.object({ outcome: import_zod68.z.literal("unchanged"), projectId: import_zod68.z.string().uuid(), repoUrl: import_zod68.z.string() }).strict()
|
|
8053
8408
|
]);
|
|
8054
|
-
var FileAgentRefKindSchema =
|
|
8055
|
-
var CheckFileAgentRefsQuerySchema =
|
|
8056
|
-
projectId:
|
|
8057
|
-
environment:
|
|
8058
|
-
modelService:
|
|
8409
|
+
var FileAgentRefKindSchema = import_zod68.z.enum(["environment", "modelService", "managedMcp"]);
|
|
8410
|
+
var CheckFileAgentRefsQuerySchema = import_zod68.z.object({
|
|
8411
|
+
projectId: import_zod68.z.string().uuid(),
|
|
8412
|
+
environment: import_zod68.z.string().min(1).max(200).optional(),
|
|
8413
|
+
modelService: import_zod68.z.string().min(1).max(200).optional(),
|
|
8059
8414
|
/**
|
|
8060
8415
|
* `agent.yaml` `mcpServers:` —— 托管 MCP id(`vcrd_*`),已经是 id 而不是名字,
|
|
8061
8416
|
* 所以这里问的是「它在这个项目里存在吗」。上限对齐 `mcpServers` 的列表上限。
|
|
8062
8417
|
*/
|
|
8063
|
-
managedMcpIds:
|
|
8418
|
+
managedMcpIds: import_zod68.z.array(ManagedMcpIdSchema).max(64).optional()
|
|
8064
8419
|
}).strict();
|
|
8065
|
-
var FileAgentRefProblemSchema =
|
|
8420
|
+
var FileAgentRefProblemSchema = import_zod68.z.object({
|
|
8066
8421
|
kind: FileAgentRefKindSchema,
|
|
8067
|
-
name:
|
|
8422
|
+
name: import_zod68.z.string(),
|
|
8068
8423
|
/** Existing names in the project, for a "did you mean" hint (server-capped). */
|
|
8069
|
-
available:
|
|
8424
|
+
available: import_zod68.z.array(import_zod68.z.string())
|
|
8070
8425
|
}).strict();
|
|
8071
|
-
var CheckFileAgentRefsResponseSchema =
|
|
8072
|
-
environmentId:
|
|
8073
|
-
llmProviderRef:
|
|
8426
|
+
var CheckFileAgentRefsResponseSchema = import_zod68.z.object({
|
|
8427
|
+
environmentId: import_zod68.z.string().optional(),
|
|
8428
|
+
llmProviderRef: import_zod68.z.string().optional(),
|
|
8074
8429
|
/** 解析到的 `managedMcpId → 展示名`(发布侧要把名字冻进快照;check 只看 problems)。 */
|
|
8075
|
-
managedMcpDisplayNames:
|
|
8076
|
-
problems:
|
|
8430
|
+
managedMcpDisplayNames: import_zod68.z.record(import_zod68.z.string(), import_zod68.z.string()).optional(),
|
|
8431
|
+
problems: import_zod68.z.array(FileAgentRefProblemSchema)
|
|
8077
8432
|
}).strict();
|
|
8078
|
-
var IssueMcpDevTicketRequestSchema =
|
|
8079
|
-
projectId:
|
|
8433
|
+
var IssueMcpDevTicketRequestSchema = import_zod69.z.object({
|
|
8434
|
+
projectId: import_zod69.z.string().uuid(),
|
|
8080
8435
|
/**
|
|
8081
8436
|
* 人可读的用途标记(典型值:`<agent slug>@<主机名>`)。只为审计与自助排查
|
|
8082
8437
|
* ("我还有几张票在外面"),不参与鉴权。
|
|
8083
8438
|
*/
|
|
8084
|
-
label:
|
|
8439
|
+
label: import_zod69.z.string().min(1).max(200).optional(),
|
|
8085
8440
|
/** 省略 = 服务端默认(一个开发日)。服务端另有 24h 上限。 */
|
|
8086
|
-
ttlSeconds:
|
|
8441
|
+
ttlSeconds: import_zod69.z.number().int().positive().max(24 * 60 * 60).optional()
|
|
8087
8442
|
}).strict();
|
|
8088
|
-
var McpDevTicketTargetSchema =
|
|
8443
|
+
var McpDevTicketTargetSchema = import_zod69.z.object({
|
|
8089
8444
|
managedMcpId: ManagedMcpIdSchema,
|
|
8090
8445
|
/** 展示名 —— 给人看的(提示、报错)。**不是** `.mcp.json` 的键。 */
|
|
8091
|
-
displayName:
|
|
8446
|
+
displayName: import_zod69.z.string(),
|
|
8092
8447
|
/** 真实上游 URL。作为 `X-Pilot-MCP-Target` 头传给 gateway(**不是**凭据)。 */
|
|
8093
|
-
mcpServerUrl:
|
|
8448
|
+
mcpServerUrl: import_zod69.z.string(),
|
|
8094
8449
|
/**
|
|
8095
8450
|
* `.mcp.json` 的**键名**,平台侧创建期定死(`pilot_v2_vault_credentials.
|
|
8096
8451
|
* server_key`)。CLI 必须用它,不许从 `displayName` 现造:LLM 看到的工具名是
|
|
@@ -8105,37 +8460,37 @@ var McpDevTicketTargetSchema = import_zod66.z.object({
|
|
|
8105
8460
|
* 版本 skew 面(老服务端可能回 null → 新 SDK parse 抛错),而收益只是类型更
|
|
8106
8461
|
* 诚实。CLI 侧不该再有 null 分支——那个分支正是这条修复要消灭的东西。
|
|
8107
8462
|
*/
|
|
8108
|
-
serverKey:
|
|
8463
|
+
serverKey: import_zod69.z.string().nullable()
|
|
8109
8464
|
}).strict();
|
|
8110
|
-
var McpDevTicketStdioTargetSchema =
|
|
8465
|
+
var McpDevTicketStdioTargetSchema = import_zod69.z.object({
|
|
8111
8466
|
managedMcpId: ManagedMcpIdSchema,
|
|
8112
8467
|
/**
|
|
8113
8468
|
* `.mcp.json` 的键名。与 remote 的 `serverKey` 在**同一个命名空间**里分配:
|
|
8114
8469
|
* `.mcp.json` 是一张表,stdio 与 remote 的键撞了就是互相覆盖(沙箱冻结侧同
|
|
8115
8470
|
* 此约束,见 `vault-snapshot-freezer`)。
|
|
8116
8471
|
*/
|
|
8117
|
-
serverKey:
|
|
8472
|
+
serverKey: import_zod69.z.string().min(1).max(200),
|
|
8118
8473
|
/** 展示名 —— 给人看的。**不是**键。 */
|
|
8119
|
-
displayName:
|
|
8120
|
-
command:
|
|
8121
|
-
args:
|
|
8474
|
+
displayName: import_zod69.z.string(),
|
|
8475
|
+
command: import_zod69.z.string().min(1).max(500),
|
|
8476
|
+
args: import_zod69.z.array(import_zod69.z.string().max(500)).max(64).optional(),
|
|
8122
8477
|
/** 变量名 → 已渲染的值(`${MCP_...}` 占位符或字面量)。**绝不含明文凭据。** */
|
|
8123
|
-
env:
|
|
8478
|
+
env: import_zod69.z.record(import_zod69.z.string(), import_zod69.z.string()).optional()
|
|
8124
8479
|
}).strict();
|
|
8125
|
-
var IssueMcpDevTicketResponseSchema =
|
|
8480
|
+
var IssueMcpDevTicketResponseSchema = import_zod69.z.object({
|
|
8126
8481
|
/**
|
|
8127
8482
|
* 写进 `.mcp.json` 的 `Authorization: Bearer <token>`。
|
|
8128
8483
|
* **只在这一次响应里出现**,服务端不留明文。
|
|
8129
8484
|
*/
|
|
8130
|
-
token:
|
|
8485
|
+
token: import_zod69.z.string(),
|
|
8131
8486
|
/** 票据的 public id —— 撤销时用它。 */
|
|
8132
|
-
ticketId:
|
|
8487
|
+
ticketId: import_zod69.z.string(),
|
|
8133
8488
|
/** ISO 时间串。 */
|
|
8134
|
-
expiresAt:
|
|
8489
|
+
expiresAt: import_zod69.z.string(),
|
|
8135
8490
|
/** gateway URL(CLI 不该自己猜环境)。 */
|
|
8136
|
-
gatewayUrl:
|
|
8491
|
+
gatewayUrl: import_zod69.z.string(),
|
|
8137
8492
|
/** `remote` 形态 —— 经 gateway 代理,白名单即 `allowedMcpTargets`。 */
|
|
8138
|
-
targets:
|
|
8493
|
+
targets: import_zod69.z.array(McpDevTicketTargetSchema),
|
|
8139
8494
|
/**
|
|
8140
8495
|
* `stdio` 形态 —— 本机子进程,不经 gateway、不进白名单。上限与
|
|
8141
8496
|
* `FrozenStdioMcpListSchema` 对齐(64),两侧同一个上限才不会出现
|
|
@@ -8150,20 +8505,20 @@ var IssueMcpDevTicketResponseSchema = import_zod66.z.object({
|
|
|
8150
8505
|
* 注意输出类型仍是**非可选数组**(`z.infer` 取的是 default 之后的形态),所以
|
|
8151
8506
|
* 消费方不需要写 `?? []` 分支。
|
|
8152
8507
|
*/
|
|
8153
|
-
stdioTargets:
|
|
8508
|
+
stdioTargets: import_zod69.z.array(McpDevTicketStdioTargetSchema).max(64).default([])
|
|
8154
8509
|
}).strict();
|
|
8155
|
-
var RevokeMcpDevTicketResponseSchema =
|
|
8510
|
+
var RevokeMcpDevTicketResponseSchema = import_zod69.z.object({
|
|
8156
8511
|
/** `false` = 本来就不活跃(已撤销/不存在)。撤销是幂等的,两种都算成功。 */
|
|
8157
|
-
revoked:
|
|
8512
|
+
revoked: import_zod69.z.boolean()
|
|
8158
8513
|
}).strict();
|
|
8159
|
-
var DevSecretEnvKeySchema =
|
|
8160
|
-
var ResolveMcpDevSecretsRequestSchema =
|
|
8161
|
-
projectId:
|
|
8514
|
+
var DevSecretEnvKeySchema = import_zod70.z.string().min(1).max(100).regex(/^[A-Z_][A-Z0-9_]*$/, "env key must match ^[A-Z_][A-Z0-9_]*$");
|
|
8515
|
+
var ResolveMcpDevSecretsRequestSchema = import_zod70.z.object({
|
|
8516
|
+
projectId: import_zod70.z.string().uuid(),
|
|
8162
8517
|
/**
|
|
8163
8518
|
* 这个 agent 声明的托管 MCP id。服务端据此推导要解哪些 `sec_*` ——
|
|
8164
8519
|
* 只有 `stdio` 形态有凭据要下发(`remote` 走 gateway,明文不出平台)。
|
|
8165
8520
|
*/
|
|
8166
|
-
managedMcpIds:
|
|
8521
|
+
managedMcpIds: import_zod70.z.array(ManagedMcpIdSchema).max(64).optional(),
|
|
8167
8522
|
/**
|
|
8168
8523
|
* `agent.yaml` 的 `env:` 里指向 secret 的条目:`envKey → sec_*`。
|
|
8169
8524
|
*
|
|
@@ -8172,16 +8527,16 @@ var ResolveMcpDevSecretsRequestSchema = import_zod67.z.object({
|
|
|
8172
8527
|
* `secrets:resolve` 的调用方本来就被授权读本项目任意 secret,所以这不扩大权限;
|
|
8173
8528
|
* 上限在这里是为了让一次请求不能变成"把整个项目扫一遍"的批量导出工具。
|
|
8174
8529
|
*/
|
|
8175
|
-
envSecretRefs:
|
|
8530
|
+
envSecretRefs: import_zod70.z.record(DevSecretEnvKeySchema, SecretPublicIdSchema).refine((refs) => Object.keys(refs).length <= 64, {
|
|
8176
8531
|
message: "envSecretRefs must have at most 64 entries"
|
|
8177
8532
|
}).optional()
|
|
8178
8533
|
}).strict();
|
|
8179
|
-
var ResolveMcpDevSecretsResponseSchema =
|
|
8534
|
+
var ResolveMcpDevSecretsResponseSchema = import_zod70.z.object({
|
|
8180
8535
|
/**
|
|
8181
8536
|
* env 变量名 → **明文**。CLI 只把它放进子进程 env(`.mcp.json` 与 env 文件里
|
|
8182
8537
|
* 都只写 `${VAR}` 占位符),不落盘。
|
|
8183
8538
|
*/
|
|
8184
|
-
values:
|
|
8539
|
+
values: import_zod70.z.record(DevSecretEnvKeySchema, import_zod70.z.string()),
|
|
8185
8540
|
/**
|
|
8186
8541
|
* 声明了但解不出来的 env key(不存在 / 已归档 / 不属于本项目)。
|
|
8187
8542
|
*
|
|
@@ -8189,7 +8544,7 @@ var ResolveMcpDevSecretsResponseSchema = import_zod67.z.object({
|
|
|
8189
8544
|
* `${VAR}` 字面量原样传给 MCP server,于是上游报"token 无效",排查方向被带到
|
|
8190
8545
|
* 上游去,而真实原因是这里少了一个值。
|
|
8191
8546
|
*/
|
|
8192
|
-
missing:
|
|
8547
|
+
missing: import_zod70.z.array(import_zod70.z.string())
|
|
8193
8548
|
}).strict();
|
|
8194
8549
|
var EVAL_SUITE_API_VERSION = "agenthub/v1alpha1";
|
|
8195
8550
|
var EVAL_SUITE_KIND = "EvalSuite";
|
|
@@ -8199,7 +8554,7 @@ var EVAL_MAX_RETRIES = 2;
|
|
|
8199
8554
|
var EVAL_MAX_TURN_BYTES = 32 * 1024;
|
|
8200
8555
|
var EVAL_MAX_FIXTURE_FILE_BYTES = 64 * 1024;
|
|
8201
8556
|
var EVAL_MAX_FIXTURE_TOTAL_BYTES = 512 * 1024;
|
|
8202
|
-
var EvalRunStatusSchema =
|
|
8557
|
+
var EvalRunStatusSchema = import_zod71.z.enum([
|
|
8203
8558
|
"pending",
|
|
8204
8559
|
"running",
|
|
8205
8560
|
"passed",
|
|
@@ -8207,20 +8562,20 @@ var EvalRunStatusSchema = import_zod68.z.enum([
|
|
|
8207
8562
|
"errored",
|
|
8208
8563
|
"cancelled"
|
|
8209
8564
|
]);
|
|
8210
|
-
var EvalCaseVerdictSchema =
|
|
8211
|
-
var EvalGraderStatusSchema =
|
|
8212
|
-
var EvalErrorClassSchema =
|
|
8565
|
+
var EvalCaseVerdictSchema = import_zod71.z.enum(["passed", "failed", "errored"]);
|
|
8566
|
+
var EvalGraderStatusSchema = import_zod71.z.enum(["passed", "failed", "errored", "skipped"]);
|
|
8567
|
+
var EvalErrorClassSchema = import_zod71.z.enum([
|
|
8213
8568
|
"capability_unavailable",
|
|
8214
8569
|
"infrastructure_error",
|
|
8215
8570
|
"indeterminate",
|
|
8216
8571
|
"invalid_definition"
|
|
8217
8572
|
]);
|
|
8218
|
-
var EvalErrorCodeSchema =
|
|
8573
|
+
var EvalErrorCodeSchema = import_zod71.z.enum([
|
|
8219
8574
|
"EVAL_GRADER_CAPABILITY_UNAVAILABLE",
|
|
8220
8575
|
"EVAL_SELF_EVAL_FORBIDDEN"
|
|
8221
8576
|
]);
|
|
8222
8577
|
var EVAL_SCRIPT_STDOUT_TAIL_MAX_BYTES = 64 * 1024;
|
|
8223
|
-
var EvalTriggerSchema =
|
|
8578
|
+
var EvalTriggerSchema = import_zod71.z.enum([
|
|
8224
8579
|
"manual",
|
|
8225
8580
|
"promote_gate",
|
|
8226
8581
|
"cli",
|
|
@@ -8230,123 +8585,135 @@ var EvalTriggerSchema = import_zod68.z.enum([
|
|
|
8230
8585
|
"replay",
|
|
8231
8586
|
"pipeline"
|
|
8232
8587
|
]);
|
|
8233
|
-
var EvalSeveritySchema =
|
|
8234
|
-
var EvalGraderTypeSchema =
|
|
8235
|
-
var EvalPassPolicySchema =
|
|
8236
|
-
var EvalSuitePurposeSchema =
|
|
8588
|
+
var EvalSeveritySchema = import_zod71.z.enum(["gate", "soft"]);
|
|
8589
|
+
var EvalGraderTypeSchema = import_zod71.z.enum(["transcript", "file", "llm", "script"]);
|
|
8590
|
+
var EvalPassPolicySchema = import_zod71.z.enum(["all", "any"]);
|
|
8591
|
+
var EvalSuitePurposeSchema = import_zod71.z.enum(["regression", "capability"]);
|
|
8237
8592
|
var EVAL_SKIP_REASON_MAX = 2048;
|
|
8238
|
-
var EvalSuiteSkipSchema =
|
|
8239
|
-
var EvalSkippedSuiteSchema =
|
|
8240
|
-
var EvalConclusionStatusSchema =
|
|
8593
|
+
var EvalSuiteSkipSchema = import_zod71.z.object({ reason: import_zod71.z.string().min(1).max(EVAL_SKIP_REASON_MAX) }).strict();
|
|
8594
|
+
var EvalSkippedSuiteSchema = import_zod71.z.object({ path: import_zod71.z.string().min(1), reason: import_zod71.z.string().min(1) }).strict();
|
|
8595
|
+
var EvalConclusionStatusSchema = import_zod71.z.enum(["passed", "failed", "errored", "unassessed"]);
|
|
8241
8596
|
var isSafeRelativePath = (p) => !p.startsWith("/") && !p.split("/").includes("..") && !p.split("/").includes(".");
|
|
8242
|
-
var EvalRelativePathSchema =
|
|
8597
|
+
var EvalRelativePathSchema = import_zod71.z.string().min(1).max(255).refine(isSafeRelativePath, {
|
|
8243
8598
|
message: "path must be a relative path without '.' or '..' segments"
|
|
8244
8599
|
});
|
|
8245
|
-
var EvalSlugSchema =
|
|
8600
|
+
var EvalSlugSchema = import_zod71.z.string().regex(/^[a-z0-9-]{1,64}$/, {
|
|
8246
8601
|
message: "must be a slug matching [a-z0-9-]{1,64}"
|
|
8247
8602
|
});
|
|
8248
|
-
var EvalTimesExprSchema =
|
|
8603
|
+
var EvalTimesExprSchema = import_zod71.z.string().regex(/^(>=|<=|=|>|<)?\d+$/, {
|
|
8249
8604
|
message: 'times must match an operator + integer, e.g. ">=1", "=3", "2"'
|
|
8250
8605
|
});
|
|
8251
|
-
var EvalMarkerSchema =
|
|
8252
|
-
evalRunId:
|
|
8606
|
+
var EvalMarkerSchema = import_zod71.z.object({
|
|
8607
|
+
evalRunId: import_zod71.z.string().min(1),
|
|
8253
8608
|
caseId: EvalSlugSchema,
|
|
8254
|
-
trial:
|
|
8255
|
-
}).strict();
|
|
8256
|
-
var EvalPatternRulesSchema =
|
|
8257
|
-
required:
|
|
8258
|
-
forbidden:
|
|
8259
|
-
}).strict();
|
|
8260
|
-
var EvalTranscriptExpectSchema =
|
|
8261
|
-
completed:
|
|
8262
|
-
calledTool:
|
|
8263
|
-
toolOrder:
|
|
8264
|
-
forbiddenTools:
|
|
8265
|
-
calledSubagent:
|
|
8266
|
-
usedNoTools:
|
|
8267
|
-
loadedSkill:
|
|
8268
|
-
maxToolCalls:
|
|
8609
|
+
trial: import_zod71.z.number().int().nonnegative()
|
|
8610
|
+
}).strict();
|
|
8611
|
+
var EvalPatternRulesSchema = import_zod71.z.object({
|
|
8612
|
+
required: import_zod71.z.array(import_zod71.z.string()).optional(),
|
|
8613
|
+
forbidden: import_zod71.z.array(import_zod71.z.string()).optional()
|
|
8614
|
+
}).strict();
|
|
8615
|
+
var EvalTranscriptExpectSchema = import_zod71.z.object({
|
|
8616
|
+
completed: import_zod71.z.boolean().optional(),
|
|
8617
|
+
calledTool: import_zod71.z.object({ name: import_zod71.z.string().min(1), times: EvalTimesExprSchema.optional() }).strict().optional(),
|
|
8618
|
+
toolOrder: import_zod71.z.array(import_zod71.z.string().min(1)).optional(),
|
|
8619
|
+
forbiddenTools: import_zod71.z.array(import_zod71.z.string().min(1)).optional(),
|
|
8620
|
+
calledSubagent: import_zod71.z.object({ name: import_zod71.z.string().min(1).optional(), times: EvalTimesExprSchema.optional() }).strict().optional(),
|
|
8621
|
+
usedNoTools: import_zod71.z.boolean().optional(),
|
|
8622
|
+
loadedSkill: import_zod71.z.string().min(1).optional(),
|
|
8623
|
+
maxToolCalls: import_zod71.z.number().int().positive().optional(),
|
|
8269
8624
|
commandPatterns: EvalPatternRulesSchema.optional(),
|
|
8270
8625
|
toolInputPatterns: EvalPatternRulesSchema.optional()
|
|
8271
8626
|
}).strict();
|
|
8272
|
-
var EvalTranscriptGraderSchema =
|
|
8273
|
-
type:
|
|
8627
|
+
var EvalTranscriptGraderSchema = import_zod71.z.object({
|
|
8628
|
+
type: import_zod71.z.literal("transcript"),
|
|
8274
8629
|
label: EvalSlugSchema.optional(),
|
|
8275
8630
|
severity: EvalSeveritySchema.optional(),
|
|
8276
8631
|
// 缺省 gate
|
|
8277
|
-
online:
|
|
8632
|
+
online: import_zod71.z.boolean().optional(),
|
|
8633
|
+
/**
|
|
8634
|
+
* T2 真·多轮:只对第 `turn` 轮(0-based,指向 `case.turns` 的下标)的轨迹
|
|
8635
|
+
* 断言——可以表达"第二轮才调用 run_sql"。缺省 = 整个 trial 的合并轨迹
|
|
8636
|
+
* (全部轮的工具按序拼接,终态取最后一轮)。executor 保证走到 grader 的
|
|
8637
|
+
* trial 中间轮恒为 completed(非末轮非 completed 直接整 trial 报 infra
|
|
8638
|
+
* 错,不会被末轮掩盖),所以缺省 grader 看到的末轮终态就是真实终态;
|
|
8639
|
+
* `turn` 的价值在**按轮收窄工具断言**,不再承担防掩盖职责。上界
|
|
8640
|
+
* (< turns.length)在 EvalSuiteSchema 的 superRefine 校验(需要 case 的
|
|
8641
|
+
* turns 上下文;单 parse 一个 grader 不带上界,越界到 gradeTranscript
|
|
8642
|
+
* 才 errored——已知取舍)。
|
|
8643
|
+
*/
|
|
8644
|
+
turn: import_zod71.z.number().int().min(0).optional(),
|
|
8278
8645
|
expect: EvalTranscriptExpectSchema
|
|
8279
8646
|
}).strict();
|
|
8280
|
-
var EvalFileEntrySchema =
|
|
8647
|
+
var EvalFileEntrySchema = import_zod71.z.object({
|
|
8281
8648
|
path: EvalRelativePathSchema,
|
|
8282
|
-
mustMatch:
|
|
8283
|
-
mustNotMatch:
|
|
8649
|
+
mustMatch: import_zod71.z.array(import_zod71.z.string()).optional(),
|
|
8650
|
+
mustNotMatch: import_zod71.z.array(import_zod71.z.string()).optional()
|
|
8284
8651
|
}).strict();
|
|
8285
|
-
var EvalFileShorthandExpectSchema =
|
|
8286
|
-
includes:
|
|
8287
|
-
equals:
|
|
8288
|
-
matches:
|
|
8652
|
+
var EvalFileShorthandExpectSchema = import_zod71.z.object({
|
|
8653
|
+
includes: import_zod71.z.string().optional(),
|
|
8654
|
+
equals: import_zod71.z.string().optional(),
|
|
8655
|
+
matches: import_zod71.z.string().optional()
|
|
8289
8656
|
// 正则字符串
|
|
8290
8657
|
}).strict();
|
|
8291
|
-
var EvalFileGraderSchema =
|
|
8292
|
-
type:
|
|
8658
|
+
var EvalFileGraderSchema = import_zod71.z.object({
|
|
8659
|
+
type: import_zod71.z.literal("file"),
|
|
8293
8660
|
label: EvalSlugSchema.optional(),
|
|
8294
8661
|
severity: EvalSeveritySchema.optional(),
|
|
8295
8662
|
// 缺省 gate
|
|
8296
|
-
online:
|
|
8663
|
+
online: import_zod71.z.boolean().optional(),
|
|
8297
8664
|
// 多文件形式
|
|
8298
|
-
files:
|
|
8665
|
+
files: import_zod71.z.array(EvalFileEntrySchema).min(1).optional(),
|
|
8299
8666
|
// 简写形式
|
|
8300
8667
|
path: EvalRelativePathSchema.optional(),
|
|
8301
8668
|
expect: EvalFileShorthandExpectSchema.optional()
|
|
8302
8669
|
}).strict();
|
|
8303
|
-
var EvalLlmGraderSchema =
|
|
8304
|
-
type:
|
|
8670
|
+
var EvalLlmGraderSchema = import_zod71.z.object({
|
|
8671
|
+
type: import_zod71.z.literal("llm"),
|
|
8305
8672
|
label: EvalSlugSchema.optional(),
|
|
8306
8673
|
severity: EvalSeveritySchema.optional(),
|
|
8307
8674
|
// 缺省 soft
|
|
8308
|
-
online:
|
|
8675
|
+
online: import_zod71.z.boolean().optional(),
|
|
8309
8676
|
rubric: EvalRelativePathSchema.refine((p) => p.endsWith(".md"), {
|
|
8310
8677
|
message: "rubric must be a relative .md path within the suite"
|
|
8311
8678
|
}),
|
|
8312
|
-
dimensions:
|
|
8313
|
-
threshold:
|
|
8314
|
-
graderVersion:
|
|
8679
|
+
dimensions: import_zod71.z.array(import_zod71.z.string().min(1)).optional(),
|
|
8680
|
+
threshold: import_zod71.z.number().min(0).max(1),
|
|
8681
|
+
graderVersion: import_zod71.z.number().int().positive()
|
|
8315
8682
|
}).strict();
|
|
8316
|
-
var EvalScriptExpectSchema =
|
|
8317
|
-
exitCode:
|
|
8683
|
+
var EvalScriptExpectSchema = import_zod71.z.object({
|
|
8684
|
+
exitCode: import_zod71.z.number().int().optional(),
|
|
8318
8685
|
// 缺省 0
|
|
8319
|
-
stdoutIncludes:
|
|
8686
|
+
stdoutIncludes: import_zod71.z.array(import_zod71.z.string()).optional()
|
|
8320
8687
|
}).strict();
|
|
8321
|
-
var EvalScriptGraderSchema =
|
|
8322
|
-
type:
|
|
8688
|
+
var EvalScriptGraderSchema = import_zod71.z.object({
|
|
8689
|
+
type: import_zod71.z.literal("script"),
|
|
8323
8690
|
label: EvalSlugSchema.optional(),
|
|
8324
8691
|
severity: EvalSeveritySchema.optional(),
|
|
8325
8692
|
// 缺省 gate
|
|
8326
|
-
online:
|
|
8327
|
-
run:
|
|
8328
|
-
timeout:
|
|
8693
|
+
online: import_zod71.z.boolean().optional(),
|
|
8694
|
+
run: import_zod71.z.string().min(1),
|
|
8695
|
+
timeout: import_zod71.z.number().int().positive().max(EVAL_MAX_TIMEOUT_SECONDS).optional(),
|
|
8329
8696
|
expect: EvalScriptExpectSchema.optional()
|
|
8330
8697
|
}).strict();
|
|
8331
|
-
var EvalGraderSpecSchema =
|
|
8698
|
+
var EvalGraderSpecSchema = import_zod71.z.discriminatedUnion("type", [
|
|
8332
8699
|
EvalTranscriptGraderSchema,
|
|
8333
8700
|
EvalFileGraderSchema,
|
|
8334
8701
|
EvalLlmGraderSchema,
|
|
8335
8702
|
EvalScriptGraderSchema
|
|
8336
8703
|
]);
|
|
8337
|
-
var EvalFixtureWorkspaceSchema =
|
|
8338
|
-
repo:
|
|
8339
|
-
ref:
|
|
8704
|
+
var EvalFixtureWorkspaceSchema = import_zod71.z.object({
|
|
8705
|
+
repo: import_zod71.z.string().url(),
|
|
8706
|
+
ref: import_zod71.z.string().min(1)
|
|
8340
8707
|
}).strict();
|
|
8341
|
-
var EvalFixtureFileSchema =
|
|
8708
|
+
var EvalFixtureFileSchema = import_zod71.z.object({
|
|
8342
8709
|
path: EvalRelativePathSchema,
|
|
8343
|
-
content:
|
|
8710
|
+
content: import_zod71.z.string()
|
|
8344
8711
|
}).strict();
|
|
8345
|
-
var EvalFixturesSchema =
|
|
8712
|
+
var EvalFixturesSchema = import_zod71.z.object({
|
|
8346
8713
|
workspace: EvalFixtureWorkspaceSchema.optional(),
|
|
8347
|
-
files:
|
|
8714
|
+
files: import_zod71.z.array(EvalFixtureFileSchema).optional()
|
|
8348
8715
|
}).strict();
|
|
8349
|
-
var EvalAgentOverridesSchema =
|
|
8716
|
+
var EvalAgentOverridesSchema = import_zod71.z.object({
|
|
8350
8717
|
/**
|
|
8351
8718
|
* 覆盖被测 agent 的模型。**被测 model 是 case 级可变的**:最终生效值 =
|
|
8352
8719
|
* `agentOverrides.model ?? agent 默认 model`,故同一份卷不同 case 的被测
|
|
@@ -8359,33 +8726,51 @@ var EvalAgentOverridesSchema = import_zod68.z.object({
|
|
|
8359
8726
|
* 先经 ModelGate 归一为 canonical id 再比较——**需运行时上下文,故不在本零依赖
|
|
8360
8727
|
* 契约层做,留给 T3/T4 resolve 层的 400**。
|
|
8361
8728
|
*/
|
|
8362
|
-
model:
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8729
|
+
model: import_zod71.z.string().min(1).optional(),
|
|
8730
|
+
/**
|
|
8731
|
+
* T1 语义(减法白名单):把 revision 解析出的 skills **收窄**为名单内的
|
|
8732
|
+
* 子集(按 `EnabledSkill.rushSkillName` 匹配——即 agent skills.json 里写的
|
|
8733
|
+
* 名字)。`[]` = 全部禁用(合法的消融测试)。名单里的名字一个都匹配不上 →
|
|
8734
|
+
* 执行层 infrastructure error(fail-loud:拼错名字静默测了个没装 skill 的
|
|
8735
|
+
* agent,是假红灯)。**不能加塞** revision 未声明的 skill——eval 测的是
|
|
8736
|
+
* 「已发布的 agent」,不是「一个不存在的配置」。
|
|
8737
|
+
*/
|
|
8738
|
+
skills: import_zod71.z.array(import_zod71.z.string().min(1)).optional(),
|
|
8739
|
+
/**
|
|
8740
|
+
* T1 语义(减法白名单):把 revision 解析出的 mcpServers **收窄**为名单内
|
|
8741
|
+
* 的子集(按 runtime `.mcp.json` 的 server 键名匹配,即 agent 实际运行的
|
|
8742
|
+
* server 名)。匹配规则与 fail-loud 姿态同 `skills`。stdio transport 的
|
|
8743
|
+
* server 仍受 `allowStdioMcp` 总闸约束(默认不注入)。
|
|
8744
|
+
*/
|
|
8745
|
+
mcpServers: import_zod71.z.array(import_zod71.z.string().min(1)).optional(),
|
|
8746
|
+
/**
|
|
8747
|
+
* T1 语义:追加在被测 agent 冻结 systemPrompt 之后的指令块(`\n\n` 拼接),
|
|
8748
|
+
* 例如注入 case 特有的输出格式要求。不能替换(替换 = 测别的 agent)。
|
|
8749
|
+
*/
|
|
8750
|
+
systemPromptAppend: import_zod71.z.string().optional()
|
|
8366
8751
|
}).strict();
|
|
8367
|
-
var EvalCaseOriginSchema =
|
|
8368
|
-
sessionId:
|
|
8369
|
-
capturedAt:
|
|
8752
|
+
var EvalCaseOriginSchema = import_zod71.z.object({
|
|
8753
|
+
sessionId: import_zod71.z.string().min(1),
|
|
8754
|
+
capturedAt: import_zod71.z.string().min(1)
|
|
8370
8755
|
}).strict();
|
|
8371
|
-
var EvalCaseSchema =
|
|
8756
|
+
var EvalCaseSchema = import_zod71.z.object({
|
|
8372
8757
|
id: EvalSlugSchema,
|
|
8373
|
-
description:
|
|
8374
|
-
turns:
|
|
8758
|
+
description: import_zod71.z.string().optional(),
|
|
8759
|
+
turns: import_zod71.z.array(import_zod71.z.object({ user: import_zod71.z.string().min(1) }).strict()).min(1),
|
|
8375
8760
|
fixtures: EvalFixturesSchema.optional(),
|
|
8376
8761
|
agentOverrides: EvalAgentOverridesSchema.optional(),
|
|
8377
|
-
timeout:
|
|
8378
|
-
maxRetries:
|
|
8379
|
-
trials:
|
|
8762
|
+
timeout: import_zod71.z.number().int().positive().max(EVAL_MAX_TIMEOUT_SECONDS).optional(),
|
|
8763
|
+
maxRetries: import_zod71.z.number().int().min(0).max(EVAL_MAX_RETRIES).optional(),
|
|
8764
|
+
trials: import_zod71.z.number().int().min(1).max(EVAL_MAX_TRIALS).optional(),
|
|
8380
8765
|
// U1,默认 1
|
|
8381
8766
|
passPolicy: EvalPassPolicySchema.optional(),
|
|
8382
8767
|
// U1,缺省按 purpose
|
|
8383
8768
|
origin: EvalCaseOriginSchema.optional(),
|
|
8384
|
-
allowStdioMcp:
|
|
8769
|
+
allowStdioMcp: import_zod71.z.boolean().optional(),
|
|
8385
8770
|
// 默认 false(§2.1.1 副作用面)
|
|
8386
|
-
graders:
|
|
8771
|
+
graders: import_zod71.z.array(EvalGraderSpecSchema).min(1)
|
|
8387
8772
|
}).strict();
|
|
8388
|
-
var EvalSuiteDefaultsSchema =
|
|
8773
|
+
var EvalSuiteDefaultsSchema = import_zod71.z.object({
|
|
8389
8774
|
/**
|
|
8390
8775
|
* llm grader 的裁判模型。**仅 suite 级、不可 case/grader 级覆盖**(也不在
|
|
8391
8776
|
* `EvalAgentOverridesSchema` 白名单里)。
|
|
@@ -8407,27 +8792,27 @@ var EvalSuiteDefaultsSchema = import_zod68.z.object({
|
|
|
8407
8792
|
* 兑现留给 T7(llm grader 实现),届时大概率取当时最合适的 judge 且做成运行面
|
|
8408
8793
|
* 可配置,而非硬编码进契约。
|
|
8409
8794
|
*/
|
|
8410
|
-
judgeModel:
|
|
8411
|
-
timeout:
|
|
8412
|
-
maxConcurrency:
|
|
8795
|
+
judgeModel: import_zod71.z.string().min(1).optional(),
|
|
8796
|
+
timeout: import_zod71.z.number().int().positive().max(EVAL_MAX_TIMEOUT_SECONDS).optional(),
|
|
8797
|
+
maxConcurrency: import_zod71.z.number().int().positive().optional()
|
|
8413
8798
|
}).strict();
|
|
8414
8799
|
var byteLen = (s) => new TextEncoder().encode(s).length;
|
|
8415
|
-
var EvalSuiteSchema =
|
|
8416
|
-
apiVersion:
|
|
8417
|
-
kind:
|
|
8800
|
+
var EvalSuiteSchema = import_zod71.z.object({
|
|
8801
|
+
apiVersion: import_zod71.z.literal(EVAL_SUITE_API_VERSION),
|
|
8802
|
+
kind: import_zod71.z.literal(EVAL_SUITE_KIND),
|
|
8418
8803
|
purpose: EvalSuitePurposeSchema.optional(),
|
|
8419
8804
|
// U2,默认 regression
|
|
8420
8805
|
skip: EvalSuiteSkipSchema.optional(),
|
|
8421
8806
|
// §4 声明跳过(带必填理由)
|
|
8422
8807
|
defaults: EvalSuiteDefaultsSchema.optional(),
|
|
8423
|
-
cases:
|
|
8808
|
+
cases: import_zod71.z.array(EvalCaseSchema).min(1)
|
|
8424
8809
|
}).strict().superRefine((suite, ctx) => {
|
|
8425
8810
|
const seen = /* @__PURE__ */ new Set();
|
|
8426
8811
|
suite.cases.forEach((c, ci) => {
|
|
8427
8812
|
var _a, _b;
|
|
8428
8813
|
if (seen.has(c.id)) {
|
|
8429
8814
|
ctx.addIssue({
|
|
8430
|
-
code:
|
|
8815
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8431
8816
|
path: ["cases", ci, "id"],
|
|
8432
8817
|
message: `duplicate case id "${c.id}" (must be unique within suite)`
|
|
8433
8818
|
});
|
|
@@ -8436,7 +8821,7 @@ var EvalSuiteSchema = import_zod68.z.object({
|
|
|
8436
8821
|
c.turns.forEach((t, ti) => {
|
|
8437
8822
|
if (byteLen(t.user) > EVAL_MAX_TURN_BYTES) {
|
|
8438
8823
|
ctx.addIssue({
|
|
8439
|
-
code:
|
|
8824
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8440
8825
|
path: ["cases", ci, "turns", ti, "user"],
|
|
8441
8826
|
message: `turn exceeds ${EVAL_MAX_TURN_BYTES} bytes`
|
|
8442
8827
|
});
|
|
@@ -8448,7 +8833,7 @@ var EvalSuiteSchema = import_zod68.z.object({
|
|
|
8448
8833
|
fixtureTotal += size;
|
|
8449
8834
|
if (size > EVAL_MAX_FIXTURE_FILE_BYTES) {
|
|
8450
8835
|
ctx.addIssue({
|
|
8451
|
-
code:
|
|
8836
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8452
8837
|
path: ["cases", ci, "fixtures", "files", fi, "content"],
|
|
8453
8838
|
message: `fixture file exceeds ${EVAL_MAX_FIXTURE_FILE_BYTES} bytes`
|
|
8454
8839
|
});
|
|
@@ -8456,7 +8841,7 @@ var EvalSuiteSchema = import_zod68.z.object({
|
|
|
8456
8841
|
});
|
|
8457
8842
|
if (fixtureTotal > EVAL_MAX_FIXTURE_TOTAL_BYTES) {
|
|
8458
8843
|
ctx.addIssue({
|
|
8459
|
-
code:
|
|
8844
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8460
8845
|
path: ["cases", ci, "fixtures", "files"],
|
|
8461
8846
|
message: `fixture files total exceeds ${EVAL_MAX_FIXTURE_TOTAL_BYTES} bytes`
|
|
8462
8847
|
});
|
|
@@ -8467,99 +8852,106 @@ var EvalSuiteSchema = import_zod68.z.object({
|
|
|
8467
8852
|
const hasShorthand = g.path != null && g.expect != null;
|
|
8468
8853
|
if (hasFiles === hasShorthand) {
|
|
8469
8854
|
ctx.addIssue({
|
|
8470
|
-
code:
|
|
8855
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8471
8856
|
path: ["cases", ci, "graders", gi],
|
|
8472
8857
|
message: "file grader must use either `files[]` or `{path, expect}`, not both/neither"
|
|
8473
8858
|
});
|
|
8474
8859
|
}
|
|
8475
8860
|
}
|
|
8861
|
+
if (g.type === "transcript" && g.turn != null && g.turn >= c.turns.length) {
|
|
8862
|
+
ctx.addIssue({
|
|
8863
|
+
code: import_zod71.z.ZodIssueCode.custom,
|
|
8864
|
+
path: ["cases", ci, "graders", gi, "turn"],
|
|
8865
|
+
message: `transcript grader turn=${g.turn} is out of range (case has ${c.turns.length} turn(s); 0-based)`
|
|
8866
|
+
});
|
|
8867
|
+
}
|
|
8476
8868
|
});
|
|
8477
8869
|
});
|
|
8478
8870
|
});
|
|
8479
|
-
var ScriptEvidenceSchema =
|
|
8480
|
-
|
|
8481
|
-
kind:
|
|
8871
|
+
var ScriptEvidenceSchema = import_zod71.z.discriminatedUnion("kind", [
|
|
8872
|
+
import_zod71.z.object({
|
|
8873
|
+
kind: import_zod71.z.literal("executed"),
|
|
8482
8874
|
// A1
|
|
8483
|
-
exitCode:
|
|
8484
|
-
stdoutTailRef:
|
|
8875
|
+
exitCode: import_zod71.z.number().int(),
|
|
8876
|
+
stdoutTailRef: import_zod71.z.string().optional(),
|
|
8485
8877
|
// 超限内容走 OSS ref
|
|
8486
|
-
durationMs:
|
|
8878
|
+
durationMs: import_zod71.z.number().int().nonnegative()
|
|
8487
8879
|
}).strict(),
|
|
8488
|
-
|
|
8489
|
-
kind:
|
|
8880
|
+
import_zod71.z.object({
|
|
8881
|
+
kind: import_zod71.z.literal("capability_unavailable"),
|
|
8490
8882
|
// A0
|
|
8491
|
-
capability:
|
|
8492
|
-
phase:
|
|
8883
|
+
capability: import_zod71.z.literal("script_grader"),
|
|
8884
|
+
phase: import_zod71.z.literal("A0")
|
|
8493
8885
|
}).strict()
|
|
8494
8886
|
]);
|
|
8495
|
-
var EvalGraderEvidenceSchema =
|
|
8496
|
-
|
|
8497
|
-
type:
|
|
8498
|
-
matchedEventIds:
|
|
8499
|
-
violatedCheck:
|
|
8887
|
+
var EvalGraderEvidenceSchema = import_zod71.z.discriminatedUnion("type", [
|
|
8888
|
+
import_zod71.z.object({
|
|
8889
|
+
type: import_zod71.z.literal("transcript"),
|
|
8890
|
+
matchedEventIds: import_zod71.z.array(import_zod71.z.string()).optional(),
|
|
8891
|
+
violatedCheck: import_zod71.z.string().optional()
|
|
8500
8892
|
}).strict(),
|
|
8501
|
-
|
|
8502
|
-
type:
|
|
8503
|
-
path:
|
|
8504
|
-
excerpt:
|
|
8893
|
+
import_zod71.z.object({
|
|
8894
|
+
type: import_zod71.z.literal("file"),
|
|
8895
|
+
path: import_zod71.z.string(),
|
|
8896
|
+
excerpt: import_zod71.z.string().max(2048).optional()
|
|
8505
8897
|
// ≤2KB
|
|
8506
8898
|
}).strict(),
|
|
8507
|
-
|
|
8508
|
-
type:
|
|
8509
|
-
judgeModel:
|
|
8510
|
-
rubricSha:
|
|
8899
|
+
import_zod71.z.object({
|
|
8900
|
+
type: import_zod71.z.literal("llm"),
|
|
8901
|
+
judgeModel: import_zod71.z.string(),
|
|
8902
|
+
rubricSha: import_zod71.z.string(),
|
|
8511
8903
|
// U5:离散档位 + 锚点文本(不是换算后小数)
|
|
8512
|
-
dimensionScores:
|
|
8513
|
-
judgeOutputRef:
|
|
8904
|
+
dimensionScores: import_zod71.z.record(import_zod71.z.string(), import_zod71.z.unknown()).optional(),
|
|
8905
|
+
judgeOutputRef: import_zod71.z.string().optional()
|
|
8514
8906
|
// judge 原始输出 OSS ref
|
|
8515
8907
|
}).strict(),
|
|
8516
|
-
|
|
8908
|
+
import_zod71.z.object({ type: import_zod71.z.literal("script"), evidence: ScriptEvidenceSchema }).strict()
|
|
8517
8909
|
]);
|
|
8518
|
-
var GraderVerdictSchema =
|
|
8519
|
-
graderIndex:
|
|
8520
|
-
graderKey:
|
|
8910
|
+
var GraderVerdictSchema = import_zod71.z.object({
|
|
8911
|
+
graderIndex: import_zod71.z.number().int().nonnegative(),
|
|
8912
|
+
graderKey: import_zod71.z.string(),
|
|
8521
8913
|
type: EvalGraderTypeSchema,
|
|
8522
8914
|
severity: EvalSeveritySchema,
|
|
8523
8915
|
// resolve 后终值
|
|
8524
|
-
label:
|
|
8916
|
+
label: import_zod71.z.string().optional(),
|
|
8525
8917
|
status: EvalGraderStatusSchema,
|
|
8526
8918
|
errorClass: EvalErrorClassSchema.optional(),
|
|
8527
8919
|
// status=errored 时
|
|
8528
8920
|
errorCode: EvalErrorCodeSchema.optional(),
|
|
8529
8921
|
// status=errored 时
|
|
8530
|
-
score:
|
|
8922
|
+
score: import_zod71.z.number().nullable(),
|
|
8531
8923
|
// llm=0~1;二值 grader=null
|
|
8532
|
-
threshold:
|
|
8533
|
-
reason:
|
|
8924
|
+
threshold: import_zod71.z.number().optional(),
|
|
8925
|
+
reason: import_zod71.z.string(),
|
|
8534
8926
|
evidence: EvalGraderEvidenceSchema.optional(),
|
|
8535
|
-
graderVersion:
|
|
8536
|
-
engineVersion:
|
|
8927
|
+
graderVersion: import_zod71.z.number().int().optional(),
|
|
8928
|
+
engineVersion: import_zod71.z.string(),
|
|
8537
8929
|
// 平台 grader 实现版本,基线口径用
|
|
8538
|
-
durationMs:
|
|
8930
|
+
durationMs: import_zod71.z.number().int().nonnegative().optional()
|
|
8539
8931
|
}).strict();
|
|
8540
|
-
var EvalCaseResultSchema =
|
|
8541
|
-
caseId:
|
|
8542
|
-
trial:
|
|
8932
|
+
var EvalCaseResultSchema = import_zod71.z.object({
|
|
8933
|
+
caseId: import_zod71.z.string(),
|
|
8934
|
+
trial: import_zod71.z.number().int().nonnegative(),
|
|
8543
8935
|
// U1,online_sample 恒 0
|
|
8544
|
-
attempt:
|
|
8936
|
+
attempt: import_zod71.z.number().int().nonnegative(),
|
|
8545
8937
|
// 基础设施重试序
|
|
8546
|
-
sessionId:
|
|
8938
|
+
sessionId: import_zod71.z.string().optional(),
|
|
8547
8939
|
verdict: EvalCaseVerdictSchema,
|
|
8548
|
-
caseDefinitionDigest:
|
|
8940
|
+
caseDefinitionDigest: import_zod71.z.string(),
|
|
8549
8941
|
errorClass: EvalErrorClassSchema.optional(),
|
|
8550
8942
|
errorCode: EvalErrorCodeSchema.optional(),
|
|
8551
|
-
softMisses:
|
|
8552
|
-
softIncomplete:
|
|
8553
|
-
graders:
|
|
8554
|
-
resolvedRef:
|
|
8943
|
+
softMisses: import_zod71.z.array(import_zod71.z.string()),
|
|
8944
|
+
softIncomplete: import_zod71.z.array(import_zod71.z.string()),
|
|
8945
|
+
graders: import_zod71.z.array(GraderVerdictSchema),
|
|
8946
|
+
resolvedRef: import_zod71.z.string().optional()
|
|
8555
8947
|
// fixtures.workspace.ref → commit SHA
|
|
8556
8948
|
}).strict();
|
|
8557
|
-
var EvalRunSummarySchema =
|
|
8558
|
-
total:
|
|
8559
|
-
passed:
|
|
8560
|
-
failed:
|
|
8561
|
-
errored:
|
|
8562
|
-
gatePass:
|
|
8949
|
+
var EvalRunSummarySchema = import_zod71.z.object({
|
|
8950
|
+
total: import_zod71.z.number().int().nonnegative(),
|
|
8951
|
+
passed: import_zod71.z.number().int().nonnegative(),
|
|
8952
|
+
failed: import_zod71.z.number().int().nonnegative(),
|
|
8953
|
+
errored: import_zod71.z.number().int().nonnegative(),
|
|
8954
|
+
gatePass: import_zod71.z.boolean(),
|
|
8563
8955
|
// 正向断言:全部 case 的全部 gate grader 显式 passed
|
|
8564
8956
|
/**
|
|
8565
8957
|
* v1.2:本 run 参与门禁的 grader 总数。零 gate grader 时 `gatePass` 按「真空为真」
|
|
@@ -8567,116 +8959,116 @@ var EvalRunSummarySchema = import_zod68.z.object({
|
|
|
8567
8959
|
* 本字段让使用者一眼分辨「真的全部通过」与「压根没有门禁断言」。
|
|
8568
8960
|
* optional:老数据无此字段。
|
|
8569
8961
|
*/
|
|
8570
|
-
gateGraderCount:
|
|
8962
|
+
gateGraderCount: import_zod71.z.number().int().nonnegative().optional(),
|
|
8571
8963
|
/**
|
|
8572
8964
|
* v1.2:有多少 case 一个 gate grader 都没有(各自「真空为真」)。`gateGraderCount`
|
|
8573
8965
|
* 是 sum,只能答「全 run 有没有任何门禁断言」;本字段答「是否每个 case 都有」——
|
|
8574
8966
|
* `gatePass=true` 但本值 > 0 = 有 case 无门禁却被算作通过(case 级假绿)。optional:老数据无。
|
|
8575
8967
|
*/
|
|
8576
|
-
casesWithoutGateGrader:
|
|
8577
|
-
errorSummary:
|
|
8578
|
-
capabilityUnavailable:
|
|
8579
|
-
infrastructureError:
|
|
8968
|
+
casesWithoutGateGrader: import_zod71.z.number().int().nonnegative().optional(),
|
|
8969
|
+
errorSummary: import_zod71.z.object({
|
|
8970
|
+
capabilityUnavailable: import_zod71.z.number().int().nonnegative(),
|
|
8971
|
+
infrastructureError: import_zod71.z.number().int().nonnegative(),
|
|
8580
8972
|
/** v1.2:judge 未能给出结论(gate llm UNKNOWN)。optional:老数据无此字段。 */
|
|
8581
|
-
indeterminate:
|
|
8973
|
+
indeterminate: import_zod71.z.number().int().nonnegative().optional(),
|
|
8582
8974
|
/** v1.2:定义写错(自评防护 EVAL_SELF_EVAL_FORBIDDEN)。optional:老数据无此字段。 */
|
|
8583
|
-
invalidDefinition:
|
|
8975
|
+
invalidDefinition: import_zod71.z.number().int().nonnegative().optional()
|
|
8584
8976
|
}).loose().optional()
|
|
8585
8977
|
}).loose();
|
|
8586
8978
|
var EvalRunSummaryWriteSchema = EvalRunSummarySchema.extend({
|
|
8587
8979
|
errorSummary: EvalRunSummarySchema.shape.errorSummary.unwrap().strict().optional()
|
|
8588
8980
|
}).strict();
|
|
8589
|
-
var EvalSuiteRefSchema =
|
|
8590
|
-
source:
|
|
8591
|
-
digest:
|
|
8592
|
-
path:
|
|
8981
|
+
var EvalSuiteRefSchema = import_zod71.z.object({
|
|
8982
|
+
source: import_zod71.z.enum(["package", "repo"]),
|
|
8983
|
+
digest: import_zod71.z.string().min(1),
|
|
8984
|
+
path: import_zod71.z.string().min(1)
|
|
8593
8985
|
}).strict();
|
|
8594
|
-
var CreateEvalRunRequestSchema =
|
|
8595
|
-
agent:
|
|
8986
|
+
var CreateEvalRunRequestSchema = import_zod71.z.object({
|
|
8987
|
+
agent: import_zod71.z.string().min(1),
|
|
8596
8988
|
// A0 只打 test stage(§9 非目标:不做 prod 直评)。用 enum 而非 literal——
|
|
8597
8989
|
// 将来放开 staging/prod 时「enum 加值」是非破坏性变更,literal 变 enum 才是
|
|
8598
8990
|
// 破坏性变更(T1 评审建议,见设计文档 §2.1.6)。
|
|
8599
|
-
stage:
|
|
8991
|
+
stage: import_zod71.z.enum(["test"]),
|
|
8600
8992
|
suiteRef: EvalSuiteRefSchema.optional(),
|
|
8601
8993
|
// 缺省=目标 Revision 绑定的 suite
|
|
8602
|
-
caseIds:
|
|
8603
|
-
strict:
|
|
8994
|
+
caseIds: import_zod71.z.array(EvalSlugSchema).optional(),
|
|
8995
|
+
strict: import_zod71.z.boolean().optional()
|
|
8604
8996
|
}).strict();
|
|
8605
|
-
var CreateEvalRunResponseSchema =
|
|
8606
|
-
var CancelEvalRunResponseSchema =
|
|
8607
|
-
var EvalRunViewSchema =
|
|
8608
|
-
runId:
|
|
8997
|
+
var CreateEvalRunResponseSchema = import_zod71.z.object({ runId: import_zod71.z.string().min(1) }).strict();
|
|
8998
|
+
var CancelEvalRunResponseSchema = import_zod71.z.object({ runId: import_zod71.z.string().min(1), cancelled: import_zod71.z.boolean() }).strict();
|
|
8999
|
+
var EvalRunViewSchema = import_zod71.z.object({
|
|
9000
|
+
runId: import_zod71.z.string(),
|
|
8609
9001
|
status: EvalRunStatusSchema,
|
|
8610
|
-
agent:
|
|
8611
|
-
revisionId:
|
|
8612
|
-
stage:
|
|
9002
|
+
agent: import_zod71.z.string(),
|
|
9003
|
+
revisionId: import_zod71.z.string(),
|
|
9004
|
+
stage: import_zod71.z.string(),
|
|
8613
9005
|
suiteRef: EvalSuiteRefSchema,
|
|
8614
|
-
strict:
|
|
9006
|
+
strict: import_zod71.z.boolean(),
|
|
8615
9007
|
trigger: EvalTriggerSchema,
|
|
8616
|
-
startedAt:
|
|
8617
|
-
completedAt:
|
|
8618
|
-
cases:
|
|
9008
|
+
startedAt: import_zod71.z.string().optional(),
|
|
9009
|
+
completedAt: import_zod71.z.string().optional(),
|
|
9010
|
+
cases: import_zod71.z.array(EvalCaseResultSchema),
|
|
8619
9011
|
summary: EvalRunSummarySchema
|
|
8620
9012
|
}).strict();
|
|
8621
|
-
var EvalRunListItemSchema =
|
|
8622
|
-
runId:
|
|
9013
|
+
var EvalRunListItemSchema = import_zod71.z.object({
|
|
9014
|
+
runId: import_zod71.z.string(),
|
|
8623
9015
|
status: EvalRunStatusSchema,
|
|
8624
|
-
agent:
|
|
8625
|
-
revisionId:
|
|
8626
|
-
stage:
|
|
9016
|
+
agent: import_zod71.z.string(),
|
|
9017
|
+
revisionId: import_zod71.z.string(),
|
|
9018
|
+
stage: import_zod71.z.string(),
|
|
8627
9019
|
trigger: EvalTriggerSchema,
|
|
8628
|
-
startedAt:
|
|
8629
|
-
completedAt:
|
|
9020
|
+
startedAt: import_zod71.z.string().optional(),
|
|
9021
|
+
completedAt: import_zod71.z.string().optional(),
|
|
8630
9022
|
summary: EvalRunSummarySchema
|
|
8631
9023
|
}).strict();
|
|
8632
|
-
var EvalRunListResponseSchema =
|
|
8633
|
-
items:
|
|
8634
|
-
nextCursor:
|
|
9024
|
+
var EvalRunListResponseSchema = import_zod71.z.object({
|
|
9025
|
+
items: import_zod71.z.array(EvalRunListItemSchema),
|
|
9026
|
+
nextCursor: import_zod71.z.string().optional()
|
|
8635
9027
|
}).strict();
|
|
8636
9028
|
var PIPELINE_COMMIT_SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
8637
|
-
var CommitShaSchema =
|
|
9029
|
+
var CommitShaSchema = import_zod72.z.string().regex(PIPELINE_COMMIT_SHA_RE, {
|
|
8638
9030
|
message: "commitSha must be 7-64 hexadecimal characters"
|
|
8639
9031
|
});
|
|
8640
9032
|
var PIPELINE_FULL_COMMIT_SHA_RE = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i;
|
|
8641
|
-
var FullCommitShaSchema =
|
|
9033
|
+
var FullCommitShaSchema = import_zod72.z.string().regex(PIPELINE_FULL_COMMIT_SHA_RE, {
|
|
8642
9034
|
message: "commitSha must be a full 40- or 64-character hexadecimal SHA (short prefixes cannot anchor a release)"
|
|
8643
9035
|
});
|
|
8644
9036
|
var PIPELINE_TRIGGERED_REF_MAX_LENGTH = 512;
|
|
8645
|
-
var TriggeredRefSchema =
|
|
8646
|
-
var IsoTimestampSchema =
|
|
9037
|
+
var TriggeredRefSchema = import_zod72.z.string().min(1).max(PIPELINE_TRIGGERED_REF_MAX_LENGTH);
|
|
9038
|
+
var IsoTimestampSchema = import_zod72.z.string().datetime({ offset: true });
|
|
8647
9039
|
var NullableIsoTimestampSchema = IsoTimestampSchema.nullable();
|
|
8648
|
-
var PipelineTriggerSchema =
|
|
8649
|
-
var PipelineRunStatusSchema =
|
|
8650
|
-
var PipelineStepSchema =
|
|
8651
|
-
var PipelineStepStatusSchema =
|
|
8652
|
-
var PipelineErrorCodeSchema =
|
|
8653
|
-
var ListPipelineRunsQuerySchema =
|
|
8654
|
-
projectId:
|
|
8655
|
-
limit:
|
|
8656
|
-
}).strict();
|
|
8657
|
-
var NullableTriggeredRefSchema =
|
|
8658
|
-
var PipelineRunListItemSchema =
|
|
8659
|
-
id:
|
|
8660
|
-
commitSha:
|
|
8661
|
-
commitMessage:
|
|
9040
|
+
var PipelineTriggerSchema = import_zod72.z.enum(PIPELINE_TRIGGERS);
|
|
9041
|
+
var PipelineRunStatusSchema = import_zod72.z.enum(PIPELINE_RUN_STATUSES);
|
|
9042
|
+
var PipelineStepSchema = import_zod72.z.enum(PIPELINE_STEPS);
|
|
9043
|
+
var PipelineStepStatusSchema = import_zod72.z.enum(PIPELINE_STEP_STATUSES);
|
|
9044
|
+
var PipelineErrorCodeSchema = import_zod72.z.string().min(1).nullable();
|
|
9045
|
+
var ListPipelineRunsQuerySchema = import_zod72.z.object({
|
|
9046
|
+
projectId: import_zod72.z.string().uuid(),
|
|
9047
|
+
limit: import_zod72.z.coerce.number().int().min(1).max(200).default(50)
|
|
9048
|
+
}).strict();
|
|
9049
|
+
var NullableTriggeredRefSchema = import_zod72.z.string().nullable().optional();
|
|
9050
|
+
var PipelineRunListItemSchema = import_zod72.z.object({
|
|
9051
|
+
id: import_zod72.z.string().uuid(),
|
|
9052
|
+
commitSha: import_zod72.z.string(),
|
|
9053
|
+
commitMessage: import_zod72.z.string().nullable(),
|
|
8662
9054
|
trigger: PipelineTriggerSchema,
|
|
8663
9055
|
status: PipelineRunStatusSchema,
|
|
8664
|
-
stagesKey:
|
|
8665
|
-
attempt:
|
|
8666
|
-
agentSlugs:
|
|
8667
|
-
createdBy:
|
|
9056
|
+
stagesKey: import_zod72.z.string(),
|
|
9057
|
+
attempt: import_zod72.z.number().int().nonnegative(),
|
|
9058
|
+
agentSlugs: import_zod72.z.array(import_zod72.z.string()),
|
|
9059
|
+
createdBy: import_zod72.z.string().nullable(),
|
|
8668
9060
|
createdAt: IsoTimestampSchema,
|
|
8669
9061
|
startedAt: NullableIsoTimestampSchema,
|
|
8670
9062
|
completedAt: NullableIsoTimestampSchema,
|
|
8671
9063
|
errorCode: PipelineErrorCodeSchema,
|
|
8672
9064
|
triggeredRef: NullableTriggeredRefSchema
|
|
8673
9065
|
}).strict();
|
|
8674
|
-
var ListPipelineRunsResponseSchema =
|
|
8675
|
-
enabled:
|
|
8676
|
-
items:
|
|
9066
|
+
var ListPipelineRunsResponseSchema = import_zod72.z.object({
|
|
9067
|
+
enabled: import_zod72.z.boolean(),
|
|
9068
|
+
items: import_zod72.z.array(PipelineRunListItemSchema)
|
|
8677
9069
|
}).strict();
|
|
8678
|
-
var CreatePipelineRunRequestSchema =
|
|
8679
|
-
projectId:
|
|
9070
|
+
var CreatePipelineRunRequestSchema = import_zod72.z.object({
|
|
9071
|
+
projectId: import_zod72.z.string().uuid(),
|
|
8680
9072
|
commitSha: FullCommitShaSchema,
|
|
8681
9073
|
/**
|
|
8682
9074
|
* Explicit re-run: mint `attempt+1` even when the latest run for this
|
|
@@ -8685,7 +9077,7 @@ var CreatePipelineRunRequestSchema = import_zod69.z.object({
|
|
|
8685
9077
|
* against servers that predate it (`.strict()` on their side). Non-passed
|
|
8686
9078
|
* terminal runs re-run automatically without this flag (§4).
|
|
8687
9079
|
*/
|
|
8688
|
-
rerun:
|
|
9080
|
+
rerun: import_zod72.z.boolean().optional(),
|
|
8689
9081
|
/**
|
|
8690
9082
|
* The ref the caller resolved `commitSha` from, recorded for display only
|
|
8691
9083
|
* (see `TriggeredRefSchema`). Optional: a caller that has just a SHA and no
|
|
@@ -8698,54 +9090,54 @@ var CreatePipelineRunRequestSchema = import_zod69.z.object({
|
|
|
8698
9090
|
*/
|
|
8699
9091
|
triggeredRef: TriggeredRefSchema.optional()
|
|
8700
9092
|
}).strict();
|
|
8701
|
-
var CreatePipelineRunResponseSchema =
|
|
8702
|
-
runId:
|
|
8703
|
-
deduplicated:
|
|
8704
|
-
attempt:
|
|
9093
|
+
var CreatePipelineRunResponseSchema = import_zod72.z.object({
|
|
9094
|
+
runId: import_zod72.z.string().uuid(),
|
|
9095
|
+
deduplicated: import_zod72.z.boolean(),
|
|
9096
|
+
attempt: import_zod72.z.number().int().nonnegative().optional(),
|
|
8705
9097
|
status: PipelineRunStatusSchema.optional()
|
|
8706
9098
|
});
|
|
8707
|
-
var PipelineRunDetailRunSchema =
|
|
8708
|
-
id:
|
|
8709
|
-
projectId:
|
|
8710
|
-
repoUrl:
|
|
8711
|
-
commitSha:
|
|
8712
|
-
commitMessage:
|
|
9099
|
+
var PipelineRunDetailRunSchema = import_zod72.z.object({
|
|
9100
|
+
id: import_zod72.z.string().uuid(),
|
|
9101
|
+
projectId: import_zod72.z.string().uuid(),
|
|
9102
|
+
repoUrl: import_zod72.z.string(),
|
|
9103
|
+
commitSha: import_zod72.z.string(),
|
|
9104
|
+
commitMessage: import_zod72.z.string().nullable(),
|
|
8713
9105
|
trigger: PipelineTriggerSchema,
|
|
8714
9106
|
status: PipelineRunStatusSchema,
|
|
8715
|
-
stagesRequested:
|
|
8716
|
-
stagesKey:
|
|
8717
|
-
attempt:
|
|
8718
|
-
planJson:
|
|
9107
|
+
stagesRequested: import_zod72.z.array(PipelineStepSchema).nullable(),
|
|
9108
|
+
stagesKey: import_zod72.z.string(),
|
|
9109
|
+
attempt: import_zod72.z.number().int().nonnegative(),
|
|
9110
|
+
planJson: import_zod72.z.unknown().nullable(),
|
|
8719
9111
|
errorCode: PipelineErrorCodeSchema,
|
|
8720
|
-
errorMessage:
|
|
8721
|
-
createdBy:
|
|
9112
|
+
errorMessage: import_zod72.z.string().nullable(),
|
|
9113
|
+
createdBy: import_zod72.z.string().nullable(),
|
|
8722
9114
|
createdAt: IsoTimestampSchema,
|
|
8723
9115
|
startedAt: NullableIsoTimestampSchema,
|
|
8724
9116
|
completedAt: NullableIsoTimestampSchema,
|
|
8725
9117
|
triggeredRef: NullableTriggeredRefSchema
|
|
8726
9118
|
}).strict();
|
|
8727
|
-
var PipelineRunStepSchema =
|
|
9119
|
+
var PipelineRunStepSchema = import_zod72.z.object({
|
|
8728
9120
|
step: PipelineStepSchema,
|
|
8729
9121
|
status: PipelineStepStatusSchema,
|
|
8730
|
-
attempt:
|
|
8731
|
-
resultJson:
|
|
9122
|
+
attempt: import_zod72.z.number().int().nonnegative(),
|
|
9123
|
+
resultJson: import_zod72.z.unknown().nullable(),
|
|
8732
9124
|
errorCode: PipelineErrorCodeSchema,
|
|
8733
|
-
errorMessage:
|
|
9125
|
+
errorMessage: import_zod72.z.string().nullable(),
|
|
8734
9126
|
startedAt: NullableIsoTimestampSchema,
|
|
8735
9127
|
completedAt: NullableIsoTimestampSchema
|
|
8736
9128
|
}).strict();
|
|
8737
|
-
var PipelineRunWorkloadSchema =
|
|
8738
|
-
agentSlug:
|
|
8739
|
-
affectedReason:
|
|
8740
|
-
workloadId:
|
|
8741
|
-
revisionId:
|
|
8742
|
-
repointStatus:
|
|
8743
|
-
freezeStatus:
|
|
8744
|
-
frozenPackageOssUrl:
|
|
8745
|
-
frozenPackageSha256:
|
|
8746
|
-
frozenPackageWarnings:
|
|
8747
|
-
evalRunId:
|
|
8748
|
-
evalVerdict:
|
|
9129
|
+
var PipelineRunWorkloadSchema = import_zod72.z.object({
|
|
9130
|
+
agentSlug: import_zod72.z.string(),
|
|
9131
|
+
affectedReason: import_zod72.z.string().nullable(),
|
|
9132
|
+
workloadId: import_zod72.z.string().nullable(),
|
|
9133
|
+
revisionId: import_zod72.z.string().nullable(),
|
|
9134
|
+
repointStatus: import_zod72.z.string().nullable(),
|
|
9135
|
+
freezeStatus: import_zod72.z.string().nullable(),
|
|
9136
|
+
frozenPackageOssUrl: import_zod72.z.string().nullable(),
|
|
9137
|
+
frozenPackageSha256: import_zod72.z.string().nullable(),
|
|
9138
|
+
frozenPackageWarnings: import_zod72.z.array(import_zod72.z.string()).nullable(),
|
|
9139
|
+
evalRunId: import_zod72.z.string().nullable(),
|
|
9140
|
+
evalVerdict: import_zod72.z.string().nullable(),
|
|
8749
9141
|
/**
|
|
8750
9142
|
* joined | skipped_no_base_revision | skipped_no_image_change | failed.
|
|
8751
9143
|
*
|
|
@@ -8754,7 +9146,7 @@ var PipelineRunWorkloadSchema = import_zod69.z.object({
|
|
|
8754
9146
|
* so a client parsing a response from a control-plane that predates these
|
|
8755
9147
|
* fields must not throw. Absent and null both read as "not reported".
|
|
8756
9148
|
*/
|
|
8757
|
-
joinStatus:
|
|
9149
|
+
joinStatus: import_zod72.z.string().nullable().optional(),
|
|
8758
9150
|
/**
|
|
8759
9151
|
* Per-workload failure, so a client can say WHICH agent failed and why —
|
|
8760
9152
|
* the run/step level only ever counts failures. Deliberately NOT
|
|
@@ -8766,16 +9158,16 @@ var PipelineRunWorkloadSchema = import_zod69.z.object({
|
|
|
8766
9158
|
* `.max()`-ed here — a schema cap would upgrade "the error text is long"
|
|
8767
9159
|
* into "the whole response fails to parse".
|
|
8768
9160
|
*/
|
|
8769
|
-
errorCode:
|
|
8770
|
-
errorMessage:
|
|
9161
|
+
errorCode: import_zod72.z.string().nullable().optional(),
|
|
9162
|
+
errorMessage: import_zod72.z.string().nullable().optional()
|
|
8771
9163
|
}).strict();
|
|
8772
|
-
var PipelineRunDetailResponseSchema =
|
|
9164
|
+
var PipelineRunDetailResponseSchema = import_zod72.z.object({
|
|
8773
9165
|
run: PipelineRunDetailRunSchema,
|
|
8774
|
-
steps:
|
|
8775
|
-
workloads:
|
|
9166
|
+
steps: import_zod72.z.array(PipelineRunStepSchema),
|
|
9167
|
+
workloads: import_zod72.z.array(PipelineRunWorkloadSchema)
|
|
8776
9168
|
}).strict();
|
|
8777
|
-
var GetPipelinePlanQuerySchema =
|
|
8778
|
-
projectId:
|
|
9169
|
+
var GetPipelinePlanQuerySchema = import_zod72.z.object({
|
|
9170
|
+
projectId: import_zod72.z.string().uuid(),
|
|
8779
9171
|
commitSha: CommitShaSchema,
|
|
8780
9172
|
fromSha: CommitShaSchema.optional(),
|
|
8781
9173
|
/**
|
|
@@ -8783,20 +9175,20 @@ var GetPipelinePlanQuerySchema = import_zod69.z.object({
|
|
|
8783
9175
|
* Accepted as the STRING "false" because it arrives as a query param; any
|
|
8784
9176
|
* other value (including absent) means "compute if missing".
|
|
8785
9177
|
*/
|
|
8786
|
-
enqueue:
|
|
9178
|
+
enqueue: import_zod72.z.enum(["true", "false"]).optional().transform((value) => value !== "false")
|
|
8787
9179
|
}).strict();
|
|
8788
|
-
var PipelinePlanResponseSchema =
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
source:
|
|
8792
|
-
enqueued:
|
|
9180
|
+
var PipelinePlanResponseSchema = import_zod72.z.discriminatedUnion("source", [
|
|
9181
|
+
import_zod72.z.object({ source: import_zod72.z.literal("cache"), plan: import_zod72.z.unknown() }).strict(),
|
|
9182
|
+
import_zod72.z.object({
|
|
9183
|
+
source: import_zod72.z.literal("computing"),
|
|
9184
|
+
enqueued: import_zod72.z.boolean(),
|
|
8793
9185
|
// 上一次计算的失败摘要(若有)。默认 enqueue=true 会不断重算,plan 一直
|
|
8794
9186
|
// "computing" 时失败原本被吞——带上它让轮询者看到「在重试,但上次失败:…」
|
|
8795
9187
|
// 而不是无限"计算中"(#1346 D4)。
|
|
8796
9188
|
// 长度上游已有界(plan-cache fail() 落库前截断 2000),这里刻意不设
|
|
8797
9189
|
// .max():schema 硬上限会把"错误信息超长"升级成"整个响应 parse 失败",
|
|
8798
9190
|
// 让错误路径反过来炸掉主功能。
|
|
8799
|
-
lastError:
|
|
9191
|
+
lastError: import_zod72.z.string().nullable().optional()
|
|
8800
9192
|
}).strict()
|
|
8801
9193
|
]);
|
|
8802
9194
|
var PIPELINE_API_ERROR_CODES = [
|
|
@@ -8807,23 +9199,23 @@ var PIPELINE_API_ERROR_CODES = [
|
|
|
8807
9199
|
"PIPELINE_RUN_NOT_FOUND",
|
|
8808
9200
|
"PLAN_NOT_CACHED"
|
|
8809
9201
|
];
|
|
8810
|
-
var PipelineApiErrorCodeSchema =
|
|
9202
|
+
var PipelineApiErrorCodeSchema = import_zod72.z.enum(PIPELINE_API_ERROR_CODES);
|
|
8811
9203
|
var SKILL_NAME_MAX_LENGTH = 200;
|
|
8812
9204
|
var SKILL_SOURCE_REF_MAX_LENGTH = 512;
|
|
8813
9205
|
var SKILL_NAME_WHITELIST = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
8814
|
-
var SkillNameSchema =
|
|
9206
|
+
var SkillNameSchema = import_zod73.z.string().min(1).max(SKILL_NAME_MAX_LENGTH).refine((value) => SKILL_NAME_WHITELIST.test(value), {
|
|
8815
9207
|
message: "skill name must start with [A-Za-z0-9] and contain only [A-Za-z0-9._-] (no path separators, spaces or invisible characters)"
|
|
8816
9208
|
}).refine((value) => value !== "." && value !== "..", {
|
|
8817
9209
|
message: "skill name must not be '.' or '..'"
|
|
8818
9210
|
});
|
|
8819
|
-
var SkillSourceRefSchema =
|
|
8820
|
-
var SkillManifestSourceTypeSchema =
|
|
8821
|
-
var SkillsManifestDefaultsSchema =
|
|
8822
|
-
installDir:
|
|
8823
|
-
targetAgents:
|
|
8824
|
-
installMode:
|
|
9211
|
+
var SkillSourceRefSchema = import_zod73.z.string().min(1).max(SKILL_SOURCE_REF_MAX_LENGTH);
|
|
9212
|
+
var SkillManifestSourceTypeSchema = import_zod73.z.enum(["rush", "github", "gitlab"]);
|
|
9213
|
+
var SkillsManifestDefaultsSchema = import_zod73.z.object({
|
|
9214
|
+
installDir: import_zod73.z.string().min(1).max(SKILL_SOURCE_REF_MAX_LENGTH).optional(),
|
|
9215
|
+
targetAgents: import_zod73.z.array(import_zod73.z.string().min(1)).optional(),
|
|
9216
|
+
installMode: import_zod73.z.string().min(1).optional()
|
|
8825
9217
|
}).passthrough();
|
|
8826
|
-
var SkillsManifestSchema =
|
|
9218
|
+
var SkillsManifestSchema = import_zod73.z.object({
|
|
8827
9219
|
/**
|
|
8828
9220
|
* **必填,刻意不做 `.optional().default({})`**(评审提过,权衡后维持):
|
|
8829
9221
|
* 本 schema 是 passthrough 的,若 `skills` 可省略,一个拼错的顶层 key
|
|
@@ -8832,27 +9224,27 @@ var SkillsManifestSchema = import_zod70.z.object({
|
|
|
8832
9224
|
* 看到一条报错、补上 `"skills": {}`:响的、可恢复的。空清单请显式写
|
|
8833
9225
|
* `{"skills": {}}`(脚手架生成的就是这个形态)。
|
|
8834
9226
|
*/
|
|
8835
|
-
skills:
|
|
8836
|
-
registries:
|
|
9227
|
+
skills: import_zod73.z.record(SkillNameSchema, SkillSourceRefSchema),
|
|
9228
|
+
registries: import_zod73.z.record(import_zod73.z.string().min(1), import_zod73.z.string().min(1)).optional(),
|
|
8837
9229
|
defaults: SkillsManifestDefaultsSchema.optional()
|
|
8838
9230
|
}).passthrough();
|
|
8839
|
-
var SkillsLockEntrySchema =
|
|
8840
|
-
source:
|
|
9231
|
+
var SkillsLockEntrySchema = import_zod73.z.object({
|
|
9232
|
+
source: import_zod73.z.string().min(1).max(SKILL_SOURCE_REF_MAX_LENGTH),
|
|
8841
9233
|
/** 注册表源的精确版本;git 源这里是可读注记(实测常为 `main`)。 */
|
|
8842
|
-
version:
|
|
9234
|
+
version: import_zod73.z.string().optional(),
|
|
8843
9235
|
/** 浮动 ref 的人类可读注记——**绝不参与安装**(D23)。 */
|
|
8844
|
-
ref:
|
|
8845
|
-
resolved:
|
|
9236
|
+
ref: import_zod73.z.string().optional(),
|
|
9237
|
+
resolved: import_zod73.z.string().optional(),
|
|
8846
9238
|
/** git 源的钉死点。实测可能为 `""`(缺 commit),由校验层硬拒。 */
|
|
8847
|
-
commit:
|
|
8848
|
-
integrity:
|
|
8849
|
-
installedAt:
|
|
9239
|
+
commit: import_zod73.z.string().optional(),
|
|
9240
|
+
integrity: import_zod73.z.string().optional(),
|
|
9241
|
+
installedAt: import_zod73.z.string().optional()
|
|
8850
9242
|
}).passthrough();
|
|
8851
|
-
var SkillsLockSchema =
|
|
8852
|
-
lockfileVersion:
|
|
8853
|
-
skills:
|
|
9243
|
+
var SkillsLockSchema = import_zod73.z.object({
|
|
9244
|
+
lockfileVersion: import_zod73.z.number().int().nonnegative().optional(),
|
|
9245
|
+
skills: import_zod73.z.record(SkillNameSchema, SkillsLockEntrySchema)
|
|
8854
9246
|
}).passthrough();
|
|
8855
|
-
var SkillsManifestErrorCodeSchema =
|
|
9247
|
+
var SkillsManifestErrorCodeSchema = import_zod73.z.enum([
|
|
8856
9248
|
/** `skills.json` 语法/结构非法。 */
|
|
8857
9249
|
"SKILLS_MANIFEST_INVALID",
|
|
8858
9250
|
/** `skills.lock` 语法/结构非法。 */
|
|
@@ -8988,7 +9380,7 @@ var BindingsResource = class {
|
|
|
8988
9380
|
};
|
|
8989
9381
|
|
|
8990
9382
|
// src/resources/environments.ts
|
|
8991
|
-
var
|
|
9383
|
+
var import_zod74 = require("zod");
|
|
8992
9384
|
|
|
8993
9385
|
// src/agent-vocab.ts
|
|
8994
9386
|
function resolveExclusiveAlias(canonicalKey, canonicalValue, aliasKey, aliasValue) {
|
|
@@ -9012,24 +9404,24 @@ function attachAgentAliases(data) {
|
|
|
9012
9404
|
}
|
|
9013
9405
|
|
|
9014
9406
|
// src/resources/environments.ts
|
|
9015
|
-
var EnvironmentVersionHistorySchema =
|
|
9016
|
-
versions:
|
|
9017
|
-
repoints:
|
|
9407
|
+
var EnvironmentVersionHistorySchema = import_zod74.z.object({
|
|
9408
|
+
versions: import_zod74.z.array(EnvironmentVersionSchema),
|
|
9409
|
+
repoints: import_zod74.z.array(EnvironmentRepointRecordSchema)
|
|
9018
9410
|
}).strict();
|
|
9019
|
-
var RepointedSlotResultSchema =
|
|
9020
|
-
workloadId:
|
|
9411
|
+
var RepointedSlotResultSchema = import_zod74.z.object({
|
|
9412
|
+
workloadId: import_zod74.z.string().uuid(),
|
|
9021
9413
|
stage: StageSchema,
|
|
9022
|
-
fromVersion:
|
|
9414
|
+
fromVersion: import_zod74.z.number().int().positive().nullable()
|
|
9023
9415
|
}).strict();
|
|
9024
|
-
var RepointEnvironmentResultSchema =
|
|
9025
|
-
toVersion:
|
|
9026
|
-
repointedSlotCount:
|
|
9027
|
-
repointedSlots:
|
|
9416
|
+
var RepointEnvironmentResultSchema = import_zod74.z.object({
|
|
9417
|
+
toVersion: import_zod74.z.number().int().positive(),
|
|
9418
|
+
repointedSlotCount: import_zod74.z.number().int().nonnegative(),
|
|
9419
|
+
repointedSlots: import_zod74.z.array(RepointedSlotResultSchema)
|
|
9028
9420
|
}).strict();
|
|
9029
|
-
var UpdateEnvironmentResultSchema =
|
|
9421
|
+
var UpdateEnvironmentResultSchema = import_zod74.z.object({
|
|
9030
9422
|
environment: EnvironmentSchema,
|
|
9031
|
-
createdVersion:
|
|
9032
|
-
repointedSlotCount:
|
|
9423
|
+
createdVersion: import_zod74.z.number().int().positive().nullable(),
|
|
9424
|
+
repointedSlotCount: import_zod74.z.number().int().nonnegative()
|
|
9033
9425
|
}).strict();
|
|
9034
9426
|
function attachAgentAliasesToEach(items) {
|
|
9035
9427
|
return items.map((item) => attachAgentAliases(item));
|
|
@@ -9350,14 +9742,14 @@ var McpDevTicketsResource = class {
|
|
|
9350
9742
|
};
|
|
9351
9743
|
|
|
9352
9744
|
// src/resources/memories.ts
|
|
9353
|
-
var
|
|
9745
|
+
var import_zod75 = require("zod");
|
|
9354
9746
|
var ListedMemorySchema = AgentMemorySchema.extend({
|
|
9355
|
-
createdAt:
|
|
9356
|
-
updatedAt:
|
|
9747
|
+
createdAt: import_zod75.z.string(),
|
|
9748
|
+
updatedAt: import_zod75.z.string()
|
|
9357
9749
|
});
|
|
9358
|
-
var ListMemoriesResponseSchema =
|
|
9359
|
-
items:
|
|
9360
|
-
nextCursor:
|
|
9750
|
+
var ListMemoriesResponseSchema = import_zod75.z.object({
|
|
9751
|
+
items: import_zod75.z.array(ListedMemorySchema),
|
|
9752
|
+
nextCursor: import_zod75.z.string().nullish()
|
|
9361
9753
|
});
|
|
9362
9754
|
function parseEnvelopeData2(envelope, routeLabel, schema) {
|
|
9363
9755
|
if (envelope?.data === void 0) {
|
|
@@ -9828,7 +10220,7 @@ var ProjectsResource = class {
|
|
|
9828
10220
|
};
|
|
9829
10221
|
|
|
9830
10222
|
// src/resources/sessions.ts
|
|
9831
|
-
var
|
|
10223
|
+
var import_zod76 = require("zod");
|
|
9832
10224
|
function normalizeSessionRequest(request) {
|
|
9833
10225
|
const { agentId, versionId, ...rest } = request;
|
|
9834
10226
|
const workloadId = resolveExclusiveAlias("workloadId", rest.workloadId, "agentId", agentId);
|
|
@@ -9853,33 +10245,181 @@ function normalizeSessionRequest(request) {
|
|
|
9853
10245
|
...revisionId !== void 0 ? { revisionId } : {}
|
|
9854
10246
|
};
|
|
9855
10247
|
}
|
|
9856
|
-
var ListSessionEventsEnvelopeSchema =
|
|
9857
|
-
data:
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
10248
|
+
var ListSessionEventsEnvelopeSchema = import_zod76.z.object({
|
|
10249
|
+
data: import_zod76.z.object({
|
|
10250
|
+
events: import_zod76.z.array(SessionEventSchema),
|
|
10251
|
+
// Optional so a pre-P1 server's `{ events }` body still parses.
|
|
10252
|
+
hasMore: import_zod76.z.boolean().optional(),
|
|
10253
|
+
cursorReset: import_zod76.z.boolean().optional()
|
|
10254
|
+
})
|
|
10255
|
+
});
|
|
10256
|
+
var TurnListEnvelopeSchema = import_zod76.z.object({ data: TurnListResponseDataSchema });
|
|
10257
|
+
var TurnEnvelopeSchema = import_zod76.z.object({ data: TurnSchema });
|
|
10258
|
+
var DispatchOutcomeEnvelopeSchema = import_zod76.z.object({
|
|
10259
|
+
data: import_zod76.z.object({ outcome: DispatchOutcomeSchema })
|
|
10260
|
+
});
|
|
10261
|
+
var SendTurnTurnRefEnvelopeSchema = import_zod76.z.object({
|
|
10262
|
+
data: import_zod76.z.object({
|
|
10263
|
+
turn: import_zod76.z.object({ turnId: import_zod76.z.string(), status: TurnStatusSchema }).optional()
|
|
10264
|
+
})
|
|
10265
|
+
});
|
|
10266
|
+
var SessionRuntimeBindingEnvelopeSchema = import_zod76.z.object({
|
|
10267
|
+
runtimeBinding: import_zod76.z.object({ id: import_zod76.z.string().min(1) }).nullish()
|
|
10268
|
+
});
|
|
10269
|
+
var DeliveryResultEnvelopeSchema = import_zod76.z.object({
|
|
10270
|
+
data: import_zod76.z.object({ delivery: SessionDeliveryEnvelopeSchema.nullable() })
|
|
10271
|
+
});
|
|
10272
|
+
var SessionArtifactsListEnvelopeSchema = import_zod76.z.object({
|
|
10273
|
+
data: import_zod76.z.object({
|
|
10274
|
+
items: import_zod76.z.array(
|
|
10275
|
+
import_zod76.z.object({
|
|
10276
|
+
id: import_zod76.z.string(),
|
|
10277
|
+
artifactId: import_zod76.z.string().optional(),
|
|
10278
|
+
filename: import_zod76.z.string(),
|
|
10279
|
+
path: import_zod76.z.string(),
|
|
10280
|
+
contentType: import_zod76.z.string(),
|
|
10281
|
+
size: import_zod76.z.number(),
|
|
10282
|
+
turnId: import_zod76.z.string().optional(),
|
|
10283
|
+
messageId: import_zod76.z.string().optional()
|
|
9874
10284
|
})
|
|
9875
10285
|
),
|
|
9876
|
-
partial:
|
|
9877
|
-
skippedBundles:
|
|
10286
|
+
partial: import_zod76.z.boolean().optional(),
|
|
10287
|
+
skippedBundles: import_zod76.z.array(import_zod76.z.object({ artifactId: import_zod76.z.string(), reason: import_zod76.z.string() })).optional()
|
|
9878
10288
|
})
|
|
9879
10289
|
});
|
|
10290
|
+
var SessionTurnsResource = class {
|
|
10291
|
+
constructor(client, sessions) {
|
|
10292
|
+
this.client = client;
|
|
10293
|
+
this.sessions = sessions;
|
|
10294
|
+
}
|
|
10295
|
+
/**
|
|
10296
|
+
* `GET /api/sessions/:id/turns` — one keyset page of turns, newest first by
|
|
10297
|
+
* default. Requires scope `runs:stream`.
|
|
10298
|
+
*
|
|
10299
|
+
* Page forward with `after: nextCursor` / back with `before: prevCursor`;
|
|
10300
|
+
* there is no `page`/`offset`.
|
|
10301
|
+
*
|
|
10302
|
+
* "Forward" is relative to the ORDER YOU ASKED FOR, not to time: under the
|
|
10303
|
+
* default `order: "desc"` it means toward OLDER turns. `hasMore` describes
|
|
10304
|
+
* that same forward direction, so the loop that walks a whole history is
|
|
10305
|
+
* `after: nextCursor` until `hasMore` is false. Pairing `hasMore` with
|
|
10306
|
+
* `before`/`prevCursor` reads a flag about the direction you are NOT
|
|
10307
|
+
* walking and will not terminate correctly — `before` is for picking up
|
|
10308
|
+
* turns that arrived on the other side of your page, not for draining.
|
|
10309
|
+
*
|
|
10310
|
+
* `streamCursor` is the session's highest `__seq` and can be handed
|
|
10311
|
+
* straight to {@link SessionsResource.streamEvents} as `lastEventId` to
|
|
10312
|
+
* resume live streaming without replaying what this page already covers.
|
|
10313
|
+
*/
|
|
10314
|
+
async list(sessionId, options = {}) {
|
|
10315
|
+
const path = `/api/sessions/${encodeURIComponent(sessionId)}/turns`;
|
|
10316
|
+
const envelope = await this.client.request(path, {
|
|
10317
|
+
method: "GET",
|
|
10318
|
+
query: {
|
|
10319
|
+
limit: options.limit,
|
|
10320
|
+
order: options.order,
|
|
10321
|
+
before: options.before,
|
|
10322
|
+
after: options.after,
|
|
10323
|
+
status: options.status && options.status.length > 0 ? options.status.join(",") : void 0,
|
|
10324
|
+
revivalAttemptId: options.revivalAttemptId
|
|
10325
|
+
},
|
|
10326
|
+
signal: options.signal,
|
|
10327
|
+
cache: "no-store"
|
|
10328
|
+
});
|
|
10329
|
+
const parsed = TurnListEnvelopeSchema.safeParse(envelope);
|
|
10330
|
+
if (!parsed.success) {
|
|
10331
|
+
throw new PilotPlatformApiError({
|
|
10332
|
+
status: 0,
|
|
10333
|
+
code: "MALFORMED_PLATFORM_RESPONSE",
|
|
10334
|
+
message: `GET ${path} did not return a {data: {turns: [...]}} envelope.`,
|
|
10335
|
+
cause: parsed.error
|
|
10336
|
+
});
|
|
10337
|
+
}
|
|
10338
|
+
return parsed.data.data;
|
|
10339
|
+
}
|
|
10340
|
+
/**
|
|
10341
|
+
* `GET /api/sessions/:id/turns/:turnId` — one turn. Requires scope
|
|
10342
|
+
* `runs:stream`.
|
|
10343
|
+
*
|
|
10344
|
+
* Throws `PilotPlatformNotFoundError` with `code` `TURN_NOT_FOUND` (404)
|
|
10345
|
+
* for an id this session has no turn for. A prompt that is waiting on
|
|
10346
|
+
* Agent Recovery has NOT become a turn yet and reads as that same 404 —
|
|
10347
|
+
* check `sessions.get(id)`'s `pendingRevival` before treating it as a bad
|
|
10348
|
+
* id.
|
|
10349
|
+
*/
|
|
10350
|
+
async get(sessionId, turnId, options = {}) {
|
|
10351
|
+
const path = `/api/sessions/${encodeURIComponent(sessionId)}/turns/${encodeURIComponent(turnId)}`;
|
|
10352
|
+
const envelope = await this.client.request(path, {
|
|
10353
|
+
method: "GET",
|
|
10354
|
+
signal: options.signal,
|
|
10355
|
+
cache: "no-store"
|
|
10356
|
+
});
|
|
10357
|
+
const parsed = TurnEnvelopeSchema.safeParse(envelope);
|
|
10358
|
+
if (!parsed.success) {
|
|
10359
|
+
throw new PilotPlatformApiError({
|
|
10360
|
+
status: 0,
|
|
10361
|
+
code: "MALFORMED_PLATFORM_RESPONSE",
|
|
10362
|
+
message: `GET ${path} did not return a {data: <Turn>} envelope.`,
|
|
10363
|
+
cause: parsed.error
|
|
10364
|
+
});
|
|
10365
|
+
}
|
|
10366
|
+
return parsed.data.data;
|
|
10367
|
+
}
|
|
10368
|
+
/**
|
|
10369
|
+
* `POST /api/sessions/:id/abort` — ask the worker to stop `turnId`.
|
|
10370
|
+
* Requires scope **`runs:abort`** (not `runs:stream`, unlike every other
|
|
10371
|
+
* method here).
|
|
10372
|
+
*
|
|
10373
|
+
* Requires a control-plane that declares `tokenAudience: "agenthub"` on the
|
|
10374
|
+
* abort dispatch binding. Against an older one, an AgentHub token
|
|
10375
|
+
* (`aud=agenthub` — the only kind this SDK sends) is rejected with 403
|
|
10376
|
+
* `TOKEN_AUDIENCE_MISMATCH` before the scope check.
|
|
10377
|
+
*
|
|
10378
|
+
* Idempotent: the request key is derived from the session and turn, so
|
|
10379
|
+
* re-issuing it — including from the portal's Stop button — collapses onto
|
|
10380
|
+
* the one abort rather than stacking.
|
|
10381
|
+
*
|
|
10382
|
+
* The returned `DispatchOutcome` is the dispatch result, NOT proof the turn
|
|
10383
|
+
* stopped: a `rejected` / `transport_failed` outcome comes back as a VALUE
|
|
10384
|
+
* with 200 (branch on `outcome.kind`, and on `priorOutcome` for
|
|
10385
|
+
* `idempotent_replay`), and even an `accepted` abort only means the worker
|
|
10386
|
+
* received the signal. Whether it landed is read off the turn:
|
|
10387
|
+
* `(await turns.get(sessionId, turnId)).status === "aborted"`.
|
|
10388
|
+
*/
|
|
10389
|
+
async abort(sessionId, turnId, options = {}) {
|
|
10390
|
+
const runtimeBindingId = options.runtimeBindingId ?? await resolveRuntimeBindingId(this.sessions, sessionId, options.signal);
|
|
10391
|
+
const path = `/api/sessions/${encodeURIComponent(sessionId)}/abort`;
|
|
10392
|
+
const envelope = await this.client.request(path, {
|
|
10393
|
+
method: "POST",
|
|
10394
|
+
body: {
|
|
10395
|
+
// Byte-identical to the portal Stop button's key
|
|
10396
|
+
// (`use-session-revival.ts`), so a user click and an SDK abort for the
|
|
10397
|
+
// same turn dedupe against each other instead of racing.
|
|
10398
|
+
idempotencyKey: `abort:session:${sessionId}:turn:${turnId}`,
|
|
10399
|
+
session: { sessionId, runtimeBindingId },
|
|
10400
|
+
protocolVersion: "v1",
|
|
10401
|
+
turnId,
|
|
10402
|
+
reason: options.reason ?? { kind: "user" },
|
|
10403
|
+
trace: { traceId: newTraceId(), spanId: newTraceId() }
|
|
10404
|
+
},
|
|
10405
|
+
signal: options.signal
|
|
10406
|
+
});
|
|
10407
|
+
const parsed = DispatchOutcomeEnvelopeSchema.safeParse(envelope);
|
|
10408
|
+
if (!parsed.success) {
|
|
10409
|
+
throw new PilotPlatformApiError({
|
|
10410
|
+
status: 0,
|
|
10411
|
+
code: "MALFORMED_PLATFORM_RESPONSE",
|
|
10412
|
+
message: `POST ${path} did not return a {data: {outcome: ...}} envelope.`,
|
|
10413
|
+
cause: parsed.error
|
|
10414
|
+
});
|
|
10415
|
+
}
|
|
10416
|
+
return parsed.data.data.outcome;
|
|
10417
|
+
}
|
|
10418
|
+
};
|
|
9880
10419
|
var SessionsResource = class {
|
|
9881
10420
|
constructor(client) {
|
|
9882
10421
|
this.client = client;
|
|
10422
|
+
this.turns = new SessionTurnsResource(client, this);
|
|
9883
10423
|
}
|
|
9884
10424
|
async create(request, options = {}) {
|
|
9885
10425
|
const body = CreatePlatformSessionRequestSchema.parse(normalizeSessionRequest(request));
|
|
@@ -9897,6 +10437,11 @@ var SessionsResource = class {
|
|
|
9897
10437
|
method: "GET",
|
|
9898
10438
|
signal: options.signal,
|
|
9899
10439
|
cache: "no-store",
|
|
10440
|
+
// Omitted entirely (not sent as `include=`) unless explicitly
|
|
10441
|
+
// requested — see `GetSessionOptions.include`'s docstring.
|
|
10442
|
+
query: {
|
|
10443
|
+
include: options.include?.length ? options.include.join(",") : void 0
|
|
10444
|
+
},
|
|
9900
10445
|
headers: {
|
|
9901
10446
|
"Cache-Control": "no-cache",
|
|
9902
10447
|
Pragma: "no-cache"
|
|
@@ -9992,7 +10537,10 @@ var SessionsResource = class {
|
|
|
9992
10537
|
*
|
|
9993
10538
|
* Requires scope `runs:create`. The session must be `ready`
|
|
9994
10539
|
* (`sessions.wait`) and have no turn in flight — a prior running turn
|
|
9995
|
-
* throws `SESSION_TURN_IN_PROGRESS` (409), it is never queued.
|
|
10540
|
+
* throws `SESSION_TURN_IN_PROGRESS` (409), it is never queued. A turn sent
|
|
10541
|
+
* while an Agent Recovery started by someone else is running throws
|
|
10542
|
+
* `SESSION_REVIVING` (409): nothing was dispatched, so re-send it once
|
|
10543
|
+
* `lifecyclePhase` is back to `"active"` (see {@link SendTurnResult}).
|
|
9996
10544
|
*/
|
|
9997
10545
|
async sendTurn(sessionId, input, options = {}) {
|
|
9998
10546
|
const path = `/api/sessions/${encodeURIComponent(sessionId)}/turns`;
|
|
@@ -10018,16 +10566,15 @@ var SessionsResource = class {
|
|
|
10018
10566
|
return {
|
|
10019
10567
|
kind: "revival_in_progress",
|
|
10020
10568
|
attemptId: revival.attemptId,
|
|
10021
|
-
...revival.turnId !== void 0 && { turnId: revival.turnId }
|
|
10022
|
-
...revival.alreadyReviving !== void 0 && {
|
|
10023
|
-
alreadyReviving: revival.alreadyReviving
|
|
10024
|
-
}
|
|
10569
|
+
...revival.turnId !== void 0 && { turnId: revival.turnId }
|
|
10025
10570
|
};
|
|
10026
10571
|
}
|
|
10027
10572
|
const dispatched = SessionTurnDispatchedResponseSchema.parse(json);
|
|
10028
10573
|
const outcome = dispatched.data.outcome;
|
|
10029
10574
|
if (outcome.kind === "accepted" || outcome.kind === "idempotent_replay") {
|
|
10030
|
-
|
|
10575
|
+
const turnRef = SendTurnTurnRefEnvelopeSchema.safeParse(json);
|
|
10576
|
+
const turn = turnRef.success ? turnRef.data.data.turn : void 0;
|
|
10577
|
+
return { kind: outcome.kind, turnId: outcome.turnId, outcome, ...turn && { turn } };
|
|
10031
10578
|
}
|
|
10032
10579
|
throw new PilotPlatformApiError({
|
|
10033
10580
|
status: res.status,
|
|
@@ -10039,8 +10586,8 @@ var SessionsResource = class {
|
|
|
10039
10586
|
* `GET /api/sessions/:id/events` — cursor-paged read of the session event
|
|
10040
10587
|
* log (`worker_protocol.*` dispatch markers, `pilot_coder.chunk` streaming
|
|
10041
10588
|
* chunks, `agent.*` lifecycle events...). Requires scope `runs:stream`.
|
|
10042
|
-
* Poll with `afterEventId` = the last
|
|
10043
|
-
* oldest-first.
|
|
10589
|
+
* Poll with `afterEventId` = the `eventId` of the last event you have
|
|
10590
|
+
* (not its `id`); rows are returned oldest-first.
|
|
10044
10591
|
*/
|
|
10045
10592
|
async listEvents(sessionId, options = {}) {
|
|
10046
10593
|
const path = `/api/sessions/${encodeURIComponent(sessionId)}/events`;
|
|
@@ -10048,7 +10595,9 @@ var SessionsResource = class {
|
|
|
10048
10595
|
method: "GET",
|
|
10049
10596
|
query: {
|
|
10050
10597
|
afterEventId: options.afterEventId,
|
|
10051
|
-
limit: options.limit
|
|
10598
|
+
limit: options.limit,
|
|
10599
|
+
turnId: options.turnId,
|
|
10600
|
+
types: options.types && options.types.length > 0 ? options.types.join(",") : void 0
|
|
10052
10601
|
},
|
|
10053
10602
|
signal: options.signal,
|
|
10054
10603
|
cache: "no-store"
|
|
@@ -10062,7 +10611,8 @@ var SessionsResource = class {
|
|
|
10062
10611
|
cause: parsed.error
|
|
10063
10612
|
});
|
|
10064
10613
|
}
|
|
10065
|
-
|
|
10614
|
+
const { events, hasMore, cursorReset } = parsed.data.data;
|
|
10615
|
+
return attachPageFields(events, { hasMore, cursorReset });
|
|
10066
10616
|
}
|
|
10067
10617
|
/**
|
|
10068
10618
|
* `GET /api/sessions/:id/delivery-result` — the session-plane delivery
|
|
@@ -10368,21 +10918,39 @@ var SessionsResource = class {
|
|
|
10368
10918
|
}
|
|
10369
10919
|
}
|
|
10370
10920
|
/**
|
|
10371
|
-
* Convenience poller: after `sendTurn`, poll `
|
|
10372
|
-
*
|
|
10373
|
-
*
|
|
10374
|
-
*
|
|
10375
|
-
*
|
|
10376
|
-
*
|
|
10377
|
-
*
|
|
10378
|
-
*
|
|
10379
|
-
*
|
|
10380
|
-
*
|
|
10381
|
-
*
|
|
10382
|
-
*
|
|
10383
|
-
*
|
|
10384
|
-
*
|
|
10385
|
-
*
|
|
10921
|
+
* Convenience poller: after `sendTurn`, poll the TURN (`turns.get`) until
|
|
10922
|
+
* its `status` is terminal, then resolve with the turn and — when one
|
|
10923
|
+
* exists — its terminal worker-protocol event.
|
|
10924
|
+
*
|
|
10925
|
+
* It polls the turn rather than draining `listEvents` because the cost of
|
|
10926
|
+
* the old form scaled with the CONVERSATION, not with the wait: a session
|
|
10927
|
+
* with thousands of streamed chunk rows spent its first polls paging
|
|
10928
|
+
* through history it did not care about, and an `interrupted` turn (worker
|
|
10929
|
+
* died, so no terminal event was ever written) could only ever time out.
|
|
10930
|
+
* A turn's status answers both in one request.
|
|
10931
|
+
*
|
|
10932
|
+
* `terminalEvent` is fetched with a SINGLE `listEvents` call after the
|
|
10933
|
+
* status settles, windowed to this turn and to the terminal event types —
|
|
10934
|
+
* it stays on the result because callers read its payload (e.g.
|
|
10935
|
+
* `completedAt`, which {@link exportWorkspace} needs). It is `undefined`
|
|
10936
|
+
* for an `interrupted` turn, which by construction has no terminal event.
|
|
10937
|
+
*
|
|
10938
|
+
* A 404 `TURN_NOT_FOUND` in the first {@link TURN_VISIBILITY_GRACE_MS} is
|
|
10939
|
+
* treated as "the turn row has not materialized yet" and retried — the
|
|
10940
|
+
* canonical call is `waitForTurn(id, sendTurn(...).turnId)`, and the turn
|
|
10941
|
+
* projection is not guaranteed to have run by the time that returns. After
|
|
10942
|
+
* the grace window the 404 is rethrown UNCHANGED, so a wrong turn id
|
|
10943
|
+
* surfaces as `TURN_NOT_FOUND` within seconds instead of costing the full
|
|
10944
|
+
* (10-minute) deadline.
|
|
10945
|
+
*
|
|
10946
|
+
* **Agent Recovery does not count against that grace.** After a 202
|
|
10947
|
+
* `revival_in_progress`, the prompt is replayed server-side and its turn row
|
|
10948
|
+
* only exists once the replay lands — minutes, not seconds. So on a 404 the
|
|
10949
|
+
* wait asks `sessions.get`: while `pendingRevival` is non-null (or
|
|
10950
|
+
* `lifecyclePhase` is `"reviving"`) the grace window is restarted rather
|
|
10951
|
+
* than consumed, and polling continues until the replay materializes. Only
|
|
10952
|
+
* the overall `timeoutMs` bounds that; a session NOT reviving keeps the
|
|
10953
|
+
* plain 30s behavior.
|
|
10386
10954
|
*
|
|
10387
10955
|
* Throws `SESSION_TURN_WAIT_TIMEOUT` on deadline (default 10 min; managed
|
|
10388
10956
|
* agent turns are long tasks, raise `timeoutMs` for longer runs).
|
|
@@ -10390,31 +10958,37 @@ var SessionsResource = class {
|
|
|
10390
10958
|
async waitForTurn(sessionId, turnId, options = {}) {
|
|
10391
10959
|
const intervalMs = options.intervalMs ?? 1e3;
|
|
10392
10960
|
const timeoutMs = options.timeoutMs ?? 6e5;
|
|
10393
|
-
const pageLimit = 200;
|
|
10394
10961
|
const startedAt = Date.now();
|
|
10395
|
-
|
|
10396
|
-
let
|
|
10962
|
+
const graceMs = Math.min(TURN_VISIBILITY_GRACE_MS, timeoutMs);
|
|
10963
|
+
let graceDeadline = startedAt + graceMs;
|
|
10397
10964
|
while (true) {
|
|
10398
10965
|
if (options.signal?.aborted) throw options.signal.reason;
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
if (
|
|
10407
|
-
|
|
10408
|
-
continue;
|
|
10409
|
-
if (payloadTurnId === turnId) {
|
|
10410
|
-
return { terminalEvent: event };
|
|
10966
|
+
let turn;
|
|
10967
|
+
try {
|
|
10968
|
+
turn = await this.turns.get(sessionId, turnId, { signal: options.signal });
|
|
10969
|
+
} catch (error) {
|
|
10970
|
+
if (!isTurnNotFound(error)) throw error;
|
|
10971
|
+
if (await isRevivalPending(this, sessionId, options.signal)) {
|
|
10972
|
+
graceDeadline = Date.now() + graceMs;
|
|
10973
|
+
} else if (Date.now() >= graceDeadline) {
|
|
10974
|
+
throw error;
|
|
10411
10975
|
}
|
|
10412
|
-
if ((
|
|
10413
|
-
|
|
10976
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
10977
|
+
throw new PilotPlatformApiError({
|
|
10978
|
+
status: 0,
|
|
10979
|
+
code: "SESSION_TURN_WAIT_TIMEOUT",
|
|
10980
|
+
message: `Timed out waiting for turn ${turnId} of session ${sessionId} to appear; the session was still recovering.`
|
|
10981
|
+
});
|
|
10414
10982
|
}
|
|
10983
|
+
await sleep(intervalMs, options.signal);
|
|
10984
|
+
continue;
|
|
10985
|
+
}
|
|
10986
|
+
if (isTerminalTurnStatus(turn.status)) {
|
|
10987
|
+
return {
|
|
10988
|
+
terminalEvent: await fetchTerminalEvent(this, sessionId, turnId, options.signal),
|
|
10989
|
+
turn
|
|
10990
|
+
};
|
|
10415
10991
|
}
|
|
10416
|
-
const last = events[events.length - 1];
|
|
10417
|
-
if (last) cursor = last.id;
|
|
10418
10992
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
10419
10993
|
throw new PilotPlatformApiError({
|
|
10420
10994
|
status: 0,
|
|
@@ -10422,7 +10996,6 @@ var SessionsResource = class {
|
|
|
10422
10996
|
message: `Timed out waiting for turn ${turnId} of session ${sessionId} to terminate.`
|
|
10423
10997
|
});
|
|
10424
10998
|
}
|
|
10425
|
-
if (events.length === pageLimit) continue;
|
|
10426
10999
|
await sleep(intervalMs, options.signal);
|
|
10427
11000
|
}
|
|
10428
11001
|
}
|
|
@@ -10464,7 +11037,71 @@ async function* parseSseFrames(body, signal) {
|
|
|
10464
11037
|
});
|
|
10465
11038
|
}
|
|
10466
11039
|
}
|
|
11040
|
+
var TURN_VISIBILITY_GRACE_MS = 3e4;
|
|
11041
|
+
function isTurnNotFound(error) {
|
|
11042
|
+
return error instanceof PilotPlatformApiError && error.code === "TURN_NOT_FOUND";
|
|
11043
|
+
}
|
|
11044
|
+
var SessionRevivalStateSchema = import_zod76.z.object({
|
|
11045
|
+
pendingRevival: import_zod76.z.object({ attemptId: import_zod76.z.string() }).nullish(),
|
|
11046
|
+
session: import_zod76.z.object({ lifecyclePhase: import_zod76.z.string().nullish() }).loose().optional()
|
|
11047
|
+
});
|
|
11048
|
+
async function isRevivalPending(sessions, sessionId, signal) {
|
|
11049
|
+
let snapshot;
|
|
11050
|
+
try {
|
|
11051
|
+
snapshot = await sessions.get(sessionId, { signal });
|
|
11052
|
+
} catch (error) {
|
|
11053
|
+
if (signal?.aborted) throw error;
|
|
11054
|
+
return false;
|
|
11055
|
+
}
|
|
11056
|
+
const parsed = SessionRevivalStateSchema.safeParse(snapshot);
|
|
11057
|
+
if (!parsed.success) return false;
|
|
11058
|
+
return (parsed.data.pendingRevival ?? null) !== null || parsed.data.session?.lifecyclePhase === "reviving";
|
|
11059
|
+
}
|
|
11060
|
+
async function fetchTerminalEvent(sessions, sessionId, turnId, signal) {
|
|
11061
|
+
let events;
|
|
11062
|
+
try {
|
|
11063
|
+
events = await sessions.listEvents(sessionId, {
|
|
11064
|
+
turnId,
|
|
11065
|
+
types: [...WORKER_PROTOCOL_TERMINAL_EVENT_TYPES],
|
|
11066
|
+
limit: 10,
|
|
11067
|
+
signal
|
|
11068
|
+
});
|
|
11069
|
+
} catch (error) {
|
|
11070
|
+
if (!isTurnNotFound(error)) throw error;
|
|
11071
|
+
return void 0;
|
|
11072
|
+
}
|
|
11073
|
+
const terminals = events.filter(
|
|
11074
|
+
(event) => WORKER_PROTOCOL_TERMINAL_EVENT_TYPES.includes(event.eventType)
|
|
11075
|
+
);
|
|
11076
|
+
return terminals[terminals.length - 1];
|
|
11077
|
+
}
|
|
11078
|
+
function attachPageFields(events, fields) {
|
|
11079
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
11080
|
+
if (value === void 0) continue;
|
|
11081
|
+
Object.defineProperty(events, key, { value, enumerable: false, configurable: true });
|
|
11082
|
+
}
|
|
11083
|
+
return events;
|
|
11084
|
+
}
|
|
11085
|
+
async function resolveRuntimeBindingId(sessions, sessionId, signal) {
|
|
11086
|
+
const snapshot = await sessions.get(sessionId, { signal });
|
|
11087
|
+
const parsed = SessionRuntimeBindingEnvelopeSchema.safeParse(snapshot);
|
|
11088
|
+
const runtimeBindingId = parsed.success ? parsed.data.runtimeBinding?.id ?? void 0 : void 0;
|
|
11089
|
+
if (!runtimeBindingId) {
|
|
11090
|
+
throw new PilotPlatformApiError({
|
|
11091
|
+
status: 0,
|
|
11092
|
+
code: "RUNTIME_BINDING_NOT_READY",
|
|
11093
|
+
message: `Session ${sessionId} has no active runtime binding; there is no worker to abort.`
|
|
11094
|
+
});
|
|
11095
|
+
}
|
|
11096
|
+
return runtimeBindingId;
|
|
11097
|
+
}
|
|
11098
|
+
function newTraceId() {
|
|
11099
|
+
const cryptoImpl = globalThis.crypto;
|
|
11100
|
+
if (typeof cryptoImpl?.randomUUID === "function") return cryptoImpl.randomUUID();
|
|
11101
|
+
return `sdk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
11102
|
+
}
|
|
10467
11103
|
function sleep(ms, signal) {
|
|
11104
|
+
if (signal?.aborted) return Promise.reject(signal.reason);
|
|
10468
11105
|
if (ms <= 0) return Promise.resolve();
|
|
10469
11106
|
return new Promise((resolve, reject) => {
|
|
10470
11107
|
const timer = setTimeout(resolve, ms);
|
|
@@ -10480,11 +11117,11 @@ function sleep(ms, signal) {
|
|
|
10480
11117
|
}
|
|
10481
11118
|
|
|
10482
11119
|
// src/resources/workloads.ts
|
|
10483
|
-
var
|
|
10484
|
-
var CanaryPromoteResponseSchema =
|
|
11120
|
+
var import_zod77 = require("zod");
|
|
11121
|
+
var CanaryPromoteResponseSchema = import_zod77.z.object({
|
|
10485
11122
|
slot: StageSlotViewSchema,
|
|
10486
|
-
fromRevisionId:
|
|
10487
|
-
toRevisionId:
|
|
11123
|
+
fromRevisionId: import_zod77.z.string().uuid(),
|
|
11124
|
+
toRevisionId: import_zod77.z.string().uuid()
|
|
10488
11125
|
}).strict();
|
|
10489
11126
|
var WorkloadStageCanaryResource = class {
|
|
10490
11127
|
constructor(client) {
|
|
@@ -11138,6 +11775,40 @@ function mergeSignals(...signals) {
|
|
|
11138
11775
|
}
|
|
11139
11776
|
return controller.signal;
|
|
11140
11777
|
}
|
|
11778
|
+
|
|
11779
|
+
// src/ui-messages.ts
|
|
11780
|
+
function toUIMessages(turns) {
|
|
11781
|
+
const messages = [];
|
|
11782
|
+
for (const turn of [...turns].sort(compareByDispatch)) {
|
|
11783
|
+
const userMessage = {
|
|
11784
|
+
id: turn.user.messageId,
|
|
11785
|
+
role: "user",
|
|
11786
|
+
parts: [{ type: "text", text: turn.user.text }]
|
|
11787
|
+
};
|
|
11788
|
+
if (turn.user.attachments.length > 0) {
|
|
11789
|
+
userMessage.metadata = { attachments: turn.user.attachments };
|
|
11790
|
+
}
|
|
11791
|
+
messages.push(userMessage);
|
|
11792
|
+
if (turn.assistant === null) continue;
|
|
11793
|
+
const assistantMessage = {
|
|
11794
|
+
id: turn.assistant.messageId,
|
|
11795
|
+
role: "assistant",
|
|
11796
|
+
parts: turn.assistant.parts
|
|
11797
|
+
};
|
|
11798
|
+
if (turn.assistant.state === "truncated") {
|
|
11799
|
+
assistantMessage.metadata = { truncated: true };
|
|
11800
|
+
}
|
|
11801
|
+
messages.push(assistantMessage);
|
|
11802
|
+
}
|
|
11803
|
+
return messages;
|
|
11804
|
+
}
|
|
11805
|
+
function compareByDispatch(a, b) {
|
|
11806
|
+
const aTime = Date.parse(a.dispatchedAt);
|
|
11807
|
+
const bTime = Date.parse(b.dispatchedAt);
|
|
11808
|
+
const byTime = Number.isNaN(aTime) || Number.isNaN(bTime) ? a.dispatchedAt.localeCompare(b.dispatchedAt) : aTime - bTime;
|
|
11809
|
+
if (byTime !== 0) return byTime;
|
|
11810
|
+
return a.turnId.localeCompare(b.turnId);
|
|
11811
|
+
}
|
|
11141
11812
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11142
11813
|
0 && (module.exports = {
|
|
11143
11814
|
AGENTHUB_SDK_USER_AGENT,
|
|
@@ -11220,10 +11891,20 @@ function mergeSignals(...signals) {
|
|
|
11220
11891
|
SessionFileResourceSchema,
|
|
11221
11892
|
SessionMemorySubjectDeclarationSchema,
|
|
11222
11893
|
SessionResourcesSchema,
|
|
11894
|
+
SessionTurnsResource,
|
|
11223
11895
|
SessionsResource,
|
|
11224
11896
|
StageSchema,
|
|
11225
11897
|
StageSlotViewSchema,
|
|
11226
11898
|
StoredMemorySubjectPolicySchema,
|
|
11899
|
+
TERMINAL_TURN_STATUSES,
|
|
11900
|
+
TURN_LIST_DEFAULT_LIMIT,
|
|
11901
|
+
TURN_LIST_MAX_LIMIT,
|
|
11902
|
+
TurnAssistantPartSchema,
|
|
11903
|
+
TurnKindSchema,
|
|
11904
|
+
TurnListQuerySchema,
|
|
11905
|
+
TurnListResponseDataSchema,
|
|
11906
|
+
TurnSchema,
|
|
11907
|
+
TurnStatusSchema,
|
|
11227
11908
|
UpdateEnvironmentInputSchema,
|
|
11228
11909
|
WorkbenchDTOSchema,
|
|
11229
11910
|
WorkloadStageCanaryResource,
|
|
@@ -11233,8 +11914,11 @@ function mergeSignals(...signals) {
|
|
|
11233
11914
|
WriteMemoriesRequestSchema,
|
|
11234
11915
|
WriteMemoriesResultSchema,
|
|
11235
11916
|
WriteMemoryItemSchema,
|
|
11917
|
+
isTerminalTurnStatus,
|
|
11236
11918
|
pilotPlatformErrorFromResponse,
|
|
11237
11919
|
platformRevisionPublishToManifest,
|
|
11238
|
-
platformWorkloadCreateToManifest
|
|
11920
|
+
platformWorkloadCreateToManifest,
|
|
11921
|
+
toUIMessages,
|
|
11922
|
+
turnMessageIds
|
|
11239
11923
|
});
|
|
11240
11924
|
//# sourceMappingURL=index.cjs.map
|