@notis_ai/cli 0.2.29 → 0.2.31

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 (113) hide show
  1. package/README.md +26 -8
  2. package/dist/agent-hooks/notis-agent-hook.mjs +38399 -10883
  3. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  4. package/dist/base-skills/notis-cli/SKILL.md +11 -0
  5. package/dist/base-skills/notis-cli/references/native-databases.md +1 -1
  6. package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
  7. package/dist/base-skills/notis-query/references/query.md +6 -4
  8. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  9. package/dist/base-skills/notis-spaces/SKILL.md +8 -3
  10. package/dist/base-skills/notis-spaces/references/architecture.md +4 -1
  11. package/dist/base-skills/notis-spaces/references/design.md +7 -1
  12. package/dist/base-skills/notis-spaces/references/fixtures.md +27 -2
  13. package/dist/base-skills/notis-spaces/references/release.md +6 -5
  14. package/dist/base-skills/notis-spaces/references/sdk.md +172 -48
  15. package/dist/base-skills/notis-spaces/references/troubleshooting.md +3 -0
  16. package/dist/base-skills/notis-spaces/references/views.md +20 -0
  17. package/dist/sdk/src/hooks/useNativeDocuments.ts +50 -12
  18. package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
  19. package/dist/sdk/src/index.ts +7 -2
  20. package/dist/sdk/src/runtime.ts +8 -1
  21. package/dist/sdk/src/space.ts +233 -1
  22. package/dist/sdk/src/tailwind.ts +53 -3
  23. package/dist/sdk/src/ui/icons.tsx +1 -0
  24. package/dist/sdk/src/words/types.ts +28 -0
  25. package/dist/skill-sync/index.js +10 -90
  26. package/dist/skill-sync-worker.mjs +232 -120
  27. package/dist/space-harness/host.js +309 -96
  28. package/dist/space-sdk/dist/chunk-3DFOGU26.js +3 -0
  29. package/dist/space-sdk/dist/index.js +4 -2
  30. package/dist/space-sdk/dist/ui.js +19 -14
  31. package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +23 -0
  32. package/dist/space-sdk/src/hooks/useThreadItem.d.ts +28 -0
  33. package/dist/space-sdk/src/index.d.ts +4 -2
  34. package/dist/space-sdk/src/runtime.d.ts +8 -1
  35. package/dist/space-sdk/src/space.ts +233 -1
  36. package/dist/space-sdk/src/tailwind-candidates.d.ts +765 -16
  37. package/dist/space-sdk/src/tailwind.ts +53 -3
  38. package/dist/space-sdk/src/ui/actions/useToast.d.ts +2 -0
  39. package/dist/space-sdk/src/ui/blocks/DataTable.d.ts +19 -4
  40. package/dist/space-sdk/src/ui/blocks/Meter.d.ts +12 -3
  41. package/dist/space-sdk/src/ui/blocks/Tabs.d.ts +7 -1
  42. package/dist/space-sdk/src/ui/blocks/index.d.ts +1 -1
  43. package/dist/space-sdk/src/ui/charts/CalendarHeatmap.d.ts +69 -0
  44. package/dist/space-sdk/src/ui/charts/Chart.d.ts +18 -3
  45. package/dist/space-sdk/src/ui/charts/chartData.d.ts +19 -0
  46. package/dist/space-sdk/src/ui/charts/heatmapData.d.ts +81 -0
  47. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +56 -10
  48. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +16 -7
  49. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +59 -0
  50. package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +5 -2
  51. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +103 -8
  52. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +82 -0
  53. package/dist/space-sdk/src/ui/comments/hostComments.d.ts +37 -0
  54. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  55. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +119 -0
  56. package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +75 -0
  57. package/dist/space-sdk/src/ui/comments/useComments.d.ts +147 -15
  58. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +24 -8
  59. package/dist/space-sdk/src/ui/index.d.ts +6 -3
  60. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +6 -1
  61. package/dist/space-sdk/src/ui/list/Row.d.ts +11 -1
  62. package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +8 -2
  63. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +2 -0
  64. package/dist/space-sdk/src/ui/period/dateWords.d.ts +9 -0
  65. package/dist/space-sdk/src/ui/period/periods.d.ts +15 -2
  66. package/dist/space-sdk/src/ui/styles.d.ts +27 -5
  67. package/dist/space-sdk/src/words/types.ts +28 -0
  68. package/dist/view-renderer/dist/host.js +379 -166
  69. package/dist/view-renderer/src/dom.js +3 -2
  70. package/dist/view-renderer/src/errors.js +9 -0
  71. package/dist/view-renderer/src/host.tsx +18 -8
  72. package/dist/view-renderer/src/remote-broker.js +3 -1
  73. package/dist/view-renderer/src/renderer.js +87 -17
  74. package/dist/view-renderer/src/skeleton.js +70 -18
  75. package/package.json +5 -4
  76. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -1
  77. package/skills/notis-query/cli.md +3 -0
  78. package/skills/notis-spaces/cli.md +8 -8
  79. package/src/cli.js +10 -2
  80. package/src/command-specs/computer.js +21 -1
  81. package/src/command-specs/profile.js +12 -5
  82. package/src/command-specs/spaces.js +101 -31
  83. package/src/command-specs/tools.js +3 -0
  84. package/src/runtime/agent-identity.js +187 -0
  85. package/src/runtime/api-hosts.generated.js +35 -0
  86. package/src/runtime/api-hosts.js +109 -0
  87. package/src/runtime/app-platform.js +68 -24
  88. package/src/runtime/channel.js +3 -7
  89. package/src/runtime/http-agent.js +53 -0
  90. package/src/runtime/native-record-files.js +11 -0
  91. package/src/runtime/oauth.js +97 -5
  92. package/src/runtime/profiles.js +200 -41
  93. package/src/runtime/skill-sync/cloud-client.ts +0 -10
  94. package/src/runtime/skill-sync/index.ts +13 -15
  95. package/src/runtime/skill-sync/local-scanner.ts +0 -67
  96. package/src/runtime/skill-sync/types.ts +1 -0
  97. package/src/runtime/skill-sync/write-cloud-skill.ts +7 -23
  98. package/src/runtime/skill-sync-service.js +4 -5
  99. package/src/runtime/space-dependencies.js +66 -0
  100. package/src/runtime/space-fixture-broker.js +23 -8
  101. package/src/runtime/space-platform.js +49 -3
  102. package/src/runtime/space-source.js +76 -2
  103. package/src/runtime/space-test-server.js +125 -10
  104. package/src/runtime/space-verification.js +106 -42
  105. package/src/runtime/space-view-manifest.js +38 -5
  106. package/src/runtime/telemetry.js +14 -1
  107. package/src/runtime/transport.js +31 -4
  108. package/src/runtime/upsell.js +3 -6
  109. package/src/runtime/view-render.js +6 -1
  110. package/src/skill-sync-worker.js +13 -2
  111. package/src/space-harness-host.ts +6 -3
  112. package/template/tailwind.config.ts +2 -35
  113. package/dist/space-sdk/dist/chunk-BFGB6XXC.js +0 -5
