@get-bb/plugin-sdk 0.4.12 → 0.4.14

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.
@@ -3314,75 +3314,11 @@ var threadEventTypeSchema = z18.string().refine(
3314
3314
  "Invalid thread event type"
3315
3315
  );
3316
3316
 
3317
- // ../domain/src/claude-task-tools.ts
3318
- import { z as z19 } from "zod";
3319
- var claudeTaskToolNameValues = [
3320
- "TaskCreate",
3321
- "TaskGet",
3322
- "TaskList",
3323
- "TaskUpdate"
3324
- ];
3325
- var claudeTaskToolNameSchema = z19.enum(claudeTaskToolNameValues);
3326
- var claudeTaskStatusValues = ["pending", "in_progress", "completed"];
3327
- var claudeTaskStatusSchema = z19.enum(claudeTaskStatusValues);
3328
- var claudeTaskUpdateStatusValues = [
3329
- ...claudeTaskStatusValues,
3330
- "deleted"
3331
- ];
3332
- var claudeTaskUpdateStatusSchema = z19.enum(claudeTaskUpdateStatusValues);
3333
- var claudeTaskListStatusValues = [
3334
- ...claudeTaskStatusValues,
3335
- "deleted"
3336
- ];
3337
- var claudeTaskListStatusSchema = z19.enum(claudeTaskListStatusValues);
3338
- var claudeTaskCreateArgsSchema = z19.object({
3339
- activeForm: z19.string().optional(),
3340
- subject: z19.string()
3341
- }).passthrough();
3342
- var claudeTaskGetArgsSchema = z19.object({
3343
- taskId: z19.string()
3344
- }).passthrough();
3345
- var claudeTaskUpdateArgsSchema = z19.object({
3346
- activeForm: z19.string().optional(),
3347
- status: claudeTaskUpdateStatusSchema.optional(),
3348
- subject: z19.string().optional(),
3349
- taskId: z19.string()
3350
- }).passthrough();
3351
- var claudeTaskCreateOutputSchema = z19.object({
3352
- task: z19.object({
3353
- id: z19.string(),
3354
- subject: z19.string()
3355
- }).passthrough()
3356
- }).passthrough();
3357
- var claudeTaskGetOutputTaskSchema = z19.object({
3358
- id: z19.string(),
3359
- status: claudeTaskStatusSchema,
3360
- subject: z19.string()
3361
- }).passthrough();
3362
- var claudeTaskGetOutputSchema = z19.object({
3363
- task: claudeTaskGetOutputTaskSchema.nullable()
3364
- }).passthrough();
3365
- var claudeTaskUpdateOutputSchema = z19.object({
3366
- success: z19.boolean(),
3367
- taskId: z19.string()
3368
- }).passthrough();
3369
- var claudeTaskListItemSchema = z19.object({
3370
- id: z19.string(),
3371
- status: claudeTaskListStatusSchema,
3372
- subject: z19.string()
3373
- }).passthrough();
3374
- var claudeTaskListOutputSchema = z19.object({
3375
- tasks: z19.array(z19.unknown())
3376
- }).passthrough();
3377
- var claudeTaskToolOutputSchema = z19.union([
3378
- claudeTaskCreateOutputSchema,
3379
- claudeTaskGetOutputSchema,
3380
- claudeTaskListOutputSchema,
3381
- claudeTaskUpdateOutputSchema
3382
- ]);
3317
+ // ../domain/src/thread.ts
3318
+ import { z as z24 } from "zod";
3383
3319
 
3384
3320
  // ../domain/src/environment.ts
