@notis_ai/cli 0.2.33 → 0.2.34

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 (56) hide show
  1. package/README.md +1 -2
  2. package/dist/agent-hooks/notis-agent-hook.mjs +82 -19
  3. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  4. package/dist/base-skills/notis-cli/SKILL.md +1 -1
  5. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  6. package/dist/base-skills/notis-spaces/references/comments.md +11 -3
  7. package/dist/sdk/src/components/NotisSelectionBoundary.tsx +13 -5
  8. package/dist/sdk/src/components/SelectionActionBar.tsx +3 -1
  9. package/dist/sdk/src/components/SpaceTextComments.tsx +13 -4
  10. package/dist/sdk/src/components/selectionRange.ts +65 -0
  11. package/dist/sdk/src/config.ts +1 -1
  12. package/dist/sdk/src/functions.ts +17 -2
  13. package/dist/sdk/src/hooks/useCollectionInteractions.ts +59 -7
  14. package/dist/sdk/src/index.ts +4 -3
  15. package/dist/sdk/src/interactions/shortcuts.tsx +6 -1
  16. package/dist/sdk/src/interactions/swipeDownToDismiss.ts +158 -0
  17. package/dist/sdk/src/interactions/textBoxTwoState.ts +174 -0
  18. package/dist/sdk/src/interactions.ts +17 -0
  19. package/dist/sdk/src/space.ts +73 -5
  20. package/dist/skill-sync/index.js +23 -1
  21. package/dist/skill-sync-worker.mjs +62 -3
  22. package/dist/space-harness/host.js +351 -237
  23. package/dist/space-sdk/dist/chunk-3NPBCE6E.js +3 -0
  24. package/dist/space-sdk/dist/index.js +2 -2
  25. package/dist/space-sdk/dist/ui.js +16 -12
  26. package/dist/space-sdk/src/config.ts +1 -1
  27. package/dist/space-sdk/src/functions.ts +17 -2
  28. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +5 -0
  29. package/dist/space-sdk/src/index.d.ts +3 -3
  30. package/dist/space-sdk/src/interactions/shortcuts.d.ts +5 -0
  31. package/dist/space-sdk/src/space.ts +73 -5
  32. package/dist/space-sdk/src/tailwind-candidates.d.ts +234 -71
  33. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +86 -14
  34. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +4 -1
  35. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +0 -6
  36. package/dist/space-sdk/src/ui/comments/commentDrafts.d.ts +63 -0
  37. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +4 -0
  38. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +23 -1
  39. package/dist/space-sdk/src/ui/comments/handover.d.ts +34 -0
  40. package/dist/space-sdk/src/ui/comments/hostPanel.d.ts +113 -0
  41. package/dist/space-sdk/src/ui/comments/index.d.ts +6 -1
  42. package/dist/space-sdk/src/ui/comments/paneOutlet.d.ts +33 -0
  43. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +54 -32
  44. package/dist/space-sdk/src/ui/comments/reviewRun.d.ts +190 -0
  45. package/dist/space-sdk/src/ui/comments/useComments.d.ts +52 -3
  46. package/dist/view-renderer/dist/host.js +413 -299
  47. package/package.json +3 -3
  48. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +1 -1
  49. package/src/runtime/agent-identity.js +3 -4
  50. package/src/runtime/app-platform.js +1 -1
  51. package/src/runtime/profiles.js +59 -2
  52. package/src/runtime/skill-sync/cloud-client.ts +33 -3
  53. package/src/runtime/skill-sync/index.ts +1 -1
  54. package/src/runtime/skill-sync/types.ts +4 -1
  55. package/src/runtime/space-functions.js +5 -3
  56. package/dist/space-sdk/dist/chunk-4GWS2IFO.js +0 -3
@@ -1083,6 +1083,20 @@ async function skillPushPayload(skill) {
1083
1083
  };
1084
1084
  }
1085
1085
  var SYNC_PUSH_ENVELOPE_BYTES = Buffer.byteLength(JSON.stringify({ skill_sync_protocol: 2, skills: [] }));
