agentful 0.4.43 → 0.4.45
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/dist/index.cjs +25 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, tuiDesign, sym, ui;
|
|
|
3044
3044
|
var init_branding = __esm({
|
|
3045
3045
|
"src/branding.ts"() {
|
|
3046
3046
|
"use strict";
|
|
3047
|
-
VERSION = "0.4.
|
|
3047
|
+
VERSION = "0.4.45" ? "0.4.45" : null.version;
|
|
3048
3048
|
brand = {
|
|
3049
3049
|
name: "agentful",
|
|
3050
3050
|
// the command users type
|
|
@@ -6367,6 +6367,10 @@ function requireProject(cwd = process.cwd()) {
|
|
|
6367
6367
|
return config;
|
|
6368
6368
|
}
|
|
6369
6369
|
var PROJECT_ID = /^[a-z0-9]{10,20}$/i;
|
|
6370
|
+
function printable(text, max) {
|
|
6371
|
+
const clean = text.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim();
|
|
6372
|
+
return clean.length > max ? `${clean.slice(0, max - 1)}\u2026` : clean;
|
|
6373
|
+
}
|
|
6370
6374
|
async function linkProject(auth, projectId, title, cwd = process.cwd()) {
|
|
6371
6375
|
if (!PROJECT_ID.test(projectId)) {
|
|
6372
6376
|
throw new ApiError(
|
|
@@ -6396,6 +6400,15 @@ async function linkProject(auth, projectId, title, cwd = process.cwd()) {
|
|
|
6396
6400
|
`The platform returned no owner for project ${projectId}; nothing was linked.`
|
|
6397
6401
|
);
|
|
6398
6402
|
}
|
|
6403
|
+
if (record.role === "guest") {
|
|
6404
|
+
const org = typeof record.org_name === "string" ? printable(record.org_name, 80) : "";
|
|
6405
|
+
const link = `${APP_URL}/shared/${encodeURIComponent(storageUserId)}/${projectId}`;
|
|
6406
|
+
throw new ApiError(
|
|
6407
|
+
403,
|
|
6408
|
+
"guest_preview_only",
|
|
6409
|
+
`Project ${projectId} is shared with you as a guest${org ? ` by ${org}` : ""}. Guests see only the preview, in the app; nothing was linked. Open it at ${link}`
|
|
6410
|
+
);
|
|
6411
|
+
}
|
|
6399
6412
|
await request(`${API_URL}/api/workspaces/${encodeURIComponent(storageUserId)}/${projectId}/tree`, { token: auth.pb_token });
|
|
6400
6413
|
const config = {
|
|
6401
6414
|
projectId,
|
|
@@ -10896,6 +10909,14 @@ function writePulledBackendDeclaration(root, declaration) {
|
|
|
10896
10909
|
(0, import_node_fs20.writeFileSync)(target, `${JSON.stringify(portableDeclaration, null, 2)}
|
|
10897
10910
|
`, "utf8");
|
|
10898
10911
|
}
|
|
10912
|
+
function explainPullRefusal(err2) {
|
|
10913
|
+
if (!(err2 instanceof ApiError) || err2.status !== 403) return err2;
|
|
10914
|
+
return new ApiError(
|
|
10915
|
+
403,
|
|
10916
|
+
"pull_not_allowed",
|
|
10917
|
+
'Only the person responsible for this project can pull it. If it is shared with you to view, `agentful open` shows the preview, and the app shows the code under "Shared with me".'
|
|
10918
|
+
);
|
|
10919
|
+
}
|
|
10899
10920
|
|
|
10900
10921
|
// src/commands/pull.ts
|
|
10901
10922
|
async function pullCommand(opts) {
|
|
@@ -10915,7 +10936,9 @@ async function pullCommand(opts) {
|
|
|
10915
10936
|
request(
|
|
10916
10937
|
`${PB_URL}/api/workspaces/${project.userId}/${project.projectId}`,
|
|
10917
10938
|
{ token: auth.pb_token, timeoutMs: 12e4 }
|
|
10918
|
-
)
|
|
10939
|
+
).catch((err2) => {
|
|
10940
|
+
throw explainPullRefusal(err2);
|
|
10941
|
+
}),
|
|
10919
10942
|
fetchBackendSessionState(auth, project.userId, project.projectId)
|
|
10920
10943
|
]);
|
|
10921
10944
|
let written = 0;
|