@autohq/cli 0.1.88 → 0.1.89

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.
@@ -21786,6 +21786,281 @@ var RunDiagnosticEventSchema = external_exports.object({
21786
21786
  createdAt: external_exports.string().datetime()
21787
21787
  });
21788
21788
 
21789
+ // ../../packages/schemas/src/session-runs.ts
21790
+ var SESSION_RUN_STATUSES = [
21791
+ "queued",
21792
+ "running",
21793
+ "awaiting",
21794
+ "failed",
21795
+ "stopped"
21796
+ ];
21797
+ var SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
21798
+ var SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
21799
+ var SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
21800
+ var SESSION_RUN_CHECK_STATUSES = [
21801
+ "queued",
21802
+ "in_progress",
21803
+ "completed"
21804
+ ];
21805
+ var SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
21806
+ var SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
21807
+ var SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
21808
+ var SessionRunCheckConclusionSchema = external_exports.enum(
21809
+ SESSION_RUN_CHECK_CONCLUSIONS
21810
+ );
21811
+ var SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
21812
+ SESSION_RUN_CHECK_TIMEOUT_PHASES
21813
+ );
21814
+ var ManualSessionRunRequestSchema = external_exports.object({
21815
+ message: external_exports.string().trim().min(1).max(2e4).optional(),
21816
+ interactive: external_exports.boolean().optional()
21817
+ });
21818
+ var SessionRunArchiveRequestSchema = external_exports.object({
21819
+ archived: external_exports.boolean()
21820
+ });
21821
+ var SessionRunsArchiveRequestSchema = external_exports.object({
21822
+ run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
21823
+ archived: external_exports.boolean()
21824
+ });
21825
+ var SessionRunRecordSchema = external_exports.object({
21826
+ id: SessionRunIdSchema2,
21827
+ organizationId: external_exports.string().trim().min(1),
21828
+ projectId: external_exports.string().trim().min(1).nullable(),
21829
+ sessionId: SessionIdSchema,
21830
+ runtimeId: RuntimeIdSchema2.nullable(),
21831
+ status: SessionRunStatusSchema,
21832
+ idempotencyKey: external_exports.string().min(1).nullable(),
21833
+ correlationKey: external_exports.string().nullable(),
21834
+ workflowId: external_exports.string().min(1),
21835
+ displayTitle: SessionRunDisplayTitleSchema,
21836
+ starterActor: AuthActorSchema.nullable(),
21837
+ sessionSnapshot: SessionResourceSchema,
21838
+ profileSnapshot: ProfileResourceSchema,
21839
+ environmentSnapshot: EnvironmentResourceSchema,
21840
+ toolSnapshots: external_exports.array(
21841
+ external_exports.discriminatedUnion("source", [
21842
+ external_exports.object({
21843
+ source: external_exports.literal("inline"),
21844
+ alias: ToolAliasSchema,
21845
+ spec: RemoteMcpToolSchema.or(LocalToolSchema)
21846
+ }),
21847
+ external_exports.object({
21848
+ source: external_exports.literal("resource"),
21849
+ alias: ToolAliasSchema,
21850
+ resource: ToolResourceSchema
21851
+ })
21852
+ ])
21853
+ ),
21854
+ input: JsonValueSchema2,
21855
+ createdAt: external_exports.string().datetime(),
21856
+ updatedAt: external_exports.string().datetime(),
21857
+ startedAt: external_exports.string().datetime().nullable(),
21858
+ finishedAt: external_exports.string().datetime().nullable(),
21859
+ archivedAt: external_exports.string().datetime().nullable(),
21860
+ error: JsonValueSchema2.nullable()
21861
+ });
21862
+ var SessionRunsArchiveResponseSchema = external_exports.object({
21863
+ archived: external_exports.boolean(),
21864
+ runs: external_exports.array(SessionRunRecordSchema)
21865
+ });
21866
+
21867
+ // ../../packages/schemas/src/run-introspection.ts
21868
+ var TruncatedValueSchema = external_exports.object({
21869
+ truncated: external_exports.literal(true),
21870
+ truncatedPreview: external_exports.string(),
21871
+ originalBytes: external_exports.number().int().nonnegative()
21872
+ });
21873
+ var RunConversationSearchSnippetSchema = external_exports.object({
21874
+ partIndex: external_exports.number().int().nonnegative(),
21875
+ partType: external_exports.string(),
21876
+ /** The search term this snippet was produced for. */
21877
+ query: external_exports.string(),
21878
+ text: external_exports.string()
21879
+ });
21880
+ var RunConversationSearchMatchSchema = external_exports.object({
21881
+ sequence: external_exports.number().int().nonnegative(),
21882
+ role: ConversationRoleSchema2,
21883
+ kind: ConversationEntryKindSchema2,
21884
+ status: ConversationEntryStatusSchema2,
21885
+ createdAt: external_exports.string().datetime(),
21886
+ /** Which of the requested terms matched this entry. */
21887
+ matchedQueries: external_exports.array(external_exports.string()),
21888
+ /** Total match occurrences across terms in this entry. */
21889
+ matchCount: external_exports.number().int().positive(),
21890
+ snippets: external_exports.array(RunConversationSearchSnippetSchema)
21891
+ });
21892
+ var RunConversationSearchResponseSchema = external_exports.object({
21893
+ matches: external_exports.array(RunConversationSearchMatchSchema),
21894
+ hasMore: external_exports.boolean(),
21895
+ /**
21896
+ * Sequence of the last candidate entry scanned (not just the last confirmed
21897
+ * match) — pass as `afterSequence` to continue without re-scanning
21898
+ * candidates the match confirmation dropped. Null when nothing was scanned.
21899
+ */
21900
+ nextAfterSequence: external_exports.number().int().nullable()
21901
+ });
21902
+ var RunToolExchangeSchema = external_exports.object({
21903
+ name: external_exports.string(),
21904
+ callSequence: external_exports.number().int().nonnegative(),
21905
+ resultSequence: external_exports.number().int().nonnegative().nullable(),
21906
+ input: JsonValueSchema2,
21907
+ output: JsonValueSchema2.nullable(),
21908
+ /** Null while the call has no recorded result. */
21909
+ isError: external_exports.boolean().nullable(),
21910
+ /** Result `completedAt` minus call `createdAt`; null without a result. */
21911
+ durationMs: external_exports.number().int().nonnegative().nullable(),
21912
+ startedAt: external_exports.string().datetime(),
21913
+ completedAt: external_exports.string().datetime().nullable()
21914
+ });
21915
+ var RunToolExchangesResponseSchema = external_exports.object({
21916
+ exchanges: external_exports.array(RunToolExchangeSchema),
21917
+ hasMore: external_exports.boolean(),
21918
+ /**
21919
+ * Sequence bounds of the entries window this page consumed (not just the
21920
+ * returned exchanges) — continue paging with `after`/`before` from these so
21921
+ * filtered-out entries are not re-scanned. Null when nothing was scanned.
21922
+ */
21923
+ nextAfterSequence: external_exports.number().int().nullable(),
21924
+ nextBeforeSequence: external_exports.number().int().nullable()
21925
+ });
21926
+ var RUN_TRIGGER_DELIVERY_ACTIONS = [
21927
+ "started",
21928
+ "signaled",
21929
+ "dropped",
21930
+ "warned",
21931
+ "errored"
21932
+ ];
21933
+ var RunTriggerDeliveryActionSchema = external_exports.enum(
21934
+ RUN_TRIGGER_DELIVERY_ACTIONS
21935
+ );
21936
+ var RUN_EVENT_ORIGIN_KINDS = [
21937
+ "internal",
21938
+ "provider_grant",
21939
+ "webhook"
21940
+ ];
21941
+ var RunEventOriginKindSchema = external_exports.enum(RUN_EVENT_ORIGIN_KINDS);
21942
+ var RunTriggerDeliveryRecordSchema = external_exports.object({
21943
+ action: RunTriggerDeliveryActionSchema,
21944
+ triggerId: external_exports.string(),
21945
+ eventKey: external_exports.string(),
21946
+ originKind: RunEventOriginKindSchema,
21947
+ occurredAt: external_exports.string().datetime(),
21948
+ receivedAt: external_exports.string().datetime(),
21949
+ deliveredAt: external_exports.string().datetime(),
21950
+ reason: external_exports.string().nullable(),
21951
+ /** Event payload; may be a {@link TruncatedValueSchema} marker. */
21952
+ payload: JsonValueSchema2.optional()
21953
+ });
21954
+ var RunTriggersResponseSchema = external_exports.object({
21955
+ /** The `started` delivery that spawned the run; null for manual/agent spawns. */
21956
+ spawn: RunTriggerDeliveryRecordSchema.nullable(),
21957
+ /** Who started the run, for manual/CLI/agent spawns. */
21958
+ starter: AuthActorSchema.nullable(),
21959
+ /** Subsequent deliveries against the run, chronological. */
21960
+ deliveries: external_exports.array(RunTriggerDeliveryRecordSchema)
21961
+ });
21962
+ var RunArtifactRecordSchema = external_exports.object({
21963
+ artifactType: external_exports.string(),
21964
+ externalId: external_exports.string(),
21965
+ payload: JsonValueSchema2,
21966
+ recordedAt: external_exports.string().datetime()
21967
+ });
21968
+ var RunArtifactsResponseSchema = external_exports.object({
21969
+ artifacts: external_exports.array(RunArtifactRecordSchema)
21970
+ });
21971
+ var RunTurnSchema = external_exports.object({
21972
+ startSequence: external_exports.number().int().nonnegative(),
21973
+ endSequence: external_exports.number().int().nonnegative(),
21974
+ startedAt: external_exports.string().datetime(),
21975
+ completedAt: external_exports.string().datetime().nullable(),
21976
+ toolCallCount: external_exports.number().int().nonnegative()
21977
+ });
21978
+ var RunToolStatSchema = external_exports.object({
21979
+ name: external_exports.string(),
21980
+ /** Run-wide call count from the SQL aggregate. */
21981
+ calls: external_exports.number().int().nonnegative(),
21982
+ /**
21983
+ * Derived from the summary's recent-entries window (most recent ~1000
21984
+ * entries), so on very long runs `errors` and `durationMs` can understate
21985
+ * relative to the run-wide `calls`.
21986
+ */
21987
+ errors: external_exports.number().int().nonnegative(),
21988
+ durationMs: external_exports.object({
21989
+ p50: external_exports.number().nonnegative().nullable(),
21990
+ max: external_exports.number().nonnegative().nullable()
21991
+ })
21992
+ });
21993
+ var RunSummarySchema = external_exports.object({
21994
+ run: external_exports.object({
21995
+ id: SessionRunIdSchema2,
21996
+ sessionName: external_exports.string(),
21997
+ profileName: external_exports.string(),
21998
+ displayTitle: external_exports.string(),
21999
+ status: SessionRunStatusSchema,
22000
+ error: JsonValueSchema2.nullable(),
22001
+ workflowId: external_exports.string(),
22002
+ createdAt: external_exports.string().datetime(),
22003
+ startedAt: external_exports.string().datetime().nullable(),
22004
+ finishedAt: external_exports.string().datetime().nullable(),
22005
+ archivedAt: external_exports.string().datetime().nullable()
22006
+ }),
22007
+ timing: external_exports.object({
22008
+ /** `startedAt - createdAt`; null until the run starts. */
22009
+ queuedMs: external_exports.number().int().nonnegative().nullable(),
22010
+ /** `(finishedAt ?? now) - startedAt`; null until the run starts. */
22011
+ activeMs: external_exports.number().int().nonnegative().nullable(),
22012
+ /** `(finishedAt ?? now) - createdAt`. */
22013
+ totalMs: external_exports.number().int().nonnegative()
22014
+ }),
22015
+ conversation: external_exports.object({
22016
+ entryCount: external_exports.number().int().nonnegative(),
22017
+ firstEntryAt: external_exports.string().datetime().nullable(),
22018
+ lastEntryAt: external_exports.string().datetime().nullable(),
22019
+ countsByKind: external_exports.object({
22020
+ status: external_exports.number().int().nonnegative(),
22021
+ message: external_exports.number().int().nonnegative(),
22022
+ tool_call: external_exports.number().int().nonnegative(),
22023
+ tool_result: external_exports.number().int().nonnegative(),
22024
+ question: external_exports.number().int().nonnegative()
22025
+ }),
22026
+ failedEntryCount: external_exports.number().int().nonnegative(),
22027
+ lastSequence: external_exports.number().int().nonnegative()
22028
+ }),
22029
+ tools: external_exports.array(RunToolStatSchema),
22030
+ /**
22031
+ * True when the run has more conversation entries than the summary's
22032
+ * recent-entries window, meaning per-tool `errors`/`durationMs` (and
22033
+ * `turns`) describe only the most recent slice of the run.
22034
+ */
22035
+ toolStatsWindowed: external_exports.boolean(),
22036
+ trigger: external_exports.object({
22037
+ /** Spawning event key, or "manual" / "agent" for actor-started runs. */
22038
+ spawn: external_exports.string(),
22039
+ signaledCount: external_exports.number().int().nonnegative(),
22040
+ droppedCount: external_exports.number().int().nonnegative()
22041
+ }),
22042
+ artifacts: external_exports.object({
22043
+ count: external_exports.number().int().nonnegative(),
22044
+ types: external_exports.array(external_exports.string())
22045
+ }),
22046
+ /** Derived per-user-message turns, capped to the most recent. */
22047
+ turns: external_exports.array(RunTurnSchema),
22048
+ commands: external_exports.object({
22049
+ total: external_exports.number().int().nonnegative(),
22050
+ byKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
22051
+ failed: external_exports.number().int().nonnegative()
22052
+ }),
22053
+ checks: external_exports.array(
22054
+ external_exports.object({
22055
+ name: external_exports.string(),
22056
+ displayName: external_exports.string(),
22057
+ status: SessionRunCheckStatusSchema,
22058
+ conclusion: SessionRunCheckConclusionSchema.nullable(),
22059
+ completedAt: external_exports.string().datetime().nullable()
22060
+ })
22061
+ )
22062
+ });
22063
+
21789
22064
  // ../../packages/schemas/src/session-run-commands.ts
