@zackbart/connecta 0.30.0 → 0.31.0

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 (66) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +6 -3
  3. package/bin/version.mjs +1 -1
  4. package/dist/call-recovery.js +25 -0
  5. package/dist/config-schema.d.ts +14 -7
  6. package/dist/config-schema.js +29 -10
  7. package/dist/connectors/guarded-fetch.d.ts +9 -1
  8. package/dist/connectors/guarded-fetch.js +14 -2
  9. package/dist/errors.d.ts +2 -0
  10. package/dist/invocation.js +32 -0
  11. package/dist/operator-ui/generated.js +2 -2
  12. package/dist/operator-ui/view.d.ts +9 -0
  13. package/dist/operator-ui/view.js +11 -0
  14. package/dist/program-writes.js +2 -47
  15. package/dist/provider.d.ts +7 -5
  16. package/dist/provider.js +3 -4
  17. package/dist/providers/_shared/rest/dispatch.js +41 -0
  18. package/dist/providers/_shared/rest/operation-index.d.ts +133 -0
  19. package/dist/providers/_shared/rest/operation-index.js +527 -0
  20. package/dist/providers/_shared/rest/tools.d.ts +141 -0
  21. package/dist/providers/_shared/rest/tools.js +569 -0
  22. package/dist/providers/_shared/rest/value-safety.d.ts +151 -0
  23. package/dist/providers/_shared/rest/value-safety.js +580 -0
  24. package/dist/providers/cloudflare/graphql.js +385 -0
  25. package/dist/providers/cloudflare/index.d.ts +47 -51
  26. package/dist/providers/cloudflare/index.js +188 -1997
  27. package/dist/providers/cloudflare/openapi.generated.js +3347 -0
  28. package/dist/providers/cloudflare/rest.d.ts +37 -0
  29. package/dist/providers/cloudflare/rest.js +1056 -0
  30. package/dist/providers/cloudflare/skill.generated.js +7 -4
  31. package/dist/providers/cloudflare/value-safety.js +1247 -0
  32. package/dist/providers/notion/index.d.ts +35 -31
  33. package/dist/providers/notion/index.js +60 -1499
  34. package/dist/providers/notion/openapi.generated.js +75 -0
  35. package/dist/providers/notion/rest.d.ts +24 -0
  36. package/dist/providers/notion/rest.js +1067 -0
  37. package/dist/providers/notion/skill.generated.js +5 -4
  38. package/dist/providers/notion/value-safety.js +31 -0
  39. package/dist/providers/stripe/index.d.ts +26 -20
  40. package/dist/providers/stripe/index.js +103 -130
  41. package/dist/providers/stripe/openapi.generated.js +649 -0
  42. package/dist/providers/stripe/rest.d.ts +14 -0
  43. package/dist/providers/stripe/rest.js +395 -0
  44. package/dist/providers/stripe/skill.generated.js +7 -5
  45. package/dist/providers/stripe/value-safety.js +705 -0
  46. package/dist/providers/vercel/index.d.ts +31 -22
  47. package/dist/providers/vercel/index.js +96 -853
  48. package/dist/providers/vercel/openapi.generated.js +456 -0
  49. package/dist/providers/vercel/rest.d.ts +20 -0
  50. package/dist/providers/vercel/rest.js +1002 -0
  51. package/dist/providers/vercel/skill.generated.js +4 -5
  52. package/dist/providers/vercel/value-safety.js +328 -0
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/write-outcome.js +47 -0
  56. package/documentation/README.md +1 -0
  57. package/documentation/architecture.md +120 -8
  58. package/documentation/integrating.md +16 -5
  59. package/documentation/meta-tools.md +9 -2
  60. package/documentation/provider-auth-migration.md +307 -0
  61. package/documentation/provider-migration-0.29.md +17 -5
  62. package/examples/worker/README.md +2 -2
  63. package/package.json +3 -2
  64. package/templates/node/README.md +2 -2
  65. package/templates/node/package.json +1 -1
  66. package/dist/providers/vercel/mcp-ownership.js +0 -212
