@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.
@@ -1,5 +1,5 @@
1
1
  //#region generated/server.d.ts
2
- export declare const facet: import("@agimon-ai/po-core/serverFacet").DoomServerFacet;
2
+ export declare const facet: import("@agimon-ai/po-core/serverFacet").PoServerFacet;
3
3
  //#endregion
4
4
  export { facet as default };
5
5
  //# sourceMappingURL=server.d.mts.map
@@ -1,10 +1,10 @@
1
- import { _ as NETWORK_TIMEOUT_MS, a as GIT_WORKTREE_LIFECYCLE_EVENT, b as createWorktreeGit, c as isWorktreeLifecycleEvent, d as registryFile, f as readJson, g as invalidRequest, h as HubUnavailableError, i as GIT_SESSION_CHANGED_EVENT, l as credentialsFile, m as DoomGitExpectedError, n as createWorktreeRegistry, o as createWorktreeMessageInbox, p as writeJsonAtomic, r as validRefName, s as isSessionChangedEvent, t as createWorktreeOperations, u as doomGitRoot, v as READ_TIMEOUT_MS, x as runGit, y as REBASE_TIMEOUT_MS } from "../worktreeOperations-2PaaLPTF.mjs";
1
+ import { _ as NETWORK_TIMEOUT_MS, a as GIT_WORKTREE_LIFECYCLE_EVENT, b as createWorktreeGit, c as isWorktreeLifecycleEvent, d as registryFile, f as readJson, g as invalidRequest, h as PoGitExpectedError, i as GIT_SESSION_CHANGED_EVENT, l as credentialsFile, m as HubUnavailableError, n as createWorktreeRegistry, o as createWorktreeMessageInbox, p as writeJsonAtomic, r as validRefName, s as isSessionChangedEvent, t as createWorktreeOperations, u as poGitRoot, v as READ_TIMEOUT_MS, x as runGit, y as REBASE_TIMEOUT_MS } from "../worktreeOperations-BSeyxUai.mjs";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { composeServerProviderOverrides, defineServerPlugin, readPackageResource } from "@agimon-ai/po-core/serverFacet";
6
6
  import { composeRootHooks, defineChannel, defineHook, defineResource, defineRoot, defineRoute, defineServerTool } from "@agimon-ai/po-core/extensionFile";
7
- import { readDoomSessionDelivery } from "@agimon-ai/po-session";
7
+ import { readPoSessionDelivery } from "@agimon-ai/po-session";
8
8
  import { Type } from "typebox";
9
9
  //#region src/schemas/runWorktreeTool.ts
10
10
  /**
@@ -312,7 +312,7 @@ function createGitSession({ context, host: serverHost }) {
312
312
  git: createWorktreeGit(),
313
313
  sessionService: serverHost.context.sessionService,
314
314
  messageInbox,
315
- sessionDelivery: () => readDoomSessionDelivery(context)
315
+ sessionDelivery: () => readPoSessionDelivery(context)
316
316
  });
317
317
  const resources = [{
318
318
  when: {
@@ -928,7 +928,7 @@ function createGitAuthStore(homeDir = os.homedir()) {
928
928
  const key = workspaceKey(workspaceRoot);
929
929
  const current = readFile();
930
930
  const next = parseGitAuthSave(request, current.workspaces[key] ?? { method: "none" }, homeDir);
931
- const root = doomGitRoot(homeDir);
931
+ const root = poGitRoot(homeDir);
932
932
  fs.mkdirSync(root, {
933
933
  recursive: true,
934
934
  mode: OWNER_ONLY_DIRECTORY
@@ -1100,7 +1100,7 @@ function badRequest(message) {
1100
1100
  return Response.json({ error: message }, { status: 400 });
1101
1101
  }
1102
1102
  function failed(error) {
1103
- if (error instanceof DoomGitExpectedError) return Response.json({
1103
+ if (error instanceof PoGitExpectedError) return Response.json({
1104
1104
  error: error.message,
1105
1105
  code: error.code
1106
1106
  }, { status: error.retryable ? 503 : 409 });
@@ -1191,7 +1191,7 @@ var route_server_default = defineRoute({
1191
1191
  try {
1192
1192
  return Response.json(gitAuth.save(root, await request.json().catch(() => void 0)));
1193
1193
  } catch (error) {
1194
- if (error instanceof DoomGitExpectedError && error.code === "invalid_request") {
1194
+ if (error instanceof PoGitExpectedError && error.code === "invalid_request") {
1195
1195
  const text = error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");
1196
1196
  return Response.json({
1197
1197
  error: text,
@@ -1366,12 +1366,12 @@ const RULES = [
1366
1366
  }
1367
1367
  ];
1368
1368
  function classifyGitFailure(operation, result, mismatch) {
1369
- if (result.timedOut) return new DoomGitExpectedError("git_timeout", `git ${operation} took too long and was stopped.`, true, "Check the network, then try again.");
1369
+ if (result.timedOut) return new PoGitExpectedError("git_timeout", `git ${operation} took too long and was stopped.`, true, "Check the network, then try again.");
1370
1370
  const text = `${result.stderr}\n${result.stdout}`.toLowerCase();
1371
1371
  const rule = RULES.find((candidate) => candidate.phrases.some((phrase) => text.includes(phrase)));
1372
- if (rule === void 0) return new DoomGitExpectedError("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.");
1372
+ if (rule === void 0) return new 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.");
1373
1373
  const recovery = rule.code === "auth_failed" && mismatch !== void 0 ? `${mismatch} ${rule.recovery}` : rule.recovery;
1374
- return new DoomGitExpectedError(rule.code, rule.message, rule.retryable, recovery);
1374
+ return new PoGitExpectedError(rule.code, rule.message, rule.retryable, recovery);
1375
1375
  }
1376
1376
  //#endregion
1377
1377
  //#region src/services/gitSync/index.ts
@@ -1394,7 +1394,7 @@ function classifyGitFailure(operation, result, mismatch) {
1394
1394
  */
