@agimon-ai/po-git 0.0.0-alpha.3 → 0.0.0-alpha.4
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/extensions/server.cjs +13 -13
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +1 -1
- package/dist/extensions/server.mjs +14 -14
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +112 -112
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{worktreeOperations-2PaaLPTF.mjs → worktreeOperations-BSeyxUai.mjs} +39 -39
- package/dist/worktreeOperations-BSeyxUai.mjs.map +1 -0
- package/dist/{worktreeOperations-C6_xikos.cjs → worktreeOperations-DGUbUnYU.cjs} +50 -50
- package/dist/worktreeOperations-DGUbUnYU.cjs.map +1 -0
- package/package.json +14 -14
- package/dist/worktreeOperations-2PaaLPTF.mjs.map +0 -1
- package/dist/worktreeOperations-C6_xikos.cjs.map +0 -1
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_worktreeOperations = require("../worktreeOperations-
|
|
5
|
+
const require_worktreeOperations = require("../worktreeOperations-DGUbUnYU.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
node_fs = require_worktreeOperations.__toESM(node_fs, 1);
|
|
8
8
|
let node_os = require("node:os");
|
|
@@ -319,7 +319,7 @@ function createGitSession({ context, host: serverHost }) {
|
|
|
319
319
|
git: require_worktreeOperations.createWorktreeGit(),
|
|
320
320
|
sessionService: serverHost.context.sessionService,
|
|
321
321
|
messageInbox,
|
|
322
|
-
sessionDelivery: () => (0, _agimon_ai_po_session.
|
|
322
|
+
sessionDelivery: () => (0, _agimon_ai_po_session.readPoSessionDelivery)(context)
|
|
323
323
|
});
|
|
324
324
|
const resources = [{
|
|
325
325
|
when: {
|
|
@@ -935,7 +935,7 @@ function createGitAuthStore(homeDir = node_os.default.homedir()) {
|
|
|
935
935
|
const key = workspaceKey(workspaceRoot);
|
|
936
936
|
const current = readFile();
|
|
937
937
|
const next = parseGitAuthSave(request, current.workspaces[key] ?? { method: "none" }, homeDir);
|
|
938
|
-
const root = require_worktreeOperations.
|
|
938
|
+
const root = require_worktreeOperations.poGitRoot(homeDir);
|
|
939
939
|
node_fs.default.mkdirSync(root, {
|
|
940
940
|
recursive: true,
|
|
941
941
|
mode: OWNER_ONLY_DIRECTORY
|
|
@@ -1107,7 +1107,7 @@ function badRequest(message) {
|
|
|
1107
1107
|
return Response.json({ error: message }, { status: 400 });
|
|
1108
1108
|
}
|
|
1109
1109
|
function failed(error) {
|
|
1110
|
-
if (error instanceof require_worktreeOperations.
|
|
1110
|
+
if (error instanceof require_worktreeOperations.PoGitExpectedError) return Response.json({
|
|
1111
1111
|
error: error.message,
|
|
1112
1112
|
code: error.code
|
|
1113
1113
|
}, { status: error.retryable ? 503 : 409 });
|
|
@@ -1198,7 +1198,7 @@ var route_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoute)({
|
|
|
1198
1198
|
try {
|
|
1199
1199
|
return Response.json(gitAuth.save(root, await request.json().catch(() => void 0)));
|
|
1200
1200
|
} catch (error) {
|
|
1201
|
-
if (error instanceof require_worktreeOperations.
|
|
1201
|
+
if (error instanceof require_worktreeOperations.PoGitExpectedError && error.code === "invalid_request") {
|
|
1202
1202
|
const text = error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");
|
|
1203
1203
|
return Response.json({
|
|
1204
1204
|
error: text,
|
|
@@ -1373,12 +1373,12 @@ const RULES = [
|
|
|
1373
1373
|
}
|
|
1374
1374
|
];
|
|
1375
1375
|
function classifyGitFailure(operation, result, mismatch) {
|
|
1376
|
-
if (result.timedOut) return new require_worktreeOperations.
|
|
1376
|
+
if (result.timedOut) return new require_worktreeOperations.PoGitExpectedError("git_timeout", `git ${operation} took too long and was stopped.`, true, "Check the network, then try again.");
|
|
1377
1377
|
const text = `${result.stderr}\n${result.stdout}`.toLowerCase();
|
|
1378
1378
|
const rule = RULES.find((candidate) => candidate.phrases.some((phrase) => text.includes(phrase)));
|
|
1379
|
-
if (rule === void 0) return new require_worktreeOperations.
|
|
1379
|
+
if (rule === void 0) return new require_worktreeOperations.PoGitExpectedError("git_failed", `git ${operation} failed (exit ${String(result.code)}).`, false, "Run the same command in a terminal in this checkout to see what git says.");
|
|
1380
1380
|
const recovery = rule.code === "auth_failed" && mismatch !== void 0 ? `${mismatch} ${rule.recovery}` : rule.recovery;
|
|
1381
|
-
return new require_worktreeOperations.
|
|
1381
|
+
return new require_worktreeOperations.PoGitExpectedError(rule.code, rule.message, rule.retryable, recovery);
|
|
1382
1382
|
}
|
|
1383
1383
|
//#endregion
|
|
1384
1384
|
//#region src/services/gitSync/index.ts
|
|
@@ -1401,7 +1401,7 @@ function classifyGitFailure(operation, result, mismatch) {
|
|
|
1401
1401
|
*/
|
|
1402
1402
|
const DONE = { outcome: "done" };
|
|
1403
1403
|
function expected(code, message, recovery) {
|
|
1404
|
-
return new require_worktreeOperations.
|
|
1404
|
+
return new require_worktreeOperations.PoGitExpectedError(code, message, false, recovery);
|
|
1405
1405
|
}
|
|
1406
1406
|
async function readLine(cwd, args) {
|
|
1407
1407
|
const result = await require_worktreeOperations.runGit(cwd, args, { timeout: require_worktreeOperations.READ_TIMEOUT_MS });
|
|
@@ -1628,13 +1628,13 @@ const PENDING = {
|
|
|
1628
1628
|
/** The error target a failure maps to: a rejected plain push asks for a confirmed lease force. */
|
|
1629
1629
|
function errorTargetFor$1(command, error) {
|
|
1630
1630
|
if (command.action !== "push") return { action: command.action };
|
|
1631
|
-
return error instanceof require_worktreeOperations.
|
|
1631
|
+
return error instanceof require_worktreeOperations.PoGitExpectedError && error.code === "push_needs_force" && command.force !== true ? {
|
|
1632
1632
|
action: "push",
|
|
1633
1633
|
forceRequired: true
|
|
1634
1634
|
} : { action: "push" };
|
|
1635
1635
|
}
|
|
1636
1636
|
function failureText$1(error) {
|
|
1637
|
-
if (error instanceof require_worktreeOperations.
|
|
1637
|
+
if (error instanceof require_worktreeOperations.PoGitExpectedError) return error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");
|
|
1638
1638
|
return "The git command failed.";
|
|
1639
1639
|
}
|
|
1640
1640
|
function createGitChangesChannel(options = {}) {
|
|
@@ -1752,7 +1752,7 @@ function createGitChangesChannel(options = {}) {
|
|
|
1752
1752
|
errorTarget: void 0
|
|
1753
1753
|
});
|
|
1754
1754
|
run(scope, command).then(() => update(scope.sessionId, { pending: void 0 })).catch((error) => {
|
|
1755
|
-
host.onNotice(`git ${command.action} failed for ${scope.sessionId} (${error instanceof require_worktreeOperations.
|
|
1755
|
+
host.onNotice(`git ${command.action} failed for ${scope.sessionId} (${error instanceof require_worktreeOperations.PoGitExpectedError ? error.code : "unexpected"})`);
|
|
1756
1756
|
update(scope.sessionId, {
|
|
1757
1757
|
pending: void 0,
|
|
1758
1758
|
error: failureText$1(error),
|
|
@@ -1864,7 +1864,7 @@ function parseCommand(payload) {
|
|
|
1864
1864
|
* echoed: a git error can carry a remote URL with a token in it.
|
|
1865
1865
|
*/
|
|
1866
1866
|
function failureText(error) {
|
|
1867
|
-
return error instanceof require_worktreeOperations.
|
|
1867
|
+
return error instanceof require_worktreeOperations.PoGitExpectedError ? error.message : "The worktree operation failed.";
|
|
1868
1868
|
}
|
|
1869
1869
|
/** Starts one direct-event subscription per managed session. */
|
|
1870
1870
|
function createWorktreesChannel(options = {}) {
|