codiedev 0.9.80 → 0.10.0-beta.10

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 (154) hide show
  1. package/README.md +12 -5
  2. package/dist/backup/cache.js +1 -5
  3. package/dist/backup/match.js +0 -6
  4. package/dist/backup/run.js +3 -35
  5. package/dist/captureExclusions.js +0 -12
  6. package/dist/captureLog.js +0 -28
  7. package/dist/captureReadiness.js +0 -58
  8. package/dist/captureSignals.js +0 -11
  9. package/dist/cli.js +11 -33
  10. package/dist/cliSession.js +3 -60
  11. package/dist/codexHookTrust.js +0 -28
  12. package/dist/codexLimitScan.js +0 -107
  13. package/dist/codie.js +64 -57
  14. package/dist/codieBrandInstall.js +0 -18
  15. package/dist/codieLauncher.js +1 -72
  16. package/dist/codieRuntime.js +27 -32
  17. package/dist/codieRuntimeInstall.js +11 -43
  18. package/dist/codieUsage.js +0 -49
  19. package/dist/commands/agentTemplates.generated.js +136 -0
  20. package/dist/commands/agents.js +1088 -0
  21. package/dist/commands/agentsSdk.generated.js +7 -0
  22. package/dist/commands/ask.js +0 -3
  23. package/dist/commands/capture.js +0 -2
  24. package/dist/commands/createTicket.js +0 -10
  25. package/dist/commands/doctor.js +2 -72
  26. package/dist/commands/evals.js +3 -9
  27. package/dist/commands/inbox.js +0 -2
  28. package/dist/commands/library.js +0 -3
  29. package/dist/commands/pack.js +0 -29
  30. package/dist/commands/ping.js +0 -2
  31. package/dist/commands/pull.js +0 -9
  32. package/dist/commands/push.js +0 -12
  33. package/dist/commands/search.js +0 -4
  34. package/dist/commands/send.js +0 -5
  35. package/dist/commands/share.js +0 -4
  36. package/dist/commands/shared.js +0 -35
  37. package/dist/commands/traces.js +0 -13
  38. package/dist/commands/tracesLabel.js +0 -8
  39. package/dist/configDir.js +1 -18
  40. package/dist/connect.js +3 -75
  41. package/dist/connectFlow.js +0 -15
  42. package/dist/copilotHooks.js +0 -67
  43. package/dist/copilotInstallation.js +0 -1
  44. package/dist/cursorHooks.js +1 -11
  45. package/dist/cursorLifecycle.js +1 -7
  46. package/dist/detection.js +0 -30
  47. package/dist/harnessDirs.js +0 -19
  48. package/dist/hook.js +43 -293
  49. package/dist/inboxFormat.js +0 -24
  50. package/dist/launchContext.js +0 -50
  51. package/dist/launcher.js +0 -33
  52. package/dist/limitEvent.js +2 -34
  53. package/dist/managedPi.js +2 -50
  54. package/dist/mcp.js +0 -48
  55. package/dist/nativeSteering.js +1 -4
  56. package/dist/packs/codie.js +0 -15
  57. package/dist/packs/harnesses.js +1 -38
  58. package/dist/packs/hookGate.js +0 -33
  59. package/dist/packs/install.js +0 -20
  60. package/dist/packs/manifest.js +1 -15
  61. package/dist/packs/paths.js +0 -8
  62. package/dist/packs/shim.js +0 -8
  63. package/dist/packs/store.js +0 -12
  64. package/dist/packs/sync.js +0 -20
  65. package/dist/piHooks.js +4 -45
  66. package/dist/piRuntime.js +0 -18
  67. package/dist/repoResolver.js +0 -19
  68. package/dist/secret.js +0 -3
  69. package/dist/selfUpdate.js +2 -77
  70. package/dist/skillMarker.js +0 -14
  71. package/dist/subagents.js +0 -18
  72. package/dist/teamSkillContext.js +0 -1
  73. package/dist/transcriptModels.js +0 -8
  74. package/dist/upgradeNudge.js +1 -30
  75. package/dist/utils.js +165 -768
  76. package/dist/version.js +0 -10
  77. package/dist/versionCheck.js +0 -33
  78. package/package.json +13 -8
  79. package/dist/backup/cache.d.ts +0 -14
  80. package/dist/backup/match.d.ts +0 -2
  81. package/dist/backup/run.d.ts +0 -25
  82. package/dist/captureExclusions.d.ts +0 -30
  83. package/dist/captureLog.d.ts +0 -20
  84. package/dist/captureReadiness.d.ts +0 -65
  85. package/dist/captureSignals.d.ts +0 -47
  86. package/dist/cli.d.ts +0 -15
  87. package/dist/cliSession.d.ts +0 -108
  88. package/dist/codexHookTrust.d.ts +0 -49
  89. package/dist/codexLimitScan.d.ts +0 -64
  90. package/dist/codie.d.ts +0 -2
  91. package/dist/codieBrandInstall.d.ts +0 -11
  92. package/dist/codieLauncher.d.ts +0 -87
  93. package/dist/codieRuntime.d.ts +0 -35
  94. package/dist/codieRuntimeInstall.d.ts +0 -56
  95. package/dist/codieUsage.d.ts +0 -64
  96. package/dist/commands/ask.d.ts +0 -1
  97. package/dist/commands/capture.d.ts +0 -14
  98. package/dist/commands/createTicket.d.ts +0 -27
  99. package/dist/commands/delete.d.ts +0 -1
  100. package/dist/commands/doctor.d.ts +0 -9
  101. package/dist/commands/evals.d.ts +0 -3
  102. package/dist/commands/inbox.d.ts +0 -3
  103. package/dist/commands/library.d.ts +0 -2
  104. package/dist/commands/note.d.ts +0 -1
  105. package/dist/commands/pack.d.ts +0 -54
  106. package/dist/commands/ping.d.ts +0 -1
  107. package/dist/commands/pull.d.ts +0 -2
  108. package/dist/commands/push.d.ts +0 -33
  109. package/dist/commands/search.d.ts +0 -2
  110. package/dist/commands/send.d.ts +0 -2
  111. package/dist/commands/share.d.ts +0 -2
  112. package/dist/commands/shared.d.ts +0 -64
  113. package/dist/commands/traces.d.ts +0 -72
  114. package/dist/commands/tracesLabel.d.ts +0 -24
  115. package/dist/configDir.d.ts +0 -10
  116. package/dist/connect.d.ts +0 -1
  117. package/dist/connectFlow.d.ts +0 -34
  118. package/dist/copilotHooks.d.ts +0 -85
  119. package/dist/copilotInstallation.d.ts +0 -10
  120. package/dist/cursorHooks.d.ts +0 -13
  121. package/dist/cursorLifecycle.d.ts +0 -2
  122. package/dist/detection.d.ts +0 -30
  123. package/dist/harnessDirs.d.ts +0 -15
  124. package/dist/hook.d.ts +0 -6
  125. package/dist/inboxFormat.d.ts +0 -38
  126. package/dist/launchContext.d.ts +0 -46
  127. package/dist/launcher.d.ts +0 -25
  128. package/dist/limitEvent.d.ts +0 -15
  129. package/dist/limitEventReporter.d.ts +0 -21
  130. package/dist/managedPi.d.ts +0 -48
  131. package/dist/mcp.d.ts +0 -12
  132. package/dist/nativeSteering.d.ts +0 -5
  133. package/dist/packs/codie.d.ts +0 -45
  134. package/dist/packs/harnesses.d.ts +0 -74
  135. package/dist/packs/hookGate.d.ts +0 -53
  136. package/dist/packs/install.d.ts +0 -46
  137. package/dist/packs/manifest.d.ts +0 -52
  138. package/dist/packs/paths.d.ts +0 -17
  139. package/dist/packs/shim.d.ts +0 -26
  140. package/dist/packs/store.d.ts +0 -42
  141. package/dist/packs/sync.d.ts +0 -40
  142. package/dist/piHooks.d.ts +0 -22
  143. package/dist/piRuntime.d.ts +0 -26
  144. package/dist/repoResolver.d.ts +0 -17
  145. package/dist/secret.d.ts +0 -1
  146. package/dist/selfUpdate.d.ts +0 -64
  147. package/dist/skillMarker.d.ts +0 -6
  148. package/dist/subagents.d.ts +0 -36
  149. package/dist/teamSkillContext.d.ts +0 -9
  150. package/dist/transcriptModels.d.ts +0 -20
  151. package/dist/upgradeNudge.d.ts +0 -24
  152. package/dist/utils.d.ts +0 -396
  153. package/dist/version.d.ts +0 -1
  154. package/dist/versionCheck.d.ts +0 -68