1086
+ var SERVER_REQUEST_BODY_MAX_BYTES = 64 * 1024 * 1024;
1087
+ var MAX_SYNC_PUSH_SKILL_BYTES = SERVER_REQUEST_BODY_MAX_BYTES - SYNC_PUSH_ENVELOPE_BYTES;
1088
+ function mib(bytes) {
1089
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
1090
+ }
1091
+ function tooLargeFailure(name, sizeBytes, limitBytes) {
1092
+ return {
1093
+ name,
1094
+ error: `Skill is too large to sync (${mib(sizeBytes)}, the limit is ${mib(limitBytes)}); remove large files from its folder to sync it`,
1095
+ code: "skill_too_large",
1096
+ size_bytes: sizeBytes,
1097
+ limit_bytes: limitBytes
1098
+ };
1099
+ }
1086
1100
  function pushBatches(payloads, maxBodyBytes) {
1087
1101
  const batches = [];
1088
1102
  let batch = [];
@@ -1113,9 +1127,15 @@ function pushFailure(name, error) {
1113
1127
  return { name, error: "Upload failed; sync will retry", code };
1114
1128
  }
1115
1129
  async function pushChangedSkills(serverUrl, jwt, changedSkills, options = {}) {
1116
- const payloadSkills = await Promise.all(changedSkills.map(skillPushPayload));
1130
+ const maxSkillBytes = options.maxSkillBytes ?? MAX_SYNC_PUSH_SKILL_BYTES;
1117
1131
  const saved = [];
1118
1132
  const failed = [];
1133
+ const payloadSkills = [];
1134
+ for (const payload of await Promise.all(changedSkills.map(skillPushPayload))) {
1135
+ const bytes = Buffer.byteLength(JSON.stringify(payload)) + 1;
1136
+ if (bytes > maxSkillBytes) failed.push(tooLargeFailure(String(payload.name), bytes, maxSkillBytes));
1137
+ else payloadSkills.push(payload);
1138
+ }
1119
1139
  for (const batch of pushBatches(payloadSkills, options.maxBodyBytes ?? MAX_SYNC_PUSH_BODY_BYTES)) {
1120
1140
  try {
1121
1141
  const result = await requestJson(`${serverUrl}/portal_skills/sync-push`, jwt, {
@@ -2404,6 +2424,8 @@ async function runSkillSync(serverUrl, jwt, dependencies = {}, options = {}) {
2404
2424
  };
2405
2425
  }
2406
2426
  export {
2427
+ MAX_SYNC_PUSH_SKILL_BYTES,
2428
+ SERVER_REQUEST_BODY_MAX_BYTES,
2407
2429
  fetchSyncSettings,
2408
2430
  isolatedLinkOptions,
2409
2431
  materializeCloudSkillsForLocalShell,
@@ -5,6 +5,7 @@ import { homedir as homedir5 } from "node:os";
5
5
  import { join as join9 } from "node:path";
6
6
 
7
7
  // src/runtime/profiles.js
8
+ import { spawnSync } from "node:child_process";
8
9
  import { createHash as createHash2 } from "node:crypto";
9
10
  import {
10
11
  existsSync as existsSync3,
@@ -489,6 +490,7 @@ var LEGACY_DESKTOP_PROFILE_KEYS = [
489
490
  "desktop_pid"
490
491
  ];
491
492
  var WORKTREE_RUNTIME_FILENAME = join3(".context", "notis-runtime.json");
493
+ var WORKTREE_RUNTIME_SECRETS_FILENAME = "notis-runtime-secrets.json";
492
494
  var WORKTREE_ROUTING_FILENAME = join3(".context", "notis-routing.json");
493
495
  var LOCAL_API_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
494
496
  function clone(value) {
@@ -599,6 +601,41 @@ function processIsAlive(pid) {
599
601
  return error?.code === "EPERM";
600
602
  }
601
603
  }
604
+ var RUNTIME_API_PROBE_TIMEOUT_MS = 1500;
605
+ var RUNTIME_API_PROBE_SOURCE = `
606
+ const target = process.argv[1].replace(/\\/+$/, '') + '/openapi.json';
607
+ fetch(target, { redirect: 'manual', signal: AbortSignal.timeout(${RUNTIME_API_PROBE_TIMEOUT_MS}) })
608
+ .then((response) => {
609
+ response.body?.cancel().catch(() => {});
610
+ process.exit(response.ok ? 0 : 1);
611
+ })
612
+ .catch(() => process.exit(1));
613
+ `;
614
+ var runtimeApiProbeResults = /* @__PURE__ */ new Map();
615
+ function localRuntimeApiAnswers(apiBase) {
616
+ if (runtimeApiProbeResults.has(apiBase)) {
617
+ return runtimeApiProbeResults.get(apiBase);
618
+ }
619
+ let answered = false;
620
+ try {
621
+ const probe = spawnSync(process.execPath, ["-e", RUNTIME_API_PROBE_SOURCE, apiBase], {
622
+ env: { PATH: process.env.PATH || "" },
623
+ stdio: "ignore",
624
+ timeout: RUNTIME_API_PROBE_TIMEOUT_MS + 2500
625
+ });
626
+ answered = probe.status === 0;
627
+ } catch {
628
+ answered = false;
629
+ }
630
+ runtimeApiProbeResults.set(apiBase, answered);
631
+ return answered;
632
+ }
633
+ function devRuntimeIsAlive(pid, apiBase) {
634
+ if (processIsAlive(pid)) {
635
+ return true;
636
+ }
637
+ return Number.isInteger(pid) && pid > 0 && localRuntimeApiAnswers(apiBase);
638
+ }
602
639
  function resolveWorktreeRuntime(startDir = process.cwd()) {
603
640
  if (process.env.NODE_ENV === "test" && process.env.NOTIS_TEST_DISABLE_WORKTREE_ROUTING === "1") {
604
641
  return null;
@@ -625,12 +662,14 @@ function resolveWorktreeRuntime(startDir = process.cwd()) {
625
662
  return null;
626
663
  }
627
664
  const runtime = readJsonFile(runtimePath);
665
+ const secrets = readJsonFile(join3(dirname3(runtimePath), WORKTREE_RUNTIME_SECRETS_FILENAME));
666
+ const sessionSecrets = secrets && runtime && secrets.dev_session_id === runtime.dev_session_id ? secrets : null;
628
667
  const apiBase = typeof runtime?.api_base === "string" ? runtime.api_base.replace(/\/+$/, "") : "";
629
668
  const profile = typeof runtime?.profile === "string" ? runtime.profile.trim() : "";
630
- const devAccessToken = typeof runtime?.dev_access_token === "string" ? runtime.dev_access_token.trim() : "";
669
+ const devAccessToken = typeof sessionSecrets?.dev_access_token === "string" && sessionSecrets.dev_access_token.trim() ? sessionSecrets.dev_access_token.trim() : typeof runtime?.dev_access_token === "string" ? runtime.dev_access_token.trim() : "";
631
670
  const desktopDeepLinkScheme = typeof runtime?.desktop_deep_link_scheme === "string" ? runtime.desktop_deep_link_scheme.trim() : "";
632
671
  const pid = Number(runtime?.dev_pid);
633
- if (runtime?.mode !== "local-only" || !isLocalApiBase(apiBase) || !profile || !devAccessToken || !processIsAlive(pid)) {
672
+ if (runtime?.mode !== "local-only" || !isLocalApiBase(apiBase) || !profile || !devAccessToken || !devRuntimeIsAlive(pid, apiBase)) {
634
673
  return {
635
674
  unavailable: new CliError({
636
675
  code: "dev_runtime_unavailable",
@@ -2984,6 +3023,20 @@ async function skillPushPayload(skill) {
2984
3023
  };
2985
3024
  }
2986
3025
  var SYNC_PUSH_ENVELOPE_BYTES = Buffer.byteLength(JSON.stringify({ skill_sync_protocol: 2, skills: [] }));
3026
+ var SERVER_REQUEST_BODY_MAX_BYTES = 64 * 1024 * 1024;
3027
+ var MAX_SYNC_PUSH_SKILL_BYTES = SERVER_REQUEST_BODY_MAX_BYTES - SYNC_PUSH_ENVELOPE_BYTES;
3028
+ function mib(bytes) {
3029
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
3030
+ }
3031
+ function tooLargeFailure(name, sizeBytes, limitBytes) {
3032
+ return {
3033
+ name,
3034
+ error: `Skill is too large to sync (${mib(sizeBytes)}, the limit is ${mib(limitBytes)}); remove large files from its folder to sync it`,
3035
+ code: "skill_too_large",
3036
+ size_bytes: sizeBytes,
3037
+ limit_bytes: limitBytes
3038
+ };
3039
+ }
2987
3040
  function pushBatches(payloads, maxBodyBytes) {
2988
3041
  const batches = [];
2989
3042
  let batch = [];
@@ -3014,9 +3067,15 @@ function pushFailure(name, error) {
3014
3067
  return { name, error: "Upload failed; sync will retry", code };
3015
3068
  }
3016
3069
  async function pushChangedSkills(serverUrl, jwt, changedSkills, options = {}) {
3017
- const payloadSkills = await Promise.all(changedSkills.map(skillPushPayload));
3070
+ const maxSkillBytes = options.maxSkillBytes ?? MAX_SYNC_PUSH_SKILL_BYTES;
3018
3071
  const saved = [];
3019
3072
  const failed = [];
3073
+ const payloadSkills = [];
3074
+ for (const payload of await Promise.all(changedSkills.map(skillPushPayload))) {
3075
+ const bytes = Buffer.byteLength(JSON.stringify(payload)) + 1;
3076
+ if (bytes > maxSkillBytes) failed.push(tooLargeFailure(String(payload.name), bytes, maxSkillBytes));
3077
+ else payloadSkills.push(payload);
3078
+ }
3020
3079
  for (const batch of pushBatches(payloadSkills, options.maxBodyBytes ?? MAX_SYNC_PUSH_BODY_BYTES)) {
3021
3080
  try {
3022
3081
  const result = await requestJson(`${serverUrl}/portal_skills/sync-push`, jwt, {