@primitive.ai/prim 0.1.0-alpha.117 → 0.1.0-alpha.118

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.
Files changed (47) hide show
  1. package/README.md +21 -21
  2. package/SKILL.md +3 -3
  3. package/dist/{chunk-XG7S3LIL.js → chunk-3NJ4FUPK.js} +889 -919
  4. package/dist/{chunk-J5HBSRAV.js → chunk-4HEWA4IO.js} +1 -1
  5. package/dist/{chunk-LEUZDTNT.js → chunk-B3FVP7VQ.js} +1 -1
  6. package/dist/{chunk-4OEJ2ONG.js → chunk-C2AEY4AI.js} +2 -13
  7. package/dist/{chunk-S55JKCHQ.js → chunk-C2AJBMP2.js} +2 -2
  8. package/dist/{chunk-D3ZDZZYS.js → chunk-CHRICRVE.js} +17 -10
  9. package/dist/{chunk-HMD5K6W7.js → chunk-ECP7EGOD.js} +2 -2
  10. package/dist/{chunk-FTW4ZCBA.js → chunk-FPDOBG3H.js} +1 -1
  11. package/dist/{chunk-3TIKBQHV.js → chunk-JGOFEG6T.js} +6 -4
  12. package/dist/chunk-JSBRDJBE.js +30 -0
  13. package/dist/{chunk-KGBMU76T.js → chunk-JXQVXU2K.js} +1 -1
  14. package/dist/chunk-KZB4ABIB.js +13 -0
  15. package/dist/{chunk-I3J344DF.js → chunk-L3NUFCOD.js} +5 -5
  16. package/dist/{chunk-6IRAGUYK.js → chunk-LEEWUN74.js} +2 -2
  17. package/dist/{chunk-JKJ22ONL.js → chunk-OHLVHT6R.js} +6 -6
  18. package/dist/{chunk-RLBASQJD.js → chunk-OIXHRN32.js} +4 -4
  19. package/dist/{chunk-LLKJAET2.js → chunk-PYIIYC3A.js} +8 -16
  20. package/dist/{chunk-NEQI2VLM.js → chunk-Q4CWXKNV.js} +5 -5
  21. package/dist/{chunk-4SN5BCIG.js → chunk-QX7QFMLF.js} +2 -2
  22. package/dist/{chunk-CXMLAWC2.js → chunk-SCOEPFOV.js} +2 -2
  23. package/dist/{chunk-6JHKKLA2.js → chunk-UMSJ4DU2.js} +46 -46
  24. package/dist/{chunk-JKO6PZWQ.js → chunk-VEI7KUOU.js} +26 -48
  25. package/dist/hook-runtime/daemon/server.js +1 -0
  26. package/dist/hook-runtime/hooks/post-commit.js +1 -0
  27. package/dist/hook-runtime/hooks/post-rewrite.js +1 -0
  28. package/dist/hook-runtime/hooks/post-tool-use.js +29 -29
  29. package/dist/hook-runtime/hooks/pre-commit.js +1 -0
  30. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +34746 -0
  31. package/dist/hook-runtime/hooks/pre-tool-use.js +82 -35547
  32. package/dist/hook-runtime/hooks/prim-hook.js +22 -22
  33. package/dist/hook-runtime/hooks/session-end.js +14 -14
  34. package/dist/hook-runtime/hooks/session-start.js +100 -100
  35. package/dist/hook-runtime/index.js +244 -256
  36. package/dist/hook-runtime/statusline-main.js +1 -0
  37. package/dist/hooks/post-commit.js +8 -7
  38. package/dist/hooks/post-rewrite.js +7 -6
  39. package/dist/hooks/post-tool-use.js +25 -22
  40. package/dist/hooks/pre-commit.js +5 -4
  41. package/dist/hooks/pre-tool-use-worker.js +222 -0
  42. package/dist/hooks/pre-tool-use.js +73 -255
  43. package/dist/hooks/prim-hook.js +25 -22
  44. package/dist/hooks/session-end.js +10 -7
  45. package/dist/hooks/session-start.js +22 -19
  46. package/dist/index.js +54 -53
  47. package/package.json +3 -3
@@ -2,7 +2,7 @@ import {
2
2
  decodeJwtPayload,
3
3
  primConfigDirectory,
4
4
  resolveAuthCredential
5
- } from "./chunk-XG7S3LIL.js";
5
+ } from "./chunk-3NJ4FUPK.js";
6
6
 
7
7
  // src/daemon/principal.ts
