@xanots/sdk 0.0.3 → 0.0.5

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 (93) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +38 -1
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/agent-file-refresh-IJ7GN2FJ.js +17 -0
  5. package/dist/bin.js +12 -153
  6. package/dist/{capture-HUV5BNTC.js → capture-7PO6SGB4.js} +2 -2
  7. package/dist/{chunk-CMZLPTGW.js → chunk-7SISR3CS.js} +2 -2
  8. package/dist/{chunk-XQ22GLYS.js → chunk-AAFBSOSD.js} +6 -6
  9. package/dist/{chunk-BT2CSEC5.js → chunk-APOR6TCV.js} +4 -4
  10. package/dist/{chunk-55VHDNW5.js → chunk-BPEEGJJA.js} +108 -3
  11. package/dist/{chunk-U3G2UW65.js → chunk-CYJ7R3AD.js} +3 -3
  12. package/dist/{agent-file-refresh-6M5M7T24.js → chunk-D6OGU2AI.js} +5 -6
  13. package/dist/chunk-ERQZFWIW.js +22 -0
  14. package/dist/{chunk-DYCLVQXW.js → chunk-F5T45NAM.js} +31 -2
  15. package/dist/{chunk-TQUO2OXY.js → chunk-FN4OQT2J.js} +4 -4
  16. package/dist/{chunk-6USV65XA.js → chunk-IVP6TS26.js} +2 -2
  17. package/dist/{chunk-HQ2CBRVI.js → chunk-KXCPZUUM.js} +10 -8
  18. package/dist/{chunk-7REDODS2.js → chunk-LLWK6H77.js} +20 -2
  19. package/dist/{chunk-HJPTWBLH.js → chunk-MFIHIS6B.js} +2 -2
  20. package/dist/{chunk-3NFUWXOC.js → chunk-MS3BRZAZ.js} +146 -45
  21. package/dist/{chunk-2V4YE6QC.js → chunk-OARSPAIE.js} +112 -21
  22. package/dist/{chunk-7DKX2SPN.js → chunk-OR43PDCW.js} +4 -4
  23. package/dist/chunk-PGBK64U5.js +59 -0
  24. package/dist/{chunk-F6JCFRKO.js → chunk-PXXLBXOP.js} +2 -2
  25. package/dist/{chunk-W2G2WPTB.js → chunk-QA5ICJ4M.js} +3 -3
  26. package/dist/{chunk-YZ4GU6F5.js → chunk-QUUB7HYK.js} +5 -838
  27. package/dist/{chunk-C56BC2FY.js → chunk-SG4UBJ47.js} +2 -2
  28. package/dist/{chunk-76QBEIGO.js → chunk-T4XPCJRF.js} +3 -2
  29. package/dist/{chunk-VTIL47DT.js → chunk-W5NOKYEG.js} +6 -2
  30. package/dist/chunk-WGDAOOXG.js +845 -0
  31. package/dist/{chunk-DGSF2Q5H.js → chunk-WJYB7DSI.js} +2 -2
  32. package/dist/{chunk-4YMD2OOZ.js → chunk-XHEXOES3.js} +1 -1
  33. package/dist/{chunk-4HT3BNZ7.js → chunk-YUBJLB6G.js} +10 -2
  34. package/dist/{chunk-5L4X5LS6.js → chunk-YUPQOLFX.js} +77 -2
  35. package/dist/chunk-ZGA5MUNC.js +173 -0
  36. package/dist/{chunk-P3TTMWUP.js → chunk-ZOYMZZ3S.js} +8 -1
  37. package/dist/chunk-ZSYZTGJH.js +81 -0
  38. package/dist/cli.d.ts +14 -1
  39. package/dist/cli.js +8 -8
  40. package/dist/codegen-command-BLOS3GR3.js +43 -0
  41. package/dist/{completion-BKAFCZBE.js → completion-GHP5RRLQ.js} +2 -2
  42. package/dist/{deploy-command-4R6BYC6G.js → deploy-command-XOH76USO.js} +27 -27
  43. package/dist/{env-target-XWS2ZZ2Y.js → env-target-POGJMD6Q.js} +7 -7
  44. package/dist/{ephemeral-command-JL4TPIRQ.js → ephemeral-command-46SL27GJ.js} +25 -25
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.js +13 -7
  47. package/dist/init-command-NCRPVFGE.js +30 -0
  48. package/dist/internal.d.ts +2 -2
  49. package/dist/internal.js +50 -5
  50. package/dist/{io-AMIKRLPC.js → io-7VIA5SON.js} +3 -3
  51. package/dist/{live-diff-RXSJCVJ7.js → live-diff-FP4SFNT4.js} +2 -2
  52. package/dist/{lock-3CVKALKT.js → lock-KXOJIGCG.js} +2 -2
  53. package/dist/{lock-commands-XOYS75YQ.js → lock-commands-6UONZW26.js} +9 -9
  54. package/dist/{login-command-ACJF6KWQ.js → login-command-SG7IWTHW.js} +140 -37
  55. package/dist/{logout-command-MX3MJS5U.js → logout-command-J2AG5NKC.js} +3 -3
  56. package/dist/{loop-SAWAOUFO.js → loop-7SAIGRCZ.js} +3 -3
  57. package/dist/{marketplace-command-UVV3XAOL.js → marketplace-command-NKTQ3VPS.js} +11 -25
  58. package/dist/meta-client-OW5WKWW7.js +1 -1
  59. package/dist/node.d.ts +2 -2
  60. package/dist/node.js +18 -12
  61. package/dist/onboard-command-EHOHKQQU.js +36 -0
  62. package/dist/{profile-command-SWJ3SPKR.js → profile-command-ZPC2DPFV.js} +6 -6
  63. package/dist/{release-command-HZUY2XZX.js → release-command-FKQ6E3TD.js} +25 -25
  64. package/dist/{sandbox-details-command-HJE5SPVG.js → sandbox-details-command-DMY2KGA2.js} +5 -5
  65. package/dist/{sandbox-export-command-QCJY4GMV.js → sandbox-export-command-R6QMEK3D.js} +8 -8
  66. package/dist/scaffold.js +4 -2
  67. package/dist/{store-g45zwB33.d.ts → store-BJONDJoZ.d.ts} +171 -2
  68. package/dist/{test-command-72Y5S22H.js → test-command-56IAEYHX.js} +11 -11
  69. package/dist/upgrade-command-M2DZ3ZPD.js +177 -0
  70. package/dist/{validate-command-KDGH537H.js → validate-command-CIBQJND7.js} +12 -12
  71. package/dist/{workspace-command-ICSI6PKO.js → workspace-command-HZS43PHJ.js} +28 -27
  72. package/dist/workspace-export-AJMGN3CQ.js +1 -1
  73. package/guides/README.md +30 -0
  74. package/guides/authoring.md +642 -0
  75. package/guides/cli.md +192 -0
  76. package/guides/codegen.md +83 -0
  77. package/guides/coverage.md +67 -0
  78. package/guides/deploying.md +358 -0
  79. package/guides/environment.md +132 -0
  80. package/guides/object-kinds.md +376 -0
  81. package/guides/project-structure.md +43 -0
  82. package/guides/scaffold.md +198 -0
  83. package/guides/typed-frontend.md +201 -0
  84. package/llms/kinds-knowledge.md +20 -0
  85. package/llms/object-kinds.md +1 -0
  86. package/llms-full.txt +25 -2
  87. package/llms.txt +3 -2
  88. package/manifest.json +31 -4
  89. package/package.json +5 -2
  90. package/dist/chunk-WUSKBXXD.js +0 -25
  91. package/dist/chunk-ZO3HJOCJ.js +0 -29
  92. package/dist/codegen-command-FIADGXRN.js +0 -42
  93. package/dist/init-command-LOK75W64.js +0 -29
