@autohq/cli 0.1.301 → 0.1.303
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/agent-bridge.js +416 -326
- package/dist/index.js +736 -645
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18884,223 +18884,572 @@ var init_session_diagnostics = __esm({
|
|
|
18884
18884
|
}
|
|
18885
18885
|
});
|
|
18886
18886
|
|
|
18887
|
-
// ../../packages/schemas/src/
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18887
|
+
// ../../packages/schemas/src/singleton-refresh.ts
|
|
18888
|
+
var SINGLETON_RESPAWN_REASONS, SingletonRespawnReasonSchema, SingletonRespawnSchema, SingletonRefreshEventPayloadSchema;
|
|
18889
|
+
var init_singleton_refresh = __esm({
|
|
18890
|
+
"../../packages/schemas/src/singleton-refresh.ts"() {
|
|
18891
|
+
"use strict";
|
|
18892
|
+
init_zod();
|
|
18893
|
+
SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
|
|
18894
|
+
SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
|
|
18895
|
+
SingletonRespawnSchema = external_exports.object({
|
|
18896
|
+
reason: SingletonRespawnReasonSchema.default("refresh")
|
|
18897
|
+
}).strict();
|
|
18898
|
+
SingletonRefreshEventPayloadSchema = external_exports.object({
|
|
18899
|
+
trigger: external_exports.literal("agent.refresh"),
|
|
18900
|
+
refresh: external_exports.object({
|
|
18901
|
+
reason: SingletonRespawnReasonSchema,
|
|
18902
|
+
agentResourceId: external_exports.string().trim().min(1),
|
|
18903
|
+
previousSessionId: external_exports.string().trim().min(1)
|
|
18904
|
+
})
|
|
18905
|
+
});
|
|
18906
|
+
}
|
|
18907
|
+
});
|
|
18908
|
+
|
|
18909
|
+
// ../../packages/schemas/src/session-commands.ts
|
|
18910
|
+
var SESSION_COMMAND_KINDS, SESSION_DISPATCH_COMMAND_KINDS, SESSION_PERSISTED_COMMAND_KINDS, SESSION_LIFECYCLE_COMMAND_KINDS, SESSION_COMMAND_STATUSES, SESSION_DISPATCH_COMMAND_STATUSES, SessionCommandKindSchema, SessionPersistedCommandKindSchema, SessionDispatchCommandKindSchema, RunLifecycleCommandKindSchema, SessionCommandStatusSchema, SessionDispatchCommandStatusSchema, SessionCommandSenderSchema, MESSAGE_DELIVERY_MODES, MessageDeliveryModeSchema, TRIGGER_INJECTION_MODALITIES, TriggerInjectionModalitySchema, RunMessageCommandPayloadSchema, RunAnswerCommandPayloadSchema, RunLifecycleCommandPayloadSchema, RunStopCommandPayloadSchema, SessionCommandPayloadSchema, CreateRunMessageCommandRequestSchema, CreateRunAnswerCommandRequestSchema, CreateRunLifecycleCommandRequestSchema, CreateRunStopCommandRequestSchema, CreateSessionCommandRequestSchema, RunResolutionPolicySchema, AgentAddressedCommandTargetSchema, SessionCommandRecordBaseSchema, RunStartCommandPayloadSchema, RunStartWithMessageCommandPayloadSchema, SessionPersistedCommandPayloadSchema, SessionCommandRecordSchema, SessionDispatchMessageCommandPayloadSchema, SessionDispatchAnswerCommandPayloadSchema, SessionDispatchStopCommandPayloadSchema, SessionDispatchCommandPayloadSchema, SessionDispatchCommandRecordBaseSchema, SessionDispatchCommandRecordSchema;
|
|
18911
|
+
var init_session_commands = __esm({
|
|
18912
|
+
"../../packages/schemas/src/session-commands.ts"() {
|
|
18896
18913
|
"use strict";
|
|
18897
18914
|
init_zod();
|
|
18898
|
-
init_agents();
|
|
18899
18915
|
init_auth();
|
|
18900
|
-
init_environments();
|
|
18901
18916
|
init_ids();
|
|
18902
18917
|
init_primitives();
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
"
|
|
18906
|
-
"
|
|
18907
|
-
"
|
|
18908
|
-
"
|
|
18909
|
-
"
|
|
18918
|
+
init_singleton_refresh();
|
|
18919
|
+
SESSION_COMMAND_KINDS = [
|
|
18920
|
+
"message",
|
|
18921
|
+
"answer",
|
|
18922
|
+
"pause",
|
|
18923
|
+
"resume",
|
|
18924
|
+
"interrupt",
|
|
18925
|
+
"cancel",
|
|
18926
|
+
"stop"
|
|
18910
18927
|
];
|
|
18911
|
-
|
|
18912
|
-
"
|
|
18913
|
-
"
|
|
18914
|
-
"
|
|
18915
|
-
"
|
|
18916
|
-
"
|
|
18928
|
+
SESSION_DISPATCH_COMMAND_KINDS = [
|
|
18929
|
+
"start",
|
|
18930
|
+
"startWithMessage",
|
|
18931
|
+
"message",
|
|
18932
|
+
"answer",
|
|
18933
|
+
"stop"
|
|
18917
18934
|
];
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
"
|
|
18923
|
-
"
|
|
18935
|
+
SESSION_PERSISTED_COMMAND_KINDS = [
|
|
18936
|
+
"message",
|
|
18937
|
+
"pause",
|
|
18938
|
+
"resume",
|
|
18939
|
+
"interrupt",
|
|
18940
|
+
"cancel",
|
|
18941
|
+
"stop",
|
|
18942
|
+
"start",
|
|
18943
|
+
"startWithMessage",
|
|
18944
|
+
"answer"
|
|
18945
|
+
];
|
|
18946
|
+
SESSION_LIFECYCLE_COMMAND_KINDS = [
|
|
18947
|
+
"pause",
|
|
18948
|
+
"resume",
|
|
18949
|
+
"interrupt",
|
|
18950
|
+
"cancel",
|
|
18951
|
+
"stop"
|
|
18952
|
+
];
|
|
18953
|
+
SESSION_COMMAND_STATUSES = [
|
|
18954
|
+
"pending",
|
|
18955
|
+
"dispatching",
|
|
18956
|
+
"accepted",
|
|
18924
18957
|
"failed"
|
|
18925
18958
|
];
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
AmbientStatusSchema = external_exports.string().trim().min(1);
|
|
18932
|
-
SESSION_CHECK_STATUSES = [
|
|
18933
|
-
"queued",
|
|
18934
|
-
"in_progress",
|
|
18935
|
-
"completed"
|
|
18959
|
+
SESSION_DISPATCH_COMMAND_STATUSES = [
|
|
18960
|
+
"pending",
|
|
18961
|
+
"dispatching",
|
|
18962
|
+
"accepted",
|
|
18963
|
+
"failed"
|
|
18936
18964
|
];
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
SessionCheckConclusionSchema = external_exports.enum(SESSION_CHECK_CONCLUSIONS);
|
|
18941
|
-
SessionCheckTimeoutPhaseSchema = external_exports.enum(
|
|
18942
|
-
SESSION_CHECK_TIMEOUT_PHASES
|
|
18965
|
+
SessionCommandKindSchema = external_exports.enum(SESSION_COMMAND_KINDS);
|
|
18966
|
+
SessionPersistedCommandKindSchema = external_exports.enum(
|
|
18967
|
+
SESSION_PERSISTED_COMMAND_KINDS
|
|
18943
18968
|
);
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18969
|
+
SessionDispatchCommandKindSchema = external_exports.enum(
|
|
18970
|
+
SESSION_DISPATCH_COMMAND_KINDS
|
|
18971
|
+
);
|
|
18972
|
+
RunLifecycleCommandKindSchema = external_exports.enum(
|
|
18973
|
+
SESSION_LIFECYCLE_COMMAND_KINDS
|
|
18974
|
+
);
|
|
18975
|
+
SessionCommandStatusSchema = external_exports.enum(SESSION_COMMAND_STATUSES);
|
|
18976
|
+
SessionDispatchCommandStatusSchema = external_exports.enum(
|
|
18977
|
+
SESSION_DISPATCH_COMMAND_STATUSES
|
|
18978
|
+
);
|
|
18979
|
+
SessionCommandSenderSchema = external_exports.discriminatedUnion("type", [
|
|
18980
|
+
external_exports.object({
|
|
18981
|
+
type: external_exports.literal("operator"),
|
|
18982
|
+
id: external_exports.string().trim().min(1).nullable().default(null),
|
|
18983
|
+
actor: AuthActorSchema.nullable().optional()
|
|
18984
|
+
}),
|
|
18985
|
+
external_exports.object({
|
|
18986
|
+
type: external_exports.literal("agent"),
|
|
18987
|
+
sessionId: SessionIdSchema
|
|
18988
|
+
}),
|
|
18989
|
+
external_exports.object({
|
|
18990
|
+
type: external_exports.literal("system")
|
|
18991
|
+
})
|
|
18992
|
+
]);
|
|
18993
|
+
MESSAGE_DELIVERY_MODES = ["interrupt", "deferred"];
|
|
18994
|
+
MessageDeliveryModeSchema = external_exports.enum(MESSAGE_DELIVERY_MODES);
|
|
18995
|
+
TRIGGER_INJECTION_MODALITIES = [
|
|
18996
|
+
"chat",
|
|
18997
|
+
"githubCheck",
|
|
18998
|
+
"githubCheckAction",
|
|
18999
|
+
"githubPullRequest",
|
|
19000
|
+
"other"
|
|
19001
|
+
];
|
|
19002
|
+
TriggerInjectionModalitySchema = external_exports.enum(
|
|
19003
|
+
TRIGGER_INJECTION_MODALITIES
|
|
19004
|
+
);
|
|
19005
|
+
RunMessageCommandPayloadSchema = external_exports.object({
|
|
19006
|
+
message: external_exports.string().trim().min(1),
|
|
19007
|
+
// Optional so existing payloads and direct operator/agent messages stay
|
|
19008
|
+
// valid without it; trigger routing sets "deferred" for GitHub check
|
|
19009
|
+
// events. An absent mode is treated as "interrupt" at the delivery
|
|
19010
|
+
// boundary (commandDeliveryPayload / the runtime handler), so the default
|
|
19011
|
+
// lives where the value is consumed rather than as a required field every
|
|
19012
|
+
// call site must construct.
|
|
19013
|
+
deliveryMode: MessageDeliveryModeSchema.optional(),
|
|
19014
|
+
metadata: JsonValueSchema.optional()
|
|
19015
|
+
}).strict();
|
|
19016
|
+
RunAnswerCommandPayloadSchema = external_exports.object({
|
|
19017
|
+
toolCallId: external_exports.string().trim().min(1),
|
|
19018
|
+
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
19019
|
+
response: external_exports.string().trim().min(1).optional()
|
|
19020
|
+
}).strict().refine((value) => Object.keys(value.answers).length > 0 || value.response, {
|
|
19021
|
+
message: "Provide at least one answer or a freeform response"
|
|
18959
19022
|
});
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
19023
|
+
RunLifecycleCommandPayloadSchema = external_exports.object({
|
|
19024
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
19025
|
+
}).strict();
|
|
19026
|
+
RunStopCommandPayloadSchema = external_exports.object({
|
|
19027
|
+
reason: external_exports.string().trim().min(1).optional(),
|
|
19028
|
+
respawn: SingletonRespawnSchema.optional()
|
|
19029
|
+
}).strict();
|
|
19030
|
+
SessionCommandPayloadSchema = external_exports.union([
|
|
19031
|
+
RunMessageCommandPayloadSchema,
|
|
19032
|
+
RunAnswerCommandPayloadSchema,
|
|
19033
|
+
RunLifecycleCommandPayloadSchema,
|
|
19034
|
+
RunStopCommandPayloadSchema
|
|
19035
|
+
]);
|
|
19036
|
+
CreateRunMessageCommandRequestSchema = external_exports.object({
|
|
19037
|
+
message: external_exports.string().trim().min(1),
|
|
19038
|
+
metadata: JsonValueSchema.optional()
|
|
18963
19039
|
});
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
projectId: external_exports.string().trim().min(1).nullable(),
|
|
18968
|
-
agentId: AgentIdSchema,
|
|
18969
|
-
runtimeId: RuntimeIdSchema.nullable(),
|
|
18970
|
-
status: SessionStatusSchema,
|
|
18971
|
-
runtimePhase: SessionRuntimePhaseSchema.nullable(),
|
|
18972
|
-
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
18973
|
-
correlationKey: external_exports.string().nullable(),
|
|
18974
|
-
workflowId: external_exports.string().min(1),
|
|
18975
|
-
displayTitle: RunDisplayTitleSchema,
|
|
18976
|
-
ambientStatus: AmbientStatusSchema.nullable(),
|
|
18977
|
-
ambientStatusUpdatedAt: external_exports.string().datetime().nullable(),
|
|
18978
|
-
starterActor: AuthActorSchema.nullable(),
|
|
18979
|
-
snapshot: AgentResourceSchema,
|
|
18980
|
-
environmentSnapshot: EnvironmentResourceSchema,
|
|
18981
|
-
toolSnapshots: external_exports.array(
|
|
18982
|
-
external_exports.object({
|
|
18983
|
-
source: external_exports.literal("inline"),
|
|
18984
|
-
alias: ToolAliasSchema,
|
|
18985
|
-
spec: RemoteMcpToolSchema.or(ConnectionBackedToolSchema).or(LocalToolSchema).or(GithubToolSchema)
|
|
18986
|
-
})
|
|
18987
|
-
),
|
|
18988
|
-
input: JsonValueSchema,
|
|
18989
|
-
createdAt: external_exports.string().datetime(),
|
|
18990
|
-
updatedAt: external_exports.string().datetime(),
|
|
18991
|
-
lastActivityAt: external_exports.string().datetime(),
|
|
18992
|
-
startedAt: external_exports.string().datetime().nullable(),
|
|
18993
|
-
finishedAt: external_exports.string().datetime().nullable(),
|
|
18994
|
-
archivedAt: external_exports.string().datetime().nullable(),
|
|
18995
|
-
error: JsonValueSchema.nullable()
|
|
19040
|
+
CreateRunAnswerCommandRequestSchema = RunAnswerCommandPayloadSchema;
|
|
19041
|
+
CreateRunLifecycleCommandRequestSchema = external_exports.object({
|
|
19042
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
18996
19043
|
});
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
sequence: external_exports.number().int().nonnegative(),
|
|
19001
|
-
messageId: external_exports.string().trim().min(1),
|
|
19002
|
-
commandId: external_exports.string().trim().min(1).nullable(),
|
|
19003
|
-
turnId: external_exports.string().trim().min(1).nullable(),
|
|
19004
|
-
role: SessionMessageRoleSchema,
|
|
19005
|
-
status: SessionMessageStatusSchema,
|
|
19006
|
-
message: JsonValueSchema,
|
|
19007
|
-
streamCursor: external_exports.number().int().positive().nullable().default(null),
|
|
19008
|
-
createdAt: external_exports.string().datetime(),
|
|
19009
|
-
updatedAt: external_exports.string().datetime(),
|
|
19010
|
-
completedAt: external_exports.string().datetime().nullable()
|
|
19044
|
+
CreateRunStopCommandRequestSchema = external_exports.object({
|
|
19045
|
+
reason: external_exports.string().trim().min(1).optional(),
|
|
19046
|
+
respawn: SingletonRespawnSchema.optional()
|
|
19011
19047
|
});
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19048
|
+
CreateSessionCommandRequestSchema = external_exports.discriminatedUnion("kind", [
|
|
19049
|
+
external_exports.object({
|
|
19050
|
+
kind: external_exports.literal("message"),
|
|
19051
|
+
payload: CreateRunMessageCommandRequestSchema
|
|
19052
|
+
}).strict(),
|
|
19053
|
+
external_exports.object({
|
|
19054
|
+
kind: external_exports.literal("answer"),
|
|
19055
|
+
payload: CreateRunAnswerCommandRequestSchema
|
|
19056
|
+
}).strict(),
|
|
19057
|
+
external_exports.object({
|
|
19058
|
+
kind: external_exports.literal("pause"),
|
|
19059
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
19060
|
+
}).strict(),
|
|
19061
|
+
external_exports.object({
|
|
19062
|
+
kind: external_exports.literal("resume"),
|
|
19063
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
19064
|
+
}).strict(),
|
|
19065
|
+
external_exports.object({
|
|
19066
|
+
kind: external_exports.literal("interrupt"),
|
|
19067
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
19068
|
+
}).strict(),
|
|
19069
|
+
external_exports.object({
|
|
19070
|
+
kind: external_exports.literal("cancel"),
|
|
19071
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
19072
|
+
}).strict(),
|
|
19073
|
+
external_exports.object({
|
|
19074
|
+
kind: external_exports.literal("stop"),
|
|
19075
|
+
payload: CreateRunStopCommandRequestSchema
|
|
19076
|
+
}).strict()
|
|
19077
|
+
]);
|
|
19078
|
+
RunResolutionPolicySchema = external_exports.enum([
|
|
19079
|
+
"singletonLiveRun",
|
|
19080
|
+
"latestLiveRun",
|
|
19081
|
+
"latestRun"
|
|
19082
|
+
]);
|
|
19083
|
+
AgentAddressedCommandTargetSchema = external_exports.object({
|
|
19084
|
+
agentId: AgentIdSchema.optional(),
|
|
19085
|
+
agentName: external_exports.string().trim().min(1).optional(),
|
|
19086
|
+
resolutionPolicy: RunResolutionPolicySchema
|
|
19087
|
+
}).refine((value) => Boolean(value.agentId) !== Boolean(value.agentName), {
|
|
19088
|
+
message: "Provide exactly one of agentId or agentName"
|
|
19017
19089
|
});
|
|
19018
|
-
|
|
19019
|
-
id:
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
19025
|
-
|
|
19090
|
+
SessionCommandRecordBaseSchema = external_exports.object({
|
|
19091
|
+
id: SessionCommandIdSchema,
|
|
19092
|
+
sessionId: SessionIdSchema,
|
|
19093
|
+
sender: SessionCommandSenderSchema,
|
|
19094
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
19095
|
+
status: SessionCommandStatusSchema,
|
|
19096
|
+
attemptCount: external_exports.number().int().nonnegative(),
|
|
19097
|
+
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
19098
|
+
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
19099
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
19100
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
19101
|
+
error: JsonValueSchema.nullable(),
|
|
19026
19102
|
createdAt: external_exports.string().datetime(),
|
|
19027
|
-
updatedAt: external_exports.string().datetime()
|
|
19028
|
-
archivedAt: external_exports.string().datetime().nullable(),
|
|
19029
|
-
lastActivityAt: external_exports.string().datetime()
|
|
19030
|
-
});
|
|
19031
|
-
SessionListResponseSchema = external_exports.object({
|
|
19032
|
-
sessions: external_exports.array(SessionListItemSchema),
|
|
19033
|
-
/**
|
|
19034
|
-
* Opaque keyset cursor for the next page, or `null` when the list is
|
|
19035
|
-
* exhausted. Replay it on the next request to append the following page; it is
|
|
19036
|
-
* minted for a specific sort and rejected against a different one.
|
|
19037
|
-
*/
|
|
19038
|
-
nextCursor: external_exports.string().nullable(),
|
|
19039
|
-
hasMore: external_exports.boolean()
|
|
19103
|
+
updatedAt: external_exports.string().datetime()
|
|
19040
19104
|
});
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19105
|
+
RunStartCommandPayloadSchema = external_exports.object({
|
|
19106
|
+
kind: external_exports.literal("start")
|
|
19107
|
+
}).strict();
|
|
19108
|
+
RunStartWithMessageCommandPayloadSchema = external_exports.object({
|
|
19109
|
+
kind: external_exports.literal("startWithMessage"),
|
|
19110
|
+
message: external_exports.string().trim().min(1)
|
|
19111
|
+
}).strict();
|
|
19112
|
+
SessionPersistedCommandPayloadSchema = external_exports.union([
|
|
19113
|
+
RunMessageCommandPayloadSchema,
|
|
19114
|
+
RunAnswerCommandPayloadSchema,
|
|
19115
|
+
RunLifecycleCommandPayloadSchema,
|
|
19116
|
+
RunStopCommandPayloadSchema,
|
|
19117
|
+
RunStartCommandPayloadSchema,
|
|
19118
|
+
RunStartWithMessageCommandPayloadSchema
|
|
19119
|
+
]);
|
|
19120
|
+
SessionCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
19121
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19122
|
+
kind: external_exports.literal("message"),
|
|
19123
|
+
payload: RunMessageCommandPayloadSchema
|
|
19124
|
+
}),
|
|
19125
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19126
|
+
kind: external_exports.literal("answer"),
|
|
19127
|
+
payload: RunAnswerCommandPayloadSchema
|
|
19128
|
+
}),
|
|
19129
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19130
|
+
kind: external_exports.literal("pause"),
|
|
19131
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
19132
|
+
}),
|
|
19133
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19134
|
+
kind: external_exports.literal("resume"),
|
|
19135
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
19136
|
+
}),
|
|
19137
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19138
|
+
kind: external_exports.literal("interrupt"),
|
|
19139
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
19140
|
+
}),
|
|
19141
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19142
|
+
kind: external_exports.literal("cancel"),
|
|
19143
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
19144
|
+
}),
|
|
19145
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19146
|
+
kind: external_exports.literal("stop"),
|
|
19147
|
+
payload: RunStopCommandPayloadSchema
|
|
19148
|
+
}),
|
|
19149
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19150
|
+
kind: external_exports.literal("start"),
|
|
19151
|
+
payload: RunStartCommandPayloadSchema
|
|
19152
|
+
}),
|
|
19153
|
+
SessionCommandRecordBaseSchema.extend({
|
|
19154
|
+
kind: external_exports.literal("startWithMessage"),
|
|
19155
|
+
payload: RunStartWithMessageCommandPayloadSchema
|
|
19156
|
+
})
|
|
19157
|
+
]);
|
|
19158
|
+
SessionDispatchMessageCommandPayloadSchema = external_exports.object({
|
|
19159
|
+
kind: external_exports.literal("message"),
|
|
19160
|
+
message: external_exports.string().trim().min(1)
|
|
19161
|
+
}).strict();
|
|
19162
|
+
SessionDispatchAnswerCommandPayloadSchema = external_exports.object({
|
|
19163
|
+
kind: external_exports.literal("answer"),
|
|
19164
|
+
toolCallId: external_exports.string().trim().min(1),
|
|
19165
|
+
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
19166
|
+
response: external_exports.string().trim().min(1).optional()
|
|
19167
|
+
}).strict();
|
|
19168
|
+
SessionDispatchStopCommandPayloadSchema = external_exports.object({
|
|
19169
|
+
kind: external_exports.literal("stop"),
|
|
19170
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
19171
|
+
}).strict();
|
|
19172
|
+
SessionDispatchCommandPayloadSchema = external_exports.discriminatedUnion(
|
|
19173
|
+
"kind",
|
|
19174
|
+
[
|
|
19175
|
+
RunStartCommandPayloadSchema,
|
|
19176
|
+
RunStartWithMessageCommandPayloadSchema,
|
|
19177
|
+
SessionDispatchMessageCommandPayloadSchema,
|
|
19178
|
+
SessionDispatchAnswerCommandPayloadSchema,
|
|
19179
|
+
SessionDispatchStopCommandPayloadSchema
|
|
19180
|
+
]
|
|
19181
|
+
);
|
|
19182
|
+
SessionDispatchCommandRecordBaseSchema = external_exports.object({
|
|
19183
|
+
id: SessionCommandIdSchema,
|
|
19184
|
+
sessionId: SessionIdSchema,
|
|
19185
|
+
sender: SessionCommandSenderSchema,
|
|
19186
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
19187
|
+
status: SessionDispatchCommandStatusSchema,
|
|
19188
|
+
attemptCount: external_exports.number().int().nonnegative(),
|
|
19189
|
+
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
19190
|
+
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
19191
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
19192
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
19193
|
+
error: JsonValueSchema.nullable(),
|
|
19194
|
+
createdAt: external_exports.string().datetime(),
|
|
19195
|
+
updatedAt: external_exports.string().datetime()
|
|
19044
19196
|
});
|
|
19197
|
+
SessionDispatchCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
19198
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19199
|
+
kind: external_exports.literal("start"),
|
|
19200
|
+
payload: RunStartCommandPayloadSchema
|
|
19201
|
+
}),
|
|
19202
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19203
|
+
kind: external_exports.literal("startWithMessage"),
|
|
19204
|
+
payload: RunStartWithMessageCommandPayloadSchema
|
|
19205
|
+
}),
|
|
19206
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19207
|
+
kind: external_exports.literal("message"),
|
|
19208
|
+
payload: SessionDispatchMessageCommandPayloadSchema
|
|
19209
|
+
}),
|
|
19210
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19211
|
+
kind: external_exports.literal("answer"),
|
|
19212
|
+
payload: SessionDispatchAnswerCommandPayloadSchema
|
|
19213
|
+
}),
|
|
19214
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19215
|
+
kind: external_exports.literal("stop"),
|
|
19216
|
+
payload: SessionDispatchStopCommandPayloadSchema
|
|
19217
|
+
})
|
|
19218
|
+
]);
|
|
19045
19219
|
}
|
|
19046
19220
|
});
|
|
19047
19221
|
|
|
19048
|
-
// ../../packages/schemas/src/
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19222
|
+
// ../../packages/schemas/src/sessions.ts
|
|
19223
|
+
function isSessionTerminalStatus(status) {
|
|
19224
|
+
return SESSION_TERMINAL_STATUSES.some(
|
|
19225
|
+
(terminalStatus) => terminalStatus === status
|
|
19226
|
+
);
|
|
19227
|
+
}
|
|
19228
|
+
var SESSION_STATUSES, SESSION_RUNTIME_PHASES, SESSION_TERMINAL_STATUSES, SESSION_DISPLAY_TITLE_MAX_LENGTH, SESSION_MESSAGE_ROLES, SESSION_MESSAGE_STATUSES, SessionStatusSchema, SessionRuntimePhaseSchema, SessionMessageRoleSchema, SessionMessageStatusSchema, RunDisplayTitleSchema, AmbientStatusSchema, SESSION_CHECK_STATUSES, SESSION_CHECK_CONCLUSIONS, SESSION_CHECK_TIMEOUT_PHASES, SessionCheckStatusSchema, SessionCheckConclusionSchema, SessionCheckTimeoutPhaseSchema, ManualSessionRequestSchema, SessionArchiveRequestSchema, SessionsArchiveRequestSchema, SessionRecordSchema, SessionMessageOriginSchema, SessionUiMessageRecordSchema, SessionListItemAgentSchema, SessionListItemSchema, SessionListResponseSchema, SessionsArchiveResponseSchema;
|
|
19229
|
+
var init_sessions = __esm({
|
|
19230
|
+
"../../packages/schemas/src/sessions.ts"() {
|
|
19052
19231
|
"use strict";
|
|
19053
19232
|
init_zod();
|
|
19233
|
+
init_agents();
|
|
19054
19234
|
init_auth();
|
|
19055
|
-
|
|
19235
|
+
init_environments();
|
|
19056
19236
|
init_ids();
|
|
19057
19237
|
init_primitives();
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19238
|
+
init_session_commands();
|
|
19239
|
+
init_tools();
|
|
19240
|
+
SESSION_STATUSES = [
|
|
19241
|
+
"queued",
|
|
19242
|
+
"running",
|
|
19243
|
+
"awaiting",
|
|
19244
|
+
"failed",
|
|
19245
|
+
"stopped"
|
|
19246
|
+
];
|
|
19247
|
+
SESSION_RUNTIME_PHASES = [
|
|
19248
|
+
"building_image",
|
|
19249
|
+
"booting_container",
|
|
19250
|
+
"preparing_environment",
|
|
19251
|
+
"starting_runtime",
|
|
19252
|
+
"running"
|
|
19253
|
+
];
|
|
19254
|
+
SESSION_TERMINAL_STATUSES = ["failed", "stopped"];
|
|
19255
|
+
SESSION_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
19256
|
+
SESSION_MESSAGE_ROLES = ["system", "user", "assistant"];
|
|
19257
|
+
SESSION_MESSAGE_STATUSES = [
|
|
19258
|
+
"in_progress",
|
|
19259
|
+
"completed",
|
|
19260
|
+
"failed"
|
|
19261
|
+
];
|
|
19262
|
+
SessionStatusSchema = external_exports.enum(SESSION_STATUSES);
|
|
19263
|
+
SessionRuntimePhaseSchema = external_exports.enum(SESSION_RUNTIME_PHASES);
|
|
19264
|
+
SessionMessageRoleSchema = external_exports.enum(SESSION_MESSAGE_ROLES);
|
|
19265
|
+
SessionMessageStatusSchema = external_exports.enum(SESSION_MESSAGE_STATUSES);
|
|
19266
|
+
RunDisplayTitleSchema = external_exports.string().trim().max(SESSION_DISPLAY_TITLE_MAX_LENGTH);
|
|
19267
|
+
AmbientStatusSchema = external_exports.string().trim().min(1);
|
|
19268
|
+
SESSION_CHECK_STATUSES = [
|
|
19269
|
+
"queued",
|
|
19270
|
+
"in_progress",
|
|
19271
|
+
"completed"
|
|
19272
|
+
];
|
|
19273
|
+
SESSION_CHECK_CONCLUSIONS = ["success", "failure"];
|
|
19274
|
+
SESSION_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
|
|
19275
|
+
SessionCheckStatusSchema = external_exports.enum(SESSION_CHECK_STATUSES);
|
|
19276
|
+
SessionCheckConclusionSchema = external_exports.enum(SESSION_CHECK_CONCLUSIONS);
|
|
19277
|
+
SessionCheckTimeoutPhaseSchema = external_exports.enum(
|
|
19278
|
+
SESSION_CHECK_TIMEOUT_PHASES
|
|
19279
|
+
);
|
|
19280
|
+
ManualSessionRequestSchema = external_exports.object({
|
|
19281
|
+
message: external_exports.string().trim().min(1).max(2e4).optional(),
|
|
19282
|
+
interactive: external_exports.boolean().optional(),
|
|
19283
|
+
/**
|
|
19284
|
+
* Deliver the agent's configured `initialPrompt` as the session's kickoff
|
|
19285
|
+
* message so the agent opens the conversation. Agents without an
|
|
19286
|
+
* `initialPrompt` fall back to the default manual say-hello message, so a
|
|
19287
|
+
* kickoff always pings the agent. The kickoff is delivered through the
|
|
19288
|
+
* session's one idempotent start command and never renders as a user chat
|
|
19289
|
+
* bubble; the agent's greeting is the first visible content.
|
|
19290
|
+
*/
|
|
19291
|
+
kickoff: external_exports.boolean().optional()
|
|
19292
|
+
});
|
|
19293
|
+
SessionArchiveRequestSchema = external_exports.object({
|
|
19294
|
+
archived: external_exports.boolean()
|
|
19295
|
+
});
|
|
19296
|
+
SessionsArchiveRequestSchema = external_exports.object({
|
|
19297
|
+
session_ids: external_exports.array(SessionIdSchema).min(1).max(100),
|
|
19298
|
+
archived: external_exports.boolean()
|
|
19299
|
+
});
|
|
19300
|
+
SessionRecordSchema = external_exports.object({
|
|
19301
|
+
id: SessionIdSchema,
|
|
19302
|
+
organizationId: external_exports.string().trim().min(1),
|
|
19303
|
+
projectId: external_exports.string().trim().min(1).nullable(),
|
|
19304
|
+
agentId: AgentIdSchema,
|
|
19305
|
+
runtimeId: RuntimeIdSchema.nullable(),
|
|
19306
|
+
status: SessionStatusSchema,
|
|
19307
|
+
runtimePhase: SessionRuntimePhaseSchema.nullable(),
|
|
19308
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
19309
|
+
correlationKey: external_exports.string().nullable(),
|
|
19310
|
+
workflowId: external_exports.string().min(1),
|
|
19311
|
+
displayTitle: RunDisplayTitleSchema,
|
|
19312
|
+
ambientStatus: AmbientStatusSchema.nullable(),
|
|
19313
|
+
ambientStatusUpdatedAt: external_exports.string().datetime().nullable(),
|
|
19314
|
+
starterActor: AuthActorSchema.nullable(),
|
|
19315
|
+
snapshot: AgentResourceSchema,
|
|
19316
|
+
environmentSnapshot: EnvironmentResourceSchema,
|
|
19317
|
+
toolSnapshots: external_exports.array(
|
|
19318
|
+
external_exports.object({
|
|
19319
|
+
source: external_exports.literal("inline"),
|
|
19320
|
+
alias: ToolAliasSchema,
|
|
19321
|
+
spec: RemoteMcpToolSchema.or(ConnectionBackedToolSchema).or(LocalToolSchema).or(GithubToolSchema)
|
|
19322
|
+
})
|
|
19323
|
+
),
|
|
19324
|
+
input: JsonValueSchema,
|
|
19325
|
+
createdAt: external_exports.string().datetime(),
|
|
19326
|
+
updatedAt: external_exports.string().datetime(),
|
|
19327
|
+
lastActivityAt: external_exports.string().datetime(),
|
|
19328
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
19329
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
19330
|
+
archivedAt: external_exports.string().datetime().nullable(),
|
|
19331
|
+
error: JsonValueSchema.nullable()
|
|
19332
|
+
});
|
|
19333
|
+
SessionMessageOriginSchema = external_exports.object({
|
|
19334
|
+
eventKey: external_exports.string().trim().min(1),
|
|
19335
|
+
provider: external_exports.string().trim().min(1).nullable().default(null)
|
|
19336
|
+
});
|
|
19337
|
+
SessionUiMessageRecordSchema = external_exports.object({
|
|
19338
|
+
id: external_exports.string().trim().min(1),
|
|
19339
|
+
sessionId: SessionIdSchema,
|
|
19340
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
19341
|
+
messageId: external_exports.string().trim().min(1),
|
|
19342
|
+
commandId: external_exports.string().trim().min(1).nullable(),
|
|
19343
|
+
turnId: external_exports.string().trim().min(1).nullable(),
|
|
19344
|
+
role: SessionMessageRoleSchema,
|
|
19345
|
+
status: SessionMessageStatusSchema,
|
|
19346
|
+
message: JsonValueSchema,
|
|
19347
|
+
// The sender of the command that carried this message into the session
|
|
19348
|
+
// (operator chat send, trigger delivery, or another agent's session), joined
|
|
19349
|
+
// from session_commands at read time. Null for messages that did not arrive
|
|
19350
|
+
// through a command, such as assistant output.
|
|
19351
|
+
sender: SessionCommandSenderSchema.nullable().default(null),
|
|
19352
|
+
// For trigger deliveries, the routed event behind the carrying command:
|
|
19353
|
+
// its event key plus the originating provider connection when known
|
|
19354
|
+
// (e.g. "slack" for a subscribed-thread reply, "github" for a check event).
|
|
19355
|
+
origin: SessionMessageOriginSchema.nullable().default(null),
|
|
19356
|
+
streamCursor: external_exports.number().int().positive().nullable().default(null),
|
|
19357
|
+
createdAt: external_exports.string().datetime(),
|
|
19358
|
+
updatedAt: external_exports.string().datetime(),
|
|
19359
|
+
completedAt: external_exports.string().datetime().nullable()
|
|
19360
|
+
});
|
|
19361
|
+
SessionListItemAgentSchema = external_exports.object({
|
|
19362
|
+
name: external_exports.string(),
|
|
19363
|
+
displayName: external_exports.string().nullable(),
|
|
19364
|
+
username: external_exports.string().nullable(),
|
|
19365
|
+
avatarSha256: external_exports.string().nullable()
|
|
19366
|
+
});
|
|
19367
|
+
SessionListItemSchema = external_exports.object({
|
|
19368
|
+
id: SessionIdSchema,
|
|
19369
|
+
agentId: AgentIdSchema,
|
|
19370
|
+
status: SessionStatusSchema,
|
|
19371
|
+
runtimePhase: SessionRuntimePhaseSchema.nullable(),
|
|
19372
|
+
displayTitle: RunDisplayTitleSchema,
|
|
19373
|
+
summary: external_exports.string(),
|
|
19374
|
+
agent: SessionListItemAgentSchema,
|
|
19375
|
+
createdAt: external_exports.string().datetime(),
|
|
19376
|
+
updatedAt: external_exports.string().datetime(),
|
|
19377
|
+
archivedAt: external_exports.string().datetime().nullable(),
|
|
19378
|
+
lastActivityAt: external_exports.string().datetime()
|
|
19379
|
+
});
|
|
19380
|
+
SessionListResponseSchema = external_exports.object({
|
|
19381
|
+
sessions: external_exports.array(SessionListItemSchema),
|
|
19382
|
+
/**
|
|
19383
|
+
* Opaque keyset cursor for the next page, or `null` when the list is
|
|
19384
|
+
* exhausted. Replay it on the next request to append the following page; it is
|
|
19385
|
+
* minted for a specific sort and rejected against a different one.
|
|
19386
|
+
*/
|
|
19387
|
+
nextCursor: external_exports.string().nullable(),
|
|
19388
|
+
hasMore: external_exports.boolean()
|
|
19389
|
+
});
|
|
19390
|
+
SessionsArchiveResponseSchema = external_exports.object({
|
|
19391
|
+
archived: external_exports.boolean(),
|
|
19392
|
+
sessions: external_exports.array(SessionRecordSchema)
|
|
19393
|
+
});
|
|
19394
|
+
}
|
|
19395
|
+
});
|
|
19396
|
+
|
|
19397
|
+
// ../../packages/schemas/src/session-introspection.ts
|
|
19398
|
+
var TruncatedValueSchema, RunConversationSearchSnippetSchema, RunConversationSearchMatchSchema, RunConversationSearchResponseSchema, SessionToolExchangeSchema, SessionToolExchangesResponseSchema, SESSION_TRIGGER_DELIVERY_ACTIONS, SessionTriggerDeliveryActionSchema, SESSION_EVENT_ORIGIN_KINDS, SessionEventOriginKindSchema, SessionTriggerDeliveryRecordSchema, SessionTriggersResponseSchema, RunArtifactRecordSchema, RunArtifactsResponseSchema, RunBindingRecordSchema, RunBindingsResponseSchema, RunTurnSchema, SessionToolStatSchema, RunSummarySchema;
|
|
19399
|
+
var init_session_introspection = __esm({
|
|
19400
|
+
"../../packages/schemas/src/session-introspection.ts"() {
|
|
19401
|
+
"use strict";
|
|
19402
|
+
init_zod();
|
|
19403
|
+
init_auth();
|
|
19404
|
+
init_conversation();
|
|
19405
|
+
init_ids();
|
|
19406
|
+
init_primitives();
|
|
19407
|
+
init_session_bindings();
|
|
19408
|
+
init_sessions();
|
|
19409
|
+
TruncatedValueSchema = external_exports.object({
|
|
19410
|
+
truncated: external_exports.literal(true),
|
|
19411
|
+
truncatedPreview: external_exports.string(),
|
|
19412
|
+
originalBytes: external_exports.number().int().nonnegative()
|
|
19413
|
+
});
|
|
19414
|
+
RunConversationSearchSnippetSchema = external_exports.object({
|
|
19415
|
+
partIndex: external_exports.number().int().nonnegative(),
|
|
19416
|
+
partType: external_exports.string(),
|
|
19417
|
+
/** The search term this snippet was produced for. */
|
|
19418
|
+
query: external_exports.string(),
|
|
19419
|
+
text: external_exports.string()
|
|
19420
|
+
});
|
|
19421
|
+
RunConversationSearchMatchSchema = external_exports.object({
|
|
19422
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
19423
|
+
role: ConversationRoleSchema,
|
|
19424
|
+
kind: ConversationEntryKindSchema,
|
|
19425
|
+
status: ConversationEntryStatusSchema,
|
|
19426
|
+
createdAt: external_exports.string().datetime(),
|
|
19427
|
+
/** Which of the requested terms matched this entry. */
|
|
19428
|
+
matchedQueries: external_exports.array(external_exports.string()),
|
|
19429
|
+
/** Total match occurrences across terms in this entry. */
|
|
19430
|
+
matchCount: external_exports.number().int().positive(),
|
|
19431
|
+
snippets: external_exports.array(RunConversationSearchSnippetSchema)
|
|
19432
|
+
});
|
|
19433
|
+
RunConversationSearchResponseSchema = external_exports.object({
|
|
19434
|
+
matches: external_exports.array(RunConversationSearchMatchSchema),
|
|
19435
|
+
hasMore: external_exports.boolean(),
|
|
19436
|
+
/**
|
|
19437
|
+
* Sequence of the last candidate entry scanned (not just the last confirmed
|
|
19438
|
+
* match) — pass as `afterSequence` to continue without re-scanning
|
|
19439
|
+
* candidates the match confirmation dropped. Null when nothing was scanned.
|
|
19440
|
+
*/
|
|
19441
|
+
nextAfterSequence: external_exports.number().int().nullable()
|
|
19442
|
+
});
|
|
19443
|
+
SessionToolExchangeSchema = external_exports.object({
|
|
19444
|
+
name: external_exports.string(),
|
|
19445
|
+
callSequence: external_exports.number().int().nonnegative(),
|
|
19446
|
+
resultSequence: external_exports.number().int().nonnegative().nullable(),
|
|
19447
|
+
input: JsonValueSchema,
|
|
19448
|
+
output: JsonValueSchema.nullable(),
|
|
19449
|
+
/** Null while the call has no recorded result. */
|
|
19450
|
+
isError: external_exports.boolean().nullable(),
|
|
19451
|
+
/** Result `completedAt` minus call `createdAt`; null without a result. */
|
|
19452
|
+
durationMs: external_exports.number().int().nonnegative().nullable(),
|
|
19104
19453
|
startedAt: external_exports.string().datetime(),
|
|
19105
19454
|
completedAt: external_exports.string().datetime().nullable()
|
|
19106
19455
|
});
|
|
@@ -19185,468 +19534,133 @@ var init_session_introspection = __esm({
|
|
|
19185
19534
|
calls: external_exports.number().int().nonnegative(),
|
|
19186
19535
|
/**
|
|
19187
19536
|
* Derived from the summary's recent-entries window (most recent ~1000
|
|
19188
|
-
* entries), so on very long sessions `errors` and `durationMs` can understate
|
|
19189
|
-
* relative to the session-wide `calls`.
|
|
19190
|
-
*/
|
|
19191
|
-
errors: external_exports.number().int().nonnegative(),
|
|
19192
|
-
durationMs: external_exports.object({
|
|
19193
|
-
p50: external_exports.number().nonnegative().nullable(),
|
|
19194
|
-
max: external_exports.number().nonnegative().nullable()
|
|
19195
|
-
})
|
|
19196
|
-
});
|
|
19197
|
-
RunSummarySchema = external_exports.object({
|
|
19198
|
-
session: external_exports.object({
|
|
19199
|
-
id: SessionIdSchema,
|
|
19200
|
-
agentName: external_exports.string(),
|
|
19201
|
-
displayTitle: external_exports.string(),
|
|
19202
|
-
ambientStatus: AmbientStatusSchema.nullable(),
|
|
19203
|
-
status: SessionStatusSchema,
|
|
19204
|
-
error: JsonValueSchema.nullable(),
|
|
19205
|
-
workflowId: external_exports.string(),
|
|
19206
|
-
createdAt: external_exports.string().datetime(),
|
|
19207
|
-
startedAt: external_exports.string().datetime().nullable(),
|
|
19208
|
-
finishedAt: external_exports.string().datetime().nullable(),
|
|
19209
|
-
archivedAt: external_exports.string().datetime().nullable()
|
|
19210
|
-
}),
|
|
19211
|
-
timing: external_exports.object({
|
|
19212
|
-
/** `startedAt - createdAt`; null until the session starts. */
|
|
19213
|
-
queuedMs: external_exports.number().int().nonnegative().nullable(),
|
|
19214
|
-
/** `(finishedAt ?? now) - startedAt`; null until the session starts. */
|
|
19215
|
-
activeMs: external_exports.number().int().nonnegative().nullable(),
|
|
19216
|
-
/** `(finishedAt ?? now) - createdAt`. */
|
|
19217
|
-
totalMs: external_exports.number().int().nonnegative()
|
|
19218
|
-
}),
|
|
19219
|
-
conversation: external_exports.object({
|
|
19220
|
-
entryCount: external_exports.number().int().nonnegative(),
|
|
19221
|
-
firstEntryAt: external_exports.string().datetime().nullable(),
|
|
19222
|
-
lastEntryAt: external_exports.string().datetime().nullable(),
|
|
19223
|
-
countsByKind: external_exports.object({
|
|
19224
|
-
status: external_exports.number().int().nonnegative(),
|
|
19225
|
-
message: external_exports.number().int().nonnegative(),
|
|
19226
|
-
tool_call: external_exports.number().int().nonnegative(),
|
|
19227
|
-
tool_result: external_exports.number().int().nonnegative(),
|
|
19228
|
-
question: external_exports.number().int().nonnegative()
|
|
19229
|
-
}),
|
|
19230
|
-
failedEntryCount: external_exports.number().int().nonnegative(),
|
|
19231
|
-
lastSequence: external_exports.number().int().nonnegative()
|
|
19232
|
-
}),
|
|
19233
|
-
tools: external_exports.array(SessionToolStatSchema),
|
|
19234
|
-
/**
|
|
19235
|
-
* True when the session has more conversation entries than the summary's
|
|
19236
|
-
* recent-entries window, meaning per-tool `errors`/`durationMs` (and
|
|
19237
|
-
* `turns`) describe only the most recent slice of the session.
|
|
19238
|
-
*/
|
|
19239
|
-
toolStatsWindowed: external_exports.boolean(),
|
|
19240
|
-
trigger: external_exports.object({
|
|
19241
|
-
/** Spawning event key, or "manual" / "agent" for actor-started sessions. */
|
|
19242
|
-
spawn: external_exports.string(),
|
|
19243
|
-
signaledCount: external_exports.number().int().nonnegative(),
|
|
19244
|
-
droppedCount: external_exports.number().int().nonnegative()
|
|
19245
|
-
}),
|
|
19246
|
-
artifacts: external_exports.object({
|
|
19247
|
-
count: external_exports.number().int().nonnegative(),
|
|
19248
|
-
types: external_exports.array(external_exports.string())
|
|
19249
|
-
}),
|
|
19250
|
-
/** Active session bindings, counted with their distinct target types. */
|
|
19251
|
-
bindings: external_exports.object({
|
|
19252
|
-
count: external_exports.number().int().nonnegative(),
|
|
19253
|
-
targetTypes: external_exports.array(BindingTargetTypeSchema)
|
|
19254
|
-
}),
|
|
19255
|
-
/** Derived per-user-message turns, capped to the most recent. */
|
|
19256
|
-
turns: external_exports.array(RunTurnSchema),
|
|
19257
|
-
commands: external_exports.object({
|
|
19258
|
-
total: external_exports.number().int().nonnegative(),
|
|
19259
|
-
byKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
|
|
19260
|
-
failed: external_exports.number().int().nonnegative()
|
|
19261
|
-
}),
|
|
19262
|
-
checks: external_exports.array(
|
|
19263
|
-
external_exports.object({
|
|
19264
|
-
name: external_exports.string(),
|
|
19265
|
-
displayName: external_exports.string(),
|
|
19266
|
-
status: SessionCheckStatusSchema,
|
|
19267
|
-
conclusion: SessionCheckConclusionSchema.nullable(),
|
|
19268
|
-
completedAt: external_exports.string().datetime().nullable()
|
|
19269
|
-
})
|
|
19270
|
-
)
|
|
19271
|
-
});
|
|
19272
|
-
}
|
|
19273
|
-
});
|
|
19274
|
-
|
|
19275
|
-
// ../../packages/schemas/src/session-turns.ts
|
|
19276
|
-
var SESSION_TURN_STATUSES, SESSION_TURN_FAILURE_SCOPES, SessionTurnStatusSchema, SessionTurnFailureScopeSchema, SessionTurnRecordSchema;
|
|
19277
|
-
var init_session_turns = __esm({
|
|
19278
|
-
"../../packages/schemas/src/session-turns.ts"() {
|
|
19279
|
-
"use strict";
|
|
19280
|
-
init_zod();
|
|
19281
|
-
init_ids();
|
|
19282
|
-
init_primitives();
|
|
19283
|
-
SESSION_TURN_STATUSES = [
|
|
19284
|
-
"accepted",
|
|
19285
|
-
"in_progress",
|
|
19286
|
-
"waiting_for_input",
|
|
19287
|
-
"completed",
|
|
19288
|
-
"failed",
|
|
19289
|
-
"stale"
|
|
19290
|
-
];
|
|
19291
|
-
SESSION_TURN_FAILURE_SCOPES = ["turn", "session"];
|
|
19292
|
-
SessionTurnStatusSchema = external_exports.enum(SESSION_TURN_STATUSES);
|
|
19293
|
-
SessionTurnFailureScopeSchema = external_exports.enum(
|
|
19294
|
-
SESSION_TURN_FAILURE_SCOPES
|
|
19295
|
-
);
|
|
19296
|
-
SessionTurnRecordSchema = external_exports.object({
|
|
19297
|
-
id: external_exports.string().trim().min(1),
|
|
19298
|
-
sessionId: SessionIdSchema,
|
|
19299
|
-
commandId: SessionCommandIdSchema,
|
|
19300
|
-
runtimeId: RuntimeIdSchema.nullable(),
|
|
19301
|
-
bridgeLeaseId: RuntimeBridgeLeaseIdSchema.nullable(),
|
|
19302
|
-
status: SessionTurnStatusSchema,
|
|
19303
|
-
failureScope: SessionTurnFailureScopeSchema.nullable(),
|
|
19304
|
-
lastOutputSeq: external_exports.number().int().positive().nullable(),
|
|
19305
|
-
acceptedAt: external_exports.string().datetime().nullable(),
|
|
19306
|
-
startedAt: external_exports.string().datetime().nullable(),
|
|
19307
|
-
lastProgressAt: external_exports.string().datetime().nullable(),
|
|
19308
|
-
completedAt: external_exports.string().datetime().nullable(),
|
|
19309
|
-
failedAt: external_exports.string().datetime().nullable(),
|
|
19310
|
-
staleAt: external_exports.string().datetime().nullable(),
|
|
19311
|
-
error: JsonValueSchema.nullable(),
|
|
19312
|
-
createdAt: external_exports.string().datetime(),
|
|
19313
|
-
updatedAt: external_exports.string().datetime()
|
|
19314
|
-
});
|
|
19315
|
-
}
|
|
19316
|
-
});
|
|
19317
|
-
|
|
19318
|
-
// ../../packages/schemas/src/singleton-refresh.ts
|
|
19319
|
-
var SINGLETON_RESPAWN_REASONS, SingletonRespawnReasonSchema, SingletonRespawnSchema, SingletonRefreshEventPayloadSchema;
|
|
19320
|
-
var init_singleton_refresh = __esm({
|
|
19321
|
-
"../../packages/schemas/src/singleton-refresh.ts"() {
|
|
19322
|
-
"use strict";
|
|
19323
|
-
init_zod();
|
|
19324
|
-
SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
|
|
19325
|
-
SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
|
|
19326
|
-
SingletonRespawnSchema = external_exports.object({
|
|
19327
|
-
reason: SingletonRespawnReasonSchema.default("refresh")
|
|
19328
|
-
}).strict();
|
|
19329
|
-
SingletonRefreshEventPayloadSchema = external_exports.object({
|
|
19330
|
-
trigger: external_exports.literal("agent.refresh"),
|
|
19331
|
-
refresh: external_exports.object({
|
|
19332
|
-
reason: SingletonRespawnReasonSchema,
|
|
19333
|
-
agentResourceId: external_exports.string().trim().min(1),
|
|
19334
|
-
previousSessionId: external_exports.string().trim().min(1)
|
|
19335
|
-
})
|
|
19336
|
-
});
|
|
19337
|
-
}
|
|
19338
|
-
});
|
|
19339
|
-
|
|
19340
|
-
// ../../packages/schemas/src/session-commands.ts
|
|
19341
|
-
var SESSION_COMMAND_KINDS, SESSION_DISPATCH_COMMAND_KINDS, SESSION_PERSISTED_COMMAND_KINDS, SESSION_LIFECYCLE_COMMAND_KINDS, SESSION_COMMAND_STATUSES, SESSION_DISPATCH_COMMAND_STATUSES, SessionCommandKindSchema, SessionPersistedCommandKindSchema, SessionDispatchCommandKindSchema, RunLifecycleCommandKindSchema, SessionCommandStatusSchema, SessionDispatchCommandStatusSchema, SessionCommandSenderSchema, MESSAGE_DELIVERY_MODES, MessageDeliveryModeSchema, TRIGGER_INJECTION_MODALITIES, TriggerInjectionModalitySchema, RunMessageCommandPayloadSchema, RunAnswerCommandPayloadSchema, RunLifecycleCommandPayloadSchema, RunStopCommandPayloadSchema, SessionCommandPayloadSchema, CreateRunMessageCommandRequestSchema, CreateRunAnswerCommandRequestSchema, CreateRunLifecycleCommandRequestSchema, CreateRunStopCommandRequestSchema, CreateSessionCommandRequestSchema, RunResolutionPolicySchema, AgentAddressedCommandTargetSchema, SessionCommandRecordBaseSchema, RunStartCommandPayloadSchema, RunStartWithMessageCommandPayloadSchema, SessionPersistedCommandPayloadSchema, SessionCommandRecordSchema, SessionDispatchMessageCommandPayloadSchema, SessionDispatchAnswerCommandPayloadSchema, SessionDispatchStopCommandPayloadSchema, SessionDispatchCommandPayloadSchema, SessionDispatchCommandRecordBaseSchema, SessionDispatchCommandRecordSchema;
|
|
19342
|
-
var init_session_commands = __esm({
|
|
19343
|
-
"../../packages/schemas/src/session-commands.ts"() {
|
|
19344
|
-
"use strict";
|
|
19345
|
-
init_zod();
|
|
19346
|
-
init_auth();
|
|
19347
|
-
init_ids();
|
|
19348
|
-
init_primitives();
|
|
19349
|
-
init_singleton_refresh();
|
|
19350
|
-
SESSION_COMMAND_KINDS = [
|
|
19351
|
-
"message",
|
|
19352
|
-
"answer",
|
|
19353
|
-
"pause",
|
|
19354
|
-
"resume",
|
|
19355
|
-
"interrupt",
|
|
19356
|
-
"cancel",
|
|
19357
|
-
"stop"
|
|
19358
|
-
];
|
|
19359
|
-
SESSION_DISPATCH_COMMAND_KINDS = [
|
|
19360
|
-
"start",
|
|
19361
|
-
"startWithMessage",
|
|
19362
|
-
"message",
|
|
19363
|
-
"answer",
|
|
19364
|
-
"stop"
|
|
19365
|
-
];
|
|
19366
|
-
SESSION_PERSISTED_COMMAND_KINDS = [
|
|
19367
|
-
"message",
|
|
19368
|
-
"pause",
|
|
19369
|
-
"resume",
|
|
19370
|
-
"interrupt",
|
|
19371
|
-
"cancel",
|
|
19372
|
-
"stop",
|
|
19373
|
-
"start",
|
|
19374
|
-
"startWithMessage",
|
|
19375
|
-
"answer"
|
|
19376
|
-
];
|
|
19377
|
-
SESSION_LIFECYCLE_COMMAND_KINDS = [
|
|
19378
|
-
"pause",
|
|
19379
|
-
"resume",
|
|
19380
|
-
"interrupt",
|
|
19381
|
-
"cancel",
|
|
19382
|
-
"stop"
|
|
19383
|
-
];
|
|
19384
|
-
SESSION_COMMAND_STATUSES = [
|
|
19385
|
-
"pending",
|
|
19386
|
-
"dispatching",
|
|
19387
|
-
"accepted",
|
|
19388
|
-
"failed"
|
|
19389
|
-
];
|
|
19390
|
-
SESSION_DISPATCH_COMMAND_STATUSES = [
|
|
19391
|
-
"pending",
|
|
19392
|
-
"dispatching",
|
|
19393
|
-
"accepted",
|
|
19394
|
-
"failed"
|
|
19395
|
-
];
|
|
19396
|
-
SessionCommandKindSchema = external_exports.enum(SESSION_COMMAND_KINDS);
|
|
19397
|
-
SessionPersistedCommandKindSchema = external_exports.enum(
|
|
19398
|
-
SESSION_PERSISTED_COMMAND_KINDS
|
|
19399
|
-
);
|
|
19400
|
-
SessionDispatchCommandKindSchema = external_exports.enum(
|
|
19401
|
-
SESSION_DISPATCH_COMMAND_KINDS
|
|
19402
|
-
);
|
|
19403
|
-
RunLifecycleCommandKindSchema = external_exports.enum(
|
|
19404
|
-
SESSION_LIFECYCLE_COMMAND_KINDS
|
|
19405
|
-
);
|
|
19406
|
-
SessionCommandStatusSchema = external_exports.enum(SESSION_COMMAND_STATUSES);
|
|
19407
|
-
SessionDispatchCommandStatusSchema = external_exports.enum(
|
|
19408
|
-
SESSION_DISPATCH_COMMAND_STATUSES
|
|
19409
|
-
);
|
|
19410
|
-
SessionCommandSenderSchema = external_exports.discriminatedUnion("type", [
|
|
19411
|
-
external_exports.object({
|
|
19412
|
-
type: external_exports.literal("operator"),
|
|
19413
|
-
id: external_exports.string().trim().min(1).nullable().default(null),
|
|
19414
|
-
actor: AuthActorSchema.nullable().optional()
|
|
19415
|
-
}),
|
|
19416
|
-
external_exports.object({
|
|
19417
|
-
type: external_exports.literal("agent"),
|
|
19418
|
-
sessionId: SessionIdSchema
|
|
19419
|
-
}),
|
|
19420
|
-
external_exports.object({
|
|
19421
|
-
type: external_exports.literal("system")
|
|
19422
|
-
})
|
|
19423
|
-
]);
|
|
19424
|
-
MESSAGE_DELIVERY_MODES = ["interrupt", "deferred"];
|
|
19425
|
-
MessageDeliveryModeSchema = external_exports.enum(MESSAGE_DELIVERY_MODES);
|
|
19426
|
-
TRIGGER_INJECTION_MODALITIES = [
|
|
19427
|
-
"chat",
|
|
19428
|
-
"githubCheck",
|
|
19429
|
-
"githubCheckAction",
|
|
19430
|
-
"githubPullRequest",
|
|
19431
|
-
"other"
|
|
19432
|
-
];
|
|
19433
|
-
TriggerInjectionModalitySchema = external_exports.enum(
|
|
19434
|
-
TRIGGER_INJECTION_MODALITIES
|
|
19435
|
-
);
|
|
19436
|
-
RunMessageCommandPayloadSchema = external_exports.object({
|
|
19437
|
-
message: external_exports.string().trim().min(1),
|
|
19438
|
-
// Optional so existing payloads and direct operator/agent messages stay
|
|
19439
|
-
// valid without it; trigger routing sets "deferred" for GitHub check
|
|
19440
|
-
// events. An absent mode is treated as "interrupt" at the delivery
|
|
19441
|
-
// boundary (commandDeliveryPayload / the runtime handler), so the default
|
|
19442
|
-
// lives where the value is consumed rather than as a required field every
|
|
19443
|
-
// call site must construct.
|
|
19444
|
-
deliveryMode: MessageDeliveryModeSchema.optional(),
|
|
19445
|
-
metadata: JsonValueSchema.optional()
|
|
19446
|
-
}).strict();
|
|
19447
|
-
RunAnswerCommandPayloadSchema = external_exports.object({
|
|
19448
|
-
toolCallId: external_exports.string().trim().min(1),
|
|
19449
|
-
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
19450
|
-
response: external_exports.string().trim().min(1).optional()
|
|
19451
|
-
}).strict().refine((value) => Object.keys(value.answers).length > 0 || value.response, {
|
|
19452
|
-
message: "Provide at least one answer or a freeform response"
|
|
19453
|
-
});
|
|
19454
|
-
RunLifecycleCommandPayloadSchema = external_exports.object({
|
|
19455
|
-
reason: external_exports.string().trim().min(1).optional()
|
|
19456
|
-
}).strict();
|
|
19457
|
-
RunStopCommandPayloadSchema = external_exports.object({
|
|
19458
|
-
reason: external_exports.string().trim().min(1).optional(),
|
|
19459
|
-
respawn: SingletonRespawnSchema.optional()
|
|
19460
|
-
}).strict();
|
|
19461
|
-
SessionCommandPayloadSchema = external_exports.union([
|
|
19462
|
-
RunMessageCommandPayloadSchema,
|
|
19463
|
-
RunAnswerCommandPayloadSchema,
|
|
19464
|
-
RunLifecycleCommandPayloadSchema,
|
|
19465
|
-
RunStopCommandPayloadSchema
|
|
19466
|
-
]);
|
|
19467
|
-
CreateRunMessageCommandRequestSchema = external_exports.object({
|
|
19468
|
-
message: external_exports.string().trim().min(1),
|
|
19469
|
-
metadata: JsonValueSchema.optional()
|
|
19470
|
-
});
|
|
19471
|
-
CreateRunAnswerCommandRequestSchema = RunAnswerCommandPayloadSchema;
|
|
19472
|
-
CreateRunLifecycleCommandRequestSchema = external_exports.object({
|
|
19473
|
-
reason: external_exports.string().trim().min(1).optional()
|
|
19474
|
-
});
|
|
19475
|
-
CreateRunStopCommandRequestSchema = external_exports.object({
|
|
19476
|
-
reason: external_exports.string().trim().min(1).optional(),
|
|
19477
|
-
respawn: SingletonRespawnSchema.optional()
|
|
19478
|
-
});
|
|
19479
|
-
CreateSessionCommandRequestSchema = external_exports.discriminatedUnion("kind", [
|
|
19480
|
-
external_exports.object({
|
|
19481
|
-
kind: external_exports.literal("message"),
|
|
19482
|
-
payload: CreateRunMessageCommandRequestSchema
|
|
19483
|
-
}).strict(),
|
|
19484
|
-
external_exports.object({
|
|
19485
|
-
kind: external_exports.literal("answer"),
|
|
19486
|
-
payload: CreateRunAnswerCommandRequestSchema
|
|
19487
|
-
}).strict(),
|
|
19488
|
-
external_exports.object({
|
|
19489
|
-
kind: external_exports.literal("pause"),
|
|
19490
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
19491
|
-
}).strict(),
|
|
19492
|
-
external_exports.object({
|
|
19493
|
-
kind: external_exports.literal("resume"),
|
|
19494
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
19495
|
-
}).strict(),
|
|
19496
|
-
external_exports.object({
|
|
19497
|
-
kind: external_exports.literal("interrupt"),
|
|
19498
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
19499
|
-
}).strict(),
|
|
19500
|
-
external_exports.object({
|
|
19501
|
-
kind: external_exports.literal("cancel"),
|
|
19502
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
19503
|
-
}).strict(),
|
|
19504
|
-
external_exports.object({
|
|
19505
|
-
kind: external_exports.literal("stop"),
|
|
19506
|
-
payload: CreateRunStopCommandRequestSchema
|
|
19507
|
-
}).strict()
|
|
19508
|
-
]);
|
|
19509
|
-
RunResolutionPolicySchema = external_exports.enum([
|
|
19510
|
-
"singletonLiveRun",
|
|
19511
|
-
"latestLiveRun",
|
|
19512
|
-
"latestRun"
|
|
19513
|
-
]);
|
|
19514
|
-
AgentAddressedCommandTargetSchema = external_exports.object({
|
|
19515
|
-
agentId: AgentIdSchema.optional(),
|
|
19516
|
-
agentName: external_exports.string().trim().min(1).optional(),
|
|
19517
|
-
resolutionPolicy: RunResolutionPolicySchema
|
|
19518
|
-
}).refine((value) => Boolean(value.agentId) !== Boolean(value.agentName), {
|
|
19519
|
-
message: "Provide exactly one of agentId or agentName"
|
|
19520
|
-
});
|
|
19521
|
-
SessionCommandRecordBaseSchema = external_exports.object({
|
|
19522
|
-
id: SessionCommandIdSchema,
|
|
19523
|
-
sessionId: SessionIdSchema,
|
|
19524
|
-
sender: SessionCommandSenderSchema,
|
|
19525
|
-
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
19526
|
-
status: SessionCommandStatusSchema,
|
|
19527
|
-
attemptCount: external_exports.number().int().nonnegative(),
|
|
19528
|
-
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
19529
|
-
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
19530
|
-
acceptedAt: external_exports.string().datetime().nullable(),
|
|
19531
|
-
failedAt: external_exports.string().datetime().nullable(),
|
|
19532
|
-
error: JsonValueSchema.nullable(),
|
|
19533
|
-
createdAt: external_exports.string().datetime(),
|
|
19534
|
-
updatedAt: external_exports.string().datetime()
|
|
19537
|
+
* entries), so on very long sessions `errors` and `durationMs` can understate
|
|
19538
|
+
* relative to the session-wide `calls`.
|
|
19539
|
+
*/
|
|
19540
|
+
errors: external_exports.number().int().nonnegative(),
|
|
19541
|
+
durationMs: external_exports.object({
|
|
19542
|
+
p50: external_exports.number().nonnegative().nullable(),
|
|
19543
|
+
max: external_exports.number().nonnegative().nullable()
|
|
19544
|
+
})
|
|
19535
19545
|
});
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
RunStartWithMessageCommandPayloadSchema
|
|
19550
|
-
]);
|
|
19551
|
-
SessionCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
19552
|
-
SessionCommandRecordBaseSchema.extend({
|
|
19553
|
-
kind: external_exports.literal("message"),
|
|
19554
|
-
payload: RunMessageCommandPayloadSchema
|
|
19555
|
-
}),
|
|
19556
|
-
SessionCommandRecordBaseSchema.extend({
|
|
19557
|
-
kind: external_exports.literal("answer"),
|
|
19558
|
-
payload: RunAnswerCommandPayloadSchema
|
|
19546
|
+
RunSummarySchema = external_exports.object({
|
|
19547
|
+
session: external_exports.object({
|
|
19548
|
+
id: SessionIdSchema,
|
|
19549
|
+
agentName: external_exports.string(),
|
|
19550
|
+
displayTitle: external_exports.string(),
|
|
19551
|
+
ambientStatus: AmbientStatusSchema.nullable(),
|
|
19552
|
+
status: SessionStatusSchema,
|
|
19553
|
+
error: JsonValueSchema.nullable(),
|
|
19554
|
+
workflowId: external_exports.string(),
|
|
19555
|
+
createdAt: external_exports.string().datetime(),
|
|
19556
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
19557
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
19558
|
+
archivedAt: external_exports.string().datetime().nullable()
|
|
19559
19559
|
}),
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19560
|
+
timing: external_exports.object({
|
|
19561
|
+
/** `startedAt - createdAt`; null until the session starts. */
|
|
19562
|
+
queuedMs: external_exports.number().int().nonnegative().nullable(),
|
|
19563
|
+
/** `(finishedAt ?? now) - startedAt`; null until the session starts. */
|
|
19564
|
+
activeMs: external_exports.number().int().nonnegative().nullable(),
|
|
19565
|
+
/** `(finishedAt ?? now) - createdAt`. */
|
|
19566
|
+
totalMs: external_exports.number().int().nonnegative()
|
|
19563
19567
|
}),
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19568
|
+
conversation: external_exports.object({
|
|
19569
|
+
entryCount: external_exports.number().int().nonnegative(),
|
|
19570
|
+
firstEntryAt: external_exports.string().datetime().nullable(),
|
|
19571
|
+
lastEntryAt: external_exports.string().datetime().nullable(),
|
|
19572
|
+
countsByKind: external_exports.object({
|
|
19573
|
+
status: external_exports.number().int().nonnegative(),
|
|
19574
|
+
message: external_exports.number().int().nonnegative(),
|
|
19575
|
+
tool_call: external_exports.number().int().nonnegative(),
|
|
19576
|
+
tool_result: external_exports.number().int().nonnegative(),
|
|
19577
|
+
question: external_exports.number().int().nonnegative()
|
|
19578
|
+
}),
|
|
19579
|
+
failedEntryCount: external_exports.number().int().nonnegative(),
|
|
19580
|
+
lastSequence: external_exports.number().int().nonnegative()
|
|
19567
19581
|
}),
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19582
|
+
tools: external_exports.array(SessionToolStatSchema),
|
|
19583
|
+
/**
|
|
19584
|
+
* True when the session has more conversation entries than the summary's
|
|
19585
|
+
* recent-entries window, meaning per-tool `errors`/`durationMs` (and
|
|
19586
|
+
* `turns`) describe only the most recent slice of the session.
|
|
19587
|
+
*/
|
|
19588
|
+
toolStatsWindowed: external_exports.boolean(),
|
|
19589
|
+
trigger: external_exports.object({
|
|
19590
|
+
/** Spawning event key, or "manual" / "agent" for actor-started sessions. */
|
|
19591
|
+
spawn: external_exports.string(),
|
|
19592
|
+
signaledCount: external_exports.number().int().nonnegative(),
|
|
19593
|
+
droppedCount: external_exports.number().int().nonnegative()
|
|
19571
19594
|
}),
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19595
|
+
artifacts: external_exports.object({
|
|
19596
|
+
count: external_exports.number().int().nonnegative(),
|
|
19597
|
+
types: external_exports.array(external_exports.string())
|
|
19575
19598
|
}),
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19599
|
+
/** Active session bindings, counted with their distinct target types. */
|
|
19600
|
+
bindings: external_exports.object({
|
|
19601
|
+
count: external_exports.number().int().nonnegative(),
|
|
19602
|
+
targetTypes: external_exports.array(BindingTargetTypeSchema)
|
|
19579
19603
|
}),
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19604
|
+
/** Derived per-user-message turns, capped to the most recent. */
|
|
19605
|
+
turns: external_exports.array(RunTurnSchema),
|
|
19606
|
+
commands: external_exports.object({
|
|
19607
|
+
total: external_exports.number().int().nonnegative(),
|
|
19608
|
+
byKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
|
|
19609
|
+
failed: external_exports.number().int().nonnegative()
|
|
19583
19610
|
}),
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19611
|
-
|
|
19611
|
+
checks: external_exports.array(
|
|
19612
|
+
external_exports.object({
|
|
19613
|
+
name: external_exports.string(),
|
|
19614
|
+
displayName: external_exports.string(),
|
|
19615
|
+
status: SessionCheckStatusSchema,
|
|
19616
|
+
conclusion: SessionCheckConclusionSchema.nullable(),
|
|
19617
|
+
completedAt: external_exports.string().datetime().nullable()
|
|
19618
|
+
})
|
|
19619
|
+
)
|
|
19620
|
+
});
|
|
19621
|
+
}
|
|
19622
|
+
});
|
|
19623
|
+
|
|
19624
|
+
// ../../packages/schemas/src/session-turns.ts
|
|
19625
|
+
var SESSION_TURN_STATUSES, SESSION_TURN_FAILURE_SCOPES, SessionTurnStatusSchema, SessionTurnFailureScopeSchema, SessionTurnRecordSchema;
|
|
19626
|
+
var init_session_turns = __esm({
|
|
19627
|
+
"../../packages/schemas/src/session-turns.ts"() {
|
|
19628
|
+
"use strict";
|
|
19629
|
+
init_zod();
|
|
19630
|
+
init_ids();
|
|
19631
|
+
init_primitives();
|
|
19632
|
+
SESSION_TURN_STATUSES = [
|
|
19633
|
+
"accepted",
|
|
19634
|
+
"in_progress",
|
|
19635
|
+
"waiting_for_input",
|
|
19636
|
+
"completed",
|
|
19637
|
+
"failed",
|
|
19638
|
+
"stale"
|
|
19639
|
+
];
|
|
19640
|
+
SESSION_TURN_FAILURE_SCOPES = ["turn", "session"];
|
|
19641
|
+
SessionTurnStatusSchema = external_exports.enum(SESSION_TURN_STATUSES);
|
|
19642
|
+
SessionTurnFailureScopeSchema = external_exports.enum(
|
|
19643
|
+
SESSION_TURN_FAILURE_SCOPES
|
|
19612
19644
|
);
|
|
19613
|
-
|
|
19614
|
-
id:
|
|
19645
|
+
SessionTurnRecordSchema = external_exports.object({
|
|
19646
|
+
id: external_exports.string().trim().min(1),
|
|
19615
19647
|
sessionId: SessionIdSchema,
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19648
|
+
commandId: SessionCommandIdSchema,
|
|
19649
|
+
runtimeId: RuntimeIdSchema.nullable(),
|
|
19650
|
+
bridgeLeaseId: RuntimeBridgeLeaseIdSchema.nullable(),
|
|
19651
|
+
status: SessionTurnStatusSchema,
|
|
19652
|
+
failureScope: SessionTurnFailureScopeSchema.nullable(),
|
|
19653
|
+
lastOutputSeq: external_exports.number().int().positive().nullable(),
|
|
19622
19654
|
acceptedAt: external_exports.string().datetime().nullable(),
|
|
19655
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
19656
|
+
lastProgressAt: external_exports.string().datetime().nullable(),
|
|
19657
|
+
completedAt: external_exports.string().datetime().nullable(),
|
|
19623
19658
|
failedAt: external_exports.string().datetime().nullable(),
|
|
19659
|
+
staleAt: external_exports.string().datetime().nullable(),
|
|
19624
19660
|
error: JsonValueSchema.nullable(),
|
|
19625
19661
|
createdAt: external_exports.string().datetime(),
|
|
19626
19662
|
updatedAt: external_exports.string().datetime()
|
|
19627
19663
|
});
|
|
19628
|
-
SessionDispatchCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
19629
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19630
|
-
kind: external_exports.literal("start"),
|
|
19631
|
-
payload: RunStartCommandPayloadSchema
|
|
19632
|
-
}),
|
|
19633
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19634
|
-
kind: external_exports.literal("startWithMessage"),
|
|
19635
|
-
payload: RunStartWithMessageCommandPayloadSchema
|
|
19636
|
-
}),
|
|
19637
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19638
|
-
kind: external_exports.literal("message"),
|
|
19639
|
-
payload: SessionDispatchMessageCommandPayloadSchema
|
|
19640
|
-
}),
|
|
19641
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19642
|
-
kind: external_exports.literal("answer"),
|
|
19643
|
-
payload: SessionDispatchAnswerCommandPayloadSchema
|
|
19644
|
-
}),
|
|
19645
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
19646
|
-
kind: external_exports.literal("stop"),
|
|
19647
|
-
payload: SessionDispatchStopCommandPayloadSchema
|
|
19648
|
-
})
|
|
19649
|
-
]);
|
|
19650
19664
|
}
|
|
19651
19665
|
});
|
|
19652
19666
|
|
|
@@ -24689,7 +24703,7 @@ var init_package = __esm({
|
|
|
24689
24703
|
"package.json"() {
|
|
24690
24704
|
package_default = {
|
|
24691
24705
|
name: "@autohq/cli",
|
|
24692
|
-
version: "0.1.
|
|
24706
|
+
version: "0.1.303",
|
|
24693
24707
|
license: "SEE LICENSE IN README.md",
|
|
24694
24708
|
publishConfig: {
|
|
24695
24709
|
access: "public"
|
|
@@ -35259,6 +35273,7 @@ var UiMessagePartTracker = class {
|
|
|
35259
35273
|
textPartIndexById = /* @__PURE__ */ new Map();
|
|
35260
35274
|
reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
35261
35275
|
toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
35276
|
+
approvalByCallId = /* @__PURE__ */ new Map();
|
|
35262
35277
|
dataPartIndexById = /* @__PURE__ */ new Map();
|
|
35263
35278
|
append(chunk) {
|
|
35264
35279
|
switch (chunk.type) {
|
|
@@ -35351,14 +35366,16 @@ var UiMessagePartTracker = class {
|
|
|
35351
35366
|
return [];
|
|
35352
35367
|
}
|
|
35353
35368
|
case "tool-input-available": {
|
|
35369
|
+
const pendingApproval = this.approvalByCallId.get(chunk.toolCallId);
|
|
35354
35370
|
const index = this.upsertToolPart(chunk.toolCallId, {
|
|
35355
35371
|
...toolPartShape({
|
|
35356
35372
|
toolCallId: chunk.toolCallId,
|
|
35357
35373
|
toolName: chunk.toolName,
|
|
35358
35374
|
dynamic: chunk.dynamic,
|
|
35359
|
-
state: "input-available"
|
|
35375
|
+
state: pendingApproval ? "approval-requested" : "input-available"
|
|
35360
35376
|
}),
|
|
35361
35377
|
input: chunk.input,
|
|
35378
|
+
...pendingApproval ? { approval: pendingApproval } : {},
|
|
35362
35379
|
...chunk.providerExecuted !== void 0 ? { providerExecuted: chunk.providerExecuted } : {},
|
|
35363
35380
|
...chunk.providerMetadata !== void 0 ? { callProviderMetadata: chunk.providerMetadata } : {}
|
|
35364
35381
|
});
|
|
@@ -35377,6 +35394,24 @@ var UiMessagePartTracker = class {
|
|
|
35377
35394
|
});
|
|
35378
35395
|
return this.persistable(index);
|
|
35379
35396
|
}
|
|
35397
|
+
case "tool-approval-request": {
|
|
35398
|
+
const approval = {
|
|
35399
|
+
id: chunk.approvalId,
|
|
35400
|
+
...chunk.signature != null ? { signature: chunk.signature } : {}
|
|
35401
|
+
};
|
|
35402
|
+
this.approvalByCallId.set(chunk.toolCallId, approval);
|
|
35403
|
+
const part = this.partById(
|
|
35404
|
+
this.toolPartIndexByCallId,
|
|
35405
|
+
chunk.toolCallId
|
|
35406
|
+
);
|
|
35407
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
35408
|
+
if (!part || index === void 0) {
|
|
35409
|
+
return [];
|
|
35410
|
+
}
|
|
35411
|
+
part.state = "approval-requested";
|
|
35412
|
+
part.approval = approval;
|
|
35413
|
+
return this.persistable(index);
|
|
35414
|
+
}
|
|
35380
35415
|
case "tool-output-available": {
|
|
35381
35416
|
const part = this.partById(
|
|
35382
35417
|
this.toolPartIndexByCallId,
|
|
@@ -35389,6 +35424,20 @@ var UiMessagePartTracker = class {
|
|
|
35389
35424
|
part.state = "output-available";
|
|
35390
35425
|
part.output = chunk.output;
|
|
35391
35426
|
part.preliminary = chunk.preliminary;
|
|
35427
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
35428
|
+
return this.persistable(index);
|
|
35429
|
+
}
|
|
35430
|
+
case "tool-output-denied": {
|
|
35431
|
+
const part = this.partById(
|
|
35432
|
+
this.toolPartIndexByCallId,
|
|
35433
|
+
chunk.toolCallId
|
|
35434
|
+
);
|
|
35435
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
35436
|
+
if (!part || index === void 0) {
|
|
35437
|
+
return [];
|
|
35438
|
+
}
|
|
35439
|
+
part.state = "output-denied";
|
|
35440
|
+
this.settleApproval(part, chunk.toolCallId, { approved: false });
|
|
35392
35441
|
return this.persistable(index);
|
|
35393
35442
|
}
|
|
35394
35443
|
case "tool-output-error": {
|
|
@@ -35402,6 +35451,7 @@ var UiMessagePartTracker = class {
|
|
|
35402
35451
|
}
|
|
35403
35452
|
part.state = "output-error";
|
|
35404
35453
|
part.errorText = chunk.errorText;
|
|
35454
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
35405
35455
|
return this.persistable(index);
|
|
35406
35456
|
}
|
|
35407
35457
|
case "start-step": {
|
|
@@ -35509,6 +35559,16 @@ var UiMessagePartTracker = class {
|
|
|
35509
35559
|
}
|
|
35510
35560
|
return this.parts[index] ?? null;
|
|
35511
35561
|
}
|
|
35562
|
+
// The UIToolInvocation contract requires `approval.approved` on settled
|
|
35563
|
+
// states (`output-available`/`output-denied`), but the settling chunks don't
|
|
35564
|
+
// carry it — the outcome is implied by which chunk arrives. Stamp it onto a
|
|
35565
|
+
// previously requested approval; parts that never parked stay approval-free.
|
|
35566
|
+
settleApproval(part, toolCallId, outcome) {
|
|
35567
|
+
const approval = this.approvalByCallId.get(toolCallId);
|
|
35568
|
+
if (approval) {
|
|
35569
|
+
part.approval = { ...approval, approved: outcome.approved };
|
|
35570
|
+
}
|
|
35571
|
+
}
|
|
35512
35572
|
reset() {
|
|
35513
35573
|
this.messageId = null;
|
|
35514
35574
|
this.messageMetadata = void 0;
|
|
@@ -35517,6 +35577,7 @@ var UiMessagePartTracker = class {
|
|
|
35517
35577
|
this.textPartIndexById = /* @__PURE__ */ new Map();
|
|
35518
35578
|
this.reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
35519
35579
|
this.toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
35580
|
+
this.approvalByCallId = /* @__PURE__ */ new Map();
|
|
35520
35581
|
this.dataPartIndexById = /* @__PURE__ */ new Map();
|
|
35521
35582
|
}
|
|
35522
35583
|
};
|
|
@@ -35953,6 +36014,21 @@ function legacyToolEntry(chunk) {
|
|
|
35953
36014
|
]
|
|
35954
36015
|
}
|
|
35955
36016
|
};
|
|
36017
|
+
case "tool-output-denied":
|
|
36018
|
+
return {
|
|
36019
|
+
role: "tool",
|
|
36020
|
+
kind: "tool_result",
|
|
36021
|
+
content: {
|
|
36022
|
+
parts: [
|
|
36023
|
+
{
|
|
36024
|
+
type: "tool_result",
|
|
36025
|
+
toolUseId: legacyToolCallId(chunk.toolCallId),
|
|
36026
|
+
output: { denied: true },
|
|
36027
|
+
isError: true
|
|
36028
|
+
}
|
|
36029
|
+
]
|
|
36030
|
+
}
|
|
36031
|
+
};
|
|
35956
36032
|
default:
|
|
35957
36033
|
return null;
|
|
35958
36034
|
}
|
|
@@ -38095,15 +38171,19 @@ var CodexProjector = class {
|
|
|
38095
38171
|
return [];
|
|
38096
38172
|
}
|
|
38097
38173
|
}
|
|
38098
|
-
// An approval parks the turn on operator input, so
|
|
38099
|
-
//
|
|
38174
|
+
// An approval parks the turn on operator input, so both chunks mark the
|
|
38175
|
+
// delivered turn as waiting for input.
|
|
38100
38176
|
projectApproval(request) {
|
|
38101
38177
|
return [
|
|
38102
|
-
|
|
38103
|
-
type: "
|
|
38104
|
-
|
|
38105
|
-
|
|
38106
|
-
|
|
38178
|
+
{
|
|
38179
|
+
type: "ui_message_chunk",
|
|
38180
|
+
chunk: {
|
|
38181
|
+
type: "tool-approval-request",
|
|
38182
|
+
approvalId: String(request.requestId),
|
|
38183
|
+
toolCallId: request.itemId
|
|
38184
|
+
},
|
|
38185
|
+
turnStatus: "waiting_for_input"
|
|
38186
|
+
},
|
|
38107
38187
|
{
|
|
38108
38188
|
type: "ui_message_chunk",
|
|
38109
38189
|
chunk: {
|
|
@@ -38158,6 +38238,7 @@ var CodexProjector = class {
|
|
|
38158
38238
|
...item.cwd ? { cwd: item.cwd } : {}
|
|
38159
38239
|
},
|
|
38160
38240
|
output: item.aggregatedOutput ?? "",
|
|
38241
|
+
isDenied: isDeclinedStatus(item.status),
|
|
38161
38242
|
isError: isFailedStatus(item.status) || (item.exitCode ?? 0) !== 0,
|
|
38162
38243
|
title: item.command,
|
|
38163
38244
|
toolMetadata: statusMetadata(item.status, {
|
|
@@ -38171,6 +38252,7 @@ var CodexProjector = class {
|
|
|
38171
38252
|
name: "apply_patch",
|
|
38172
38253
|
input: { changes: toJsonValue(item.changes) },
|
|
38173
38254
|
output: { status: item.status ?? "unknown" },
|
|
38255
|
+
isDenied: isDeclinedStatus(item.status),
|
|
38174
38256
|
isError: isFailedStatus(item.status),
|
|
38175
38257
|
title: "apply_patch",
|
|
38176
38258
|
toolMetadata: statusMetadata(item.status)
|
|
@@ -38268,6 +38350,12 @@ function toolInputChunk(input) {
|
|
|
38268
38350
|
});
|
|
38269
38351
|
}
|
|
38270
38352
|
function toolOutputChunk(input) {
|
|
38353
|
+
if (input.isDenied) {
|
|
38354
|
+
return uiChunk2({
|
|
38355
|
+
type: "tool-output-denied",
|
|
38356
|
+
toolCallId: input.itemId
|
|
38357
|
+
});
|
|
38358
|
+
}
|
|
38271
38359
|
return uiChunk2(
|
|
38272
38360
|
input.isError ? {
|
|
38273
38361
|
type: "tool-output-error",
|
|
@@ -38338,6 +38426,9 @@ function reasoningPartId(itemId) {
|
|
|
38338
38426
|
function isFailedStatus(status) {
|
|
38339
38427
|
return status === "failed" || status === "declined";
|
|
38340
38428
|
}
|
|
38429
|
+
function isDeclinedStatus(status) {
|
|
38430
|
+
return status === "declined";
|
|
38431
|
+
}
|
|
38341
38432
|
function statusMetadata(status, fields = {}) {
|
|
38342
38433
|
return {
|
|
38343
38434
|
status: status ?? "unknown",
|