@xanots/sdk 0.0.3 → 0.0.4

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 (87) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +34 -1
  3. package/dist/agent-file-refresh-IJ7GN2FJ.js +17 -0
  4. package/dist/bin.js +12 -153
  5. package/dist/{capture-HUV5BNTC.js → capture-7PO6SGB4.js} +2 -2
  6. package/dist/{chunk-CMZLPTGW.js → chunk-7SISR3CS.js} +2 -2
  7. package/dist/{chunk-7DKX2SPN.js → chunk-ACQCK4DT.js} +4 -4
  8. package/dist/{chunk-XQ22GLYS.js → chunk-AJ7JQ4OU.js} +5 -5
  9. package/dist/{chunk-ZO3HJOCJ.js → chunk-ALNQCWAW.js} +2 -2
  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-3NFUWXOC.js → chunk-DUC3PXDG.js} +142 -45
  14. package/dist/{chunk-HQ2CBRVI.js → chunk-EAIR6VUL.js} +10 -8
  15. package/dist/chunk-ERQZFWIW.js +22 -0
  16. package/dist/{chunk-TQUO2OXY.js → chunk-FN4OQT2J.js} +4 -4
  17. package/dist/{chunk-6USV65XA.js → chunk-KGNJM4LN.js} +2 -2
  18. package/dist/{chunk-HJPTWBLH.js → chunk-MFIHIS6B.js} +2 -2
  19. package/dist/{chunk-F6JCFRKO.js → chunk-PXXLBXOP.js} +2 -2
  20. package/dist/{chunk-YZ4GU6F5.js → chunk-QUUB7HYK.js} +5 -838
  21. package/dist/{chunk-W2G2WPTB.js → chunk-SWIXWJIY.js} +3 -3
  22. package/dist/{chunk-76QBEIGO.js → chunk-T4XPCJRF.js} +3 -2
  23. package/dist/chunk-T6N3VMMO.js +173 -0
  24. package/dist/{chunk-2V4YE6QC.js → chunk-VKD3EBKG.js} +112 -21
  25. package/dist/{chunk-BT2CSEC5.js → chunk-VWGJQTNA.js} +3 -3
  26. package/dist/chunk-WGDAOOXG.js +845 -0
  27. package/dist/{chunk-4YMD2OOZ.js → chunk-XHEXOES3.js} +1 -1
  28. package/dist/{chunk-4HT3BNZ7.js → chunk-YUBJLB6G.js} +10 -2
  29. package/dist/{chunk-5L4X5LS6.js → chunk-YUPQOLFX.js} +77 -2
  30. package/dist/{chunk-DYCLVQXW.js → chunk-YYSJAAJM.js} +25 -1
  31. package/dist/{chunk-P3TTMWUP.js → chunk-ZOYMZZ3S.js} +8 -1
  32. package/dist/chunk-ZSYZTGJH.js +81 -0
  33. package/dist/cli.d.ts +6 -0
  34. package/dist/cli.js +8 -8
  35. package/dist/{codegen-command-FIADGXRN.js → codegen-command-Z7WQMOJ7.js} +21 -20
  36. package/dist/{completion-BKAFCZBE.js → completion-4GYN752B.js} +2 -2
  37. package/dist/{deploy-command-4R6BYC6G.js → deploy-command-M2S4HHLC.js} +26 -26
  38. package/dist/{env-target-XWS2ZZ2Y.js → env-target-GSFCYHKZ.js} +6 -6
  39. package/dist/{ephemeral-command-JL4TPIRQ.js → ephemeral-command-6WJW7LP6.js} +24 -24
  40. package/dist/index.d.ts +2 -2
  41. package/dist/index.js +13 -7
  42. package/dist/init-command-GJUPWTKA.js +30 -0
  43. package/dist/internal.d.ts +2 -2
  44. package/dist/internal.js +50 -5
  45. package/dist/{io-AMIKRLPC.js → io-7VIA5SON.js} +3 -3
  46. package/dist/{live-diff-RXSJCVJ7.js → live-diff-FP4SFNT4.js} +2 -2
  47. package/dist/{lock-3CVKALKT.js → lock-KXOJIGCG.js} +2 -2
  48. package/dist/{lock-commands-XOYS75YQ.js → lock-commands-7IH7RSSP.js} +9 -9
  49. package/dist/{login-command-ACJF6KWQ.js → login-command-QM5SBBI2.js} +2 -2
  50. package/dist/{logout-command-MX3MJS5U.js → logout-command-THPASOHM.js} +2 -2
  51. package/dist/{loop-SAWAOUFO.js → loop-7SAIGRCZ.js} +3 -3
  52. package/dist/{marketplace-command-UVV3XAOL.js → marketplace-command-463DT7O7.js} +11 -25
  53. package/dist/meta-client-OW5WKWW7.js +1 -1
  54. package/dist/node.d.ts +2 -2
  55. package/dist/node.js +18 -12
  56. package/dist/onboard-command-EHOHKQQU.js +36 -0
  57. package/dist/{profile-command-SWJ3SPKR.js → profile-command-EUWPVWED.js} +6 -6
  58. package/dist/{release-command-HZUY2XZX.js → release-command-M4CVNTWL.js} +25 -25
  59. package/dist/{sandbox-details-command-HJE5SPVG.js → sandbox-details-command-BRII3QHG.js} +5 -5
  60. package/dist/{sandbox-export-command-QCJY4GMV.js → sandbox-export-command-PCZ5FL4U.js} +8 -8
  61. package/dist/scaffold.js +4 -2
  62. package/dist/{store-g45zwB33.d.ts → store-BJONDJoZ.d.ts} +171 -2
  63. package/dist/{test-command-72Y5S22H.js → test-command-U4G5Y3UM.js} +10 -10
  64. package/dist/upgrade-command-CKJ4BS2P.js +177 -0
  65. package/dist/{validate-command-KDGH537H.js → validate-command-S5N37JRP.js} +12 -12
  66. package/dist/{workspace-command-ICSI6PKO.js → workspace-command-RALSEJSW.js} +28 -27
  67. package/dist/workspace-export-AJMGN3CQ.js +1 -1
  68. package/guides/README.md +30 -0
  69. package/guides/authoring.md +642 -0
  70. package/guides/cli.md +191 -0
  71. package/guides/codegen.md +83 -0
  72. package/guides/coverage.md +67 -0
  73. package/guides/deploying.md +340 -0
  74. package/guides/environment.md +132 -0
  75. package/guides/object-kinds.md +376 -0
  76. package/guides/project-structure.md +43 -0
  77. package/guides/scaffold.md +198 -0
  78. package/guides/typed-frontend.md +201 -0
  79. package/llms/kinds-knowledge.md +20 -0
  80. package/llms/object-kinds.md +1 -0
  81. package/llms-full.txt +25 -2
  82. package/llms.txt +3 -2
  83. package/manifest.json +26 -3
  84. package/package.json +5 -2
  85. package/dist/.build-fingerprint +0 -1
  86. package/dist/chunk-WUSKBXXD.js +0 -25
  87. package/dist/init-command-LOK75W64.js +0 -29
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  compileBundle
3
- } from "./chunk-3NFUWXOC.js";
3
+ } from "./chunk-DUC3PXDG.js";
4
4
  import {
5
5
  missingArgument
6
- } from "./chunk-6USV65XA.js";
6
+ } from "./chunk-KGNJM4LN.js";
7
7
 
