@zackbart/connecta 0.35.0 → 0.36.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +8 -4
  3. package/bin/version.mjs +1 -1
  4. package/dist/auth/downstream-oauth.js +71 -79
  5. package/dist/auth/static-oauth.js +104 -26
  6. package/dist/connectors/api-connector.d.ts +17 -0
  7. package/dist/connectors/api-connector.js +3 -1
  8. package/dist/http/client.js +1 -1
  9. package/dist/http/hatch-paging.js +2 -2
  10. package/dist/http/paging.js +3 -89
  11. package/dist/http/provider.js +1 -2
  12. package/dist/http/services.js +1 -1
  13. package/dist/http/tools.js +1 -27
  14. package/dist/operator-ui/contract.d.ts +1 -0
  15. package/dist/operator-ui/generated.js +4 -4
  16. package/dist/program-writes.js +0 -1
  17. package/dist/providers/_shared/google/kit.js +29 -139
  18. package/dist/providers/_shared/rest/kit.js +4 -404
  19. package/dist/providers/_shared/sensitive-fields.js +0 -16
  20. package/dist/providers/breeze/api.js +2 -2
  21. package/dist/providers/ccb/api.js +1 -1
  22. package/dist/providers/cloudflare/api.js +8 -8
  23. package/dist/providers/cloudflare/lib/config.d.ts +2 -1
  24. package/dist/providers/docs/api.js +1 -1
  25. package/dist/providers/docs/tools.js +1 -2
  26. package/dist/providers/drive/api.js +2 -2
  27. package/dist/providers/drive/lib/hatch.js +1 -1
  28. package/dist/providers/drive/tools.js +1 -1
  29. package/dist/providers/forms/api.js +1 -1
  30. package/dist/providers/forms/lib/hatch.js +1 -1
  31. package/dist/providers/forms/tools.js +2 -3
  32. package/dist/providers/github/api.js +1 -1
  33. package/dist/providers/github/lib/discovery.js +2 -2
  34. package/dist/providers/gmail/api.js +1 -1
  35. package/dist/providers/gmail/tools.js +2 -2
  36. package/dist/providers/granola/api.js +155 -0
  37. package/dist/providers/granola/index.d.ts +10 -0
  38. package/dist/providers/granola/index.js +68 -0
  39. package/dist/providers/granola/openapi.generated.js +30 -0
  40. package/dist/providers/granola/safety.js +37 -0
  41. package/dist/providers/granola/skill.generated.js +5 -0
  42. package/dist/providers/granola/tools.js +2 -0
  43. package/dist/providers/overflow/api.js +26 -26
  44. package/dist/providers/planning-center/api.js +4 -4
  45. package/dist/providers/planning-center/lib/constants.d.ts +1 -1
  46. package/dist/providers/planning-center/lib/json-api.js +2 -2
  47. package/dist/providers/quickbooks/api.js +299 -0
  48. package/dist/providers/quickbooks/index.d.ts +13 -0
  49. package/dist/providers/quickbooks/index.js +93 -0
  50. package/dist/providers/quickbooks/lib/query.js +118 -0
  51. package/dist/providers/quickbooks/lib/writes.js +168 -0
  52. package/dist/providers/quickbooks/safety.js +222 -0
  53. package/dist/providers/quickbooks/skill.generated.js +5 -0
  54. package/dist/providers/quickbooks/tools.js +117 -0
  55. package/dist/providers/sheets/api.js +1 -1
  56. package/dist/providers/sheets/lib/hatch.js +2 -2
  57. package/dist/providers/sheets/lib/requests.js +1 -1
  58. package/dist/providers/sheets/tools.js +1 -2
  59. package/dist/providers/slides/api.js +1 -1
  60. package/dist/providers/slides/tools.js +2 -2
  61. package/dist/providers/stripe/api.js +7 -7
  62. package/dist/providers/tithely/api.js +2 -2
  63. package/dist/providers/vercel/api.js +12 -12
  64. package/dist/providers/vercel/index.js +1 -2
  65. package/dist/providers/vercel/lib/pin.js +1 -1
  66. package/dist/routes/mcp.js +1 -1
  67. package/dist/routes/oauth.js +3 -0
  68. package/dist/runtime/admission.js +0 -12
  69. package/dist/runtime/call.js +0 -4
  70. package/dist/skills.js +0 -1
  71. package/dist/storage/keys.js +2 -3
  72. package/dist/types.d.ts +2 -0
  73. package/dist/ui.d.ts +1 -1
  74. package/dist/ui.js +0 -1
  75. package/dist/version.d.ts +1 -1
  76. package/dist/version.js +1 -1
  77. package/documentation/README.md +1 -0
  78. package/documentation/architecture.md +249 -366
  79. package/documentation/auth.md +56 -19
  80. package/documentation/code-mode.md +6 -6
  81. package/documentation/integrating.md +1 -1
  82. package/documentation/meta-tools.md +6 -3
  83. package/documentation/operator-tests.md +11 -2
  84. package/documentation/operator-ui.md +17 -5
  85. package/documentation/providers.md +492 -0
  86. package/package.json +12 -9
  87. package/templates/node/package.json +1 -1
  88. package/dist/operator-ui/agents.d.ts +0 -75
  89. package/dist/operator-ui/agents.js +0 -114
  90. package/dist/operator-ui/config-summary.js +0 -566
  91. package/dist/operator-ui/connection-map.js +0 -378
  92. package/dist/operator-ui/endpoints.js +0 -212
  93. package/dist/operator-ui/fix-prompts.d.ts +0 -18
  94. package/dist/operator-ui/fix-prompts.js +0 -79
  95. package/dist/operator-ui/health.js +0 -52
  96. package/dist/operator-ui/member-page.js +0 -97
  97. package/dist/operator-ui/overview.js +0 -126
  98. package/dist/operator-ui/setup-commands.js +0 -47
  99. package/dist/operator-ui/view.d.ts +0 -378
  100. package/dist/operator-ui/view.js +0 -631
  101. package/dist/providers/_shared/rest/dispatch.js +0 -21
  102. package/dist/providers/_shared/rest/tools.js +0 -592