@@ -5,7 +5,6 @@ exports.normalizeCursorTranscript = normalizeCursorTranscript;
5
5
  exports.isCursorTranscriptEmpty = isCursorTranscriptEmpty;
6
6
  exports.cursorTranscriptHasUsage = cursorTranscriptHasUsage;
7
7
  exports.cursorObservedModel = cursorObservedModel;
8
- /** Normalize Cursor's native hook payload into the shared capture shape. */
9
8
  function normalizeCursorHookInput(input) {
10
9
  const sessionId = firstString(input.session_id, input.sessionId, input.conversation_id);
11
10
  const roots = Array.isArray(input.workspace_roots)
@@ -26,7 +25,6 @@ function normalizeCursorHookInput(input) {
26
25
  ...(duration !== undefined ? { duration_ms: duration } : {}),
27
26
  };
28
27
  }
29
- /** Normalize Cursor message roles and native tools at the capture boundary. */
30
28
  function normalizeCursorTranscript(content) {
31
29
  return content
32
30
  .split("\n")
@@ -51,17 +49,11 @@ function normalizeCursorTranscript(content) {
51
49
  return JSON.stringify({ ...entry, type, ...(message ? { message: { ...message, content } } : {}) });
52
50
  }
53
51
  catch {
54
- // Preserve malformed/non-JSON lines; tolerant downstream parsers skip
55
- // anything they cannot consume.
56
52
  }
57
53
  return line;
58
54
  })
