@zackbart/connecta 0.10.1 → 0.10.3

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 (78) hide show
  1. package/AGENTS.md +113 -0
  2. package/CHANGELOG.md +70 -0
  3. package/README.md +53 -9
  4. package/bin/connecta.mjs +272 -0
  5. package/dist/catalog-service.d.ts +40 -1
  6. package/dist/catalog-service.d.ts.map +1 -1
  7. package/dist/catalog-service.js +137 -12
  8. package/dist/catalog-service.js.map +1 -1
  9. package/dist/catalog.d.ts +17 -0
  10. package/dist/catalog.d.ts.map +1 -1
  11. package/dist/catalog.js +113 -13
  12. package/dist/catalog.js.map +1 -1
  13. package/dist/errors.d.ts +28 -0
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/errors.js +40 -0
  16. package/dist/errors.js.map +1 -1
  17. package/dist/execute.d.ts +45 -1
  18. package/dist/execute.d.ts.map +1 -1
  19. package/dist/execute.js +265 -68
  20. package/dist/execute.js.map +1 -1
  21. package/dist/invocation.d.ts.map +1 -1
  22. package/dist/invocation.js +34 -6
  23. package/dist/invocation.js.map +1 -1
  24. package/dist/meta-tools.d.ts +1 -0
  25. package/dist/meta-tools.d.ts.map +1 -1
  26. package/dist/meta-tools.js +412 -12
  27. package/dist/meta-tools.js.map +1 -1
  28. package/dist/skills.d.ts +1 -1
  29. package/dist/skills.d.ts.map +1 -1
  30. package/dist/skills.js +1 -1
  31. package/dist/tool-safety.d.ts +10 -0
  32. package/dist/tool-safety.d.ts.map +1 -0
  33. package/dist/tool-safety.js +12 -0
  34. package/dist/tool-safety.js.map +1 -0
  35. package/dist/validate.d.ts.map +1 -1
  36. package/dist/validate.js +100 -1
  37. package/dist/validate.js.map +1 -1
  38. package/dist/version.d.ts +1 -1
  39. package/dist/version.js +1 -1
  40. package/documentation/architecture.md +7 -0
  41. package/documentation/auth.md +58 -0
  42. package/documentation/call-admission.md +7 -0
  43. package/documentation/code-first-exploration.md +292 -0
  44. package/documentation/code-mode.md +696 -0
  45. package/documentation/connector-guides.md +7 -0
  46. package/documentation/connectors.md +69 -0
  47. package/documentation/mcp-2026-07-28.md +46 -0
  48. package/documentation/meta-tools.md +185 -0
  49. package/documentation/operations.md +7 -0
  50. package/documentation/operator-ui.md +7 -0
  51. package/documentation/request-admission.md +7 -0
  52. package/documentation/storage-and-credentials.md +54 -0
  53. package/ethos.md +132 -0
  54. package/examples/node/README.md +53 -0
  55. package/examples/node/src/index.ts +73 -0
  56. package/examples/worker/README.md +160 -0
  57. package/examples/worker/src/cloudflare-kv.ts +43 -0
  58. package/examples/worker/src/d1-activity-row.ts +100 -0
  59. package/examples/worker/src/d1-activity.ts +144 -0
  60. package/examples/worker/src/index.ts +136 -0
  61. package/examples/worker/wrangler.jsonc +26 -0
  62. package/package.json +11 -1
  63. package/src/catalog-service.ts +181 -16
  64. package/src/catalog.ts +143 -12
  65. package/src/errors.ts +88 -1
  66. package/src/execute.ts +372 -96
  67. package/src/invocation.ts +45 -8
  68. package/src/meta-tools.ts +506 -11
  69. package/src/skills.ts +1 -1
  70. package/src/tool-safety.ts +15 -0
  71. package/src/validate.ts +128 -0
  72. package/src/version.ts +1 -1
  73. package/templates/node/.env.example +5 -0
  74. package/templates/node/AGENTS.md +19 -0
  75. package/templates/node/README.md +33 -0
  76. package/templates/node/package.json +23 -0
  77. package/templates/node/src/index.ts +43 -0
  78. package/templates/node/tsconfig.json +12 -0
package/src/errors.ts CHANGED
@@ -11,6 +11,73 @@ export type ConnectorCallErrorCode =
11
11
  | "input_required_unsupported"
12
12
  | "connector_call_failed";
13
13
 
