deepspace 0.3.10 → 0.3.11

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 (120) hide show
  1. package/dist/cli.js +92 -14
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +160 -1
  4. package/dist/index.js +278 -121
  5. package/dist/index.js.map +1 -1
  6. package/dist/server.d.ts +171 -1
  7. package/dist/server.js +580 -0
  8. package/dist/server.js.map +1 -1
  9. package/dist/worker.d.ts +251 -1
  10. package/dist/worker.js +587 -0
  11. package/dist/worker.js.map +1 -1
  12. package/features/admin-page/feature.json +29 -0
  13. package/features/admin-page/src/AdminPage.tsx +292 -0
  14. package/features/admin-page/src/admin-schema.ts +20 -0
  15. package/features/ai-chat/feature.json +41 -0
  16. package/features/ai-chat/src/AiChatPage.tsx +692 -0
  17. package/features/ai-chat/src/ChatPanel.tsx +1098 -0
  18. package/features/ai-chat/src/ai-chat-schema.ts +11 -0
  19. package/features/canvas/feature.json +45 -0
  20. package/features/canvas/src/CanvasEditorPage.tsx +87 -0
  21. package/features/canvas/src/CanvasListPage.tsx +202 -0
  22. package/features/canvas/src/canvas-schema.ts +33 -0
  23. package/features/canvas/src/components/CanvasToolbar.tsx +170 -0
  24. package/features/canvas/src/components/CanvasView.tsx +369 -0
  25. package/features/canvas/src/components/ShapeRenderer.tsx +114 -0
  26. package/features/cron/feature.json +33 -0
  27. package/features/cron/src/CronLogPage.tsx +100 -0
  28. package/features/cron/src/cron.ts +25 -0
  29. package/features/docs/feature.json +96 -0
  30. package/features/docs/src/DocsEditorPage.tsx +1012 -0
  31. package/features/docs/src/DocsListPage.tsx +951 -0
  32. package/features/docs/src/DocsOutlinePanel.tsx +68 -0
  33. package/features/docs/src/DocsPresence.tsx +138 -0
  34. package/features/docs/src/InviteDialog.tsx +336 -0
  35. package/features/docs/src/LibrarySidebar.tsx +464 -0
  36. package/features/docs/src/docs-favorites.ts +18 -0
  37. package/features/docs/src/docs-library-types.ts +15 -0
  38. package/features/docs/src/docs-schema.ts +80 -0
  39. package/features/docs/src/docs-ui.css +309 -0
  40. package/features/docs/src/editor/DocEditorSurface.tsx +257 -0
  41. package/features/docs/src/editor/DocsTiptapToolbar.tsx +560 -0
  42. package/features/docs/src/editor/useDocEditor.ts +206 -0
  43. package/features/docs/src/use-yjs-room-with-awareness.ts +285 -0
  44. package/features/file-attachments/feature.json +42 -0
  45. package/features/file-attachments/src/AttachmentsPage.tsx +864 -0
  46. package/features/file-attachments/src/attachments-constants.ts +9 -0
  47. package/features/file-attachments/src/attachments-schema.ts +45 -0
  48. package/features/file-attachments/src/useFilePreview.ts +471 -0
  49. package/features/file-attachments/src/useMimeTypeDetection.ts +138 -0
  50. package/features/file-manager/feature.json +24 -0
  51. package/features/file-manager/src/FileManagerPage.tsx +330 -0
  52. package/features/integration-test/feature.json +18 -0
  53. package/features/integration-test/src/IntegrationTestPage.tsx +423 -0
  54. package/features/integration-test/src/integration.spec.ts +42 -0
  55. package/features/items/feature.json +33 -0
  56. package/features/items/src/ItemsPage.tsx +325 -0
  57. package/features/items/src/items-constants.ts +10 -0
  58. package/features/items/src/items-schema.ts +27 -0
  59. package/features/kanban/feature.json +18 -0
  60. package/features/kanban/src/Kanban.tsx +283 -0
  61. package/features/landing/feature.json +62 -0
  62. package/features/landing/src/LandingPage.tsx +627 -0
  63. package/features/landing/src/primitives.tsx +389 -0
  64. package/features/landing/src/sections/FAQSection.tsx +110 -0
  65. package/features/landing/src/sections/FeaturesGridSection.tsx +311 -0
  66. package/features/landing/src/sections/HowItWorksSection.tsx +62 -0
  67. package/features/landing/src/sections/LogoCloudSection.tsx +58 -0
  68. package/features/landing/src/sections/ShowcaseSection.tsx +63 -0
  69. package/features/landing/src/sections/StatsSection.tsx +31 -0
  70. package/features/landing/src/sections/TeamSection.tsx +86 -0
  71. package/features/landing/src/sections/TestimonialsSection.tsx +68 -0
  72. package/features/landing/src/sections/VideoSection.tsx +71 -0
  73. package/features/leaderboard/feature.json +33 -0
  74. package/features/leaderboard/src/LeaderboardPage.tsx +372 -0
  75. package/features/leaderboard/src/leaderboard-constants.ts +21 -0
  76. package/features/leaderboard/src/leaderboard-schema.ts +36 -0
  77. package/features/messaging/feature.json +111 -0
  78. package/features/messaging/src/ChatMultiPage.tsx +300 -0
  79. package/features/messaging/src/ChatPage.tsx +75 -0
  80. package/features/messaging/src/components/chat/ChatHeader.tsx +76 -0
  81. package/features/messaging/src/components/chat/MessageActionSheet.tsx +168 -0
  82. package/features/messaging/src/components/chat/MessageInput.tsx +65 -0
  83. package/features/messaging/src/components/chat/MessageItem.tsx +352 -0
  84. package/features/messaging/src/components/chat/MessageList.tsx +248 -0
  85. package/features/messaging/src/components/chat/ReactionPicker.tsx +2 -0
  86. package/features/messaging/src/components/chat/ThreadPanel.tsx +107 -0
  87. package/features/messaging/src/components/chat/UserProfilePopover.tsx +158 -0
  88. package/features/messaging/src/components/chat-multi/AddMemberModal.tsx +188 -0
  89. package/features/messaging/src/components/chat-multi/BrowseGroupsModal.tsx +163 -0
  90. package/features/messaging/src/components/chat-multi/ChannelListItem.tsx +147 -0
  91. package/features/messaging/src/components/chat-multi/ChannelSettingsPanel.tsx +344 -0
  92. package/features/messaging/src/components/chat-multi/ChannelSidebar.tsx +460 -0
  93. package/features/messaging/src/components/chat-multi/CreateGroupModal.tsx +190 -0
  94. package/features/messaging/src/components/chat-multi/InvitationList.tsx +149 -0
  95. package/features/messaging/src/components/chat-multi/NewMessageModal.tsx +159 -0
  96. package/features/messaging/src/hooks/useChatChannel.ts +64 -0
  97. package/features/messaging/src/hooks/useLongPress.ts +74 -0
  98. package/features/messaging/src/hooks/useMultiChannel.ts +142 -0
  99. package/features/messaging/src/messaging-schema.ts +25 -0
  100. package/features/presence-test/feature.json +21 -0
  101. package/features/presence-test/src/PresenceTestPage.tsx +120 -0
  102. package/features/sidebar/feature.json +19 -0
  103. package/features/sidebar/src/AppSidebar.tsx +558 -0
  104. package/features/tasks/feature.json +33 -0
  105. package/features/tasks/src/TasksPage.tsx +598 -0
  106. package/features/tasks/src/tasks-constants.ts +43 -0
  107. package/features/tasks/src/tasks-schema.ts +56 -0
  108. package/features/testing/feature.json +49 -0
  109. package/features/testing/src/TestPage.tsx +145 -0
  110. package/features/testing/src/cpu-burn-action.ts +51 -0
  111. package/features/testing/src/subrequest-burn-action.ts +53 -0
  112. package/features/testing/src/test-schema.ts +23 -0
  113. package/features/topbar/feature.json +18 -0
  114. package/features/topbar/src/Topbar.tsx +353 -0
  115. package/features/tree/feature.json +26 -0
  116. package/features/tree/src/TreeSidebar.tsx +607 -0
  117. package/features/tree/src/tree-constants.ts +68 -0
  118. package/features/tree/src/tree-hooks.ts +258 -0
  119. package/package.json +4 -2
  120. package/scripts/add-feature.cjs +654 -0
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli/cli.ts
4
- import { defineCommand as defineCommand17, runMain } from "citty";
4
+ import { defineCommand as defineCommand18, runMain } from "citty";
5
5
  import { execSync as execSync5 } from "child_process";