59
55
  .join("\n");
60
56
  }
61
- /** Cursor may change its private JSONL record shape independently of the hook
62
- * contract. Only a byte-empty snapshot is safe to discard; a non-empty file
63
- * that the current normalizer cannot parse must still be uploaded for backend
64
- * recovery and diagnosis. */
65
57
  function isCursorTranscriptEmpty(content) {
66
58
  return content.trim().length === 0;
67
59
  }
@@ -71,8 +63,6 @@ function firstString(...values) {
71
63
  function firstNumber(...values) {
72
64
  return values.find((value) => typeof value === "number" && Number.isFinite(value));
73
65
  }
74
- /** The IDE transcript often omits usage entirely; absence must not become
75
- * measured zero. CLI records with explicit token fields retain their totals. */
76
66
  function cursorTranscriptHasUsage(content) {
77
67
  return content.split("\n").some((line) => {
78
68
  try {
@@ -93,7 +83,7 @@ function cursorObservedModel(content) {
93
83
  if (event.subtype === "cursor_model" && typeof event.model === "string")
94
84
  model = event.model;
95
85
  }
96
- catch { /* partial records */ }
86
+ catch { }
97
87
  }
98
88
  return model;
99
89
  }
@@ -40,7 +40,6 @@ const path = __importStar(require("path"));
40
40
  const crypto = __importStar(require("crypto"));
41
41
  const configDir_1 = require("./configDir");
42
42
  const limitEvent_1 = require("./limitEvent");
43
- /** Retain aborted-turn evidence across non-final captures, which are snapshots. */
44
43
  function fileFor(sessionId) {
45
44
  const key = crypto.createHash("sha256").update(sessionId).digest("hex");
46
45
  return path.join((0, configDir_1.codiedevStateDir)(), "cursor-lifecycle", `${key}.json`);
@@ -54,15 +53,12 @@ function recordCursorLifecycle(input, final) {
54
53
  try {
55
54
  state = JSON.parse(fs.readFileSync(file, "utf8"));
56
55
  }
57
- catch { /* first observation */ }
56
+ catch { }
58
57
  const model = typeof input.model_id === "string" && input.model_id.trim() ? input.model_id
59
58
  : typeof input.model === "string" && input.model.trim() ? input.model : undefined;
60
59
  if (model)
61
60
  state.model = model;
62
61
  const event = typeof input.hook_event_name === "string" ? input.hook_event_name : final ? "sessionEnd" : "stop";
63
- // sessionEnd can arrive long after the agent stopped. Do not count that
64
- // window-open time as active work. These are observed hook times, not
65
- // invented per-message timestamps.
66
62
  if (event !== "sessionEnd" || !state.observations?.length) {
67
63
  const timestamp = new Date().toISOString();
68
64
  state.observations = [...(state.observations ?? []), { event, timestamp, ...(model ? { model } : {}) }].slice(-1000);
@@ -84,8 +80,6 @@ function recordCursorLifecycle(input, final) {
84
80
  state.rejections = [...new Set([...(state.rejections ?? []), rejectionId])].slice(-1000);
85
81
  }
86
82
  const aborted = status === "aborted" || input.is_interrupt === true;
87
- // sessionEnd after an aborted stop is the same interruption. A repeated
88
- // stop with the same generation_id is likewise a retry, not another turn.
89
83
  const id = typeof input.generation_id === "string" ? input.generation_id
90
84
  : `${Date.now()}-${state.ids.length}`;
91
85
  if (aborted && !(final && state.lastStatus === "aborted") && !state.ids.includes(id))
package/dist/detection.js CHANGED
@@ -1,44 +1,14 @@
1
1
  "use strict";
2
- // Pure detection helpers — runtime probes (fs / PATH lookup) live in utils.ts
3
- // and feed these. Splitting them out makes the truth-table testable without
4
- // mocking fs or process.
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.detectClaudeCode = detectClaudeCode;
7
4
  exports.isCodiedevHookCommand = isCodiedevHookCommand;
8
- /**
9
- * Claude Code is "installed" if either ~/.claude exists (the user has
10
- * launched the app at least once) OR the `claude` binary is on PATH (the
11
- * user installed via npm/brew but hasn't launched yet). Either signal is
12
- * sufficient — we want to wire up the hook the moment the user has
13
- * obviously committed to the tool.
14
- */
15
5
  function detectClaudeCode(probe) {
16
6
  return probe.dirExists || probe.binOnPath;
17
7
  }
18
- /**
19
- * True iff `cmd` looks like a hook command codiedev itself wrote. Used
20
- * both by the install filter (so `connect` replaces the existing entry
21
- * instead of stacking another one) and by `codiedev doctor` (so it can
22
- * grade whether the hook is wired up).
23
- *
24
- * Must match every form codiedev can write:
25
- * - Legacy `npx codiedev-hook <subcommand>`
26
- * - Absolute path from npm-registry install:
27
- * `<node> /.../node_modules/codiedev/dist/hook.js <subcommand>`
28
- * - Absolute path from `npm link` dev install (the monorepo folder
29
- * is named `codiedev-cli`, not `codiedev`):
30
- * `<node> /.../codiedev-cli/dist/hook.js <subcommand>`
31
- *
32
- * The `codiedev[^/\\]*` allows the trailing `-cli` (or any future suffix)
33
- * without matching unrelated paths like `notcodiedev/dist/hook.js`.
34
- */
35
8
  function isCodiedevHookCommand(cmd) {
36
9
  if (!cmd)
37
10
  return false;
38
11
  if (cmd.includes("codiedev-hook"))
39
12
  return true;
40
- // Anchor at a path separator (or string start) so we don't match
41
- // unrelated paths like `notcodiedev/dist/hook.js` that happen to contain
42
- // the substring `codiedev`.
43
13
  return /(?:^|[\\/])codiedev[^/\\]*[\\/]dist[\\/]hook/.test(cmd);
44
14
  }
@@ -41,14 +41,6 @@ exports.piAgentDir = piAgentDir;
41
41
  exports.displayPath = displayPath;
42
42
  exports.claudeConfigDirInUse = claudeConfigDirInUse;
43
43
  exports.codexHomeInUse = codexHomeInUse;
44
- // Where each coding agent reads its user config from. Every harness lets the
45
- // user relocate it with an env var; installing into the default dir when the
46
- // var is set writes hooks the agent never loads (a container with
47
- // CLAUDE_CONFIG_DIR=/home/node/.claude while HOME=/root captured nothing for
48
- // two weeks while doctor reported ✓). Same shape as copilotHome().
49
- //
50
- // Imports only node built-ins so utils.ts, doctor.ts and the hook path
51
- // can all import it without a cycle.
52
44
  const fs = __importStar(require("fs"));
53
45
  const os = __importStar(require("os"));
54
46
  const path = __importStar(require("path"));
@@ -56,40 +48,29 @@ function override(value) {
56
48
  const trimmed = value?.trim();
57
49
  return trimmed ? path.resolve(trimmed) : undefined;
58
50
  }
59
- /** Claude Code: `$CLAUDE_CONFIG_DIR` or ~/.claude. */
60
51
  function claudeConfigDir(env = process.env, home = os.homedir()) {
61
52
  return override(env.CLAUDE_CONFIG_DIR) ?? path.join(home, ".claude");
62
53
  }
63
- /** Claude Code's user state file. Lives inside `$CLAUDE_CONFIG_DIR` when set, else ~/.claude.json. */
64
54
  function claudeUserConfigPath(env = process.env, home = os.homedir()) {
65
55
  const dir = override(env.CLAUDE_CONFIG_DIR);
66
56
  return dir ? path.join(dir, ".claude.json") : path.join(home, ".claude.json");
67
57
  }
68
- /** Codex: `$CODEX_HOME` or ~/.codex. */
69
58
  function codexHome(env = process.env, home = os.homedir()) {
70
59
  return override(env.CODEX_HOME) ?? path.join(home, ".codex");
71
60
  }
72
- /** OpenCode: `$XDG_CONFIG_HOME/opencode` or ~/.config/opencode. */
73
61
  function openCodeConfigDir(env = process.env, home = os.homedir()) {
74
62
  return path.join(override(env.XDG_CONFIG_HOME) ?? path.join(home, ".config"), "opencode");
75
63
  }
76
- /** pi: `$PI_CODING_AGENT_DIR` or ~/.pi/agent. Holds extensions/, skills/,
77
- * sessions/ and the global AGENTS.md. */
78
64
  function piAgentDir(env = process.env, home = os.homedir()) {
79
65
  return override(env.PI_CODING_AGENT_DIR) ?? path.join(home, ".pi", "agent");
80
66
  }
81
- /** `~`-abbreviated path for user-facing output. */
82
67
  function displayPath(p, home = os.homedir()) {
83
68
  return p === home || p.startsWith(home + path.sep) ? "~" + p.slice(home.length) : p;
84
69
  }
85
- // Files/dirs Claude Code writes on first real use. Our installer only writes
86
- // settings.json + CLAUDE.md, so a dir holding nothing but those is one Claude
87
- // Code has never run against — the hooks in it will never fire.
88
70
  const CLAUDE_USAGE_MARKERS = ["projects", "history.jsonl", "sessions", "statsig", "todos", "shell-snapshots"];
89
71
  function claudeConfigDirInUse(dir = claudeConfigDir(), exists = fs.existsSync) {
90
72
  return CLAUDE_USAGE_MARKERS.some((m) => exists(path.join(dir, m)));
91
73
  }
92
- // Codex writes rollouts under sessions/ and keeps history.jsonl alongside.
93
74
  const CODEX_USAGE_MARKERS = ["sessions", "history.jsonl", "auth.json"];
94
75
  function codexHomeInUse(dir = codexHome(), exists = fs.existsSync) {
95
76
  return CODEX_USAGE_MARKERS.some((m) => exists(path.join(dir, m)));