@anhlp/alp-paseo 0.0.0-beta.2 → 0.0.1-beta.3
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 +16 -4
- package/client/library.tsx +22 -6
- package/package.json +14 -14
- package/paseo-plugin.json +1 -1
- package/server/dist/THIRD-PARTY-NOTICES.txt +2 -2
- package/server/dist/alpd.js +705 -326
- package/server/dist/index.js +686 -273
- package/server/dist/library.js +65 -9
- package/server/dist/main.js +284 -102
- package/server/dist/mapping.js +4 -2
- package/server/dist/panel/library.js +65 -9
- package/server/dist/panel/mapping.js +4 -2
- package/server/dist/panel/tasks.js +1 -1
- package/server/dist/panel/usage.js +3 -3
- package/server/dist/paseo/agents.js +62 -18
- package/server/dist/paseo/index.js +166 -68
- package/server/dist/paseo/plugins.js +84 -28
- package/server/dist/paseo/providers.js +44 -3
- package/server/dist/provider-core.js +14 -0
- package/server/dist/provider.js +574 -209
- package/server/dist/remote/index.js +34 -5
- package/server/dist/remote/link.js +1 -1
- package/server/dist/remote/panels.js +20 -5
- package/server/dist/remote/provider.js +15 -1
- package/server/dist/session-usage.js +15 -0
- package/server/dist/tasks.js +1 -1
- package/server/dist/usage.js +3 -3
- package/server/dist/web.js +1 -1
- package/shared/library.ts +2 -0
package/server/dist/library.js
CHANGED
|
@@ -8680,7 +8680,7 @@ function launchCommand(command, args = [], env = process.env) {
|
|
|
8680
8680
|
}
|
|
8681
8681
|
|
|
8682
8682
|
// packages/core/src/library-edit.js
|
|
8683
|
-
import { mkdir as mkdir2, rename as rename3, rm as rm3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
8683
|
+
import { lstat as lstat3, mkdir as mkdir2, readdir as readdir4, rename as rename3, rm as rm3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
8684
8684
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
8685
8685
|
import path8 from "node:path";
|
|
8686
8686
|
|
|
@@ -8736,6 +8736,42 @@ function base(scope, { root, library }, kind) {
|
|
|
8736
8736
|
return fail3("INVALID_SCOPE", `Scope must be library or project, not '${scope}'`);
|
|
8737
8737
|
}
|
|
8738
8738
|
var revisionOf = (content) => content === void 0 ? null : createHash2("sha256").update(JSON.stringify(content)).digest("hex").slice(0, 16);
|
|
8739
|
+
function assertProjectDataContent(kind, content) {
|
|
8740
|
+
const deny = () => fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes allow only instruction entries and non-executable agent configuration");
|
|
8741
|
+
if (!object6(content) || !["agents", "skills"].includes(kind)) deny();
|
|
8742
|
+
const keys2 = kind === "skills" ? ["body"] : ["instructions", "config"];
|
|
8743
|
+
if (Object.keys(content).some((key) => !keys2.includes(key))) deny();
|
|
8744
|
+
const text = kind === "skills" ? content.body : content.instructions;
|
|
8745
|
+
if (typeof text !== "string" || !text.trim()) deny();
|
|
8746
|
+
if (content.config !== void 0) {
|
|
8747
|
+
const config2 = content.config;
|
|
8748
|
+
if (!object6(config2)) deny();
|
|
8749
|
+
const allowed = ["description", "model", "thinking", "context", "autocompact"];
|
|
8750
|
+
if (Object.keys(config2).some((key) => !allowed.includes(key))) deny();
|
|
8751
|
+
for (const key of ["description", "thinking"]) if (config2[key] !== void 0 && typeof config2[key] !== "string") deny();
|
|
8752
|
+
if (config2.model !== void 0 && (typeof config2.model !== "string" || !/^(codex|claude):[^\s/\\:]{1,240}$/.test(config2.model))) deny();
|
|
8753
|
+
for (const key of ["context", "autocompact"]) if (config2[key] !== void 0 && !(typeof config2[key] === "string" || typeof config2[key] === "number" && Number.isFinite(config2[key]))) deny();
|
|
8754
|
+
}
|
|
8755
|
+
}
|
|
8756
|
+
async function projectDataEntry(kind, name, { scope, root, library, templates: templates2 }) {
|
|
8757
|
+
if (scope !== "project" || !root || !["agents", "skills"].includes(kind)) fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes require project scope and agents or skills");
|
|
8758
|
+
nameOf(name);
|
|
8759
|
+
const directory = base(scope, { root, library }, kind);
|
|
8760
|
+
await safeEntryPaths(directory, kind, name);
|
|
8761
|
+
const found = await layers(kind, name, { root, library, templates: templates2 });
|
|
8762
|
+
if (found.library !== void 0 || found.builtin !== void 0) fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes cannot shadow or reveal a library or built-in entry");
|
|
8763
|
+
if (found.project !== void 0) assertProjectDataContent(kind, found.project);
|
|
8764
|
+
const owned = path8.join(directory, kind, name);
|
|
8765
|
+
const files = await readdir4(owned).catch((error51) => {
|
|
8766
|
+
if (error51.code === "ENOENT") return [];
|
|
8767
|
+
throw error51;
|
|
8768
|
+
});
|
|
8769
|
+
const allowed = new Set(FILES[kind](name).map(([file2]) => path8.basename(file2)));
|
|
8770
|
+
for (const file2 of files) {
|
|
8771
|
+
const info = await lstat3(path8.join(owned, file2));
|
|
8772
|
+
if (!allowed.has(file2) || !info.isFile() || info.isSymbolicLink() || info.nlink !== 1) fail3("UNSAFE_LIBRARY_WRITE", "Project-data entries cannot contain sidecars, links or executable assets");
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8739
8775
|
async function safeEntryPaths(directory, kind, name) {
|
|
8740
8776
|
for (const [file2] of FILES[kind](name)) {
|
|
8741
8777
|
await assertNoSymlinks(directory, path8.join(kind, file2));
|
|
@@ -8933,9 +8969,13 @@ async function writeAtomic(file2, text) {
|
|
|
8933
8969
|
await moveFile(temporary, file2);
|
|
8934
8970
|
}
|
|
8935
8971
|
var exists = (target) => stat2(target).then(() => true, () => false);
|
|
8936
|
-
async function saveEntry(kind, name, content, { scope, root, library, templates: templates2, revision } = {}) {
|
|
8972
|
+
async function saveEntry(kind, name, content, { scope, root, library, templates: templates2, revision, policy } = {}) {
|
|
8937
8973
|
kindOf(kind);
|
|
8938
8974
|
nameOf(name);
|
|
8975
|
+
if (policy === "project-data") {
|
|
8976
|
+
assertProjectDataContent(kind, content);
|
|
8977
|
+
await projectDataEntry(kind, name, { scope, root, library, templates: templates2 });
|
|
8978
|
+
}
|
|
8939
8979
|
const directory = base(scope, { root, library }, kind);
|
|
8940
8980
|
await safeEntryPaths(directory, kind, name);
|
|
8941
8981
|
await check(kind, name, content, { scope, root, library, templates: templates2 });
|
|
@@ -8957,9 +8997,10 @@ async function saveEntry(kind, name, content, { scope, root, library, templates:
|
|
|
8957
8997
|
}
|
|
8958
8998
|
return { revision: revisionOf(await readLayer(kind, name, directory)) };
|
|
8959
8999
|
}
|
|
8960
|
-
async function deleteEntry(kind, name, { scope, root, library, templates: templates2, revision } = {}) {
|
|
9000
|
+
async function deleteEntry(kind, name, { scope, root, library, templates: templates2, revision, policy } = {}) {
|
|
8961
9001
|
kindOf(kind);
|
|
8962
9002
|
nameOf(name);
|
|
9003
|
+
if (policy === "project-data") await projectDataEntry(kind, name, { scope, root, library, templates: templates2 });
|
|
8963
9004
|
const directory = base(scope, { root, library }, kind);
|
|
8964
9005
|
const current = await readLayer(kind, name, directory);
|
|
8965
9006
|
if (current === void 0) fail3("NOT_FOUND", `No ${kind} entry '${name}' in the ${scope}`);
|
|
@@ -8975,14 +9016,25 @@ async function deleteEntry(kind, name, { scope, root, library, templates: templa
|
|
|
8975
9016
|
const now = scope === "project" && found.library !== void 0 ? "library" : "builtin";
|
|
8976
9017
|
return { removed: true, ...fallback !== void 0 ? { now } : {} };
|
|
8977
9018
|
}
|
|
8978
|
-
async function duplicateEntry(kind, from, to, { scope, root, library, templates: templates2 } = {}) {
|
|
9019
|
+
async function duplicateEntry(kind, from, to, { scope, root, library, templates: templates2, policy } = {}) {
|
|
9020
|
+
kindOf(kind);
|
|
9021
|
+
nameOf(from);
|
|
9022
|
+
nameOf(to);
|
|
9023
|
+
if (policy === "project-data") {
|
|
9024
|
+
await projectDataEntry(kind, from, { scope, root, library, templates: templates2 });
|
|
9025
|
+
await projectDataEntry(kind, to, { scope, root, library, templates: templates2 });
|
|
9026
|
+
}
|
|
8979
9027
|
const { content } = await getEntry(kind, from, { root, library, templates: templates2 });
|
|
8980
|
-
return saveEntry(kind, to, structuredClone(content), { scope, root, library, templates: templates2, revision: null });
|
|
9028
|
+
return saveEntry(kind, to, structuredClone(content), { scope, root, library, templates: templates2, revision: null, policy });
|
|
8981
9029
|
}
|
|
8982
|
-
async function renameEntry(kind, from, to, { scope, root, library, templates: templates2 } = {}) {
|
|
9030
|
+
async function renameEntry(kind, from, to, { scope, root, library, templates: templates2, policy } = {}) {
|
|
8983
9031
|
kindOf(kind);
|
|
8984
9032
|
nameOf(from);
|
|
8985
9033
|
nameOf(to);
|
|
9034
|
+
if (policy === "project-data") {
|
|
9035
|
+
await projectDataEntry(kind, from, { scope, root, library, templates: templates2 });
|
|
9036
|
+
await projectDataEntry(kind, to, { scope, root, library, templates: templates2 });
|
|
9037
|
+
}
|
|
8986
9038
|
const directory = base(scope, { root, library }, kind);
|
|
8987
9039
|
const content = await readLayer(kind, from, directory);
|
|
8988
9040
|
if (content === void 0) fail3("NOT_FOUND", `No ${kind} entry '${from}' in the ${scope}`);
|
|
@@ -9477,7 +9529,7 @@ var TAIL_BYTES = 256 * 1024;
|
|
|
9477
9529
|
var MAX_FRAME = 16 * 1024 * 1024;
|
|
9478
9530
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
9479
9531
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
9480
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
9532
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
9481
9533
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
9482
9534
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
9483
9535
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -24132,12 +24184,14 @@ var toolShapes = {
|
|
|
24132
24184
|
body: external_exports.string().min(1).max(2e4),
|
|
24133
24185
|
roles: external_exports.array(external_exports.string().min(1)).min(1).max(10),
|
|
24134
24186
|
lessons: external_exports.array(external_exports.string().min(1).max(600)).max(50).optional(),
|
|
24135
|
-
replace: external_exports.boolean().optional()
|
|
24187
|
+
replace: external_exports.boolean().optional(),
|
|
24188
|
+
requestId: external_exports.string().min(1).max(100).optional()
|
|
24136
24189
|
},
|
|
24137
24190
|
alp_issue: {
|
|
24138
24191
|
action: external_exports.enum(["search", "create", "comment"]),
|
|
24139
24192
|
target: external_exports.enum(["project", "alp"]),
|
|
24140
24193
|
query: external_exports.string().min(1).max(200).optional(),
|
|
24194
|
+
requestId: external_exports.string().min(1).max(100).optional(),
|
|
24141
24195
|
title: external_exports.string().min(1).max(200).optional(),
|
|
24142
24196
|
body: external_exports.string().min(1).max(2e4).optional(),
|
|
24143
24197
|
issue: external_exports.number().int().positive().optional(),
|
|
@@ -26275,7 +26329,9 @@ var libraryGet = defineRpc2({
|
|
|
26275
26329
|
revision: external_exports.string().nullable(),
|
|
26276
26330
|
usedBy: external_exports.array(external_exports.string()),
|
|
26277
26331
|
/** Agents: the skills the library gives it by name (role-skills.json). */
|
|
26278
|
-
librarySkills: external_exports.array(external_exports.string()).optional()
|
|
26332
|
+
librarySkills: external_exports.array(external_exports.string()).optional(),
|
|
26333
|
+
/** ALP remote mode: JSON Pointers of the values `content` holds as a secret marker, not as the value. */
|
|
26334
|
+
secrets: external_exports.array(external_exports.string()).optional()
|
|
26279
26335
|
})
|
|
26280
26336
|
});
|
|
26281
26337
|
var librarySkills2 = defineRpc2({
|