21790
22065
  var SESSION_RUN_COMMAND_KINDS = [
21791
22066
  "message",
@@ -22084,84 +22359,6 @@ var RunCommandDispatchSignalPayloadSchema = external_exports.object({
22084
22359
  }).strict();
22085
22360
  var RealtimeRunCursorSchema = external_exports.string().regex(/^rt:(0|[1-9]\d*)$/);
22086
22361
 
22087
- // ../../packages/schemas/src/session-runs.ts
22088
- var SESSION_RUN_STATUSES = [
22089
- "queued",
22090
- "running",
22091
- "awaiting",
22092
- "failed",
22093
- "stopped"
22094
- ];
22095
- var SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
22096
- var SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
22097
- var SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
22098
- var SESSION_RUN_CHECK_STATUSES = [
22099
- "queued",
22100
- "in_progress",
22101
- "completed"
22102
- ];
22103
- var SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
22104
- var SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
22105
- var SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
22106
- var SessionRunCheckConclusionSchema = external_exports.enum(
22107
- SESSION_RUN_CHECK_CONCLUSIONS
22108
- );
22109
- var SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
22110
- SESSION_RUN_CHECK_TIMEOUT_PHASES
22111
- );
22112
- var ManualSessionRunRequestSchema = external_exports.object({
22113
- message: external_exports.string().trim().min(1).max(2e4).optional(),
22114
- interactive: external_exports.boolean().optional()
22115
- });
22116
- var SessionRunArchiveRequestSchema = external_exports.object({
22117
- archived: external_exports.boolean()
22118
- });
22119
- var SessionRunsArchiveRequestSchema = external_exports.object({
22120
- run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
22121
- archived: external_exports.boolean()
22122
- });
22123
- var SessionRunRecordSchema = external_exports.object({
22124
- id: SessionRunIdSchema2,
22125
- organizationId: external_exports.string().trim().min(1),
22126
- projectId: external_exports.string().trim().min(1).nullable(),
22127
- sessionId: SessionIdSchema,
22128
- runtimeId: RuntimeIdSchema2.nullable(),
22129
- status: SessionRunStatusSchema,
22130
- idempotencyKey: external_exports.string().min(1).nullable(),
22131
- correlationKey: external_exports.string().nullable(),
22132
- workflowId: external_exports.string().min(1),
22133
- displayTitle: SessionRunDisplayTitleSchema,
22134
- starterActor: AuthActorSchema.nullable(),
22135
- sessionSnapshot: SessionResourceSchema,
22136
- profileSnapshot: ProfileResourceSchema,
22137
- environmentSnapshot: EnvironmentResourceSchema,
22138
- toolSnapshots: external_exports.array(
22139
- external_exports.discriminatedUnion("source", [
22140
- external_exports.object({
22141
- source: external_exports.literal("inline"),
22142
- alias: ToolAliasSchema,
22143
- spec: RemoteMcpToolSchema.or(LocalToolSchema)
22144
- }),
22145
- external_exports.object({
22146
- source: external_exports.literal("resource"),
22147
- alias: ToolAliasSchema,
22148
- resource: ToolResourceSchema
22149
- })
22150
- ])
22151
- ),
22152
- input: JsonValueSchema2,
22153
- createdAt: external_exports.string().datetime(),
22154
- updatedAt: external_exports.string().datetime(),
22155
- startedAt: external_exports.string().datetime().nullable(),
22156
- finishedAt: external_exports.string().datetime().nullable(),
22157
- archivedAt: external_exports.string().datetime().nullable(),
22158
- error: JsonValueSchema2.nullable()
22159
- });
22160
- var SessionRunsArchiveResponseSchema = external_exports.object({
22161
- archived: external_exports.boolean(),
22162
- runs: external_exports.array(SessionRunRecordSchema)
22163
- });
22164
-
22165
22362
  // ../../packages/schemas/src/temporal.ts