package/CHANGELOG.md ADDED
@@ -0,0 +1,79 @@
1
+ # Changelog
2
+
3
+ All notable changes to [`@xanots/sdk`](https://www.npmjs.com/package/@xanots/sdk).
4
+
5
+ This file is **generated** from the [GitHub releases](https://github.com/xanots/sdk/releases)
6
+ by `npm run changelog` — edit the release, not this file. Each entry summarizes
7
+ one release and links to its full notes.
8
+
9
+ Versions before 0.0.1 belong to the retired `@xanots/core` line and are not
10
+ listed here.
11
+
12
+ ---
13
+
14
+ ## 0.0.4 — The markdown your agents read
15
+
16
+ _2026-08-26_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.4)
17
+
18
+ Knowledge is now workspace source: the markdown your Xano agents read before they act is authored as real `.md` files, reviewed in a diff, and deployed with the code it describes. Two commands join the CLI — `xanots onboard` puts the scaffold's choices in a browser, and `xanots upgrade` answers the version question on purpose rather than nudging. Windows users should take this one regardless: every npm call in the package was failing before it reached npm.
19
+
20
+ - `knowledge()` — author the markdown your Xano agents read
21
+ - `xanots onboard` — pick the scaffold's look in a browser
22
+ - `xanots upgrade` — the version question asked on purpose
23
+ - Every npm call failed on a current Node for Windows
24
+ - The guides ship in the tarball
25
+ - `CHANGELOG.md` ships, generated from the releases
26
+
27
+ ---
28
+
29
+ ## 0.0.3 — The scaffold gets a look
30
+
31
+ _2026-08-25_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.3)
32
+
33
+ `xanots init` wrote one hard-coded stylesheet, so every scaffolded project looked
34
+ identical. It now takes a theme, a corner radius, a dark-mode strategy, three
35
+ typeface slots and an icon set — 126 themes composed from shadcn/ui's own tables,
36
+ or any registry theme URL. The same command can install **and register**
37
+ marketplace add-ons in one line, and the agent grounding now points assistants at
38
+ a prebuilt module instead of hand-rolling one. Nothing changes for anyone not
39
+ passing the new flags: no flags and no TTY scaffolds exactly what it did before.
40
+
41
+ - `xanots init` takes a theme, typefaces and an icon set
42
+ - `chart-*` and `sidebar-*` were missing from every scaffolded stylesheet
43
+ - `components.json` hard-coded a base color the stylesheet no longer used
44
+ - Dark mode shipped inert
45
+ - `--marketplace` installs add-ons and registers them
46
+ - Agents are grounded in marketplace discovery and the first-party modules
47
+ - New `@xanots/sdk/scaffold` export carries the scaffold's palette as data
48
+
49
+ ---
50
+
51
+ ## 0.0.2 — What the engine actually requires
52
+
53
+ _2026-08-25_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.2)
54
+
55
+ This release is about the statement surface refusing what the engine cannot accept, while you are writing rather than after you deploy. An absent required argument does not error on Xano — it substitutes a type default and answers HTTP 200 with a confident wrong result, which nothing downstream can distinguish from a right one. So 50-odd arguments that were typed optional are now required, one field the engine never reads is gone, and the wrappers that used to pass a missing field along now name it. If your code omitted any of them it will stop type-checking; it was already producing the wrong answer.
56
+
57
+ - ⚠️ 25 arguments across 15 statements are now required
58
+ - ⚠️ The Elasticsearch and OpenSearch credentials and target are required
59
+ - ⚠️ `webflow.request` no longer offers a `headers` field
60
+ - ⚠️ Statements that passed a missing field along now refuse it
61
+ - A zero-argument call names the field it needs
62
+ - A pulled workspace decodes where it used to fall back to `raw()`
63
+ - Every statement in the catalog has byte evidence behind it
64
+
65
+ ---
66
+
67
+ ## 0.0.1 — The new name, and a README to match
68
+
69
+ _2026-08-24_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.1)
70
+
71
+ The SDK is now published as **`@xanots/sdk`**, starting a fresh version line at 0.0.1. The name says what the package is — the authoring surface, the compiler, and the CLI — rather than implying one member of a family with a shared core. Alongside the rename: two new build-time warnings for shapes that used to ship clean and then misbehave at request time, and a README rebuilt as a landing page with its reference material split into browsable guides.
72
+
73
+ - ⚠️ The package is now `@xanots/sdk`
74
+ - `s.switch` fell through without `break: true`
75
+ - A filtered operand in a `where` could 500 at request time
76
+ - The README is a landing page again
77
+ - Scaffolds build the frontend before deploying it
78
+ - `@xanots/auth` is authentication, not authorization
79
+ - `InferResponse`: the shapes that never derive, and the line that closes each
package/README.md CHANGED
@@ -93,6 +93,10 @@ for you, and the target instance comes from your token rather than a flag.
93
93
  npx @xanots/sdk login
