@zackbart/connecta 0.24.4 → 0.26.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 (155) hide show
  1. package/AGENTS.md +43 -12
  2. package/CHANGELOG.md +524 -0
  3. package/README.md +32 -15
  4. package/SECURITY.md +6 -5
  5. package/bin/connecta.mjs +5 -1
  6. package/dist/activity.d.ts +10 -3
  7. package/dist/activity.js +10 -1
  8. package/dist/advertised-schema.js +53 -0
  9. package/dist/artifacts/connector.d.ts +55 -0
  10. package/dist/artifacts/connector.js +724 -0
  11. package/dist/artifacts/document.js +76 -0
  12. package/dist/artifacts/guide.js +140 -0
  13. package/dist/artifacts/html-scan.js +329 -0
  14. package/dist/artifacts/json.js +68 -0
  15. package/dist/artifacts/kv-store.d.ts +20 -0
  16. package/dist/artifacts/kv-store.js +140 -0
  17. package/dist/artifacts/markdown.js +449 -0
  18. package/dist/artifacts/module.d.ts +37 -0
  19. package/dist/artifacts/module.js +60 -0
  20. package/dist/artifacts/operations.d.ts +195 -0
  21. package/dist/artifacts/operations.js +944 -0
  22. package/dist/artifacts/refresh.d.ts +53 -0
  23. package/dist/artifacts/refresh.js +235 -0
  24. package/dist/artifacts/routes.js +194 -0
  25. package/dist/artifacts/types.d.ts +214 -0
  26. package/dist/artifacts/types.js +22 -0
  27. package/dist/artifacts/validate.d.ts +62 -0
  28. package/dist/artifacts/validate.js +652 -0
  29. package/dist/artifacts.d.ts +6 -0
  30. package/dist/artifacts.js +9 -0
  31. package/dist/auth/downstream-oauth.js +490 -106
  32. package/dist/call-admission.js +139 -113
  33. package/dist/catalog-service.js +152 -106
  34. package/dist/catalog.js +297 -38
  35. package/dist/concurrency.js +24 -23
  36. package/dist/connector-access.d.ts +18 -4
  37. package/dist/connector-access.js +65 -20
  38. package/dist/connector-caller.d.ts +8 -0
  39. package/dist/connector-caller.js +19 -0
  40. package/dist/connector-scope.js +6 -37
  41. package/dist/connectors/api.d.ts +2 -2
  42. package/dist/connectors/remote-mcp.d.ts +6 -5
  43. package/dist/connectors/remote-mcp.js +330 -240
  44. package/dist/credential-contract.d.ts +9 -0
  45. package/dist/credential-rules.js +2 -2
  46. package/dist/credentials.d.ts +6 -1
  47. package/dist/credentials.js +45 -3
  48. package/dist/errors.d.ts +16 -1
  49. package/dist/errors.js +28 -0
  50. package/dist/execute.js +745 -282
  51. package/dist/executor-admission.d.ts +11 -1
  52. package/dist/executor-admission.js +145 -63
  53. package/dist/executors/quickjs-runtime.js +4 -2
  54. package/dist/executors/quickjs.js +255 -212
  55. package/dist/fix-prompt.js +37 -0
  56. package/dist/index.d.ts +72 -7
  57. package/dist/index.js +281 -26
  58. package/dist/invocation.js +371 -286
  59. package/dist/meta-tools.js +213 -94
  60. package/dist/module-contracts.d.ts +21 -1
  61. package/dist/oauth-callback-outcome.js +94 -0
  62. package/dist/oauth-sealing.js +29 -0
  63. package/dist/operator-ui/fix-prompts.js +87 -0
  64. package/dist/operator-ui/generated.js +2 -2
  65. package/dist/operator-ui/model.d.ts +103 -1
  66. package/dist/operator-ui/setup-commands.js +53 -0
  67. package/dist/operator-ui/view.js +128 -3
  68. package/dist/program-source.js +321 -0
  69. package/dist/providers/notion.js +2 -2
  70. package/dist/providers/revenuecat.js +32 -5
  71. package/dist/providers/stripe.d.ts +3 -2
  72. package/dist/providers/vercel.js +1 -1
  73. package/dist/registry.d.ts +43 -7
  74. package/dist/registry.js +434 -288
  75. package/dist/resumable.js +1291 -0
  76. package/dist/routes/activity.js +74 -154
  77. package/dist/routes/actor-labels.js +114 -0
  78. package/dist/routes/credentials.js +196 -163
  79. package/dist/routes/mcp.js +228 -112
  80. package/dist/routes/oauth-management.js +73 -71
  81. package/dist/routes/oauth.js +44 -16
  82. package/dist/routes/operator.js +83 -0
  83. package/dist/routes/shared.d.ts +25 -1
  84. package/dist/routes/shared.js +20 -2
  85. package/dist/routes/ui-data.js +211 -0
  86. package/dist/routes/ui.js +76 -35
  87. package/dist/run-journal.js +347 -0
  88. package/dist/runtime/admission.js +43 -0
  89. package/dist/runtime/call-admission.js +67 -0
  90. package/dist/runtime/connector-scope.js +72 -0
  91. package/dist/runtime/run.js +174 -0
  92. package/dist/runtime/services.js +130 -0
  93. package/dist/runtime/shared-read.js +106 -0
  94. package/dist/runtime/storage.js +66 -0
  95. package/dist/server.js +137 -89
  96. package/dist/skills.js +28 -9
  97. package/dist/storage/file.js +39 -2
  98. package/dist/storage/memory.js +28 -16
  99. package/dist/timeout.js +39 -43
  100. package/dist/tool-safety.d.ts +27 -1
  101. package/dist/tool-safety.js +31 -0
  102. package/dist/types.d.ts +45 -7
  103. package/dist/ui.d.ts +25 -4
  104. package/dist/ui.js +77 -167
  105. package/dist/url-safety.js +157 -0
  106. package/dist/version.d.ts +1 -1
  107. package/dist/version.js +1 -1
  108. package/documentation/architecture.md +367 -16
  109. package/documentation/auth.md +163 -2
  110. package/documentation/code-mode.md +274 -56
  111. package/documentation/meta-tools.md +200 -44
  112. package/ethos.md +46 -47
  113. package/examples/worker/AGENTS.md +6 -0
  114. package/examples/worker/README.md +224 -14
  115. package/examples/worker/src/d1-activity-row.ts +14 -2
  116. package/examples/worker/src/d1-activity.ts +4 -2
  117. package/examples/worker/src/d1-storage.ts +116 -0
  118. package/examples/worker/src/index.ts +42 -7
  119. package/examples/worker/src/r2-artifact-blobs.ts +29 -0
  120. package/examples/worker/wrangler.jsonc +21 -5
  121. package/package.json +16 -4
  122. package/templates/node/AGENTS.md +9 -2
  123. package/templates/node/README.md +31 -3
  124. package/templates/node/package.json +1 -1
  125. package/templates/node/src/index.ts +27 -0
  126. package/dist/auth/downstream-oauth.d.ts +0 -200
  127. package/dist/catalog-fingerprint.d.ts +0 -19
  128. package/dist/catalog-limits.d.ts +0 -9
  129. package/dist/catalog-service.d.ts +0 -263
  130. package/dist/catalog.d.ts +0 -87
  131. package/dist/concurrency.d.ts +0 -3
  132. package/dist/connectors/guarded-fetch.d.ts +0 -96
  133. package/dist/credential-rules.d.ts +0 -85
  134. package/dist/execute.d.ts +0 -154
  135. package/dist/executor-result.d.ts +0 -10
  136. package/dist/executors/quickjs-child.d.ts +0 -1
  137. package/dist/executors/quickjs-protocol.d.ts +0 -67
  138. package/dist/favicon.d.ts +0 -1
  139. package/dist/identity.d.ts +0 -4
  140. package/dist/invocation.d.ts +0 -74
  141. package/dist/mcp-result.d.ts +0 -8
  142. package/dist/meta-tools.d.ts +0 -129
  143. package/dist/operator-ui/generated.d.ts +0 -2
  144. package/dist/operator-ui/view.d.ts +0 -188
  145. package/dist/result-shapes.d.ts +0 -13
  146. package/dist/retired-toolkits.d.ts +0 -2
  147. package/dist/routes/activity.d.ts +0 -2
  148. package/dist/routes/credentials.d.ts +0 -2
  149. package/dist/routes/mcp.d.ts +0 -10
  150. package/dist/routes/oauth-management.d.ts +0 -2
  151. package/dist/routes/oauth.d.ts +0 -2
  152. package/dist/routes/ui.d.ts +0 -2
  153. package/dist/server.d.ts +0 -9
  154. package/dist/skills.d.ts +0 -44
  155. package/dist/timeout.d.ts +0 -21