6
6
  import { readFileSync as readFileSync10, existsSync as existsSync13 } from "fs";
7
- import { dirname as dirname2, join as join13 } from "path";
7
+ import { dirname as dirname2, join as join14 } from "path";
8
8
  import { fileURLToPath } from "url";
9
9
 
10
10
  // src/cli/commands/login.ts
@@ -530,16 +530,16 @@ var DIR2 = join4(homedir3(), ".deepspace");
530
530
  var SESSION_PATH2 = join4(DIR2, "session");
531
531
  var TOKEN_PATH2 = join4(DIR2, "token");
532
532
  async function ensureToken() {
533
- if (!existsSync3(SESSION_PATH2)) {
534
- throw new Error("Not logged in. Run `deepspace login` first.");
535
- }
536
- const sessionToken = readFileSync3(SESSION_PATH2, "utf-8").trim();
537
533
  if (existsSync3(TOKEN_PATH2)) {
538
534
  const existing = readFileSync3(TOKEN_PATH2, "utf-8").trim();
539
535
  if (isTokenValid(existing)) {
540
536
  return existing;
541
537
  }
542
538
  }
539
+ if (!existsSync3(SESSION_PATH2)) {
540
+ throw new Error("Not logged in. Run `deepspace login` first.");
541
+ }
542
+ const sessionToken = readFileSync3(SESSION_PATH2, "utf-8").trim();
543
543
  const token2 = await exchangeSession(AUTH_URL3, sessionToken);
544
544
  if (!token2) {
545
545
  throw new Error("Session expired. Run `deepspace login` to re-authenticate.");
@@ -2096,8 +2096,10 @@ import { existsSync as existsSync10 } from "fs";
2096
2096
  import { resolve as resolve6, join as join10 } from "path";
2097
2097
  import { execSync as execSync3 } from "child_process";
2098
2098
  function findScript(from) {
2099
- const candidate = join10(from, ".deepspace", "scripts", "add-feature.cjs");
2100
- if (existsSync10(candidate)) return candidate;
2099
+ const inNodeModules = join10(from, "node_modules", "deepspace", "scripts", "add-feature.cjs");
2100
+ if (existsSync10(inNodeModules)) return inNodeModules;
2101
+ const inDotDeepspace = join10(from, ".deepspace", "scripts", "add-feature.cjs");
2102
+ if (existsSync10(inDotDeepspace)) return inDotDeepspace;
2101
2103
  return null;
2102
2104
  }
2103
2105
  var add_default = defineCommand11({
@@ -2132,8 +2134,11 @@ var add_default = defineCommand11({
2132
2134
  const appDir = resolve6(args.dir ?? ".");
2133
2135
  const script = findScript(appDir);
2134
2136
  if (!script) {
2135
- console.error("No .deepspace/scripts/add-feature.cjs found.");
2136
- console.error("Are you in a DeepSpace app directory?");
2137
+ console.error("Could not find the deepspace feature installer.");
2138
+ console.error("Looked in:");
2139
+ console.error(` ${join10(appDir, "node_modules", "deepspace", "scripts", "add-feature.cjs")}`);
2140
+ console.error(` ${join10(appDir, ".deepspace", "scripts", "add-feature.cjs")}`);
2141
+ console.error("Are you in a DeepSpace app directory? Try `npm install` first.");
2137
2142
  process.exit(1);
2138
2143
  }
2139
2144
  const passArgs = [];
@@ -3326,13 +3331,85 @@ var library_default = defineCommand16({
3326
3331
  }
3327
3332
  });
3328
3333
 
3334
+ // src/cli/commands/admin.ts
3335
+ import { defineCommand as defineCommand17 } from "citty";
3336
+ import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "fs";
3337
+ import { homedir as homedir5 } from "os";
3338
+ import { join as join13 } from "path";
3339
+ var AUTH_URL5 = process.env.DEEPSPACE_AUTH_URL ?? ENVS.prod.auth;
3340
+ var impersonate = defineCommand17({
3341
+ meta: {
3342
+ name: "impersonate",
3343
+ description: "Store a short-lived CLI token for another user"
3344
+ },
3345
+ args: {
3346
+ email: {
3347
+ type: "string",
3348
+ description: "Target user email",
3349
+ required: false
3350
+ },
3351
+ userId: {
3352
+ type: "string",
3353
+ description: "Target user id",
3354
+ required: false
3355
+ },
3356
+ secret: {
3357
+ type: "string",
3358
+ description: "Admin secret; defaults to DEEPSPACE_ADMIN_SECRET",
3359
+ required: false
3360
+ }
3361
+ },
3362
+ async run({ args }) {
3363
+ const secret = args.secret ?? process.env.DEEPSPACE_ADMIN_SECRET;
3364
+ if (!secret) {
3365
+ console.error("Missing admin secret. Set DEEPSPACE_ADMIN_SECRET or pass --secret.");
3366
+ process.exit(1);
3367
+ }
3368
+ if (!args.email && !args.userId) {
3369
+ console.error("Pass --email or --userId.");
3370
+ process.exit(1);
3371
+ }
3372
+ const res = await fetch(`${AUTH_URL5}/api/auth/admin/impersonate`, {
3373
+ method: "POST",
3374
+ headers: {
3375
+ "Content-Type": "application/json",
3376
+ Authorization: `Bearer ${secret}`
3377
+ },
3378
+ body: JSON.stringify({
3379
+ email: args.email,
3380
+ userId: args.userId
3381
+ })
3382
+ });
3383
+ const data = await res.json().catch(() => ({}));
3384
+ if (!res.ok || !data.token || !data.user) {
3385
+ console.error(`Failed: ${data.error ?? `HTTP ${res.status}`}`);
3386
+ process.exit(1);
3387
+ }
3388
+ const dir = join13(homedir5(), ".deepspace");
3389
+ mkdirSync4(dir, { recursive: true });
3390
+ writeFileSync5(TOKEN_PATH2, data.token, { mode: 384 });
3391
+ console.log(`Impersonating ${data.user.name ?? data.user.email ?? data.user.id}`);
3392
+ console.log(`Email: ${data.user.email ?? "(none)"}`);
3393
+ console.log(`UserID: ${data.user.id}`);
3394
+ }
3395
+ });
3396
+ var admin_default = defineCommand17({
3397
+ meta: {
3398
+ name: "admin",
3399
+ description: "Maintainer-only admin commands"
3400
+ },
3401
+ subCommands: {
3402
+ impersonate
3403
+ }
3404
+ });
3405
+
3329
3406
  // src/cli/cli.ts
3330
3407
  var __dirname = dirname2(fileURLToPath(import.meta.url));
3331
- var pkg = JSON.parse(readFileSync10(join13(__dirname, "..", "package.json"), "utf-8"));
3408
+ var pkg = JSON.parse(readFileSync10(join14(__dirname, "..", "package.json"), "utf-8"));
3332
3409
  if (process.platform === "linux" && !process.env.SSL_CERT_FILE && existsSync13("/etc/ssl/certs/ca-certificates.crt")) {
3333
3410
  process.env.SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
3334
3411
  }
3335
- var create3 = defineCommand17({
3412
+ var create3 = defineCommand18({
3336
3413
  meta: {
3337
3414
  name: "create",
3338
3415
  description: "Create a new DeepSpace app"
@@ -3351,7 +3428,7 @@ var create3 = defineCommand17({
3351
3428
  execSync5(`npm create deepspace@latest${name}`, { stdio: "inherit" });
3352
3429
  }
3353
3430
  });
3354
- var main = defineCommand17({
3431
+ var main = defineCommand18({
3355
3432
  meta: {
3356
3433
  name: "deepspace",
3357
3434
  version: pkg.version,
@@ -3374,7 +3451,8 @@ var main = defineCommand17({
3374
3451
  deploy: deploy_default,
3375
3452
  undeploy: undeploy_default,
3376
3453
  domain: domain_default,
3377
- library: library_default
3454
+ library: library_default,
3455
+ admin: admin_default
3378
3456
  }
3379
3457
  // No `run()` here — citty cascades parent run() AFTER subcommand finishes,
3380
3458
  // which corrupts agent-friendly output (`--json`) and prints noise on every