@otto-code/protocol 0.8.10 → 0.8.12

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.
Files changed (60) hide show
  1. package/dist/agent-queue.d.ts +87 -0
  2. package/dist/agent-queue.js +106 -0
  3. package/dist/brain.d.ts +2321 -0
  4. package/dist/brain.js +1082 -0
  5. package/dist/client-capabilities.d.ts +2 -0
  6. package/dist/client-capabilities.js +10 -0
  7. package/dist/code-intelligence.d.ts +917 -0
  8. package/dist/code-intelligence.js +699 -0
  9. package/dist/communications.d.ts +1106 -0
  10. package/dist/communications.js +384 -0
  11. package/dist/context.d.ts +787 -0
  12. package/dist/context.js +295 -0
  13. package/dist/daemon-config.d.ts +377 -0
  14. package/dist/daemon-config.js +395 -0
  15. package/dist/file-operations.d.ts +380 -0
  16. package/dist/file-operations.js +282 -0
  17. package/dist/generated/validation/ws-outbound.aot.js +54927 -48878
  18. package/dist/git-hosting.d.ts +117 -0
  19. package/dist/git-hosting.js +109 -0
  20. package/dist/git-operations.d.ts +255 -0
  21. package/dist/git-operations.js +221 -0
  22. package/dist/integration-authorization.d.ts +195 -0
  23. package/dist/integration-authorization.js +125 -0
  24. package/dist/kanban.d.ts +341 -0
  25. package/dist/kanban.js +273 -0
  26. package/dist/loop/rpc-schemas.d.ts +6 -6
  27. package/dist/meetings.d.ts +95 -0
  28. package/dist/meetings.js +57 -0
  29. package/dist/messages.d.ts +21054 -24042
  30. package/dist/messages.js +4355 -8731
  31. package/dist/orchestration.d.ts +726 -0
  32. package/dist/orchestration.js +232 -0
  33. package/dist/personality-schemas.d.ts +221 -0
  34. package/dist/personality-schemas.js +340 -0
  35. package/dist/preview.d.ts +140 -0
  36. package/dist/preview.js +98 -0
  37. package/dist/project-knowledge.d.ts +740 -0
  38. package/dist/project-knowledge.js +229 -0
  39. package/dist/project-links.d.ts +102 -0
  40. package/dist/project-links.js +62 -0
  41. package/dist/provider-config.d.ts +87 -2
  42. package/dist/provider-config.js +110 -0
  43. package/dist/refine.d.ts +93 -0
  44. package/dist/refine.js +78 -0
  45. package/dist/schedule/rpc-schemas.d.ts +47 -47
  46. package/dist/schedule/types.d.ts +13 -13
  47. package/dist/speech.d.ts +180 -0
  48. package/dist/speech.js +177 -0
  49. package/dist/storage.d.ts +79 -0
  50. package/dist/storage.js +107 -0
  51. package/dist/suggested-tasks.d.ts +106 -0
  52. package/dist/suggested-tasks.js +81 -0
  53. package/dist/terminal-compatibility.d.ts +55 -0
  54. package/dist/terminal-compatibility.js +35 -0
  55. package/dist/usage-stats.d.ts +255 -0
  56. package/dist/usage-stats.js +162 -0
  57. package/dist/validation/ws-outbound-schema-metadata.d.ts +1404 -274
  58. package/dist/worktree-ops.d.ts +81 -0
  59. package/dist/worktree-ops.js +88 -0
  60. package/package.json +1 -1
