@autohq/cli 0.1.414 → 0.1.416

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.
@@ -30820,7 +30820,7 @@ Object.assign(lookup, {
30820
30820
  // package.json
30821
30821
  var package_default = {
30822
30822
  name: "@autohq/cli",
30823
- version: "0.1.414",
30823
+ version: "0.1.416",
30824
30824
  license: "SEE LICENSE IN README.md",
30825
30825
  publishConfig: {
30826
30826
  access: "public"
@@ -31460,6 +31460,10 @@ var JsonValueSchema2 = external_exports.lazy(
31460
31460
  external_exports.record(external_exports.string(), JsonValueSchema2)
31461
31461
  ])
31462
31462
  );
31463
+ var JsonObjectSchema = external_exports.record(
31464
+ external_exports.string(),
31465
+ JsonValueSchema2
31466
+ );
31463
31467
  function toJsonValue(value2) {
31464
31468
  if (value2 === void 0) {
31465
31469
  return null;
@@ -33985,14 +33989,16 @@ var BINDING_TARGET_TYPES = [
33985
33989
  "chat.message",
33986
33990
  "agent.singleton",
33987
33991
  "linear.issue",
33988
- "auto.connection.authorization_attempt"
33992
+ "auto.connection.authorization_attempt",
33993
+ "auto.session"
33989
33994
  ];
33990
33995
  var TRIGGER_BINDING_TARGET_TYPES = [
33991
33996
  "github.pull_request",
33992
33997
  "github.issue",
33993
33998
  "slack.thread",
33994
33999
  "agent.singleton",
33995
- "linear.issue"
34000
+ "linear.issue",
34001
+ "auto.session"
33996
34002
  ];
33997
34003
  var SESSION_BINDING_SOURCES = [
33998
34004
  "trigger_spawn",
@@ -34010,6 +34016,20 @@ var SESSION_BINDING_RELEASED_BY = [
34010
34016
  "operator",
34011
34017
  "takeover"
34012
34018
  ];
34019
+ var BINDING_TRANSITION_CAUSES = [
34020
+ "manual_bind",
34021
+ "manual_update",
34022
+ "attributed_event",
34023
+ "mention",
34024
+ "session_spawn",
34025
+ "trigger_spawn",
34026
+ "chat_send",
34027
+ "trigger_release",
34028
+ "archive",
34029
+ "takeover",
34030
+ "rollover",
34031
+ "system"
34032
+ ];
34013
34033
  var BindingTargetTypeSchema = external_exports.enum(BINDING_TARGET_TYPES);
34014
34034
  var TriggerBindingTargetTypeSchema = external_exports.enum(
34015
34035
  TRIGGER_BINDING_TARGET_TYPES
@@ -34025,6 +34045,7 @@ var SessionBindingContinuitySchema = external_exports.enum(
34025
34045
  var SessionBindingReleasedBySchema = external_exports.enum(
34026
34046
  SESSION_BINDING_RELEASED_BY
34027
34047
  );
34048
+ var BindingTransitionCauseSchema = external_exports.enum(BINDING_TRANSITION_CAUSES);
34028
34049
  var BindingTargetSchema = external_exports.object({
34029
34050
  type: BindingTargetTypeSchema,
34030
34051
  externalId: external_exports.string().min(1)
@@ -34253,8 +34274,15 @@ var TRIGGER_ON_UNMATCHED_POLICIES = [
34253
34274
  ];
34254
34275
  var OnUnmatchedSchema = external_exports.enum(TRIGGER_ON_UNMATCHED_POLICIES).default("drop");
34255
34276
  var SpawnBindSchema = external_exports.object({
34256
- target: TriggerBindingTargetTypeSchema
34257
- });
34277
+ target: TriggerBindingTargetTypeSchema,
34278
+ context: JsonObjectSchema.optional(),
34279
+ eventContext: JsonObjectSchema.optional()
34280
+ }).strict();
34281
+ var TriggerReleaseSchema = external_exports.union([
34282
+ external_exports.literal(false),
34283
+ external_exports.literal(true).transform(() => ({ context: null })),
34284
+ external_exports.object({ context: JsonObjectSchema.nullable().default(null) }).strict()
34285
+ ]);
34258
34286
  var CanonicalTriggerRoutingSchema = external_exports.discriminatedUnion("kind", [
34259
34287
  external_exports.object({
34260
34288
  kind: external_exports.literal("spawn"),
@@ -34283,7 +34311,7 @@ var CanonicalTriggerRoutingSchema = external_exports.discriminatedUnion("kind",
34283
34311
  // routing completes. No-op when no active binding exists. `agent.singleton`
34284
34312
  // is rejected at apply time (singleton slots are pool-membership state
34285
34313
  // owned by the reconciler).
34286
- release: external_exports.boolean().default(false)
34314
+ release: TriggerReleaseSchema.default(false)
34287
34315
  })
34288
34316
  ]);
34289
34317
  var LegacySingletonRouteBySchema = external_exports.object({
@@ -34460,7 +34488,8 @@ var AgentArchiveAfterInactiveSchema = external_exports.object({
34460
34488
  seconds: external_exports.number().int().min(60).max(365 * 24 * 60 * 60)
34461
34489
  }).strict();
34462
34490
  var AgentSessionPolicySchema = external_exports.object({
34463
- archiveAfterInactive: AgentArchiveAfterInactiveSchema.optional()
34491
+ archiveAfterInactive: AgentArchiveAfterInactiveSchema.optional(),
34492
+ observeSpawnedSessions: external_exports.boolean().optional()
34464
34493
  }).strict().default({});
34465
34494
  var AgentConcurrencySchema = external_exports.number().int().refine((value2) => value2 === 1, {
34466
34495
  message: "Only `concurrency: 1` is supported; larger pools are a deliberate non-goal for now (see docs/agent-concurrency.md)"
@@ -34701,7 +34730,13 @@ var BINDING_LIFECYCLE_VALUES = ["manual", "held"];
34701
34730
  var BindingLifecycleSpecSchema = external_exports.object({
34702
34731
  lifecycle: external_exports.enum(BINDING_LIFECYCLE_VALUES).default("manual"),
34703
34732
  continuity: external_exports.enum(["session", "agent"]).default("session"),
34704
- bind: BindingAutoBindSchema.optional()
34733
+ bind: BindingAutoBindSchema.optional(),
34734
+ context: JsonObjectSchema.optional(),
34735
+ eventContext: external_exports.object({
34736
+ bound: JsonObjectSchema.optional(),
34737
+ updated: JsonObjectSchema.optional(),
34738
+ unbound: JsonObjectSchema.optional()
34739
+ }).strict().optional()
34705
34740
  }).strict();
34706
34741
  var AgentBindingsSchema = external_exports.record(external_exports.string(), BindingLifecycleSpecSchema).superRefine((bindings, context) => {
34707
34742
  for (const key of Object.keys(bindings)) {
@@ -36373,11 +36408,19 @@ var ProjectApplySourceRequestSchema = external_exports.object({
36373
36408
  dryRun: external_exports.boolean().default(false),
36374
36409
  prune: external_exports.boolean().default(true)
36375
36410
  });
36411
+ var ProjectApplySourceLocationSchema = external_exports.object({
36412
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
36413
+ name: external_exports.string().min(1),
36414
+ path: external_exports.string().min(1),
36415
+ file: external_exports.string().min(1),
36416
+ line: external_exports.number().int().positive()
36417
+ });
36376
36418
  var ProjectApplyRequestSchema = external_exports.object({
36377
36419
  delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
36378
36420
  dryRun: external_exports.boolean().default(false),
36379
36421
  prune: external_exports.boolean().default(false),
36380
36422
  resources: external_exports.array(ProjectApplyResourceSchema).default([]),
36423
+ sourceLocations: external_exports.array(ProjectApplySourceLocationSchema).default([]),
36381
36424
  assets: ProjectApplyAssetsSchema.default({})
36382
36425
  });
36383
36426
  var ProjectApplySystemConfigSchema = external_exports.object({
@@ -36420,7 +36463,12 @@ var ProjectApplyResponsePrunedSchema = external_exports.object({
36420
36463
  });
36421
36464
  var ProjectApplyPlanDiffSchema = external_exports.object({
36422
36465
  action: external_exports.enum(["add", "remove", "change"]),
36423
- path: external_exports.string().min(1)
36466
+ path: external_exports.string().min(1),
36467
+ source: ProjectApplySourceLocationSchema.omit({
36468
+ kind: true,
36469
+ name: true,
36470
+ path: true
36471
+ }).optional()
36424
36472
  });
36425
36473
  var ProjectApplyResponseSchema = external_exports.object({
36426
36474
  dryRun: external_exports.boolean().default(false),
@@ -36433,6 +36481,11 @@ var ProjectApplyResponseSchema = external_exports.object({
36433
36481
  kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
36434
36482
  name: external_exports.string().min(1),
36435
36483
  uid: external_exports.string().min(1).optional(),
36484
+ source: ProjectApplySourceLocationSchema.omit({
36485
+ kind: true,
36486
+ name: true,
36487
+ path: true
36488
+ }).optional(),
36436
36489
  diff: external_exports.array(ProjectApplyPlanDiffSchema).optional(),
36437
36490
  diffOmitted: external_exports.number().int().positive().optional()
36438
36491
  })
@@ -36717,6 +36770,10 @@ var RunBindingRecordSchema = external_exports.object({
36717
36770
  continuity: SessionBindingContinuitySchema,
36718
36771
  releasedBy: SessionBindingReleasedBySchema.nullable(),
36719
36772
  payload: JsonValueSchema2.nullable(),
36773
+ context: JsonObjectSchema.nullable(),
36774
+ eventContextDefaults: JsonObjectSchema.nullable(),
36775
+ revision: external_exports.number().int().nonnegative(),
36776
+ observeAfterBindingRevision: external_exports.number().int().nonnegative().nullable(),
36720
36777
  createdAt: external_exports.string().datetime(),
36721
36778
  updatedAt: external_exports.string().datetime()
36722
36779
  });
package/dist/index.js CHANGED
@@ -15207,7 +15207,7 @@ function toJsonValue(value) {
15207
15207
  return String(value);
15208
15208
  }
15209
15209
  }
15210
- var JsonValueSchema, IdempotencySchema;
15210
+ var JsonValueSchema, JsonObjectSchema, IdempotencySchema;
15211
15211
  var init_primitives = __esm({
15212
15212
  "../../packages/schemas/src/primitives.ts"() {
15213
15213
  "use strict";
@@ -15222,6 +15222,10 @@ var init_primitives = __esm({
15222
15222
  external_exports.record(external_exports.string(), JsonValueSchema)
15223
15223
  ])
15224
15224
  );
15225
+ JsonObjectSchema = external_exports.record(
15226
+ external_exports.string(),
15227
+ JsonValueSchema
15228
+ );
15225
15229
  IdempotencySchema = external_exports.discriminatedUnion("kind", [
15226
15230
  external_exports.object({ kind: external_exports.literal("none") }),
15227
15231
  external_exports.object({ kind: external_exports.literal("key"), key: external_exports.string().trim().min(1) })
@@ -17962,7 +17966,7 @@ var init_secrets = __esm({
17962
17966
  });
17963
17967
 
17964
17968
  // ../../packages/schemas/src/session-bindings.ts
17965
- var BINDING_TARGET_TYPES, TRIGGER_BINDING_TARGET_TYPES, SESSION_BINDING_SOURCES, SESSION_BINDING_STATUSES, SESSION_BINDING_RELEASE_POLICIES, SESSION_BINDING_CONTINUITIES, SESSION_BINDING_RELEASED_BY, BindingTargetTypeSchema, TriggerBindingTargetTypeSchema, SessionBindingSourceSchema, SessionBindingStatusSchema, SessionBindingReleasePolicySchema, SessionBindingContinuitySchema, SessionBindingReleasedBySchema, BindingTargetSchema, BINDING_AUTO_BIND_VALUES, BindingAutoBindSchema, AUTO_BIND_LEGAL_TARGETS;
17969
+ var BINDING_TARGET_TYPES, TRIGGER_BINDING_TARGET_TYPES, SESSION_BINDING_SOURCES, SESSION_BINDING_STATUSES, SESSION_BINDING_RELEASE_POLICIES, SESSION_BINDING_CONTINUITIES, SESSION_BINDING_RELEASED_BY, BINDING_TRANSITION_CAUSES, BindingTargetTypeSchema, TriggerBindingTargetTypeSchema, SessionBindingSourceSchema, SessionBindingStatusSchema, SessionBindingReleasePolicySchema, SessionBindingContinuitySchema, SessionBindingReleasedBySchema, BindingTransitionCauseSchema, BindingTargetSchema, BINDING_AUTO_BIND_VALUES, BindingAutoBindSchema, AUTO_BIND_LEGAL_TARGETS;
17966
17970
  var init_session_bindings = __esm({
17967
17971
  "../../packages/schemas/src/session-bindings.ts"() {
17968
17972
  "use strict";
@@ -17974,14 +17978,16 @@ var init_session_bindings = __esm({
17974
17978
  "chat.message",
17975
17979
  "agent.singleton",
17976
17980
  "linear.issue",
17977
- "auto.connection.authorization_attempt"
17981
+ "auto.connection.authorization_attempt",
17982
+ "auto.session"
17978
17983
  ];
17979
17984
  TRIGGER_BINDING_TARGET_TYPES = [
17980
17985
  "github.pull_request",
17981
17986
  "github.issue",
17982
17987
  "slack.thread",
17983
17988
  "agent.singleton",
17984
- "linear.issue"
17989
+ "linear.issue",
17990
+ "auto.session"
17985
17991
  ];
17986
17992
  SESSION_BINDING_SOURCES = [
17987
17993
  "trigger_spawn",
@@ -17999,6 +18005,20 @@ var init_session_bindings = __esm({
17999
18005
  "operator",
18000
18006
  "takeover"
18001
18007
  ];
18008
+ BINDING_TRANSITION_CAUSES = [
18009
+ "manual_bind",
18010
+ "manual_update",
18011
+ "attributed_event",
18012
+ "mention",
18013
+ "session_spawn",
18014
+ "trigger_spawn",
18015
+ "chat_send",
18016
+ "trigger_release",
18017
+ "archive",
18018
+ "takeover",
18019
+ "rollover",
18020
+ "system"
18021
+ ];
18002
18022
  BindingTargetTypeSchema = external_exports.enum(BINDING_TARGET_TYPES);
18003
18023
  TriggerBindingTargetTypeSchema = external_exports.enum(
18004
18024
  TRIGGER_BINDING_TARGET_TYPES
@@ -18014,6 +18034,7 @@ var init_session_bindings = __esm({
18014
18034
  SessionBindingReleasedBySchema = external_exports.enum(
18015
18035
  SESSION_BINDING_RELEASED_BY
18016
18036
  );
18037
+ BindingTransitionCauseSchema = external_exports.enum(BINDING_TRANSITION_CAUSES);
18017
18038
  BindingTargetSchema = external_exports.object({
18018
18039
  type: BindingTargetTypeSchema,
18019
18040
  externalId: external_exports.string().min(1)
@@ -18226,7 +18247,7 @@ function normalizeLegacyHeartbeatTickWorkflowInput(input) {
18226
18247
  agentResourceId: sessionResourceId
18227
18248
  };
18228
18249
  }
18229
- var CANONICAL_ROUTE_BY_KINDS, LEGACY_ROUTE_BY_KINDS, CanonicalRouteBySchema, LegacyRouteBySchema, RouteBySchema, TRIGGER_ON_UNMATCHED_POLICIES, OnUnmatchedSchema, SpawnBindSchema, CanonicalTriggerRoutingSchema, LegacySingletonRouteBySchema, LegacySingletonDeliverRoutingSchema, LegacyOwnedArtifactDeliverRoutingSchema, LegacyDeliverOrSpawnRoutingSchema, TriggerRoutingSchema, SourceEventRequestSchema, EventRoutingWorkflowInputSchema, HeartbeatTickWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowResultSchema, EventRoutingTriggerResultSchema;
18250
+ var CANONICAL_ROUTE_BY_KINDS, LEGACY_ROUTE_BY_KINDS, CanonicalRouteBySchema, LegacyRouteBySchema, RouteBySchema, TRIGGER_ON_UNMATCHED_POLICIES, OnUnmatchedSchema, SpawnBindSchema, TriggerReleaseSchema, CanonicalTriggerRoutingSchema, LegacySingletonRouteBySchema, LegacySingletonDeliverRoutingSchema, LegacyOwnedArtifactDeliverRoutingSchema, LegacyDeliverOrSpawnRoutingSchema, TriggerRoutingSchema, SourceEventRequestSchema, EventRoutingWorkflowInputSchema, HeartbeatTickWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowInputSchema, GithubPullRequestMergeabilityWorkflowResultSchema, EventRoutingTriggerResultSchema;
18230
18251
  var init_trigger_router = __esm({
18231
18252
  "../../packages/schemas/src/trigger-router.ts"() {
18232
18253
  "use strict";
@@ -18277,8 +18298,15 @@ var init_trigger_router = __esm({
18277
18298
  ];
18278
18299
  OnUnmatchedSchema = external_exports.enum(TRIGGER_ON_UNMATCHED_POLICIES).default("drop");
18279
18300
  SpawnBindSchema = external_exports.object({
18280
- target: TriggerBindingTargetTypeSchema
18281
- });
18301
+ target: TriggerBindingTargetTypeSchema,
18302
+ context: JsonObjectSchema.optional(),
18303
+ eventContext: JsonObjectSchema.optional()
18304
+ }).strict();
18305
+ TriggerReleaseSchema = external_exports.union([
18306
+ external_exports.literal(false),
18307
+ external_exports.literal(true).transform(() => ({ context: null })),
18308
+ external_exports.object({ context: JsonObjectSchema.nullable().default(null) }).strict()
18309
+ ]);
18282
18310
  CanonicalTriggerRoutingSchema = external_exports.discriminatedUnion("kind", [
18283
18311
  external_exports.object({
18284
18312
  kind: external_exports.literal("spawn"),
@@ -18307,7 +18335,7 @@ var init_trigger_router = __esm({
18307
18335
  // routing completes. No-op when no active binding exists. `agent.singleton`
18308
18336
  // is rejected at apply time (singleton slots are pool-membership state
18309
18337
  // owned by the reconciler).
18310
- release: external_exports.boolean().default(false)
18338
+ release: TriggerReleaseSchema.default(false)
18311
18339
  })
18312
18340
  ]);
18313
18341
  LegacySingletonRouteBySchema = external_exports.object({
@@ -18900,7 +18928,8 @@ var init_agents = __esm({
18900
18928
  seconds: external_exports.number().int().min(60).max(365 * 24 * 60 * 60)
18901
18929
  }).strict();
18902
18930
  AgentSessionPolicySchema = external_exports.object({
18903
- archiveAfterInactive: AgentArchiveAfterInactiveSchema.optional()
18931
+ archiveAfterInactive: AgentArchiveAfterInactiveSchema.optional(),
18932
+ observeSpawnedSessions: external_exports.boolean().optional()
18904
18933
  }).strict().default({});
18905
18934
  AgentConcurrencySchema = external_exports.number().int().refine((value) => value === 1, {
18906
18935
  message: "Only `concurrency: 1` is supported; larger pools are a deliberate non-goal for now (see docs/agent-concurrency.md)"
@@ -19023,7 +19052,13 @@ var init_agents = __esm({
19023
19052
  BindingLifecycleSpecSchema = external_exports.object({
19024
19053
  lifecycle: external_exports.enum(BINDING_LIFECYCLE_VALUES).default("manual"),
19025
19054
  continuity: external_exports.enum(["session", "agent"]).default("session"),
19026
- bind: BindingAutoBindSchema.optional()
19055
+ bind: BindingAutoBindSchema.optional(),
19056
+ context: JsonObjectSchema.optional(),
19057
+ eventContext: external_exports.object({
19058
+ bound: JsonObjectSchema.optional(),
19059
+ updated: JsonObjectSchema.optional(),
19060
+ unbound: JsonObjectSchema.optional()
19061
+ }).strict().optional()
19027
19062
  }).strict();
19028
19063
  AgentBindingsSchema = external_exports.record(external_exports.string(), BindingLifecycleSpecSchema).superRefine((bindings, context) => {
19029
19064
  for (const key of Object.keys(bindings)) {
@@ -20477,7 +20512,7 @@ var init_project_service_accounts = __esm({
20477
20512
  function projectApplyBundleStorageKey(sha256) {
20478
20513
  return `project-apply-bundles/${sha256}.json`;
20479
20514
  }
20480
- var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, AgentApplyDocumentSchema, ConfigApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, PROJECT_APPLY_RESOURCE_KINDS, PROJECT_APPLY_BUNDLE_VERSION, MAX_PROJECT_APPLY_BUNDLE_BYTES, PROJECT_APPLY_BUNDLE_CONTENT_TYPE, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadResponseSchema, ApplyBundlePathSchema, ProjectApplyBundleFileSchema, ProjectApplyBundleSchema, ProjectApplyBundleRefSchema, ProjectApplyBundleUploadRequestSchema, ProjectApplyBundleUploadResponseSchema, ProjectApplyBundleDirectoryEntrypointSchema, ProjectApplyBundleFileEntrypointSchema, ProjectApplyBundleEntrypointSchema, ProjectApplySourceSchema, ProjectApplySourceRequestSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponsePrunedSchema, ProjectApplyPlanDiffSchema, ProjectApplyResponseSchema, ProjectResourceApplyResultSchema, ProjectResourceApplyAuditActionSchema, ProjectResourceApplyOperationIdSchema, ProjectResourceApplyTriggerArtifactSchema, ProjectResourceApplyWorkflowErrorSchema, ProjectResourceApplyWorkflowInputSchema, ProjectResourceApplyWorkflowResultSchema;
20515
+ var EnvironmentApplyDocumentSchema, IdentityApplyDocumentSchema, AgentApplyDocumentSchema, ConfigApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, PROJECT_APPLY_RESOURCE_KINDS, PROJECT_APPLY_BUNDLE_VERSION, MAX_PROJECT_APPLY_BUNDLE_BYTES, PROJECT_APPLY_BUNDLE_CONTENT_TYPE, ProjectDeleteResourceBaseSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadResponseSchema, ApplyBundlePathSchema, ProjectApplyBundleFileSchema, ProjectApplyBundleSchema, ProjectApplyBundleRefSchema, ProjectApplyBundleUploadRequestSchema, ProjectApplyBundleUploadResponseSchema, ProjectApplyBundleDirectoryEntrypointSchema, ProjectApplyBundleFileEntrypointSchema, ProjectApplyBundleEntrypointSchema, ProjectApplySourceSchema, ProjectApplySourceRequestSchema, ProjectApplySourceLocationSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponsePrunedSchema, ProjectApplyPlanDiffSchema, ProjectApplyResponseSchema, ProjectResourceApplyResultSchema, ProjectResourceApplyAuditActionSchema, ProjectResourceApplyOperationIdSchema, ProjectResourceApplyTriggerArtifactSchema, ProjectResourceApplyWorkflowErrorSchema, ProjectResourceApplyWorkflowInputSchema, ProjectResourceApplyWorkflowResultSchema;
20481
20516
  var init_project_resources = __esm({
20482
20517
  "../../packages/schemas/src/project-resources.ts"() {
20483
20518
  "use strict";
@@ -20616,11 +20651,19 @@ var init_project_resources = __esm({
20616
20651
  dryRun: external_exports.boolean().default(false),
20617
20652
  prune: external_exports.boolean().default(true)
20618
20653
  });
20654
+ ProjectApplySourceLocationSchema = external_exports.object({
20655
+ kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
20656
+ name: external_exports.string().min(1),
20657
+ path: external_exports.string().min(1),
20658
+ file: external_exports.string().min(1),
20659
+ line: external_exports.number().int().positive()
20660
+ });
20619
20661
  ProjectApplyRequestSchema = external_exports.object({
20620
20662
  delete: external_exports.array(ProjectDeleteResourceSchema).default([]),
20621
20663
  dryRun: external_exports.boolean().default(false),
20622
20664
  prune: external_exports.boolean().default(false),
20623
20665
  resources: external_exports.array(ProjectApplyResourceSchema).default([]),
20666
+ sourceLocations: external_exports.array(ProjectApplySourceLocationSchema).default([]),
20624
20667
  assets: ProjectApplyAssetsSchema.default({})
20625
20668
  });
20626
20669
  ProjectApplySystemConfigSchema = external_exports.object({
@@ -20663,7 +20706,12 @@ var init_project_resources = __esm({
20663
20706
  });
20664
20707
  ProjectApplyPlanDiffSchema = external_exports.object({
20665
20708
  action: external_exports.enum(["add", "remove", "change"]),
20666
- path: external_exports.string().min(1)
20709
+ path: external_exports.string().min(1),
20710
+ source: ProjectApplySourceLocationSchema.omit({
20711
+ kind: true,
20712
+ name: true,
20713
+ path: true
20714
+ }).optional()
20667
20715
  });
20668
20716
  ProjectApplyResponseSchema = external_exports.object({
20669
20717
  dryRun: external_exports.boolean().default(false),
@@ -20676,6 +20724,11 @@ var init_project_resources = __esm({
20676
20724
  kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
20677
20725
  name: external_exports.string().min(1),
20678
20726
  uid: external_exports.string().min(1).optional(),
20727
+ source: ProjectApplySourceLocationSchema.omit({
20728
+ kind: true,
20729
+ name: true,
20730
+ path: true
20731
+ }).optional(),
20679
20732
  diff: external_exports.array(ProjectApplyPlanDiffSchema).optional(),
20680
20733
  diffOmitted: external_exports.number().int().positive().optional()
20681
20734
  })
@@ -21002,6 +21055,10 @@ var init_session_introspection = __esm({
21002
21055
  continuity: SessionBindingContinuitySchema,
21003
21056
  releasedBy: SessionBindingReleasedBySchema.nullable(),
21004
21057
  payload: JsonValueSchema.nullable(),
21058
+ context: JsonObjectSchema.nullable(),
21059
+ eventContextDefaults: JsonObjectSchema.nullable(),
21060
+ revision: external_exports.number().int().nonnegative(),
21061
+ observeAfterBindingRevision: external_exports.number().int().nonnegative().nullable(),
21005
21062
  createdAt: external_exports.string().datetime(),
21006
21063
  updatedAt: external_exports.string().datetime()
21007
21064
  });
@@ -38611,7 +38668,7 @@ var init_package = __esm({
38611
38668
  "package.json"() {
38612
38669
  package_default = {
38613
38670
  name: "@autohq/cli",
38614
- version: "0.1.414",
38671
+ version: "0.1.416",
38615
38672
  license: "SEE LICENSE IN README.md",
38616
38673
  publishConfig: {
38617
38674
  access: "public"
@@ -39720,9 +39777,113 @@ var init_agent_document_merge = __esm({
39720
39777
  }
39721
39778
  });
39722
39779
 
39780
+ // ../../packages/schemas/src/project-apply-files/source-locations.ts
39781
+ import { LineCounter, isMap, isSeq, parseAllDocuments } from "yaml";
39782
+ function readProjectConfigSourceLocations(file2) {
39783
+ const locations = readYamlLocations(file2, "spec");
39784
+ return Object.values(locations).map((location) => ({
39785
+ ...location,
39786
+ kind: RESOURCE_KIND_CONFIG,
39787
+ name: PROJECT_CONFIG_RESOURCE_NAME
39788
+ }));
39789
+ }
39790
+ function readAgentDraftSourceLocations(path2, fileIndex) {
39791
+ const normalizedPath = normalizeSourcePath(path2);
39792
+ if (normalizedPath.startsWith("packages/")) {
39793
+ return {};
39794
+ }
39795
+ const file2 = fileIndex.get(normalizedPath);
39796
+ if (!file2) {
39797
+ return {};
39798
+ }
39799
+ return readYamlLocations(file2, "");
39800
+ }
39801
+ function readYamlLocations(file2, rootPath) {
39802
+ const source = Buffer.from(file2.contentBase64, "base64").toString("utf8");
39803
+ const lineCounter = new LineCounter();
39804
+ const documents = parseAllDocuments(source, {
39805
+ keepSourceTokens: true,
39806
+ lineCounter
39807
+ });
39808
+ if (documents.length !== 1 || documents[0]?.errors.length) {
39809
+ return {};
39810
+ }
39811
+ const locations = {};
39812
+ collectNodeLocations(documents[0]?.contents, rootPath, locations, {
39813
+ file: normalizeSourcePath(file2.path),
39814
+ lineCounter
39815
+ });
39816
+ return locations;
39817
+ }
39818
+ function collectNodeLocations(node, path2, locations, context) {
39819
+ if (isMap(node)) {
39820
+ for (const pair of node.items) {
39821
+ const key = String(pair.key?.toJSON());
39822
+ if (["import", "imports", "remove", "variables"].includes(key)) {
39823
+ continue;
39824
+ }
39825
+ const childPath = propertyPath(path2, key);
39826
+ recordLocation(
39827
+ pair.key,
39828
+ childPath,
39829
+ locations,
39830
+ context
39831
+ );
39832
+ collectNodeLocations(pair.value, childPath, locations, context);
39833
+ }
39834
+ return;
39835
+ }
39836
+ if (isSeq(node)) {
39837
+ node.items.forEach((item, index) => {
39838
+ const childPath = `${path2}[${index}]`;
39839
+ recordLocation(
39840
+ item,
39841
+ childPath,
39842
+ locations,
39843
+ context
39844
+ );
39845
+ collectNodeLocations(item, childPath, locations, context);
39846
+ });
39847
+ }
39848
+ }
39849
+ function recordLocation(node, path2, locations, context) {
39850
+ const offset = node?.range?.[0];
39851
+ if (offset === void 0) {
39852
+ return;
39853
+ }
39854
+ const locationPath = path2.startsWith("spec.") ? path2 : compiledPath(path2);
39855
+ locations[locationPath] = {
39856
+ path: locationPath,
39857
+ file: context.file,
39858
+ line: context.lineCounter.linePos(offset).line
39859
+ };
39860
+ }
39861
+ function compiledPath(path2) {
39862
+ const topLevel = path2.match(/^[^.[]+/)?.[0];
39863
+ if (!topLevel) {
39864
+ return path2;
39865
+ }
39866
+ const target = ["name", "labels", "annotations"].includes(topLevel) ? "metadata" : "spec";
39867
+ return `${target}.${path2}`;
39868
+ }
39869
+ function propertyPath(parent, key) {
39870
+ const segment = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : `[${JSON.stringify(key)}]`;
39871
+ if (!parent) {
39872
+ return segment;
39873
+ }
39874
+ return segment.startsWith("[") ? `${parent}${segment}` : `${parent}.${segment}`;
39875
+ }
39876
+ var init_source_locations = __esm({
39877
+ "../../packages/schemas/src/project-apply-files/source-locations.ts"() {
39878
+ "use strict";
39879
+ init_project_config();
39880
+ init_source();
39881
+ }
39882
+ });
39883
+
39723
39884
  // ../../packages/schemas/src/project-apply-files/agent-fields/helpers.ts
39724
39885
  function emptyAgentDraft() {
39725
- return { metadata: {}, spec: {} };
39886
+ return { metadata: {}, spec: {}, sourceLocations: {} };
39726
39887
  }
39727
39888
  function cloneAgentDraft(draft) {
39728
39889
  return structuredClone(draft);
@@ -40033,7 +40194,7 @@ function splitMetadataAndSpec(document) {
40033
40194
  }
40034
40195
  spec[key] = value;
40035
40196
  }
40036
- return { metadata, spec };
40197
+ return { metadata, spec, sourceLocations: {} };
40037
40198
  }
40038
40199
  function standaloneResourceError(kind, path2) {
40039
40200
  if (kind === RESOURCE_KIND_ENVIRONMENT) {
@@ -40438,6 +40599,7 @@ function parseAgentDraft(document, path2, fileIndex) {
40438
40599
  const sanitized = sanitizedAgentDocument2(document);
40439
40600
  assertNoLegacyEnvelopeFields(sanitized, path2);
40440
40601
  const draft = emptyAgentDraft();
40602
+ draft.sourceLocations = readAgentDraftSourceLocations(path2, fileIndex);
40441
40603
  for (const [key, value] of Object.entries(sanitized)) {
40442
40604
  if (value === void 0) {
40443
40605
  continue;
@@ -40460,7 +40622,8 @@ function parseAgentDraft(document, path2, fileIndex) {
40460
40622
  function mergeAgentDrafts(base, override) {
40461
40623
  return {
40462
40624
  metadata: mergeDraftTarget("metadata", base.metadata, override.metadata),
40463
- spec: mergeDraftTarget("spec", base.spec, override.spec)
40625
+ spec: mergeDraftTarget("spec", base.spec, override.spec),
40626
+ sourceLocations: mergeSourceLocations(base, override)
40464
40627
  };
40465
40628
  }
40466
40629
  function applyAgentDraftRemoval(draft, removal) {
@@ -40478,8 +40641,35 @@ function applyAgentDraftRemoval(draft, removal) {
40478
40641
  if (updated !== void 0 || current !== void 0) {
40479
40642
  target[removal.target] = updated;
40480
40643
  }
40644
+ for (const name of removal.names) {
40645
+ const prefix = `spec.${removal.target}.${name}`;
40646
+ next.sourceLocations = Object.fromEntries(
40647
+ Object.entries(next.sourceLocations).filter(
40648
+ ([path2]) => path2 !== prefix && !path2.startsWith(`${prefix}.`)
40649
+ )
40650
+ );
40651
+ }
40481
40652
  return next;
40482
40653
  }
40654
+ function mergeSourceLocations(base, override) {
40655
+ let merged = { ...base.sourceLocations };
40656
+ for (const target of ["metadata", "spec"]) {
40657
+ for (const [key, value] of Object.entries(override[target])) {
40658
+ if (value === void 0) {
40659
+ continue;
40660
+ }
40661
+ const prefix = `${target}.${key}`;
40662
+ if (!isRecord2(value)) {
40663
+ merged = Object.fromEntries(
40664
+ Object.entries(merged).filter(
40665
+ ([path2]) => path2 !== prefix && !path2.startsWith(`${prefix}.`)
40666
+ )
40667
+ );
40668
+ }
40669
+ }
40670
+ }
40671
+ return { ...merged, ...override.sourceLocations };
40672
+ }
40483
40673
  function assertSupportedAgentRemovalTarget(target) {
40484
40674
  const supported = supportedRemovalTargets();
40485
40675
  if (!supported.includes(target)) {
@@ -40549,6 +40739,8 @@ var AGENT_FIELDS;
40549
40739
  var init_agent_fields = __esm({
40550
40740
  "../../packages/schemas/src/project-apply-files/agent-fields/index.ts"() {
40551
40741
  "use strict";
40742
+ init_source();
40743
+ init_source_locations();
40552
40744
  init_file_backed_string();
40553
40745
  init_helpers();
40554
40746
  init_inline_resource();
@@ -40677,11 +40869,52 @@ function readApplyDocument(path2, document, fileIndex, contextVariables) {
40677
40869
  fileIndex,
40678
40870
  contextVariables
40679
40871
  );
40680
- return result.resources.map((resource) => ({
40681
- resource,
40682
- generatedFromAgent: resource !== result.resource,
40683
- sourcePath: normalizeSourcePath(path2)
40684
- }));
40872
+ return result.resources.map((resource) => {
40873
+ let generatedField;
40874
+ switch (resource.kind) {
40875
+ case "environment":
40876
+ generatedField = "spec.environment";
40877
+ break;
40878
+ case "identity":
40879
+ generatedField = "spec.identity";
40880
+ break;
40881
+ default:
40882
+ generatedField = void 0;
40883
+ break;
40884
+ }
40885
+ const generatedLocation = generatedField ? result.sourceLocations[generatedField] : void 0;
40886
+ return {
40887
+ resource,
40888
+ generatedFromAgent: resource !== result.resource,
40889
+ sourcePath: normalizeSourcePath(path2),
40890
+ sourceLocations: sourceLocationsForCompiledResource({
40891
+ resource,
40892
+ primaryResource: result.resource,
40893
+ draftLocations: result.sourceLocations,
40894
+ generatedLocation
40895
+ })
40896
+ };
40897
+ });
40898
+ }
40899
+ function sourceLocationsForCompiledResource(input) {
40900
+ if (input.resource === input.primaryResource) {
40901
+ return Object.values(input.draftLocations).map((location) => ({
40902
+ ...location,
40903
+ kind: input.resource.kind,
40904
+ name: input.resource.metadata.name
40905
+ }));
40906
+ }
40907
+ if (!input.generatedLocation) {
40908
+ return [];
40909
+ }
40910
+ return [
40911
+ {
40912
+ ...input.generatedLocation,
40913
+ kind: input.resource.kind,
40914
+ name: input.resource.metadata.name,
40915
+ path: "$"
40916
+ }
40917
+ ];
40685
40918
  }
40686
40919
  function validateAgentFragmentDocument(document, path2, context) {
40687
40920
  const normalizedPath = normalizeSourcePath(path2);
@@ -40740,15 +40973,16 @@ function conflictingGeneratedResourceMessage(key, existing, record2) {
40740
40973
  return `Conflicting generated resource "${key}" from agent authoring: ${location}. Inline generated resources must be identical when they share a name.`;
40741
40974
  }
40742
40975
  function compileAgentDocumentValue(document, path2, fileIndex, contextVariables) {
40743
- return compileAgentDraftResources(
40744
- compileAgentDocument2(document, path2, {
40745
- fileIndex,
40746
- stack: [],
40747
- variables: /* @__PURE__ */ new Map(),
40748
- ...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
40749
- }),
40750
- path2
40751
- );
40976
+ const draft = compileAgentDocument2(document, path2, {
40977
+ fileIndex,
40978
+ stack: [],
40979
+ variables: /* @__PURE__ */ new Map(),
40980
+ ...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
40981
+ });
40982
+ return {
40983
+ ...compileAgentDraftResources(draft, path2),
40984
+ sourceLocations: draft.sourceLocations
40985
+ };
40752
40986
  }
40753
40987
  function compileAgentDocument2(document, path2, context) {
40754
40988
  const normalizedPath = normalizeSourcePath(path2);
@@ -41101,11 +41335,18 @@ function readProjectApplyDirectorySource(input) {
41101
41335
  ...request.resources.map((resource) => ({
41102
41336
  resource,
41103
41337
  generatedFromAgent: resource.kind !== RESOURCE_KIND_AGENT,
41104
- sourcePath: file2.path
41338
+ sourcePath: file2.path,
41339
+ sourceLocations: request.sourceLocations.filter(
41340
+ (location) => location.kind === resource.kind && location.name === resource.metadata.name
41341
+ )
41105
41342
  }))
41106
41343
  );
41107
41344
  }
41345
+ const configFile = files.find(
41346
+ (file2) => ["config.yaml", "config.yml"].map((name) => sourcePathJoin(resourceRoot, name)).includes(normalizeSourcePath(file2.path))
41347
+ );
41108
41348
  const configResource = readProjectConfigResource(files, resourceRoot);
41349
+ const configSourceLocations = configFile ? readProjectConfigSourceLocations(configFile) : [];
41109
41350
  const resources = [
41110
41351
  ...dedupeGeneratedResources(resourceRecords),
41111
41352
  ...configResource ? [configResource] : []
@@ -41118,6 +41359,10 @@ function readProjectApplyDirectorySource(input) {
41118
41359
  dryRun: input.dryRun ?? false,
41119
41360
  prune: input.prune ?? true,
41120
41361
  resources,
41362
+ sourceLocations: [
41363
+ ...resourceRecords.flatMap((record2) => record2.sourceLocations),
41364
+ ...configSourceLocations
41365
+ ],
41121
41366
  assets: readApplyAssets(resources, input.readAsset)
41122
41367
  });
41123
41368
  }
@@ -41155,6 +41400,9 @@ function readProjectApplyDocumentSourceFile(file2, options = {}) {
41155
41400
  dryRun: false,
41156
41401
  prune: false,
41157
41402
  resources: dedupeGeneratedResources(resourceRecords),
41403
+ sourceLocations: resourceRecords.flatMap(
41404
+ (record2) => record2.sourceLocations
41405
+ ),
41158
41406
  assets: {}
41159
41407
  });
41160
41408
  }
@@ -41276,6 +41524,7 @@ var init_project_apply_files = __esm({
41276
41524
  init_apply_result();
41277
41525
  init_assets();
41278
41526
  init_source();
41527
+ init_source_locations();
41279
41528
  init_template_injection();
41280
41529
  init_assets();
41281
41530
  init_template_injection();
@@ -58994,9 +59243,12 @@ function formatBindingsText(result, writeLine, style) {
58994
59243
  for (const binding of result.bindings) {
58995
59244
  writeLine(
58996
59245
  `${style.label(binding.targetType)} ${style.id(binding.externalId)} ${style.dim(
58997
- `source=${binding.source} created=${binding.createdAt}`
59246
+ `source=${binding.source} revision=${binding.revision}${binding.observeAfterBindingRevision === null ? "" : ` observes-after=${binding.observeAfterBindingRevision}`} created=${binding.createdAt}`
58998
59247
  )}`
58999
59248
  );
59249
+ if (binding.context) {
59250
+ writeLine(style.dim(` context=${JSON.stringify(binding.context)}`));
59251
+ }
59000
59252
  }
59001
59253
  }
59002
59254
  async function handleRunsCommands(context, sessionId, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.414",
3
+ "version": "0.1.416",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"