@autohq/cli 0.1.431 → 0.1.432

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -17584,335 +17584,6 @@ var init_connections = __esm({
17584
17584
  }
17585
17585
  });
17586
17586
 
17587
- // ../../packages/schemas/src/dormant-capabilities.ts
17588
- var DormantCapabilityConnectionSchema, DormantCapabilitySchema, DormantCapabilitiesSchema;
17589
- var init_dormant_capabilities = __esm({
17590
- "../../packages/schemas/src/dormant-capabilities.ts"() {
17591
- "use strict";
17592
- init_zod();
17593
- DormantCapabilityConnectionSchema = external_exports.object({
17594
- provider: external_exports.string().trim().min(1),
17595
- connection: external_exports.string().trim().min(1)
17596
- });
17597
- DormantCapabilitySchema = external_exports.object({
17598
- kind: external_exports.enum(["tool", "trigger"]),
17599
- name: external_exports.string().trim().min(1),
17600
- connections: external_exports.array(DormantCapabilityConnectionSchema).min(1)
17601
- });
17602
- DormantCapabilitiesSchema = external_exports.array(DormantCapabilitySchema);
17603
- }
17604
- });
17605
-
17606
- // ../../packages/schemas/src/github-sync.ts
17607
- var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncInitialSyncSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
17608
- var init_github_sync = __esm({
17609
- "../../packages/schemas/src/github-sync.ts"() {
17610
- "use strict";
17611
- init_zod();
17612
- init_ids();
17613
- init_primitives();
17614
- GITHUB_SYNC_AUTO_PATH = ".auto";
17615
- GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS = 15e3;
17616
- GithubSyncRepositoryFullNameSchema = external_exports.string().trim().min(1).regex(/^[^/\s]+\/[^/\s]+$/, {
17617
- message: "repository must be in owner/name form"
17618
- });
17619
- GithubSyncProductionBranchSchema = external_exports.string().trim().min(1).max(255).refine((branch) => !branch.startsWith("/") && !branch.endsWith("/"), {
17620
- message: "branch must not start or end with /"
17621
- });
17622
- GithubSyncCiWatchdogWorkflowSchema = external_exports.object({
17623
- workflowId: external_exports.string().trim().min(1).max(255)
17624
- }).strict();
17625
- GithubSyncCiWatchdogSchema = external_exports.object({
17626
- workflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
17627
- checkDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
17628
- }).strict();
17629
- GithubSyncBindingSchema = external_exports.object({
17630
- id: external_exports.string().trim().min(1),
17631
- organizationId: OrganizationIdSchema,
17632
- projectId: ProjectIdSchema,
17633
- providerGrantId: ProviderGrantIdSchema,
17634
- installationId: external_exports.string().trim().min(1),
17635
- repoFullName: GithubSyncRepositoryFullNameSchema,
17636
- repoId: external_exports.string().trim().min(1).nullable(),
17637
- productionBranch: GithubSyncProductionBranchSchema,
17638
- autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
17639
- ciWatchdog: GithubSyncCiWatchdogSchema,
17640
- enabled: external_exports.boolean(),
17641
- lastPlannedSha: external_exports.string().trim().min(1).nullable(),
17642
- lastAppliedSha: external_exports.string().trim().min(1).nullable(),
17643
- createdAt: external_exports.string().datetime(),
17644
- updatedAt: external_exports.string().datetime()
17645
- });
17646
- GithubSyncBindingCreateRequestSchema = external_exports.object({
17647
- connection: external_exports.string().trim().min(1).optional(),
17648
- repo: GithubSyncRepositoryFullNameSchema,
17649
- repoId: external_exports.string().trim().min(1).optional(),
17650
- branch: GithubSyncProductionBranchSchema.optional(),
17651
- ciWatchdog: GithubSyncCiWatchdogSchema.optional()
17652
- });
17653
- GithubSyncInitialSyncSchema = external_exports.object({
17654
- started: external_exports.boolean(),
17655
- headSha: external_exports.string().trim().min(1).optional(),
17656
- workflowId: external_exports.string().trim().min(1).optional(),
17657
- reason: external_exports.enum([
17658
- "no_auto_directory",
17659
- "already_applied",
17660
- "probe_failed",
17661
- "start_failed"
17662
- ]).optional()
17663
- });
17664
- GithubSyncBindingCreateResponseSchema = external_exports.object({
17665
- binding: GithubSyncBindingSchema,
17666
- created: external_exports.boolean(),
17667
- initialSync: GithubSyncInitialSyncSchema.optional()
17668
- });
17669
- GithubSyncBindingListResponseSchema = external_exports.object({
17670
- bindings: external_exports.array(GithubSyncBindingSchema)
17671
- });
17672
- GithubSyncTriggerArtifactSchema = external_exports.object({
17673
- type: external_exports.string().trim().min(1),
17674
- externalId: external_exports.string().trim().min(1),
17675
- payload: JsonValueSchema.optional()
17676
- }).strict();
17677
- GithubSyncWorkflowInputSchema = external_exports.discriminatedUnion("kind", [
17678
- external_exports.object({
17679
- kind: external_exports.literal("pull_request"),
17680
- bindingId: external_exports.string().trim().min(1),
17681
- organizationId: OrganizationIdSchema,
17682
- projectId: ProjectIdSchema,
17683
- providerGrantId: ProviderGrantIdSchema,
17684
- installationId: external_exports.string().trim().min(1),
17685
- repoFullName: GithubSyncRepositoryFullNameSchema,
17686
- repoId: external_exports.string().trim().min(1).optional(),
17687
- productionBranch: GithubSyncProductionBranchSchema,
17688
- autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
17689
- pullRequestNumber: external_exports.number().int().positive(),
17690
- headSha: external_exports.string().trim().min(1),
17691
- baseSha: external_exports.string().trim().min(1).optional(),
17692
- baseRef: GithubSyncProductionBranchSchema,
17693
- triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
17694
- }),
17695
- external_exports.object({
17696
- kind: external_exports.literal("push"),
17697
- bindingId: external_exports.string().trim().min(1),
17698
- organizationId: OrganizationIdSchema,
17699
- projectId: ProjectIdSchema,
17700
- providerGrantId: ProviderGrantIdSchema,
17701
- installationId: external_exports.string().trim().min(1),
17702
- repoFullName: GithubSyncRepositoryFullNameSchema,
17703
- repoId: external_exports.string().trim().min(1).optional(),
17704
- productionBranch: GithubSyncProductionBranchSchema,
17705
- autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
17706
- ref: external_exports.string().trim().min(1),
17707
- branch: GithubSyncProductionBranchSchema,
17708
- before: external_exports.string().trim().min(1).optional(),
17709
- after: external_exports.string().trim().min(1),
17710
- triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
17711
- }),
17712
- // Synthetic re-apply triggered by a managed-template version bump (not a
17713
- // webhook). The tenant's `.auto` is unchanged — only our registry changed —
17714
- // so this arm skips the `no_auto_changes` early-out and applies the production
17715
- // branch HEAD (`after`, which the sweep resolves before starting the run).
17716
- // It is otherwise push-shaped. `templateName`/`version` identify the drift
17717
- // that triggered it (for the commit check + idempotent workflow id).
17718
- external_exports.object({
17719
- kind: external_exports.literal("template_push"),
17720
- bindingId: external_exports.string().trim().min(1),
17721
- organizationId: OrganizationIdSchema,
17722
- projectId: ProjectIdSchema,
17723
- providerGrantId: ProviderGrantIdSchema,
17724
- installationId: external_exports.string().trim().min(1),
17725
- repoFullName: GithubSyncRepositoryFullNameSchema,
17726
- repoId: external_exports.string().trim().min(1).optional(),
17727
- productionBranch: GithubSyncProductionBranchSchema,
17728
- autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
17729
- before: external_exports.string().trim().min(1).optional(),
17730
- after: external_exports.string().trim().min(1),
17731
- templateName: external_exports.string().trim().min(1),
17732
- version: external_exports.string().trim().min(1),
17733
- triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
17734
- }),
17735
- // Synthetic authoritative re-apply triggered by one durable connection
17736
- // lifecycle occurrence. The event id makes retries reuse the same workflow,
17737
- // while a later remove/re-allow occurrence can re-run at the same git SHA.
17738
- external_exports.object({
17739
- kind: external_exports.literal("connection_push"),
17740
- bindingId: external_exports.string().trim().min(1),
17741
- organizationId: OrganizationIdSchema,
17742
- projectId: ProjectIdSchema,
17743
- providerGrantId: ProviderGrantIdSchema,
17744
- installationId: external_exports.string().trim().min(1),
17745
- repoFullName: GithubSyncRepositoryFullNameSchema,
17746
- repoId: external_exports.string().trim().min(1).optional(),
17747
- productionBranch: GithubSyncProductionBranchSchema,
17748
- autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
17749
- before: external_exports.string().trim().min(1).optional(),
17750
- after: external_exports.string().trim().min(1),
17751
- connectionEventId: external_exports.string().trim().min(1),
17752
- triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
17753
- })
17754
- ]);
17755
- GithubSyncWorkflowResultSchema = external_exports.discriminatedUnion("status", [
17756
- external_exports.object({
17757
- status: external_exports.literal("skipped"),
17758
- reason: external_exports.string().trim().min(1)
17759
- }),
17760
- external_exports.object({
17761
- status: external_exports.literal("planned"),
17762
- changed: external_exports.boolean(),
17763
- checkRunId: external_exports.number().int().positive().optional()
17764
- }),
17765
- external_exports.object({
17766
- status: external_exports.literal("applied"),
17767
- changed: external_exports.boolean(),
17768
- checkRunId: external_exports.number().int().positive().optional()
17769
- }),
17770
- external_exports.object({
17771
- status: external_exports.literal("failed"),
17772
- message: external_exports.string().trim().min(1),
17773
- checkRunId: external_exports.number().int().positive().optional()
17774
- })
17775
- ]);
17776
- }
17777
- });
17778
-
17779
- // ../../packages/schemas/src/github-credentials.ts
17780
- var CreateRunGithubCredentialRequestSchema, RunGithubCredentialResponseSchema;
17781
- var init_github_credentials = __esm({
17782
- "../../packages/schemas/src/github-credentials.ts"() {
17783
- "use strict";
17784
- init_zod();
17785
- CreateRunGithubCredentialRequestSchema = external_exports.object({
17786
- host: external_exports.literal("github.com"),
17787
- path: external_exports.string().trim().min(1).optional()
17788
- });
17789
- RunGithubCredentialResponseSchema = external_exports.object({
17790
- username: external_exports.literal("x-access-token"),
17791
- password: external_exports.string().min(1),
17792
- expiresAt: external_exports.string().datetime()
17793
- });
17794
- }
17795
- });
17796
-
17797
- // ../../packages/schemas/src/github-mcp-catalog.ts
17798
- var GITHUB_MCP_TOOL_NAMES, GITHUB_MCP_PROXY_TOOL_NAMES, GITHUB_MCP_SELECTABLE_TOOL_NAMES, GITHUB_MCP_MERGE_TOOLS, GITHUB_MCP_SECRETS_TOOLS, GITHUB_MCP_SECRETS_WRITE_TOOLS, GITHUB_MCP_WRITE_TOOLS, githubMcpToolNameSet, GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS, githubMcpWriteToolSet, githubMcpProxyToolSet, githubMcpMergeToolSet, githubMcpSecretsToolSet, githubMcpSecretsWriteToolSet;
17799
- var init_github_mcp_catalog = __esm({
17800
- "../../packages/schemas/src/github-mcp-catalog.ts"() {
17801
- "use strict";
17802
- GITHUB_MCP_TOOL_NAMES = [
17803
- "actions_get",
17804
- "actions_list",
17805
- "actions_run_trigger",
17806
- "add_comment_to_pending_review",
17807
- "add_issue_comment",
17808
- "add_reply_to_pull_request_comment",
17809
- "create_branch",
17810
- "create_or_update_file",
17811
- "create_pull_request",
17812
- "create_repository",
17813
- "delete_file",
17814
- "fork_repository",
17815
- "get_commit",
17816
- "get_file_contents",
17817
- "get_job_logs",
17818
- "get_label",
17819
- "get_latest_release",
17820
- "get_release_by_tag",
17821
- "get_tag",
17822
- "issue_read",
17823
- "issue_write",
17824
- "list_branches",
17825
- "list_commits",
17826
- "list_issue_types",
17827
- "list_issues",
17828
- "list_pull_requests",
17829
- "list_releases",
17830
- "list_repository_collaborators",
17831
- "list_tags",
17832
- "merge_pull_request",
17833
- "pull_request_read",
17834
- "pull_request_review_write",
17835
- "push_files",
17836
- "search_code",
17837
- "search_commits",
17838
- "search_issues",
17839
- "search_pull_requests",
17840
- "search_repositories",
17841
- "sub_issue_write",
17842
- "update_pull_request",
17843
- "update_pull_request_branch"
17844
- ];
17845
- GITHUB_MCP_PROXY_TOOL_NAMES = [
17846
- "actions_secret_list",
17847
- "actions_secret_write",
17848
- "delete_issue_comment",
17849
- "download_comment_attachment",
17850
- "enable_pull_request_auto_merge",
17851
- "upsert_issue_comment"
17852
- ];
17853
- GITHUB_MCP_SELECTABLE_TOOL_NAMES = [
17854
- ...GITHUB_MCP_TOOL_NAMES,
17855
- ...GITHUB_MCP_PROXY_TOOL_NAMES
17856
- ];
17857
- GITHUB_MCP_MERGE_TOOLS = [
17858
- "merge_pull_request",
17859
- "enable_pull_request_auto_merge"
17860
- ];
17861
- GITHUB_MCP_SECRETS_TOOLS = [
17862
- "actions_secret_list",
17863
- "actions_secret_write"
17864
- ];
17865
- GITHUB_MCP_SECRETS_WRITE_TOOLS = [
17866
- "actions_secret_write"
17867
- ];
17868
- GITHUB_MCP_WRITE_TOOLS = [
17869
- "actions_run_trigger",
17870
- "add_comment_to_pending_review",
17871
- "add_issue_comment",
17872
- "add_reply_to_pull_request_comment",
17873
- "create_branch",
17874
- "create_or_update_file",
17875
- "create_pull_request",
17876
- "create_repository",
17877
- "delete_file",
17878
- "fork_repository",
17879
- "issue_write",
17880
- "merge_pull_request",
17881
- "pull_request_review_write",
17882
- "push_files",
17883
- "sub_issue_write",
17884
- "update_pull_request",
17885
- "update_pull_request_branch"
17886
- ];
17887
- githubMcpToolNameSet = new Set(
17888
- GITHUB_MCP_TOOL_NAMES
17889
- );
17890
- GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS = /* @__PURE__ */ new Set([
17891
- "actions_secret_list",
17892
- "download_comment_attachment",
17893
- "delete_issue_comment"
17894
- ]);
17895
- githubMcpWriteToolSet = /* @__PURE__ */ new Set([
17896
- ...GITHUB_MCP_WRITE_TOOLS,
17897
- ...GITHUB_MCP_PROXY_TOOL_NAMES.filter(
17898
- (name) => !GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS.has(name)
17899
- )
17900
- ]);
17901
- githubMcpProxyToolSet = new Set(
17902
- GITHUB_MCP_PROXY_TOOL_NAMES
17903
- );
17904
- githubMcpMergeToolSet = new Set(
17905
- GITHUB_MCP_MERGE_TOOLS
17906
- );
17907
- githubMcpSecretsToolSet = new Set(
17908
- GITHUB_MCP_SECRETS_TOOLS
17909
- );
17910
- githubMcpSecretsWriteToolSet = new Set(
17911
- GITHUB_MCP_SECRETS_WRITE_TOOLS
17912
- );
17913
- }
17914
- });
17915
-
17916
17587
  // ../../packages/schemas/src/mounts.ts