8
8
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  scheduleCollectScopeRefresh
3
- } from "./chunk-3TIKBQHV.js";
3
+ } from "./chunk-JGOFEG6T.js";
4
4
 
5
5
  // src/ingest-response.ts
6
6
  var IngestAcknowledgementError = class extends Error {
@@ -2,20 +2,10 @@ import {
2
2
  cursorHooksPath,
3
3
  hasExactCursorHandler,
4
4
  readCursorHooks
5
- } from "./chunk-JKO6PZWQ.js";
5
+ } from "./chunk-VEI7KUOU.js";
6
6
  import {
7
7
  resolveRepositoryContext
8
- } from "./chunk-XG7S3LIL.js";
9
-
10
- // src/hooks/agent.ts
11
- function parseAgent(argv) {
12
- const i = argv.indexOf("--agent");
13
- const value = i !== -1 ? argv[i + 1] : void 0;
14
- if (value === "codex" || value === "cursor" || value === "hermes") {
15
- return value;
16
- }
17
- return "claude_code";
18
- }
8
+ } from "./chunk-3NJ4FUPK.js";
19
9
 
20
10
  // src/hooks/cursor-coexistence.ts
21
11
  var CURSOR_EVENTS = /* @__PURE__ */ new Set([
@@ -257,7 +247,6 @@ function normalizeEnvelope(parsed, agent) {
257
247
  }
258
248
 
259
249
  export {
260
- parseAgent,
261
250
  shouldSuppressImportedCursorHandler,
262
251
  readHookStdin,
263
252
  normalizeEnvelope
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
5
  scrubEnvironmentPaths
6
- } from "./chunk-6IRAGUYK.js";
6
+ } from "./chunk-LEEWUN74.js";
7
7
  import {
8
8
  isValidRepoSyncId
9
- } from "./chunk-XG7S3LIL.js";
9
+ } from "./chunk-3NJ4FUPK.js";
10
10
 
11
11
  // src/hooks/prim-hook-core.ts
12
12
  import { createHash, randomUUID } from "crypto";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  analyzeShellTargets,
3
3
  extractFileTargets
4
- } from "./chunk-I3J344DF.js";
4
+ } from "./chunk-L3NUFCOD.js";
5
5
  import {
6
6
  DEFAULT_RULES,
7
7
  scrub
8
- } from "./chunk-6IRAGUYK.js";
8
+ } from "./chunk-LEEWUN74.js";
9
9
  import {
10
10
  boundedHealthError,
11
11
  isPreflightResponseV4
12
- } from "./chunk-3TIKBQHV.js";
12
+ } from "./chunk-JGOFEG6T.js";
13
13
  import {
14
14
  getClient,
15
15
  terminalSafeLine
16
- } from "./chunk-6JHKKLA2.js";
16
+ } from "./chunk-UMSJ4DU2.js";
17
17
  import {
18
18
  canonicalGitRoot,
19
19
  canonicalRepositoryPath
20
- } from "./chunk-XG7S3LIL.js";
20
+ } from "./chunk-3NJ4FUPK.js";
21
21
 
22
22
  // src/hooks/approval-copy.ts
23
23
  var MAX_EXCERPT_CHARS = 80;
@@ -308,6 +308,14 @@ function hasCompleteCoverage(response) {
308
308
  }
309
309
  return coverage.status === "completed" && coverage.discoveryComplete && coverage.candidateCount === coverage.evaluatedCount + coverage.bypassedCount && coverage.submittedCount === coverage.evaluatedCount && coverage.semanticBatchCount === coverage.completedSemanticBatchCount;
310
310
  }