@@ -0,0 +1,221 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Otto git-operation wire schemas: the checkout.git.* commit, rollback, operation-log, blame and file-history RPCs and pushes. Fork-only capability, so it owns its schemas; messages.ts re-exports them. The checkout.git.file_* and fetch RPCs stay in messages.ts because they embed Paseo's ParsedDiffFileSchema and CheckoutErrorSchema.
4
+ */
5
+ // One entry in a git operation log (the "Git Commit"/"Git Push" log panes).
6
+ // `seq` is a per-(cwd, operation) monotonic counter used for client-side
7
+ // dedup between backfill and live pushes.
8
+ export const GitOperationLogEntrySchema = z.object({
9
+ seq: z.number(),
10
+ timestamp: z.string(),
11
+ level: z.enum(["info", "output", "error"]),
12
+ text: z.string(),
13
+ });
14
+ // Backfill for a git operation log pane. `operation` is an open string on the
15
+ // wire ("commit" | "pull" | "push" today) so newly watchable operations don't
16
+ // break old peers. Gated by server_info.features.checkoutGitLog.
17
+ export const CheckoutGitGetOperationLogRequestSchema = z.object({
18
+ type: z.literal("checkout.git.get_operation_log.request"),
19
+ cwd: z.string(),
20
+ operation: z.string(),
21
+ requestId: z.string(),
22
+ });
23
+ export const CheckoutGitGetOperationLogResponseSchema = z.object({
24
+ type: z.literal("checkout.git.get_operation_log.response"),
25
+ payload: z.object({
26
+ cwd: z.string(),
27
+ operation: z.string(),
28
+ entries: z.array(GitOperationLogEntrySchema),
29
+ requestId: z.string(),
30
+ }),
31
+ });
32
+ // Live append notification, broadcast to connected clients while a watched git
33
+ // operation runs. Carries only the appended entries; `seq` orders them against
34
+ // the backfill.
35
+ export const CheckoutGitLogAppendedNotificationSchema = z.object({
36
+ type: z.literal("checkout.git.log_appended.notification"),
37
+ payload: z.object({
38
+ cwd: z.string(),
39
+ operation: z.string(),
40
+ entries: z.array(GitOperationLogEntrySchema),
41
+ }),
42
+ });
43
+ // Namespaced successor to checkout_commit_request: per-file selection and
44
+ // structured errors. Gated by server_info.features.checkoutGitCommit; the flat
45
+ // RPC stays accepted for old clients.
46
+ export const CheckoutGitCommitRequestSchema = z.object({
47
+ type: z.literal("checkout.git.commit.request"),
48
+ cwd: z.string(),
49
+ message: z.string(),
50
+ // Repo-relative paths to stage and commit. Only these paths land in the
51
+ // commit, even if other changes are already staged.
52
+ paths: z.array(z.string()),
53
+ // Set after the user confirms committing while agents are running in this
54
+ // workspace; without it the daemon refuses with kind "agents_running".
55
+ allowWithRunningAgents: z.boolean().optional(),
56
+ requestId: z.string(),
57
+ });
58
+ // Resolve which agent the daemon would use to author a commit message for this
59
+ // checkout (the "writer" role) so the client can name it in a confirmation
60
+ // before running the AI-authored commit. A pure query - it never commits. Gated
61
+ // by server_info.features.checkoutGitCommitAgent.
62
+ export const CheckoutGitCommitAgentRequestSchema = z.object({
63
+ type: z.literal("checkout.git.commit_agent.request"),
64
+ cwd: z.string(),
65
+ requestId: z.string(),
66
+ });
67
+ // Discard uncommitted working-tree changes for specific repo-relative paths
68
+ // (restore tracked files from HEAD, delete newly-added files). Gated by
69
+ // server_info.features.checkoutGitRollback.
70
+ export const CheckoutGitRollbackRequestSchema = z.object({
71
+ type: z.literal("checkout.git.rollback.request"),
72
+ cwd: z.string(),
73
+ // Repo-relative paths whose uncommitted changes should be discarded.
74
+ paths: z.array(z.string()),
75
+ // Set after the user confirms rolling back while agents are running in this
76
+ // workspace; without it the daemon refuses with kind "agents_running", since
77
+ // discarding a live agent's uncommitted edits mid-run can destroy its work.
78
+ allowWithRunningAgents: z.boolean().optional(),
79
+ requestId: z.string(),
80
+ });
81
+ export const CheckoutGitCommitRunningAgentSchema = z.object({
82
+ id: z.string(),
83
+ title: z.string().nullable(),
84
+ });
85
+ export const CheckoutGitCommitErrorSchema = z.discriminatedUnion("kind", [
86
+ z.object({
87
+ kind: z.literal("agents_running"),
88
+ agents: z.array(CheckoutGitCommitRunningAgentSchema),
89
+ }),
90
+ z.object({
91
+ kind: z.literal("identity_missing"),
92
+ missingName: z.boolean(),
93
+ missingEmail: z.boolean(),
94
+ }),
95
+ z.object({
96
+ kind: z.literal("hook_failed"),
97
+ output: z.string(),
98
+ exitCode: z.number().nullable(),
99
+ }),
100
+ z.object({
101
+ kind: z.literal("signing_failed"),
102
+ detail: z.string(),
103
+ }),
104
+ z.object({
105
+ kind: z.literal("nothing_to_commit"),
106
+ }),
107
+ z.object({
108
+ kind: z.literal("git_failed"),
109
+ detail: z.string(),
110
+ }),
111
+ ]);
112
+ export const CheckoutGitCommitResponseSchema = z.object({
113
+ type: z.literal("checkout.git.commit.response"),
114
+ payload: z.object({
115
+ cwd: z.string(),
116
+ success: z.boolean(),
117
+ commitSha: z.string().nullable(),
118
+ error: CheckoutGitCommitErrorSchema.nullable(),
119
+ requestId: z.string(),
120
+ }),
121
+ });
122
+ // The agent the daemon resolved to author a commit message. "personality" when
123
+ // an available role-matched Agent Personality wins the mini-task routing (its
124
+ // name plus the bound provider/model); "provider" when a bare provider/model is
125
+ // used instead; "none" when nothing is configured to run the task, in which case
126
+ // the client refuses the AI commit rather than falling back to placeholder text.
127
+ export const CommitMessageAgentSchema = z.discriminatedUnion("kind", [
128
+ z.object({
129
+ kind: z.literal("personality"),
130
+ personalityId: z.string(),
131
+ personalityName: z.string(),
132
+ provider: z.string(),
133
+ providerLabel: z.string(),
134
+ model: z.string().nullable(),
135
+ modelLabel: z.string().nullable(),
136
+ }),
137
+ z.object({
138
+ kind: z.literal("provider"),
139
+ provider: z.string(),
140
+ providerLabel: z.string(),
141
+ model: z.string().nullable(),
142
+ modelLabel: z.string().nullable(),
143
+ }),
144
+ z.object({
145
+ kind: z.literal("none"),
146
+ }),
147
+ ]);
148
+ export const CheckoutGitCommitAgentResponseSchema = z.object({
149
+ type: z.literal("checkout.git.commit_agent.response"),
150
+ payload: z.object({
151
+ cwd: z.string(),
152
+ agent: CommitMessageAgentSchema,
153
+ requestId: z.string(),
154
+ }),
155
+ });
156
+ export const CheckoutGitRollbackErrorSchema = z.discriminatedUnion("kind", [
157
+ z.object({
158
+ kind: z.literal("nothing_to_rollback"),
159
+ }),
160
+ z.object({
161
+ kind: z.literal("git_failed"),
162
+ detail: z.string(),
163
+ }),
164
+ // Refused because agents are running in this workspace; discarding their
165
+ // uncommitted edits mid-run risks destroying work. The client re-sends with
166
+ // allowWithRunningAgents after confirming, mirroring the commit flow.
167
+ z.object({
168
+ kind: z.literal("agents_running"),
169
+ agents: z.array(CheckoutGitCommitRunningAgentSchema),
170
+ }),
171
+ ]);
172
+ export const CheckoutGitRollbackResponseSchema = z.object({
173
+ type: z.literal("checkout.git.rollback.response"),
174
+ payload: z.object({
175
+ cwd: z.string(),
176
+ success: z.boolean(),
177
+ // Repo-relative paths whose changes were discarded.
178
+ rolledBackPaths: z.array(z.string()),
179
+ error: CheckoutGitRollbackErrorSchema.nullable(),
180
+ requestId: z.string(),
181
+ }),
182
+ });
183
+ export const GitFileHistoryEntrySchema = z.object({
184
+ sha: z.string(),
185
+ shortSha: z.string(),
186
+ subject: z.string(),
187
+ body: z.string(),
188
+ authorName: z.string(),
189
+ authorEmail: z.string(),
190
+ // Unix seconds.
191
+ authoredAt: z.number(),
192
+ committerName: z.string(),
193
+ committedAt: z.number(),
194
+ // The file's name at this commit - differs from the requested path across a
195
+ // rename. Diff requests must echo this one back, not the current name.
196
+ path: z.string(),
197
+ previousPath: z.string().optional(),
198
+ // Single-letter git status (A/M/D/R/C).
199
+ changeKind: z.string().optional(),
200
+ isMerge: z.boolean(),
201
+ // Parent object names, so a diff view can name the revision it is comparing
202
+ // against instead of writing "<sha>^". Empty for a root commit.
203
+ parentShas: z.array(z.string()).optional(),
204
+ });
205
+ export const GitBlameLineSchema = z.object({
206
+ line: z.number(),
207
+ sha: z.string(),
208
+ originalLine: z.number(),
209
+ });
210
+ // Blame commit metadata is deduped by sha rather than inlined per line: a
211
+ // thousand-line page usually references a handful of commits.
212
+ export const GitBlameCommitSchema = z.object({
213
+ sha: z.string(),
214
+ shortSha: z.string(),
215
+ summary: z.string(),
216
+ authorName: z.string(),
217
+ authorEmail: z.string(),
218
+ authoredAt: z.number(),
219
+ path: z.string().optional(),
220
+ });
221
+ //# sourceMappingURL=git-operations.js.map
@@ -0,0 +1,195 @@
1
+ import { z } from "zod";
2
+ /** Nonsecret credential methods Otto may present through one Connect flow. */
3
+ export declare const IntegrationAuthorizationMethodSchema: z.ZodString;
4
+ /**
5
+ * Lifecycle state safe to project to a frontend. Secrets and callback material
6
+ * deliberately have no schema here, so they cannot leak through this contract.
7
+ */
8
+ export declare const IntegrationConnectionStateSchema: z.ZodEnum<{
9
+ error: "error";
10
+ disconnected: "disconnected";
11
+ connected: "connected";
12
+ reauth_required: "reauth_required";
13
+ authorizing: "authorizing";
14
+ }>;
15
+ export declare const IntegrationConnectionMetadataSchema: z.ZodObject<{
16
+ integrationId: z.ZodString;
17
+ connectionId: z.ZodString;
18
+ method: z.ZodString;
19
+ state: z.ZodEnum<{
20
+ error: "error";
21
+ disconnected: "disconnected";
22
+ connected: "connected";
23
+ reauth_required: "reauth_required";
24
+ authorizing: "authorizing";
25
+ }>;
26
+ accountLabel: z.ZodNullable<z.ZodString>;
27
+ grantedScopes: z.ZodArray<z.ZodString>;
28
+ updatedAt: z.ZodString;
29
+ errorCode: z.ZodNullable<z.ZodString>;
30
+ enabled: z.ZodOptional<z.ZodBoolean>;
31
+ }, z.core.$strip>;
32
+ /** A host-safe projection of whether secure storage can accept credentials. */
33
+ export declare const CredentialVaultAvailabilitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ status: z.ZodLiteral<"available">;
35
+ backend: z.ZodString;
36
+ }, z.core.$strip>, z.ZodObject<{
37
+ status: z.ZodLiteral<"unavailable">;
38
+ reason: z.ZodString;
39
+ }, z.core.$strip>], "status">;
40
+ /**
41
+ * The settings-safe authorization projection. It is deliberately limited to
42
+ * connection metadata and vault readiness: browser callbacks and credentials
43
+ * never cross this boundary.
44
+ */
45
+ export declare const IntegrationAuthorizationOverviewSchema: z.ZodObject<{
46
+ vault: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ status: z.ZodLiteral<"available">;
48
+ backend: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ status: z.ZodLiteral<"unavailable">;
51
+ reason: z.ZodString;
52
+ }, z.core.$strip>], "status">;
53
+ connections: z.ZodArray<z.ZodObject<{
54
+ integrationId: z.ZodString;
55
+ connectionId: z.ZodString;
56
+ method: z.ZodString;
57
+ state: z.ZodEnum<{
58
+ error: "error";
59
+ disconnected: "disconnected";
60
+ connected: "connected";
61
+ reauth_required: "reauth_required";
62
+ authorizing: "authorizing";
63
+ }>;
64
+ accountLabel: z.ZodNullable<z.ZodString>;
65
+ grantedScopes: z.ZodArray<z.ZodString>;
66
+ updatedAt: z.ZodString;
67
+ errorCode: z.ZodNullable<z.ZodString>;
68
+ enabled: z.ZodOptional<z.ZodBoolean>;
69
+ }, z.core.$strip>>;
70
+ }, z.core.$strip>;
71
+ /**
72
+ * A nonsecret connection choice rendered by a future Integration settings
73
+ * surface. The method is intentionally a string rather than an enum so new
74
+ * providers can add a legitimate OAuth/device/API-key flow without breaking an
75
+ * older wire parser.
76
+ */
77
+ export declare const IntegrationAuthorizationMethodOptionSchema: z.ZodObject<{
78
+ integrationId: z.ZodString;
79
+ method: z.ZodString;
80
+ label: z.ZodString;
81
+ description: z.ZodString;
82
+ recommended: z.ZodBoolean;
83
+ availability: z.ZodEnum<{
84
+ available: "available";
85
+ planned: "planned";
86
+ }>;
87
+ }, z.core.$strip>;
88
+ export type IntegrationAuthorizationMethod = z.infer<typeof IntegrationAuthorizationMethodSchema>;
89
+ export type IntegrationConnectionState = z.infer<typeof IntegrationConnectionStateSchema>;
90
+ export type IntegrationConnectionMetadata = z.infer<typeof IntegrationConnectionMetadataSchema>;
91
+ export type CredentialVaultAvailability = z.infer<typeof CredentialVaultAvailabilitySchema>;
92
+ export type IntegrationAuthorizationOverview = z.infer<typeof IntegrationAuthorizationOverviewSchema>;
93
+ export type IntegrationAuthorizationMethodOption = z.infer<typeof IntegrationAuthorizationMethodOptionSchema>;
94
+ export declare const IntegrationsAuthorizationGetOverviewRequestSchema: z.ZodObject<{
95
+ type: z.ZodLiteral<"integrations.authorization.get_overview.request">;
96
+ requestId: z.ZodString;
97
+ }, z.core.$strip>;
98
+ export declare const IntegrationsAuthorizationGetOverviewResponseSchema: z.ZodObject<{
99
+ type: z.ZodLiteral<"integrations.authorization.get_overview.response">;
100
+ payload: z.ZodObject<{
101
+ overview: z.ZodObject<{
102
+ vault: z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ status: z.ZodLiteral<"available">;
104
+ backend: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ status: z.ZodLiteral<"unavailable">;
107
+ reason: z.ZodString;
108
+ }, z.core.$strip>], "status">;
109
+ connections: z.ZodArray<z.ZodObject<{
110
+ integrationId: z.ZodString;
111
+ connectionId: z.ZodString;
112
+ method: z.ZodString;
113
+ state: z.ZodEnum<{
114
+ error: "error";
115
+ disconnected: "disconnected";
116
+ connected: "connected";
117
+ reauth_required: "reauth_required";
118
+ authorizing: "authorizing";
119
+ }>;
120
+ accountLabel: z.ZodNullable<z.ZodString>;
121
+ grantedScopes: z.ZodArray<z.ZodString>;
122
+ updatedAt: z.ZodString;
123
+ errorCode: z.ZodNullable<z.ZodString>;
124
+ enabled: z.ZodOptional<z.ZodBoolean>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
127
+ requestId: z.ZodString;
128
+ }, z.core.$strip>;
129
+ }, z.core.$strip>;
130
+ export type IntegrationsAuthorizationGetOverviewRequest = z.infer<typeof IntegrationsAuthorizationGetOverviewRequestSchema>;
131
+ export type IntegrationsAuthorizationGetOverviewResponse = z.infer<typeof IntegrationsAuthorizationGetOverviewResponseSchema>;
132
+ /**
133
+ * List daemon-supported, nonsecret authorization methods for integration
134
+ * settings. Availability is explicit so a client never offers a flow the host
135
+ * has not implemented yet. Gated by features.integrationAuthorization.
136
+ */
137
+ export declare const IntegrationsAuthorizationGetMethodsRequestSchema: z.ZodObject<{
138
+ type: z.ZodLiteral<"integrations.authorization.get_methods.request">;
139
+ requestId: z.ZodString;
140
+ integrationId: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strip>;
142
+ export declare const IntegrationsAuthorizationGetMethodsResponseSchema: z.ZodObject<{
143
+ type: z.ZodLiteral<"integrations.authorization.get_methods.response">;
144
+ payload: z.ZodObject<{
145
+ methods: z.ZodArray<z.ZodObject<{
146
+ integrationId: z.ZodString;
147
+ method: z.ZodString;
148
+ label: z.ZodString;
149
+ description: z.ZodString;
150
+ recommended: z.ZodBoolean;
151
+ availability: z.ZodEnum<{
152
+ available: "available";
153
+ planned: "planned";
154
+ }>;
155
+ }, z.core.$strip>>;
156
+ requestId: z.ZodString;
157
+ }, z.core.$strip>;
158
+ }, z.core.$strip>;
159
+ export type IntegrationsAuthorizationGetMethodsRequest = z.infer<typeof IntegrationsAuthorizationGetMethodsRequestSchema>;
160
+ export type IntegrationsAuthorizationGetMethodsResponse = z.infer<typeof IntegrationsAuthorizationGetMethodsResponseSchema>;
161
+ /**
162
+ * Starts a daemon-owned browser sign-in through the registered integration
163
+ * driver. Authorization codes and credentials remain daemon-only.
164
+ * Gated by features.integrationAuthorizationBrowserFlow.
165
+ */
166
+ export declare const IntegrationsAuthorizationStartBrowserRequestSchema: z.ZodObject<{
167
+ type: z.ZodLiteral<"integrations.authorization.start_browser.request">;
168
+ requestId: z.ZodString;
169
+ integrationId: z.ZodString;
170
+ connectionId: z.ZodString;
171
+ }, z.core.$strip>;
172
+ export declare const IntegrationsAuthorizationStartBrowserResponseSchema: z.ZodObject<{
173
+ type: z.ZodLiteral<"integrations.authorization.start_browser.response">;
174
+ payload: z.ZodObject<{
175
+ authorizationUrl: z.ZodNullable<z.ZodString>;
176
+ error: z.ZodNullable<z.ZodString>;
177
+ requestId: z.ZodString;
178
+ }, z.core.$strip>;
179
+ }, z.core.$strip>;
180
+ export type IntegrationsAuthorizationStartBrowserResponse = z.infer<typeof IntegrationsAuthorizationStartBrowserResponseSchema>;
181
+ /** Starts the configured daemon-owned Zoom PKCE browser flow. */
182
+ export declare const IntegrationsZoomStartAuthorizationRequestSchema: z.ZodObject<{
183
+ type: z.ZodLiteral<"integrations.zoom.start_authorization.request">;
184
+ requestId: z.ZodString;
185
+ }, z.core.$strip>;
186
+ export declare const IntegrationsZoomStartAuthorizationResponseSchema: z.ZodObject<{
187
+ type: z.ZodLiteral<"integrations.zoom.start_authorization.response">;
188
+ payload: z.ZodObject<{
189
+ authorizationUrl: z.ZodNullable<z.ZodString>;
190
+ error: z.ZodNullable<z.ZodString>;
191
+ requestId: z.ZodString;
192
+ }, z.core.$strip>;
193
+ }, z.core.$strip>;
194
+ export type IntegrationsZoomStartAuthorizationResponse = z.infer<typeof IntegrationsZoomStartAuthorizationResponseSchema>;
195
+ //# sourceMappingURL=integration-authorization.d.ts.map
@@ -0,0 +1,125 @@
1
+ import { z } from "zod";
2
+ /** Nonsecret credential methods Otto may present through one Connect flow. */
3
+ export const IntegrationAuthorizationMethodSchema = z.string().trim().min(1);
4
+ /**
5
+ * Lifecycle state safe to project to a frontend. Secrets and callback material
6
+ * deliberately have no schema here, so they cannot leak through this contract.
7
+ */
8
+ export const IntegrationConnectionStateSchema = z.enum([
9
+ "disconnected",
10
+ "authorizing",
11
+ "connected",
12
+ "reauth_required",
13
+ "error",
14
+ ]);
15
+ export const IntegrationConnectionMetadataSchema = z.object({
16
+ integrationId: z.string().trim().min(1),
17
+ connectionId: z.string().trim().min(1),
18
+ method: IntegrationAuthorizationMethodSchema,
19
+ state: IntegrationConnectionStateSchema,
20
+ accountLabel: z.string().nullable(),
21
+ grantedScopes: z.array(z.string()),
22
+ updatedAt: z.string().datetime(),
23
+ errorCode: z.string().nullable(),
24
+ /** Nonsecret daemon-owned availability, independent of authorization state. */
25
+ enabled: z.boolean().optional(),
26
+ });
27
+ /** A host-safe projection of whether secure storage can accept credentials. */
28
+ export const CredentialVaultAvailabilitySchema = z.discriminatedUnion("status", [
29
+ z.object({
30
+ status: z.literal("available"),
31
+ backend: z.string().trim().min(1),
32
+ }),
33
+ z.object({
34
+ status: z.literal("unavailable"),
35
+ reason: z.string().trim().min(1),
36
+ }),
37
+ ]);
38
+ /**
39
+ * The settings-safe authorization projection. It is deliberately limited to
40
+ * connection metadata and vault readiness: browser callbacks and credentials
41
+ * never cross this boundary.
42
+ */
43
+ export const IntegrationAuthorizationOverviewSchema = z.object({
44
+ vault: CredentialVaultAvailabilitySchema,
45
+ connections: z.array(IntegrationConnectionMetadataSchema),
46
+ });
47
+ /**
48
+ * A nonsecret connection choice rendered by a future Integration settings
49
+ * surface. The method is intentionally a string rather than an enum so new
50
+ * providers can add a legitimate OAuth/device/API-key flow without breaking an
51
+ * older wire parser.
52
+ */
53
+ export const IntegrationAuthorizationMethodOptionSchema = z.object({
54
+ integrationId: z.string().trim().min(1),
55
+ method: IntegrationAuthorizationMethodSchema,
56
+ label: z.string().trim().min(1),
57
+ description: z.string().trim().min(1),
58
+ recommended: z.boolean(),
59
+ availability: z.enum(["available", "planned"]),
60
+ });
61
+ // Settings pages use this generic, daemon-owned projection to render reusable
62
+ // integration connection state. OAuth drivers and API-key entry remain outside
63
+ // the wire contract until their provider-specific implementation exists.
64
+ // Gated by features.integrationAuthorization.
65
+ export const IntegrationsAuthorizationGetOverviewRequestSchema = z.object({
66
+ type: z.literal("integrations.authorization.get_overview.request"),
67
+ requestId: z.string(),
68
+ });
69
+ export const IntegrationsAuthorizationGetOverviewResponseSchema = z.object({
70
+ type: z.literal("integrations.authorization.get_overview.response"),
71
+ payload: z.object({
72
+ overview: IntegrationAuthorizationOverviewSchema,
73
+ requestId: z.string(),
74
+ }),
75
+ });
76
+ /**
77
+ * List daemon-supported, nonsecret authorization methods for integration
78
+ * settings. Availability is explicit so a client never offers a flow the host
79
+ * has not implemented yet. Gated by features.integrationAuthorization.
80
+ */
81
+ export const IntegrationsAuthorizationGetMethodsRequestSchema = z.object({
82
+ type: z.literal("integrations.authorization.get_methods.request"),
83
+ requestId: z.string(),
84
+ integrationId: z.string().optional(),
85
+ });
86
+ export const IntegrationsAuthorizationGetMethodsResponseSchema = z.object({
87
+ type: z.literal("integrations.authorization.get_methods.response"),
88
+ payload: z.object({
89
+ methods: z.array(IntegrationAuthorizationMethodOptionSchema),
90
+ requestId: z.string(),
91
+ }),
92
+ });
93
+ /**
94
+ * Starts a daemon-owned browser sign-in through the registered integration
95
+ * driver. Authorization codes and credentials remain daemon-only.
96
+ * Gated by features.integrationAuthorizationBrowserFlow.
97
+ */
98
+ export const IntegrationsAuthorizationStartBrowserRequestSchema = z.object({
99
+ type: z.literal("integrations.authorization.start_browser.request"),
100
+ requestId: z.string(),
101
+ integrationId: z.string(),
102
+ connectionId: z.string(),
103
+ });
104
+ export const IntegrationsAuthorizationStartBrowserResponseSchema = z.object({
105
+ type: z.literal("integrations.authorization.start_browser.response"),
106
+ payload: z.object({
107
+ authorizationUrl: z.string().url().nullable(),
108
+ error: z.string().nullable(),
109
+ requestId: z.string(),
110
+ }),
111
+ });
112
+ /** Starts the configured daemon-owned Zoom PKCE browser flow. */
113
+ export const IntegrationsZoomStartAuthorizationRequestSchema = z.object({
114
+ type: z.literal("integrations.zoom.start_authorization.request"),
115
+ requestId: z.string(),
116
+ });
117
+ export const IntegrationsZoomStartAuthorizationResponseSchema = z.object({
118
+ type: z.literal("integrations.zoom.start_authorization.response"),
119
+ payload: z.object({
120
+ authorizationUrl: z.string().url().nullable(),
121
+ error: z.string().nullable(),
122
+ requestId: z.string(),
123
+ }),
124
+ });
125
+ //# sourceMappingURL=integration-authorization.js.map