@arbol-ai/maximus 7.3.1 → 8.0.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.
- package/README.md +36 -38
- package/bin/maximus.js +4 -0
- package/config/oxfmt.mjs +1 -0
- package/config/oxlint.mjs +10 -0
- package/dist/analytics/analytics.d.ts +21 -9
- package/dist/analytics/analytics.js +19 -5
- package/dist/body.d.ts +1 -1
- package/dist/body.js +2 -2
- package/dist/chunks/agent-skills-Ef65jTf_.js +49 -0
- package/dist/chunks/agent-skills-m7y1EUch.js +3 -0
- package/dist/chunks/{body-6LichrQm.js → body-DOIHwIIl.js} +14 -7
- package/dist/chunks/{correlation-BEkcFFGT.js → correlation-4b23a-a4.js} +8 -5
- package/dist/chunks/define-app-CfVZBt7D.js +336 -0
- package/dist/chunks/errors-WfyKhiyk.js +131 -0
- package/dist/chunks/execution-CfZEx_JP.js +84 -0
- package/dist/chunks/generate-C-9FKW0o.js +197 -0
- package/dist/chunks/handler-DWTGoduQ.js +140 -0
- package/dist/chunks/http-layout-_h7xwgPC.js +128 -0
- package/dist/chunks/http-paths-DMBxwpp6.js +218 -0
- package/dist/chunks/{json-Bu4BLT25.js → json-B14evE6-.js} +21 -5
- package/dist/chunks/names-ncD7A3DV.js +280 -0
- package/dist/chunks/openapi-CV0KmJpS.js +1588 -0
- package/dist/chunks/openapi-file-OjSs9mRv.js +83 -0
- package/dist/chunks/pages-DyC0m8Zb.js +14 -0
- package/dist/chunks/prepare-configured-BmRJLg6J.js +3 -0
- package/dist/chunks/prepare-configured-Cithjf80.js +52 -0
- package/dist/chunks/project-files-C0OX7MQQ.js +130 -0
- package/dist/chunks/query-kind-CWKAXEME.js +40 -0
- package/dist/chunks/record-DQUDTpEA.js +10 -0
- package/dist/chunks/result-CKgZHrnj.js +56 -0
- package/dist/chunks/{runtime-BPnaa-NK.js → runtime-CVVf5hmp.js} +50 -25
- package/dist/chunks/scaffold-DGrcjR3h.js +3 -0
- package/dist/chunks/scaffold-DZD6dfoZ.js +138 -0
- package/dist/chunks/{schemas-CzTvbXb6.js → schemas-p_aRcMC1.js} +30 -14
- package/dist/chunks/server-CCc7fil4.js +410 -0
- package/dist/chunks/src--HZrH1U9.js +568 -0
- package/dist/chunks/standard-failures-CLjxS2ea.js +74 -0
- package/dist/chunks/{telemetry-BTwB68m5.js → telemetry-C3LfZcOB.js} +32 -11
- package/dist/chunks/{types-BWxDd3tY.d.ts → types-BQYB4Ads.d.ts} +998 -337
- package/dist/chunks/{validation-r-sgmsqb.js → validation-fTohBT6R.js} +69 -28
- package/dist/chunks/workers-types-iONp32T4.d.ts +143 -0
- package/dist/chunks/yaml-Dk2L24yQ.js +74 -0
- package/dist/diagnostics.d.ts +6 -4
- package/dist/diagnostics.js +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -125
- package/dist/http-paths.d.ts +1 -1
- package/dist/http-paths.js +1 -197
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -10
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +5 -3
- package/dist/mcp/index.d.ts +3 -2
- package/dist/mcp/index.js +5 -387
- package/dist/postgres/index.d.ts +25 -8
- package/dist/postgres/index.js +17 -8
- package/dist/project/config.d.ts +139 -0
- package/dist/project/config.js +196 -0
- package/dist/project/index.d.ts +17 -4
- package/dist/project/index.js +44 -9
- package/dist/projection.d.ts +14 -13
- package/dist/projection.js +8 -32
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +2 -2
- package/dist/standard-failures.d.ts +2 -89
- package/dist/standard-failures.js +1 -72
- package/dist/tooling/cli.js +151 -107
- package/dist/tooling/testing.js +2 -2
- package/dist/vite/cloudflare-workers.js +25 -0
- package/dist/vite/index.d.ts +157 -0
- package/dist/vite/index.js +1477 -0
- package/dist/webhooks.d.ts +12 -10
- package/dist/webhooks.js +26 -12
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +30 -22
- package/skills/maximus/SKILL.md +165 -69
- package/skills/maximus/references/deploying.md +73 -0
- package/skills/maximus/references/errors-and-results.md +114 -55
- package/skills/maximus/references/project.md +202 -0
- package/skills/maximus/references/routes-and-tools.md +256 -0
- package/skills/maximus/references/testing.md +137 -50
- package/skills/maximus/references/transports.md +113 -100
- package/skills/maximus/references/writing-code.md +84 -0
- package/templates/mcp/mcp/instructions.md.template +2 -0
- package/templates/mcp/routes/v1/greeting.get.ts.template +12 -0
- package/templates/mcp/tests/mcp.test.ts.template +36 -0
- package/templates/project/.agents/skills/project/SKILL.md.template +21 -12
- package/templates/project/.github/workflows/ci.yml.template +4 -1
- package/templates/project/CLAUDE.md.template +41 -22
- package/templates/project/README.md.template +54 -47
- package/templates/project/middleware/10-response.ts.template +16 -0
- package/templates/project/package.json.template +16 -8
- package/templates/project/pages/index.ts.template +2 -4
- package/templates/project/routes/v1/greeting.get.ts.template +10 -0
- package/templates/project/routes/v1/greeting.post.ts.template +12 -0
- package/templates/project/tests/greeting.test.ts.template +45 -0
- package/templates/project/tsconfig.json.template +8 -5
- package/templates/project/vite.config.ts.template +15 -7
- package/templates/web/app/main.tsx.template +16 -0
- package/templates/web/app/root.tsx.template +17 -0
- package/templates/web/app/routes/index.tsx.template +9 -0
- package/templates/web/index.html.template +12 -0
- package/templates/web/package.json.template +12 -0
- package/templates/web/tsconfig.json.template +7 -0
- package/templates/web/vite.config.ts.template +22 -0
- package/dist/chunks/execution-B-yy4C7N.js +0 -691
- package/dist/chunks/prepare-project-zi106pWF.js +0 -146
- package/dist/chunks/record-DY-lX9w1.js +0 -34
- package/dist/chunks/src-DPSpGNnT.js +0 -1164
- package/dist/client/client.d.ts +0 -129
- package/dist/client/client.js +0 -321
- package/dist/tooling/vite.d.ts +0 -3
- package/dist/tooling/vite.js +0 -44
- package/skills/maximus/references/adding-an-operation.md +0 -179
- package/skills/maximus/references/building-a-service.md +0 -167
- package/skills/maximus/references/migration-from-v2.md +0 -62
- package/skills/maximus/references/migration-to-v5.md +0 -37
- package/skills/maximus/references/publishing-and-verification.md +0 -39
- package/templates/project/cloudflare.config.ts.template +0 -24
- package/templates/project/routes/v1/greeting.ts.template +0 -22
- package/templates/project/src/app.ts.template +0 -2
- package/templates/project/src/application.ts.template +0 -26
- package/templates/project/src/index.ts.template +0 -3
- package/templates/project/src/worker.ts.template +0 -6
- package/templates/service/.agents/skills/project/SKILL.md.template +0 -10
- package/templates/service/.github/workflows/ci.yml.template +0 -21
- package/templates/service/.gitignore.template +0 -9
- package/templates/service/CLAUDE.md.template +0 -5
- package/templates/service/README.md.template +0 -45
- package/templates/service/cloudflare.config.ts.template +0 -30
- package/templates/service/package.json.template +0 -36
- package/templates/service/src/app.ts.template +0 -30
- package/templates/service/src/index.ts.template +0 -13
- package/templates/service/tests/contract.test.ts.template +0 -12
- package/templates/service/tsconfig.json.template +0 -16
- package/templates/service/vite.config.ts.template +0 -13
- package/templates/service/vitest.config.ts.template +0 -10
|
@@ -5,7 +5,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
5
5
|
* Safe error descriptions for diagnostics: an error's known names, its causes' names, its issue count and
|
|
6
6
|
* its stack locations, never a message.
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
8
|
+
/** The built-in error names a description keeps; `createDiagnostics` adds the names a consumer supplies. */
|
|
9
9
|
const BUILTIN_ERROR_NAMES = [
|
|
10
10
|
"AbortError",
|
|
11
11
|
"AggregateError",
|
|
@@ -19,7 +19,10 @@ const BUILTIN_ERROR_NAMES = [
|
|
|
19
19
|
"TypeError",
|
|
20
20
|
"URIError"
|
|
21
21
|
];
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* A property of a thrown value, or undefined when it has none or reading it throws, so a getter or a Proxy
|
|
24
|
+
* cannot break the handling of an error.
|
|
25
|
+
*/
|
|
23
26
|
function errorProperty(value, key) {
|
|
24
27
|
try {
|
|
25
28
|
return typeof value === "object" && value !== null && key in value ? Reflect.get(value, key) : void 0;
|
|
@@ -28,9 +31,11 @@ function errorProperty(value, key) {
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* The error describer for diagnostics, for an SDK's events or a log line its owner writes: `describeError`
|
|
35
|
+
* answers an `ErrorDescription`, and `safeErrorName` an error's name when it is built in or among
|
|
36
|
+
* `errorNames`, else `UnknownError`. Pass constant names of your own errors, never a value taken from an
|
|
37
|
+
* upstream response. No message, record key, URL or query parameter reaches a description, and nothing is
|
|
38
|
+
* logged.
|
|
34
39
|
*/
|
|
35
40
|
function createDiagnostics(errorNames = []) {
|
|
36
41
|
const names = /* @__PURE__ */ new Set([...BUILTIN_ERROR_NAMES, ...errorNames]);
|
|
@@ -118,7 +123,10 @@ function activeTraceId(config) {
|
|
|
118
123
|
return null;
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Logs a refused admission (`maximus.admission.rejected`) and hands it to the observers as background work.
|
|
128
|
+
* Nothing is recorded while telemetry is off or without a background context.
|
|
129
|
+
*/
|
|
122
130
|
function recordAdmission(manifest, env, background, admission) {
|
|
123
131
|
if (!background || !telemetryEnabled(manifest.telemetry, env)) return;
|
|
124
132
|
const event = {
|
|
@@ -148,11 +156,20 @@ function recordAdmission(manifest, env, background, admission) {
|
|
|
148
156
|
for (const observer of manifest.telemetry?.observers ?? []) if (observer.admission) deliver(background, event.requestId, () => observer.admission?.(event, env));
|
|
149
157
|
}
|
|
150
158
|
/**
|
|
151
|
-
* Whether telemetry is on for this env: it is unless `enabled` is false, or a function that returns false
|
|
152
|
-
* has no env to read.
|
|
159
|
+
* Whether telemetry is on for this env: it is unless `enabled` is false, or a function that returns false,
|
|
160
|
+
* has no env to read or throws.
|
|
153
161
|
*/
|
|
154
162
|
function telemetryEnabled(config, env) {
|
|
155
|
-
|
|
163
|
+
if (typeof config?.enabled !== "function") return config?.enabled !== false;
|
|
164
|
+
if (env === void 0) return false;
|
|
165
|
+
try {
|
|
166
|
+
return config.enabled(env);
|
|
167
|
+
} catch {
|
|
168
|
+
try {
|
|
169
|
+
console.error(JSON.stringify({ event: "maximus.telemetry.switch_failed" }));
|
|
170
|
+
} catch {}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
156
173
|
}
|
|
157
174
|
/** Describes errors by their built-in names only. */
|
|
158
175
|
const diagnostics = createDiagnostics();
|
|
@@ -182,7 +199,8 @@ function diagnosticsEnabled() {
|
|
|
182
199
|
}
|
|
183
200
|
/**
|
|
184
201
|
* Logs an unexpected error by its safe description only (`maximus.unexpected`: error and cause names, issue
|
|
185
|
-
* count, stack locations; never a message) and tells the observers.
|
|
202
|
+
* count, stack locations; never a message) and tells the observers of the current `withDiagnostics` scope.
|
|
203
|
+
* It does nothing while diagnostics are off.
|
|
186
204
|
*/
|
|
187
205
|
function reportUnexpected(error, surface = "application", requestId) {
|
|
188
206
|
if (!diagnosticsEnabled()) return;
|
|
@@ -198,7 +216,10 @@ function reportUnexpected(error, surface = "application", requestId) {
|
|
|
198
216
|
observer.error?.(error, surface, requestId);
|
|
199
217
|
} catch {}
|
|
200
218
|
}
|
|
201
|
-
/**
|
|
219
|
+
/**
|
|
220
|
+
* Hands the observation of one operation call to the observers, as background work. Nothing is recorded
|
|
221
|
+
* while telemetry is off or without a background context.
|
|
222
|
+
*/
|
|
202
223
|
function recordExecution(manifest, env, background, invocation) {
|
|
203
224
|
if (!background || !telemetryEnabled(manifest.telemetry, env)) return;
|
|
204
225
|
const event = {
|