311
+ function hasConfirmedConflict(response) {
312
+ const coverage = response.evaluationCoverage;
313
+ return (response.state === "completed" || response.state === "processing" || response.state === "paused") && response.conflicts.length > 0 && coverage.discoveryComplete && (response.state !== "completed" || hasCompleteCoverage(response)) && coverage.evaluatedCount <= coverage.candidateCount && coverage.evaluatedCount > 0 && coverage.completedSemanticBatchCount > 0 && (coverage.status === "partial" || coverage.status === "completed") && ["ask", "block", "warn"].includes(response.verdict) && [
314
+ "high_confidence_contradiction",
315
+ "aged_high_confidence_contradiction",
316
+ "provisional_or_uncertain_contradiction"
317
+ ].includes(response.reasonCode);
318
+ }
311
319
  function isNoTargetsSkip(response) {
312
320
  const coverage = response.evaluationCoverage;
313
321
  return response.state === "completed" && response.verdict === "allow" && response.reasonCode === "no_targets_skipped" && response.checkId === void 0 && response.evaluationId === void 0 && response.conflicts.length === 0 && response.bypassed.length === 0 && coverage.status === "completed" && coverage.discoveryComplete && coverage.candidateCount === 0 && coverage.submittedCount === 0 && coverage.evaluatedCount === 0 && coverage.bypassedCount === 0 && coverage.semanticBatchCount === 0 && coverage.completedSemanticBatchCount === 0;
@@ -325,7 +333,7 @@ function pausedResult(message, checkId) {
325
333
  return { verdict: "deny", conflicts: [], reason, additionalContext: reason, truncated: false };
326
334
  }
327
335
  function resultForPreflight2(response, preview, invocation, proposalTruncated = false) {
328
- if (!hasCompleteCoverage(response))
336
+ if (!hasCompleteCoverage(response) && !hasConfirmedConflict(response))
329
337
  return pausedResult(response.message || response.reasonCode, response.checkId);
330
338
  return resultForPreflight(
331
339
  {
@@ -417,7 +425,8 @@ async function waitForPreflight(operation, options = {}) {
417
425
  );
418
426
  checkId = response.checkId;
419
427
  evaluationId = response.evaluationId;
420
- if (response.state !== "processing") return response;
428
+ if (response.state !== "processing" || options.stopOnConflict && hasConfirmedConflict(response))
429
+ return response;
421
430
  const progress = JSON.stringify(response.evaluationCoverage);
422
431
  if (progress !== lastProgress) options.onProgress?.(response);
423
432
  lastProgress = progress;
@@ -438,11 +447,9 @@ export {
438
447
  proposalFor,
439
448
  proposalIsTruncated,
440
449
  PREFLIGHT_PROTOCOL_VERSION2 as PREFLIGHT_PROTOCOL_VERSION,
441
- PREFLIGHT_WAIT_MS,
442
450
  toolInputDigest,
443
451
  hasCompleteCoverage,
444
- PreflightPausedError,
445
- pausedResult,
452
+ hasConfirmedConflict,
446
453
  resultForPreflight2 as resultForPreflight,
447
454
  requestPreflight,
448
455
  waitForPreflight
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getSiteUrl
3
- } from "./chunk-6JHKKLA2.js";
3
+ } from "./chunk-UMSJ4DU2.js";
4
4
  import {
5
5
  atomicWriteFile,
6
6
  ensureDurableDirectory,
7
7
  jwtOrganizationId,
8
8
  primConfigDirectory,
9
9
  resolveAuthCredential
10
- } from "./chunk-XG7S3LIL.js";
10
+ } from "./chunk-3NJ4FUPK.js";
11
11
 
12
12
  // src/journal.ts
13
13
  import {
@@ -3,7 +3,7 @@ import {
3
3
  isTerminalSafeText,
4
4
  terminalSafeLine,
5
5
  terminalSafeText
6
- } from "./chunk-6JHKKLA2.js";
6
+ } from "./chunk-UMSJ4DU2.js";
7
7
 
8
8
  // src/decisions/feedback.ts
9
9
  var FEEDBACK_PROTOCOL_VERSION = 2;
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  getClient,
3
3
  terminalSafeLine
4
- } from "./chunk-6JHKKLA2.js";
4
+ } from "./chunk-UMSJ4DU2.js";
5
5
  import {
6
- __commonJS,
7
- __toESM,
8
6
  localGitConfigValue,
9
7
  setLocalGitConfigValue
10
- } from "./chunk-XG7S3LIL.js";
8
+ } from "./chunk-3NJ4FUPK.js";
9
+ import {
10
+ __commonJS,
11
+ __toESM
12
+ } from "./chunk-JSBRDJBE.js";
11
13
 
12
14
  // node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js
13
15
  var require_ucs2length = __commonJS({
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  atomicWriteFile,
3
3
  repoActiveFlag
4
- } from "./chunk-XG7S3LIL.js";
4
+ } from "./chunk-3NJ4FUPK.js";
5
5
 
6
6
  // src/lib/commit-heartbeat.ts
7
7
  import { execFileSync } from "child_process";