22166
22363
  var ResourceReconciliationScopeSchema = external_exports.object({
22167
22364
  organizationId: external_exports.string().trim().min(1),
package/dist/index.js CHANGED
@@ -17654,6 +17654,307 @@ var init_run_diagnostics = __esm({
17654
17654
  }
17655
17655
  });
17656
17656
 
17657
+ // ../../packages/schemas/src/session-runs.ts
17658
+ var SESSION_RUN_STATUSES, SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH, SessionRunStatusSchema, SessionRunDisplayTitleSchema, SESSION_RUN_CHECK_STATUSES, SESSION_RUN_CHECK_CONCLUSIONS, SESSION_RUN_CHECK_TIMEOUT_PHASES, SessionRunCheckStatusSchema, SessionRunCheckConclusionSchema, SessionRunCheckTimeoutPhaseSchema, ManualSessionRunRequestSchema, SessionRunArchiveRequestSchema, SessionRunsArchiveRequestSchema, SessionRunRecordSchema, SessionRunsArchiveResponseSchema;
17659
+ var init_session_runs = __esm({
17660
+ "../../packages/schemas/src/session-runs.ts"() {
17661
+ "use strict";
17662
+ init_zod();
17663
+ init_auth();
17664
+ init_environments();
17665
+ init_ids();
17666
+ init_primitives();
17667
+ init_profiles();
17668
+ init_sessions();
17669
+ init_tools();
17670
+ SESSION_RUN_STATUSES = [
17671
+ "queued",
17672
+ "running",
17673
+ "awaiting",
17674
+ "failed",
17675
+ "stopped"
17676
+ ];
17677
+ SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
17678
+ SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
17679
+ SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
17680
+ SESSION_RUN_CHECK_STATUSES = [
17681
+ "queued",
17682
+ "in_progress",
17683
+ "completed"
17684
+ ];
17685
+ SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
17686
+ SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
17687
+ SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
17688
+ SessionRunCheckConclusionSchema = external_exports.enum(
17689
+ SESSION_RUN_CHECK_CONCLUSIONS
17690
+ );
17691
+ SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
17692
+ SESSION_RUN_CHECK_TIMEOUT_PHASES
17693
+ );
17694
+ ManualSessionRunRequestSchema = external_exports.object({
17695
+ message: external_exports.string().trim().min(1).max(2e4).optional(),
17696
+ interactive: external_exports.boolean().optional()
17697
+ });
17698
+ SessionRunArchiveRequestSchema = external_exports.object({
17699
+ archived: external_exports.boolean()
17700
+ });
17701
+ SessionRunsArchiveRequestSchema = external_exports.object({
17702
+ run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
17703
+ archived: external_exports.boolean()
17704
+ });
17705
+ SessionRunRecordSchema = external_exports.object({
17706
+ id: SessionRunIdSchema2,
17707
+ organizationId: external_exports.string().trim().min(1),
17708
+ projectId: external_exports.string().trim().min(1).nullable(),
17709
+ sessionId: SessionIdSchema,
17710
+ runtimeId: RuntimeIdSchema2.nullable(),
17711
+ status: SessionRunStatusSchema,
17712
+ idempotencyKey: external_exports.string().min(1).nullable(),
17713
+ correlationKey: external_exports.string().nullable(),
17714
+ workflowId: external_exports.string().min(1),
17715
+ displayTitle: SessionRunDisplayTitleSchema,
17716
+ starterActor: AuthActorSchema.nullable(),
17717
+ sessionSnapshot: SessionResourceSchema,
17718
+ profileSnapshot: ProfileResourceSchema,
17719
+ environmentSnapshot: EnvironmentResourceSchema,
17720
+ toolSnapshots: external_exports.array(
17721
+ external_exports.discriminatedUnion("source", [
17722
+ external_exports.object({
17723
+ source: external_exports.literal("inline"),
17724
+ alias: ToolAliasSchema,
17725
+ spec: RemoteMcpToolSchema.or(LocalToolSchema)
17726
+ }),
17727
+ external_exports.object({
17728
+ source: external_exports.literal("resource"),
17729
+ alias: ToolAliasSchema,
17730
+ resource: ToolResourceSchema
17731
+ })
17732
+ ])
17733
+ ),
17734
+ input: JsonValueSchema2,
17735
+ createdAt: external_exports.string().datetime(),
17736
+ updatedAt: external_exports.string().datetime(),
17737
+ startedAt: external_exports.string().datetime().nullable(),
17738
+ finishedAt: external_exports.string().datetime().nullable(),
17739
+ archivedAt: external_exports.string().datetime().nullable(),
17740
+ error: JsonValueSchema2.nullable()
17741
+ });
17742
+ SessionRunsArchiveResponseSchema = external_exports.object({
17743
+ archived: external_exports.boolean(),
17744
+ runs: external_exports.array(SessionRunRecordSchema)
17745
+ });
17746
+ }
17747
+ });
17748
+
17749
+ // ../../packages/schemas/src/run-introspection.ts
17750
+ var TruncatedValueSchema, RunConversationSearchSnippetSchema, RunConversationSearchMatchSchema, RunConversationSearchResponseSchema, RunToolExchangeSchema, RunToolExchangesResponseSchema, RUN_TRIGGER_DELIVERY_ACTIONS, RunTriggerDeliveryActionSchema, RUN_EVENT_ORIGIN_KINDS, RunEventOriginKindSchema, RunTriggerDeliveryRecordSchema, RunTriggersResponseSchema, RunArtifactRecordSchema, RunArtifactsResponseSchema, RunTurnSchema, RunToolStatSchema, RunSummarySchema;
17751
+ var init_run_introspection = __esm({
17752
+ "../../packages/schemas/src/run-introspection.ts"() {
17753
+ "use strict";
17754
+ init_zod();
17755
+ init_auth();
17756
+ init_conversation();
17757
+ init_ids();
17758
+ init_primitives();
17759
+ init_session_runs();
17760
+ TruncatedValueSchema = external_exports.object({
17761
+ truncated: external_exports.literal(true),
17762
+ truncatedPreview: external_exports.string(),
17763
+ originalBytes: external_exports.number().int().nonnegative()
17764
+ });
17765
+ RunConversationSearchSnippetSchema = external_exports.object({
17766
+ partIndex: external_exports.number().int().nonnegative(),
17767
+ partType: external_exports.string(),
17768
+ /** The search term this snippet was produced for. */
17769
+ query: external_exports.string(),
17770
+ text: external_exports.string()
17771
+ });
17772
+ RunConversationSearchMatchSchema = external_exports.object({
17773
+ sequence: external_exports.number().int().nonnegative(),
17774
+ role: ConversationRoleSchema2,
17775
+ kind: ConversationEntryKindSchema2,
17776
+ status: ConversationEntryStatusSchema2,
17777
+ createdAt: external_exports.string().datetime(),
17778
+ /** Which of the requested terms matched this entry. */
17779
+ matchedQueries: external_exports.array(external_exports.string()),
17780
+ /** Total match occurrences across terms in this entry. */
17781
+ matchCount: external_exports.number().int().positive(),
17782
+ snippets: external_exports.array(RunConversationSearchSnippetSchema)
17783
+ });
17784
+ RunConversationSearchResponseSchema = external_exports.object({
17785
+ matches: external_exports.array(RunConversationSearchMatchSchema),
17786
+ hasMore: external_exports.boolean(),
17787
+ /**
17788
+ * Sequence of the last candidate entry scanned (not just the last confirmed
17789
+ * match) — pass as `afterSequence` to continue without re-scanning
17790
+ * candidates the match confirmation dropped. Null when nothing was scanned.
17791
+ */
17792
+ nextAfterSequence: external_exports.number().int().nullable()
17793
+ });
17794
+ RunToolExchangeSchema = external_exports.object({
17795
+ name: external_exports.string(),
17796
+ callSequence: external_exports.number().int().nonnegative(),
17797
+ resultSequence: external_exports.number().int().nonnegative().nullable(),
17798
+ input: JsonValueSchema2,
17799
+ output: JsonValueSchema2.nullable(),
17800
+ /** Null while the call has no recorded result. */
17801
+ isError: external_exports.boolean().nullable(),
17802
+ /** Result `completedAt` minus call `createdAt`; null without a result. */
17803
+ durationMs: external_exports.number().int().nonnegative().nullable(),
17804
+ startedAt: external_exports.string().datetime(),
17805
+ completedAt: external_exports.string().datetime().nullable()
17806
+ });
17807
+ RunToolExchangesResponseSchema = external_exports.object({
17808
+ exchanges: external_exports.array(RunToolExchangeSchema),
17809
+ hasMore: external_exports.boolean(),
17810
+ /**
17811
+ * Sequence bounds of the entries window this page consumed (not just the
17812
+ * returned exchanges) — continue paging with `after`/`before` from these so
17813
+ * filtered-out entries are not re-scanned. Null when nothing was scanned.
17814
+ */
17815
+ nextAfterSequence: external_exports.number().int().nullable(),
17816
+ nextBeforeSequence: external_exports.number().int().nullable()
17817
+ });
17818
+ RUN_TRIGGER_DELIVERY_ACTIONS = [
17819
+ "started",
17820
+ "signaled",
17821
+ "dropped",
17822
+ "warned",
17823
+ "errored"
17824
+ ];
17825
+ RunTriggerDeliveryActionSchema = external_exports.enum(
17826
+ RUN_TRIGGER_DELIVERY_ACTIONS
17827
+ );
17828
+ RUN_EVENT_ORIGIN_KINDS = [
17829
+ "internal",
17830
+ "provider_grant",
17831
+ "webhook"
17832
+ ];
17833
+ RunEventOriginKindSchema = external_exports.enum(RUN_EVENT_ORIGIN_KINDS);
17834
+ RunTriggerDeliveryRecordSchema = external_exports.object({
17835
+ action: RunTriggerDeliveryActionSchema,
17836
+ triggerId: external_exports.string(),
17837
+ eventKey: external_exports.string(),
17838
+ originKind: RunEventOriginKindSchema,
17839
+ occurredAt: external_exports.string().datetime(),
17840
+ receivedAt: external_exports.string().datetime(),
17841
+ deliveredAt: external_exports.string().datetime(),
17842
+ reason: external_exports.string().nullable(),
17843
+ /** Event payload; may be a {@link TruncatedValueSchema} marker. */
17844
+ payload: JsonValueSchema2.optional()
17845
+ });
17846
+ RunTriggersResponseSchema = external_exports.object({
17847
+ /** The `started` delivery that spawned the run; null for manual/agent spawns. */
17848
+ spawn: RunTriggerDeliveryRecordSchema.nullable(),
17849
+ /** Who started the run, for manual/CLI/agent spawns. */
17850
+ starter: AuthActorSchema.nullable(),
17851
+ /** Subsequent deliveries against the run, chronological. */
17852
+ deliveries: external_exports.array(RunTriggerDeliveryRecordSchema)
17853
+ });
17854
+ RunArtifactRecordSchema = external_exports.object({
17855
+ artifactType: external_exports.string(),
17856
+ externalId: external_exports.string(),
17857
+ payload: JsonValueSchema2,
17858
+ recordedAt: external_exports.string().datetime()
17859
+ });
17860
+ RunArtifactsResponseSchema = external_exports.object({
17861
+ artifacts: external_exports.array(RunArtifactRecordSchema)
17862
+ });
17863
+ RunTurnSchema = external_exports.object({
17864
+ startSequence: external_exports.number().int().nonnegative(),
17865
+ endSequence: external_exports.number().int().nonnegative(),
17866
+ startedAt: external_exports.string().datetime(),
17867
+ completedAt: external_exports.string().datetime().nullable(),
17868
+ toolCallCount: external_exports.number().int().nonnegative()
17869
+ });
17870
+ RunToolStatSchema = external_exports.object({
17871
+ name: external_exports.string(),
17872
+ /** Run-wide call count from the SQL aggregate. */
17873
+ calls: external_exports.number().int().nonnegative(),
17874
+ /**
17875
+ * Derived from the summary's recent-entries window (most recent ~1000
17876
+ * entries), so on very long runs `errors` and `durationMs` can understate
17877
+ * relative to the run-wide `calls`.
17878
+ */
17879
+ errors: external_exports.number().int().nonnegative(),
17880
+ durationMs: external_exports.object({
17881
+ p50: external_exports.number().nonnegative().nullable(),
17882
+ max: external_exports.number().nonnegative().nullable()
17883
+ })
17884
+ });
17885
+ RunSummarySchema = external_exports.object({
17886
+ run: external_exports.object({
17887
+ id: SessionRunIdSchema2,
17888
+ sessionName: external_exports.string(),
17889
+ profileName: external_exports.string(),
17890
+ displayTitle: external_exports.string(),
17891
+ status: SessionRunStatusSchema,
17892
+ error: JsonValueSchema2.nullable(),
17893
+ workflowId: external_exports.string(),
17894
+ createdAt: external_exports.string().datetime(),
17895
+ startedAt: external_exports.string().datetime().nullable(),
17896
+ finishedAt: external_exports.string().datetime().nullable(),
17897
+ archivedAt: external_exports.string().datetime().nullable()
17898
+ }),
17899
+ timing: external_exports.object({
17900
+ /** `startedAt - createdAt`; null until the run starts. */
17901
+ queuedMs: external_exports.number().int().nonnegative().nullable(),
17902
+ /** `(finishedAt ?? now) - startedAt`; null until the run starts. */
17903
+ activeMs: external_exports.number().int().nonnegative().nullable(),
17904
+ /** `(finishedAt ?? now) - createdAt`. */
17905
+ totalMs: external_exports.number().int().nonnegative()
17906
+ }),
17907
+ conversation: external_exports.object({
17908
+ entryCount: external_exports.number().int().nonnegative(),
17909
+ firstEntryAt: external_exports.string().datetime().nullable(),
17910
+ lastEntryAt: external_exports.string().datetime().nullable(),
17911
+ countsByKind: external_exports.object({
17912
+ status: external_exports.number().int().nonnegative(),
17913
+ message: external_exports.number().int().nonnegative(),
17914
+ tool_call: external_exports.number().int().nonnegative(),
17915
+ tool_result: external_exports.number().int().nonnegative(),
17916
+ question: external_exports.number().int().nonnegative()
17917
+ }),
17918
+ failedEntryCount: external_exports.number().int().nonnegative(),
17919
+ lastSequence: external_exports.number().int().nonnegative()
17920
+ }),
17921
+ tools: external_exports.array(RunToolStatSchema),
17922
+ /**
17923
+ * True when the run has more conversation entries than the summary's
17924
+ * recent-entries window, meaning per-tool `errors`/`durationMs` (and
17925
+ * `turns`) describe only the most recent slice of the run.
17926
+ */
17927
+ toolStatsWindowed: external_exports.boolean(),
17928
+ trigger: external_exports.object({
17929
+ /** Spawning event key, or "manual" / "agent" for actor-started runs. */
17930
+ spawn: external_exports.string(),
17931
+ signaledCount: external_exports.number().int().nonnegative(),
17932
+ droppedCount: external_exports.number().int().nonnegative()
17933
+ }),
17934
+ artifacts: external_exports.object({
17935
+ count: external_exports.number().int().nonnegative(),
17936
+ types: external_exports.array(external_exports.string())
17937
+ }),
17938
+ /** Derived per-user-message turns, capped to the most recent. */
17939
+ turns: external_exports.array(RunTurnSchema),
17940
+ commands: external_exports.object({
17941
+ total: external_exports.number().int().nonnegative(),
17942
+ byKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
17943
+ failed: external_exports.number().int().nonnegative()
17944
+ }),
17945
+ checks: external_exports.array(
17946
+ external_exports.object({
17947
+ name: external_exports.string(),
17948
+ displayName: external_exports.string(),
17949
+ status: SessionRunCheckStatusSchema,
17950
+ conclusion: SessionRunCheckConclusionSchema.nullable(),
17951
+ completedAt: external_exports.string().datetime().nullable()
17952
+ })
17953
+ )
17954
+ });
17955
+ }
17956
+ });
17957
+
17657
17958
  // ../../packages/schemas/src/session-run-commands.ts