@@ -1,10 +0,0 @@
1
- import { type RouteContext, type ServerOptions } from "./shared.js";
2
- export declare const MCP_CORS_HEADERS: {
3
- "Access-Control-Allow-Origin": string;
4
- "Access-Control-Allow-Methods": string;
5
- "Access-Control-Allow-Headers": string;
6
- };
7
- export declare function createMcpRoute(opts: ServerOptions): {
8
- handle(context: RouteContext): Promise<Response | null>;
9
- rejectOrigin(request: Request): Response | null;
10
- };
@@ -1,2 +0,0 @@
1
- import { type RouteContext } from "./shared.js";
2
- export declare function routeOAuthManagement(context: RouteContext): Promise<Response | null>;
@@ -1,2 +0,0 @@
1
- import { type RouteContext } from "./shared.js";
2
- export declare function routeOAuthCallback(context: RouteContext): Promise<Response | null>;
@@ -1,2 +0,0 @@
1
- import { type RouteContext } from "./shared.js";
2
- export declare function routeUi(context: RouteContext): Promise<Response | null>;
package/dist/server.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { type RuntimeExecutionContext, type ServerOptions } from "./routes/shared.js";
2
- export type { ServerOptions } from "./routes/shared.js";
3
- /**
4
- * Build the Web-standard fetch handler.
5
- *
6
- * Route ordering is the contract: private mutation routes precede wildcard
7
- * OPTIONS, and the security wrapper is applied to every response, including 404s.
8
- */
9
- export declare function createFetchHandler(opts: ServerOptions): (request: Request, runtimeContext?: RuntimeExecutionContext) => Promise<Response>;
package/dist/skills.d.ts DELETED
@@ -1,44 +0,0 @@
1
- import type { Connector } from "./types.js";
2
- export declare const CONNECTA_INSTRUCTIONS = "Choose a route before discovery. A known-address read needs only call_tool. Unknown-address read-only work starts with execute_code to discover, call, and return the answer; use the same route for reduction, multiple or dependent calls, loops, joins, or branches. Keep discovery and calls together when schemas suffice; do not return catalog matches alone. Inspect unfamiliar result shapes with a small sample before proceeding. Only readOnlyHint: true tools run there. Keep catalog inspection and unannotated, write-capable, or destructive work top level: search_tools then call_destructive_tool when a call is needed. After auth_required use authorize_connector. After a truncated direct result use get_result. Guidance is on demand: fetch skills({ name: \"usage\" }) only when these instructions and the tool description are insufficient or a run needs repair.";
3
- /** Shared Connecta routing guidance, byte-identical across deployments. */
4
- export declare const USAGE_SKILL: string;
5
- /** The always-loaded MCP `instructions` string. */
6
- export declare function instructionsFor(): string;
7
- /** True when at least one of `connectors` carries a usage guide. */
8
- export declare function hasConnectorGuides(connectors: readonly Connector[]): boolean;
9
- /** The skill name that fetches `connector`'s guide. */
10
- export declare function connectorSkillName(connectorId: string): string;
11
- /** The connector's guide, or undefined when it declares none (or a blank one). */
12
- export declare function connectorGuide(connector: Connector): string | undefined;
13
- /** Discovery budget for one connector-guide summary, including an ellipsis. */
14
- export declare const GUIDE_SUMMARY_LENGTH = 120;
15
- /** Normalize authored and derived summaries under one construction contract. */
16
- export declare function normalizeGuideSummary(summary: string): string | undefined;
17
- /** Bounded, decision-useful discovery summary for a connector guide. */
18
- export declare function connectorGuideSummary(connector: Connector): string | undefined;
19
- /** Whether correct use always depends on conventions outside the tool schema. */
20
- export declare function connectorGuideRequired(connector: Connector): boolean;
21
- export interface SkillListing {
22
- name: string;
23
- description: string;
24
- }
25
- /**
26
- * Every fetchable skill: the built-in guides plus one entry per connector that
27
- * carries a usage guide. Derived from the connector list passed in — the single
28
- * place guide visibility is decided.
29
- */
30
- export declare function listSkills(connectors: readonly Connector[]): SkillListing[];
31
- export type SkillLookup = {
32
- found: true;
33
- content: string;
34
- } | {
35
- found: false;
36
- message: string;
37
- };
38
- /**
39
- * Resolve one skill name. Built-in names match exactly; connector guides are
40
- * reachable only through the `connector:` prefix. Every miss — unknown name,
41
- * unknown connector, connector without a guide — is an explicit error, never a
42
- * silent fallback to the generic guide.
43
- */
44
- export declare function resolveSkill(name: string, connectors: readonly Connector[]): SkillLookup;
package/dist/timeout.d.ts DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * Generous default bound for a single downstream probe/catalog call. High enough
3
- * to trip only on a pathological hang, not a realistically slow probe.
4
- */
5
- export declare const DEFAULT_PROBE_TIMEOUT_MS = 30000;
6
- /** A finite, positive integer number of milliseconds, or undefined. */
7
- export declare function normalizeTimeoutMs(value: number | undefined): number | undefined;
8
- /** Resolve after `ms`, or false when the caller aborts first. */
9
- export declare function sleep(ms: number, signal?: AbortSignal): Promise<boolean>;
10
- export interface DeadlineOptions {
11
- timeoutMs?: number;
12
- signal?: AbortSignal;
13
- timeoutError: Error;
14
- }
15
- export declare function withDeadline<T>(operation: (signal: AbortSignal) => Promise<T>, options: DeadlineOptions): Promise<T>;
16
- /**
17
- * Give one operation a caller-facing deadline and the matching cancellation
18
- * signal. The timeout rejects with the stable, labelled error while aborting
19
- * any in-flight work that honors the signal.
20
- */
21
- export declare function withAbortableTimeout<T>(operation: (signal: AbortSignal) => Promise<T>, ms: number, label: string): Promise<T>;