@@ -811,44 +811,6 @@ async function createZipFromDirectory(directoryPath) {
811
811
  await fs.rm(stagingRoot, { recursive: true, force: true });
812
812
  }
813
813
  }
814
- async function extractZipToDirectory(zipPath, destinationDir) {
815
- const extractRoot = await fs.mkdtemp(
816
- path.join(os.tmpdir(), "notis-skill-extract-")
817
- );
818
- try {
819
- if (process.platform === "win32") {
820
- await execFileAsync("powershell.exe", [
821
- "-NoProfile",
822
- "-Command",
823
- `Expand-Archive -Path '${zipPath.replace(/'/g, "''")}' -DestinationPath '${extractRoot.replace(/'/g, "''")}' -Force`
824
- ]);
825
- } else {
826
- await execFileAsync("unzip", ["-qq", zipPath, "-d", extractRoot]);
827
- }
828
- const extractedEntries = await fs.readdir(extractRoot, {
829
- withFileTypes: true
830
- });
831
- const extractedDirectory = extractedEntries.find(
832
- (entry) => entry.isDirectory()
833
- );
834
- const sourceDir = extractedDirectory ? path.join(extractRoot, extractedDirectory.name) : extractRoot;
835
- await fs.rm(destinationDir, { recursive: true, force: true });
836
- await fs.mkdir(path.dirname(destinationDir), { recursive: true });
837
- await fs.cp(sourceDir, destinationDir, { recursive: true });
838
- return await listRelativeFiles(destinationDir);
839
- } finally {
840
- await fs.rm(extractRoot, { recursive: true, force: true });
841
- }
842
- }
843
- async function listRelativeFiles(dirPath) {
844
- try {
845
- const files = await listFilesRecursive(dirPath);
846
- return files.map((filePath) => toPosixRelativePath(dirPath, filePath)).sort();
847
- } catch (error) {
848
- if (error?.code === "ENOENT") return [];
849
- throw error;
850
- }
851
- }
852
814
  function toPosixRelativePath(rootDir, filePath) {
853
815
  return path.relative(rootDir, filePath).split(path.sep).join("/");
854
816
  }
