@acryldev/workspace 0.1.1 → 0.2.0

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.
@@ -1,5 +1,5 @@
1
1
  /** The worktree file routes: two reads and two changes, for the app's own page only. */
2
- import { Acryl } from 'acrylblends';
2
+ import { Acryl } from '@acryldev/blends';
3
3
  import { type ReportError } from '../private-route.ts';
4
4
  import { type WorkspaceFiles } from './service.ts';
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Opens the operating system's own folder chooser and reports the folder picked. The Host serves a
3
- * loopback-only Web server (`acryl-workspace` refuses to start otherwise), so a dialog raised here is on
3
+ * loopback-only Web server (`@acryldev/workspace` refuses to start otherwise), so a dialog raised here is on
4
4
  * the same machine as the person using the page - the reason this is safe to offer at all, unlike a
5
5
  * chooser on a remote server nobody is sitting at.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  /** The native folder chooser, for the app's own page only. */
2
- import { Acryl } from 'acrylblends';
2
+ import { Acryl } from '@acryldev/blends';
3
3
  import { type ReportError } from '../private-route.ts';
4
4
  /** POST: open the OS's chooser and answer the folder, or `null` when it was cancelled. */
5
5
  export declare function pickFolderRoutes(pick: () => Promise<string | null>, reportError: ReportError): Acryl;
@@ -1,5 +1,5 @@
1
1
  /** The workspace git routes: five reads, and the writes the Changes panel makes (worktree, stage, unstage, commit), for the app's own page only. */
2
- import { Acryl } from 'acrylblends';
2
+ import { Acryl } from '@acryldev/blends';
3
3
  import { type ReportError } from '../private-route.ts';
4
4
  import { type WorkspaceGit } from './service.ts';
5
5
  /**
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** Cordis Host plugin: ACRYL Workspace PTY table and loopback routes. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  /** Stable Cordis plugin name. */
4
- export declare const name = "@acryldev/workspace";
4
+ export declare const name = "acryl-workspace";
5
5
  /**
6
6
  * The part of the runtime's `appInstance` service ACRYL plugins read (a separated interface: plugins do not import the runtime). Every plugin declares
7
7
  * exactly this shape, so the Context augmentations agree in any program that loads several of them.
package/lib/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { randomBytes, randomUUID } from "node:crypto";
2
2
  import { basename, dirname, isAbsolute, join, normalize, resolve, sep } from "node:path";
3
- import { Acryl } from "acrylblends";
3
+ import { Acryl } from "@acryldev/blends";
4
4
  import { INVALID_JSON, jsonBody, ownPage, ownPageSocket, privateApi, readJson } from "@acryldev/loopback-http/router";
5
5
  import { chmod, lstat, mkdir, readFile, readdir, realpath, rename, rmdir, stat, unlink, writeFile } from "node:fs/promises";
6
- import { bearerAuth } from "acrylblends/bearer-auth";
7
- import { loopbackOnly } from "acrylblends/loopback-only";
6
+ import { bearerAuth } from "@acryldev/blends/bearer-auth";
7
+ import { loopbackOnly } from "@acryldev/blends/loopback-only";
8
8
  import { execFile, spawn } from "node:child_process";
9
9
  import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
10
10
  import z from "@deepseek-ai/schemastery";
11
- import { streamSSE } from "acrylblends/streaming";
11
+ import { streamSSE } from "@acryldev/blends/streaming";
12
12
  import { defineAcrylTool } from "@acryldev/control";
13
13
  import { spawn as spawn$1 } from "node-pty";
14
14
  import { homedir } from "node:os";
15
15
  import serializeModule from "@xterm/addon-serialize";
16
16
  import headlessModule from "@xterm/headless";
17
- import { bodyLimit } from "acrylblends/body-limit";
17
+ import { bodyLimit } from "@acryldev/blends/body-limit";
18
18
  //#region src/private-route.ts
19
19
  /** Every workspace route lives below this path; it is the one prefix the plugin mounts on the Web server. */
20
20
  const WORKSPACE_API_PREFIX = "/api/acryl-workspace";