8
8
  // src/emit/bundle-input.ts
9
9
  import { existsSync, readFileSync } from "fs";
@@ -34,4 +34,4 @@ export {
34
34
  assertBundleInput,
35
35
  loadBundleText
36
36
  };
37
- //# sourceMappingURL=chunk-W2G2WPTB.js.map
37
+ //# sourceMappingURL=chunk-SWIXWJIY.js.map
@@ -9,7 +9,8 @@ var ROUND_TRIP_KINDS = [
9
9
  { key: "tool", fixtureDir: "toolset" },
10
10
  { key: "middleware", fixtureDir: "middleware" },
11
11
  { key: "addon", fixtureDir: "addon" },
12
- { key: "workflow_test", fixtureDir: "workflow-test" }
12
+ { key: "workflow_test", fixtureDir: "workflow-test" },
13
+ { key: "knowledge", fixtureDir: "knowledge" }
13
14
  ];
14
15
  var FIXTURE_DIR_BY_KIND = new Map(ROUND_TRIP_KINDS.map((k) => [k.key, k.fixtureDir]));
15
16
  var RUNNABLE_KINDS = new Set(ROUND_TRIP_KINDS.filter((k) => k.runnable).map((k) => k.key));
@@ -63,4 +64,4 @@ export {
63
64
  indexByIdentity,
64
65
  resolveMatch
65
66
  };