@@ -990,7 +952,7 @@ async function captureNativeSkillFiles(skill) {
990
952
  if (hash.digest("hex") !== skill.folderHash) throw new Error("Local Skill files changed before upload. Sync again with the current files.");
991
953
  return files;
992
954
  }
993
- async function writeCloudSkillToDisk(skill, bundleBytes, paths = DEFAULT_SYNC_PATHS, options = {}) {
955
+ async function writeCloudSkillToDisk(skill, paths = DEFAULT_SYNC_PATHS, options = {}) {
994
956
  if (isNativeSkill(skill)) {
995
957
  assertNativePull({
996
958
  skills: [{ ...skill, name: "native-" + skill.id }],
@@ -999,7 +961,6 @@ async function writeCloudSkillToDisk(skill, bundleBytes, paths = DEFAULT_SYNC_PA
999
961
  sync_enabled: true,
1000
962
  last_synced_at: null
1001
963
  });
1002
- if (bundleBytes?.length) throw new Error("Native Skills require their verified complete file response.");
1003
964
  }
1004
965
  const skillDir = path.join(
1005
966
  paths.skillsDir,
@@ -1012,22 +973,6 @@ async function writeCloudSkillToDisk(skill, bundleBytes, paths = DEFAULT_SYNC_PA
1012
973
  // An unchanged legacy folder upgrading in place: shared files take the cloud version.
1013
974
  legacyBaseline: isNativeSkill(skill) && options.legacyBaseline === true && options.expectedFolderHash !== void 0
1014
975
  };
1015
- if (bundleBytes?.length) {
1016
- const bundlePath = path.join(
1017
- os.tmpdir(),
1018
- `notis-skill-download-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
1019
- );
1020
- try {
1021
- await fs.writeFile(bundlePath, bundleBytes);
1022
- let appliedFiles = [];
1023
- await replaceSkillDirectoryAtomically(skillDir, async (stagingDir) => {
1024
- appliedFiles = await extractZipToDirectory(bundlePath, stagingDir);
1025
- }, preserve);
1026
- return { written: true, appliedFiles };
1027
- } finally {
1028
- await fs.rm(bundlePath, { force: true });
1029
- }
1030
- }
1031
976
  if (!skill.skill_md && (!skill.bundle_files || skill.bundle_files.length === 0)) {
1032
977
  return false;
1033
978
  }
@@ -1188,14 +1133,6 @@ async function pushChangedSkills(serverUrl, jwt, changedSkills, options = {}) {
1188
1133
  }
1189
1134
  return { skills: saved, ...failed.length ? { failed } : {} };
1190
1135
  }
1191
- async function downloadSkillBundle(bundleUrl) {
1192
- const response = await fetch(bundleUrl, { signal: AbortSignal.timeout(9e4) });
1193
- if (!response.ok) {
1194
- const text = await response.text();
1195
- throw new Error(`GET ${bundleUrl} \u2192 ${response.status}: ${text}`);
1196
- }
1197
- return Buffer.from(await response.arrayBuffer());
1198
- }
1199
1136
  async function updateAgentTargets(serverUrl, jwt, skillId, targets, expectedUpdatedAt, native) {
1200
1137
  if (native) {
1201
1138
  checkedNativeReference(native.reference, skillId);
@@ -1566,25 +1503,7 @@ function getPushCandidates(localSkills, syncState, cloudCuratedSkillNames = /* @
1566
1503
  }
1567
1504
 
1568
1505
  // src/runtime/skill-sync/write-cloud-skill.ts
1569
- async function writeCloudSkillWithBundleFallback(skill, dependencies) {
1570
- if (skill.skill_source_url) {
1571
- try {
1572
- const bundleBytes = await dependencies.downloadSkillBundle(skill.skill_source_url);
1573
- const wroteBundleToDisk = await dependencies.writeCloudSkillToDisk(skill, bundleBytes);
1574
- if (wroteBundleToDisk) {
1575
- return wroteBundleToDisk;
1576
- }
1577
- dependencies.onWarning?.(
1578
- `Bundle sync for "${skill.name}" produced no local changes, falling back to SKILL.md payload.`,
1579
- new Error("Bundle write returned false")
1580
- );
1581
- } catch (error) {
1582
- dependencies.onWarning?.(
1583
- `Failed to apply bundle sync for "${skill.name}", falling back to SKILL.md payload.`,
1584
- error
1585
- );
1586
- }
1587
- }
1506
+ async function writeCloudSkill(skill, dependencies) {
1588
1507
  if (skill.bundle_hydration_failed) {
1589
1508
  dependencies.onWarning?.(
1590
1509
  `Skipping markdown fallback for synced skill "${skill.name}" because its stored bundle could not be hydrated by the server.`,
@@ -1623,7 +1542,6 @@ var DEFAULT_RUN_SKILL_SYNC_DEPS = {
1623
1542
  fetchSyncSettings,
1624
1543
  pullSkills,
1625
1544
  pushChangedSkills,
1626
- downloadSkillBundle,
1627
1545
  gatherTopLevelLocalSkills,
1628
1546
  readLegacySyncState,
1629
1547
  readSyncState,
@@ -1712,7 +1630,10 @@ function cloudContentHash(skill) {
1712
1630
  return createHash4("sha256").update(JSON.stringify({
1713
1631
  md: skill.skill_md,
1714
1632
  hash: skill.skill_folder_hash,
1715
- source: skill.skill_source_url,
1633
+ // A recorded origin is provenance, never content (SKL-059): a URL hashes as null so
1634
+ // it cannot force a rewrite, and an absent or null one hashes as before so stored
1635
+ // hashes stay valid.
1636
+ source: skill.skill_source_url ? null : skill.skill_source_url,
1716
1637
  files: skill.bundle_files?.slice().sort((a, b) => a.path.localeCompare(b.path)),
1717
1638
  hydrationFailed: skill.bundle_hydration_failed === true
1718
1639
  })).digest("hex");
@@ -1785,7 +1706,7 @@ function buildSyncState(pullResponse, localSkills, lastSyncedAt, verifiedAgentLi
1785
1706
  agentTargets: normalizeAgentTargets(skill.agent_targets),
1786
1707
  verifiedAgentLinks: skill.status === "active" ? verifiedAgentLinks[skill.name] ?? {} : {},
1787
1708
  cloudUpdatedAt: skill.updated_at,
1788
- ...!failedContentNames.has(skill.name) && !skill.skill_source_url ? { cloudContentHash: cloudContentHash(skill) } : {},
1709
+ ...!failedContentNames.has(skill.name) ? { cloudContentHash: cloudContentHash(skill) } : {},
1789
1710
  ...appliedCloudFolderHash !== void 0 ? { appliedCloudFolderHash } : {},
1790
1711
  ...appliedFileList !== void 0 ? { appliedFiles: appliedFileList } : {},
1791
1712
  syncedAt: lastSyncedAt || (/* @__PURE__ */ new Date()).toISOString()
@@ -1886,9 +1807,8 @@ async function writePulledSkillsToScopedMirror(pullResponse, localSkills, previo
1886
1807
  }
1887
1808
  continue;
1888
1809
  }
1889
- const outcome = await writeCloudSkillWithBundleFallback(cloudSkill, {
1890
- downloadSkillBundle: deps.downloadSkillBundle,
1891
- writeCloudSkillToDisk: (skill, bundleBytes) => deps.writeCloudSkillToDisk(skill, bundleBytes, syncPaths, {
1810
+ const outcome = await writeCloudSkill(cloudSkill, {
1811
+ writeCloudSkillToDisk: (skill) => deps.writeCloudSkillToDisk(skill, syncPaths, {
1892
1812
  // What the last write put there. Everything else in the folder was
1893
1813
  // produced locally and survives this one.
1894
1814
  previouslyApplied: previouslyAppliedFiles(skill, local, previousState),
@@ -1904,7 +1824,7 @@ async function writePulledSkillsToScopedMirror(pullResponse, localSkills, previo
1904
1824
  appliedFilesByName[cloudSkill.name] = outcome.appliedFiles;
1905
1825
  }
1906
1826
  } else {
1907
- failures.push({ name: cloudSkill.name, error: "Skill content could not be downloaded or written; sync will retry" });
1827
+ failures.push({ name: cloudSkill.name, error: "Skill content could not be written; sync will retry" });
1908
1828
  }
1909
1829
  }
1910
1830
  return downloaded;