1395
1395
  const DONE = { outcome: "done" };
1396
1396
  function expected(code, message, recovery) {
1397
- return new DoomGitExpectedError(code, message, false, recovery);
1397
+ return new PoGitExpectedError(code, message, false, recovery);
1398
1398
  }
1399
1399
  async function readLine(cwd, args) {
1400
1400
  const result = await runGit(cwd, args, { timeout: READ_TIMEOUT_MS });
@@ -1621,13 +1621,13 @@ const PENDING = {
1621
1621
  /** The error target a failure maps to: a rejected plain push asks for a confirmed lease force. */
1622
1622
  function errorTargetFor$1(command, error) {
1623
1623
  if (command.action !== "push") return { action: command.action };
1624
- return error instanceof DoomGitExpectedError && error.code === "push_needs_force" && command.force !== true ? {
1624
+ return error instanceof PoGitExpectedError && error.code === "push_needs_force" && command.force !== true ? {
1625
1625
  action: "push",
1626
1626
  forceRequired: true
1627
1627
  } : { action: "push" };
1628
1628
  }
1629
1629
  function failureText$1(error) {
1630
- if (error instanceof DoomGitExpectedError) return error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");
1630
+ if (error instanceof PoGitExpectedError) return error.message.replace(/^\[[a-z_]+\] /u, "").replace("\nRecovery: ", " ");
1631
1631
  return "The git command failed.";
1632
1632
  }
1633
1633
  function createGitChangesChannel(options = {}) {
@@ -1745,7 +1745,7 @@ function createGitChangesChannel(options = {}) {
1745
1745
  errorTarget: void 0
1746
1746
  });
1747
1747
  run(scope, command).then(() => update(scope.sessionId, { pending: void 0 })).catch((error) => {
1748
- host.onNotice(`git ${command.action} failed for ${scope.sessionId} (${error instanceof DoomGitExpectedError ? error.code : "unexpected"})`);
1748
+ host.onNotice(`git ${command.action} failed for ${scope.sessionId} (${error instanceof PoGitExpectedError ? error.code : "unexpected"})`);
1749
1749
  update(scope.sessionId, {
1750
1750
  pending: void 0,
1751
1751
  error: failureText$1(error),
@@ -1857,7 +1857,7 @@ function parseCommand(payload) {
1857
1857
  * echoed: a git error can carry a remote URL with a token in it.
1858
1858
  */
1859
1859
  function failureText(error) {
1860
- return error instanceof DoomGitExpectedError ? error.message : "The worktree operation failed.";
1860
+ return error instanceof PoGitExpectedError ? error.message : "The worktree operation failed.";
1861
1861
  }
1862
1862
  /** Starts one direct-event subscription per managed session. */
1863
1863
  function createWorktreesChannel(options = {}) {