@otto-code/protocol 0.5.0 → 0.5.1

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/messages.js CHANGED
@@ -133,13 +133,17 @@ export const MutableGitHostingConfigSchema = z
133
133
  .passthrough();
134
134
  // Canonical personality roles, in display order. Kept as an exported const so
135
135
  // the daemon and app share one vocabulary, but the wire schema stores roles as
136
- // plain strings (below) — adding an 8th role later must never break an older
137
- // peer's parsing. Consumers filter incoming role arrays to this known set.
136
+ // plain strings (below) — adding a role later must never break an older peer's
137
+ // parsing. Consumers filter incoming role arrays to this known set. The retired
138
+ // "worker" role is mapped to "coder" on the way in (see LEGACY_ROLE_ALIASES in
139
+ // agent-personalities.ts) so personalities persisted before the split keep their
140
+ // role rather than silently losing it.
138
141
  export const PERSONALITY_ROLES = [
139
142
  "chatter",
140
143
  "artificer",
141
144
  "scheduler",
142
- "worker",
145
+ "writer",
146
+ "coder",
143
147
  "judger",
144
148
  "advisor",
145
149
  "orchestrator",
@@ -1483,6 +1487,78 @@ export const CheckoutCommitRequestSchema = z.object({
1483
1487
  addAll: z.boolean().optional(),
1484
1488
  requestId: z.string(),
1485
1489
  });
1490
+ // One entry in a git operation log (the "Git Commit"/"Git Push" log panes).
1491
+ // `seq` is a per-(cwd, operation) monotonic counter used for client-side
1492
+ // dedup between backfill and live pushes.
1493
+ export const GitOperationLogEntrySchema = z.object({
1494
+ seq: z.number(),
1495
+ timestamp: z.string(),
1496
+ level: z.enum(["info", "output", "error"]),
1497
+ text: z.string(),
1498
+ });
1499
+ // Backfill for a git operation log pane. `operation` is an open string on the
1500
+ // wire ("commit" | "pull" | "push" today) so newly watchable operations don't
1501
+ // break old peers. Gated by server_info.features.checkoutGitLog.
1502
+ export const CheckoutGitGetOperationLogRequestSchema = z.object({
1503
+ type: z.literal("checkout.git.get_operation_log.request"),
1504
+ cwd: z.string(),
1505
+ operation: z.string(),
1506
+ requestId: z.string(),
1507
+ });
1508
+ export const CheckoutGitGetOperationLogResponseSchema = z.object({
1509
+ type: z.literal("checkout.git.get_operation_log.response"),
1510
+ payload: z.object({
1511
+ cwd: z.string(),
1512
+ operation: z.string(),
1513
+ entries: z.array(GitOperationLogEntrySchema),
1514
+ requestId: z.string(),
1515
+ }),
1516
+ });
1517
+ // Live append notification, broadcast to connected clients while a watched git
1518
+ // operation runs. Carries only the appended entries; `seq` orders them against
1519
+ // the backfill.
1520
+ export const CheckoutGitLogAppendedNotificationSchema = z.object({
1521
+ type: z.literal("checkout.git.log_appended.notification"),
1522
+ payload: z.object({
1523
+ cwd: z.string(),
1524
+ operation: z.string(),
1525
+ entries: z.array(GitOperationLogEntrySchema),
1526
+ }),
1527
+ });
1528
+ // Namespaced successor to checkout_commit_request: per-file selection and
1529
+ // structured errors. Gated by server_info.features.checkoutGitCommit; the flat
1530
+ // RPC stays accepted for old clients.
1531
+ export const CheckoutGitCommitRequestSchema = z.object({
1532
+ type: z.literal("checkout.git.commit.request"),
1533
+ cwd: z.string(),
1534
+ message: z.string(),
1535
+ // Repo-relative paths to stage and commit. Only these paths land in the
1536
+ // commit, even if other changes are already staged.
1537
+ paths: z.array(z.string()),
1538
+ // Set after the user confirms committing while agents are running in this
1539
+ // workspace; without it the daemon refuses with kind "agents_running".
1540
+ allowWithRunningAgents: z.boolean().optional(),
1541
+ requestId: z.string(),
1542
+ });
1543
+ // Resolve which agent the daemon would use to author a commit message for this
1544
+ // checkout (the "writer" role) so the client can name it in a confirmation
1545
+ // before running the AI-authored commit. A pure query — it never commits. Gated
1546
+ // by server_info.features.checkoutGitCommitAgent.
1547
+ export const CheckoutGitCommitAgentRequestSchema = z.object({
1548
+ type: z.literal("checkout.git.commit_agent.request"),
1549
+ cwd: z.string(),
1550
+ requestId: z.string(),
1551
+ });
1552
+ // Discard uncommitted working-tree changes for specific repo-relative paths
1553
+ // (restore tracked files from HEAD, delete newly-added files). Gated by
1554
+ // server_info.features.checkoutGitRollback.
1555
+ export const CheckoutGitRollbackRequestSchema = z.object({
1556
+ type: z.literal("checkout.git.rollback.request"),
1557
+ cwd: z.string(),
1558
+ // Repo-relative paths whose uncommitted changes should be discarded.
1559
+ paths: z.array(z.string()),
1560
+ requestId: z.string(),
1561
+ });
1486
1562
  export const CheckoutMergeRequestSchema = z.object({
1487
1563
  type: z.literal("checkout_merge_request"),
1488
1564
  cwd: z.string(),
@@ -2170,6 +2246,10 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
2170
2246
  SubscribeCheckoutDiffRequestSchema,
2171
2247
  UnsubscribeCheckoutDiffRequestSchema,
2172
2248
  CheckoutCommitRequestSchema,
2249
+ CheckoutGitCommitRequestSchema,
2250
+ CheckoutGitCommitAgentRequestSchema,
2251
+ CheckoutGitRollbackRequestSchema,
2252
+ CheckoutGitGetOperationLogRequestSchema,
2173
2253
  CheckoutMergeRequestSchema,
2174
2254
  CheckoutMergeFromBaseRequestSchema,
2175
2255
  CheckoutPullRequestSchema,
@@ -2464,6 +2544,14 @@ export const ServerInfoStatusPayloadSchema = z
2464
2544
  ttsPreview: z.boolean().optional(),
2465
2545
  // COMPAT(setAgentPersonality): added in v0.5.0, drop the gate when daemon floor >= v0.5.0.
2466
2546
  setAgentPersonality: z.boolean().optional(),
2547
+ // COMPAT(checkoutGitCommit): added in v0.5.1, drop the gate when daemon floor >= v0.5.1.
2548
+ checkoutGitCommit: z.boolean().optional(),
2549
+ // COMPAT(checkoutGitCommitAgent): added in v0.5.1, drop the gate when daemon floor >= v0.5.1.
2550
+ checkoutGitCommitAgent: z.boolean().optional(),
2551
+ // COMPAT(checkoutGitRollback): added in v0.5.1, drop the gate when daemon floor >= v0.5.1.
2552
+ checkoutGitRollback: z.boolean().optional(),
2553
+ // COMPAT(checkoutGitLog): added in v0.5.1, drop the gate when daemon floor >= v0.5.1.
2554
+ checkoutGitLog: z.boolean().optional(),
2467
2555
  })
2468
2556
  .optional(),
2469
2557
  })