17658
17959
  var SESSION_RUN_COMMAND_KINDS, SESSION_RUN_DISPATCH_COMMAND_KINDS, SESSION_RUN_PERSISTED_COMMAND_KINDS, SESSION_RUN_LIFECYCLE_COMMAND_KINDS, SESSION_RUN_COMMAND_STATUSES, SESSION_RUN_DISPATCH_COMMAND_STATUSES, SessionRunCommandKindSchema2, SessionRunPersistedCommandKindSchema, SessionRunDispatchCommandKindSchema, SessionRunLifecycleCommandKindSchema, SessionRunCommandStatusSchema, SessionRunDispatchCommandStatusSchema, SessionRunCommandSenderSchema, SessionRunMessageCommandPayloadSchema, SessionRunAnswerCommandPayloadSchema, SessionRunLifecycleCommandPayloadSchema, SessionRunCommandPayloadSchema, CreateSessionRunMessageCommandRequestSchema, CreateSessionRunAnswerCommandRequestSchema, CreateSessionRunLifecycleCommandRequestSchema, CreateSessionRunCommandRequestSchema, SessionRunResolutionPolicySchema, SessionAddressedCommandTargetSchema, SessionRunCommandRecordBaseSchema, SessionRunStartCommandPayloadSchema, SessionRunStartWithMessageCommandPayloadSchema, SessionRunPersistedCommandPayloadSchema, SessionRunCommandRecordSchema, SessionRunDispatchMessageCommandPayloadSchema, SessionRunDispatchAnswerCommandPayloadSchema, SessionRunDispatchStopCommandPayloadSchema, SessionRunDispatchCommandPayloadSchema, SessionRunDispatchCommandRecordBaseSchema, SessionRunDispatchCommandRecordSchema;