66
- //# sourceMappingURL=chunk-76QBEIGO.js.map
67
+ //# sourceMappingURL=chunk-T4XPCJRF.js.map
@@ -0,0 +1,173 @@
1
+ import {
2
+ readVersion
3
+ } from "./chunk-DUC3PXDG.js";
4
+ import {
5
+ atomicWrite
6
+ } from "./chunk-GNPVYOPB.js";
7
+ import {
8
+ blank,
9
+ detail,
10
+ style,
11
+ warn
12
+ } from "./chunk-EZG76F7R.js";
13
+
14
+ // src/emit/update-check.ts
15
+ import { existsSync, readFileSync, mkdirSync } from "fs";
16
+ import { homedir } from "os";
17
+ import { dirname, join } from "path";
18
+ import { createRequire } from "module";
19
+ function registryUrl() {
20
+ return process.env.XANOTS_UPDATE_REGISTRY ?? "https://registry.npmjs.org/@xanots/sdk/latest";
21
+ }
22
+ function cachePath() {
23
+ return process.env.XANOTS_UPDATE_CACHE ?? join(homedir(), ".xanots", "update-check.json");
24
+ }
25
+ var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
26
+ var FETCH_TIMEOUT_MS = 2e3;
27
+ var CHECK_TIMEOUT_MS = 1e4;
28
+ function isNewer(candidate, current) {
29
+ const a = parseSemver(candidate);
30
+ const b = parseSemver(current);
31
+ if (!a || !b) return false;
32
+ for (let i = 0; i < 3; i++) {
33
+ if (a.nums[i] !== b.nums[i]) return a.nums[i] > b.nums[i];
34
+ }
35
+ if (a.pre.length === 0) return b.pre.length > 0;
36
+ if (b.pre.length === 0) return false;
37
+ return comparePre(a.pre, b.pre) > 0;
38
+ }
39
+ function parseSemver(v) {
40
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
41
+ if (!m) return null;
42
+ return {
43
+ nums: [Number(m[1]), Number(m[2]), Number(m[3])],
44
+ pre: m[4] ? m[4].split(".") : []
45
+ };
46
+ }
47
+ function comparePre(a, b) {
48
+ const len = Math.max(a.length, b.length);
49
+ for (let i = 0; i < len; i++) {
50
+ if (i >= a.length) return -1;
51
+ if (i >= b.length) return 1;
52
+ const x = a[i];
53
+ const y = b[i];
54
+ const xn = /^\d+$/.test(x);
55
+ const yn = /^\d+$/.test(y);
56
+ if (xn && yn) {
57
+ if (Number(x) !== Number(y)) return Number(x) < Number(y) ? -1 : 1;
58
+ } else if (xn !== yn) {
59
+ return xn ? -1 : 1;
60
+ } else if (x !== y) {
61
+ return x < y ? -1 : 1;
62
+ }
63
+ }
64
+ return 0;
65
+ }
66
+ function readCache() {
67
+ const path = cachePath();
68
+ if (!existsSync(path)) return void 0;
69
+ try {
70
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
71
+ if (typeof parsed.latest === "string" && typeof parsed.checkedAt === "number") {
72
+ return { latest: parsed.latest, checkedAt: parsed.checkedAt };
73
+ }
74
+ } catch {
75
+ }
76
+ return void 0;
77
+ }
78
+ function writeCache(cache) {
79
+ try {
80
+ const path = cachePath();
81
+ mkdirSync(dirname(path), { recursive: true });
82
+ atomicWrite(path, JSON.stringify(cache, null, 2) + "\n");
83
+ } catch {
84
+ }
85
+ }
86
+ async function fetchLatest(timeoutMs = FETCH_TIMEOUT_MS) {
87
+ try {
88
+ const res = await fetch(registryUrl(), {
89
+ headers: { accept: "application/json" },
90
+ signal: AbortSignal.timeout(timeoutMs)
91
+ });
92
+ if (!res.ok) return null;
93
+ const data = await res.json();
94
+ return typeof data.version === "string" ? data.version : null;
95
+ } catch {
96
+ return null;
97
+ }
98
+ }
99
+ var noticeSuppressed = false;
100
+ function suppressUpdateNotice() {
101
+ noticeSuppressed = true;
102
+ }
103
+ function disabled() {
104
+ return Boolean(
105
+ noticeSuppressed || process.env.XANOTS_NO_UPDATE_CHECK || process.env.NO_UPDATE_NOTIFIER || process.env.CI
106
+ );
107
+ }
108
+ async function resolveUpdateNotice(opts) {
109
+ if (!opts?.force && disabled()) return null;
110
+ const current = opts?.current ?? readVersion();
111
+ if (current === "unknown") return null;
112
+ const cache = readCache();
113
+ let latest = cache?.latest;
114
+ const now = Date.now();
115
+ if (!cache || now - cache.checkedAt > CHECK_INTERVAL_MS) {
116
+ const fetched = await fetchLatest();
117
+ if (fetched) {
118
+ latest = fetched;
119
+ writeCache({ latest: fetched, checkedAt: now });
120
+ }
121
+ }
122
+ return latest && isNewer(latest, current) ? { current, latest } : null;
123
+ }
124
+ async function checkForUpgrade(opts) {
125
+ const current = opts?.current ?? readVersion();
126
+ if (current === "unknown") return { status: "unknown", reason: "local-version" };
127
+ const latest = await fetchLatest(CHECK_TIMEOUT_MS);
128
+ if (latest === null) return { status: "unknown", reason: "registry" };
129
+ writeCache({ latest, checkedAt: Date.now() });
130
+ return { status: isNewer(latest, current) ? "available" : "current", current, latest };
131
+ }
132
+ function detectInstallMode() {
133
+ const override = process.env.XANOTS_INSTALL_MODE;
134
+ if (override === "global" || override === "local") return override;
135
+ try {
136
+ const requireFromCwd = createRequire(join(process.cwd(), "package.json"));
137
+ requireFromCwd.resolve("@xanots/sdk/package.json");
138
+ return "local";
139
+ } catch {
140
+ return "global";
141
+ }
142
+ }
143
+ function upgradeCommand(mode) {
144
+ return mode === "global" ? "npm i -g @xanots/sdk@latest" : "npm i -D @xanots/sdk@latest";
145
+ }
146
+ function printUpdateNotice(notice) {
147
+ blank();
148
+ warn(
149
+ `A new @xanots/sdk is available: ${style.dim(notice.current)} \u2192 ${style.green(notice.latest)}`
150
+ );
151
+ detail(`update: ${upgradeCommand(detectInstallMode())}`);
152
+ }
153
+ function runExitedClean(code = process.exitCode) {
154
+ return code === void 0 || code === 0;
155
+ }
156
+ async function maybeNotifyUpdate() {
157
+ try {
158
+ if (disabled() || process.stderr.isTTY !== true || !runExitedClean()) return;
159
+ const notice = await resolveUpdateNotice();
160
+ if (notice) printUpdateNotice(notice);
161
+ } catch {
162
+ }
163
+ }
164
+
165
+ export {
166
+ registryUrl,
167
+ suppressUpdateNotice,
168
+ checkForUpgrade,
169
+ detectInstallMode,
170
+ upgradeCommand,
171
+ maybeNotifyUpdate
172
+ };
173
+ //# sourceMappingURL=chunk-T6N3VMMO.js.map
@@ -15,7 +15,10 @@ import {
15
15
  normalize,
16
16
  retiredInputSuccessor,
17
17
  retiredInputs
18
- } from "./chunk-P3TTMWUP.js";
18
+ } from "./chunk-ZOYMZZ3S.js";
19
+ import {
20
+ getAccessToken
21
+ } from "./chunk-C56BC2FY.js";
19
22
  import {
20
23
  exportWorkspaceBundle
21
24
  } from "./chunk-QTNO2WD6.js";