@@ -1021,7 +1021,7 @@ function filesRoutes(files, reportError) {
1021
1021
  //#region src/folder-picker/picker.ts
1022
1022
  /**
1023
1023
  * Opens the operating system's own folder chooser and reports the folder picked. The Host serves a
1024
- * loopback-only Web server (`acryl-workspace` refuses to start otherwise), so a dialog raised here is on
1024
+ * loopback-only Web server (`@acryldev/workspace` refuses to start otherwise), so a dialog raised here is on
1025
1025
  * the same machine as the person using the page - the reason this is safe to offer at all, unlike a
1026
1026
  * chooser on a remote server nobody is sitting at.
1027
1027
  */
@@ -1982,7 +1982,7 @@ function gitRoutes(git, reportError) {
1982
1982
  //#region src/projects/contract.ts
1983
1983
  /**
1984
1984
  * The project registry's wire contract. A project is a folder the user added to ACRYL; ACRYL owns the list (it lives in the ACRYL home through
1985
- * `acryl-settings`), and the DeepSeek Harness chat's workspaces follow it one way: a chat registers the folder it runs in when it starts, never the other
1985
+ * `@acryldev/settings`), and the DeepSeek Harness chat's workspaces follow it one way: a chat registers the folder it runs in when it starts, never the other
1986
1986
  * way round.
1987
1987
  */
1988
1988
  const WORKSPACE_PROJECTS_PATH = "/api/acryl-workspace/projects";
@@ -2084,7 +2084,7 @@ function remoteOf(value) {
2084
2084
  //#endregion
2085
2085
  //#region src/projects/registry.ts
2086
2086
  /**
2087
- * The project registry: the folders the user added, grouped into workspaces (spec 043), in one `acryl-settings` section, changed one write at a time.
2087
+ * The project registry: the folders the user added, grouped into workspaces (spec 043), in one `@acryldev/settings` section, changed one write at a time.
2088
2088
  * A workspace is a named set of projects the sidebar shows as a whole; Default always exists and starts with every project added before workspaces
2089
2089
  * existed. A project can be in several workspaces; removing it from one never touches the others or the disk.
2090
2090
  */
@@ -2946,14 +2946,14 @@ var WorkspacePtyRegistry = class {
2946
2946
  command: known.command,
2947
2947
  args: []
2948
2948
  });
2949
- if (commandId !== "shell" && agentPlan === void 0) throw new Error("acryl-workspace: unknown workspace PTY command");
2950
- if (cwd !== void 0 && !isExistingAbsoluteDirectory(cwd)) throw new Error("acryl-workspace: workspace PTY cwd must be an existing absolute directory");
2949
+ if (commandId !== "shell" && agentPlan === void 0) throw new Error("@acryldev/workspace: unknown workspace PTY command");
2950
+ if (cwd !== void 0 && !isExistingAbsoluteDirectory(cwd)) throw new Error("@acryldev/workspace: workspace PTY cwd must be an existing absolute directory");
2951
2951
  const cols = size?.cols ?? DEFAULT_COLS;
2952
2952
  const rows = size?.rows ?? DEFAULT_ROWS;
2953
- if (!Number.isInteger(cols) || !Number.isInteger(rows) || cols < 2 || cols > 500 || rows < 1 || rows > 200) throw new Error("acryl-workspace: workspace PTY size is out of range");
2953
+ if (!Number.isInteger(cols) || !Number.isInteger(rows) || cols < 2 || cols > 500 || rows < 1 || rows > 200) throw new Error("@acryldev/workspace: workspace PTY size is out of range");
2954
2954
  const plan = agentPlan ?? planWorkspacePtyCommand("shell", this.platform, this.env);
2955
2955
  const dirs = await this.spawnDirs;
2956
- if (this.disposed) throw new Error("acryl-workspace: workspace PTY registry is disposed");
2956
+ if (this.disposed) throw new Error("@acryldev/workspace: workspace PTY registry is disposed");
2957
2957
  const id = this.createId();
2958
2958
  let process;
2959
2959
  try {
@@ -2984,7 +2984,7 @@ var WorkspacePtyRegistry = class {
2984
2984
  rows
2985
2985
  });
2986
2986
  } catch (cause) {
2987
- throw new Error(`acryl-workspace: workspace PTY spawn failed: ${cause instanceof Error ? cause.message : String(cause)}`);
2987
+ throw new Error(`@acryldev/workspace: workspace PTY spawn failed: ${cause instanceof Error ? cause.message : String(cause)}`);
2988
2988
  }
2989
2989
  const subscriptions = [];
2990
2990
  const session = {
@@ -3039,7 +3039,7 @@ var WorkspacePtyRegistry = class {
3039
3039
  /** Write exact terminal input bytes. */
3040
3040
  write(id, data) {
3041
3041
  const session = this.require(id);
3042
- if (session.status !== "running") throw new Error("acryl-workspace: workspace PTY is not running");
3042
+ if (session.status !== "running") throw new Error("@acryldev/workspace: workspace PTY is not running");
3043
3043
  session.process.write(data);
3044
3044
  }
3045
3045
  /** Resize one live terminal. */
@@ -3106,7 +3106,7 @@ var WorkspacePtyRegistry = class {
3106
3106
  }
3107
3107
  require(id) {
3108
3108
  const session = this.sessions.get(id);
3109
- if (session === void 0) throw new Error("acryl-workspace: unknown workspace PTY session");
3109
+ if (session === void 0) throw new Error("@acryldev/workspace: unknown workspace PTY session");
3110
3110
  return session;
3111
3111
  }
3112
3112
  view(session) {
@@ -3655,7 +3655,7 @@ function registerContextTool(ctx, deps) {
3655
3655
  //#region src/index.ts
3656
3656
  /** Cordis Host plugin: ACRYL Workspace PTY table and loopback routes. */
3657
3657
  /** Stable Cordis plugin name. */
3658
- const name = "@acryldev/workspace";
3658
+ const name = "acryl-workspace";
3659
3659
  /**
3660
3660
  * The routes, the terminal's WebSocket among them, are served by the router (`router`, `routerHttp`) under {@link WORKSPACE_API_PREFIX}. The
3661
3661
  * loopback Web server is still needed for its address (agent hooks report to it). The app instance says where this app keeps its data.
@@ -3672,11 +3672,11 @@ const inject = [
3672
3672
  * @param ctx - Host context for this generation.
3673
3673
  */
3674
3674
  function apply(ctx, config = {}) {
3675
- if (ctx.acrylWeb.host !== "127.0.0.1") throw new Error("acryl-workspace: requires a loopback Web server");
3675
+ if (ctx.acrylWeb.host !== "127.0.0.1") throw new Error("@acryldev/workspace: requires a loopback Web server");
3676
3676
  const appPage = typeof config.appPage === "string" && config.appPage.startsWith("/") ? config.appPage : void 0;
3677
3677
  const rendererOrigin = `http://127.0.0.1:${String(ctx.acrylWeb.port)}`;
3678
3678
  const reportHostError = (operation, cause) => {
3679
- ctx.logger.error(`acryl-workspace: failed to ${operation}: ${cause instanceof Error ? cause.message : String(cause)}`);
3679
+ ctx.logger.error(`@acryldev/workspace: failed to ${operation}: ${cause instanceof Error ? cause.message : String(cause)}`);
3680
3680
  };
3681
3681
  const built = {};
3682
3682
  ctx.effect(() => {
@@ -3733,7 +3733,7 @@ function apply(ctx, config = {}) {
3733
3733
  const contextFor = (folder) => sharedContext?.contextFor(folder);
3734
3734
  const chatContextFiber = ctx.inject(["systemPrompt"], (child) => {
3735
3735
  const systemPrompt = child.systemPrompt;
3736
- child.effect(() => registerChatContext(systemPrompt, contextFor), "acryl-workspace: shared workspace context for the chat");
3736
+ child.effect(() => registerChatContext(systemPrompt, contextFor), "@acryldev/workspace: shared workspace context for the chat");
3737
3737
  });
3738
3738
  releases.push(() => {
3739
3739
  chatContextFiber.dispose();
@@ -3742,13 +3742,13 @@ function apply(ctx, config = {}) {
3742
3742
  child.effect(() => registerContextTool(child, {
3743
3743
  view: () => projects.view(),
3744
3744
  promptFor: (id) => sharedContext?.promptFor(id)
3745
- }), "acryl-workspace: workspace context tool");
3745
+ }), "@acryldev/workspace: workspace context tool");
3746
3746
  });
3747
3747
  releases.push(() => {
3748
3748
  contextToolFiber.dispose();
3749
3749
  });
3750
3750
  const toolsFiber = ctx.inject(["acrylTools"], (child) => {
3751
- child.effect(() => registerWorkspaceTools(child, projects), "acryl-workspace: workspace agent tools");
3751
+ child.effect(() => registerWorkspaceTools(child, projects), "@acryldev/workspace: workspace agent tools");
3752
3752
  });
3753
3753
  releases.push(() => {
3754
3754
  toolsFiber.dispose();
@@ -3787,8 +3787,8 @@ function apply(ctx, config = {}) {
3787
3787
  for (const release of releases.reverse()) release();
3788
3788
  await Promise.all([workspacePty.disposeAll(), workspaceGit.dispose()]);
3789
3789
  };
3790
- }, "acryl-workspace: PTY table, git, files, projects and agents");
3791
- if (built.routes === void 0 || built.pty === void 0) throw new Error("acryl-workspace: the routes were not built");
3790
+ }, "@acryldev/workspace: PTY table, git, files, projects and agents");
3791
+ if (built.routes === void 0 || built.pty === void 0) throw new Error("@acryldev/workspace: the routes were not built");
3792
3792
  const upgrade = ctx.routerHttp.upgrades();
3793
3793
  ctx.router.route("/", privateApi$1(...built.routes, ptyStreamRoutes(built.pty, upgrade, reportHostError)));
3794
3794
  ctx.routerHttp.mount(WORKSPACE_API_PREFIX, { upgrade: [WORKSPACE_PTY_STREAM_PATH] });