17659
17960
  var init_session_run_commands = __esm({
@@ -17970,98 +18271,6 @@ var init_runtimes = __esm({
17970
18271
  }
17971
18272
  });
17972
18273
 
17973
- // ../../packages/schemas/src/session-runs.ts
17974
- var SESSION_RUN_STATUSES, SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH, SessionRunStatusSchema, SessionRunDisplayTitleSchema, SESSION_RUN_CHECK_STATUSES, SESSION_RUN_CHECK_CONCLUSIONS, SESSION_RUN_CHECK_TIMEOUT_PHASES, SessionRunCheckStatusSchema, SessionRunCheckConclusionSchema, SessionRunCheckTimeoutPhaseSchema, ManualSessionRunRequestSchema, SessionRunArchiveRequestSchema, SessionRunsArchiveRequestSchema, SessionRunRecordSchema, SessionRunsArchiveResponseSchema;
17975
- var init_session_runs = __esm({
17976
- "../../packages/schemas/src/session-runs.ts"() {
17977
- "use strict";
17978
- init_zod();
17979
- init_auth();
17980
- init_environments();
17981
- init_ids();
17982
- init_primitives();
17983
- init_profiles();
17984
- init_sessions();
17985
- init_tools();
17986
- SESSION_RUN_STATUSES = [
17987
- "queued",
17988
- "running",
17989
- "awaiting",
17990
- "failed",
17991
- "stopped"
17992
- ];
17993
- SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
17994
- SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
17995
- SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
17996
- SESSION_RUN_CHECK_STATUSES = [
17997
- "queued",
17998
- "in_progress",
17999
- "completed"
18000
- ];
18001
- SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
18002
- SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
18003
- SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
18004
- SessionRunCheckConclusionSchema = external_exports.enum(
18005
- SESSION_RUN_CHECK_CONCLUSIONS
18006
- );
18007
- SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
18008
- SESSION_RUN_CHECK_TIMEOUT_PHASES
18009
- );
18010
- ManualSessionRunRequestSchema = external_exports.object({
18011
- message: external_exports.string().trim().min(1).max(2e4).optional(),
18012
- interactive: external_exports.boolean().optional()
18013
- });
18014
- SessionRunArchiveRequestSchema = external_exports.object({
18015
- archived: external_exports.boolean()
18016
- });
18017
- SessionRunsArchiveRequestSchema = external_exports.object({
18018
- run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
18019
- archived: external_exports.boolean()
18020
- });
18021
- SessionRunRecordSchema = external_exports.object({
18022
- id: SessionRunIdSchema2,
18023
- organizationId: external_exports.string().trim().min(1),
18024
- projectId: external_exports.string().trim().min(1).nullable(),
18025
- sessionId: SessionIdSchema,
18026
- runtimeId: RuntimeIdSchema2.nullable(),
18027
- status: SessionRunStatusSchema,
18028
- idempotencyKey: external_exports.string().min(1).nullable(),
18029
- correlationKey: external_exports.string().nullable(),
18030
- workflowId: external_exports.string().min(1),
18031
- displayTitle: SessionRunDisplayTitleSchema,
18032
- starterActor: AuthActorSchema.nullable(),
18033
- sessionSnapshot: SessionResourceSchema,
18034
- profileSnapshot: ProfileResourceSchema,
18035
- environmentSnapshot: EnvironmentResourceSchema,
18036
- toolSnapshots: external_exports.array(
18037
- external_exports.discriminatedUnion("source", [
18038
- external_exports.object({
18039
- source: external_exports.literal("inline"),
18040
- alias: ToolAliasSchema,
18041
- spec: RemoteMcpToolSchema.or(LocalToolSchema)
18042
- }),
18043
- external_exports.object({
18044
- source: external_exports.literal("resource"),
18045
- alias: ToolAliasSchema,
18046
- resource: ToolResourceSchema
18047
- })
18048
- ])
18049
- ),
18050
- input: JsonValueSchema2,
18051
- createdAt: external_exports.string().datetime(),
18052
- updatedAt: external_exports.string().datetime(),
18053
- startedAt: external_exports.string().datetime().nullable(),
18054
- finishedAt: external_exports.string().datetime().nullable(),
18055
- archivedAt: external_exports.string().datetime().nullable(),
18056
- error: JsonValueSchema2.nullable()
18057
- });
18058
- SessionRunsArchiveResponseSchema = external_exports.object({
18059
- archived: external_exports.boolean(),
18060
- runs: external_exports.array(SessionRunRecordSchema)
18061
- });
18062
- }
18063
- });
18064
-
18065
18274
  // ../../packages/schemas/src/temporal.ts
18066
18275
  var ResourceReconciliationScopeSchema;