@@ -24,18 +27,15 @@ import {
24
27
  resolveFrontendPreset,
25
28
  resolveThemeChoice,
26
29
  sanitizeAppName
27
- } from "./chunk-HQ2CBRVI.js";
30
+ } from "./chunk-EAIR6VUL.js";
28
31
  import {
29
32
  XANO_DIR,
30
33
  resolveAiPresets,
31
34
  scaffoldProject
32
- } from "./chunk-CMZLPTGW.js";
33
- import {
34
- getAccessToken
35
- } from "./chunk-C56BC2FY.js";
35
+ } from "./chunk-7SISR3CS.js";
36
36
  import {
37
37
  TEST_EXPECT_TYPES
38
- } from "./chunk-F6JCFRKO.js";
38
+ } from "./chunk-PXXLBXOP.js";
39
39
  import {
40
40
  raw
41
41
  } from "./chunk-LU7TRWMC.js";
@@ -44,7 +44,7 @@ import {
44
44
  describeOrigin,
45
45
  renderCodegenMarker,
46
46
  renderCodegenReadme
47
- } from "./chunk-YZ4GU6F5.js";
47
+ } from "./chunk-QUUB7HYK.js";
48
48
  import {
49
49
  FIELD_METHODS,
50
50
  STATEMENT_SURFACES,
@@ -67,14 +67,14 @@ import {
67
67
  searchConstrainsRows,
68
68
  tableTrigger,
69
69
  workspaceTrigger
70
- } from "./chunk-U3G2UW65.js";
70
+ } from "./chunk-CYJ7R3AD.js";
71
71
  import {
72
72
  loadDefault,
73
73
  readVersion
74
- } from "./chunk-3NFUWXOC.js";
74
+ } from "./chunk-DUC3PXDG.js";
75
75
  import {
76
76
  UsageError
77
- } from "./chunk-6USV65XA.js";
77
+ } from "./chunk-KGNJM4LN.js";
78
78
  import {
79
79
  blank,
80
80
  detail,
@@ -115,7 +115,7 @@ import {
115
115
  sys,
116
116
  toolset,
117
117
  withFilters
118
- } from "./chunk-5L4X5LS6.js";
118
+ } from "./chunk-YUPQOLFX.js";
119
119
  import {
120
120
  parsePathParams,
121
121
  unboundPathParams
@@ -130,7 +130,7 @@ import {
130
130
  } from "./chunk-5XZ744TS.js";
131
131
  import {
132
132
  REFERENCEABLE_KIND_PAYLOAD_KEYS
133
- } from "./chunk-4HT3BNZ7.js";
133
+ } from "./chunk-YUBJLB6G.js";
134
134
 
