@zackbart/connecta 0.25.0 → 0.26.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 (100) hide show
  1. package/AGENTS.md +6 -5
  2. package/CHANGELOG.md +387 -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/artifacts/connector.d.ts +55 -0
  9. package/dist/artifacts/connector.js +724 -0
  10. package/dist/artifacts/document.js +80 -0
  11. package/dist/artifacts/guide.js +140 -0
  12. package/dist/artifacts/html-scan.js +329 -0
  13. package/dist/artifacts/json.js +68 -0
  14. package/dist/artifacts/kv-store.d.ts +20 -0
  15. package/dist/artifacts/kv-store.js +140 -0
  16. package/dist/artifacts/markdown.js +478 -0
  17. package/dist/artifacts/module.d.ts +37 -0
  18. package/dist/artifacts/module.js +60 -0
  19. package/dist/artifacts/operations.d.ts +195 -0
  20. package/dist/artifacts/operations.js +944 -0
  21. package/dist/artifacts/refresh.d.ts +53 -0
  22. package/dist/artifacts/refresh.js +235 -0
  23. package/dist/artifacts/routes.js +217 -0
  24. package/dist/artifacts/types.d.ts +214 -0
  25. package/dist/artifacts/types.js +22 -0
  26. package/dist/artifacts/validate.d.ts +62 -0
  27. package/dist/artifacts/validate.js +653 -0
  28. package/dist/artifacts.d.ts +6 -0
  29. package/dist/artifacts.js +9 -0
  30. package/dist/auth/downstream-oauth.js +397 -48
  31. package/dist/auth/oauth-start-reset.js +20 -0
  32. package/dist/branding.d.ts +87 -0
  33. package/dist/branding.js +170 -1
  34. package/dist/catalog-service.js +39 -29
  35. package/dist/catalog.js +42 -8
  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/connectors/remote-mcp.js +48 -9
  41. package/dist/errors.d.ts +16 -1
  42. package/dist/errors.js +28 -0
  43. package/dist/execute.js +431 -75
  44. package/dist/executor-admission.d.ts +11 -1
  45. package/dist/executor-admission.js +79 -14
  46. package/dist/executors/quickjs.js +4 -2
  47. package/dist/index.d.ts +62 -6
  48. package/dist/index.js +230 -6
  49. package/dist/invocation.js +56 -10
  50. package/dist/meta-tools.js +7 -2
  51. package/dist/module-contracts.d.ts +21 -1
  52. package/dist/oauth-callback-outcome.js +43 -18
  53. package/dist/operator-ui/generated.js +2 -2
  54. package/dist/operator-ui/model.d.ts +62 -5
  55. package/dist/operator-ui/view.js +372 -28
  56. package/dist/page-styles.js +7 -0
  57. package/dist/program-source.js +116 -0
  58. package/dist/registry.d.ts +42 -6
  59. package/dist/registry.js +164 -60
  60. package/dist/resumable.js +1291 -0
  61. package/dist/routes/activity.js +6 -69
  62. package/dist/routes/actor-labels.js +114 -0
  63. package/dist/routes/credentials.js +27 -5
  64. package/dist/routes/mcp.js +120 -59
  65. package/dist/routes/oauth-management.js +87 -20
  66. package/dist/routes/oauth.js +54 -87
  67. package/dist/routes/operator.js +1 -0
  68. package/dist/routes/shared.d.ts +23 -1
  69. package/dist/routes/shared.js +20 -2
  70. package/dist/routes/ui-data.js +2 -1
  71. package/dist/routes/ui.js +19 -4
  72. package/dist/run-journal.js +347 -0
  73. package/dist/runtime/shared-read.js +106 -0
  74. package/dist/server.js +30 -2
  75. package/dist/skills.js +30 -11
  76. package/dist/timeout.js +26 -0
  77. package/dist/tool-safety.d.ts +35 -0
  78. package/dist/tool-safety.js +31 -0
  79. package/dist/types.d.ts +23 -0
  80. package/dist/ui.d.ts +17 -5
  81. package/dist/ui.js +51 -68
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/documentation/architecture.md +214 -27
  85. package/documentation/auth.md +186 -2
  86. package/documentation/code-mode.md +236 -63
  87. package/documentation/meta-tools.md +55 -29
  88. package/ethos.md +12 -10
  89. package/examples/worker/AGENTS.md +6 -0
  90. package/examples/worker/README.md +174 -10
  91. package/examples/worker/src/d1-activity-row.ts +14 -2
  92. package/examples/worker/src/d1-activity.ts +4 -2
  93. package/examples/worker/src/index.ts +36 -1
  94. package/examples/worker/src/r2-artifact-blobs.ts +29 -0
  95. package/examples/worker/wrangler.jsonc +5 -1
  96. package/package.json +6 -2
  97. package/templates/node/AGENTS.md +9 -2
  98. package/templates/node/README.md +31 -3
  99. package/templates/node/package.json +1 -1
  100. package/templates/node/src/index.ts +27 -0
