@acryldev/blends-frame 0.2.12 → 0.2.13
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/lib/client.js +13 -2
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +5 -0
- package/lib/index.js +15 -5
- package/lib/index.js.map +1 -1
- package/lib/types/contract.d.ts +5 -0
- package/package.json +3 -3
package/lib/contract.d.ts
CHANGED
|
@@ -138,6 +138,11 @@ export interface FrameState {
|
|
|
138
138
|
readonly unsaved?: number;
|
|
139
139
|
/** The commit the checked-out branch's upstream points at, as last fetched or pushed; absent without one. A change means the shared marks changed. */
|
|
140
140
|
readonly upstreamHead?: string;
|
|
141
|
+
/** The Blend's own version (blend.yaml `metadata.version`) and the ACRYL Blends framework's it runs on; each absent when it cannot be read. */
|
|
142
|
+
readonly appVersions?: {
|
|
143
|
+
readonly blend?: string;
|
|
144
|
+
readonly framework?: string;
|
|
145
|
+
};
|
|
141
146
|
}
|
|
142
147
|
/** @throws an Error naming the field when the answer is not a frame state. */
|
|
143
148
|
export declare function parseFrameState(value: unknown): FrameState;
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { execFile, execFileSync, spawn } 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 { digestFolder, readAppVersions } from "@acryldev/blends-core";
|
|
7
8
|
import { Acryl } from "@acryldev/blends";
|
|
8
9
|
import { error } from "@acryldev/loopback-http";
|
|
9
10
|
import { INVALID_JSON, jsonBody, ownPage, privateApi, readJson } from "@acryldev/loopback-http/router";
|
|
@@ -12,7 +13,6 @@ import { GitRunner, Versions } from "@acryldev/versions";
|
|
|
12
13
|
import * as workspaceHost from "@acryldev/workspace";
|
|
13
14
|
import { promisify } from "node:util";
|
|
14
15
|
import { pathToFileURL } from "node:url";
|
|
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";
|
|
@@ -80,7 +80,7 @@ function isRecord$2(value) {
|
|
|
80
80
|
/** @throws an Error naming the field when the answer is not a frame state. */
|
|
81
81
|
function parseFrameState(value) {
|
|
82
82
|
if (!isRecord$2(value)) throw new Error("frame state: not an object");
|
|
83
|
-
const { appName, appRoot, appPage, branches, head, unsaved, upstreamHead } = value;
|
|
83
|
+
const { appName, appRoot, appPage, branches, head, unsaved, upstreamHead, appVersions } = value;
|
|
84
84
|
if (typeof appName !== "string" || appName === "") throw new Error("frame state: appName");
|
|
85
85
|
if (typeof appRoot !== "string" || appRoot === "") throw new Error("frame state: appRoot");
|
|
86
86
|
if (appPage !== void 0 && (typeof appPage !== "string" || !appPage.startsWith("/"))) throw new Error("frame state: appPage");
|
|
@@ -88,6 +88,7 @@ function parseFrameState(value) {
|
|
|
88
88
|
if (head !== void 0 && (typeof head !== "string" || head === "")) throw new Error("frame state: head");
|
|
89
89
|
if (unsaved !== void 0 && (typeof unsaved !== "number" || !Number.isInteger(unsaved) || unsaved < 0)) throw new Error("frame state: unsaved");
|
|
90
90
|
if (upstreamHead !== void 0 && (typeof upstreamHead !== "string" || upstreamHead === "")) throw new Error("frame state: upstreamHead");
|
|
91
|
+
if (appVersions !== void 0 && (!isRecord$2(appVersions) || [appVersions.blend, appVersions.framework].some((v) => v !== void 0 && typeof v !== "string"))) throw new Error("frame state: appVersions");
|
|
91
92
|
const parsed = branches.map((branch) => {
|
|
92
93
|
if (!isRecord$2(branch) || typeof branch.name !== "string" || typeof branch.current !== "boolean") throw new Error("frame state: branch");
|
|
93
94
|
return {
|
|
@@ -102,7 +103,8 @@ function parseFrameState(value) {
|
|
|
102
103
|
branches: parsed,
|
|
103
104
|
...head === void 0 ? {} : { head },
|
|
104
105
|
...unsaved === void 0 ? {} : { unsaved },
|
|
105
|
-
...upstreamHead === void 0 ? {} : { upstreamHead }
|
|
106
|
+
...upstreamHead === void 0 ? {} : { upstreamHead },
|
|
107
|
+
...appVersions === void 0 ? {} : { appVersions }
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
110
|
const FRAME_PLUGINS_PATH = `${FRAME_API_PREFIX}/plugins`;
|
|
@@ -4111,7 +4113,14 @@ function processGroupId(pid) {
|
|
|
4111
4113
|
"pgid=",
|
|
4112
4114
|
"-p",
|
|
4113
4115
|
String(pid)
|
|
4114
|
-
], {
|
|
4116
|
+
], {
|
|
4117
|
+
encoding: "utf8",
|
|
4118
|
+
stdio: [
|
|
4119
|
+
"ignore",
|
|
4120
|
+
"pipe",
|
|
4121
|
+
"ignore"
|
|
4122
|
+
]
|
|
4123
|
+
}).trim());
|
|
4115
4124
|
return Number.isInteger(value) && value > 0 ? value : void 0;
|
|
4116
4125
|
} catch {
|
|
4117
4126
|
return;
|
|
@@ -4196,7 +4205,8 @@ function apply(ctx, config = {}) {
|
|
|
4196
4205
|
...appPage === void 0 ? {} : { appPage },
|
|
4197
4206
|
branches,
|
|
4198
4207
|
...worktree,
|
|
4199
|
-
...upstream === void 0 ? {} : { upstreamHead: upstream }
|
|
4208
|
+
...upstream === void 0 ? {} : { upstreamHead: upstream },
|
|
4209
|
+
appVersions: readAppVersions(root)
|
|
4200
4210
|
};
|
|
4201
4211
|
};
|
|
4202
4212
|
const graph = createGraphPort(ctx, root);
|