@acryldev/blends-frame 0.1.6 → 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.
- package/README.md +4 -4
- package/cordis.patch.yml +1 -1
- package/lib/app-plugins.d.ts +1 -1
- package/lib/auto-save.d.ts +1 -1
- package/lib/client.js +65 -44
- package/lib/client.js.map +1 -1
- package/lib/git-sync.d.ts +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +23 -23
- package/lib/index.js.map +1 -1
- package/lib/types/client/SettingsLauncher.d.ts +1 -1
- package/lib/types/client/canvas/app-canvas.d.ts +1 -1
- package/lib/types/client/chat-draft.d.ts +1 -1
- package/lib/types/client/chats.d.ts +1 -1
- package/lib/types/client/desktop-app.d.ts +1 -1
- package/lib/types/client/frame-state.d.ts +13 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/tools.d.ts +1 -1
- package/lib/types/client/versions.d.ts +1 -1
- package/package.json +21 -22
package/lib/git-sync.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Push and pull run one at a time: a second click waits for the first to finish rather than racing it.
|
|
13
13
|
*/
|
|
14
14
|
import { type GitRemoteState, type GitSyncResult, type PushPlan } from './contract.ts';
|
|
15
|
-
/** The part of the confined git runner (
|
|
15
|
+
/** The part of the confined git runner (`@acryldev/versions`) this module uses: an argument array, never a shell. */
|
|
16
16
|
export interface SyncGit {
|
|
17
17
|
run(args: readonly string[], cwd: string, acceptExit?: number, timeoutMs?: number): Promise<{
|
|
18
18
|
readonly stdout: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* and its local branches. The frame itself is the client half (`./client`).
|
|
4
4
|
*
|
|
5
5
|
* One effect owns the confined git runner and both registrations; disposal unmounts the route and reaps any git call still running. The right
|
|
6
|
-
* panel's terminals, PTY agents, files and git are the workspace's own Host services (
|
|
6
|
+
* panel's terminals, PTY agents, files and git are the workspace's own Host services (`@acryldev/workspace`), run here as a child plugin: only its
|
|
7
7
|
* Host half, since the frame, not the workbench, owns the page.
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
10
|
-
import { Acryl } from '
|
|
10
|
+
import { Acryl } from '@acryldev/blends';
|
|
11
11
|
import { GitRunner, Versions } from '@acryldev/versions';
|
|
12
12
|
import { type ShareAppPluginResult } from './app-plugins.ts';
|
|
13
13
|
import { type GraphPort } from './plugin-graph.ts';
|
|
@@ -38,7 +38,7 @@ export interface FrameConfig {
|
|
|
38
38
|
*/
|
|
39
39
|
readonly shareOwner?: string;
|
|
40
40
|
}
|
|
41
|
-
export declare const name = "
|
|
41
|
+
export declare const name = "acryl-blends-frame";
|
|
42
42
|
export declare const inject: string[];
|
|
43
43
|
/** `git for-each-ref` lines `<current marker> <name>`: the checked-out branch first, the rest by name. */
|
|
44
44
|
export declare function parseBranches(stdout: string): FrameBranch[];
|
package/lib/index.js
CHANGED
|
@@ -4,15 +4,15 @@ import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
5
5
|
import { mkdir, readFile, readdir, rename, writeFile } from "node:fs/promises";
|
|
6
6
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
|
-
import { Acryl } from "
|
|
7
|
+
import { Acryl } from "@acryldev/blends";
|
|
8
8
|
import { error } from "@acryldev/loopback-http";
|
|
9
9
|
import { INVALID_JSON, jsonBody, ownPage, privateApi, readJson } from "@acryldev/loopback-http/router";
|
|
10
|
-
import { PluginStore, StoreConflictError, bumpVersion, gitCli, githubCli, parseVersion, savePlugin, sharePlugin, storeRootOf } from "@
|
|
10
|
+
import { PluginStore, StoreConflictError, bumpVersion, gitCli, githubCli, parseVersion, savePlugin, sharePlugin, storeRootOf } from "@acryldev/plugin-hub-core";
|
|
11
11
|
import { GitRunner, Versions } from "@acryldev/versions";
|
|
12
12
|
import * as workspaceHost from "@acryldev/workspace";
|
|
13
13
|
import { promisify } from "node:util";
|
|
14
14
|
import { pathToFileURL } from "node:url";
|
|
15
|
-
import { digestFolder } from "@
|
|
15
|
+
import { digestFolder } from "@acryldev/blends-core";
|
|
16
16
|
import { parseDocument } from "yaml";
|
|
17
17
|
import { boundContextSummary, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
18
18
|
import { randomBytes } from "node:crypto";
|
|
@@ -506,8 +506,8 @@ async function switchAppPlugin(root, kind, name, on) {
|
|
|
506
506
|
}
|
|
507
507
|
/** The frame's own Loader rows the list shows: ACRYL's plugins around the app, not DSH's engine rows nor the rows that run the app. */
|
|
508
508
|
function isFramePlugin(moduleName, entryId) {
|
|
509
|
-
if (entryId.startsWith("app-") || entryId === "
|
|
510
|
-
return moduleName.startsWith("
|
|
509
|
+
if (entryId.startsWith("app-") || entryId === "@acryldev/door") return false;
|
|
510
|
+
return moduleName.startsWith("@acryldev/");
|
|
511
511
|
}
|
|
512
512
|
/** Cordis `FiberState`: PENDING 0, LOADING 1, ACTIVE 2, FAILED 3. */
|
|
513
513
|
function frameRowState(row) {
|
|
@@ -1398,7 +1398,7 @@ function pluginShareOf(service) {
|
|
|
1398
1398
|
*
|
|
1399
1399
|
* The turn-end signal is DSH's own: its `workspace-changes` plugin diffs the working tree around every turn (the person's earlier unsaved edits never
|
|
1400
1400
|
* enter a turn's list) and appends a `workspace/changes` session event only when files changed, so a turn that changed nothing makes no version here.
|
|
1401
|
-
* The Host hears that event on `session/event`, reads the turn's file list from `ctx.workspaceChanges.summary`, and saves through
|
|
1401
|
+
* The Host hears that event on `session/event`, reads the turn's file list from `ctx.workspaceChanges.summary`, and saves through `@acryldev/versions`.
|
|
1402
1402
|
*/
|
|
1403
1403
|
/** The longest a version's name is, in characters, before it is cut at a word. */
|
|
1404
1404
|
const SUBJECT_LIMIT = 50;
|
|
@@ -2079,7 +2079,7 @@ function guardOutwardCommands(events, report) {
|
|
|
2079
2079
|
if (decided.kind === "deny" || decided.kind === "cancel") return decided;
|
|
2080
2080
|
const needs = outwardApproval(exec);
|
|
2081
2081
|
if (needs === void 0) return decided;
|
|
2082
|
-
report(
|
|
2082
|
+
report(`@acryldev/blends-frame: asked the person before ${needs.action}`);
|
|
2083
2083
|
return {
|
|
2084
2084
|
kind: "ask",
|
|
2085
2085
|
reason: `outward: ${needs.action}`,
|
|
@@ -2297,7 +2297,7 @@ function stopsHost(exec, host) {
|
|
|
2297
2297
|
const { command } = parsed(exec.arguments);
|
|
2298
2298
|
if (typeof command !== "string" || !/\b(?:kill|pkill|killall|Stop-Process|taskkill)\b/iu.test(command)) return false;
|
|
2299
2299
|
const named = host.hostPort === void 0 ? String(host.hostPid) : `${String(host.hostPid)}|${String(host.hostPort)}`;
|
|
2300
|
-
if (new RegExp(`\\b(?:${named})\\b|ide-host
|
|
2300
|
+
if (new RegExp(`\\b(?:${named})\\b|ide-host|@acryldev/node-server`, "iu").test(command)) return true;
|
|
2301
2301
|
for (const invocation of killInvocations(command)) {
|
|
2302
2302
|
if (invocation.verb === "kill" && killTargets(invocation.args, host)) return true;
|
|
2303
2303
|
if (invocation.verb === "pkill" && pkillTargets(invocation.args, host)) return true;
|
|
@@ -2709,7 +2709,7 @@ function createBranchChatsStore(path) {
|
|
|
2709
2709
|
*
|
|
2710
2710
|
* Push and pull run one at a time: a second click waits for the first to finish rather than racing it.
|
|
2711
2711
|
*/
|
|
2712
|
-
/** A fetch or push talks to another machine: as long as the versions' own push (
|
|
2712
|
+
/** A fetch or push talks to another machine: as long as the versions' own push (`@acryldev/versions`). */
|
|
2713
2713
|
const REMOTE_TIMEOUT_MS = 12e4;
|
|
2714
2714
|
/** git's own line for a failure, else the fallback: what a person reads in the Git tab. */
|
|
2715
2715
|
function reason(cause, fallback) {
|
|
@@ -3157,7 +3157,7 @@ var GithubConnect = class {
|
|
|
3157
3157
|
/**
|
|
3158
3158
|
* The app's snapshot verbs as the frame's service `appSnapshot`: every version the frame saves (Save point, the auto-save) is captured first, so
|
|
3159
3159
|
* a version is always a snapshot whose `blend.yaml` names every plugin folder and whose lock matches; the agent's snapshot tools
|
|
3160
|
-
* (
|
|
3160
|
+
* (@acryldev/app-context) run on it too, the same code as `npm run snapshot`. The verbs are the app's own (`plugins/manifest/snapshot.ts`, part of the app's
|
|
3161
3161
|
* folder), so the frame runs the version the app was made with; an app made before them says so instead of guessing. Pushing and pulling are
|
|
3162
3162
|
* not here: they are the person's (the Git tab and the versions header, ./git-sync.ts), and a push sends only a plan they confirmed.
|
|
3163
3163
|
*/
|
|
@@ -3218,10 +3218,10 @@ function createAppSnapshot(root, remote, load = () => loadSnapshotVerbs(root)) {
|
|
|
3218
3218
|
* and its local branches. The frame itself is the client half (`./client`).
|
|
3219
3219
|
*
|
|
3220
3220
|
* One effect owns the confined git runner and both registrations; disposal unmounts the route and reaps any git call still running. The right
|
|
3221
|
-
* panel's terminals, PTY agents, files and git are the workspace's own Host services (
|
|
3221
|
+
* panel's terminals, PTY agents, files and git are the workspace's own Host services (`@acryldev/workspace`), run here as a child plugin: only its
|
|
3222
3222
|
* Host half, since the frame, not the workbench, owns the page.
|
|
3223
3223
|
*/
|
|
3224
|
-
const name = "
|
|
3224
|
+
const name = "acryl-blends-frame";
|
|
3225
3225
|
const inject = [
|
|
3226
3226
|
"router",
|
|
3227
3227
|
"routerHttp",
|
|
@@ -3802,7 +3802,7 @@ function apply(ctx, config = {}) {
|
|
|
3802
3802
|
const shareOwner = typeof wantedOwner === "string" && /^[A-Za-z0-9-]+$/u.test(wantedOwner) ? wantedOwner : void 0;
|
|
3803
3803
|
const shareTo = shareOwner === void 0 ? {} : { owner: shareOwner };
|
|
3804
3804
|
const root = ctx.appInstance.root;
|
|
3805
|
-
if (typeof root !== "string") throw new Error("
|
|
3805
|
+
if (typeof root !== "string") throw new Error("@acryldev/blends-frame: the app instance has no app folder (root)");
|
|
3806
3806
|
const appBase = appPage === void 0 ? void 0 : appPage.replace(/\/+$/u, "");
|
|
3807
3807
|
if (appBase !== void 0 && appBase !== "" && appBase !== "/") {
|
|
3808
3808
|
ctx.inject(["nodeServer"], (child) => {
|
|
@@ -3817,7 +3817,7 @@ function apply(ctx, config = {}) {
|
|
|
3817
3817
|
});
|
|
3818
3818
|
if (appFallbackTarget(appBase, url, request.headers) === void 0) return void 0;
|
|
3819
3819
|
return server.throughRouter(request, connection);
|
|
3820
|
-
}), "
|
|
3820
|
+
}), "@acryldev/blends-frame: an app page's URLs under the canvas prefix");
|
|
3821
3821
|
});
|
|
3822
3822
|
ctx.effect(() => ctx.router.wrap(async (c, next) => {
|
|
3823
3823
|
const url = new URL(c.req.url);
|
|
@@ -3832,21 +3832,21 @@ function apply(ctx, config = {}) {
|
|
|
3832
3832
|
};
|
|
3833
3833
|
if (copy !== void 0) init.body = await copy.arrayBuffer();
|
|
3834
3834
|
c.res = await ctx.router.fetch(new Request(new URL(target, url.origin), init), c.env?.connection ?? {});
|
|
3835
|
-
}), "
|
|
3835
|
+
}), "@acryldev/blends-frame: app requests under the canvas prefix");
|
|
3836
3836
|
}
|
|
3837
3837
|
ctx.plugin(workspaceHost, appPage === void 0 ? {} : { appPage });
|
|
3838
3838
|
ctx.inject(["workspaceController"], (child) => {
|
|
3839
3839
|
const workspaces = child.workspaceController;
|
|
3840
3840
|
child.effect(() => {
|
|
3841
3841
|
workspaces.create({ path: root }).catch((cause) => {
|
|
3842
|
-
child.logger.error(
|
|
3842
|
+
child.logger.error(`@acryldev/blends-frame: the app folder could not be made a workspace: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
3843
3843
|
});
|
|
3844
3844
|
return () => {};
|
|
3845
|
-
}, "
|
|
3845
|
+
}, "@acryldev/blends-frame: the chat works in the app folder");
|
|
3846
3846
|
});
|
|
3847
3847
|
ctx.effect(() => {
|
|
3848
3848
|
const report = (cause) => {
|
|
3849
|
-
ctx.logger.error(
|
|
3849
|
+
ctx.logger.error(`@acryldev/blends-frame: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
3850
3850
|
};
|
|
3851
3851
|
const git = new GitRunner();
|
|
3852
3852
|
const chatsFile = createBranchChatsStore(branchChatsFile(ctx.appInstance.home));
|
|
@@ -3880,7 +3880,7 @@ function apply(ctx, config = {}) {
|
|
|
3880
3880
|
const githubConnect = new GithubConnect(githubConnectPorts());
|
|
3881
3881
|
ctx.effect(() => () => {
|
|
3882
3882
|
githubConnect.dispose();
|
|
3883
|
-
}, "
|
|
3883
|
+
}, "@acryldev/blends-frame: connecting GitHub");
|
|
3884
3884
|
const plugins = {
|
|
3885
3885
|
read: async () => {
|
|
3886
3886
|
const [app, frame] = await Promise.all([readAppPlugins(root, git, join(ctx.appInstance.home, "shared-plugins.json"), ghRepositoryCheck, storeRootOf(ctx.appInstance.home)), readFramePlugins(root, frameRows())]);
|
|
@@ -3986,13 +3986,13 @@ function apply(ctx, config = {}) {
|
|
|
3986
3986
|
};
|
|
3987
3987
|
const selectionInbox = new SelectionInbox();
|
|
3988
3988
|
ctx.effect(() => installSelectionContext(ctx, selectionInbox, (cause) => {
|
|
3989
|
-
ctx.logger.error(
|
|
3990
|
-
}), "
|
|
3989
|
+
ctx.logger.error(`@acryldev/blends-frame: the selected element did not reach the chat: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
3990
|
+
}), "@acryldev/blends-frame: the picked element as context");
|
|
3991
3991
|
ctx.router.route("/", frameRoutes({
|
|
3992
3992
|
state,
|
|
3993
3993
|
selection: selectionInbox,
|
|
3994
3994
|
report: (cause) => {
|
|
3995
|
-
ctx.logger.error(
|
|
3995
|
+
ctx.logger.error(`@acryldev/blends-frame: request failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
3996
3996
|
},
|
|
3997
3997
|
plugins,
|
|
3998
3998
|
graph: graph.port,
|
|
@@ -4053,7 +4053,7 @@ function apply(ctx, config = {}) {
|
|
|
4053
4053
|
stopWatching();
|
|
4054
4054
|
autoSave.settled().then(() => git.dispose());
|
|
4055
4055
|
};
|
|
4056
|
-
}, "
|
|
4056
|
+
}, "@acryldev/blends-frame: git runner and state route");
|
|
4057
4057
|
}
|
|
4058
4058
|
export { AutoSave, FRAME_API_PREFIX, FRAME_STATE_PATH, SaveStore, appRowsOf, apply, countChanges, feedbackPort, frameRoutes, inject, messageText, name, parseBranchName, parseBranches, parseFrameState, requestSubject, saveVersion, sharedVersions };
|
|
4059
4059
|
|