135
135
  // src/emit/codegen-command.ts
136
136
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -886,6 +886,37 @@ function resolveReference(ctx, index, guid, options = {}) {
886
886
  ]);
887
887
  }
888
888
 
889
+ // src/kinds/knowledge-paths.ts
890
+ function knowledgePathSegment(name) {
891
+ const slug = name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
892
+ return slug === "" ? "item" : slug;
893
+ }
894
+ function knowledgeItemDir(type, name) {
895
+ const seg = knowledgePathSegment(name);
896
+ switch (type) {
897
+ case "agents.md":
898
+ return null;
899
+ case "skill":
900
+ return `skills/${seg}`;
901
+ case "doc":
902
+ return `docs/${seg}`;
903
+ }
904
+ }
905
+ function knowledgeBodyPath(type, name) {
906
+ switch (type) {
907
+ case "agents.md":
908
+ return "agents.md";
909
+ case "skill":
910
+ return `${knowledgeItemDir(type, name)}/SKILL.md`;
911
+ case "doc":
912
+ return `${knowledgeItemDir(type, name)}.md`;
913
+ }
914
+ }
915
+ function knowledgeRefsDir(type, name) {
916
+ const dir = knowledgeItemDir(type, name);
917
+ return dir === null ? null : `${dir}/refs`;
918
+ }
919
+
889
920
  // src/codegen/obj-expr.ts