17917
17588
  var AbsoluteMountPathSchema, GITHUB_MOUNT_CAPABILITY_LEVELS, GithubMountCapabilityLevelSchema, GITHUB_MOUNT_MERGE_CAPABILITY_LEVELS, GithubMountMergeCapabilityLevelSchema, DEFAULT_GITHUB_MOUNT_CAPABILITIES, GitMountAuthSchema, GitMountSchema, AgentMountSchema;
17918
17589
  var init_mounts = __esm({
@@ -18209,6 +17880,125 @@ var init_session_bindings = __esm({
18209
17880
  }
18210
17881
  });
18211
17882
 
17883
+ // ../../packages/schemas/src/github-mcp-catalog.ts
17884
+ var GITHUB_MCP_TOOL_NAMES, GITHUB_MCP_PROXY_TOOL_NAMES, GITHUB_MCP_SELECTABLE_TOOL_NAMES, GITHUB_MCP_MERGE_TOOLS, GITHUB_MCP_SECRETS_TOOLS, GITHUB_MCP_SECRETS_WRITE_TOOLS, GITHUB_MCP_WRITE_TOOLS, githubMcpToolNameSet, GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS, githubMcpWriteToolSet, githubMcpProxyToolSet, githubMcpMergeToolSet, githubMcpSecretsToolSet, githubMcpSecretsWriteToolSet;
17885
+ var init_github_mcp_catalog = __esm({
17886
+ "../../packages/schemas/src/github-mcp-catalog.ts"() {
17887
+ "use strict";
17888
+ GITHUB_MCP_TOOL_NAMES = [
17889
+ "actions_get",
17890
+ "actions_list",
17891
+ "actions_run_trigger",
17892
+ "add_comment_to_pending_review",
17893
+ "add_issue_comment",
17894
+ "add_reply_to_pull_request_comment",
17895
+ "create_branch",
17896
+ "create_or_update_file",
17897
+ "create_pull_request",
17898
+ "create_repository",
17899
+ "delete_file",
17900
+ "fork_repository",
17901
+ "get_commit",
17902
+ "get_file_contents",
17903
+ "get_job_logs",
17904
+ "get_label",
17905
+ "get_latest_release",
17906
+ "get_release_by_tag",
17907
+ "get_tag",
17908
+ "issue_read",
17909
+ "issue_write",
17910
+ "list_branches",
17911
+ "list_commits",
17912
+ "list_issue_types",
17913
+ "list_issues",
17914
+ "list_pull_requests",
17915
+ "list_releases",
17916
+ "list_repository_collaborators",
17917
+ "list_tags",
17918
+ "merge_pull_request",
17919
+ "pull_request_read",
17920
+ "pull_request_review_write",
17921
+ "push_files",
17922
+ "search_code",
17923
+ "search_commits",
17924
+ "search_issues",
17925
+ "search_pull_requests",
17926
+ "search_repositories",
17927
+ "sub_issue_write",
17928
+ "update_pull_request",
17929
+ "update_pull_request_branch"
17930
+ ];
17931
+ GITHUB_MCP_PROXY_TOOL_NAMES = [
17932
+ "actions_secret_list",
17933
+ "actions_secret_write",
17934
+ "delete_issue_comment",
17935
+ "download_comment_attachment",
17936
+ "enable_pull_request_auto_merge",
17937
+ "upsert_issue_comment"
17938
+ ];
17939
+ GITHUB_MCP_SELECTABLE_TOOL_NAMES = [
17940
+ ...GITHUB_MCP_TOOL_NAMES,
17941
+ ...GITHUB_MCP_PROXY_TOOL_NAMES
17942
+ ];
17943
+ GITHUB_MCP_MERGE_TOOLS = [
17944
+ "merge_pull_request",
17945
+ "enable_pull_request_auto_merge"
17946
+ ];
17947
+ GITHUB_MCP_SECRETS_TOOLS = [
17948
+ "actions_secret_list",
17949
+ "actions_secret_write"
17950
+ ];
17951
+ GITHUB_MCP_SECRETS_WRITE_TOOLS = [
17952
+ "actions_secret_write"
17953
+ ];
17954
+ GITHUB_MCP_WRITE_TOOLS = [
17955
+ "actions_run_trigger",
17956
+ "add_comment_to_pending_review",
17957
+ "add_issue_comment",
17958
+ "add_reply_to_pull_request_comment",
17959
+ "create_branch",
17960
+ "create_or_update_file",
17961
+ "create_pull_request",
17962
+ "create_repository",
17963
+ "delete_file",
17964
+ "fork_repository",
17965
+ "issue_write",
17966
+ "merge_pull_request",
17967
+ "pull_request_review_write",
17968
+ "push_files",
17969
+ "sub_issue_write",
17970
+ "update_pull_request",
17971
+ "update_pull_request_branch"
17972
+ ];
17973
+ githubMcpToolNameSet = new Set(
17974
+ GITHUB_MCP_TOOL_NAMES
17975
+ );
17976
+ GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS = /* @__PURE__ */ new Set([
17977
+ "actions_secret_list",
17978
+ "download_comment_attachment",
17979
+ "delete_issue_comment"
17980
+ ]);
17981
+ githubMcpWriteToolSet = /* @__PURE__ */ new Set([
17982
+ ...GITHUB_MCP_WRITE_TOOLS,
17983
+ ...GITHUB_MCP_PROXY_TOOL_NAMES.filter(
17984
+ (name) => !GITHUB_MCP_ATTRIBUTION_EXEMPT_PROXY_TOOLS.has(name)
17985
+ )
17986
+ ]);
17987
+ githubMcpProxyToolSet = new Set(
17988
+ GITHUB_MCP_PROXY_TOOL_NAMES
17989
+ );
17990
+ githubMcpMergeToolSet = new Set(
17991
+ GITHUB_MCP_MERGE_TOOLS
17992
+ );
17993
+ githubMcpSecretsToolSet = new Set(
17994
+ GITHUB_MCP_SECRETS_TOOLS
17995
+ );
17996
+ githubMcpSecretsWriteToolSet = new Set(
17997
+ GITHUB_MCP_SECRETS_WRITE_TOOLS
17998
+ );
17999
+ }
18000
+ });
18001
+
18212
18002
  // ../../packages/schemas/src/tools.ts
18213
18003
  function remoteMcpUrlSchema(input) {
18214
18004
  return external_exports.string().trim().url().refine(
@@ -18397,6 +18187,179 @@ var init_tools = __esm({
18397
18187
  }
18398
18188
  });
18399
18189
 
18190
+ // ../../packages/schemas/src/github-sync.ts
18191
+ var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncInitialSyncSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
18192
+ var init_github_sync = __esm({
18193
+ "../../packages/schemas/src/github-sync.ts"() {
18194
+ "use strict";
18195
+ init_zod();
18196
+ init_ids();
18197
+ init_primitives();
18198
+ GITHUB_SYNC_AUTO_PATH = ".auto";
18199
+ GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS = 15e3;
18200
+ GithubSyncRepositoryFullNameSchema = external_exports.string().trim().min(1).regex(/^[^/\s]+\/[^/\s]+$/, {
18201
+ message: "repository must be in owner/name form"
18202
+ });
18203
+ GithubSyncProductionBranchSchema = external_exports.string().trim().min(1).max(255).refine((branch) => !branch.startsWith("/") && !branch.endsWith("/"), {
18204
+ message: "branch must not start or end with /"
18205
+ });
18206
+ GithubSyncCiWatchdogWorkflowSchema = external_exports.object({
18207
+ workflowId: external_exports.string().trim().min(1).max(255)
18208
+ }).strict();
18209
+ GithubSyncCiWatchdogSchema = external_exports.object({
18210
+ workflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
18211
+ checkDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
18212
+ }).strict();
18213
+ GithubSyncBindingSchema = external_exports.object({
18214
+ id: external_exports.string().trim().min(1),
18215
+ organizationId: OrganizationIdSchema,
18216
+ projectId: ProjectIdSchema,
18217
+ providerGrantId: ProviderGrantIdSchema,
18218
+ installationId: external_exports.string().trim().min(1),
18219
+ repoFullName: GithubSyncRepositoryFullNameSchema,
18220
+ repoId: external_exports.string().trim().min(1).nullable(),
18221
+ productionBranch: GithubSyncProductionBranchSchema,
18222
+ autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
18223
+ ciWatchdog: GithubSyncCiWatchdogSchema,
18224
+ enabled: external_exports.boolean(),
18225
+ lastPlannedSha: external_exports.string().trim().min(1).nullable(),
18226
+ lastAppliedSha: external_exports.string().trim().min(1).nullable(),
18227
+ createdAt: external_exports.string().datetime(),
18228
+ updatedAt: external_exports.string().datetime()
18229
+ });
18230
+ GithubSyncBindingCreateRequestSchema = external_exports.object({
18231
+ connection: external_exports.string().trim().min(1).optional(),
18232
+ repo: GithubSyncRepositoryFullNameSchema,
18233
+ repoId: external_exports.string().trim().min(1).optional(),
18234
+ branch: GithubSyncProductionBranchSchema.optional(),
18235
+ ciWatchdog: GithubSyncCiWatchdogSchema.optional()
18236
+ });
18237
+ GithubSyncInitialSyncSchema = external_exports.object({
18238
+ started: external_exports.boolean(),
18239
+ headSha: external_exports.string().trim().min(1).optional(),
18240
+ workflowId: external_exports.string().trim().min(1).optional(),
18241
+ reason: external_exports.enum([
18242
+ "no_auto_directory",
18243
+ "already_applied",
18244
+ "probe_failed",
18245
+ "start_failed"
18246
+ ]).optional()
18247
+ });
18248
+ GithubSyncBindingCreateResponseSchema = external_exports.object({
18249
+ binding: GithubSyncBindingSchema,
18250
+ created: external_exports.boolean(),
18251
+ initialSync: GithubSyncInitialSyncSchema.optional()
18252
+ });
18253
+ GithubSyncBindingListResponseSchema = external_exports.object({
18254
+ bindings: external_exports.array(GithubSyncBindingSchema)
18255
+ });
18256
+ GithubSyncTriggerArtifactSchema = external_exports.object({
18257
+ type: external_exports.string().trim().min(1),
18258
+ externalId: external_exports.string().trim().min(1),
18259
+ payload: JsonValueSchema.optional()
18260
+ }).strict();
18261
+ GithubSyncWorkflowInputSchema = external_exports.discriminatedUnion("kind", [
18262
+ external_exports.object({
18263
+ kind: external_exports.literal("pull_request"),
18264
+ bindingId: external_exports.string().trim().min(1),
18265
+ organizationId: OrganizationIdSchema,
18266
+ projectId: ProjectIdSchema,
18267
+ providerGrantId: ProviderGrantIdSchema,
18268
+ installationId: external_exports.string().trim().min(1),
18269
+ repoFullName: GithubSyncRepositoryFullNameSchema,
18270
+ repoId: external_exports.string().trim().min(1).optional(),
18271
+ productionBranch: GithubSyncProductionBranchSchema,
18272
+ autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
18273
+ pullRequestNumber: external_exports.number().int().positive(),
18274
+ headSha: external_exports.string().trim().min(1),
18275
+ baseSha: external_exports.string().trim().min(1).optional(),
18276
+ baseRef: GithubSyncProductionBranchSchema,
18277
+ triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
18278
+ }),
18279
+ external_exports.object({
18280
+ kind: external_exports.literal("push"),
18281
+ bindingId: external_exports.string().trim().min(1),
18282
+ organizationId: OrganizationIdSchema,
18283
+ projectId: ProjectIdSchema,
18284
+ providerGrantId: ProviderGrantIdSchema,
18285
+ installationId: external_exports.string().trim().min(1),
18286
+ repoFullName: GithubSyncRepositoryFullNameSchema,
18287
+ repoId: external_exports.string().trim().min(1).optional(),
18288
+ productionBranch: GithubSyncProductionBranchSchema,
18289
+ autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
18290
+ ref: external_exports.string().trim().min(1),
18291
+ branch: GithubSyncProductionBranchSchema,
18292
+ before: external_exports.string().trim().min(1).optional(),
18293
+ after: external_exports.string().trim().min(1),
18294
+ triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
18295
+ }),
18296
+ // Synthetic re-apply triggered by a managed-template version bump (not a
18297
+ // webhook). The tenant's `.auto` is unchanged — only our registry changed —
18298
+ // so this arm skips the `no_auto_changes` early-out and applies the production
18299
+ // branch HEAD (`after`, which the sweep resolves before starting the run).
18300
+ // It is otherwise push-shaped. `templateName`/`version` identify the drift
18301
+ // that triggered it (for the commit check + idempotent workflow id).
18302
+ external_exports.object({
18303
+ kind: external_exports.literal("template_push"),
18304
+ bindingId: external_exports.string().trim().min(1),
18305
+ organizationId: OrganizationIdSchema,
18306
+ projectId: ProjectIdSchema,
18307
+ providerGrantId: ProviderGrantIdSchema,
18308
+ installationId: external_exports.string().trim().min(1),
18309
+ repoFullName: GithubSyncRepositoryFullNameSchema,
18310
+ repoId: external_exports.string().trim().min(1).optional(),
18311
+ productionBranch: GithubSyncProductionBranchSchema,
18312
+ autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
18313
+ before: external_exports.string().trim().min(1).optional(),
18314
+ after: external_exports.string().trim().min(1),
18315
+ templateName: external_exports.string().trim().min(1),
18316
+ version: external_exports.string().trim().min(1),
18317
+ triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
18318
+ }),
18319
+ // Synthetic authoritative re-apply triggered by one durable connection
18320
+ // lifecycle occurrence. The event id makes retries reuse the same workflow,
18321
+ // while a later remove/re-allow occurrence can re-run at the same git SHA.
18322
+ external_exports.object({
18323
+ kind: external_exports.literal("connection_push"),
18324
+ bindingId: external_exports.string().trim().min(1),
18325
+ organizationId: OrganizationIdSchema,
18326
+ projectId: ProjectIdSchema,
18327
+ providerGrantId: ProviderGrantIdSchema,
18328
+ installationId: external_exports.string().trim().min(1),
18329
+ repoFullName: GithubSyncRepositoryFullNameSchema,
18330
+ repoId: external_exports.string().trim().min(1).optional(),
18331
+ productionBranch: GithubSyncProductionBranchSchema,
18332
+ autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
18333
+ before: external_exports.string().trim().min(1).optional(),
18334
+ after: external_exports.string().trim().min(1),
18335
+ connectionEventId: external_exports.string().trim().min(1),
18336
+ triggerArtifact: GithubSyncTriggerArtifactSchema.optional()
18337
+ })
18338
+ ]);
18339
+ GithubSyncWorkflowResultSchema = external_exports.discriminatedUnion("status", [
18340
+ external_exports.object({
18341
+ status: external_exports.literal("skipped"),
18342
+ reason: external_exports.string().trim().min(1)
18343
+ }),
18344
+ external_exports.object({
18345
+ status: external_exports.literal("planned"),
18346
+ changed: external_exports.boolean(),
18347
+ checkRunId: external_exports.number().int().positive().optional()
18348
+ }),
18349
+ external_exports.object({
18350
+ status: external_exports.literal("applied"),
18351
+ changed: external_exports.boolean(),
18352
+ checkRunId: external_exports.number().int().positive().optional()
18353
+ }),
18354
+ external_exports.object({
18355
+ status: external_exports.literal("failed"),
18356
+ message: external_exports.string().trim().min(1),
18357
+ checkRunId: external_exports.number().int().positive().optional()
18358
+ })
18359
+ ]);
18360
+ }
18361
+ });
18362
+
18400
18363
  // ../../packages/schemas/src/trigger-router.ts
18401
18364
  function normalizeLegacyHeartbeatTickWorkflowInput(input) {
18402
18365
  if (!input || typeof input !== "object" || Array.isArray(input)) {
@@ -19078,7 +19041,7 @@ function isChatMessageEvent(trigger) {
19078
19041
  function hasFilterValue(trigger, path2, expected) {
19079
19042
  return trigger.where?.[path2] === expected;
19080
19043
  }
19081
- var RESOURCE_KIND_AGENT, AGENT_HARNESSES, AgentHarnessSchema, TriggerFilterScalarSchema, TriggerFilterPathSchema, TriggerFilterClauseSchema, TriggerFilterSchema, TriggerCheckTimeoutSchema, AgentArchiveAfterInactiveSchema, AgentSessionPolicySchema, AgentConcurrencySchema, AgentReplacePolicySchema, AgentManagesSchema, TriggerEventSchema, TriggerEventsSchema, PAYLOAD_PREFIXED_TEMPLATE_TOKEN, TriggerChecksField, TriggerEventSourceFields, TriggerSchema, ApplyTriggerSchema, HeartbeatTriggerSchema, ApplyHeartbeatTriggerSchema, TriggerDefinitionSchema, ApplyTriggerDefinitionSchema, TriggersSchema, ApplyTriggersSchema, AVATAR_ASSET_EXTENSIONS, MAX_AVATAR_ASSET_BYTES, MIN_AVATAR_ASSET_DIMENSION_PX, MAX_AVATAR_ASSET_DIMENSION_PX, PNG_SIGNATURE, AGENT_IDENTITY_DESCRIPTION_MAX_LENGTH, SHA256_HEX_PATTERN, AgentIdentitySchema, BINDING_LIFECYCLE_VALUES, BindingLifecycleSpecSchema, AgentBindingsSchema, AgentSpecFieldsSchema, AgentSpecSchema, AgentApplySpecSchema, AgentStatusSchema, AgentResourceSchema, AgentApplyRequestSchema, ApplyTriggerReceiptSchema, AgentApplyResponseSchema, AGENT_TELEGRAM_IDENTITY_STATUSES, AgentTelegramIdentityStatusSchema, AgentPresenceIdentitySchema, AgentPresenceResponseSchema, AgentPresenceConnectRequestSchema, AgentPresenceConnectPendingSchema, AgentPresenceConnectResponseSchema, AgentPresenceIconRequestSchema, AgentPresenceIconResponseSchema, AgentPresenceCompleteResponseSchema;
19044
+ var RESOURCE_KIND_AGENT, AGENT_HARNESSES, AgentHarnessSchema, TriggerFilterScalarSchema, TriggerFilterPathSchema, TriggerFilterClauseSchema, TriggerFilterSchema, TriggerCheckTimeoutSchema, AgentArchiveAfterInactiveSchema, AgentSessionPolicySchema, AgentConcurrencySchema, AgentReplacePolicySchema, AgentManagesSchema, TriggerEventSchema, TriggerEventsSchema, PAYLOAD_PREFIXED_TEMPLATE_TOKEN, TriggerChecksField, TriggerEventSourceFields, TriggerSchema, ApplyTriggerSchema, HeartbeatTriggerSchema, ApplyHeartbeatTriggerSchema, TriggerDefinitionSchema, ApplyTriggerDefinitionSchema, TriggersSchema, ApplyTriggersSchema, AVATAR_ASSET_EXTENSIONS, MAX_AVATAR_ASSET_BYTES, MIN_AVATAR_ASSET_DIMENSION_PX, MAX_AVATAR_ASSET_DIMENSION_PX, PNG_SIGNATURE, AGENT_IDENTITY_DESCRIPTION_MAX_LENGTH, SHA256_HEX_PATTERN, AgentIdentitySchema, BINDING_LIFECYCLE_VALUES, BindingLifecycleSpecSchema, AgentBindingsSchema, AgentSpecFieldsSchema, AgentSpecSchema, AgentApplySpecFieldsSchema, AgentApplySpecSchema, AgentStatusSchema, AgentResourceOriginSchema, BuiltInAgentMetadataSchema, AgentResourceSchema, AgentApplyRequestSchema, ApplyTriggerReceiptSchema, AgentApplyResponseSchema, AGENT_TELEGRAM_IDENTITY_STATUSES, AgentTelegramIdentityStatusSchema, AgentPresenceIdentitySchema, AgentPresenceResponseSchema, AgentPresenceConnectRequestSchema, AgentPresenceConnectPendingSchema, AgentPresenceConnectResponseSchema, AgentPresenceIconRequestSchema, AgentPresenceIconResponseSchema, AgentPresenceCompleteResponseSchema;
19082
19045
  var init_agents = __esm({
19083
19046
  "../../packages/schemas/src/agents.ts"() {
19084
19047
  "use strict";
@@ -19314,26 +19277,38 @@ var init_agents = __esm({
19314
19277
  validateAgentModelFieldsForHarness(spec, context);
19315
19278
  }
19316
19279
  );
19317
- AgentApplySpecSchema = AgentSpecFieldsSchema.extend({
19280
+ AgentApplySpecFieldsSchema = AgentSpecFieldsSchema.extend({
19318
19281
  initialPrompt: templateField("authoring"),
19319
19282
  displayTitle: displayTitleField("authoring"),
19320
19283
  triggers: ApplyTriggersSchema.default([])
19321
- }).superRefine((spec, context) => {
19322
- validateRunnableConfig(spec, context);
19323
- validateAgentModelFieldsForHarness(spec, context);
19324
- validateConcurrencyConfig(spec, context);
19325
- validateBindingsConfig(spec, context);
19326
- validateTriggerReleaseConfig(spec, context);
19327
- validateTriggerObservedTargetConfig(spec, context);
19328
19284
  });
19285
+ AgentApplySpecSchema = AgentApplySpecFieldsSchema.superRefine(
19286
+ (spec, context) => {
19287
+ validateRunnableConfig(spec, context);
19288
+ validateAgentModelFieldsForHarness(spec, context);
19289
+ validateConcurrencyConfig(spec, context);
19290
+ validateBindingsConfig(spec, context);
19291
+ validateTriggerReleaseConfig(spec, context);
19292
+ validateTriggerObservedTargetConfig(spec, context);
19293
+ }
19294
+ );
19329
19295
  AgentStatusSchema = external_exports.object({
19330
19296
  runCount: external_exports.number().int().nonnegative().default(0),
19331
19297
  lastActivityAt: external_exports.string().datetime().nullable().default(null)
19332
19298
  }).default({ runCount: 0, lastActivityAt: null });
19299
+ AgentResourceOriginSchema = external_exports.enum(["authored", "built_in"]);
19300
+ BuiltInAgentMetadataSchema = external_exports.object({
19301
+ templateVersion: external_exports.string().trim().min(1),
19302
+ harnessPinned: external_exports.boolean(),
19303
+ authoredOverlay: JsonValueSchema.nullable(),
19304
+ provenance: external_exports.record(external_exports.string().min(1), external_exports.enum(["built_in", "authored"]))
19305
+ });
19333
19306
  AgentResourceSchema = resourceEnvelopeSchema(
19334
19307
  AgentSpecSchema
19335
19308
  ).extend({
19336
- status: AgentStatusSchema
19309
+ status: AgentStatusSchema,
19310
+ origin: AgentResourceOriginSchema.optional(),
19311
+ builtIn: BuiltInAgentMetadataSchema.optional()
19337
19312
  });
19338
19313
  AgentApplyRequestSchema = resourceApplySchema(AgentApplySpecSchema);
19339
19314
  ApplyTriggerReceiptSchema = external_exports.object({
@@ -19447,6 +19422,166 @@ var init_agents = __esm({
19447
19422
  }
19448
19423
  });
19449
19424
 
19425
+ // ../../packages/schemas/src/default-agent.ts
19426
+ function builtInDefaultAgentSpec() {
19427
+ return AgentApplySpecSchema.parse({
19428
+ harness: BUILT_IN_DEFAULT_AGENT_RECOMMENDED_HARNESS,
19429
+ environment: BUILT_IN_DEFAULT_AGENT_ENVIRONMENT_NAME,
19430
+ identity: {
19431
+ displayName: "Default",
19432
+ username: BUILT_IN_DEFAULT_AGENT_NAME,
19433
+ description: "Auto's built-in general-purpose agent."
19434
+ },
19435
+ tools: {
19436
+ auto: {
19437
+ kind: "local",
19438
+ implementation: "auto"
19439
+ }
19440
+ }
19441
+ });
19442
+ }
19443
+ function resolveBuiltInDefaultAgentSpec(input) {
19444
+ const overlay = DefaultAgentOverlaySchema.parse(input);
19445
+ const { remove, ...authoredSpec } = overlay;
19446
+ const base = builtInDefaultAgentSpec();
19447
+ const merged = mergeValues2(base, authoredSpec);
19448
+ for (const name of remove?.env ?? []) {
19449
+ removeKeyedEntry(merged, "env", name);
19450
+ }
19451
+ for (const name of remove?.tools ?? []) {
19452
+ removeKeyedEntry(merged, "tools", name);
19453
+ }
19454
+ const harnessPinned = authoredSpec.harness !== void 0;
19455
+ if ((authoredSpec.triggers?.length ?? 0) > 0 && !harnessPinned) {
19456
+ throw new Error(
19457
+ "Default agent triggers require an authored harness because unattended sessions cannot choose one"
19458
+ );
19459
+ }
19460
+ const spec = AgentApplySpecSchema.parse(merged);
19461
+ const provenance = {};
19462
+ recordLeafProvenance(base, "", "built_in", provenance);
19463
+ recordLeafProvenance(authoredSpec, "", "authored", provenance);
19464
+ for (const name of remove?.env ?? []) {
19465
+ delete provenance[`env.${name}`];
19466
+ }
19467
+ for (const name of remove?.tools ?? []) {
19468
+ for (const key of Object.keys(provenance)) {
19469
+ if (key === `tools.${name}` || key.startsWith(`tools.${name}.`)) {
19470
+ delete provenance[key];
19471
+ }
19472
+ }
19473
+ }
19474
+ return { spec, harnessPinned, provenance };
19475
+ }
19476
+ function mergeValues2(base, overlay) {
19477
+ if (overlay === void 0) {
19478
+ return structuredClone(base);
19479
+ }
19480
+ if (isRecord(base) && isRecord(overlay)) {
19481
+ const merged = structuredClone(base);
19482
+ for (const [key, value] of Object.entries(overlay)) {
19483
+ merged[key] = mergeValues2(merged[key], value);
19484
+ }
19485
+ return merged;
19486
+ }
19487
+ return structuredClone(overlay);
19488
+ }
19489
+ function removeKeyedEntry(spec, field, name) {
19490
+ const entries = spec[field];
19491
+ if (isRecord(entries)) {
19492
+ delete entries[name];
19493
+ }
19494
+ }
19495
+ function recordLeafProvenance(value, path2, source, output) {
19496
+ if (isRecord(value)) {
19497
+ if (path2) {
19498
+ output[path2] = source;
19499
+ }
19500
+ const entries = Object.entries(value);
19501
+ if (entries.length === 0 && path2) {
19502
+ output[path2] = source;
19503
+ return;
19504
+ }
19505
+ for (const [key, nested] of entries) {
19506
+ recordLeafProvenance(
19507
+ nested,
19508
+ path2 ? `${path2}.${key}` : key,
19509
+ source,
19510
+ output
19511
+ );
19512
+ }
19513
+ return;
19514
+ }
19515
+ output[path2] = source;
19516
+ }
19517
+ function isRecord(value) {
19518
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
19519
+ }
19520
+ var BUILT_IN_DEFAULT_AGENT_NAME, BUILT_IN_DEFAULT_AGENT_ENVIRONMENT_NAME, BUILT_IN_DEFAULT_AGENT_RECOMMENDED_HARNESS, BUILT_IN_DEFAULT_AGENT_OVERLAY_ANNOTATION, DefaultAgentRemovalSchema, DefaultAgentOverlaySchema;
19521
+ var init_default_agent = __esm({
19522
+ "../../packages/schemas/src/default-agent.ts"() {
19523
+ "use strict";
19524
+ init_zod();
19525
+ init_agents();
19526
+ init_resources();
19527
+ BUILT_IN_DEFAULT_AGENT_NAME = "default";
19528
+ BUILT_IN_DEFAULT_AGENT_ENVIRONMENT_NAME = "auto-default-runtime";
19529
+ BUILT_IN_DEFAULT_AGENT_RECOMMENDED_HARNESS = "claude-code";
19530
+ BUILT_IN_DEFAULT_AGENT_OVERLAY_ANNOTATION = "auto.dev/default-agent-overlay";
19531
+ DefaultAgentRemovalSchema = external_exports.object({
19532
+ env: external_exports.array(ResourceNameSchema).optional(),
19533
+ tools: external_exports.array(ResourceNameSchema).optional(),
19534
+ triggers: external_exports.array(ResourceNameSchema).optional()
19535
+ }).strict();
19536
+ DefaultAgentOverlaySchema = AgentApplySpecFieldsSchema.partial().extend({
19537
+ env: AgentApplySpecFieldsSchema.shape.env.removeDefault().optional(),
19538
+ mounts: AgentApplySpecFieldsSchema.shape.mounts.removeDefault().optional(),
19539
+ triggers: AgentApplySpecFieldsSchema.shape.triggers.removeDefault().optional(),
19540
+ session: AgentApplySpecFieldsSchema.shape.session.removeDefault().optional(),
19541
+ bindings: AgentApplySpecFieldsSchema.shape.bindings.removeDefault().optional(),
19542
+ tools: AgentApplySpecFieldsSchema.shape.tools.removeDefault().optional(),
19543
+ remove: DefaultAgentRemovalSchema.optional()
19544
+ }).strict();
19545
+ }
19546
+ });
19547
+
19548
+ // ../../packages/schemas/src/dormant-capabilities.ts
19549
+ var DormantCapabilityConnectionSchema, DormantCapabilitySchema, DormantCapabilitiesSchema;
19550
+ var init_dormant_capabilities = __esm({
19551
+ "../../packages/schemas/src/dormant-capabilities.ts"() {
19552
+ "use strict";
19553
+ init_zod();
19554
+ DormantCapabilityConnectionSchema = external_exports.object({
19555
+ provider: external_exports.string().trim().min(1),
19556
+ connection: external_exports.string().trim().min(1)
19557
+ });
19558
+ DormantCapabilitySchema = external_exports.object({
19559
+ kind: external_exports.enum(["tool", "trigger"]),
19560
+ name: external_exports.string().trim().min(1),
19561
+ connections: external_exports.array(DormantCapabilityConnectionSchema).min(1)
19562
+ });
19563
+ DormantCapabilitiesSchema = external_exports.array(DormantCapabilitySchema);
19564
+ }
19565
+ });
19566
+
19567
+ // ../../packages/schemas/src/github-credentials.ts
19568
+ var CreateRunGithubCredentialRequestSchema, RunGithubCredentialResponseSchema;
19569
+ var init_github_credentials = __esm({
19570
+ "../../packages/schemas/src/github-credentials.ts"() {
19571
+ "use strict";
19572
+ init_zod();
19573
+ CreateRunGithubCredentialRequestSchema = external_exports.object({
19574
+ host: external_exports.literal("github.com"),
19575
+ path: external_exports.string().trim().min(1).optional()
19576
+ });
19577
+ RunGithubCredentialResponseSchema = external_exports.object({
19578
+ username: external_exports.literal("x-access-token"),
19579
+ password: external_exports.string().min(1),
19580
+ expiresAt: external_exports.string().datetime()
19581
+ });
19582
+ }
19583
+ });
19584
+
19450
19585
  // ../../packages/schemas/src/identities.ts
19451
19586
  var RESOURCE_KIND_IDENTITY, IdentitySpecSchema, IdentityResourceSchema, IdentityApplyRequestSchema;
19452
19587
  var init_identities = __esm({
@@ -41526,6 +41661,7 @@ var init_src = __esm({
41526
41661
  init_conversation();
41527
41662
  init_conversation_reducer();
41528
41663
  init_connections();
41664
+ init_default_agent();
41529
41665
  init_dormant_capabilities();
41530
41666
  init_github_sync();
41531
41667
  init_github_credentials();
@@ -44329,7 +44465,7 @@ var init_package = __esm({
44329
44465
  "package.json"() {
44330
44466
  package_default = {
44331
44467
  name: "@autohq/cli",
44332
- version: "0.1.431",
44468
+ version: "0.1.432",
44333
44469
  license: "SEE LICENSE IN README.md",
44334
44470
  publishConfig: {
44335
44471
  access: "public"
@@ -44534,7 +44670,7 @@ function compileAgentDocument(document, path2, stack, context) {
44534
44670
  `Agent import cycle detected: ${[...stack, resolvedPath].join(" -> ")}`
44535
44671
  );
44536
44672
  }
44537
- if (!isRecord(document)) {
44673
+ if (!isRecord2(document)) {
44538
44674
  throw new Error(`Invalid agent authoring file ${path2}: expected object`);
44539
44675
  }
44540
44676
  const imports = importPaths(document).map(
@@ -44544,7 +44680,7 @@ function compileAgentDocument(document, path2, stack, context) {
44544
44680
  let merged = {};
44545
44681
  for (const imported of imports) {
44546
44682
  const importedDocument = readSingleDocument(imported);
44547
- merged = mergeValues2(
44683
+ merged = mergeValues3(
44548
44684
  merged,
44549
44685
  compileAgentDocument(
44550
44686
  importedDocument,
@@ -44560,7 +44696,7 @@ function compileAgentDocument(document, path2, stack, context) {
44560
44696
  merged = applyRemoval(merged, removal);
44561
44697
  context.removals.push(removal);
44562
44698
  }
44563
- return mergeValues2(
44699
+ return mergeValues3(
44564
44700
  merged,
44565
44701
  authoringDocumentApplyShape(document, resolvedPath),
44566
44702
  []
@@ -44659,25 +44795,25 @@ function authoringDocumentApplyShape(document, path2) {
44659
44795
  };
44660
44796
  }
44661
44797
  function finalizeAgentApplyShape(document, path2) {
44662
- if (!isRecord(document) || !isRecord(document.spec)) {
44798
+ if (!isRecord2(document) || !isRecord2(document.spec)) {
44663
44799
  return { resource: document, resources: [] };
44664
44800
  }
44665
44801
  const next = structuredClone(document);
44666
44802
  const spec = next.spec;
44667
44803
  const resources = [];
44668
- if (isRecord(spec.environment)) {
44804
+ if (isRecord2(spec.environment)) {
44669
44805
  const environment = inlineEnvironmentResource(spec.environment, path2);
44670
44806
  spec.environment = environment.metadata.name;
44671
44807
  resources.push(environment);
44672
44808
  }
44673
- if (isRecord(spec.identity)) {
44809
+ if (isRecord2(spec.identity)) {
44674
44810
  const identity2 = inlineIdentityResource(spec.identity, next, path2);
44675
44811
  spec.identity = identity2.metadata.name;
44676
44812
  resources.push(identity2);
44677
44813
  }
44678
44814
  if (Array.isArray(spec.triggers)) {
44679
44815
  spec.triggers = spec.triggers.map((trigger) => {
44680
- if (!isRecord(trigger) || !("name" in trigger)) {
44816
+ if (!isRecord2(trigger) || !("name" in trigger)) {
44681
44817
  return trigger;
44682
44818
  }
44683
44819
  const compiledTrigger = { ...trigger };
@@ -44725,7 +44861,7 @@ function inlineIdentityResource(document, agentDocument, path2) {
44725
44861
  }
44726
44862
  spec[key] = value;
44727
44863
  }
44728
- if (metadata.name === void 0 && isRecord(agentDocument.metadata) && typeof agentDocument.metadata.name === "string") {
44864
+ if (metadata.name === void 0 && isRecord2(agentDocument.metadata) && typeof agentDocument.metadata.name === "string") {
44729
44865
  metadata.name = agentDocument.metadata.name;
44730
44866
  }
44731
44867
  const parsed = IdentityApplyRequestSchema.safeParse({ metadata, spec });
@@ -44761,7 +44897,7 @@ function resolveFileBackedFields(spec, path2) {
44761
44897
  };
44762
44898
  }
44763
44899
  function resolveFileBackedString(value, input) {
44764
- if (!isRecord(value) || !("file" in value)) {
44900
+ if (!isRecord2(value) || !("file" in value)) {
44765
44901
  return value;
44766
44902
  }
44767
44903
  const file2 = value.file;
@@ -44779,8 +44915,8 @@ function resolveFileBackedString(value, input) {
44779
44915
  return readFileSync6(resolve(dirname7(input.path), filePath), "utf8");
44780
44916
  }
44781
44917
  function removalDirectives(document, path2) {
44782
- const raw = isRecord(document.remove) ? document.remove : {};
44783
- if (!isRecord(raw)) {
44918
+ const raw = isRecord2(document.remove) ? document.remove : {};
44919
+ if (!isRecord2(raw)) {
44784
44920
  return [];
44785
44921
  }
44786
44922
  const directives = [];
@@ -44802,18 +44938,18 @@ function stringList(value, label) {
44802
44938
  });
44803
44939
  }
44804
44940
  function applyRemoval(value, removal) {
44805
- if (!isRecord(value)) {
44941
+ if (!isRecord2(value)) {
44806
44942
  return value;
44807
44943
  }
44808
44944
  const next = structuredClone(value);
44809
- if (!isRecord(next.spec)) {
44945
+ if (!isRecord2(next.spec)) {
44810
44946
  return next;
44811
44947
  }
44812
44948
  const spec = { ...next.spec };
44813
44949
  next.spec = spec;
44814
44950
  switch (removal.target) {
44815
44951
  case "tools": {
44816
- if (!isRecord(spec[removal.target])) {
44952
+ if (!isRecord2(spec[removal.target])) {
44817
44953
  return next;
44818
44954
  }
44819
44955
  const collection = {
@@ -44850,17 +44986,17 @@ function assertSupportedRemovalTarget(target) {
44850
44986
  );
44851
44987
  }
44852
44988
  }
44853
- function mergeValues2(base, override, path2) {
44989
+ function mergeValues3(base, override, path2) {
44854
44990
  if (override === void 0) {
44855
44991
  return base;
44856
44992
  }
44857
44993
  if (Array.isArray(base) && Array.isArray(override)) {
44858
44994
  return mergeArrays(base, override, path2);
44859
44995
  }
44860
- if (isRecord(base) && isRecord(override)) {
44996
+ if (isRecord2(base) && isRecord2(override)) {
44861
44997
  const merged = { ...base };
44862
44998
  for (const [key, value] of Object.entries(override)) {
44863
- merged[key] = mergeValues2(merged[key], value, [...path2, key]);
44999
+ merged[key] = mergeValues3(merged[key], value, [...path2, key]);
44864
45000
  }
44865
45001
  return merged;
44866
45002
  }
@@ -44882,7 +45018,7 @@ function mergeArrays(base, override, path2) {
44882
45018
  for (const item of override) {
44883
45019
  const key = collectionItemKey(path2.at(-1) ?? "", item);
44884
45020
  if (key && indexByKey.has(key)) {
44885
- merged[indexByKey.get(key) ?? 0] = mergeValues2(
45021
+ merged[indexByKey.get(key) ?? 0] = mergeValues3(
44886
45022
  merged[indexByKey.get(key) ?? 0],
44887
45023
  item,
44888
45024
  path2
@@ -44900,7 +45036,7 @@ function isNamedArrayMergePath(path2) {
44900
45036
  return path2 === "spec.mounts" || path2 === "spec.triggers";
44901
45037
  }
44902
45038
  function collectionItemKey(collection, item) {
44903
- if (!isRecord(item)) {
45039
+ if (!isRecord2(item)) {
44904
45040
  return void 0;
44905
45041
  }
44906
45042
  if (typeof item.name === "string") {
@@ -44932,7 +45068,7 @@ function isAgentFile(path2) {
44932
45068
  return false;
44933
45069
  }
44934
45070
  }
44935
- function isRecord(value) {
45071
+ function isRecord2(value) {
44936
45072
  return typeof value === "object" && value !== null && !Array.isArray(value);
44937
45073
  }
44938
45074
  var AGENT_FILE_EXTENSIONS, AGENT_SPEC_FIELDS, AGENT_METADATA_FIELDS;
@@ -45334,7 +45470,7 @@ function sourceFileIndex(files) {
45334
45470
  function isAbsoluteSourcePath(path2) {
45335
45471
  return path2.startsWith("/");
45336
45472
  }
45337
- function isRecord2(value) {
45473
+ function isRecord3(value) {
45338
45474
  return typeof value === "object" && value !== null && !Array.isArray(value);
45339
45475
  }
45340
45476
  var APPLY_DIRECTORIES, PROJECT_APPLY_RESOURCE_DIRECTORIES;
@@ -45412,7 +45548,7 @@ function resolveTemplateImportPath(importPath, fileIndex) {
45412
45548
  return key;
45413
45549
  }
45414
45550
  function removalDirectives2(document, path2) {
45415
- const raw = isRecord2(document.remove) ? document.remove : {};
45551
+ const raw = isRecord3(document.remove) ? document.remove : {};
45416
45552
  const directives = [];
45417
45553
  for (const [target, value] of Object.entries(raw)) {
45418
45554
  const names = stringList2(value, `remove.${target}`);
@@ -45553,14 +45689,14 @@ function cloneAgentDraft(draft) {
45553
45689
  function isMetadataFieldKey(key) {
45554
45690
  return AGENT_METADATA_FIELD_KEYS.includes(key);
45555
45691
  }
45556
- function mergeValues3(base, override) {
45692
+ function mergeValues4(base, override) {
45557
45693
  if (override === void 0) {
45558
45694
  return base;
45559
45695
  }
45560
- if (isRecord2(base) && isRecord2(override)) {
45696
+ if (isRecord3(base) && isRecord3(override)) {
45561
45697
  const merged = { ...base };
45562
45698
  for (const [key, value] of Object.entries(override)) {
45563
- merged[key] = mergeValues3(merged[key], value);
45699
+ merged[key] = mergeValues4(merged[key], value);
45564
45700
  }
45565
45701
  return merged;
45566
45702
  }
@@ -45577,7 +45713,7 @@ function sortJson(value) {
45577
45713
  if (Array.isArray(value)) {
45578
45714
  return value.map(sortJson);
45579
45715
  }
45580
- if (isRecord2(value)) {
45716
+ if (isRecord3(value)) {
45581
45717
  return Object.fromEntries(
45582
45718
  Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, nested]) => [key, sortJson(nested)])
45583
45719
  );
@@ -45613,7 +45749,7 @@ function fileBackedStringField() {
45613
45749
  };
45614
45750
  }
45615
45751
  function rejectDirectiveObject(value, input) {
45616
- if (isRecord2(value) && "append" in value) {
45752
+ if (isRecord3(value) && "append" in value) {
45617
45753
  throw new Error(
45618
45754
  `Invalid agent authoring file ${input.path}: ${input.field} does not support directive objects; append is supported on ${APPEND_CAPABLE_FIELDS}`
45619
45755
  );
@@ -45621,7 +45757,7 @@ function rejectDirectiveObject(value, input) {
45621
45757
  return value;
45622
45758
  }
45623
45759
  function resolveFileBackedString2(value, input) {
45624
- if (!isRecord2(value)) {
45760
+ if (!isRecord3(value)) {
45625
45761
  return value;
45626
45762
  }
45627
45763
  if ("file" in value && !("append" in value)) {
@@ -45687,7 +45823,7 @@ function resolveAppendDirective(base, override) {
45687
45823
  `Invalid agent authoring file ${droppedPending.path}: ${droppedPending.field} append directive was merged before any base value; import the base document before its append overlay`
45688
45824
  );
45689
45825
  }
45690
- return mergeValues3(base, override);
45826
+ return mergeValues4(base, override);
45691
45827
  }
45692
45828
  if (typeof base === "string") {
45693
45829
  return base + directive.text;
@@ -45719,11 +45855,11 @@ function rejectUnresolvedAppendDirective(value) {
45719
45855
  );
45720
45856
  }
45721
45857
  function appendDirectiveFromMarker(value) {
45722
- if (!isRecord2(value)) {
45858
+ if (!isRecord3(value)) {
45723
45859
  return void 0;
45724
45860
  }
45725
45861
  const marker = value[APPEND_DIRECTIVE_MARKER_KEY];
45726
- if (!isRecord2(marker)) {
45862
+ if (!isRecord3(marker)) {
45727
45863
  return void 0;
45728
45864
  }
45729
45865
  return marker;
@@ -45743,9 +45879,9 @@ var init_file_backed_string = __esm({
45743
45879
  function inlineEnvironmentField() {
45744
45880
  return {
45745
45881
  target: "spec",
45746
- merge: (base, override) => mergeValues3(base, override),
45882
+ merge: (base, override) => mergeValues4(base, override),
45747
45883
  compile: (value, context) => {
45748
- if (!isRecord2(value)) {
45884
+ if (!isRecord3(value)) {
45749
45885
  return { resources: [], value };
45750
45886
  }
45751
45887
  const resource = inlineEnvironmentResource2(value, context.path);
@@ -45756,9 +45892,9 @@ function inlineEnvironmentField() {
45756
45892
  function inlineIdentityField() {
45757
45893
  return {
45758
45894
  target: "spec",
45759
- merge: (base, override) => mergeValues3(base, override),
45895
+ merge: (base, override) => mergeValues4(base, override),
45760
45896
  compile: (value, context) => {
45761
- if (!isRecord2(value)) {
45897
+ if (!isRecord3(value)) {
45762
45898
  return { resources: [], value };
45763
45899
  }
45764
45900
  const resource = inlineIdentityResource2(
@@ -45771,7 +45907,7 @@ function inlineIdentityField() {
45771
45907
  };
45772
45908
  }
45773
45909
  function assertAgentAuthoringDocument(document, path2) {
45774
- if (!isRecord2(document) || !("kind" in document)) {
45910
+ if (!isRecord3(document) || !("kind" in document)) {
45775
45911
  return;
45776
45912
  }
45777
45913
  if (document.kind === "session") {
@@ -45797,7 +45933,10 @@ function assertAgentAuthoringDocument(document, path2) {
45797
45933
  );
45798
45934
  }
45799
45935
  }
45800
- function parseAgentResource(draft, path2) {
45936
+ function parseAgentResource(draft, path2, removals = []) {
45937
+ if (draft.metadata.name === BUILT_IN_DEFAULT_AGENT_NAME) {
45938
+ return parseBuiltInDefaultAgentResource(draft, path2, removals);
45939
+ }
45801
45940
  const parsed = AgentApplyRequestSchema.safeParse({
45802
45941
  metadata: draft.metadata,
45803
45942
  spec: draft.spec
@@ -45811,6 +45950,44 @@ function parseAgentResource(draft, path2) {
45811
45950
  spec: parsed.data.spec
45812
45951
  };
45813
45952
  }
45953
+ function parseBuiltInDefaultAgentResource(draft, path2, removals) {
45954
+ const remove = Object.fromEntries(
45955
+ removals.map(({ target, names }) => [target, names])
45956
+ );
45957
+ const overlay = DefaultAgentOverlaySchema.safeParse({
45958
+ ...draft.spec,
45959
+ ...Object.keys(remove).length > 0 ? { remove } : {}
45960
+ });
45961
+ if (!overlay.success) {
45962
+ throw new Error(
45963
+ `Invalid built-in Default agent overlay ${path2}: ${overlay.error.message}`
45964
+ );
45965
+ }
45966
+ const resolved = resolveBuiltInDefaultAgentSpec(overlay.data);
45967
+ const annotations = isRecord3(draft.metadata.annotations) ? draft.metadata.annotations : {};
45968
+ const parsed = AgentApplyRequestSchema.safeParse({
45969
+ metadata: {
45970
+ ...draft.metadata,
45971
+ annotations: {
45972
+ ...annotations,
45973
+ [BUILT_IN_DEFAULT_AGENT_OVERLAY_ANNOTATION]: JSON.stringify(
45974
+ overlay.data
45975
+ )
45976
+ }
45977
+ },
45978
+ spec: resolved.spec
45979
+ });
45980
+ if (!parsed.success) {
45981
+ throw new Error(
45982
+ `Invalid compiled built-in Default agent ${path2}: ${parsed.error.message}`
45983
+ );
45984
+ }
45985
+ return {
45986
+ kind: RESOURCE_KIND_AGENT,
45987
+ metadata: parsed.data.metadata,
45988
+ spec: parsed.data.spec
45989
+ };
45990
+ }
45814
45991
  function inlineEnvironmentResource2(document, path2) {
45815
45992
  const parsed = EnvironmentApplyRequestSchema.safeParse(
45816
45993
  splitMetadataAndSpec(document)
@@ -45872,6 +46049,7 @@ var init_inline_resource = __esm({
45872
46049
  "../../packages/schemas/src/project-apply-files/agent-fields/inline-resource.ts"() {
45873
46050
  "use strict";
45874
46051
  init_agents();
46052
+ init_default_agent();
45875
46053
  init_environments();
45876
46054
  init_identities();
45877
46055
  init_source();
@@ -45884,12 +46062,12 @@ function compileRoutingInlineBindings(input) {
45884
46062
  const bindings = input.bindings ? cloneBindings(input.bindings) : {};
45885
46063
  const compiledTriggers = [];
45886
46064
  for (const trigger of input.triggers) {
45887
- if (!isRecord2(trigger) || trigger.kind === "heartbeat") {
46065
+ if (!isRecord3(trigger) || trigger.kind === "heartbeat") {
45888
46066
  compiledTriggers.push(trigger);
45889
46067
  continue;
45890
46068
  }
45891
46069
  const routing = trigger.routing;
45892
- if (!isRecord2(routing)) {
46070
+ if (!isRecord3(routing)) {
45893
46071
  compiledTriggers.push(trigger);
45894
46072
  continue;
45895
46073
  }
@@ -45920,7 +46098,7 @@ function extractDeliverContribution(routing, path2) {
45920
46098
  if (bindBlock === void 0) {
45921
46099
  return void 0;
45922
46100
  }
45923
- if (!isRecord2(bindBlock)) {
46101
+ if (!isRecord3(bindBlock)) {
45924
46102
  throw inlineShapeError(
45925
46103
  path2,
45926
46104
  "deliver",
@@ -45950,7 +46128,7 @@ function extractBindArmContribution(routing, path2) {
45950
46128
  }
45951
46129
  function extractSpawnArmContribution(routing, path2) {
45952
46130
  const bindBlock = routing.bind;
45953
- if (!isRecord2(bindBlock)) {
46131
+ if (!isRecord3(bindBlock)) {
45954
46132
  return void 0;
45955
46133
  }
45956
46134
  if (bindBlock.lifecycle === void 0 && bindBlock.continuity === void 0) {
@@ -45988,7 +46166,7 @@ function mergeContributionIntoBindings(bindings, contribution, path2) {
45988
46166
  }
45989
46167
  function ensureEntry(bindings, target) {
45990
46168
  const existing = bindings[target];
45991
- if (isRecord2(existing)) {
46169
+ if (isRecord3(existing)) {
45992
46170
  return existing;
45993
46171
  }
45994
46172
  const entry = {};
@@ -46010,7 +46188,7 @@ function stripInlineRoutingFields(trigger, routing) {
46010
46188
  return { ...trigger, routing: rest };
46011
46189
  }
46012
46190
  case "spawn": {
46013
- if (!isRecord2(routing.bind)) {
46191
+ if (!isRecord3(routing.bind)) {
46014
46192
  return trigger;
46015
46193
  }
46016
46194
  const {
@@ -46075,7 +46253,7 @@ function rejectSingletonTarget(target, path2, arm) {
46075
46253
  function cloneBindings(bindings) {
46076
46254
  const clone2 = {};
46077
46255
  for (const [key, value] of Object.entries(bindings)) {
46078
- clone2[key] = isRecord2(value) ? { ...value } : value;
46256
+ clone2[key] = isRecord3(value) ? { ...value } : value;
46079
46257
  }
46080
46258
  return clone2;
46081
46259
  }
@@ -46105,7 +46283,7 @@ function namedArrayField(options) {
46105
46283
  target: "spec",
46106
46284
  merge: (base, override) => {
46107
46285
  if (!Array.isArray(base) || !Array.isArray(override)) {
46108
- return mergeValues3(base, override);
46286
+ return mergeValues4(base, override);
46109
46287
  }
46110
46288
  return mergeNamedArray(base, override, options.itemKey);
46111
46289
  },
@@ -46125,7 +46303,7 @@ function triggersField() {
46125
46303
  const withNamesStripped = removeAuthoringTriggerNames(value);
46126
46304
  const { triggers, bindings } = compileRoutingInlineBindings({
46127
46305
  triggers: withNamesStripped,
46128
- bindings: isRecord2(context.draft.spec.bindings) ? context.draft.spec.bindings : void 0,
46306
+ bindings: isRecord3(context.draft.spec.bindings) ? context.draft.spec.bindings : void 0,
46129
46307
  path: context.path
46130
46308
  });
46131
46309
  context.draft.spec.bindings = bindings;
@@ -46134,7 +46312,7 @@ function triggersField() {
46134
46312
  };
46135
46313
  }
46136
46314
  function mountItemKey(item) {
46137
- if (!isRecord2(item)) {
46315
+ if (!isRecord3(item)) {
46138
46316
  return void 0;
46139
46317
  }
46140
46318
  if (typeof item.name === "string") {
@@ -46146,7 +46324,7 @@ function mountItemKey(item) {
46146
46324
  return void 0;
46147
46325
  }
46148
46326
  function triggerItemKey(item) {
46149
- if (!isRecord2(item)) {
46327
+ if (!isRecord3(item)) {
46150
46328
  return void 0;
46151
46329
  }
46152
46330
  if (typeof item.name === "string") {
@@ -46175,7 +46353,7 @@ function mergeNamedArray(base, override, itemKey) {
46175
46353
  for (const item of override) {
46176
46354
  const key = itemKey(item);
46177
46355
  if (key && indexByKey.has(key)) {
46178
- merged[indexByKey.get(key) ?? 0] = mergeValues3(
46356
+ merged[indexByKey.get(key) ?? 0] = mergeValues4(
46179
46357
  merged[indexByKey.get(key) ?? 0],
46180
46358
  item
46181
46359
  );
@@ -46199,7 +46377,7 @@ function removeAuthoringTriggerNames(value) {
46199
46377
  return value;
46200
46378
  }
46201
46379
  return value.map((trigger) => {
46202
- if (!isRecord2(trigger) || !("name" in trigger)) {
46380
+ if (!isRecord3(trigger) || !("name" in trigger)) {
46203
46381
  return trigger;
46204
46382
  }
46205
46383
  const next = { ...trigger };
@@ -46220,9 +46398,9 @@ var init_named_array = __esm({
46220
46398
  function namedMapField() {
46221
46399
  return {
46222
46400
  target: "spec",
46223
- merge: (base, override) => mergeValues3(base, override),
46401
+ merge: (base, override) => mergeValues4(base, override),
46224
46402
  remove: (value, names) => {
46225
- if (!isRecord2(value)) {
46403
+ if (!isRecord3(value)) {
46226
46404
  return value;
46227
46405
  }
46228
46406
  const next = { ...value };
@@ -46321,7 +46499,7 @@ function mergeSourceLocations(base, override) {
46321
46499
  continue;
46322
46500
  }
46323
46501
  const prefix = `${target}.${key}`;
46324
- if (!isRecord2(value)) {
46502
+ if (!isRecord3(value)) {
46325
46503
  merged = Object.fromEntries(
46326
46504
  Object.entries(merged).filter(
46327
46505
  ([path2]) => path2 !== prefix && !path2.startsWith(`${prefix}.`)
@@ -46340,7 +46518,7 @@ function assertSupportedAgentRemovalTarget(target) {
46340
46518
  );
46341
46519
  }
46342
46520
  }
46343
- function compileAgentDraftResources(draft, path2) {
46521
+ function compileAgentDraftResources(draft, path2, removals = []) {
46344
46522
  const next = cloneAgentDraft(draft);
46345
46523
  const resources = [];
46346
46524
  for (const [key, field] of Object.entries(AGENT_FIELDS)) {
@@ -46358,7 +46536,7 @@ function compileAgentDraftResources(draft, path2) {
46358
46536
  next.spec[key] = compiled.value;
46359
46537
  }
46360
46538
  }
46361
- const resource = parseAgentResource(next, path2);
46539
+ const resource = parseAgentResource(next, path2, removals);
46362
46540
  return { resource, resources: [...resources, resource] };
46363
46541
  }
46364
46542
  function sanitizedAgentDocument2(document) {
@@ -46381,7 +46559,7 @@ function mergeDraftTarget(target, base, override) {
46381
46559
  for (const [key, value] of Object.entries(override)) {
46382
46560
  const field = AGENT_FIELDS[key];
46383
46561
  const merge2 = field?.target === target ? field.merge : void 0;
46384
- merged[key] = merge2 ? merge2(merged[key], value, { field: key }) : mergeValues3(merged[key], value);
46562
+ merged[key] = merge2 ? merge2(merged[key], value, { field: key }) : mergeValues4(merged[key], value);
46385
46563
  }
46386
46564
  return merged;
46387
46565
  }
@@ -46447,7 +46625,7 @@ function readVariableScope(document, path2) {
46447
46625
  if (declared === void 0) {
46448
46626
  return /* @__PURE__ */ new Map();
46449
46627
  }
46450
- if (!isRecord2(declared)) {
46628
+ if (!isRecord3(declared)) {
46451
46629
  throw new Error(
46452
46630
  `Invalid variables in ${path2}: variables must be a map of name to value`
46453
46631
  );
@@ -46476,7 +46654,7 @@ function substituteValue(value, scope, site) {
46476
46654
  if (Array.isArray(value)) {
46477
46655
  return value.map((item) => substituteValue(item, scope, site));
46478
46656
  }
46479
- if (isRecord2(value)) {
46657
+ if (isRecord3(value)) {
46480
46658
  return Object.fromEntries(
46481
46659
  Object.entries(value).map(([key, nested]) => [
46482
46660
  key,
@@ -46594,7 +46772,7 @@ function projectCompiledTriggerSourceLocations(locations, authoredTriggers) {
46594
46772
  );
46595
46773
  let compiledIndex = 0;
46596
46774
  for (const [authoredIndex, trigger] of authoredTriggers.entries()) {
46597
- if (!isRecord2(trigger)) {
46775
+ if (!isRecord3(trigger)) {
46598
46776
  continue;
46599
46777
  }
46600
46778
  const events = authoredTriggerEvents(trigger);
@@ -46662,7 +46840,7 @@ function validateAgentFragmentDocument(document, path2, context) {
46662
46840
  `Agent import cycle detected: ${[...context.stack, normalizedPath].join(" -> ")}`
46663
46841
  );
46664
46842
  }
46665
- if (!isRecord2(document)) {
46843
+ if (!isRecord3(document)) {
46666
46844
  throw new Error(`Invalid agent fragment file ${path2}: expected object`);
46667
46845
  }
46668
46846
  for (const imported of importPaths2(document).map(
@@ -46719,8 +46897,9 @@ function compileAgentDocumentValue(document, path2, fileIndex, contextVariables)
46719
46897
  ...contextVariables && Object.keys(contextVariables).length > 0 ? { contextVariables: new Map(Object.entries(contextVariables)) } : {}
46720
46898
  });
46721
46899
  const authoredTriggers = structuredClone(draft.spec.triggers);
46900
+ const removals = isRecord3(document) ? removalDirectives2(document, normalizeSourcePath(path2)) : [];
46722
46901
  return {
46723
- ...compileAgentDraftResources(draft, path2),
46902
+ ...compileAgentDraftResources(draft, path2, removals),
46724
46903
  sourceLocations: draft.sourceLocations,
46725
46904
  authoredTriggers
46726
46905
  };
@@ -46732,7 +46911,7 @@ function compileAgentDocument2(document, path2, context) {
46732
46911
  `Agent import cycle detected: ${[...context.stack, normalizedPath].join(" -> ")}`
46733
46912
  );
46734
46913
  }
46735
- if (!isRecord2(document)) {
46914
+ if (!isRecord3(document)) {
46736
46915
  throw new Error(`Invalid agent authoring file ${path2}: expected object`);
46737
46916
  }
46738
46917
  const variables = context.stack.length === 0 ? new Map([
@@ -47007,7 +47186,7 @@ function templateImportsInFile(file2) {
47007
47186
  try {
47008
47187
  const specifiers = [];
47009
47188
  for (const document of readDocumentsFromSource(file2)) {
47010
- if (!isRecord2(document)) {
47189
+ if (!isRecord3(document)) {
47011
47190
  continue;
47012
47191
  }
47013
47192
  for (const importPath of importPaths2(document)) {
@@ -65958,7 +66137,7 @@ async function selectRepository(context, github, explicitRepo) {
65958
66137
  const selection = github.grant.providerResourceSelection;
65959
66138
  if (selection.kind === "selected") {
65960
66139
  const repos = selection.resources.map(
65961
- (resource) => isRecord3(resource) && typeof resource.fullName === "string" ? resource.fullName : void 0
66140
+ (resource) => isRecord4(resource) && typeof resource.fullName === "string" ? resource.fullName : void 0
65962
66141
  ).filter(isDefined);
65963
66142
  if (repos.length === 1) {
65964
66143
  context.writeOutput(`Using GitHub repository ${repos[0]}.`);
@@ -66288,7 +66467,7 @@ function slackWorkspaceUrl(slack) {
66288
66467
  function organizationLabel(organization) {
66289
66468
  return `${organization.organizationName} (${organization.organizationSlug})`;
66290
66469
  }
66291
- function isRecord3(value) {
66470
+ function isRecord4(value) {
66292
66471
  return typeof value === "object" && value !== null && !Array.isArray(value);
66293
66472
  }
66294
66473
  function isDefined(value) {