@@ -3495,6 +3583,101 @@ export const CheckoutCommitResponseSchema = z.object({
3495
3583
  requestId: z.string(),
3496
3584
  }),
3497
3585
  });
3586
+ const CheckoutGitCommitRunningAgentSchema = z.object({
3587
+ id: z.string(),
3588
+ title: z.string().nullable(),
3589
+ });
3590
+ export const CheckoutGitCommitErrorSchema = z.discriminatedUnion("kind", [
3591
+ z.object({
3592
+ kind: z.literal("agents_running"),
3593
+ agents: z.array(CheckoutGitCommitRunningAgentSchema),
3594
+ }),
3595
+ z.object({
3596
+ kind: z.literal("identity_missing"),
3597
+ missingName: z.boolean(),
3598
+ missingEmail: z.boolean(),
3599
+ }),
3600
+ z.object({
3601
+ kind: z.literal("hook_failed"),
3602
+ output: z.string(),
3603
+ exitCode: z.number().nullable(),
3604
+ }),
3605
+ z.object({
3606
+ kind: z.literal("signing_failed"),
3607
+ detail: z.string(),
3608
+ }),
3609
+ z.object({
3610
+ kind: z.literal("nothing_to_commit"),
3611
+ }),
3612
+ z.object({
3613
+ kind: z.literal("git_failed"),
3614
+ detail: z.string(),
3615
+ }),
3616
+ ]);
3617
+ export const CheckoutGitCommitResponseSchema = z.object({
3618
+ type: z.literal("checkout.git.commit.response"),
3619
+ payload: z.object({
3620
+ cwd: z.string(),
3621
+ success: z.boolean(),
3622
+ commitSha: z.string().nullable(),
3623
+ error: CheckoutGitCommitErrorSchema.nullable(),
3624
+ requestId: z.string(),
3625
+ }),
3626
+ });
3627
+ // The agent the daemon resolved to author a commit message. "personality" when
3628
+ // an available role-matched Agent Personality wins the mini-task routing (its
3629
+ // name plus the bound provider/model); "provider" when a bare provider/model is
3630
+ // used instead; "none" when nothing is configured to run the task, in which case
3631
+ // the client refuses the AI commit rather than falling back to placeholder text.
3632
+ export const CommitMessageAgentSchema = z.discriminatedUnion("kind", [
3633
+ z.object({
3634
+ kind: z.literal("personality"),
3635
+ personalityId: z.string(),
3636
+ personalityName: z.string(),
3637
+ provider: z.string(),
3638
+ providerLabel: z.string(),
3639
+ model: z.string().nullable(),
3640
+ modelLabel: z.string().nullable(),
3641
+ }),
3642
+ z.object({
3643
+ kind: z.literal("provider"),
3644
+ provider: z.string(),
3645
+ providerLabel: z.string(),
3646
+ model: z.string().nullable(),
3647
+ modelLabel: z.string().nullable(),
3648
+ }),
3649
+ z.object({
3650
+ kind: z.literal("none"),
3651
+ }),
3652
+ ]);
3653
+ export const CheckoutGitCommitAgentResponseSchema = z.object({
3654
+ type: z.literal("checkout.git.commit_agent.response"),
3655
+ payload: z.object({
3656
+ cwd: z.string(),
3657
+ agent: CommitMessageAgentSchema,
3658
+ requestId: z.string(),
3659
+ }),
3660
+ });
3661
+ export const CheckoutGitRollbackErrorSchema = z.discriminatedUnion("kind", [
3662
+ z.object({
3663
+ kind: z.literal("nothing_to_rollback"),
3664
+ }),
3665
+ z.object({
3666
+ kind: z.literal("git_failed"),
3667
+ detail: z.string(),
3668
+ }),
3669
+ ]);
3670
+ export const CheckoutGitRollbackResponseSchema = z.object({
3671
+ type: z.literal("checkout.git.rollback.response"),
3672
+ payload: z.object({
3673
+ cwd: z.string(),
3674
+ success: z.boolean(),
3675
+ // Repo-relative paths whose changes were discarded.
3676
+ rolledBackPaths: z.array(z.string()),
3677
+ error: CheckoutGitRollbackErrorSchema.nullable(),
3678
+ requestId: z.string(),
3679
+ }),
3680
+ });
3498
3681
  export const CheckoutMergeResponseSchema = z.object({
3499
3682
  type: z.literal("checkout_merge_response"),
3500
3683
  payload: z.object({
@@ -4535,6 +4718,11 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
4535
4718
  SubscribeCheckoutDiffResponseSchema,
4536
4719
  CheckoutDiffUpdateSchema,
4537
4720
  CheckoutCommitResponseSchema,
4721
+ CheckoutGitCommitResponseSchema,
4722
+ CheckoutGitCommitAgentResponseSchema,
4723
+ CheckoutGitRollbackResponseSchema,
4724
+ CheckoutGitGetOperationLogResponseSchema,
4725
+ CheckoutGitLogAppendedNotificationSchema,
4538
4726
  CheckoutMergeResponseSchema,
4539
4727
  CheckoutMergeFromBaseResponseSchema,
4540
4728
  CheckoutPullResponseSchema,
@@ -4297,6 +4297,107 @@ export declare const WSOutboundMessageSchema: {
4297
4297
  }, import("zod/v4/core").$strip>>;
4298
4298
  requestId: import("zod").ZodString;
4299
4299
  }, import("zod/v4/core").$strip>;
4300
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4301
+ type: import("zod").ZodLiteral<"checkout.git.commit.response">;
4302
+ payload: import("zod").ZodObject<{
4303
+ cwd: import("zod").ZodString;
4304
+ success: import("zod").ZodBoolean;
4305
+ commitSha: import("zod").ZodNullable<import("zod").ZodString>;
4306
+ error: import("zod").ZodNullable<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
4307
+ kind: import("zod").ZodLiteral<"agents_running">;
4308
+ agents: import("zod").ZodArray<import("zod").ZodObject<{
4309
+ id: import("zod").ZodString;
4310
+ title: import("zod").ZodNullable<import("zod").ZodString>;
4311
+ }, import("zod/v4/core").$strip>>;
4312
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4313
+ kind: import("zod").ZodLiteral<"identity_missing">;
4314
+ missingName: import("zod").ZodBoolean;
4315
+ missingEmail: import("zod").ZodBoolean;
4316
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4317
+ kind: import("zod").ZodLiteral<"hook_failed">;
4318
+ output: import("zod").ZodString;
4319
+ exitCode: import("zod").ZodNullable<import("zod").ZodNumber>;
4320
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4321
+ kind: import("zod").ZodLiteral<"signing_failed">;
4322
+ detail: import("zod").ZodString;
4323
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4324
+ kind: import("zod").ZodLiteral<"nothing_to_commit">;
4325
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4326
+ kind: import("zod").ZodLiteral<"git_failed">;
4327
+ detail: import("zod").ZodString;
4328
+ }, import("zod/v4/core").$strip>], "kind">>;
4329
+ requestId: import("zod").ZodString;
4330
+ }, import("zod/v4/core").$strip>;
4331
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4332
+ type: import("zod").ZodLiteral<"checkout.git.commit_agent.response">;
4333
+ payload: import("zod").ZodObject<{
4334
+ cwd: import("zod").ZodString;
4335
+ agent: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
4336
+ kind: import("zod").ZodLiteral<"personality">;
4337
+ personalityId: import("zod").ZodString;
4338
+ personalityName: import("zod").ZodString;
4339
+ provider: import("zod").ZodString;
4340
+ providerLabel: import("zod").ZodString;
4341
+ model: import("zod").ZodNullable<import("zod").ZodString>;
4342
+ modelLabel: import("zod").ZodNullable<import("zod").ZodString>;
4343
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4344
+ kind: import("zod").ZodLiteral<"provider">;
4345
+ provider: import("zod").ZodString;
4346
+ providerLabel: import("zod").ZodString;
4347
+ model: import("zod").ZodNullable<import("zod").ZodString>;
4348
+ modelLabel: import("zod").ZodNullable<import("zod").ZodString>;
4349
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4350
+ kind: import("zod").ZodLiteral<"none">;
4351
+ }, import("zod/v4/core").$strip>], "kind">;
4352
+ requestId: import("zod").ZodString;
4353
+ }, import("zod/v4/core").$strip>;
4354
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4355
+ type: import("zod").ZodLiteral<"checkout.git.rollback.response">;
4356
+ payload: import("zod").ZodObject<{
4357
+ cwd: import("zod").ZodString;
4358
+ success: import("zod").ZodBoolean;
4359
+ rolledBackPaths: import("zod").ZodArray<import("zod").ZodString>;
4360
+ error: import("zod").ZodNullable<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
4361
+ kind: import("zod").ZodLiteral<"nothing_to_rollback">;
4362
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4363
+ kind: import("zod").ZodLiteral<"git_failed">;
4364
+ detail: import("zod").ZodString;
4365
+ }, import("zod/v4/core").$strip>], "kind">>;
4366
+ requestId: import("zod").ZodString;
4367
+ }, import("zod/v4/core").$strip>;
4368
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4369
+ type: import("zod").ZodLiteral<"checkout.git.get_operation_log.response">;
4370
+ payload: import("zod").ZodObject<{
4371
+ cwd: import("zod").ZodString;
4372
+ operation: import("zod").ZodString;
4373
+ entries: import("zod").ZodArray<import("zod").ZodObject<{
4374
+ seq: import("zod").ZodNumber;
4375
+ timestamp: import("zod").ZodString;
4376
+ level: import("zod").ZodEnum<{
4377
+ error: "error";
4378
+ output: "output";
4379
+ info: "info";
4380
+ }>;
4381
+ text: import("zod").ZodString;
4382
+ }, import("zod/v4/core").$strip>>;
4383
+ requestId: import("zod").ZodString;
4384
+ }, import("zod/v4/core").$strip>;
4385
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4386
+ type: import("zod").ZodLiteral<"checkout.git.log_appended.notification">;
4387
+ payload: import("zod").ZodObject<{
4388
+ cwd: import("zod").ZodString;
4389
+ operation: import("zod").ZodString;
4390
+ entries: import("zod").ZodArray<import("zod").ZodObject<{
4391
+ seq: import("zod").ZodNumber;
4392
+ timestamp: import("zod").ZodString;
4393
+ level: import("zod").ZodEnum<{
4394
+ error: "error";
4395
+ output: "output";
4396
+ info: "info";
4397
+ }>;
4398
+ text: import("zod").ZodString;
4399
+ }, import("zod/v4/core").$strip>>;
4400
+ }, import("zod/v4/core").$strip>;
4300
4401
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4301
4402
  type: import("zod").ZodLiteral<"checkout_merge_response">;
4302
4403
  payload: import("zod").ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otto-code/protocol",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Otto shared protocol schemas and wire types",
5
5
  "files": [
6
6
  "dist",