deepspace 0.26.0 → 0.26.1

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 (52) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{chunk-LPXWXF6R.js → chunk-YBXIUDZJ.js} +2 -2
  3. package/dist/{chunk-LPXWXF6R.js.map → chunk-YBXIUDZJ.js.map} +1 -1
  4. package/dist/cli.js +80 -45
  5. package/dist/cli.js.map +1 -1
  6. package/dist/documentation-client-core.js +1 -1
  7. package/dist/documentation-default-renderer.cjs +1 -1
  8. package/dist/documentation-react.js +1 -1
  9. package/dist/documentation-runtime.js +1 -1
  10. package/dist/documentation-server-core.js +1 -1
  11. package/dist/documentation.js +1 -1
  12. package/dist/documentation.js.map +1 -1
  13. package/dist/index.d.ts +26 -434
  14. package/dist/index.js +99 -864
  15. package/dist/index.js.map +1 -1
  16. package/dist/schema.d.ts +4 -41
  17. package/dist/schema.js +2 -242
  18. package/dist/schema.js.map +1 -1
  19. package/dist/server.d.ts +6 -162
  20. package/dist/server.js +13 -281
  21. package/dist/server.js.map +1 -1
  22. package/dist/worker.d.ts +4 -160
  23. package/dist/worker.js +15 -281
  24. package/dist/worker.js.map +1 -1
  25. package/features/messaging/feature.json +3 -43
  26. package/features/messaging/src/ChatPage.tsx +12 -16
  27. package/features/messaging/src/components/chat/ChatHeader.tsx +5 -13
  28. package/features/messaging/src/components/chat/MessageItem.tsx +7 -9
  29. package/features/messaging/src/components/chat/MessageList.tsx +57 -40
  30. package/features/messaging/src/components/chat/ThreadPanel.tsx +25 -11
  31. package/features/messaging/src/components/chat/UserProfilePopover.tsx +10 -29
  32. package/features/messaging/src/hooks/useChatChannel.ts +18 -23
  33. package/features/messaging/src/messaging-schema.ts +0 -2
  34. package/features/search-bar/feature.json +9 -20
  35. package/features/search-bar/src/InlineSearch.tsx +101 -0
  36. package/features/search-bar/src/__tests__/search-model.test.tsx +38 -0
  37. package/features/search-bar/src/search-model.ts +2 -149
  38. package/package.json +1 -1
  39. package/features/messaging/src/ChatMultiPage.tsx +0 -298
  40. package/features/messaging/src/components/chat-multi/AddMemberModal.tsx +0 -188
  41. package/features/messaging/src/components/chat-multi/BrowseGroupsModal.tsx +0 -163
  42. package/features/messaging/src/components/chat-multi/ChannelListItem.tsx +0 -147
  43. package/features/messaging/src/components/chat-multi/ChannelSettingsPanel.tsx +0 -344
  44. package/features/messaging/src/components/chat-multi/ChannelSidebar.tsx +0 -460
  45. package/features/messaging/src/components/chat-multi/CreateGroupModal.tsx +0 -190
  46. package/features/messaging/src/components/chat-multi/InvitationList.tsx +0 -149
  47. package/features/messaging/src/components/chat-multi/NewMessageModal.tsx +0 -159
  48. package/features/messaging/src/hooks/useMultiChannel.ts +0 -142
  49. package/features/search-bar/src/SearchOverlay.tsx +0 -566
  50. package/features/search-bar/src/__tests__/search-model.test.ts +0 -40
  51. package/features/sidebar/feature.json +0 -19
  52. package/features/sidebar/src/AppSidebar.tsx +0 -558