94
94
  ```
95
95
 
96
+ > On a remote shell, container, or Codespace — anywhere your browser can't reach this
97
+ > machine's `127.0.0.1` — add `--paste`. It prints the URL for you to open anywhere, and you
98
+ > paste the redirect back. See [Signing in & deploying](https://github.com/xanots/sdk/blob/main/guides/deploying.md).
99
+
96
100
  **2. Scaffold.** `init` writes a complete project: a Vite frontend under `frontend/` (React
97
101
  19 + shadcn/ui by default, or SvelteKit with `--framework svelte`), a XanoTS backend under
98
102
  `xano/`, and the `xano:export` / `xano:deploy` scripts already wired.
@@ -115,6 +119,20 @@ The starter backend is empty but already compiles and deploys — grow it from t
115
119
  in `xano/EXAMPLE.md`. For the flags, the two presets, theming, and add-ons, see
116
120
  [The scaffolded project](https://github.com/xanots/sdk/blob/main/guides/scaffold.md).
117
121
 
122
+ Prefer to see the theme before you commit to it? `xanots onboard` picks the framework, the
123
+ palette, the typefaces and the add-ons in a browser, against a live preview, and hands the
124
+ result back to `init` here in your terminal.
125
+
126
+ ```bash
127
+ npx @xanots/sdk onboard my-app
128
+ ```
129
+
130
+ It is a nicer way to arrive at the flags above, not a second scaffolder — it prints the
131
+ equivalent `init` command when it is done, so the project stays reproducible from a script.
132
+ The configurator is downloaded on demand, so `onboard` needs the registry before it can
133
+ start; `init` reaches out only to install the new project's dependencies, which
134
+ `--no-install` skips.
135
+
118
136
  **3. Build the frontend.**
119
137
 
120
138
  ```bash
@@ -214,7 +232,25 @@ the Xano engine, and the output is proven byte-for-byte against the engine's own
214
232
  fixtures.
215
233
 
216
234
  Give a table a `seed` array and those rows ship into the database on deploy, so a fresh