@@ -0,0 +1,13 @@
1
+ // src/hooks/agent.ts
2
+ function parseAgent(argv) {
3
+ const i = argv.indexOf("--agent");
4
+ const value = i !== -1 ? argv[i + 1] : void 0;
5
+ if (value === "codex" || value === "cursor" || value === "hermes") {
6
+ return value;
7
+ }
8
+ return "claude_code";
9
+ }
10
+
11
+ export {
12
+ parseAgent
13
+ };
@@ -1,15 +1,15 @@
1
- import {
2
- isDemoStatusResponse
3
- } from "./chunk-3TIKBQHV.js";
4
1
  import {
5
2
  inspectHookRuntime
6
- } from "./chunk-JKO6PZWQ.js";
3
+ } from "./chunk-VEI7KUOU.js";
4
+ import {
5
+ isDemoStatusResponse
6
+ } from "./chunk-JGOFEG6T.js";
7
7
  import {
8
8
  atomicWriteFile,
9
9
  primConfigDirectory,
10
10
  withFileLock,
11
11
  withFileLockSync
12
- } from "./chunk-XG7S3LIL.js";
12
+ } from "./chunk-3NJ4FUPK.js";
13
13
 
14
14
  // src/hooks/pre-tool-use-scoring.ts
15
15
  import { isAbsolute, relative, sep } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-3TIKBQHV.js";
3
+ } from "./chunk-JGOFEG6T.js";
4
4
  import {
5
5
  terminalSafeLine
6
- } from "./chunk-6JHKKLA2.js";
6
+ } from "./chunk-UMSJ4DU2.js";
7
7
 
8
8
  // src/hooks/redact.ts
9
9
  import { existsSync, readFileSync, statSync } from "fs";
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  unattendedEnv
3
3
  } from "./chunk-OYHYCK4K.js";
4
- import {
5
- HttpError,
6
- getClient
7
- } from "./chunk-6JHKKLA2.js";
8
4
  import {
9
5
  GIT_HOOK_CONTRACT_VERSION,
10
6
  blockMarkers,
@@ -13,7 +9,11 @@ import {
13
9
  hookBlockContractVersion,
14
10
  inspectGitHookEntrypoint,
15
11
  managedHookBlock
16
- } from "./chunk-JKO6PZWQ.js";
12
+ } from "./chunk-VEI7KUOU.js";
13
+ import {
14
+ HttpError,
15
+ getClient
16
+ } from "./chunk-UMSJ4DU2.js";
17
17
  import {
18
18
  atomicWriteFile,
19
19
  binFile,
@@ -27,7 +27,7 @@ import {
27
27
  setRepoSyncId,
28
28
  setRepositoryBindingState,
29
29
  withFileLock
30
- } from "./chunk-XG7S3LIL.js";
30
+ } from "./chunk-3NJ4FUPK.js";
31
31
 
32
32
  // src/commands/skill.ts
33
33
  import { createHash as createHash2 } from "crypto";
@@ -4,20 +4,20 @@ import {
4
4
  import {
5
5
  analyzeShellTargets,
6
6
  extractFileTargets
7
- } from "./chunk-I3J344DF.js";
7
+ } from "./chunk-L3NUFCOD.js";
8
8
  import {
9
9
  scrubEnvironmentPaths
10
- } from "./chunk-6IRAGUYK.js";
10
+ } from "./chunk-LEEWUN74.js";
11
11
  import {
12
12
  cachedCollectScopeAdmits
13
- } from "./chunk-3TIKBQHV.js";
13
+ } from "./chunk-JGOFEG6T.js";
14
14
  import {
15
15
  canonicalRepositoryPath,
16
16
  currentBranch,
17
17
  isRepoActiveForCapture,
18
18
  relatedWorktreeTarget,
19
19
  repoSyncId
20
- } from "./chunk-XG7S3LIL.js";
20
+ } from "./chunk-3NJ4FUPK.js";
21
21
 
22
22
  // src/hooks/file-refs.ts
23
23
  var MAX_PREFLIGHT_FILE_TARGETS = 25;
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  formatStatusline
3
- } from "./chunk-4SN5BCIG.js";
4
- import {
5
- getSiteUrl,
6
- isSessionEnded,
7
- terminalSafeText
8
- } from "./chunk-6JHKKLA2.js";
3
+ } from "./chunk-QX7QFMLF.js";
9
4
  import {
10
5
  daemonPrincipalsMatch,
11
6
  daemonRequest,
12
7
  resolveDaemonPrincipal
13
- } from "./chunk-J5HBSRAV.js";
8
+ } from "./chunk-4HEWA4IO.js";
9
+ import {
10
+ getSiteUrl,
11
+ isSessionEnded,
12
+ terminalSafeText
13
+ } from "./chunk-UMSJ4DU2.js";
14
14
  import {
15
15
  decisionIngestionStatus,
16
16
  gitToplevel,
@@ -18,7 +18,7 @@ import {
18
18
  primConfigDirectory,
19
19
  repositoryBindingState,
20
20
  withFileLock
21
- } from "./chunk-XG7S3LIL.js";
21
+ } from "./chunk-3NJ4FUPK.js";
22
22
 