@@ -0,0 +1,151 @@
1
+ import type { Operation, OperationIndex } from "./operation-index.js";
2
+ /** What a removed secret reads as. */
3
+ export declare const REDACTED = "[redacted]";
4
+ /** Credential vocabulary over normalized names, matched anywhere; mirrors `scripts/value-safety.mjs`. */
5
+ export declare const CREDENTIAL_WORDS: string[];
6
+ /** Credential vocabulary matched at the end of a normalized name; mirrors the script. */
7
+ export declare const CREDENTIAL_SUFFIX: RegExp;
8
+ /** Suffixes of metadata about a credential (ids, prefixes, last four, counts, expiry, scopes); mirrors the script. */
9
+ export declare const METADATA_SUFFIXES: string[];
10
+ /** Exact metadata names that contain a credential word; mirrors the script. */
11
+ export declare const METADATA_NAMES: string[];
12
+ export type ValueSafetyVerdict = {
13
+ readonly verdict: "refuse";
14
+ readonly reason: string;
15
+ } | {
16
+ readonly verdict: "redact";
17
+ readonly reason: string;
18
+ /**
19
+ * Reviewed field paths into the data a tool returns: `a.b` (a list on
20
+ * the way is traversed item by item), `[]` for list items, `{}` or `*`
21
+ * for every value of a map, `@keys` for a map keyed by secrets (keys
22
+ * become placeholders), `[?env]` for list items whose `type` names an
23
+ * environment variable, `[?credential]` for list items labelled with a
24
+ * credential name, `[?header]` for header, cookie, or query rules. A
25
+ * `url:` prefix sanitizes a URL; an `origin:` prefix (or `#url` suffix)
26
+ * keeps only its scheme and host. Every other value at a path becomes
27
+ * `[redacted]`.
28
+ */
29
+ readonly paths: readonly string[];
30
+ /** Reviewed metadata paths the key-name heuristic leaves (children are still checked). */
31
+ readonly keep?: readonly string[];
32
+ /** See the `safe` verdict. */
33
+ readonly errors?: "vendor";
34
+ } | {
35
+ readonly verdict: "safe";
36
+ readonly reason: string;
37
+ /** Reviewed metadata paths the key-name heuristic leaves (children are still checked). */
38
+ readonly keep?: readonly string[];
39
+ /**
40
+ * The error policy. By default a reviewed operation's failures carry the
41
+ * vendor's codes and statuses but never its text, which may echo a
42
+ * stored secret. `vendor` is a reviewed exception for operations whose
43
+ * errors cannot: the vendor's text passes (and still meets the
44
+ * sent-secrets matcher).
45
+ */
46
+ readonly errors?: "vendor";
47
+ };
48
+ /** One field name reviewed for a whole vendor whose objects repeat across operations (Stripe's). */
49
+ interface FieldReview {
50
+ readonly verdict: "redact" | "keep";
51
+ readonly reason: string;
52
+ }
53
+ /**
54
+ * A reviewed rule for one resource type, applied to every object whose
55
+ * discriminator names it wherever a response embeds it: the top level, a list,
56
+ * a search result, an expansion, an event's `data.object`. Operation verdicts
57
+ * review what an operation returns by shape; resource rules are the backstop
58
+ * for what expansions can put anywhere.
59
+ */
60
+ /**
61
+ * When an object is provably unbound (a guest Checkout Session), stated as
62
+ * data so `providers:spec` can hold it to the pinned schema: every binding
63
+ * field the schema has must be listed, in `bindings` or, with a reason, in
64
+ * `unbound`.
65
+ */
66
+ interface GuestCondition {
67
+ /**
68
+ * Fields that bind the object to an identity or its saved methods. Each
69
+ * must be absent, null, empty, or one of the listed values that bind
70
+ * nothing (`customer_creation: "if_required"`).
71
+ */
72
+ readonly bindings: Readonly<Record<string, readonly string[]>>;
73
+ /** Identity-named fields that bind nothing (guest prefill or collected details), with the reason. */
74
+ readonly unbound: Readonly<Record<string, string>>;
75
+ /** Fields whose value must be one of these (a Checkout Session's `mode: "payment"`). */
76
+ readonly requires?: Readonly<Record<string, readonly string[]>>;
77
+ }
78
+ interface ResourceRule {
79
+ readonly reason: string;
80
+ /** Reviewed paths relative to the object, in the operation path language. */
81
+ readonly paths?: readonly string[];
82
+ /**
83
+ * Fields whose string is a payer-facing URL the resource exists to hand out
84
+ * (a guest Checkout page), returned without URL sanitizing: its fragment is
85
+ * opaque state the page needs. With `guest`, only while the object is
86
+ * provably a guest's; otherwise its `withheld` paths go.
87
+ */
88
+ readonly verbatim?: readonly string[];
89
+ readonly guest?: GuestCondition;
90
+ readonly withheld?: readonly string[];
91
+ }
92
+ interface ResourceRules {
93
+ /** The field that names an object's type (Stripe's `object`). */
94
+ readonly key: string;
95
+ /** Sibling fields holding a partial copy of a discriminated object (an event's `previous_attributes`). */
96
+ readonly partials?: readonly string[];
97
+ readonly rules: Readonly<Record<string, ResourceRule>>;
98
+ }
99
+ export interface ValueSafetyTable {
100
+ /** Display name in refusals. */
101
+ readonly title: string;
102
+ /** The reviewed verdict for every flagged operation, keyed `METHOD /path template`. */
103
+ readonly operations: Readonly<Record<string, ValueSafetyVerdict>>;
104
+ /**
105
+ * Field names reviewed once for the vendor: `redact` wherever the name
106
+ * appears, `keep` as metadata the heuristic leaves wherever it appears
107
+ * (children are still checked). Keyed by the exact field name.
108
+ */
109
+ readonly fields?: Readonly<Record<string, FieldReview>>;
110
+ /** Operations whose whole body is environment variables: every value field goes, `key` or not. */
111
+ readonly envBodies?: RegExp;
112
+ /** Keys whose string-list values are permission scopes (action names under a resource), never secrets. */
113
+ readonly scopeMaps?: readonly string[];
114
+ /** Rules for resource types wherever they appear, for vendors whose objects carry a type discriminator. */
115
+ readonly resources?: ResourceRules;
116
+ }
117
+ export declare const refuse: (reason: string) => ValueSafetyVerdict;
118
+ export declare const redact: (reason: string, paths: readonly string[], keep?: readonly string[]) => ValueSafetyVerdict;
119
+ export declare const safe: (reason: string, keep?: readonly string[]) => ValueSafetyVerdict;
120
+ /** A verdict whose failures keep the vendor's text: reviewed, for operations whose errors echo no stored secret. */
121
+ export declare const vendorErrors: (verdict: ValueSafetyVerdict) => ValueSafetyVerdict;
122
+ /** Paths under each prefix; a `url:` or `origin:` directive stays in front. */
123
+ export declare function under(prefixes: readonly string[], paths: readonly string[]): string[];
124
+ /**
125
+ * Whether a key names a credential: a credential word anywhere in a name
126
+ * that is not metadata (Vercel's former rule), or a credential suffix
127
+ * (Cloudflare's).
128
+ */
129
+ export declare function credentialName(name: string): boolean;
130
+ /** Whether every segment of a reviewed path is in the path language; the harness checks each table. */
131
+ export declare function validPath(raw: string): boolean;
132
+ /** What a vendor's tools ask of its reviewed table. */
133
+ export interface ValueSafety {
134
+ readonly table: ValueSafetyTable;
135
+ /** The reviewed verdict for an operation, if it was flagged. */
136
+ verdict(method: string, template: string): ValueSafetyVerdict | undefined;
137
+ /** The refusal for a `refuse` verdict, before anything is sent. */
138
+ refusal(method: string, template: string): string | undefined;
139
+ /** One success body made value-safe: reviewed paths, environment bodies, resource rules, then the heuristic. */
140
+ redact(data: unknown, method: string, template: string): unknown;
141
+ /**
142
+ * Whether a failure's vendor text is withheld: any reviewed operation
143
+ * unless its verdict says `errors: "vendor"`, or an unreviewed one whose
144
+ * request accepts a credential-named field (an error may echo what was
145
+ * submitted). Codes and statuses still route.
146
+ */
147
+ withholdsErrors(op: Operation): boolean;
148
+ }
149
+ /** A vendor's value-safety mechanism over its reviewed table and pinned index. */
150
+ export declare function valueSafety(table: ValueSafetyTable, index: () => OperationIndex): ValueSafety;
151
+ export {};