217
- environment comes up with its lookup tables and fixtures already in place. Tables, fields,
235
+ environment comes up with its lookup tables and fixtures already in place.
236
+
237
+ Your workspace's own AI agents are configured the same way. `knowledge()` is the markdown
238
+ they read before they act — standing instructions, a skill, or reference docs — and the body
239
+ is a real `.md` file in your repo rather than a string in a def:
240
+
241
+ ```ts
242
+ knowledge({
243
+ name: "deploy-runbook",
244
+ description: "How this workspace ships: environments, gates, and rollback.",
245
+ body: knowledgeFile("./deploy-runbook.md", import.meta.url),
246
+ refs: knowledgeDir("./deploy-runbook", import.meta.url),
247
+ });
248
+ ```
249
+
250
+ So the instructions your agents follow are reviewed in a diff, versioned with the code they
251
+ describe, and redeployed with it — instead of living in a console where nothing tracks them.
252
+
253
+ Tables, fields,
218
254
  statements, values, inputs, and middleware are all in the
219
255
  [Authoring reference](https://github.com/xanots/sdk/blob/main/guides/authoring.md); every kind you can author is in
220
256
  [Object kinds](https://github.com/xanots/sdk/blob/main/guides/object-kinds.md).
@@ -386,6 +422,7 @@ Both are readable by people too.
386
422
  [npm](https://www.npmjs.com/package/@xanots/sdk) ·
387
423
  [GitHub](https://github.com/xanots/sdk) ·
388
424
  [Issues](https://github.com/xanots/sdk/issues) ·
425
+ [Changelog](CHANGELOG.md) ·
389
426
  [`llms.txt`](llms.txt) — the agent-facing router, mapping the `llms/` topic files
390
427
 
391
428
  XanoTS is the official TypeScript SDK for [Xano](https://xano.com). MIT licensed.
@@ -1 +1 @@
1
- 07182bd42383cb8fe65cb807a679f776ecf2395dce7ca0d984068e2be86e7150
1
+ c0021219c47ba8aba005451538637f3d324faefad89c71468080cbe5bd443fa1
@@ -0,0 +1,17 @@
1
+ import {
2
+ CI_ENV_VARS,
3
+ codingAgentDetected,
4
+ isCI,
5
+ refreshAgentFiles
6
+ } from "./chunk-D6OGU2AI.js";
7
+ import "./chunk-7SISR3CS.js";
8
+ import "./chunk-ZSYZTGJH.js";
9
+ import "./chunk-6DHJVLYP.js";
10
+ import "./chunk-EZG76F7R.js";
11
+ export {
12
+ CI_ENV_VARS,
13
+ codingAgentDetected,
14
+ isCI,
15
+ refreshAgentFiles
16
+ };
17
+ //# sourceMappingURL=agent-file-refresh-IJ7GN2FJ.js.map
package/dist/bin.js CHANGED
@@ -1,168 +1,27 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ maybeNotifyUpdate
4
+ } from "./chunk-ZGA5MUNC.js";
2
5
  import {
3
6
  readVersion,
4
7
  run
5
- } from "./chunk-3NFUWXOC.js";
8
+ } from "./chunk-MS3BRZAZ.js";
6
9
  import {
7
10
  exitCodeOf,
8
11
  reportFailure
9
- } from "./chunk-6USV65XA.js";
10
- import "./chunk-HJPTWBLH.js";
12
+ } from "./chunk-IVP6TS26.js";
13
+ import "./chunk-MFIHIS6B.js";
14
+ import "./chunk-GNPVYOPB.js";
11
15
  import {
12
- blank,
13
16
  clearProgress,
14
- detail,
15
- error,
16
- style,
17
- warn
17
+ error
18
18
  } from "./chunk-EZG76F7R.js";
19
- import {
20
- atomicWrite
21
- } from "./chunk-GNPVYOPB.js";
22
- import "./chunk-55VHDNW5.js";
23
- import "./chunk-DYCLVQXW.js";
24
- import "./chunk-5L4X5LS6.js";
19
+ import "./chunk-BPEEGJJA.js";
20
+ import "./chunk-F5T45NAM.js";
21
+ import "./chunk-YUPQOLFX.js";
25
22
  import "./chunk-WHOJWOSV.js";
26
23
  import "./chunk-5XZ744TS.js";
27
- import "./chunk-4HT3BNZ7.js";
28
-
29
- // src/emit/update-check.ts
30
- import { existsSync, readFileSync, mkdirSync } from "fs";
31
- import { homedir } from "os";
32
- import { dirname, join } from "path";
33
- import { createRequire } from "module";
34
- function registryUrl() {
35
- return process.env.XANOTS_UPDATE_REGISTRY ?? "https://registry.npmjs.org/@xanots/sdk/latest";
36
- }
37
- function cachePath() {
38
- return process.env.XANOTS_UPDATE_CACHE ?? join(homedir(), ".xanots", "update-check.json");
39
- }
40
- var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
41
- var FETCH_TIMEOUT_MS = 2e3;
42
- function isNewer(candidate, current) {
43
- const a = parseSemver(candidate);
44
- const b = parseSemver(current);
45
- if (!a || !b) return false;
46
- for (let i = 0; i < 3; i++) {
47
- if (a.nums[i] !== b.nums[i]) return a.nums[i] > b.nums[i];
48
- }
49
- if (a.pre.length === 0) return b.pre.length > 0;
50
- if (b.pre.length === 0) return false;
51
- return comparePre(a.pre, b.pre) > 0;
52
- }
53
- function parseSemver(v) {
54
- const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
55
- if (!m) return null;
56
- return {
57
- nums: [Number(m[1]), Number(m[2]), Number(m[3])],
58
- pre: m[4] ? m[4].split(".") : []
59
- };
60
- }
61
- function comparePre(a, b) {
62
- const len = Math.max(a.length, b.length);
63
- for (let i = 0; i < len; i++) {
64
- if (i >= a.length) return -1;
65
- if (i >= b.length) return 1;
66
- const x = a[i];
67
- const y = b[i];
68
- const xn = /^\d+$/.test(x);
69
- const yn = /^\d+$/.test(y);
70
- if (xn && yn) {
71
- if (Number(x) !== Number(y)) return Number(x) < Number(y) ? -1 : 1;
72
- } else if (xn !== yn) {
73
- return xn ? -1 : 1;
74
- } else if (x !== y) {
75
- return x < y ? -1 : 1;
76
- }
77
- }
78
- return 0;
79
- }
80
- function readCache() {
81
- const path = cachePath();
82
- if (!existsSync(path)) return void 0;
83
- try {
84
- const parsed = JSON.parse(readFileSync(path, "utf8"));
85
- if (typeof parsed.latest === "string" && typeof parsed.checkedAt === "number") {
86
- return { latest: parsed.latest, checkedAt: parsed.checkedAt };
87
- }
88
- } catch {
89
- }
90
- return void 0;
91
- }
92
- function writeCache(cache) {
93
- try {
94
- const path = cachePath();
95
- mkdirSync(dirname(path), { recursive: true });
96
- atomicWrite(path, JSON.stringify(cache, null, 2) + "\n");
97
- } catch {
98
- }
99
- }
100
- async function fetchLatest() {
101
- try {
102
- const res = await fetch(registryUrl(), {
103
- headers: { accept: "application/json" },
104
- signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
105
- });
106
- if (!res.ok) return null;
107
- const data = await res.json();
108
- return typeof data.version === "string" ? data.version : null;
109
- } catch {
110
- return null;
111
- }
112
- }
113
- function disabled() {
114
- return Boolean(
115
- process.env.XANOTS_NO_UPDATE_CHECK || process.env.NO_UPDATE_NOTIFIER || process.env.CI
116
- );
117
- }
118
- async function resolveUpdateNotice(opts) {
119
- if (!opts?.force && disabled()) return null;
120
- const current = opts?.current ?? readVersion();
121
- if (current === "unknown") return null;
122
- const cache = readCache();
123
- let latest = cache?.latest;
124
- const now = Date.now();
125
- if (!cache || now - cache.checkedAt > CHECK_INTERVAL_MS) {
126
- const fetched = await fetchLatest();
127
- if (fetched) {
128
- latest = fetched;
129
- writeCache({ latest: fetched, checkedAt: now });
130
- }
131
- }
132
- return latest && isNewer(latest, current) ? { current, latest } : null;
133
- }
134
- function detectInstallMode() {
135
- const override = process.env.XANOTS_INSTALL_MODE;
136
- if (override === "global" || override === "local") return override;
137
- try {
138
- const requireFromCwd = createRequire(join(process.cwd(), "package.json"));
139
- requireFromCwd.resolve("@xanots/sdk/package.json");
140
- return "local";
141
- } catch {
142
- return "global";
143
- }
144
- }
145
- function upgradeCommand(mode) {
146
- return mode === "global" ? "npm i -g @xanots/sdk@latest" : "npm i -D @xanots/sdk@latest";
147
- }
148
- function printUpdateNotice(notice) {
149
- blank();
150
- warn(
151
- `A new @xanots/sdk is available: ${style.dim(notice.current)} \u2192 ${style.green(notice.latest)}`
152
- );
153
- detail(`update: ${upgradeCommand(detectInstallMode())}`);
154
- }
155
- function runExitedClean(code = process.exitCode) {
156
- return code === void 0 || code === 0;
157
- }
158
- async function maybeNotifyUpdate() {
159
- try {
160
- if (disabled() || process.stderr.isTTY !== true || !runExitedClean()) return;
161
- const notice = await resolveUpdateNotice();
162
- if (notice) printUpdateNotice(notice);
163
- } catch {
164
- }
165
- }
24
+ import "./chunk-YUBJLB6G.js";
166
25
 
167
26
  // src/emit/interrupt.ts
168
27
  var EXIT_SIGINT = 130;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fixtureDirForKind
3
- } from "./chunk-76QBEIGO.js";
3
+ } from "./chunk-T4XPCJRF.js";
4
4
 
5
5
  // src/validate/capture.ts
6
6
  import { mkdirSync, writeFileSync } from "fs";
@@ -29,4 +29,4 @@ function safeName(name) {
29
29
  export {
30
30
  captureFixtures
31
31
  };
32
- //# sourceMappingURL=capture-HUV5BNTC.js.map
32
+ //# sourceMappingURL=capture-7PO6SGB4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runNpm
3
- } from "./chunk-WUSKBXXD.js";
3
+ } from "./chunk-ZSYZTGJH.js";
4
4
  import {
5
5
  defaultThemeChoice,
6
6
  reactPreset,
@@ -442,4 +442,4 @@ export {
442
442
  resolveAiPresets,
443
443
  scaffoldProject
444
444
  };
445
- //# sourceMappingURL=chunk-CMZLPTGW.js.map
445
+ //# sourceMappingURL=chunk-7SISR3CS.js.map
@@ -1,12 +1,12 @@
1
- import {
2
- exportWorkspaceBundle
3
- } from "./chunk-QTNO2WD6.js";
4
1
  import {
5
2
  sandboxBaseUrl
6
- } from "./chunk-7DKX2SPN.js";
3
+ } from "./chunk-OR43PDCW.js";
7
4
  import {
8
5
  getAccessToken
9
- } from "./chunk-C56BC2FY.js";
6
+ } from "./chunk-SG4UBJ47.js";
7
+ import {
8
+ exportWorkspaceBundle
9
+ } from "./chunk-QTNO2WD6.js";
10
10
  import {
11
11
  step,
12
12
  success
@@ -115,4 +115,4 @@ export {
115
115
  fetchSandboxBundle,
116
116
  runSandboxExportCommand
117
117
  };
118
- //# sourceMappingURL=chunk-XQ22GLYS.js.map
118
+ //# sourceMappingURL=chunk-AAFBSOSD.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getEnvironment,
3
3
  readEphemeralState
4
- } from "./chunk-DGSF2Q5H.js";
4
+ } from "./chunk-WJYB7DSI.js";
5
5
  import {
6
6
  sandboxBaseUrl
7
- } from "./chunk-7DKX2SPN.js";
7
+ } from "./chunk-OR43PDCW.js";
8
8
  import {
9
9
  fetchReadOrExplain,
10
10
  httpFailure
@@ -66,7 +66,7 @@ async function resolveMetaTarget(auth, opts, deps = {}) {
66
66
  case "sandbox":
67
67
  return resolveSandbox(auth);
68
68
  case "ephemeral": {
69
- const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-JL4TPIRQ.js")).resolveLive;
69
+ const resolveLive = deps.resolveLive ?? (await import("./ephemeral-command-46SL27GJ.js")).resolveLive;
70
70
  return resolveEphemeral(auth, opts.name, { ...deps, resolveLive });
71
71
  }
72
72
  }
@@ -75,4 +75,4 @@ async function resolveMetaTarget(auth, opts, deps = {}) {
75
75
  export {
76
76
  resolveMetaTarget
77
77
  };
78
- //# sourceMappingURL=chunk-BT2CSEC5.js.map
78
+ //# sourceMappingURL=chunk-APOR6TCV.js.map
@@ -12,7 +12,7 @@ import {
12
12
  middlewareEntryGuid,
13
13
  stackReferencesAuth,
14
14
  tableColumns
15
- } from "./chunk-5L4X5LS6.js";
15
+ } from "./chunk-YUPQOLFX.js";
16
16
  import {
17
17
  CANONICAL_PAYLOAD_KEYS,
18
18
  REFERENCEABLE_KINDS,
@@ -23,7 +23,7 @@ import {
23
23
  mintCanonical,
24
24
  recordObserved,
25
25
  resolveRef
26
- } from "./chunk-4HT3BNZ7.js";
26
+ } from "./chunk-YUBJLB6G.js";
27
27
 
28
28
  // src/workspace/seed-coerce.ts
29
29
  function coerceScalarValue(label, column, type, value, values) {
@@ -1108,6 +1108,60 @@ function checkRunFamilyHosts(sections, bag) {
1108
1108
  }
1109
1109
  }
1110
1110
  }
