@mainsoft/agent-cms 0.7.0 → 0.10.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/CHANGELOG.md +60 -0
- package/README.md +291 -32
- package/TODO.md +72 -26
- package/UPGRADE-0.10.md +36 -0
- package/UPGRADE-0.8.md +117 -0
- package/dist/agent.cjs +39 -17
- package/dist/agent.d.cts +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +9 -7
- package/dist/bin.js +4528 -355
- package/dist/{chunk-OQ55GEF3.js → chunk-3OPKTBEI.js} +1 -1
- package/dist/chunk-6PB4ZCHH.js +328 -0
- package/dist/chunk-7SCYDG2G.js +2943 -0
- package/dist/chunk-7WJIIJCI.js +544 -0
- package/dist/chunk-7Y6TU2UA.js +150 -0
- package/dist/{chunk-EXV6JNLY.js → chunk-AKCXMT3X.js} +15 -22
- package/dist/{chunk-QC2M4NZY.js → chunk-BFVBHIHV.js} +72 -1
- package/dist/chunk-DSJETZT4.js +493 -0
- package/dist/{chunk-IW3D4I7Q.js → chunk-IU2SMWAM.js} +246 -4
- package/dist/{chunk-VICZ76TR.js → chunk-KAO3Z3CF.js} +43 -2
- package/dist/{chunk-CRDW6Q72.js → chunk-MA6VKJ3F.js} +87 -25
- package/dist/{chunk-6K5ZTGHQ.js → chunk-PEQY4N73.js} +16 -0
- package/dist/{chunk-DOADAH4L.js → chunk-PGV2QPIL.js} +40 -0
- package/dist/{chunk-Y63XQS2J.js → chunk-TOZQYJFG.js} +1 -1
- package/dist/cli.cjs +4528 -355
- package/dist/cli.d.cts +19 -3
- package/dist/cli.d.ts +19 -3
- package/dist/cli.js +206 -16
- package/dist/client.cjs +72 -1
- package/dist/client.d.cts +308 -6
- package/dist/client.d.ts +308 -6
- package/dist/client.js +1 -1
- package/dist/cms-C_vkAxYV.d.cts +1537 -0
- package/dist/cms-pqJyowu1.d.ts +1537 -0
- package/dist/config.d.cts +7 -1
- package/dist/config.d.ts +7 -1
- package/dist/drizzle-repo-CviH3EX7.d.cts +146 -0
- package/dist/drizzle-repo-DWLD0rWe.d.ts +146 -0
- package/dist/errors.cjs +82 -1
- package/dist/errors.d.cts +43 -3
- package/dist/errors.d.ts +43 -3
- package/dist/errors.js +2 -2
- package/dist/frontmatter.d.cts +5 -4
- package/dist/frontmatter.d.ts +5 -4
- package/dist/http.cjs +640 -94
- package/dist/http.d.cts +51 -2
- package/dist/http.d.ts +51 -2
- package/dist/http.js +203 -13
- package/dist/index.cjs +3759 -575
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +226 -30
- package/dist/markdown.cjs +89 -25
- package/dist/markdown.d.cts +57 -3
- package/dist/markdown.d.ts +57 -3
- package/dist/markdown.js +5 -1
- package/dist/mcp.cjs +314 -37
- package/dist/mcp.d.cts +3 -2
- package/dist/mcp.d.ts +3 -2
- package/dist/mcp.js +12 -9
- package/dist/messages/en.cjs +40 -0
- package/dist/messages/en.js +1 -1
- package/dist/messages/ko.cjs +40 -0
- package/dist/messages/ko.js +40 -0
- package/dist/registry/cms-audit.json +1 -1
- package/dist/registry/cms-doc-editor.json +15 -4
- package/dist/registry/cms-doc-list.json +2 -1
- package/dist/registry/cms-files.json +29 -0
- package/dist/registry/cms-lib.json +3 -3
- package/dist/registry/cms-media-picker.json +29 -0
- package/dist/registry/cms-media.json +28 -0
- package/dist/registry/cms-preview-comments.json +24 -0
- package/dist/registry/cms-releases.json +28 -0
- package/dist/registry/cms-shell.json +2 -2
- package/dist/registry/cms-trash.json +24 -0
- package/dist/registry/cms-versions.json +2 -1
- package/dist/registry/registry.json +163 -3
- package/dist/storage-s3.cjs +168 -0
- package/dist/storage-s3.d.cts +53 -0
- package/dist/storage-s3.d.ts +53 -0
- package/dist/storage-s3.js +143 -0
- package/dist/storage.cjs +373 -0
- package/dist/storage.d.cts +183 -0
- package/dist/storage.d.ts +183 -0
- package/dist/storage.js +49 -0
- package/dist/tables.cjs +251 -3
- package/dist/tables.d.cts +4965 -681
- package/dist/tables.d.ts +4965 -681
- package/dist/tables.js +14 -2
- package/dist/tools.cjs +331 -20
- package/dist/tools.d.cts +54 -7
- package/dist/tools.d.ts +54 -7
- package/dist/tools.js +16 -7
- package/dist/types.cjs +99 -1
- package/dist/types.d.cts +205 -5
- package/dist/types.d.ts +205 -5
- package/dist/types.js +5 -3
- package/package.json +32 -22
- package/dist/ai.cjs +0 -555
- package/dist/ai.d.cts +0 -48
- package/dist/ai.d.ts +0 -48
- package/dist/ai.js +0 -73
- package/dist/chunk-52NUUZC7.js +0 -1446
- package/dist/chunk-IGL2V6US.js +0 -324
- package/dist/chunk-QQV6VLYJ.js +0 -204
- package/dist/cms-BPp01z-8.d.ts +0 -411
- package/dist/cms-D6D89-qZ.d.cts +0 -411
- package/dist/drizzle-repo-B1rt7r4j.d.ts +0 -90
- package/dist/drizzle-repo-Cn-kL2FK.d.cts +0 -90
- package/dist/repo-BWI2Pkrv.d.ts +0 -162
- package/dist/repo-CeDxUxO6.d.cts +0 -162
package/dist/ai.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCmsClient,
|
|
3
|
-
isCmsRemoteError
|
|
4
|
-
} from "./chunk-QC2M4NZY.js";
|
|
5
|
-
import {
|
|
6
|
-
CMS_TOOLS,
|
|
7
|
-
toolsFor
|
|
8
|
-
} from "./chunk-QQV6VLYJ.js";
|
|
9
|
-
import {
|
|
10
|
-
coreOf
|
|
11
|
-
} from "./chunk-52NUUZC7.js";
|
|
12
|
-
import "./chunk-6K5ZTGHQ.js";
|
|
13
|
-
import "./chunk-OQ55GEF3.js";
|
|
14
|
-
import "./chunk-AKN7SUXU.js";
|
|
15
|
-
import {
|
|
16
|
-
isCmsError
|
|
17
|
-
} from "./chunk-VICZ76TR.js";
|
|
18
|
-
import "./chunk-DOADAH4L.js";
|
|
19
|
-
import "./chunk-CRDW6Q72.js";
|
|
20
|
-
import "./chunk-2NTK7H4W.js";
|
|
21
|
-
|
|
22
|
-
// src/ai.ts
|
|
23
|
-
import { tool, zodSchema } from "ai";
|
|
24
|
-
function wrap(def, run) {
|
|
25
|
-
return tool({
|
|
26
|
-
description: def.description,
|
|
27
|
-
inputSchema: zodSchema(def.input),
|
|
28
|
-
execute: async (args) => {
|
|
29
|
-
try {
|
|
30
|
-
return await run(args);
|
|
31
|
-
} catch (err) {
|
|
32
|
-
if (isCmsError(err)) return err.toJSON();
|
|
33
|
-
if (isCmsRemoteError(err)) return { error: err.code, kind: err.kind, message: err.message, params: err.params ?? {}, ...err.diagnostics ? { diagnostics: err.diagnostics } : {}, ...err.current !== void 0 ? { current: err.current } : {} };
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function cmsTools(cms, actor, opts = {}) {
|
|
40
|
-
const core = coreOf(cms);
|
|
41
|
-
const tagged = { ...actor, via: actor.via ?? "ai" };
|
|
42
|
-
const out = {};
|
|
43
|
-
for (const def of toolsFor(core, tagged, opts.only)) {
|
|
44
|
-
out[(opts.prefix ?? "") + def.name] = wrap(def, async (args) => {
|
|
45
|
-
try {
|
|
46
|
-
return await def.run(core, tagged, def.input.parse(args));
|
|
47
|
-
} catch (e) {
|
|
48
|
-
if (isCmsError(e)) Object.defineProperty(e, "message", { value: core.message(e) });
|
|
49
|
-
throw e;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return out;
|
|
54
|
-
}
|
|
55
|
-
function remoteCmsTools(client, opts = {}) {
|
|
56
|
-
const api = createCmsClient(client);
|
|
57
|
-
const out = {};
|
|
58
|
-
for (const def of CMS_TOOLS) {
|
|
59
|
-
if (opts.only && !opts.only.includes(def.name)) continue;
|
|
60
|
-
out[(opts.prefix ?? "") + def.name] = wrap(def, (args) => api.call(def.name, args));
|
|
61
|
-
}
|
|
62
|
-
return out;
|
|
63
|
-
}
|
|
64
|
-
async function remoteCmsToolsFor(client, opts = {}) {
|
|
65
|
-
const allowed = new Set((await createCmsClient(client).listTools()).map((t) => t.name));
|
|
66
|
-
const names = CMS_TOOLS.map((t) => t.name).filter((n) => allowed.has(n) && (!opts.only || opts.only.includes(n)));
|
|
67
|
-
return remoteCmsTools(client, { ...opts, only: names });
|
|
68
|
-
}
|
|
69
|
-
export {
|
|
70
|
-
cmsTools,
|
|
71
|
-
remoteCmsTools,
|
|
72
|
-
remoteCmsToolsFor
|
|
73
|
-
};
|