@@ -46,11 +46,32 @@ reproducible `npm ci` path.
46
46
 
47
47
  ## Select optional modules
48
48
 
49
+ For scheduled artifact pages, uncomment the `artifacts()` module and hourly
50
+ `setInterval` block in `src/index.ts`. The module uses the same CAS-capable
51
+ state file and exposes `runDue()` for the timer; core starts no job on its own.
52
+ Each tick starts at most 10 due pages. Refresh programs can call only shared
53
+ connectors' explicitly read-only tools within the program owner's current
54
+ grants. Revoking refresh or pool access stops future runs. Failed runs leave the last good data
55
+ and mark the viewer stale.
56
+
49
57
  The template explicitly enables `ui: operatorUi()` from
50
58
  `@zackbart/connecta/ui`. Open `http://localhost:8787/` and supply the configured
51
59
  bearer to inspect Connections. Omit that option and import for an API-only
52
60
  server. OAuth callbacks remain in core even with no UI.
53
61
 
62
+ The page labels whether each tool runs in programs or needs approval. For
63
+ classified connection failures it offers a fixed repair prompt, and its
64
+ endpoint section has client setup commands for `/mcp` and any pool available
65
+ to the signed-in identity. Those commands contain no bearer token.
66
+
67
+ Branding belongs in `operatorUi({ branding })`: `productName`, `ownerName`,
68
+ their URLs, `description`, `pageTitle`, `favicon`, and `theme`. The theme is
69
+ five tokens — `accent`, `radius`, `fontFamily`, `monoFamily`, and
70
+ `colorScheme` — and every other color is mixed from them, so one accent themes
71
+ the whole page. A value that fails its gate falls back to the default, and the
72
+ startup warning names it. `src/index.ts` carries the full shape commented out
73
+ above `ui: operatorUi()`.
74
+
54
75
  Connection management needs an interactive identity. A configured bearer is a
55
76
  client key and never authorizes browser credential mutations. To enable Clerk:
56
77
 
@@ -89,6 +110,12 @@ it through `await ctx.credential?.get()`, or use a provider such as `notion()`
89
110
  that declares its own slot. Authorized humans manage the slot inside that
90
111
  connection on `/`; there is no separate Credentials tab.
91
112
 