3385
- import { z as z20 } from "zod";
3321
+ import { z as z19 } from "zod";
3386
3322
  var environmentStatusValues = [
3387
3323
  "provisioning",
3388
3324
  "ready",
@@ -3391,49 +3327,49 @@ var environmentStatusValues = [
3391
3327
  "destroying",
3392
3328
  "destroyed"
3393
3329
  ];
3394
- var environmentStatusSchema = z20.enum(environmentStatusValues);
3330
+ var environmentStatusSchema = z19.enum(environmentStatusValues);
3395
3331
  var WORKSPACE_PROVISION_TYPES = [
3396
3332
  "unmanaged",
3397
3333
  "managed-worktree",
3398
3334
  "personal"
3399
3335
  ];
3400
- var workspaceProvisionTypeSchema = z20.enum(WORKSPACE_PROVISION_TYPES);
3336
+ var workspaceProvisionTypeSchema = z19.enum(WORKSPACE_PROVISION_TYPES);
3401
3337
  var environmentWorkspaceDisplayKindValues = [
3402
3338
  "managed-worktree",
3403
3339
  "unmanaged-worktree",
3404
3340
  "other"
3405
3341
  ];
3406
- var environmentWorkspaceDisplayKindSchema = z20.enum(
3342
+ var environmentWorkspaceDisplayKindSchema = z19.enum(
3407
3343
  environmentWorkspaceDisplayKindValues
3408
3344
  );
3409
- var discoveredWorkspacePropertiesSchema = z20.object({
3410
- path: z20.string().min(1),
3411
- isGitRepo: z20.boolean(),
3412
- isWorktree: z20.boolean(),
3413
- branchName: z20.string().nullable(),
3414
- defaultBranch: z20.string().nullable()
3415
- });
3416
- var environmentSchema = z20.object({
3417
- id: z20.string(),
3418
- name: z20.string().nullable(),
3419
- projectId: z20.string(),
3420
- hostId: z20.string(),
3421
- path: z20.string().nullable(),
3422
- managed: z20.boolean(),
3423
- isGitRepo: z20.boolean(),
3424
- isWorktree: z20.boolean(),
3345
+ var discoveredWorkspacePropertiesSchema = z19.object({
3346
+ path: z19.string().min(1),
3347
+ isGitRepo: z19.boolean(),
3348
+ isWorktree: z19.boolean(),
3349
+ branchName: z19.string().nullable(),
3350
+ defaultBranch: z19.string().nullable()
3351
+ });
3352
+ var environmentSchema = z19.object({
3353
+ id: z19.string(),
3354
+ name: z19.string().nullable(),
3355
+ projectId: z19.string(),
3356
+ hostId: z19.string(),
3357
+ path: z19.string().nullable(),
3358
+ managed: z19.boolean(),
3359
+ isGitRepo: z19.boolean(),
3360
+ isWorktree: z19.boolean(),
3425
3361
  workspaceProvisionType: workspaceProvisionTypeSchema,
3426
- branchName: z20.string().nullable(),
3427
- baseBranch: z20.string().nullable(),
3428
- defaultBranch: z20.string().nullable(),
3429
- mergeBaseBranch: z20.string().nullable(),
3362
+ branchName: z19.string().nullable(),
3363
+ baseBranch: z19.string().nullable(),
3364
+ defaultBranch: z19.string().nullable(),
3365
+ mergeBaseBranch: z19.string().nullable(),
3430
3366
  status: environmentStatusSchema,
3431
- createdAt: z20.number(),
3432
- updatedAt: z20.number()
3367
+ createdAt: z19.number(),
3368
+ updatedAt: z19.number()
3433
3369
  });
3434
3370
 
3435
3371
  // ../domain/src/git-checkout.ts
3436
- import { z as z21 } from "zod";
3372
+ import { z as z20 } from "zod";
3437
3373
  var gitBranchForbiddenCharacterPattern = /[\u0000-\u001f\u007f\\:~^?*\[]/u;
3438
3374
  var gitBranchWhitespacePattern = /[ \t]/u;
3439
3375
  var gitReservedBranchNames = /* @__PURE__ */ new Set([
@@ -3452,74 +3388,74 @@ function isValidGitBranchName(name) {
3452
3388
  (component) => component.length > 0 && !component.startsWith(".") && !component.endsWith(".lock")
3453
3389
  );
3454
3390
  }
3455
- var gitBranchNameSchema = z21.string().refine(isValidGitBranchName, { message: "Invalid git branch name" });
3456
- var gitCheckoutRefSchema = z21.discriminatedUnion("kind", [
3457
- z21.object({
3458
- kind: z21.literal("branch"),
3459
- branchName: z21.string().min(1),
3460
- headSha: z21.string().min(1).nullable()
3461
- }),
3462
- z21.object({
3463
- kind: z21.literal("detached"),
3464
- headSha: z21.string().min(1).nullable()
3465
- }),
3466
- z21.object({
3467
- kind: z21.literal("unborn"),
3468
- branchName: z21.string().min(1).nullable()
3469
- }),
3470
- z21.object({
3471
- kind: z21.literal("unknown"),
3472
- reason: z21.string().min(1)
3391
+ var gitBranchNameSchema = z20.string().refine(isValidGitBranchName, { message: "Invalid git branch name" });
3392
+ var gitCheckoutRefSchema = z20.discriminatedUnion("kind", [
3393
+ z20.object({
3394
+ kind: z20.literal("branch"),
3395
+ branchName: z20.string().min(1),
3396
+ headSha: z20.string().min(1).nullable()
3397
+ }),
3398
+ z20.object({
3399
+ kind: z20.literal("detached"),
3400
+ headSha: z20.string().min(1).nullable()
3401
+ }),
3402
+ z20.object({
3403
+ kind: z20.literal("unborn"),
3404
+ branchName: z20.string().min(1).nullable()
3405
+ }),
3406
+ z20.object({
3407
+ kind: z20.literal("unknown"),
3408
+ reason: z20.string().min(1)
3473
3409
  })
3474
3410
  ]);
3475
- var workspaceGitOperationSchema = z21.discriminatedUnion("kind", [
3476
- z21.object({ kind: z21.literal("none") }),
3477
- z21.object({
3478
- kind: z21.literal("merge"),
3479
- hasConflicts: z21.boolean()
3480
- }),
3481
- z21.object({
3482
- kind: z21.literal("rebase"),
3483
- hasConflicts: z21.boolean()
3484
- }),
3485
- z21.object({
3486
- kind: z21.literal("cherry-pick"),
3487
- hasConflicts: z21.boolean()
3488
- }),
3489
- z21.object({
3490
- kind: z21.literal("revert"),
3491
- hasConflicts: z21.boolean()
3492
- }),
3493
- z21.object({
3494
- kind: z21.literal("unknown"),
3495
- reason: z21.string().min(1),
3496
- hasConflicts: z21.boolean()
3411
+ var workspaceGitOperationSchema = z20.discriminatedUnion("kind", [
3412
+ z20.object({ kind: z20.literal("none") }),
3413
+ z20.object({
3414
+ kind: z20.literal("merge"),
3415
+ hasConflicts: z20.boolean()
3416
+ }),
3417
+ z20.object({
3418
+ kind: z20.literal("rebase"),
3419
+ hasConflicts: z20.boolean()
3420
+ }),
3421
+ z20.object({
3422
+ kind: z20.literal("cherry-pick"),
3423
+ hasConflicts: z20.boolean()
3424
+ }),
3425
+ z20.object({
3426
+ kind: z20.literal("revert"),
3427
+ hasConflicts: z20.boolean()
3428
+ }),
3429
+ z20.object({
3430
+ kind: z20.literal("unknown"),
3431
+ reason: z20.string().min(1),
3432
+ hasConflicts: z20.boolean()
3497
3433
  })
3498
3434
  ]);
3499
- var gitBranchRefClassificationSchema = z21.object({
3500
- name: z21.string().min(1),
3501
- kind: z21.enum(["local", "remote", "missing"])
3435
+ var gitBranchRefClassificationSchema = z20.object({
3436
+ name: z20.string().min(1),
3437
+ kind: z20.enum(["local", "remote", "missing"])
3502
3438
  });
3503
- var defaultBranchRelationSchema = z21.enum([
3439
+ var defaultBranchRelationSchema = z20.enum([
3504
3440
  "equal",
3505
3441
  "local-behind",
3506
3442
  "local-ahead",
3507
3443
  "diverged",
3508
3444
  "unknown"
3509
3445
  ]);
3510
- var projectSourceCheckoutSchema = z21.object({
3446
+ var projectSourceCheckoutSchema = z20.object({
3511
3447
  /** Local branches under refs/heads, safe for checkout and write targets. */
3512
- branches: z21.array(z21.string()),
3513
- branchesTruncated: z21.boolean(),
3448
+ branches: z20.array(z20.string()),
3449
+ branchesTruncated: z20.boolean(),
3514
3450
  checkout: gitCheckoutRefSchema,
3515
- defaultBranch: z21.string().min(1).nullable(),
3451
+ defaultBranch: z20.string().min(1).nullable(),
3516
3452
  defaultBranchRelation: defaultBranchRelationSchema.nullable(),
3517
- hasUncommittedChanges: z21.boolean(),
3453
+ hasUncommittedChanges: z20.boolean(),
3518
3454
  operation: workspaceGitOperationSchema,
3519
- originDefaultBranch: z21.string().min(1).nullable(),
3455
+ originDefaultBranch: z20.string().min(1).nullable(),
3520
3456
  /** Remote-tracking branches under refs/remotes, for base/diff selection. */
3521
- remoteBranches: z21.array(z21.string()),
3522
- remoteBranchesTruncated: z21.boolean(),
3457
+ remoteBranches: z20.array(z20.string()),
3458
+ remoteBranchesTruncated: z20.boolean(),
3523
3459
  /**
3524
3460
  * Exact classification of the requested branch/ref, resolved before branch
3525
3461
  * list pagination so callers can validate selected refs even when they are
@@ -3528,269 +3464,8 @@ var projectSourceCheckoutSchema = z21.object({
3528
3464
  selectedBranch: gitBranchRefClassificationSchema.nullable()
3529
3465
  });
3530
3466
 
3531
- // ../domain/src/host-list-limits.ts
3532
- var FILE_LIST_QUERY_MAX_LENGTH = 256;
3533
- var FILE_LIST_LIMIT_MAX = 1e4;
3534
- var BRANCH_LIST_QUERY_MAX_LENGTH = 256;
3535
- var BRANCH_LIST_LIMIT_MAX = 1e3;
3536
-
3537
- // ../domain/src/number-utils.ts
3538
- function toPositiveNumber(value) {
3539
- return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
3540
- }
3541
-
3542
- // ../domain/src/provider-fork.ts
3543
- import { z as z22 } from "zod";
3544
- var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
3545
- var providerForkSchema = z22.enum(PROVIDER_FORK_VALUES);
3546
-
3547
- // ../domain/src/provider-types.ts
3548
- import { z as z23 } from "zod";
3549
- var modelReasoningEffortSchema = z23.object({
3550
- reasoningEffort: reasoningLevelSchema,
3551
- description: z23.string()
3552
- });
3553
- var availableModelSchema = z23.object({
3554
- id: z23.string(),
3555
- model: z23.string(),
3556
- displayName: z23.string(),
3557
- /** Provider route used to run this model when it is distinct from the
3558
- * selected agent provider (for example, a model provider nested under Pi). */
3559
- routeProviderId: z23.string().min(1).optional(),
3560
- description: z23.string(),
3561
- supportedReasoningEfforts: z23.array(modelReasoningEffortSchema),
3562
- defaultReasoningEffort: reasoningLevelSchema,
3563
- isDefault: z23.boolean()
3564
- });
3565
- var providerCapabilitiesSchema = z23.object({
3566
- supportsThreadArchive: z23.boolean(),
3567
- supportsThreadRename: z23.boolean(),
3568
- supportsServiceTier: z23.boolean(),
3569
- supportsNativeUserQuestion: z23.boolean(),
3570
- supportsFork: z23.boolean(),
3571
- /**
3572
- * The provider can recreate a session at an earlier point, which is what
3573
- * edit-past-message rewind needs. Separate from `supportsFork`: ACP clones
3574
- * whole sessions (tip-only) and cannot stop at a checkpoint.
3575
- */
3576
- supportsSessionRewind: z23.boolean(),
3577
- permissionModes: z23.array(permissionModeSchema).min(1)
3578
- });
3579
- var providerComposerCommandSchema = z23.object({
3580
- trigger: promptMentionCommandTriggerSchema,
3581
- name: z23.string().min(1).regex(/^[^\s/$]+$/u),
3582
- trailingText: z23.string().regex(/^\s*$/u)
3583
- });
3584
- var providerComposerActionSchema = z23.discriminatedUnion("kind", [
3585
- z23.object({
3586
- kind: z23.literal("skills"),
3587
- trigger: promptMentionCommandTriggerSchema
3588
- }),
3589
- z23.object({
3590
- kind: z23.literal("plan"),
3591
- command: providerComposerCommandSchema
3592
- }),
3593
- z23.object({
3594
- kind: z23.literal("goal"),
3595
- command: providerComposerCommandSchema
3596
- })
3597
- ]);
3598
- var providerStringsSchema = z23.object({
3599
- /** How to sign in on the host ("Run `claude` on the machine to sign in."). */
3600
- signInHint: z23.string().min(1),
3601
- /** Shown when a session's credentials expired. */
3602
- expiredHint: z23.string().min(1),
3603
- /** Where to install the agent. */
3604
- installUrl: z23.string().min(1),
3605
- /** Brand prefix stripped from model display names ("Claude "). */
3606
- brandPrefix: z23.string().min(1).optional(),
3607
- /** Plan-mode banner copy for providers that declare the `plan` action. */
3608
- planModeCopy: z23.string().min(1).optional(),
3609
- /** Per-theme tint for the provider icon. */
3610
- iconTint: z23.object({ light: z23.string().min(1), dark: z23.string().min(1) }).optional()
3611
- });
3612
- var providerOptionDescriptorSchema = z23.object({
3613
- id: z23.string().min(1),
3614
- label: z23.string().min(1),
3615
- description: z23.string().min(1).optional()
3616
- });
3617
- var providerExtensionKindInfoSchema = z23.object({
3618
- item: z23.boolean(),
3619
- state: z23.boolean()
3620
- });
3621
- var providerExtensionKindsSchema = z23.record(
3622
- extensionKindSchema,
3623
- providerExtensionKindInfoSchema
3624
- );
3625
- var providerInfoSchema = z23.object({
3626
- id: z23.string(),
3627
- displayName: z23.string(),
3628
- /**
3629
- * Declared grouping key shared by related providers (the ACP agents).
3630
- * Absent when the provider declared none. Grouping only.
3631
- */
3632
- family: z23.string().min(1).optional(),
3633
- logoUrl: z23.string().min(1).nullable(),
3634
- /** Sessionless maintenance methods declared by the provider plugin. */
3635
- experimental_providerHealth: z23.boolean(),
3636
- experimental_providerUsage: z23.boolean(),
3637
- experimental_providerInstallation: z23.boolean(),
3638
- capabilities: providerCapabilitiesSchema,
3639
- composerActions: z23.array(providerComposerActionSchema),
3640
- available: z23.boolean(),
3641
- // -------------------------------------------------------------------------
3642
- // Target-state projection (docs/provider-plugin-api.md §1). Optional and
3643
- // unfilled until WS2a projects them from the plugin declaration; absence
3644
- // means "the provider declared none", never a default. The `experimental_*`
3645
- // and `capabilities.supports*` fields above stay until WS2a stabilizes the
3646
- // surface as one unit.
3647
- // -------------------------------------------------------------------------
3648
- strings: providerStringsSchema.optional(),
3649
- serviceTiers: z23.array(providerOptionDescriptorSchema).optional(),
3650
- reasoningLevels: z23.array(providerOptionDescriptorSchema).optional(),
3651
- extensionKinds: providerExtensionKindsSchema.optional()
3652
- });
3653
- var providerRecoveryKindValues = [
3654
- "sessionArchived",
3655
- "authRequired",
3656
- "restartRecommended",
3657
- "staleTurn",
3658
- "rateLimited"
3659
- ];
3660
- var providerRecoveryKindSchema = z23.enum(providerRecoveryKindValues);
3661
- var toolCallOutputItemSchema = z23.discriminatedUnion("type", [
3662
- z23.object({
3663
- type: z23.literal("inputText"),
3664
- text: z23.string()
3665
- }),
3666
- z23.object({
3667
- type: z23.literal("inputImage"),
3668
- imageUrl: z23.string()
3669
- })
3670
- ]);
3671
- var toolCallRequestSchema = z23.object({
3672
- requestId: z23.union([z23.string().min(1), z23.number()]),
3673
- threadId: z23.string().min(1),
3674
- providerThreadId: z23.string().min(1),
3675
- turnId: z23.string().min(1),
3676
- callId: z23.string().min(1),
3677
- tool: z23.string().min(1),
3678
- arguments: z23.unknown().optional()
3679
- });
3680
- var toolCallResponseSchema = z23.object({
3681
- contentItems: z23.array(toolCallOutputItemSchema),
3682
- success: z23.boolean()
3683
- });
3684
- var dynamicToolSchema = z23.object({
3685
- name: z23.string(),
3686
- description: z23.string(),
3687
- inputSchema: z23.unknown(),
3688
- presentation: threadEventItemPresentationSchema.optional()
3689
- });
3690
-
3691
- // ../domain/src/reasoning-efforts.ts
3692
- var NONE_REASONING_EFFORT = {
3693
- reasoningEffort: "none",
3694
- description: "No extended thinking"
3695
- };
3696
- var LOW_REASONING_EFFORT = {
3697
- reasoningEffort: "low",
3698
- description: "Low reasoning effort"
3699
- };
3700
- var MEDIUM_REASONING_EFFORT = {
3701
- reasoningEffort: "medium",
3702
- description: "Medium reasoning effort"
3703
- };
3704
- var HIGH_REASONING_EFFORT = {
3705
- reasoningEffort: "high",
3706
- description: "High reasoning effort"
3707
- };
3708
- var XHIGH_REASONING_EFFORT = {
3709
- reasoningEffort: "xhigh",
3710
- description: "Extra high reasoning effort"
3711
- };
3712
- var ULTRACODE_REASONING_EFFORT = {
3713
- reasoningEffort: "ultracode",
3714
- description: "Extra high reasoning effort plus multi-agent workflow orchestration"
3715
- };
3716
- var MAX_REASONING_EFFORT = {
3717
- reasoningEffort: "max",
3718
- description: "Maximum reasoning effort"
3719
- };
3720
- var ULTRA_REASONING_EFFORT = {
3721
- reasoningEffort: "ultra",
3722
- description: "Maximum reasoning with automatic task delegation"
3723
- };
3724
- var REASONING_EFFORT_BY_LEVEL = {
3725
- none: NONE_REASONING_EFFORT,
3726
- low: LOW_REASONING_EFFORT,
3727
- medium: MEDIUM_REASONING_EFFORT,
3728
- high: HIGH_REASONING_EFFORT,
3729
- xhigh: XHIGH_REASONING_EFFORT,
3730
- ultracode: ULTRACODE_REASONING_EFFORT,
3731
- max: MAX_REASONING_EFFORT,
3732
- ultra: ULTRA_REASONING_EFFORT
3733
- };
3734
- function reasoningEffortsForLevels(levels) {
3735
- return levels.map((level) => ({ ...REASONING_EFFORT_BY_LEVEL[level] }));
3736
- }
3737
-
3738
- // ../domain/src/thread-git-diff.ts
3739
- import { z as z24 } from "zod";
3740
- var workspaceDiffTargetSchema = z24.discriminatedUnion("type", [
3741
- z24.object({
3742
- type: z24.literal("uncommitted")
3743
- }),
3744
- z24.object({
3745
- type: z24.literal("branch_committed"),
3746
- mergeBaseBranch: z24.string().min(1)
3747
- }),
3748
- z24.object({
3749
- type: z24.literal("all"),
3750
- mergeBaseBranch: z24.string().min(1)
3751
- }),
3752
- z24.object({
3753
- type: z24.literal("commit"),
3754
- sha: z24.string().regex(/^[0-9a-f]{4,40}$/iu)
3755
- })
3756
- ]);
3757
- var rawDiffFileStatSchema = z24.object({
3758
- path: z24.string(),
3759
- previousPath: z24.string().nullable(),
3760
- statusLetter: z24.enum(["A", "M", "D", "R", "C", "T"]),
3761
- additions: z24.number().int().nonnegative(),
3762
- deletions: z24.number().int().nonnegative(),
3763
- binary: z24.boolean(),
3764
- origin: z24.enum(["tracked", "untracked"])
3765
- });
3766
- var threadGitDiffResponseSchema = z24.object({
3767
- diff: z24.string(),
3768
- truncated: z24.boolean(),
3769
- shortstat: z24.string(),
3770
- files: z24.string(),
3771
- /**
3772
- * Resolved merge-base SHA for `branch_committed` / `all` targets — the
3773
- * exact ref the diff was computed against. `null` for targets that don't
3774
- * use a merge-base (`uncommitted`, `commit`), and also when no merge-base
3775
- * exists (e.g. the branch has been removed locally). Callers fetching
3776
- * per-file content for context expansion must pass this SHA as the
3777
- * "old side" ref so the file content lines up with the diff's hunk
3778
- * coordinates — passing the branch name reads from its current tip, which
3779
- * may have diverged past the merge-base.
3780
- */
3781
- mergeBaseRef: z24.string().nullable()
3782
- });
3783
-
3784
- // ../domain/src/thread-visibility.ts
3785
- import { z as z25 } from "zod";
3786
- var threadVisibilityValues = ["visible", "hidden"];
3787
- var threadVisibilitySchema = z25.enum(threadVisibilityValues);
3788
-
3789
- // ../domain/src/thread.ts
3790
- import { z as z28 } from "zod";
3791
-
3792
3467
  // ../domain/src/thread-status.ts
3793
- import { z as z26 } from "zod";
3468
+ import { z as z21 } from "zod";
3794
3469
  var threadStatusValues = [
3795
3470
  "idle",
3796
3471
  "starting",
@@ -3798,12 +3473,17 @@ var threadStatusValues = [
3798
3473
  "stopping",
3799
3474
  "error"
3800
3475
  ];
3801
- var threadStatusSchema = z26.enum(threadStatusValues);
3476
+ var threadStatusSchema = z21.enum(threadStatusValues);
3802
3477
 
3803
3478
  // ../domain/src/thread-origin-kind.ts
3804
- import { z as z27 } from "zod";
3479
+ import { z as z22 } from "zod";
3805
3480
  var threadOriginKindValues = ["fork"];
3806
- var threadOriginKindSchema = z27.enum(threadOriginKindValues);
3481
+ var threadOriginKindSchema = z22.enum(threadOriginKindValues);
3482
+
3483
+ // ../domain/src/thread-visibility.ts
3484
+ import { z as z23 } from "zod";
3485
+ var threadVisibilityValues = ["visible", "hidden"];
3486
+ var threadVisibilitySchema = z23.enum(threadVisibilityValues);
3807
3487
 
3808
3488
  // ../domain/src/thread.ts
3809
3489
  var threadRuntimeDisplayStatusValues = [
@@ -3812,19 +3492,19 @@ var threadRuntimeDisplayStatusValues = [
3812
3492
  "host-reconnecting",
3813
3493
  "waiting-for-host"
3814
3494
  ];
3815
- var threadRuntimeDisplayStatusSchema = z28.enum(
3495
+ var threadRuntimeDisplayStatusSchema = z24.enum(
3816
3496
  threadRuntimeDisplayStatusValues
3817
3497
  );
3818
- var threadRuntimeStateSchema = z28.object({
3498
+ var threadRuntimeStateSchema = z24.object({
3819
3499
  displayStatus: threadRuntimeDisplayStatusSchema,
3820
- hostReconnectGraceExpiresAt: z28.number().nullable()
3500
+ hostReconnectGraceExpiresAt: z24.number().nullable()
3821
3501
  });
3822
- var threadActivityStateSchema = z28.object({
3823
- activeWorkflowCount: z28.number().int().nonnegative(),
3824
- activeBackgroundAgentCount: z28.number().int().nonnegative(),
3825
- activeBackgroundCommandCount: z28.number().int().nonnegative(),
3826
- activePlanModeCount: z28.number().int().nonnegative(),
3827
- activeGoalCount: z28.number().int().nonnegative()
3502
+ var threadActivityStateSchema = z24.object({
3503
+ activeWorkflowCount: z24.number().int().nonnegative(),
3504
+ activeBackgroundAgentCount: z24.number().int().nonnegative(),
3505
+ activeBackgroundCommandCount: z24.number().int().nonnegative(),
3506
+ activePlanModeCount: z24.number().int().nonnegative(),
3507
+ activeGoalCount: z24.number().int().nonnegative()
3828
3508
  });
3829
3509
  var workspaceStateValues = [
3830
3510
  "clean",
@@ -3833,8 +3513,8 @@ var workspaceStateValues = [
3833
3513
  "committed_unmerged",
3834
3514
  "dirty_and_committed_unmerged"
3835
3515
  ];
3836
- var workspaceStateSchema = z28.enum(workspaceStateValues);
3837
- var workspaceFileStatusKindSchema = z28.enum([
3516
+ var workspaceStateSchema = z24.enum(workspaceStateValues);
3517
+ var workspaceFileStatusKindSchema = z24.enum([
3838
3518
  "M",
3839
3519
  "A",
3840
3520
  "D",
@@ -3849,60 +3529,60 @@ var workspaceFileStatusKindSchema = z28.enum([
3849
3529
  */
3850
3530
  "?"
3851
3531
  ]);
3852
- var workspaceFileStatusSchema = z28.object({
3853
- path: z28.string(),
3532
+ var workspaceFileStatusSchema = z24.object({
3533
+ path: z24.string(),
3854
3534
  status: workspaceFileStatusKindSchema,
3855
3535
  /**
3856
3536
  * Per-file line counts from `git diff --numstat`. Null when the count is
3857
3537
  * unknown — binary files (numstat reports `-`) and untracked files (numstat
3858
3538
  * does not include them).
3859
3539
  */
3860
- insertions: z28.number().nullable(),
3861
- deletions: z28.number().nullable()
3862
- });
3863
- var workspaceCommitSummarySchema = z28.object({
3864
- sha: z28.string(),
3865
- shortSha: z28.string(),
3866
- subject: z28.string(),
3867
- authorName: z28.string(),
3868
- authoredAt: z28.number()
3869
- });
3870
- var workspaceChangeStatsSchema = z28.object({
3871
- insertions: z28.number(),
3872
- deletions: z28.number(),
3540
+ insertions: z24.number().nullable(),
3541
+ deletions: z24.number().nullable()
3542
+ });
3543
+ var workspaceCommitSummarySchema = z24.object({
3544
+ sha: z24.string(),
3545
+ shortSha: z24.string(),
3546
+ subject: z24.string(),
3547
+ authorName: z24.string(),
3548
+ authoredAt: z24.number()
3549
+ });
3550
+ var workspaceChangeStatsSchema = z24.object({
3551
+ insertions: z24.number(),
3552
+ deletions: z24.number(),
3873
3553
  /** False when line totals omit files whose contents were intentionally not read. */
3874
- lineStatsComplete: z28.boolean(),
3875
- files: z28.array(workspaceFileStatusSchema)
3554
+ lineStatsComplete: z24.boolean(),
3555
+ files: z24.array(workspaceFileStatusSchema)
3876
3556
  });
3877
3557
  var workspaceWorkingTreeSchema = workspaceChangeStatsSchema.extend({
3878
- hasUncommittedChanges: z28.boolean(),
3558
+ hasUncommittedChanges: z24.boolean(),
3879
3559
  state: workspaceStateSchema
3880
3560
  });
3881
- var workspaceBranchSchema = z28.object({
3882
- currentBranch: z28.string().nullable(),
3883
- defaultBranch: z28.string()
3561
+ var workspaceBranchSchema = z24.object({
3562
+ currentBranch: z24.string().nullable(),
3563
+ defaultBranch: z24.string()
3884
3564
  });
3885
3565
  var workspaceMergeBaseSchema = workspaceChangeStatsSchema.extend({
3886
- mergeBaseBranch: z28.string(),
3887
- baseRef: z28.string().nullable(),
3888
- aheadCount: z28.number(),
3889
- behindCount: z28.number(),
3890
- hasCommittedUnmergedChanges: z28.boolean(),
3891
- commits: z28.array(workspaceCommitSummarySchema)
3892
- });
3893
- var workspaceStatusSchema = z28.object({
3566
+ mergeBaseBranch: z24.string(),
3567
+ baseRef: z24.string().nullable(),
3568
+ aheadCount: z24.number(),
3569
+ behindCount: z24.number(),
3570
+ hasCommittedUnmergedChanges: z24.boolean(),
3571
+ commits: z24.array(workspaceCommitSummarySchema)
3572
+ });
3573
+ var workspaceStatusSchema = z24.object({
3894
3574
  workingTree: workspaceWorkingTreeSchema,
3895
3575
  checkout: gitCheckoutRefSchema,
3896
3576
  branch: workspaceBranchSchema,
3897
3577
  mergeBase: workspaceMergeBaseSchema.nullable()
3898
3578
  });
3899
- var gitHostPullRequestCheckStatusSchema = z28.enum([
3579
+ var gitHostPullRequestCheckStatusSchema = z24.enum([
3900
3580
  "queued",
3901
3581
  "in_progress",
3902
3582
  "completed",
3903
3583
  "unknown"
3904
3584
  ]);
3905
- var gitHostPullRequestCheckConclusionSchema = z28.enum([
3585
+ var gitHostPullRequestCheckConclusionSchema = z24.enum([
3906
3586
  "success",
3907
3587
  "failure",
3908
3588
  "cancelled",
@@ -3914,19 +3594,19 @@ var gitHostPullRequestCheckConclusionSchema = z28.enum([
3914
3594
  "stale",
3915
3595
  "unknown"
3916
3596
  ]);
3917
- var gitHostPullRequestCheckSchema = z28.object({
3918
- name: z28.string().min(1),
3597
+ var gitHostPullRequestCheckSchema = z24.object({
3598
+ name: z24.string().min(1),
3919
3599
  status: gitHostPullRequestCheckStatusSchema,
3920
3600
  conclusion: gitHostPullRequestCheckConclusionSchema.nullable(),
3921
- url: z28.string().url().nullable(),
3922
- startedAt: z28.string().datetime().nullable()
3601
+ url: z24.string().url().nullable(),
3602
+ startedAt: z24.string().datetime().nullable()
3923
3603
  }).strict();
3924
- var gitHostPullRequestReviewDecisionSchema = z28.enum([
3604
+ var gitHostPullRequestReviewDecisionSchema = z24.enum([
3925
3605
  "APPROVED",
3926
3606
  "CHANGES_REQUESTED",
3927
3607
  "REVIEW_REQUIRED"
3928
3608
  ]);
3929
- var gitHostPullRequestMergeStateStatusSchema = z28.enum([
3609
+ var gitHostPullRequestMergeStateStatusSchema = z24.enum([
3930
3610
  "BEHIND",
3931
3611
  "BLOCKED",
3932
3612
  "CLEAN",
@@ -3936,65 +3616,65 @@ var gitHostPullRequestMergeStateStatusSchema = z28.enum([
3936
3616
  "UNKNOWN",
3937
3617
  "UNSTABLE"
3938
3618
  ]);
3939
- var gitHostPullRequestMergeableSchema = z28.enum([
3619
+ var gitHostPullRequestMergeableSchema = z24.enum([
3940
3620
  "CONFLICTING",
3941
3621
  "MERGEABLE",
3942
3622
  "UNKNOWN"
3943
3623
  ]);
3944
- var gitHostPullRequestSchema = z28.object({
3945
- number: z28.number().int().positive(),
3946
- title: z28.string(),
3947
- state: z28.enum(["OPEN", "CLOSED", "MERGED"]),
3948
- url: z28.string().url(),
3949
- isDraft: z28.boolean(),
3950
- baseRefName: z28.string(),
3951
- headRefName: z28.string(),
3952
- updatedAt: z28.string().datetime(),
3953
- checks: z28.array(gitHostPullRequestCheckSchema),
3624
+ var gitHostPullRequestSchema = z24.object({
3625
+ number: z24.number().int().positive(),
3626
+ title: z24.string(),
3627
+ state: z24.enum(["OPEN", "CLOSED", "MERGED"]),
3628
+ url: z24.string().url(),
3629
+ isDraft: z24.boolean(),
3630
+ baseRefName: z24.string(),
3631
+ headRefName: z24.string(),
3632
+ updatedAt: z24.string().datetime(),
3633
+ checks: z24.array(gitHostPullRequestCheckSchema),
3954
3634
  reviewDecision: gitHostPullRequestReviewDecisionSchema.nullable(),
3955
- reviewRequestCount: z28.number().int().nonnegative(),
3635
+ reviewRequestCount: z24.number().int().nonnegative(),
3956
3636
  mergeStateStatus: gitHostPullRequestMergeStateStatusSchema.nullable(),
3957
3637
  mergeable: gitHostPullRequestMergeableSchema.nullable()
3958
3638
  }).strict();
3959
- var pullRequestStateSchema = z28.enum(["draft", "open", "merged", "closed"]);
3960
- var threadPullRequestChecksStateSchema = z28.enum([
3639
+ var pullRequestStateSchema = z24.enum(["draft", "open", "merged", "closed"]);
3640
+ var threadPullRequestChecksStateSchema = z24.enum([
3961
3641
  "passing",
3962
3642
  "failing",
3963
3643
  "pending",
3964
3644
  "no_checks",
3965
3645
  "unknown"
3966
3646
  ]);
3967
- var threadPullRequestChecksSchema = z28.object({
3647
+ var threadPullRequestChecksSchema = z24.object({
3968
3648
  state: threadPullRequestChecksStateSchema,
3969
- totalCount: z28.number().int().nonnegative(),
3970
- passedCount: z28.number().int().nonnegative(),
3971
- failedCount: z28.number().int().nonnegative(),
3972
- pendingCount: z28.number().int().nonnegative()
3649
+ totalCount: z24.number().int().nonnegative(),
3650
+ passedCount: z24.number().int().nonnegative(),
3651
+ failedCount: z24.number().int().nonnegative(),
3652
+ pendingCount: z24.number().int().nonnegative()
3973
3653
  }).strict();
3974
- var threadPullRequestReviewStateSchema = z28.enum([
3654
+ var threadPullRequestReviewStateSchema = z24.enum([
3975
3655
  "approved",
3976
3656
  "changes_requested",
3977
3657
  "review_required",
3978
3658
  "review_requested",
3979
3659
  "none"
3980
3660
  ]);
3981
- var threadPullRequestReviewSchema = z28.object({
3661
+ var threadPullRequestReviewSchema = z24.object({
3982
3662
  state: threadPullRequestReviewStateSchema,
3983
- reviewRequestCount: z28.number().int().nonnegative()
3663
+ reviewRequestCount: z24.number().int().nonnegative()
3984
3664
  }).strict();
3985
- var threadPullRequestMergeabilityStateSchema = z28.enum([
3665
+ var threadPullRequestMergeabilityStateSchema = z24.enum([
3986
3666
  "mergeable",
3987
3667
  "conflicts",
3988
3668
  "blocked",
3989
3669
  "draft",
3990
3670
  "unknown"
3991
3671
  ]);
3992
- var threadPullRequestMergeabilitySchema = z28.object({
3672
+ var threadPullRequestMergeabilitySchema = z24.object({
3993
3673
  state: threadPullRequestMergeabilityStateSchema,
3994
3674
  mergeStateStatus: gitHostPullRequestMergeStateStatusSchema.nullable(),
3995
3675
  mergeable: gitHostPullRequestMergeableSchema.nullable()
3996
3676
  }).strict();
3997
- var threadPullRequestAttentionStateSchema = z28.enum([
3677
+ var threadPullRequestAttentionStateSchema = z24.enum([
3998
3678
  "checks_failed",
3999
3679
  "checks_pending",
4000
3680
  "changes_requested",
@@ -4007,66 +3687,386 @@ var threadPullRequestAttentionStateSchema = z28.enum([
4007
3687
  "closed",
4008
3688
  "none"
4009
3689
  ]);
4010
- var threadPullRequestSchema = z28.object({
4011
- number: z28.number().int().positive(),
4012
- title: z28.string(),
3690
+ var threadPullRequestSchema = z24.object({
3691
+ number: z24.number().int().positive(),
3692
+ title: z24.string(),
4013
3693
  state: pullRequestStateSchema,
4014
- url: z28.string().url(),
4015
- baseRefName: z28.string(),
4016
- headRefName: z28.string(),
4017
- updatedAt: z28.string().datetime(),
3694
+ url: z24.string().url(),
3695
+ baseRefName: z24.string(),
3696
+ headRefName: z24.string(),
3697
+ updatedAt: z24.string().datetime(),
4018
3698
  checks: threadPullRequestChecksSchema,
4019
3699
  review: threadPullRequestReviewSchema,
4020
3700
  mergeability: threadPullRequestMergeabilitySchema,
4021
3701
  attention: threadPullRequestAttentionStateSchema
4022
3702
  }).strict();
4023
- var threadQueuedMessageSchema = z28.object({
4024
- id: z28.string(),
4025
- content: z28.array(promptInputSchema).min(1),
4026
- model: z28.string().min(1),
3703
+ var threadQueuedMessageSchema = z24.object({
3704
+ id: z24.string(),
3705
+ content: z24.array(promptInputSchema).min(1),
3706
+ model: z24.string().min(1),
4027
3707
  reasoningLevel: reasoningLevelSchema,
4028
3708
  permissionMode: permissionModeSchema,
4029
3709
  serviceTier: serviceTierSchema,
4030
- groupWithNext: z28.boolean(),
4031
- createdAt: z28.number(),
4032
- updatedAt: z28.number()
4033
- });
4034
- var threadSchema = z28.object({
4035
- id: z28.string(),
4036
- projectId: z28.string(),
4037
- environmentId: z28.string().nullable(),
4038
- providerId: z28.string(),
4039
- title: z28.string().nullable(),
4040
- titleFallback: z28.string().nullable(),
4041
- sectionId: z28.string().nullable(),
3710
+ groupWithNext: z24.boolean(),
3711
+ createdAt: z24.number(),
3712
+ updatedAt: z24.number()
3713
+ });
3714
+ var threadSchema = z24.object({
3715
+ id: z24.string(),
3716
+ projectId: z24.string(),
3717
+ environmentId: z24.string().nullable(),
3718
+ providerId: z24.string(),
3719
+ title: z24.string().nullable(),
3720
+ titleFallback: z24.string().nullable(),
3721
+ sectionId: z24.string().nullable(),
4042
3722
  status: threadStatusSchema,
4043
- parentThreadId: z28.string().nullable(),
4044
- sourceThreadId: z28.string().nullable(),
3723
+ parentThreadId: z24.string().nullable(),
3724
+ sourceThreadId: z24.string().nullable(),
4045
3725
  originKind: threadOriginKindSchema.nullable(),
4046
3726
  /** Id of the plugin that spawned this thread; null for non-plugin origins. */
4047
- originPluginId: z28.string().nullable(),
3727
+ originPluginId: z24.string().nullable(),
4048
3728
  visibility: threadVisibilitySchema,
4049
- archivedAt: z28.number().nullable(),
4050
- pinnedAt: z28.number().nullable(),
4051
- deletedAt: z28.number().nullable(),
4052
- lastReadAt: z28.number().nullable(),
4053
- latestAttentionAt: z28.number(),
4054
- createdAt: z28.number(),
4055
- updatedAt: z28.number()
3729
+ archivedAt: z24.number().nullable(),
3730
+ pinnedAt: z24.number().nullable(),
3731
+ deletedAt: z24.number().nullable(),
3732
+ lastReadAt: z24.number().nullable(),
3733
+ latestAttentionAt: z24.number(),
3734
+ createdAt: z24.number(),
3735
+ updatedAt: z24.number()
4056
3736
  });
4057
3737
  var threadWithRuntimeSchema = threadSchema.extend({
4058
3738
  runtime: threadRuntimeStateSchema
4059
3739
  });
4060
3740
  var threadListEntrySchema = threadWithRuntimeSchema.extend({
4061
3741
  activity: threadActivityStateSchema,
4062
- pinSortKey: z28.string().nullable(),
4063
- hasPendingInteraction: z28.boolean(),
4064
- environmentHostId: z28.string().nullable(),
4065
- environmentName: z28.string().nullable(),
4066
- environmentBranchName: z28.string().nullable(),
3742
+ pinSortKey: z24.string().nullable(),
3743
+ hasPendingInteraction: z24.boolean(),
3744
+ environmentHostId: z24.string().nullable(),
3745
+ environmentName: z24.string().nullable(),
3746
+ environmentBranchName: z24.string().nullable(),
4067
3747
  environmentWorkspaceDisplayKind: environmentWorkspaceDisplayKindSchema
4068
3748
  });
4069
3749
 
3750
+ // ../domain/src/claude-task-tools.ts
3751
+ import { z as z25 } from "zod";
3752
+ var claudeTaskToolNameValues = [
3753
+ "TaskCreate",
3754
+ "TaskGet",
3755
+ "TaskList",
3756
+ "TaskUpdate"
3757
+ ];
3758
+ var claudeTaskToolNameSchema = z25.enum(claudeTaskToolNameValues);
3759
+ var claudeTaskStatusValues = ["pending", "in_progress", "completed"];
3760
+ var claudeTaskStatusSchema = z25.enum(claudeTaskStatusValues);
3761
+ var claudeTaskUpdateStatusValues = [
3762
+ ...claudeTaskStatusValues,
3763
+ "deleted"
3764
+ ];
3765
+ var claudeTaskUpdateStatusSchema = z25.enum(claudeTaskUpdateStatusValues);
3766
+ var claudeTaskListStatusValues = [
3767
+ ...claudeTaskStatusValues,
3768
+ "deleted"
3769
+ ];
3770
+ var claudeTaskListStatusSchema = z25.enum(claudeTaskListStatusValues);
3771
+ var claudeTaskCreateArgsSchema = z25.object({
3772
+ activeForm: z25.string().optional(),
3773
+ subject: z25.string()
3774
+ }).passthrough();
3775
+ var claudeTaskGetArgsSchema = z25.object({
3776
+ taskId: z25.string()
3777
+ }).passthrough();
3778
+ var claudeTaskUpdateArgsSchema = z25.object({
3779
+ activeForm: z25.string().optional(),
3780
+ status: claudeTaskUpdateStatusSchema.optional(),
3781
+ subject: z25.string().optional(),
3782
+ taskId: z25.string()
3783
+ }).passthrough();
3784
+ var claudeTaskCreateOutputSchema = z25.object({
3785
+ task: z25.object({
3786
+ id: z25.string(),
3787
+ subject: z25.string()
3788
+ }).passthrough()
3789
+ }).passthrough();
3790
+ var claudeTaskGetOutputTaskSchema = z25.object({
3791
+ id: z25.string(),
3792
+ status: claudeTaskStatusSchema,
3793
+ subject: z25.string()
3794
+ }).passthrough();
3795
+ var claudeTaskGetOutputSchema = z25.object({
3796
+ task: claudeTaskGetOutputTaskSchema.nullable()
3797
+ }).passthrough();
3798
+ var claudeTaskUpdateOutputSchema = z25.object({
3799
+ success: z25.boolean(),
3800
+ taskId: z25.string()
3801
+ }).passthrough();
3802
+ var claudeTaskListItemSchema = z25.object({
3803
+ id: z25.string(),
3804
+ status: claudeTaskListStatusSchema,
3805
+ subject: z25.string()
3806
+ }).passthrough();
3807
+ var claudeTaskListOutputSchema = z25.object({
3808
+ tasks: z25.array(z25.unknown())
3809
+ }).passthrough();
3810
+ var claudeTaskToolOutputSchema = z25.union([
3811
+ claudeTaskCreateOutputSchema,
3812
+ claudeTaskGetOutputSchema,
3813
+ claudeTaskListOutputSchema,
3814
+ claudeTaskUpdateOutputSchema
3815
+ ]);
3816
+
3817
+ // ../domain/src/host-list-limits.ts
3818
+ var FILE_LIST_QUERY_MAX_LENGTH = 256;
3819
+ var FILE_LIST_LIMIT_MAX = 1e4;
3820
+ var BRANCH_LIST_QUERY_MAX_LENGTH = 256;
3821
+ var BRANCH_LIST_LIMIT_MAX = 1e3;
3822
+
3823
+ // ../domain/src/number-utils.ts
3824
+ function toPositiveNumber(value) {
3825
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
3826
+ }
3827
+
3828
+ // ../domain/src/provider-fork.ts
3829
+ import { z as z26 } from "zod";
3830
+ var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
3831
+ var providerForkSchema = z26.enum(PROVIDER_FORK_VALUES);
3832
+
3833
+ // ../domain/src/provider-types.ts
3834
+ import { z as z27 } from "zod";
3835
+ var modelReasoningEffortSchema = z27.object({
3836
+ reasoningEffort: reasoningLevelSchema,
3837
+ description: z27.string()
3838
+ });
3839
+ var availableModelSchema = z27.object({
3840
+ id: z27.string(),
3841
+ model: z27.string(),
3842
+ displayName: z27.string(),
3843
+ /** Provider route used to run this model when it is distinct from the
3844
+ * selected agent provider (for example, a model provider nested under Pi). */
3845
+ routeProviderId: z27.string().min(1).optional(),
3846
+ description: z27.string(),
3847
+ supportedReasoningEfforts: z27.array(modelReasoningEffortSchema),
3848
+ defaultReasoningEffort: reasoningLevelSchema,
3849
+ isDefault: z27.boolean()
3850
+ });
3851
+ var providerCapabilitiesSchema = z27.object({
3852
+ supportsThreadArchive: z27.boolean(),
3853
+ supportsThreadRename: z27.boolean(),
3854
+ supportsServiceTier: z27.boolean(),
3855
+ supportsNativeUserQuestion: z27.boolean(),
3856
+ supportsFork: z27.boolean(),
3857
+ /**
3858
+ * The provider can recreate a session at an earlier point, which is what
3859
+ * edit-past-message rewind needs. Separate from `supportsFork`: ACP clones
3860
+ * whole sessions (tip-only) and cannot stop at a checkpoint.
3861
+ */
3862
+ supportsSessionRewind: z27.boolean(),
3863
+ permissionModes: z27.array(permissionModeSchema).min(1)
3864
+ });
3865
+ var providerComposerCommandSchema = z27.object({
3866
+ trigger: promptMentionCommandTriggerSchema,
3867
+ name: z27.string().min(1).regex(/^[^\s/$]+$/u),
3868
+ trailingText: z27.string().regex(/^\s*$/u)
3869
+ });
3870
+ var providerComposerActionSchema = z27.discriminatedUnion("kind", [
3871
+ z27.object({
3872
+ kind: z27.literal("skills"),
3873
+ trigger: promptMentionCommandTriggerSchema
3874
+ }),
3875
+ z27.object({
3876
+ kind: z27.literal("plan"),
3877
+ command: providerComposerCommandSchema
3878
+ }),
3879
+ z27.object({
3880
+ kind: z27.literal("goal"),
3881
+ command: providerComposerCommandSchema
3882
+ })
3883
+ ]);
3884
+ var providerStringsSchema = z27.object({
3885
+ /** How to sign in on the host ("Run `claude` on the machine to sign in."). */
3886
+ signInHint: z27.string().min(1),
3887
+ /** Shown when a session's credentials expired. */
3888
+ expiredHint: z27.string().min(1),
3889
+ /** Where to install the agent. */
3890
+ installUrl: z27.string().min(1),
3891
+ /** Brand prefix stripped from model display names ("Claude "). */
3892
+ brandPrefix: z27.string().min(1).optional(),
3893
+ /** Plan-mode banner copy for providers that declare the `plan` action. */
3894
+ planModeCopy: z27.string().min(1).optional(),
3895
+ /** Per-theme tint for the provider icon. */
3896
+ iconTint: z27.object({ light: z27.string().min(1), dark: z27.string().min(1) }).optional()
3897
+ });
3898
+ var providerOptionDescriptorSchema = z27.object({
3899
+ id: z27.string().min(1),
3900
+ label: z27.string().min(1),
3901
+ description: z27.string().min(1).optional()
3902
+ });
3903
+ var providerExtensionKindInfoSchema = z27.object({
3904
+ item: z27.boolean(),
3905
+ state: z27.boolean()
3906
+ });
3907
+ var providerExtensionKindsSchema = z27.record(
3908
+ extensionKindSchema,
3909
+ providerExtensionKindInfoSchema
3910
+ );
3911
+ var providerInfoSchema = z27.object({
3912
+ id: z27.string(),
3913
+ displayName: z27.string(),
3914
+ /**
3915
+ * Declared grouping key shared by related providers (the ACP agents).
3916
+ * Absent when the provider declared none. Grouping only.
3917
+ */
3918
+ family: z27.string().min(1).optional(),
3919
+ logoUrl: z27.string().min(1).nullable(),
3920
+ /** Sessionless maintenance methods declared by the provider plugin. */
3921
+ experimental_providerHealth: z27.boolean(),
3922
+ experimental_providerUsage: z27.boolean(),
3923
+ experimental_providerInstallation: z27.boolean(),
3924
+ capabilities: providerCapabilitiesSchema,
3925
+ composerActions: z27.array(providerComposerActionSchema),
3926
+ available: z27.boolean(),
3927
+ // -------------------------------------------------------------------------
3928
+ // Target-state projection (docs/provider-plugin-api.md §1). Optional and
3929
+ // unfilled until WS2a projects them from the plugin declaration; absence
3930
+ // means "the provider declared none", never a default. The `experimental_*`
3931
+ // and `capabilities.supports*` fields above stay until WS2a stabilizes the
3932
+ // surface as one unit.
3933
+ // -------------------------------------------------------------------------
3934
+ strings: providerStringsSchema.optional(),
3935
+ serviceTiers: z27.array(providerOptionDescriptorSchema).optional(),
3936
+ reasoningLevels: z27.array(providerOptionDescriptorSchema).optional(),
3937
+ extensionKinds: providerExtensionKindsSchema.optional()
3938
+ });
3939
+ var providerRecoveryKindValues = [
3940
+ "sessionArchived",
3941
+ "authRequired",
3942
+ "restartRecommended",
3943
+ "staleTurn",
3944
+ "rateLimited"
3945
+ ];
3946
+ var providerRecoveryKindSchema = z27.enum(providerRecoveryKindValues);
3947
+ var toolCallOutputItemSchema = z27.discriminatedUnion("type", [
3948
+ z27.object({
3949
+ type: z27.literal("inputText"),
3950
+ text: z27.string()
3951
+ }),
3952
+ z27.object({
3953
+ type: z27.literal("inputImage"),
3954
+ imageUrl: z27.string()
3955
+ })
3956
+ ]);
3957
+ var toolCallRequestSchema = z27.object({
3958
+ requestId: z27.union([z27.string().min(1), z27.number()]),
3959
+ threadId: z27.string().min(1),
3960
+ providerThreadId: z27.string().min(1),
3961
+ turnId: z27.string().min(1),
3962
+ callId: z27.string().min(1),
3963
+ tool: z27.string().min(1),
3964
+ arguments: z27.unknown().optional()
3965
+ });
3966
+ var toolCallResponseSchema = z27.object({
3967
+ contentItems: z27.array(toolCallOutputItemSchema),
3968
+ success: z27.boolean()
3969
+ });
3970
+ var dynamicToolSchema = z27.object({
3971
+ name: z27.string(),
3972
+ description: z27.string(),
3973
+ inputSchema: z27.unknown(),
3974
+ presentation: threadEventItemPresentationSchema.optional()
3975
+ });
3976
+
3977
+ // ../domain/src/reasoning-efforts.ts
3978
+ var NONE_REASONING_EFFORT = {
3979
+ reasoningEffort: "none",
3980
+ description: "No extended thinking"
3981
+ };
3982
+ var LOW_REASONING_EFFORT = {
3983
+ reasoningEffort: "low",
3984
+ description: "Low reasoning effort"
3985
+ };
3986
+ var MEDIUM_REASONING_EFFORT = {
3987
+ reasoningEffort: "medium",
3988
+ description: "Medium reasoning effort"
3989
+ };
3990
+ var HIGH_REASONING_EFFORT = {
3991
+ reasoningEffort: "high",
3992
+ description: "High reasoning effort"
3993
+ };
3994
+ var XHIGH_REASONING_EFFORT = {
3995
+ reasoningEffort: "xhigh",
3996
+ description: "Extra high reasoning effort"
3997
+ };
3998
+ var ULTRACODE_REASONING_EFFORT = {
3999
+ reasoningEffort: "ultracode",
4000
+ description: "Extra high reasoning effort plus multi-agent workflow orchestration"
4001
+ };
4002
+ var MAX_REASONING_EFFORT = {
4003
+ reasoningEffort: "max",
4004
+ description: "Maximum reasoning effort"
4005
+ };
4006
+ var ULTRA_REASONING_EFFORT = {
4007
+ reasoningEffort: "ultra",
4008
+ description: "Maximum reasoning with automatic task delegation"
4009
+ };
4010
+ var REASONING_EFFORT_BY_LEVEL = {
4011
+ none: NONE_REASONING_EFFORT,
4012
+ low: LOW_REASONING_EFFORT,
4013
+ medium: MEDIUM_REASONING_EFFORT,
4014
+ high: HIGH_REASONING_EFFORT,
4015
+ xhigh: XHIGH_REASONING_EFFORT,
4016
+ ultracode: ULTRACODE_REASONING_EFFORT,
4017
+ max: MAX_REASONING_EFFORT,
4018
+ ultra: ULTRA_REASONING_EFFORT
4019
+ };
4020
+ function reasoningEffortsForLevels(levels) {
4021
+ return levels.map((level) => ({ ...REASONING_EFFORT_BY_LEVEL[level] }));
4022
+ }
4023
+
4024
+ // ../domain/src/thread-git-diff.ts
4025
+ import { z as z28 } from "zod";
4026
+ var workspaceDiffTargetSchema = z28.discriminatedUnion("type", [
4027
+ z28.object({
4028
+ type: z28.literal("uncommitted")
4029
+ }),
4030
+ z28.object({
4031
+ type: z28.literal("branch_committed"),
4032
+ mergeBaseBranch: z28.string().min(1)
4033
+ }),
4034
+ z28.object({
4035
+ type: z28.literal("all"),
4036
+ mergeBaseBranch: z28.string().min(1)
4037
+ }),
4038
+ z28.object({
4039
+ type: z28.literal("commit"),
4040
+ sha: z28.string().regex(/^[0-9a-f]{4,40}$/iu)
4041
+ })
4042
+ ]);
4043
+ var rawDiffFileStatSchema = z28.object({
4044
+ path: z28.string(),
4045
+ previousPath: z28.string().nullable(),
4046
+ statusLetter: z28.enum(["A", "M", "D", "R", "C", "T"]),
4047
+ additions: z28.number().int().nonnegative(),
4048
+ deletions: z28.number().int().nonnegative(),
4049
+ binary: z28.boolean(),
4050
+ origin: z28.enum(["tracked", "untracked"])
4051
+ });
4052
+ var threadGitDiffResponseSchema = z28.object({
4053
+ diff: z28.string(),
4054
+ truncated: z28.boolean(),
4055
+ shortstat: z28.string(),
4056
+ files: z28.string(),
4057
+ /**
4058
+ * Resolved merge-base SHA for `branch_committed` / `all` targets — the
4059
+ * exact ref the diff was computed against. `null` for targets that don't
4060
+ * use a merge-base (`uncommitted`, `commit`), and also when no merge-base
4061
+ * exists (e.g. the branch has been removed locally). Callers fetching
4062
+ * per-file content for context expansion must pass this SHA as the
4063
+ * "old side" ref so the file content lines up with the diff's hunk
4064
+ * coordinates — passing the branch name reads from its current tip, which
4065
+ * may have diverged past the merge-base.
4066
+ */
4067
+ mergeBaseRef: z28.string().nullable()
4068
+ });
4069
+
4070
4070
  // ../provider-bridge-protocol/src/handshake.ts
4071
4071
  import { z as z29 } from "zod";
4072
4072
  var bridgeGrammarVersionsSchema = z29.tuple([z29.number().int().positive(), z29.number().int().positive()]).refine(([min, max]) => min <= max, {
@@ -4693,6 +4693,20 @@ var threadDeltaSchema = z35.discriminatedUnion("kind", [
4693
4693
  clientRequestId: clientTurnRequestIdSchema,
4694
4694
  providerTurnId: providerTurnIdSchema.optional()
4695
4695
  }),
4696
+ /**
4697
+ * Input the provider itself injected into the conversation, with no bb
4698
+ * client request behind it (a pi extension's `sendMessage` custom message
4699
+ * that triggered or steered a turn). The assembler records it as a
4700
+ * `userMessage` item in the open turn so the transcript shows what the
4701
+ * model was answering. Dropped silently when no turn is open: the provider
4702
+ * appended it to its own context without running the agent, so there is no
4703
+ * bb turn to attach it to.
4704
+ */
4705
+ z35.object({
4706
+ kind: z35.literal("input.provider"),
4707
+ text: z35.string().min(1),
4708
+ parentRef: deltaKeyPartSchema.optional()
4709
+ }),
4696
4710
  /**
4697
4711
  * An explicit provider signal opened work (pi `agent_start`, codex
4698
4712
  * `turn/started`). With `providerTurnId` the turn lives in the keyed
@@ -5411,8 +5425,13 @@ var threadStartCommandSchema = hostDaemonThreadTargetSchema.merge(hostDaemonThre
5411
5425
  inputGroups: z38.array(z38.array(promptInputSchema).min(1)).min(1).optional(),
5412
5426
  threadStoragePath: z38.string().min(1).optional(),
5413
5427
  /** Present means fork the new thread from this source provider session
5414
- * instead of starting fresh; absent means a normal start. */
5415
- fork: z38.object({ sourceProviderThreadId: z38.string().min(1) }).optional()
5428
+ * instead of starting fresh; absent means a normal start. The clone
5429
+ * retains the source history through `sourceProviderCheckpointId`; an
5430
+ * absent checkpoint clones the session tip. */
5431
+ fork: z38.object({
5432
+ sourceProviderThreadId: z38.string().min(1),
5433
+ sourceProviderCheckpointId: z38.string().min(1).optional()
5434
+ }).optional()
5416
5435
  }).strict().superRefine((value, ctx) => {
5417
5436
  if (value.fork === void 0 && value.input.length === 0) {
5418
5437
  ctx.addIssue({