18067
18276
  var init_temporal = __esm({
@@ -18097,6 +18306,7 @@ var init_src = __esm({
18097
18306
  init_realtime();
18098
18307
  init_resources();
18099
18308
  init_run_diagnostics();
18309
+ init_run_introspection();
18100
18310
  init_secrets();
18101
18311
  init_session_run_commands();
18102
18312
  init_runtimes();
@@ -18988,8 +19198,9 @@ function createApiClient(input) {
18988
19198
  }
18989
19199
  async function requestJson(path, options = {}) {
18990
19200
  const url2 = new URL(apiUrl(path, options.apiBaseUrl));
18991
- for (const [name, value] of Object.entries(options.searchParams ?? {})) {
18992
- url2.searchParams.set(name, value);
19201
+ const searchParamEntries = Array.isArray(options.searchParams) ? options.searchParams : Object.entries(options.searchParams ?? {});
19202
+ for (const [name, value] of searchParamEntries) {
19203
+ url2.searchParams.append(name, value);
18993
19204
  }
18994
19205
  const response = await authenticatedFetch(
18995
19206
  url2.toString(),
@@ -19729,7 +19940,7 @@ function createApiClient(input) {
19729
19940
  sessionApiPath(scope, sessionName, "/runs"),
19730
19941
  {
19731
19942
  apiBaseUrl: options.apiBaseUrl,
19732
- searchParams: options.includeArchived ? { include_archived: "true" } : void 0
19943
+ searchParams: runListSearchParams(options)
19733
19944
  }
19734
19945
  );
19735
19946
  },
@@ -19737,7 +19948,87 @@ function createApiClient(input) {
19737
19948
  const scope = activeProject();
19738
19949
  return requestJson(projectApiPath(scope, "/runs"), {
19739
19950
  apiBaseUrl: options.apiBaseUrl,
19740
- searchParams: options.includeArchived ? { include_archived: "true" } : void 0
19951
+ searchParams: runListSearchParams(options)
19952
+ });
19953
+ },
19954
+ async getRunSummary(runId, options = {}) {
19955
+ return requestJson(runApiPath(runId, "/summary"), {
19956
+ apiBaseUrl: options.apiBaseUrl
19957
+ });
19958
+ },
19959
+ async getRunConversation(runId, options = {}) {
19960
+ const searchParams = [];
19961
+ if (options.cursor) searchParams.push(["cursor", options.cursor]);
19962
+ if (options.before !== void 0)
19963
+ searchParams.push(["before", String(options.before)]);
19964
+ if (options.limit !== void 0)
19965
+ searchParams.push(["limit", String(options.limit)]);
19966
+ if (options.order) searchParams.push(["order", options.order]);
19967
+ for (const kind of options.kinds ?? []) searchParams.push(["kind", kind]);
19968
+ for (const role of options.roles ?? []) searchParams.push(["role", role]);
19969
+ return requestJson(
19970
+ runApiPath(runId, "/conversation"),
19971
+ {
19972
+ apiBaseUrl: options.apiBaseUrl,
19973
+ searchParams
19974
+ }
19975
+ );
19976
+ },
19977
+ async searchRunConversation(runId, queries, options = {}) {
19978
+ const searchParams = queries.map((query) => [
19979
+ "q",
19980
+ query
19981
+ ]);
19982
+ if (options.after !== void 0)
19983
+ searchParams.push(["after", String(options.after)]);
19984
+ for (const kind of options.kinds ?? []) searchParams.push(["kind", kind]);
19985
+ for (const role of options.roles ?? []) searchParams.push(["role", role]);
19986
+ if (options.limit !== void 0)
19987
+ searchParams.push(["limit", String(options.limit)]);
19988
+ return requestJson(
19989
+ runApiPath(runId, "/conversation/search"),
19990
+ {
19991
+ apiBaseUrl: options.apiBaseUrl,
19992
+ searchParams
19993
+ }
19994
+ );
19995
+ },
19996
+ async listRunToolExchanges(runId, options = {}) {
19997
+ const searchParams = [];
19998
+ if (options.toolName) searchParams.push(["toolName", options.toolName]);
19999
+ if (options.errorsOnly) searchParams.push(["errorsOnly", "true"]);
20000
+ if (options.after !== void 0)
20001
+ searchParams.push(["after", String(options.after)]);
20002
+ if (options.before !== void 0)
20003
+ searchParams.push(["before", String(options.before)]);
20004
+ if (options.order) searchParams.push(["order", options.order]);
20005
+ if (options.limit !== void 0)
20006
+ searchParams.push(["limit", String(options.limit)]);
20007
+ return requestJson(
20008
+ runApiPath(runId, "/tools"),
20009
+ {
20010
+ apiBaseUrl: options.apiBaseUrl,
20011
+ searchParams
20012
+ }
20013
+ );
20014
+ },
20015
+ async listRunTriggers(runId, options = {}) {
20016
+ return requestJson(runApiPath(runId, "/triggers"), {
20017
+ apiBaseUrl: options.apiBaseUrl,
20018
+ searchParams: options.payload ? { payload: options.payload } : void 0
20019
+ });
20020
+ },
20021
+ async listRunArtifacts(runId, options = {}) {
20022
+ return requestJson(
20023
+ runApiPath(runId, "/artifacts"),
20024
+ {
20025
+ apiBaseUrl: options.apiBaseUrl
20026
+ }
20027
+ );
20028
+ },
20029
+ async listRunCommands(runId, options = {}) {
20030
+ return requestJson(runApiPath(runId, "/commands"), {
20031
+ apiBaseUrl: options.apiBaseUrl
19741
20032
  });
19742
20033
  },
19743
20034
  getOperatorInfo() {
@@ -19797,6 +20088,22 @@ function createApiClient(input) {
19797
20088
  }
19798
20089
  };
19799
20090
  }
20091
+ function runListSearchParams(options) {
20092
+ const searchParams = [];
20093
+ if (options.includeArchived) {
20094
+ searchParams.push(["include_archived", "true"]);
20095
+ }
20096
+ for (const status of options.statuses ?? []) {
20097
+ searchParams.push(["status", status]);
20098
+ }
20099
+ if (options.since) {
20100
+ searchParams.push(["created_after", options.since]);
20101
+ }
20102
+ if (options.limit !== void 0) {
20103
+ searchParams.push(["limit", String(options.limit)]);
20104
+ }
20105
+ return searchParams;
20106
+ }
19800
20107
  var init_client = __esm({
19801
20108
  "src/lib/api/client.ts"() {
19802
20109
  "use strict";
@@ -21183,7 +21490,7 @@ var init_package = __esm({
21183
21490
  "package.json"() {
21184
21491
  package_default = {
21185
21492
  name: "@autohq/cli",
21186
- version: "0.1.88",
21493
+ version: "0.1.89",
21187
21494
  license: "SEE LICENSE IN README.md",
21188
21495
  publishConfig: {
21189
21496
  access: "public"
@@ -23866,7 +24173,10 @@ function sessionRunsQueryOptions(client, sessionName, apiUrl, includeArchived =
23866
24173
  queryFn: async () => {
23867
24174
  const res = await client.listSessionRuns(sessionName ?? "", {
23868
24175
  apiBaseUrl: apiUrl,
23869
- includeArchived
24176
+ includeArchived,
24177
+ // The run-list routes default to 50; ask for the server max so the
24178
+ // TUI keeps showing deep history.
24179
+ limit: TUI_RUN_LIST_LIMIT
23870
24180
  });
23871
24181
  return res.runs;
23872
24182
  },
@@ -23880,7 +24190,8 @@ function runsQueryOptions(client, apiUrl, includeArchived = false) {
23880
24190
  queryFn: async () => {
23881
24191
  const res = await client.listRuns({
23882
24192
  apiBaseUrl: apiUrl,
23883
- includeArchived
24193
+ includeArchived,
24194
+ limit: TUI_RUN_LIST_LIMIT
23884
24195
  });
23885
24196
  return res.runs;
23886
24197
  },
@@ -23996,12 +24307,13 @@ function invalidateRunsQueries(queryClient, apiUrl, runs) {
23996
24307
  });
23997
24308
  }
23998
24309
  }
23999
- var queryKeys, RUNS_REFETCH_INTERVAL_MS;
24310
+ var TUI_RUN_LIST_LIMIT, queryKeys, RUNS_REFETCH_INTERVAL_MS;
24000
24311
  var init_queries = __esm({
24001
24312
  "src/tui/hooks/queries.ts"() {
24002
24313
  "use strict";
24003
24314
  init_src();
24004
24315
  init_ApiClientContext();
24316
+ TUI_RUN_LIST_LIMIT = 200;
24005
24317
  queryKeys = {
24006
24318
  environments: (apiUrl) => ["environments", apiUrl],
24007
24319
  profiles: (apiUrl) => ["profiles", apiUrl],
@@ -24359,7 +24671,7 @@ var init_SessionsView = __esm({
24359
24671
 
24360
24672
  // src/tui/SpecInspector.tsx
24361
24673
  import { Box as Box12, Text as Text13 } from "ink";
24362
- import { stringify as stringify3 } from "yaml";
24674
+ import { stringify as stringify4 } from "yaml";
24363
24675
  import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
24364
24676
  function SpecInspector({
24365
24677
  kind,
@@ -24390,7 +24702,7 @@ function specLineCount(spec) {
24390
24702
  return yamlLines(spec).length;
24391
24703
  }
24392
24704
  function yamlLines(spec) {
24393
- return stringify3(spec).trimEnd().split("\n");
24705
+ return stringify4(spec).trimEnd().split("\n");
24394
24706
  }
24395
24707
  function YamlLine({ line }) {
24396
24708
  const match = /^(\s*)([^:#][^:]*:)(.*)$/.exec(line);
@@ -30424,26 +30736,292 @@ function validateNonNegativeInteger(value, label) {
30424
30736
  }
30425
30737
  }
30426
30738
 
30739
+ // src/commands/runs/introspect.ts
30740
+ var PREVIEW_CHARS = 160;
30741
+ async function handleRunsShow(context, runId, options = {}) {
30742
+ const client = createContextApiClient(context);
30743
+ const apiBaseUrl = apiUrlFromOptions(context, options);
30744
+ const [run, summary] = await Promise.all([
30745
+ client.getRun(runId, { apiBaseUrl }),
30746
+ client.getRunSummary(runId, { apiBaseUrl })
30747
+ ]);
30748
+ context.io.writeResult({ run, summary }, formatRunShowText);
30749
+ }
30750
+ function formatRunShowText(result, writeLine) {
30751
+ const { summary } = result;
30752
+ writeLine(
30753
+ `${summary.run.id} ${summary.run.status} session=${summary.run.sessionName} profile=${summary.run.profileName}`
30754
+ );
30755
+ if (summary.run.displayTitle) {
30756
+ writeLine(`title: ${summary.run.displayTitle}`);
30757
+ }
30758
+ writeLine(
30759
+ `created=${summary.run.createdAt} started=${summary.run.startedAt ?? "-"} finished=${summary.run.finishedAt ?? "-"}`
30760
+ );
30761
+ writeLine(
30762
+ `timing: queued=${formatMs(summary.timing.queuedMs)} active=${formatMs(summary.timing.activeMs)} total=${formatMs(summary.timing.totalMs)}`
30763
+ );
30764
+ writeLine(
30765
+ `entries=${summary.conversation.entryCount} failed=${summary.conversation.failedEntryCount} turns=${summary.turns.length} lastSequence=${summary.conversation.lastSequence}`
30766
+ );
30767
+ writeLine(
30768
+ `trigger: spawn=${summary.trigger.spawn} signaled=${summary.trigger.signaledCount} dropped=${summary.trigger.droppedCount}`
30769
+ );
30770
+ if (summary.artifacts.count > 0) {
30771
+ writeLine(
30772
+ `artifacts: ${summary.artifacts.count} (${summary.artifacts.types.join(", ")})`
30773
+ );
30774
+ }
30775
+ writeLine(
30776
+ `commands: ${summary.commands.total} failed=${summary.commands.failed}`
30777
+ );
30778
+ if (summary.tools.length > 0) {
30779
+ writeLine("tools:");
30780
+ for (const tool of summary.tools) {
30781
+ writeLine(
30782
+ ` ${tool.name} calls=${tool.calls} errors=${tool.errors} p50=${formatMs(tool.durationMs.p50)} max=${formatMs(tool.durationMs.max)}`
30783
+ );
30784
+ }
30785
+ }
30786
+ for (const check2 of summary.checks) {
30787
+ writeLine(
30788
+ `check: ${check2.name} ${check2.status}${check2.conclusion ? ` ${check2.conclusion}` : ""}`
30789
+ );
30790
+ }
30791
+ if (summary.run.error !== null) {
30792
+ writeLine(`error: ${JSON.stringify(summary.run.error)}`);
30793
+ }
30794
+ }
30795
+ async function handleRunsConversation(context, runId, options = {}) {
30796
+ const client = createContextApiClient(context);
30797
+ const tailMode = !options.after;
30798
+ const response = await client.getRunConversation(runId, {
30799
+ apiBaseUrl: apiUrlFromOptions(context, options),
30800
+ cursor: options.after,
30801
+ before: options.before,
30802
+ order: tailMode ? "desc" : "asc",
30803
+ limit: options.tail ?? 25,
30804
+ kinds: options.kind
30805
+ });
30806
+ const events = [...response.events].sort((a, b) => a.sequence - b.sequence);
30807
+ context.io.writeResult(
30808
+ {
30809
+ runId,
30810
+ events,
30811
+ cursor: response.cursor,
30812
+ hasMore: response.hasMore,
30813
+ full: Boolean(options.full),
30814
+ tailMode
30815
+ },
30816
+ formatConversationText
30817
+ );
30818
+ }
30819
+ function formatConversationText(result, writeLine) {
30820
+ if (result.events.length === 0) {
30821
+ writeLine("No conversation entries.");
30822
+ return;
30823
+ }
30824
+ for (const event of result.events) {
30825
+ const failed = event.status === "failed" ? " FAILED" : "";
30826
+ writeLine(
30827
+ `${event.sequence} ${event.role}/${event.kind}${failed}: ${entryPreview(event, result.full)}`
30828
+ );
30829
+ }
30830
+ if (result.hasMore) {
30831
+ if (result.tailMode) {
30832
+ const oldest = result.events[0]?.sequence;
30833
+ writeLine(
30834
+ `(more older entries; rerun with --before ${oldest ?? "<sequence>"})`
30835
+ );
30836
+ } else {
30837
+ writeLine(`(more entries; continue with --after ${result.cursor})`);
30838
+ }
30839
+ }
30840
+ }
30841
+ async function handleRunsSearch(context, runId, queries, options = {}) {
30842
+ const client = createContextApiClient(context);
30843
+ const response = await client.searchRunConversation(runId, queries, {
30844
+ apiBaseUrl: apiUrlFromOptions(context, options),
30845
+ kinds: options.kind,
30846
+ after: options.after,
30847
+ limit: options.limit
30848
+ });
30849
+ context.io.writeResult({ runId, queries, ...response }, formatSearchText);
30850
+ }
30851
+ function formatSearchText(result, writeLine) {
30852
+ if (result.matches.length === 0) {
30853
+ writeLine(`No matches for: ${result.queries.join(", ")}`);
30854
+ return;
30855
+ }
30856
+ for (const match of result.matches) {
30857
+ for (const snippet of match.snippets) {
30858
+ writeLine(
30859
+ `${match.sequence} ${match.kind} [${snippet.query}]: ${singleLine(snippet.text)}`
30860
+ );
30861
+ }
30862
+ }
30863
+ if (result.hasMore) {
30864
+ writeLine(
30865
+ `(more scanned entries; continue with --after ${result.nextAfterSequence ?? "<sequence>"})`
30866
+ );
30867
+ }
30868
+ }
30869
+ async function handleRunsTools(context, runId, options = {}) {
30870
+ const client = createContextApiClient(context);
30871
+ const response = await client.listRunToolExchanges(runId, {
30872
+ apiBaseUrl: apiUrlFromOptions(context, options),
30873
+ toolName: options.tool,
30874
+ errorsOnly: options.errors,
30875
+ after: options.after,
30876
+ before: options.before,
30877
+ limit: options.limit
30878
+ });
30879
+ context.io.writeResult({ runId, ...response }, formatToolsText);
30880
+ }
30881
+ function formatToolsText(result, writeLine) {
30882
+ if (result.exchanges.length === 0) {
30883
+ writeLine("No tool exchanges.");
30884
+ return;
30885
+ }
30886
+ for (const exchange of result.exchanges) {
30887
+ const duration4 = exchange.durationMs === null ? "-" : `${exchange.durationMs}ms`;
30888
+ const outcome = exchange.isError === null ? "pending" : exchange.isError ? "ERR" : "ok";
30889
+ writeLine(
30890
+ `${exchange.callSequence} ${exchange.name} ${duration4} ${outcome}: ${preview(exchange.input)}`
30891
+ );
30892
+ }
30893
+ if (result.hasMore) {
30894
+ writeLine(
30895
+ `(more exchanges; page older with --before ${result.nextBeforeSequence ?? "<sequence>"})`
30896
+ );
30897
+ }
30898
+ }
30899
+ async function handleRunsTriggers(context, runId, options = {}) {
30900
+ const client = createContextApiClient(context);
30901
+ const response = await client.listRunTriggers(runId, {
30902
+ apiBaseUrl: apiUrlFromOptions(context, options)
30903
+ });
30904
+ context.io.writeResult({ runId, ...response }, formatTriggersText);
30905
+ }
30906
+ function formatTriggersText(result, writeLine) {
30907
+ if (result.spawn) {
30908
+ writeLine(
30909
+ `spawn: ${result.spawn.eventKey} (${result.spawn.originKind}) delivered=${result.spawn.deliveredAt}`
30910
+ );
30911
+ } else if (result.starter) {
30912
+ writeLine(
30913
+ `spawn: ${result.starter.principal.kind === "run" ? "agent" : "manual"} starter=${JSON.stringify(result.starter.principal)}`
30914
+ );
30915
+ } else {
30916
+ writeLine("spawn: manual");
30917
+ }
30918
+ if (result.deliveries.length === 0) {
30919
+ writeLine("No subsequent deliveries.");
30920
+ return;
30921
+ }
30922
+ for (const delivery of result.deliveries) {
30923
+ const reason = delivery.reason ? ` reason=${delivery.reason}` : "";
30924
+ writeLine(
30925
+ `${delivery.deliveredAt} ${delivery.action} ${delivery.eventKey}${reason}`
30926
+ );
30927
+ }
30928
+ }
30929
+ async function handleRunsArtifacts(context, runId, options = {}) {
30930
+ const client = createContextApiClient(context);
30931
+ const response = await client.listRunArtifacts(runId, {
30932
+ apiBaseUrl: apiUrlFromOptions(context, options)
30933
+ });
30934
+ context.io.writeResult({ runId, ...response }, formatArtifactsText);
30935
+ }
30936
+ function formatArtifactsText(result, writeLine) {
30937
+ if (result.artifacts.length === 0) {
30938
+ writeLine("No artifacts currently owned.");
30939
+ return;
30940
+ }
30941
+ for (const artifact of result.artifacts) {
30942
+ writeLine(
30943
+ `${artifact.artifactType} ${artifact.externalId} recorded=${artifact.recordedAt}`
30944
+ );
30945
+ }
30946
+ }
30947
+ async function handleRunsCommands(context, runId, options = {}) {
30948
+ const client = createContextApiClient(context);
30949
+ const response = await client.listRunCommands(runId, {
30950
+ apiBaseUrl: apiUrlFromOptions(context, options)
30951
+ });
30952
+ context.io.writeResult({ runId, ...response }, formatCommandsText);
30953
+ }
30954
+ function formatCommandsText(result, writeLine) {
30955
+ if (result.commands.length === 0) {
30956
+ writeLine("No commands.");
30957
+ return;
30958
+ }
30959
+ for (const command of result.commands) {
30960
+ writeLine(
30961
+ `${command.createdAt} ${command.kind} ${command.status} sender=${command.sender.type}: ${preview(command.payload)}`
30962
+ );
30963
+ }
30964
+ }
30965
+ function formatMs(value) {
30966
+ return value === null ? "-" : `${value}ms`;
30967
+ }
30968
+ function entryPreview(event, full) {
30969
+ const texts = event.content.parts.map((part) => {
30970
+ switch (part.type) {
30971
+ case "text":
30972
+ return part.text;
30973
+ case "tool_call":
30974
+ return `${part.name} ${stringify3(part.input)}`;
30975
+ case "tool_result":
30976
+ return stringify3(part.output);
30977
+ case "question":
30978
+ return part.questions.map((question) => question.question).join(" ");
30979
+ default:
30980
+ return "";
30981
+ }
30982
+ });
30983
+ const joined = singleLine(texts.join(" "));
30984
+ return full ? joined : clip(joined);
30985
+ }
30986
+ function preview(value) {
30987
+ return clip(singleLine(stringify3(value)));
30988
+ }
30989
+ function stringify3(value) {
30990
+ return typeof value === "string" ? value : JSON.stringify(value);
30991
+ }
30992
+ function singleLine(text) {
30993
+ return text.replace(/\s+/g, " ").trim();
30994
+ }
30995
+ function clip(text) {
30996
+ return text.length > PREVIEW_CHARS ? `${text.slice(0, PREVIEW_CHARS)}\u2026` : text;
30997
+ }
30998
+
30427
30999
  // src/commands/runs/list.ts
30428
31000
  async function handleRunsList(context, sessionName, options = {}) {
30429
- const result = await fetchSessionRuns(context, sessionName, options);
31001
+ const result = await fetchRuns(context, sessionName, options);
30430
31002
  context.io.writeResult(result, formatRunsText);
30431
31003
  }
30432
- async function fetchSessionRuns(context, sessionName, options) {
31004
+ async function fetchRuns(context, sessionName, options) {
30433
31005
  const client = createContextApiClient(context);
30434
- const response = await client.listSessionRuns(sessionName, {
31006
+ const clientOptions = {
30435
31007
  apiBaseUrl: apiUrlFromOptions(context, options),
30436
- includeArchived: options.includeArchived
30437
- });
31008
+ includeArchived: options.includeArchived,
31009
+ statuses: options.status,
31010
+ since: options.since,
31011
+ limit: options.limit
31012
+ };
31013
+ const response = sessionName ? await client.listSessionRuns(sessionName, clientOptions) : await client.listRuns(clientOptions);
30438
31014
  return {
30439
- session: sessionName,
31015
+ session: sessionName ?? null,
30440
31016
  runs: response.runs,
30441
31017
  includeArchived: Boolean(options.includeArchived)
30442
31018
  };
30443
31019
  }
30444
31020
  function formatRunsText(result, writeLine) {
30445
31021
  if (result.runs.length === 0) {
30446
- writeLine(`No runs found for session ${result.session}.`);
31022
+ writeLine(
31023
+ result.session ? `No runs found for session ${result.session}.` : "No runs found in the current project."
31024
+ );
30447
31025
  return;
30448
31026
  }
30449
31027
  for (const run of result.runs) {
@@ -30453,13 +31031,63 @@ function formatRunsText(result, writeLine) {
30453
31031
  }
30454
31032
 
30455
31033
  // src/commands/runs/commands.ts
31034
+ function collect(value, previous = []) {
31035
+ return [...previous, value];
31036
+ }
30456
31037
  function registerRunCommands(program, context) {
30457
31038
  const runs = program.command("runs").description("Inspect session runs.");
30458
- runs.command("list").description("List runs for a session.").requiredOption("--session <name>", "session name").option("--include-archived", "include archived runs").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
30459
- async (options) => {
30460
- await handleRunsList(context, options.session, options);
31039
+ runs.command("list").description("List runs for a session or the whole project.").option("--session <name>", "session name").option("--include-archived", "include archived runs").option("--status <status>", "filter by run status (repeatable)", collect).option("--since <iso-timestamp>", "only runs created after this time").option("--limit <count>", "maximum runs to return", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (options) => {
31040
+ await handleRunsList(context, options.session, options);
31041
+ });
31042
+ runs.command("show").description("Show a run's lifecycle, timing, and behavior summary.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
31043
+ await handleRunsShow(context, runId, commandOptions);
31044
+ });
31045
+ runs.command("conversation").description(
31046
+ "Read a snapshot of a run's conversation (most recent entries by default)."
31047
+ ).argument("<run-id>", "run id").option(
31048
+ "--tail <count>",
31049
+ "number of most recent entries",
31050
+ parsePositiveInteger
31051
+ ).option("--after <cursor>", "read forward from an rt:<sequence> cursor").option(
31052
+ "--before <sequence>",
31053
+ "only entries older than this sequence (backward paging)",
31054
+ parsePositiveInteger
31055
+ ).option("--kind <kind>", "filter by entry kind (repeatable)", collect).option("--full", "do not clip entry previews in text output").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
31056
+ async (runId, commandOptions) => {
31057
+ await handleRunsConversation(context, runId, commandOptions);
31058
+ }
31059
+ );
31060
+ runs.command("search").description("Grep a run's transcript; multiple query terms OR together.").argument("<run-id>", "run id").argument("<query...>", "search term(s), at least 2 characters each").option("--kind <kind>", "filter by entry kind (repeatable)", collect).option(
31061
+ "--after <sequence>",
31062
+ "only entries after this sequence (forward paging)",
31063
+ parsePositiveInteger
31064
+ ).option("--limit <count>", "maximum matched entries", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
31065
+ async (runId, queries, commandOptions) => {
31066
+ await handleRunsSearch(context, runId, queries, commandOptions);
31067
+ }
31068
+ );
31069
+ runs.command("tools").description("List a run's paired tool calls and results with timing.").argument("<run-id>", "run id").option("--tool <name>", "filter by tool name").option("--errors", "only failed exchanges").option(
31070
+ "--after <sequence>",
31071
+ "only exchanges after this entry sequence",
31072
+ parsePositiveInteger
31073
+ ).option(
31074
+ "--before <sequence>",
31075
+ "only exchanges before this entry sequence (backward paging)",
31076
+ parsePositiveInteger
31077
+ ).option("--limit <count>", "maximum exchanges", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
31078
+ async (runId, commandOptions) => {
31079
+ await handleRunsTools(context, runId, commandOptions);
30461
31080
  }
30462
31081
  );
31082
+ runs.command("triggers").description("Show what spawned a run and the events delivered to it.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
31083
+ await handleRunsTriggers(context, runId, commandOptions);
31084
+ });
31085
+ runs.command("artifacts").description("List artifacts a run currently owns.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
31086
+ await handleRunsArtifacts(context, runId, commandOptions);
31087
+ });
31088
+ runs.command("commands").description("List a run's inbound command history.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
31089
+ await handleRunsCommands(context, runId, commandOptions);
31090
+ });
30463
31091
  runs.command("archive").description("Archive runs so they are hidden from default run lists.").argument("<run-ids...>", "run id(s)").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runIds, commandOptions) => {
30464
31092
  if (runIds.length === 1) {
30465
31093
  await archiveRunAction(context, runIds[0], commandOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.88",
3
+ "version": "0.1.89",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"