113
+ In 0.25.0, this vault also seals downstream OAuth tokens on their first read.
114
+ That is a one-way state migration for those tokens: rolling back to 0.24.x
115
+ requires authorizing each OAuth connector again. See the
116
+ [0.25.0 changelog](../../CHANGELOG.md#0250--2026-09-23) before upgrading a
117
+ deployment with existing OAuth connections.
118
+
92
119
  A saved replacement takes effect on the next call. Connecta tests credentials
93
120
  only on an explicit action and otherwise fails at use. Without a vault or UI,
94
121
  static credential recovery reports unavailable instead of offering a dead link.
@@ -132,16 +159,17 @@ npm run typecheck
132
159
  CONNECTA_TOKEN=dev-token npm run doctor
133
160
  ```
134
161
 
135
- Doctor checks health, the executor, and the exact prescribed seven-tool
162
+ Doctor checks health, the executor, and the exact prescribed eight-tool
136
163
  model-facing surface by running a harmless sandbox program. It reads the bearer
137
164
  from `CONNECTA_TOKEN`; it never accepts the secret as a command-line argument.
138
165
  Remote URLs must use HTTPS.
139
166
 
140
167
  A fully-wired deployment reports exactly the same line as a bare one —
141
- connector count, QuickJS executed, seven tools, plus any catalog drift:
168
+ connector count, QuickJS executed, eight tools, plus any catalog drift, and
169
+ a note if resumable writes are off:
142
170
 
143
171
  ```text
144
- Connecta doctor passed: 1 connector(s), QuickJS executed, prescribed seven-tool surface.
172
+ Connecta doctor passed: 1 connector(s), QuickJS executed, prescribed eight-tool surface.
145
173
  ```
146
174
 
147
175
  `QuickJS` is this deployment's sandbox, reported by the deployment itself —
@@ -15,7 +15,7 @@
15
15
  "typecheck": "tsc --noEmit"
16
16
  },
17
17
  "dependencies": {
18
- "@zackbart/connecta": "0.25.0",
18
+ "@zackbart/connecta": "0.26.1",
19
19
  "quickjs-emscripten": "0.32.0"
20
20
  },
21
21
  "devDependencies": {
@@ -27,6 +27,7 @@ import { operatorUi } from "@zackbart/connecta/ui";
27
27
  import { api, createConnecta } from "@zackbart/connecta";
28
28
  import { fileStorage, listen } from "@zackbart/connecta/node";
29
29
  import { quickJsExecutor } from "@zackbart/connecta/quickjs";
30
+ // import { artifacts, kvArtifactStore } from "@zackbart/connecta/artifacts";
30
31
  // Operator sign-in. Needs `npm install @clerk/backend` — it is an optional
31
32
  // peer, so it does not install with Connecta.
32
33
  // import { clerkAuth } from "@zackbart/connecta/auth/clerk";
@@ -45,6 +46,8 @@ const port = Number(process.env.PORT ?? 8787);
45
46
  const stateFile = process.env.CONNECTA_STATE_FILE || "./.connecta-state.json";
46
47
  const publicUrl = process.env.PUBLIC_URL || `http://localhost:${port}`;
47
48
  const storage = fileStorage(stateFile);
49
+ // Optional artifact pages and refresh jobs use the same CAS-capable state file:
50
+ // const artifactModule = artifacts({ store: kvArtifactStore(storage) });
48
51
 
49
52
  // Operator sign-in. A bearer token is a client key: it may call tools and read
50
53
  // connector status, but only a Clerk-authenticated human may write a visible
@@ -103,7 +106,25 @@ const connecta = createConnecta({
103
106
  // ),
104
107
  // deploymentId: "production",
105
108
  // }),
109
+ // The operator UI at /. Its branding is code, like everything else here:
110
+ // name, owner, description, favicon, and five theme tokens that every
111
+ // other color is mixed from. A value that fails its check falls back to the
112
+ // default, and the startup warning names it.
113
+ // ui: operatorUi({
114
+ // branding: {
115
+ // productName: "Acme Tools",
116
+ // ownerName: "Acme",
117
+ // theme: {
118
+ // accent: "#2f5fe0", // hex only
119
+ // radius: 10, // pixels, or a CSS length such as "0.5rem"
120
+ // fontFamily: "Inter, system-ui, sans-serif",
121
+ // monoFamily: "ui-monospace, monospace",
122
+ // colorScheme: "system", // or "light" | "dark"
123
+ // },
124
+ // },
125
+ // }),
106
126
  ui: operatorUi(),
127
+ // artifacts: artifactModule,
107
128
  connectors: [
108
129
  api("time", {
109
130
  description: "Time — current timestamp",
@@ -126,3 +147,9 @@ const connecta = createConnecta({
126
147
 
127
148
  listen(connecta, port);
128
149
  console.log(`connecta listening on port ${port}; MCP at ${publicUrl}/mcp`);
150
+ // The deployment owns this timer; core starts no background work. Uncomment
151
+ // with artifactModule above. Each tick starts at most 10 due pages.
152
+ // const refreshTimer = setInterval(() => {
153
+ // void artifactModule.runDue().catch((error) => console.error("artifact refresh failed", error));
154
+ // }, 60 * 60 * 1000);
155
+ // refreshTimer.unref();