14
+ /** One bounded, payload-free explanation of an input-schema mismatch. */
15
+ export interface ArgumentValidationIssue {
16
+ /** JSON Pointer into the submitted arguments; "/" means the root value. */
17
+ path: string;
18
+ /** JSON Schema keyword that rejected the argument. */
19
+ code: string;
20
+ /** Expected shape only — never the submitted value. */
21
+ expected: string;
22
+ }
23
+
24
+ export interface ArgumentValidationDetails {
25
+ issues: ArgumentValidationIssue[];
26
+ /** More findings existed but were omitted from the bounded response. */
27
+ truncated?: true;
28
+ }
29
+
30
+ export const MAX_ARGUMENT_VALIDATION_ISSUES = 3;
31
+ const MAX_ARGUMENT_ISSUE_PATH_CHARS = 256;
32
+ const MAX_ARGUMENT_ISSUE_CODE_CHARS = 64;
33
+ const MAX_ARGUMENT_ISSUE_EXPECTED_CHARS = 128;
34
+
35
+ function boundedIssueText(
36
+ value: string,
37
+ maxChars: number,
38
+ ): { value: string; truncated: boolean } {
39
+ if (value.length <= maxChars) return { value, truncated: false };
40
+ return {
41
+ value: `${value.slice(0, Math.max(0, maxChars - 1))}…`,
42
+ truncated: true,
43
+ };
44
+ }
45
+
46
+ function boundedValidation(
47
+ details: ArgumentValidationDetails | undefined,
48
+ ): ArgumentValidationDetails | undefined {
49
+ if (!details) return undefined;
50
+ let truncated =
51
+ details.truncated === true ||
52
+ details.issues.length > MAX_ARGUMENT_VALIDATION_ISSUES;
53
+ const issues = details.issues
54
+ .slice(0, MAX_ARGUMENT_VALIDATION_ISSUES)
55
+ .map((issue) => {
56
+ const path = boundedIssueText(
57
+ issue.path,
58
+ MAX_ARGUMENT_ISSUE_PATH_CHARS,
59
+ );
60
+ const code = boundedIssueText(
61
+ issue.code,
62
+ MAX_ARGUMENT_ISSUE_CODE_CHARS,
63
+ );
64
+ const expected = boundedIssueText(
65
+ issue.expected,
66
+ MAX_ARGUMENT_ISSUE_EXPECTED_CHARS,
67
+ );
68
+ truncated ||= path.truncated || code.truncated || expected.truncated;
69
+ return {
70
+ path: path.value,
71
+ code: code.value,
72
+ expected: expected.value,
73
+ };
74
+ });
75
+ return {
76
+ issues,
77
+ ...(truncated ? { truncated: true as const } : {}),
78
+ };
79
+ }
80
+
14
81
  /** Agent-visible recovery class attached only to `auth_required` failures. */
15
82
  export type AuthRecoveryMode =
16
83
  | "oauth"
@@ -58,11 +125,18 @@ export class ConnectorCallError extends Error {
58
125
  * of the wire format is `classifyCallError`'s job, not this constructor's.
59
126
  */
60
127
  readonly retryAfterMs: number | undefined;
128
+ /** Bounded schema findings for `invalid_args`; never submitted values. */
129
+ readonly validation: ArgumentValidationDetails | undefined;
61
130
 
62
131
  constructor(
63
132
  code: ConnectorCallErrorCode,
64
133
  message: string,
65
- opts: { retryable?: boolean; retryAfterMs?: number; cause?: unknown } = {},
134
+ opts: {
135
+ retryable?: boolean;
136
+ retryAfterMs?: number;
137
+ cause?: unknown;
138
+ validation?: ArgumentValidationDetails;
139
+ } = {},
66
140
  ) {
67
141
  super(
68
142
  message,
@@ -72,6 +146,8 @@ export class ConnectorCallError extends Error {
72
146
  this.code = code;
73
147
  this.retryable = opts.retryable ?? RETRYABLE_BY_CODE[code];
74
148
  this.retryAfterMs = normalizeRetryAfterMs(opts.retryAfterMs);
149
+ this.validation =
150
+ code === "invalid_args" ? boundedValidation(opts.validation) : undefined;
75
151
  }
76
152
  }
77
153
 
@@ -86,6 +162,8 @@ export interface CallErrorDetails {
86
162
  * window so it can schedule a re-issue.
87
163
  */
88
164
  retryAfterMs?: number;
165
+ /** Bounded input-schema findings; paths and expectations, never values. */
166
+ validation?: ArgumentValidationDetails;
89
167
  /** Connector whose failed operation needs recovery. */
90
168
  connector?: string;
91
169
  /** Canonical downstream address the agent may retry after recovery. */
@@ -97,6 +175,14 @@ export interface CallErrorDetails {
97
175
  tool: "authorize_connector";
98
176
  arguments: { connector: string };
99
177
  operatorHandoff: string;
178
+ } | {
179
+ tool: "search_tools";
180
+ arguments: {
181
+ query: string;
182
+ connector: string;
183
+ includeSchemas: "compact";
184
+ };
185
+ purpose: string;
100
186
  };
101
187
  /** Explicit retry guidance; recovery never retries or mutates by itself. */
102
188
  retry?: string;
@@ -156,6 +242,7 @@ export function classifyCallError(
156
242
  ...(err.retryAfterMs !== undefined
157
243
  ? { retryAfterMs: err.retryAfterMs }
158
244
  : {}),
245
+ ...(err.validation ? { validation: err.validation } : {}),
159
246
  };
160
247
  }
161
248
  // An aborted fetch rejects with a DOMException named "AbortError" whose