package/dist/cli.js CHANGED
@@ -46,8 +46,12 @@ function displayLines(value) {
46
46
 
47
47
  // src/cli/lib/spinner.ts
48
48
  var activeSpinner = null;
49
+ var plainProgress = false;
50
+ function setPlainProgress(enabled) {
51
+ plainProgress = enabled;
52
+ }
49
53
  function createSpinner() {
50
- const impl = process.stdout.isTTY ? p.spinner() : {
54
+ const impl = !plainProgress && process.stdout.isTTY ? p.spinner() : {
51
55
  start: (msg) => {
52
56
  if (msg) console.log(msg);
53
57
  },
@@ -3605,8 +3609,33 @@ function formatSchemaLintFindings(findings) {
3605
3609
  }
3606
3610
 
3607
3611
  // src/cli/lib/port.ts
3608
- import { createServer, Socket } from "net";
3612
+ import { Socket } from "net";
3609
3613
  var DEFAULT_PORT = 5173;
3614
+ async function ensurePortFree(port, host, waitMs = 15e3) {
3615
+ if (!await isPortListening(port, host)) return;
3616
+ if (!await isHttpResponding(port)) {
3617
+ const deadline = Date.now() + waitMs;
3618
+ while (Date.now() < deadline) {
3619
+ await new Promise((resolve23) => setTimeout(resolve23, 500));
3620
+ if (!await isPortListening(port, host)) return;
3621
+ }
3622
+ }
3623
+ const killArgv = port === DEFAULT_PORT ? ["deepspace", "dev", "kill"] : ["deepspace", "dev", "kill", "--port", String(port)];
3624
+ throw new Refusal(
3625
+ `Port ${port} is already in use.
3626
+ Free it with \`${killArgv.join(" ")}\`, or use another port: \`--port <other>\`.`,
3627
+ "port_in_use",
3628
+ { extra: { port } }
3629
+ );
3630
+ }
3631
+ async function isHttpResponding(port, timeoutMs = 2e3) {
3632
+ try {
3633
+ await fetch(`http://127.0.0.1:${port}/`, { signal: AbortSignal.timeout(timeoutMs) });
3634
+ return true;
3635
+ } catch {
3636
+ return false;
3637
+ }
3638
+ }
3610
3639
  function isPortListening(port, host, timeoutMs = 500) {
3611
3640
  const target2 = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host;
3612
3641
  return new Promise((resolve23) => {
@@ -3630,28 +3659,6 @@ async function waitForPortListening(port, host, timeoutMs, signal) {
3630
3659
  }
3631
3660
  return false;
3632
3661
  }
3633
- async function assertReusableDevServer(port, waitMs = 15e3) {
3634
- if (!await isPortListening(port, "127.0.0.1")) return;
3635
- if (await isHttpResponding(port)) return;
3636
- const deadline = Date.now() + waitMs;
3637
- while (Date.now() < deadline) {
3638
- if (!await isPortListening(port, "127.0.0.1")) return;
3639
- await new Promise((resolve23) => setTimeout(resolve23, 500));
3640
- }
3641
- throw new Refusal(
3642
- `Port ${port} is held by a server that no longer answers HTTP \u2014 likely a previous run's dev server still shutting down. Waited ${Math.round(waitMs / 1e3)}s for it to exit. Stop it (\`deepspace dev kill\`) or pass --port <other>, then re-run.`,
3643
- "port_in_use",
3644
- { extra: { port } }
3645
- );
3646
- }
3647
- async function isHttpResponding(port, timeoutMs = 2e3) {
3648
- try {
3649
- await fetch(`http://127.0.0.1:${port}/`, { signal: AbortSignal.timeout(timeoutMs) });
3650
- return true;
3651
- } catch {
3652
- return false;
3653
- }
3654
- }
3655
3662
  function resolvePort(arg) {
3656
3663
  const raw = arg ?? process.env.DEEPSPACE_PORT;
3657
3664
  if (!raw) return DEFAULT_PORT;
@@ -3806,16 +3813,11 @@ var dev_default = defineDeepspaceCommand({
3806
3813
  });
3807
3814
  const wranglerConfig = prepareWranglerEnvConfig(appDir, wranglerEnv);
3808
3815
  preflightWindowsWorkerd(appDir);
3809
- if (await isPortListening(port, host)) {
3810
- const killArgv = port === DEFAULT_PORT ? ["deepspace", "dev", "kill"] : ["deepspace", "dev", "kill", "--port", String(port)];
3811
- const killCmd = killArgv.join(" ");
3816
+ try {
3817
+ await ensurePortFree(port, host);
3818
+ } catch (err) {
3812
3819
  wranglerConfig.cleanup();
3813
- throw new Refusal(
3814
- `Port ${port} is already in use.
3815
- Free it with \`${killCmd}\`, or start on another port: \`deepspace dev start --port <other>\`.`,
3816
- "port_in_use",
3817
- { extra: { port } }
3818
- );
3820
+ throw err;
3819
3821
  }
3820
3822
  const url = `http://${host === DEFAULT_DEV_HOST ? "localhost" : host}:${port}`;
3821
3823
  say("Starting dev server...\n");
@@ -4478,6 +4480,7 @@ var test_default = defineDeepspaceCommand({
4478
4480
  const configuredPort = Boolean(args.port) || Boolean(process.env.DEEPSPACE_PORT);
4479
4481
  const worktreePort = configuredPort ? null : resolveWorktreePort(appDir);
4480
4482
  const port = worktreePort ?? resolvePort(args.port);
4483
+ if (suite !== "unit") await ensurePortFree(port, "0.0.0.0");
4481
4484
  let token;
4482
4485
  let ownerId;
4483
4486
  try {
@@ -4530,7 +4533,6 @@ var test_default = defineDeepspaceCommand({
4530
4533
  if (suite !== "unit") {
4531
4534
  preflightWindowsWorkerd(appDir);
4532
4535
  ensurePlaywright(appDir);
4533
- await assertReusableDevServer(port);
4534
4536
  }
4535
4537
  let exitCode = 0;
4536
4538
  let skippedSpecs = [];
@@ -4546,7 +4548,9 @@ var test_default = defineDeepspaceCommand({
4546
4548
  break;
4547
4549
  case "unit":
4548
4550
  if (forwarded.grep || forwarded.project || forwarded.headed) {
4549
- console.error("note: --grep/--project/--headed apply to Playwright suites and are ignored by `unit`");
4551
+ console.error(
4552
+ "note: --grep/--project/--headed apply to Playwright suites and are ignored by `unit`"
4553
+ );
4550
4554
  }
4551
4555
  exitCode = runVitest(appDir, wranglerEnv);
4552
4556
  break;
@@ -4616,6 +4620,18 @@ function runVitest(appDir, wranglerEnv) {
4616
4620
  // src/cli/commands/screenshot.ts
4617
4621
  import { sync as spawnSync6 } from "cross-spawn";
4618
4622
  import { resolve as resolve11 } from "path";
4623
+ var DEFAULT_SCREENSHOT_WAIT_MS = 1e3;
4624
+ function normalizeWaitTimeout(value) {
4625
+ if (value === void 0) return DEFAULT_SCREENSHOT_WAIT_MS;
4626
+ const text2 = String(value).trim();
4627
+ if (!/^\d+$/.test(text2) || !Number.isSafeInteger(Number(text2))) {
4628
+ throw new Refusal(
4629
+ "Screenshot wait timeout must be a non-negative whole number of milliseconds.",
4630
+ "invalid_wait_timeout"
4631
+ );
4632
+ }
4633
+ return Number(text2);
4634
+ }
4619
4635
  function normalizeViewportSize(value) {
4620
4636
  if (value === void 0) return void 0;
4621
4637
  const match = /^(\d+)\s*[x,]\s*(\d+)$/i.exec(String(value).trim());
@@ -4657,25 +4673,32 @@ var screenshot_default = defineDeepspaceCommand({
4657
4673
  },
4658
4674
  "wait-for-timeout": {
4659
4675
  type: "string",
4660
- description: "Milliseconds to wait before capture",
4676
+ description: `Milliseconds to settle before capture (default ${DEFAULT_SCREENSHOT_WAIT_MS}, 0 disables)`,
4677
+ required: false
4678
+ },
4679
+ "wait-for-selector": {
4680
+ type: "string",
4681
+ description: "Visible selector to await before capture (off by default)",
4661
4682
  required: false
4662
4683
  }
4663
4684
  },
4664
4685
  async run({ args }) {
4686
+ routeChildStdoutToStderr(args.json === true);
4665
4687
  const viewport = normalizeViewportSize(args.viewport);
4688
+ const waitForTimeout = normalizeWaitTimeout(args["wait-for-timeout"]);
4666
4689
  const appDir = resolve11(".");
4667
4690
  ensurePlaywright(appDir);
4668
4691
  const url = String(args.url);
4669
4692
  const output = String(args.output);
4670
4693
  const playwrightArgs = ["playwright", "screenshot", url, output];
4694
+ const waitForSelector = args["wait-for-selector"] === void 0 ? "" : String(args["wait-for-selector"]);
4671
4695
  if (args["full-page"]) playwrightArgs.push("--full-page");
4672
4696
  if (viewport) playwrightArgs.push("--viewport-size", viewport);
4673
- if (args["wait-for-timeout"] !== void 0) {
4674
- playwrightArgs.push("--wait-for-timeout", String(args["wait-for-timeout"]));
4675
- }
4697
+ if (waitForSelector) playwrightArgs.push("--wait-for-selector", waitForSelector);
4698
+ if (waitForTimeout !== 0) playwrightArgs.push("--wait-for-timeout", String(waitForTimeout));
4676
4699
  const result = spawnSync6("npx", playwrightArgs, {
4677
4700
  cwd: appDir,
4678
- stdio: "inherit"
4701
+ stdio: childStdio()
4679
4702
  });
4680
4703
  if (result.status !== 0) {
4681
4704
  throw new Refusal(
@@ -4684,7 +4707,14 @@ var screenshot_default = defineDeepspaceCommand({
4684
4707
  );
4685
4708
  }
4686
4709
  return {
4687
- data: { url, output, fullPage: Boolean(args["full-page"]), viewport: viewport ?? null }
4710
+ data: {
4711
+ url,
4712
+ output,
4713
+ fullPage: Boolean(args["full-page"]),
4714
+ viewport: viewport ?? null,
4715
+ waitForSelector: waitForSelector || null,
4716
+ waitForTimeout
4717
+ }
4688
4718
  };
4689
4719
  }
4690
4720
  });
@@ -7299,6 +7329,7 @@ var deploy_default = defineCommand3({
7299
7329
  },
7300
7330
  async run({ args }) {
7301
7331
  const output = createDeployOutput(args.json === true);
7332
+ setPlainProgress(output.json);
7302
7333
  try {
7303
7334
  await runDeploy(args, output);
7304
7335
  } catch (error) {
@@ -8169,6 +8200,8 @@ function formatDate(iso) {
8169
8200
  function renderSummary(summary) {
8170
8201
  const { credits, usageByIntegration } = summary;
8171
8202
  const lines = [];
8203
+ lines.push("Account usage (all apps)");
8204
+ lines.push("");
8172
8205
  const renews = credits.subscription.renewsAt ? ` \xB7 renews ${formatDate(credits.subscription.renewsAt)}` : "";
8173
8206
  lines.push(`Plan: ${credits.subscription.tier}${renews}`);
8174
8207
  lines.push(
@@ -8197,7 +8230,9 @@ function renderSummary(summary) {
8197
8230
  const nameWidth = Math.max(11, ...usageByIntegration.map((u) => u.name.length));
8198
8231
  lines.push(`${"INTEGRATION".padEnd(nameWidth)} CALLS COST`);
8199
8232
  for (const u of usageByIntegration) {
8200
- lines.push(`${u.name.padEnd(nameWidth)} ${String(u.count).padEnd(5)} ${formatUsd(u.totalCost)}`);
8233
+ lines.push(
8234
+ `${u.name.padEnd(nameWidth)} ${String(u.count).padEnd(5)} ${formatUsd(u.totalCost)}`
8235
+ );
8201
8236
  }
8202
8237
  }
8203
8238
  lines.push("");
@@ -8207,13 +8242,13 @@ function renderSummary(summary) {
8207
8242
  var usage_default = defineDeepspaceCommand({
8208
8243
  meta: {
8209
8244
  name: "usage",
8210
- description: "Show credit balance, quota headroom, and per-integration spend"
8245
+ description: "Show account-wide credits and integration spend (all apps)"
8211
8246
  },
8212
8247
  async run({ args }) {
8213
8248
  const token = await ensureToken();
8214
8249
  const summary = await apiFetch(API_URL3, token, "/api/usage/summary");
8215
8250
  if (!args.json) console.log(renderSummary(summary));
8216
- return { data: { ...summary } };
8251
+ return { data: { scope: "account", ...summary } };
8217
8252
  }
8218
8253
  });
8219
8254
 
@@ -15070,7 +15105,7 @@ import { join as join28, resolve as resolve22 } from "path";
15070
15105
  // package.json
15071
15106
  var package_default = {
15072
15107
  name: "deepspace",
15073
- version: "0.26.0",
15108
+ version: "0.26.1",
15074
15109
  engines: {
15075
15110
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
15076
15111
  },