1111
+ var KNOWLEDGE_NAME_OK = /^[A-Za-z0-9/_\-{}. ]+$/;
1112
+ var KNOWLEDGE_NAME_MAX = 200;
1113
+ function checkKnowledge(sections, bag, opts) {
1114
+ const items = sections.knowledge ?? [];
1115
+ if (items.length === 0) return;
1116
+ const agentsMd = items.filter((i) => i.knowledge_type === "agents.md");
1117
+ if (agentsMd.length > 1) {
1118
+ bag.error(
1119
+ "knowledge.multiple-agents-md",
1120
+ `A workspace can have at most one \`type: "agents.md"\` knowledge item, and this one declares ${agentsMd.length}: ${agentsMd.map((i) => `"${i.name}"`).join(", ")}. AGENTS.md is the workspace's standing instructions \u2014 merge them into one item, or make the others \`type: "skill"\`.`
1121
+ );
1122
+ }
1123
+ for (const item of items) {
1124
+ const name = String(item.name ?? "");
1125
+ const label = `knowledge "${name}"`;
1126
+ if (name.length > KNOWLEDGE_NAME_MAX) {
1127
+ bag.error(
1128
+ "knowledge.name-too-long",
1129
+ `${label}: name is ${name.length} characters; the platform accepts at most ${KNOWLEDGE_NAME_MAX}.`
1130
+ );
1131
+ } else if (!KNOWLEDGE_NAME_OK.test(name)) {
1132
+ const bad = [...name].filter((c) => !KNOWLEDGE_NAME_OK.test(c));
1133
+ bag.error(
1134
+ "knowledge.name-charset",
1135
+ `${label}: name contains ${bad.map((c) => JSON.stringify(c)).join(", ")}. The platform accepts the deploy and then silently DROPS the item \u2014 the agent ends up with no such knowledge and nothing reports an error. Names may use letters, digits, and \`/ _ - { } . \` or a space.`
1136
+ );
1137
+ }
1138
+ if (item.knowledge_type === "agents.md" && item.mode !== "auto") {
1139
+ bag.warn(
1140
+ "knowledge.agents-md-mode",
1141
+ `${label}: \`mode: "${item.mode}"\` has no effect on an \`agents.md\` item \u2014 its body is injected in full on every turn regardless. Drop \`mode\`, or make this a \`skill\` if you wanted the item loaded on demand.`
1142
+ );
1143
+ }
1144
+ for (const [field, value] of [
1145
+ ["name", name],
1146
+ ["description", String(item.description ?? "")]
1147
+ ]) {
1148
+ if (value.includes("\n")) {
1149
+ bag.warn(
1150
+ "knowledge.newline",
1151
+ `${label}: \`${field}\` contains a newline. It deploys, but the platform writes these into a line-oriented markdown header when a workspace is synced to files, and a newline does not survive that round trip.`
1152
+ );
1153
+ }
1154
+ }
1155
+ if (opts.resolved) {
1156
+ if (String(item.content ?? "").trim() === "") {
1157
+ bag.warn(
1158
+ "knowledge.empty-body",
1159
+ `${label}: the markdown body is empty. An enabled item still occupies a slot in the agent's menu and contributes nothing when loaded.`
1160
+ );
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1111
1165
 
1112
1166
  // src/workspace/xano.ts
1113
1167
  var XANO_BRAND = /* @__PURE__ */ Symbol.for("xanots.Xano");
@@ -1118,6 +1172,7 @@ var Xano = class {
1118
1172
  sections = /* @__PURE__ */ new Map();
1119
1173
  /** Table defs, encoded lazily at {@link export} so each can inherit the workspace `use_xdo`. */
1120
1174
  tableDefs = [];
1175
+ knowledgeDefs = [];
1121
1176
  workspaceConfig = {};
1122
1177
  bundleType = "workspace";
1123
1178
  /** True for any `Xano` registry, even one created by a different module instance. */
@@ -1146,6 +1201,9 @@ var Xano = class {
1146
1201
  for (const def of defs) this.tableDefs.push(def);
1147
1202
  return this;
1148
1203
  }
1204
+ if (kind.name === "knowledge") {
1205
+ for (const def of defs) this.knowledgeDefs.push(def);
1206
+ }
1149
1207
  const bucket = this.sections.get(kind.payloadKey) ?? [];
1150
1208
  for (const def of defs) bucket.push(this.encodeOne(kind, def));
1151
1209
  this.sections.set(kind.payloadKey, bucket);
@@ -1200,6 +1258,35 @@ var Xano = class {
1200
1258
  this.workspaceConfig = encodeObject("workspace", withName);
1201
1259
  return this;
1202
1260
  }
1261
+ /**
1262
+ * Fill each encoded knowledge item's `content` and emit its reference files as
1263
+ * the sibling `knowledge_file` section.
1264
+ *
1265
+ * Reference rows name their parent by GUID rather than by row id: the id does
1266
+ * not exist until the import inserts the parent, and the importer resolves the
1267
+ * guid back to it. `references` stays empty — the platform derives that list
1268
+ * from the stored files itself, so anything written here is overwritten.
1269
+ */
1270
+ fillKnowledge(sections, resolved) {
1271
+ const byName = new Map(resolved.map((r) => [r.name, r]));
1272
+ const items = sections.knowledge ?? [];
1273
+ const files = [];
1274
+ for (const item of items) {
1275
+ const match = byName.get(item.name);
1276
+ if (match === void 0) continue;
1277
+ item.content = match.content;
1278
+ for (const file of match.files) {
1279
+ files.push({
1280
+ knowledge: { id: item.guid },
1281
+ path: file.path,
1282
+ content: file.content,
1283
+ size: file.size,
1284
+ guid: deriveGuid("knowledge_file", `${item.name}/${file.path}`)
1285
+ });
1286
+ }
1287
+ }
1288
+ if (files.length > 0) sections.knowledge_file = files;
1289
+ }
1203
1290
  /** Set the bundle `type` (defaults to "workspace"). */
1204
1291
  setBundleType(type) {
1205
1292
  this.bundleType = type;
@@ -1214,9 +1301,23 @@ var Xano = class {
1214
1301
  tables() {
1215
1302
  return [...this.tableDefs];
1216
1303
  }
1304
+ /**
1305
+ * The registered knowledge defs (with their authored `body`/`refs` path
1306
+ * markers), for the Node compile path to read markdown off disk. Deliberately
1307
+ * NOT reached from `export()` — a file read has no place in the browser-safe
1308
+ * bundle, so the encoder emits an empty `content` and the compile path fills
1309
+ * it. See {@link import("./knowledge.js")}.
1310
+ */
1311
+ knowledge() {
1312
+ return [...this.knowledgeDefs];
1313
+ }
1217
1314
  registerFunctions(defs) {
1218
1315
  return this.register("function", defs);
1219
1316
  }
1317
+ /** Register knowledge items — the markdown a workspace's AI agents read. */
1318
+ registerKnowledge(defs) {
1319
+ return this.register("knowledge", defs);
1320
+ }
1220
1321
  registerTriggers(defs) {
1221
1322
  return this.register("trigger", defs);
1222
1323
  }
@@ -1294,6 +1395,9 @@ var Xano = class {
1294
1395
  return { ...encoded, import: { mode: "standard" } };
1295
1396
  });
1296
1397
  }
1398
+ if (options.knowledge !== void 0 && options.knowledge.length > 0) {
1399
+ this.fillKnowledge(sections, options.knowledge);
1400
+ }
1297
1401
  const bag = new DiagnosticBag(options.strict === true);
1298
1402
  this.validateQueryAuth(sections, bag);
1299
1403
  this.validateMiddlewareAuth(sections, bag);
@@ -1315,6 +1419,7 @@ var Xano = class {
1315
1419
  checkNullMatchArgs(sections, bag);
1316
1420
  checkSameNameSiblings(sections, bag);
1317
1421
  checkSeed(this.tableDefs, bag);
1422
+ checkKnowledge(sections, bag, { resolved: options.knowledge !== void 0 });
1318
1423
  checkRealtimePublish(this.bundleType, sections, bag);
1319
1424
  bag.flush();
1320
1425
  if (lockCtx) this.applyLock(lockCtx, sections);
@@ -1547,4 +1652,4 @@ export {
1547
1652
  Xano,
1548
1653
  workspace
1549
1654
  };
1550
- //# sourceMappingURL=chunk-55VHDNW5.js.map
1655
+ //# sourceMappingURL=chunk-BPEEGJJA.js.map
@@ -35,7 +35,7 @@ import {
35
35
  registerKind,
36
36
  tableColumns,
37
37
  withFilters
38
- } from "./chunk-5L4X5LS6.js";
38
+ } from "./chunk-YUPQOLFX.js";
39
39
  import {
40
40
  assertPathParamInputs,
41
41
  fillPathParams,
@@ -51,7 +51,7 @@ import {
51
51
  deriveGuid,
52
52
  realtimeChannelSeedName,
53
53
  resolveRef
54
- } from "./chunk-4HT3BNZ7.js";
54
+ } from "./chunk-YUBJLB6G.js";
55
55
 
56
56
  // src/statements/set-var.ts
57
57
  var SET_VAR = "mvp:set_var";
@@ -3721,4 +3721,4 @@ export {
3721
3721
  workspaceKind,
3722
3722
  workspaceConfig
3723
3723
  };
3724
- //# sourceMappingURL=chunk-U3G2UW65.js.map
3724
+ //# sourceMappingURL=chunk-CYJ7R3AD.js.map
@@ -5,9 +5,7 @@ import {
5
5
  presetFilePath,
6
6
  renderPreset,
7
7
  upsertManagedBlock
8
- } from "./chunk-CMZLPTGW.js";
9
- import "./chunk-WUSKBXXD.js";
10
- import "./chunk-6DHJVLYP.js";
8
+ } from "./chunk-7SISR3CS.js";
11
9
  import {
12
10
  warn
13
11
  } from "./chunk-EZG76F7R.js";
@@ -50,7 +48,7 @@ function appNameFor(projectDir) {
50
48
  }
51
49
  function refreshAgentFiles(opts) {
52
50
  const env = opts.env ?? process.env;
53
- if (isCI(env) || !codingAgentDetected(env)) return [];
51
+ if (opts.explicit !== true && (isCI(env) || !codingAgentDetected(env))) return [];
54
52
  const mode = opts.mode ?? guidanceModeFor(opts.projectDir);
55
53
  const appName = opts.appName ?? appNameFor(opts.projectDir);
56
54
  const managed = [];
@@ -87,10 +85,11 @@ function refreshAgentFiles(opts) {
87
85
  }
88
86
  return refreshed;
89
87
  }
88
+
90
89
  export {
91
- CI_ENV_VARS,
92
90
  codingAgentDetected,
91
+ CI_ENV_VARS,
93
92
  isCI,
94
93
  refreshAgentFiles
95
94
  };
96
- //# sourceMappingURL=agent-file-refresh-6M5M7T24.js.map
95
+ //# sourceMappingURL=chunk-D6OGU2AI.js.map