890
921
  var IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
891
922
  var REFERENCE = /^\$(input|var|auth|db)((?:\.[A-Za-z0-9_$]+)*)$/;
@@ -4320,10 +4351,6 @@ function omissionSeverity(reason) {
4320
4351
  }
4321
4352
  var UNSUPPORTED_SECTIONS = {
4322
4353
  vault: { reason: "secret", detail: "vault entries are instance secrets and are never emitted as source" },
4323
- knowledge: {
4324
- reason: "unmodeled",
4325
- detail: "knowledge objects are not authored in TypeScript by this SDK"
4326
- },
4327
4354
  // These three were tagged `unmodeled`, which their own detail lines contradict:
4328
4355
  // none of them is an object type the SDK failed to model. They are records of
4329
4356
  // what was done to the workspace, owned by the instance that did it.
@@ -4509,6 +4536,19 @@ function decodeExample(a) {
4509
4536
  }
4510
4537
 
4511
4538
  // src/codegen/kinds/index.ts
4539
+ function knowledgeFileRows(payload, parentGuid) {
4540
+ const rows = Array.isArray(payload.knowledge_file) ? payload.knowledge_file : [];
4541
+ const out2 = [];
4542
+ for (const raw2 of rows) {
4543
+ const row = raw2;
4544
+ if (row.knowledge?.id !== parentGuid) continue;
4545
+ const stored = typeof row.path === "string" ? row.path : "";
4546
+ if (stored === "") continue;
4547
+ const rel = stored.replace(/^knowledge-refs\/[^/]+\//, "");
4548
+ out2.push({ path: rel, content: String(row.content ?? "") });
4549
+ }
4550
+ return out2;
4551
+ }
4512
4552
  function plain(stored, storedKey, fallback, defKey = storedKey) {
4513
4553
  const value = stored[storedKey];
4514
4554
  if (value === void 0 || deepEqual2(value, fallback)) return null;
@@ -4834,6 +4874,50 @@ var DEFAULT_CACHE = {
4834
4874
  env: []
4835
4875
  };
4836
4876
  var KIND_DECODERS = [
4877
+ {
4878
+ name: "knowledge",
4879
+ payloadKey: "knowledge",
4880
+ dir: "knowledge",
4881
+ register: "registerKnowledge",
4882
+ defType: "KnowledgeDef",
4883
+ factory: "knowledge",
4884
+ decode: (a) => {
4885
+ const type = a.stored.knowledge_type ?? "skill";
4886
+ const name = String(a.stored.name ?? "");
4887
+ a.ctx.imports.use(SDK_MODULE, "knowledgeFile");
4888
+ const refsDir = knowledgeRefsDir(type, name);
4889
+ const hasRefs = refsDir !== null && knowledgeFileRows(a.payload, a.stored.guid).length > 0;
4890
+ if (hasRefs) a.ctx.imports.use(SDK_MODULE, "knowledgeDir");
4891
+ return compact([
4892
+ ...identity(a),
4893
+ plain(a.stored, "description", ""),
4894
+ plain(a.stored, "knowledge_type", "skill", "type"),
4895
+ plain(a.stored, "mode", "auto"),
4896
+ plain(a.stored, "enabled", true),
4897
+ [
4898
+ "body",
4899
+ call("knowledgeFile", lit(`./${knowledgeBodyPath(type, name)}`), id("import.meta.url"))
4900
+ ],
4901
+ hasRefs ? [
4902
+ "refs",
4903
+ call("knowledgeDir", lit(`./${refsDir}`), id("import.meta.url"))
4904
+ ] : null,
4905
+ tags(a.stored)
4906
+ ]);
4907
+ },
4908
+ companions: ({ stored, payload }) => {
4909
+ const type = stored.knowledge_type ?? "skill";
4910
+ const name = String(stored.name ?? "");
4911
+ const refsDir = knowledgeRefsDir(type, name);
4912
+ return [
4913
+ { path: knowledgeBodyPath(type, name), contents: String(stored.content ?? "") },
4914
+ ...refsDir === null ? [] : knowledgeFileRows(payload, stored.guid).map((f2) => ({
4915
+ path: `${refsDir}/${f2.path}`,
4916
+ contents: f2.content
4917
+ }))
4918
+ ];
4919
+ }
4920
+ },
4837
4921
  {
4838
4922
  name: "table",
4839
4923
  payloadKey: "dbo",
@@ -6248,6 +6332,7 @@ function assembleProject(ctx, refs, payload) {
6248
6332
  ctx,
6249
6333
  refs,
6250
6334
  stored: placement.stored,
6335
+ payload,
6251
6336
  resolve: {
6252
6337
  symbolFor: (target) => {
6253
6338
  const found = byGuid.get(target.guid);
@@ -6291,6 +6376,12 @@ function assembleProject(ctx, refs, payload) {
6291
6376
  );
6292
6377
  }
6293
6378
  const out2 = [];
6379
+ for (const placement of placements) {
6380
+ const decoder = KIND_DECODERS_BY_NAME.get(placement.object.kind);
6381
+ for (const companion of decoder.companions?.({ stored: placement.stored, payload }) ?? []) {
6382
+ out2.push({ path: `${decoder.dir}/${companion.path}`, contents: companion.contents });
6383
+ }
6384
+ }
6294
6385
  for (const [path, file] of files) {
6295
6386
  out2.push({
6296
6387
  path,
@@ -6320,7 +6411,7 @@ function workspaceFile(ctx, refs, payload) {
6320
6411
  const decoder = KIND_DECODERS_BY_NAME.get("workspace");
6321
6412
  const { expr, factory } = ctx.inObject(
6322
6413
  "workspace",
6323
- () => decodeObject(decoder, { ctx, refs, stored, resolve: {} })
6414
+ () => decodeObject(decoder, { ctx, refs, stored, payload, resolve: {} })
6324
6415
  );
6325
6416
  if (factory) imports.use(SDK_MODULE, factory);
6326
6417
  else imports.useType(SDK_MODULE, decoder.defType);
@@ -6640,7 +6731,7 @@ async function fetchBundle(args, source) {
6640
6731
  if (source.kind === "sandbox") {
6641
6732
  const auth3 = await getAccessToken(args);
6642
6733
  step("Reading the sandbox workspace");
6643
- const { fetchSandboxBundle } = await import("./sandbox-export-command-QCJY4GMV.js");
6734
+ const { fetchSandboxBundle } = await import("./sandbox-export-command-PCZ5FL4U.js");
6644
6735
  return {
6645
6736
  bundle: await fetchSandboxBundle(auth3),
6646
6737
  origin: { source: "sandbox", origin: auth3.instance }
@@ -6654,7 +6745,7 @@ async function fetchBundle(args, source) {
6654
6745
  );
6655
6746
  }
6656
6747
  const auth3 = await getAccessToken(args);
6657
- const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-JL4TPIRQ.js");
6748
+ const { resolveLive, fetchEphemeralBundle } = await import("./ephemeral-command-6WJW7LP6.js");
6658
6749
  const summary = await resolveLive(auth3, auth3.workspaceId, name);
6659
6750
  step(`Reading ephemeral "${name}"`);
6660
6751
  return {
@@ -6923,4 +7014,4 @@ export {
6923
7014
  verifyCrashEntry,
6924
7015
  blameGeneratedFile
6925
7016
  };
6926
- //# sourceMappingURL=chunk-2V4YE6QC.js.map
7017
+ //# sourceMappingURL=chunk-VKD3EBKG.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-DGSF2Q5H.js";
5
5
  import {
6
6
  sandboxBaseUrl
7
- } from "./chunk-7DKX2SPN.js";
7
+ } from "./chunk-ACQCK4DT.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-6WJW7LP6.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-VWGJQTNA.js.map