23
23
  // src/hooks/codex-context.ts
24
24
  import { createHash, randomBytes as randomBytes2 } from "crypto";
@@ -61,13 +61,6 @@ var CODEX_DIGEST_STATE_MAX_FILES = 256;
61
61
  var STATE_VERSION = 1;
62
62
  var DRAFT_STATE_VERSION = 2;
63
63
  var NO_CURSOR = -1;
64
- function hasVisibleCodexMessage(output) {
65
- if (typeof output !== "object" || output === null || Array.isArray(output)) return false;
66
- const candidate = output;
67
- return Boolean(
68
- candidate.systemMessage?.trim() || candidate.hookSpecificOutput?.permissionDecisionReason?.trim() || candidate.hookSpecificOutput?.additionalContext?.trim()
69
- );
70
- }
71
64
  function appendContext(existing, context) {
72
65
  return existing ? `${existing}
73
66
 
@@ -505,7 +498,6 @@ async function prepareCodexContext(options) {
505
498
  }
506
499
 
507
500
  export {
508
- hasVisibleCodexMessage,
509
501
  appendCodexContext,
510
502
  prepareCodexContext
511
503
  };
@@ -1,17 +1,17 @@
1
+ import {
2
+ daemonRequest
3
+ } from "./chunk-4HEWA4IO.js";
1
4
  import {
2
5
  getClient,
3
6
  getSiteUrl,
4
7
  terminalSafeLine
5
- } from "./chunk-6JHKKLA2.js";
6
- import {
7
- daemonRequest
8
- } from "./chunk-J5HBSRAV.js";
8
+ } from "./chunk-UMSJ4DU2.js";
9
9
  import {
10
10
  canonicalGitRoot,
11
11
  canonicalRepositoryPath,
12
12
  currentBranch,
13
13
  repoSyncId
14
- } from "./chunk-XG7S3LIL.js";
14
+ } from "./chunk-3NJ4FUPK.js";
15
15
 
16
16
  // src/daemon/proxy.ts
17
17
  var DAEMON_HTTP_TIMEOUT_MS = 1e4;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-3TIKBQHV.js";
3
+ } from "./chunk-JGOFEG6T.js";
4
4
  import {
5
5
  stripControlChars
6
- } from "./chunk-6JHKKLA2.js";
6
+ } from "./chunk-UMSJ4DU2.js";
7
7
 
8
8
  // src/lib/delivery-backlog.ts
9
9
  var MS_PER_SECOND = 1e3;
@@ -11,10 +11,10 @@ import {
11
11
  saveRun,
12
12
  sessionExcluded,
13
13
  sessionKey
14
- } from "./chunk-I3J344DF.js";
14
+ } from "./chunk-L3NUFCOD.js";
15
15
  import {
16
16
  packageVersion
17
- } from "./chunk-XG7S3LIL.js";
17
+ } from "./chunk-3NJ4FUPK.js";
18
18
 
19
19
  // src/demo/isolation.ts
20
20
  import { existsSync } from "fs";
@@ -23,7 +23,7 @@ import {
23
23
  syncDirectory,
24
24
  withFileLock,
25
25
  workosConnectTokenEndpoint
26
- } from "./chunk-XG7S3LIL.js";
26
+ } from "./chunk-3NJ4FUPK.js";
27
27
 
28
28
  // src/decisions/identity.ts
29
29
  var PUBLIC_ID = /^dec_[0-9a-f]{8}$/u;
@@ -102,6 +102,51 @@ function publicDecisionResponse(value) {
102
102
  return replace(projected);
103
103
  }
104
104
 
105
+ // src/lib/terminal-safe.ts
106
+ function replaceIsolatedSurrogates(value) {
107
+ let out = "";
108
+ for (let index = 0; index < value.length; index += 1) {
109
+ const unit = value.charCodeAt(index);
110
+ if (unit >= 55296 && unit <= 56319) {
111
+ const next = value.charCodeAt(index + 1);
112
+ if (next >= 56320 && next <= 57343) {
113
+ out += value[index] + value[index + 1];
114
+ index += 1;
115
+ } else {
116
+ out += "\uFFFD";
117
+ }
118
+ } else if (unit >= 56320 && unit <= 57343) {
119
+ out += "\uFFFD";
120
+ } else {
121
+ out += value[index];
122
+ }
123
+ }
124
+ return out;
125
+ }
126
+ function isUnsafeTerminalCodePoint(point) {
127
+ const c0OrC1 = point <= 31 || point >= 127 && point <= 159;
128
+ const bidiOrZeroWidth = point === 173 || // soft hyphen
129
+ point === 1564 || // Arabic letter mark
130
+ point === 6158 || // Mongolian vowel separator
131
+ point >= 8203 && point <= 8207 || // zero-width + directional marks
132
+ point >= 8234 && point <= 8238 || // bidi embeddings/overrides
133
+ point >= 8288 && point <= 8303 || // word joiner + bidi isolates/controls
134
+ point >= 65529 && point <= 65531 || // interlinear annotation controls
135
+ point === 65279 || // zero-width no-break space / BOM
136
+ point >= 917504 && point <= 917631;
137
+ return c0OrC1 || bidiOrZeroWidth;
138
+ }
139
+ function terminalSafeText(value) {
140
+ return Array.from(replaceIsolatedSurrogates(value)).filter((character) => !isUnsafeTerminalCodePoint(character.codePointAt(0) ?? 0)).join("");
141
+ }
142
+ function terminalSafeLine(value) {
143
+ return terminalSafeText(value.replace(/\s+/gu, " ")).replace(/\s+/gu, " ").trim();
144
+ }
145
+ function isTerminalSafeText(value) {
146
+ return terminalSafeText(value) === value;
147
+ }
148
+ var stripControlChars = terminalSafeText;
149
+
105
150
  // src/client.ts
106
151
  import { createHash } from "crypto";
107
152
  import { chmodSync as chmodSync2, existsSync, mkdirSync, readFileSync as readFileSync2, rmSync } from "fs";
@@ -206,51 +251,6 @@ async function ingestUploaderHeaders() {
206
251
  return headers;
207
252
  }
208
253
 
209
- // src/lib/terminal-safe.ts
210
- function replaceIsolatedSurrogates(value) {
211
- let out = "";
212
- for (let index = 0; index < value.length; index += 1) {
213
- const unit = value.charCodeAt(index);
214
- if (unit >= 55296 && unit <= 56319) {
215
- const next = value.charCodeAt(index + 1);
216
- if (next >= 56320 && next <= 57343) {
217
- out += value[index] + value[index + 1];
218
- index += 1;
219
- } else {
220
- out += "\uFFFD";
221
- }
222
- } else if (unit >= 56320 && unit <= 57343) {
223
- out += "\uFFFD";
224
- } else {
225
- out += value[index];
226
- }
227
- }
228
- return out;
229
- }
230
- function isUnsafeTerminalCodePoint(point) {
231
- const c0OrC1 = point <= 31 || point >= 127 && point <= 159;
232
- const bidiOrZeroWidth = point === 173 || // soft hyphen
233
- point === 1564 || // Arabic letter mark
234
- point === 6158 || // Mongolian vowel separator
235
- point >= 8203 && point <= 8207 || // zero-width + directional marks
236
- point >= 8234 && point <= 8238 || // bidi embeddings/overrides
237
- point >= 8288 && point <= 8303 || // word joiner + bidi isolates/controls
238
- point >= 65529 && point <= 65531 || // interlinear annotation controls
239
- point === 65279 || // zero-width no-break space / BOM
240
- point >= 917504 && point <= 917631;
241
- return c0OrC1 || bidiOrZeroWidth;
242
- }
243
- function terminalSafeText(value) {
244
- return Array.from(replaceIsolatedSurrogates(value)).filter((character) => !isUnsafeTerminalCodePoint(character.codePointAt(0) ?? 0)).join("");
245
- }
246
- function terminalSafeLine(value) {
247
- return terminalSafeText(value.replace(/\s+/gu, " ")).replace(/\s+/gu, " ").trim();
248
- }
249
- function isTerminalSafeText(value) {
250
- return terminalSafeText(value) === value;
251
- }
252
- var stripControlChars = terminalSafeText;
253
-
254
254
  // src/client.ts
255
255
  var CONFIG_DIR_MODE = 448;
256
256
  var CREDENTIAL_FILE_MODE = 384;