@@ -1,378 +0,0 @@
1
- import type { AgentSlot } from "./agents.js";
2
- import type { OperatorRole, OperatorUiContractV2 } from "./contract.js";
3
- import type { FixPromptKind } from "./fix-prompts.js";
4
- import type { UiConnector, UiData, UiProblem } from "./model.js";
5
- export declare function registrationPathLabel(path: NonNullable<UiConnector["registrationPath"]>): string;
6
- export type OperatorPage = "overview" | "endpoints" | "settings" | "connector" | "tokens" | "connections" | "activity";
7
- /** Pages the nav lists, in dashboard order. */
8
- export declare const OPERATOR_PAGES: readonly OperatorPage[];
9
- export declare const PAGE_META: Readonly<Record<OperatorPage, {
10
- path: string;
11
- label: string;
12
- }>>;
13
- /** Legacy links remain valid, with the browser replacing their URL. */
14
- export declare function canonicalOperatorPath(path: string): string;
15
- /**
16
- * What each page is for, in one line under its heading — on the gate as well
17
- * as once signed in, so the page an operator lands on reads the same before
18
- * and after the session is checked.
19
- */
20
- export declare function pageDescription(page: OperatorPage, productDescription: string): string;
21
- /**
22
- * Signed in, but neither a maintainer nor a member of any endpoint: who to
23
- * ask, and that this is not an error to retry.
24
- */
25
- export declare function noAccessCopy(kind: string, productName: string): string;
26
- /** What the gate says while the session is checked, page by page. */
27
- export declare function checkingCopy(): string;
28
- export declare function pageForPath(path: string): OperatorPage;
29
- export interface UiActivityActor {
30
- kind?: string;
31
- id?: string;
32
- namespace?: string;
33
- label?: string;
34
- }
35
- export interface UiActivityEvent {
36
- kind?: "catalog_drift";
37
- drift?: import("../activity.js").ActivityCatalogChange;
38
- id?: string;
39
- requestId?: string;
40
- classification?: "read" | "write";
41
- resultBytes?: number;
42
- occurredAt: string;
43
- actor?: UiActivityActor;
44
- connectorId: string;
45
- toolName: string;
46
- address: string;
47
- source: string;
48
- outcome: string;
49
- durationMs: number;
50
- attempts: number;
51
- errorCode?: string;
52
- friction?: string;
53
- approval?: string;
54
- packageVersion?: string;
55
- clientName?: string;
56
- clientVersion?: string;
57
- }
58
- /**
59
- * Which fix prompt a failure offers. A kind and a configured connector id —
60
- * the message beside it never travels with it.
61
- */
62
- export interface NoticeFix {
63
- kind: FixPromptKind;
64
- connectorId: string;
65
- }
66
- /** A message with the tone that decides its live region: status or alert. */
67
- export interface Notice {
68
- message: string;
69
- tone: "info" | "error";
70
- fix?: NoticeFix;
71
- }
72
- export declare function info(message: string): Notice;
73
- export declare function failure(message: string, fix?: NoticeFix): Notice;
74
- /**
75
- * Why a request the page made did not land, as the store classifies it. Only
76
- * this kind, a status code, and a closed `problem` enum ever reach a notice;
77
- * the route's `error` text never does.
78
- *
79
- * - `session` — no usable session, or the route answered 401.
80
- * - `forbidden` — the route answered 403: this identity may not do that. On a
81
- * mutation that is a permission, not an expired session, so it stays inline.
82
- * - `network` — the browser could not reach the deployment at all.
83
- * - `refused` — the route answered, and said no.
84
- * - `stale` — never sent: what the action was checked against changed before
85
- * dispatch (a refreshed slot list or member contract).
86
- */
87
- export type RequestFailureKind = "session" | "forbidden" | "network" | "refused" | "stale";
88
- export interface RequestFailureFacts {
89
- kind: RequestFailureKind;
90
- status?: number | undefined;
91
- problem?: unknown;
92
- /** A refusal's machine `code` from a closed set, such as `slot_changed`; checked, never shown. */
93
- code?: unknown;
94
- }
95
- /**
96
- * What the notices for an OAuth action and a credential Test say. Each of
97
- * those actions reaches a downstream, and a downstream's refusal can quote the
98
- * secret it was sent — so these notices are fixed sentences chosen by outcome,
99
- * and no text the server sent back is ever one of them. The route logs the
100
- * downstream's words on the host; the fix prompt beside a failure is keyed off
101
- * the same outcome.
102
- */
103
- export type DownstreamAction = "oauth_disconnect" | "oauth_reconnect" | "credential_test";
104
- /** Every action a connector row can start, downstream or not. */
105
- export type RowAction = DownstreamAction | "credential_save" | "credential_remove";
106
- /**
107
- * The route's answer to a finished OAuth action. Its state picks the sentence;
108
- * `opened` says whether the authorization page is already in a new tab.
109
- */
110
- export declare function oauthDoneNotice(action: "oauth_disconnect" | "oauth_reconnect", answer: {
111
- state?: unknown;
112
- code?: unknown;
113
- } | null, opened?: boolean): Notice;
114
- /** A credential Test's result. `ok` is the only part of the answer it reads. */
115
- export declare function credentialTestNotice(connectorId: string, answer: {
116
- ok?: unknown;
117
- } | null): Notice;
118
- /**
119
- * A route that refused one of these actions. A credential Test that found
120
- * nothing usable to test names the problem, which picks the same copy and fix
121
- * prompt the Connections page uses for it; every other refusal gets the
122
- * action's one sentence. `problem` is whatever the response carried, so it is
123
- * checked, not trusted.
124
- */
125
- export declare function refusedNotice(action: DownstreamAction, connectorId: string, problem?: unknown): Notice;
126
- /** An action whose permission or target changed before it was sent. */
127
- export declare const STALE_COPY = "This changed before sending, so nothing was sent. Try again.";
128
- /**
129
- * Every row action's failure, in one voice. The page's own failures — a
130
- * lapsed session, a denied identity, a dropped connection — read the same for
131
- * every action; a route's refusal picks the action's fixed sentence.
132
- */
133
- export declare function actionFailedNotice(action: RowAction, connectorId: string, facts: RequestFailureFacts, productName: string): Notice;
134
- /**
135
- * Why one connector's details did not load, when the reason is on this side
136
- * of the deployment rather than the downstream's. A downstream failure is the
137
- * server's `connector_unavailable` and keeps its own copy and fix prompt;
138
- * these two have nothing for a coding agent to fix.
139
- */
140
- export type ConnectorLoadFailure = "session" | "network" | "unavailable";
141
- export declare function connectorLoadFailureCopy(failure: ConnectorLoadFailure, productName: string): string;
142
- /** The signed-in page's answer when `/ui/data` could not be read. */
143
- export declare function loadFailureCopy(failure: "server" | "network", productName: string): {
144
- title: string;
145
- body: string;
146
- };
147
- /** A collection page's load failure: fixed words, whatever the route said. */
148
- export declare function collectionFailureCopy(_collection: "activity", facts: RequestFailureFacts, productName: string): string;
149
- /** A destructive or disruptive row action waiting for a second, in-page click. */
150
- export interface PendingConfirm {
151
- connectorId: string;
152
- action: "oauth_disconnect" | "oauth_restart" | "credential_remove";
153
- }
154
- /** The confirm's question, naming the connector by its title. */
155
- export declare function confirmCopy(action: PendingConfirm["action"], name: string): {
156
- question: string;
157
- confirm: string;
158
- };
159
- /**
160
- * A remote collection's four states, named once so every page spells them the
161
- * same way. `idle` is "nobody has asked yet" and is what makes a re-entered
162
- * page fetch again after an identity change.
163
- */
164
- type LoadPhase = "idle" | "loading" | "ready" | "error";
165
- export declare function accessTokenUnavailableCopy(capability?: string): string;
166
- export interface OperatorState {
167
- tokenPhase: LoadPhase;
168
- tokenNotice: Notice | null;
169
- /** One slot per declared agent, from `/ui/access-tokens`. */
170
- tokens: AgentSlot[];
171
- /** A just-issued secret, shown once in its dialog and dropped when that closes. */
172
- createdToken: string | null;
173
- /** The agent `createdToken` belongs to. */
174
- createdTokenFor: string | null;
175
- /** A rotation or revocation waiting on its in-row confirmation. */
176
- tokenConfirm: {
177
- name: string;
178
- action: "rotate" | "revoke";
179
- } | null;
180
- /**
181
- * Agents whose last token operation ended with an unknown outcome (503,
182
- * 499, or a dropped connection). Their actions stay off until a slot list
183
- * read that started after the failure succeeds.
184
- */
185
- unresolvedSlots: string[];
186
- tokenBusy: boolean;
187
- page: OperatorPage;
188
- /**
189
- * Bumped by every identity change. Async work captures it before awaiting and
190
- * throws its result away if the operator is no longer the one who asked —
191
- * the fence that keeps one identity's data off another identity's screen.
192
- */
193
- generation: number;
194
- /**
195
- * `loading` until `/ui/api/config` answers (and, for a maintainer,
196
- * `/ui/data` too). `denied` is signed in as someone who is neither a
197
- * maintainer nor a pool member.
198
- */
199
- session: "loading" | "gated" | "ready" | "denied";
200
- gate: Notice | null;
201
- /** True while a signed-in operator's /ui/data is in flight. */
202
- refreshing: boolean;
203
- /** A bounded admission recovery is pending; Retry can supersede it. */
204
- recoveryPending: boolean;
205
- /**
206
- * Why the last /ui/data read failed when the session itself was not the
207
- * reason: the page stays signed in, with its chrome, and offers a retry.
208
- * Only a 401 or 403 on that read returns to the gate.
209
- */
210
- loadFailure: "server" | "network" | null;
211
- /**
212
- * Element id the next render should focus. A rebuilt page has no stable node
213
- * to hand focus to from an event handler, so the request travels through
214
- * state and the shell spends it once the new markup exists.
215
- */
216
- pendingFocus: string | null;
217
- /**
218
- * Like `pendingFocus`, but spent only when focus has nowhere to be — the
219
- * control that had it is gone. An action that lands next to its own control
220
- * announces through its live region and leaves focus where the operator is.
221
- */
222
- focusIfLost: string | null;
223
- data: UiData | null;
224
- /** Operator contract v2, for either role; null until `/ui/api/config` answers. */
225
- contract: OperatorUiContractV2 | null;
226
- /**
227
- * The role the last good contract confirmed. It outlives a failed refresh
228
- * that clears `contract`, so the next answer with a different role is
229
- * still recognized as a different viewer. Only an identity reset clears it.
230
- */
231
- role: OperatorRole | null;
232
- contractPhase: LoadPhase;
233
- health: "loading" | "ok" | "unavailable";
234
- connectorFilter: string;
235
- oauthNotice: Notice | null;
236
- /** The connector row `oauthNotice` answers, which is where it renders. */
237
- oauthNoticeFor: string | null;
238
- /** Connector id whose OAuth mutation is in flight. */
239
- oauthBusy: string | null;
240
- /**
241
- * Connector id whose authorization started while the browser refused the
242
- * new tab: its row offers the link instead of the button.
243
- */
244
- oauthBlocked: string | null;
245
- /**
246
- * The authorization link the route returned for `oauthBlocked`. A member has
247
- * no `/ui/data` connector to keep it on, so it is held here.
248
- */
249
- oauthBlockedUrl: string | null;
250
- /** A row action waiting for its in-page confirmation. */
251
- confirming: PendingConfirm | null;
252
- /** Connectors whose details failed on this side of the deployment. */
253
- connectorFailures: Readonly<Record<string, ConnectorLoadFailure>>;
254
- credentialNotice: Notice | null;
255
- /** The connector row `credentialNotice` answers. */
256
- credentialNoticeFor: string | null;
257
- /** Connector id whose credential form is open. */
258
- credentialEditing: string | null;
259
- /** Connector id whose credential mutation is in flight. */
260
- credentialBusy: string | null;
261
- activityPhase: LoadPhase;
262
- activityNotice: Notice | null;
263
- activityEvents: UiActivityEvent[];
264
- activityCursor: string | null;
265
- activitySearch: string;
266
- }
267
- /** Who the contract says this viewer is, or null before it loads. */
268
- export declare function operatorRole(state: Pick<OperatorState, "contract">): OperatorRole | null;
269
- /**
270
- * The role pages and navigation render for. The contract's, or, while a
271
- * refresh that failed has left no contract on screen, maintainer when the
272
- * last good contract confirmed one and that maintainer's data is still here:
273
- * their page stays mounted on its own retry state instead of being torn down
274
- * mid-recovery. Never a request's permission; the store sends maintainer
275
- * reads only while the contract itself says maintainer.
276
- */
277
- export declare function displayRole(state: Pick<OperatorState, "contract" | "role" | "data">): OperatorRole | null;
278
- /**
279
- * A confirmed maintainer's page is mounted without a contract behind it: a
280
- * refresh failed, or its read ran past the deadline. The shell shows one
281
- * recovery banner with Retry above whichever page is open, and that page is
282
- * stale until a contract confirms the role again.
283
- */
284
- export declare function contractRecovering(state: Pick<OperatorState, "contract" | "role" | "data">): boolean;
285
- /**
286
- * Whether Activity is open to this viewer: maintainers only, on a deployment
287
- * that records history. Members always read "forbidden".
288
- */
289
- export declare function activityReadable(state: Pick<OperatorState, "contract" | "data">): boolean;
290
- /** The contract's half of `activityReadable`: a maintainer, on a deployment that records. */
291
- export declare function activityAllowed(state: Pick<OperatorState, "contract">): boolean;
292
- export declare function initialState(page: OperatorPage): OperatorState;
293
- /**
294
- * Drop to the gate and forget the previous operator. Bumping the generation is
295
- * what makes the drop stick: work already in flight for the old identity
296
- * resolves into a state that no longer accepts it.
297
- */
298
- export declare function resetIdentity(state: OperatorState, gate?: Notice | null): OperatorState;
299
- /**
300
- * Leaving a page closes what should not survive it: a one-time secret, a half
301
- * typed credential, and the notices that answered the page just left.
302
- */
303
- export declare function withPage(state: OperatorState, page: OperatorPage): OperatorState;
304
- /**
305
- * The status badge. An auth-needed connector is named by what it needs, so a
306
- * row whose fix is "Add credential" does not say "Authorization needed".
307
- */
308
- export declare function connectorStatusLabel(status: string, problem?: UiProblem): string;
309
- /** The tone a status carries wherever it is rendered as a badge or a tile. */
310
- export type Tone = "ok" | "warn" | "danger" | "neutral" | "accent";
311
- export declare function connectorStatusTone(status: string): Tone;
312
- export declare function problemCopy(problem: UiProblem | undefined): string | null;
313
- /**
314
- * A problem someone can fix by authorizing is a warning, matching the amber
315
- * "Authorization needed" badge above it; one where something broke is an
316
- * error. The two used to share the red box, so the row contradicted itself.
317
- */
318
- export declare function problemTone(problem: UiProblem): "warn" | "danger";
319
- /** What the page knows about a connector beyond its live status: a failed detail read. */
320
- export interface ConnectorSignals {
321
- failed?: boolean;
322
- }
323
- /** One connector's health everywhere it is shown: badge tone, status word, and the one action beside it. */
324
- export interface ConnectorVerdict {
325
- tone: "ok" | "warn" | "danger" | "neutral";
326
- label: string;
327
- /** The link to the Connection tab, or null when the connector is fine. */
328
- action: "Connect" | "Replace key" | "Inspect" | null;
329
- }
330
- /**
331
- * The verdict the Connectors list, the Overview, Endpoints and a connector's
332
- * page all show. The server's problem code comes first, then a failed detail
333
- * read on this page, then a non-ok status. Catalog drift is informational. A problem
334
- * outranks the status, so a connector whose catalog failed is never
335
- * "Connected". A failed read marks its connector `connector_unavailable` in
336
- * the store, so that one code beside a failed read is the page's own and
337
- * reads "Couldn't load" instead of blaming the downstream.
338
- */
339
- export declare function connectorVerdict(live: {
340
- status: string;
341
- problem?: UiProblem;
342
- }, signals?: ConnectorSignals): ConnectorVerdict;
343
- /**
344
- * Only http/https may become a clickable href — the browser half of the gate
345
- * `src/ui.ts` applies before an authorizationUrl is ever serialized. A hostile
346
- * downstream that gets a `javascript:` URL past one of them still meets the
347
- * other, and the caller renders inert text instead of a link.
348
- */
349
- export declare function safeHttpHref(url: string | undefined): string | null;
350
- /** Locale timestamp, or "" for anything that is not a readable date. */
351
- export declare function formatDate(value?: string): string;
352
- /** Who made a call: their name when there is one, and how they signed in. */
353
- export declare function actorLabel(actor?: UiActivityActor): string;
354
- /**
355
- * The stable id behind a friendly label, shown only when a label or namespace
356
- * could otherwise make two different people look like one.
357
- */
358
- export declare function actorStableId(actor?: UiActivityActor): string | null;
359
- export declare function filterActivity(events: UiActivityEvent[], query: string): UiActivityEvent[];
360
- /** Counts only. What the deployment ran, never what it sent or received. */
361
- export declare function activitySummary(events: UiActivityEvent[]): string;
362
- export declare function activityOutcomeClass(outcome: string): string;
363
- export declare function activityOutcomeBadge(outcome: string): {
364
- label: string;
365
- tone: Tone;
366
- };
367
- /** Why a call stalled or failed, in words; "" when nothing was recorded. */
368
- export declare function activityReason(event: UiActivityEvent): string;
369
- /** The one-line detail under an address: where it ran, retries, and why it stalled. */
370
- export declare function activityDetail(event: UiActivityEvent): string;
371
- /**
372
- * A stored credential that cannot be used, by cause. The payload's `error`
373
- * beside it is not shown: it can carry a vault's own words.
374
- */
375
- export declare function credentialProblemCopy(problem: string | undefined): string;
376
- /** Gate copy for each browser-auth shape, so the sign-in state is never a blank page. */
377
- export declare function gateCopy(kind: string, signedIn: boolean): string;
378
- export {};