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
package/dist/version.js CHANGED
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- // Resolves the running CLI version. Read once at startup so subsequent
3
- // auth calls don't pay an fs.readFile per request.
4
- //
5
- // We could `import packageJson from "../package.json"` but that requires
6
- // `resolveJsonModule` and emits the JSON into dist. Reading at runtime
7
- // keeps the bundle smaller and works regardless of tsconfig settings.
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -43,9 +37,6 @@ exports.CLI_VERSION = void 0;
43
37
  const fs = __importStar(require("fs"));
44
38
  const path = __importStar(require("path"));
45
39
  function resolveCliVersion() {
46
- // dist/version.js sits alongside dist/cli.js. The package.json is one
47
- // directory up from dist/, i.e. `../package.json` relative to this file.
48
- // In TS source we're at src/version.ts so the path is `../package.json`.
49
40
  const candidates = [
50
41
  path.join(__dirname, "..", "package.json"),
51
42
  path.join(__dirname, "..", "..", "package.json"),
@@ -59,7 +50,6 @@ function resolveCliVersion() {
59
50
  }
60
51
  }
61
52
  catch {
62
- // try next candidate
63
53
  }
64
54
  }
65
55
  return "0.0.0";
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- // Pure version-comparison helpers for the "is your CLI outdated" warning.
3
- // The IO (fetching npm registry, reading/writing the cache file) lives in
4
- // connect.ts/doctor.ts and is exercised by manual smoke. Keeping the policy
5
- // pure means the truth table is unit-testable without mocking fetch or fs.
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.parseSemver = parseSemver;
8
4
  exports.compareSemver = compareSemver;
@@ -19,13 +15,6 @@ function parseSemver(input) {
19
15
  return null;
20
16
  return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) };
21
17
  }
22
- /**
23
- * Returns -1 if a < b, 0 if equal, 1 if a > b.
24
- *
25
- * Malformed input on either side returns 0 — we never want to nag a user
26
- * because of garbage version strings (corrupt cache, registry returned
27
- * something weird, prerelease format we don't recognize).
28
- */
29
18
  function compareSemver(a, b) {
30
19
  const pa = parseSemver(a);
31
20
  const pb = parseSemver(b);
@@ -39,25 +28,11 @@ function compareSemver(a, b) {
39
28
  return pa.patch < pb.patch ? -1 : 1;
40
29
  return 0;
41
30
  }
42
- /**
43
- * Warning policy: only show when we have a known-newer `latest` from a
44
- * recent-enough cache. Stale-cache freshness is enforced by the *caller*
45
- * (which decides whether to refetch); this helper takes the cache state
46
- * as-given and answers a single question — should the user see a nag?
47
- */
48
31
  function shouldShowUpdateWarning(input) {
49
32
  if (!input.latest)
50
33
  return false;
51
34
  return compareSemver(input.current, input.latest) === -1;
52
35
  }
53
- /**
54
- * npx — running from npm's _npx cache; nothing to upgrade in place.
55
- * container — baked into an image; the honest fix is rebuilding it.
56
- * global — a real install directory we can write to. Upgradable.
57
- * readonly — a real install directory we cannot write to (root-owned global
58
- * on a shared box, read-only mount). Needs sudo, so print rather
59
- * than attempt an upgrade that would EACCES.
60
- */
61
36
  function resolveInstallKind(deps) {
62
37
  if (/[\\/](?:_npx|\.npm[\\/]_npx)[\\/]/.test(deps.dirname))
63
38
  return "npx";
@@ -71,10 +46,8 @@ function resolveInstallKind(deps) {
71
46
  }
72
47
  }
73
48
  catch {
74
- // not Linux, or no procfs — fall through to the writability probe
75
49
  }
76
50
  try {
77
- // 2 = fs.constants.W_OK, inlined so this module stays fs-free.
78
51
  deps.accessSync(deps.dirname, 2);
79
52
  return "global";
80
53
  }
@@ -94,12 +67,6 @@ function upgradeCommand(kind, pkg = "codiedev") {
94
67
  return `npm i -g ${pkg}@latest`;
95
68
  }
96
69
  }
97
- /**
98
- * `promptedAt` makes a decline stick until the next window instead of asking
99
- * on every launch. It is deliberately not keyed to a dismissed version:
100
- * somebody who says no today should be asked again tomorrow, not silently
101
- * stranded on that version forever.
102
- */
103
70
  function decideUpdateAction(input) {
104
71
  const command = upgradeCommand(input.installKind, input.pkg);
105
72
  const ttl = input.cacheTtlMs ?? 24 * 60 * 60 * 1000;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codiedev",
3
- "version": "0.9.80",
4
- "description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration — and run the governed Codie harness",
3
+ "version": "0.10.0-beta.10",
4
+ "description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration \u2014 and run the governed Codie harness",
5
5
  "bin": {
6
6
  "codiedev": "dist/cli.js",
7
7
  "codiedev-hook": "dist/hook.js",
@@ -15,9 +15,8 @@
15
15
  "test:functional": "vitest run src/__tests__/limitEvent.functional.test.ts src/__tests__/harnessParity.functional.test.ts src/__tests__/cursorParity.functional.test.ts src/__tests__/copilotCapture.functional.test.ts src/__tests__/piCapture.functional.test.ts",
16
16
  "test:harness-parity": "vitest run src/__tests__/harnessParity.functional.test.ts src/__tests__/cursorParity.functional.test.ts src/__tests__/copilotCapture.functional.test.ts src/__tests__/piCapture.functional.test.ts",
17
17
  "test:harness-binaries": "node scripts/checkHarnessBinaries.mjs",
18
+ "test:opencode-attribution": "vitest run src/__tests__/repoResolver.test.ts src/__tests__/openCodeCapture.test.ts src/__tests__/openCodePluginGitRefs.test.ts src/__tests__/capturePayloadFinal.test.ts src/__tests__/captureDirectUpload.test.ts src/__tests__/resolveCaptureFinal.test.ts && tsc",
18
19
  "test:watch": "vitest",
19
- "test:live-sources": "npm run build && node scripts/liveSourceParity.mjs",
20
- "test:ide-sources": "npm run build && node scripts/liveSourceParity.mjs --ide",
21
20
  "test:metadata-parity": "vitest run src/__tests__/sourceMetadataMatrix.test.ts src/__tests__/copilotCapture.functional.test.ts src/__tests__/copilotCapture.test.ts src/__tests__/piCapture.functional.test.ts src/__tests__/piHooks.test.ts src/__tests__/cursorParity.functional.test.ts src/__tests__/nativeSourceParity.test.ts src/__tests__/harnessParity.functional.test.ts src/__tests__/subagents.test.ts src/__tests__/transcriptModels.test.ts src/__tests__/captureRetry.test.ts src/__tests__/limitEvent.functional.test.ts src/__tests__/captureExclusions.test.ts"
22
21
  },
23
22
  "files": [
@@ -41,24 +40,30 @@
41
40
  "session-capture"
42
41
  ],
43
42
  "homepage": "https://codiedev.com",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/Signal-and-Code/codiedev.git",
46
+ "directory": "packages/codiedev-cli"
47
+ },
44
48
  "license": "MIT",
45
49
  "engines": {
46
50
  "node": ">=18"
47
51
  },
48
52
  "publishConfig": {
49
- "access": "public"
53
+ "access": "public",
54
+ "provenance": true
50
55
  },
51
56
  "devDependencies": {
52
57
  "@types/node": "^20.0.0",
53
58
  "typescript": "^5.4.0",
54
- "vitest": "^3.2.6"
59
+ "vitest": "^4.1.11"
55
60
  },
56
61
  "dependencies": {
57
62
  "@modelcontextprotocol/sdk": "^1.30.0"
58
63
  },
59
64
  "overrides": {
60
- "@hono/node-server": "^2.0.12",
61
- "ip-address": "^10.4.0",
65
+ "@hono/node-server": "^2.1.5",
66
+ "ip-address": "^10.7.4",
62
67
  "esbuild": "^0.28.1"
63
68
  }
64
69
  }
@@ -1,14 +0,0 @@
1
- import * as fs from "fs";
2
- export type HashCache = Record<string, string>;
3
- export interface Candidate {
4
- rel: string;
5
- hash: string;
6
- abs?: string;
7
- }
8
- export declare function cacheKey(repoKey: string, rel: string): string;
9
- export declare function loadCache(readFileSync?: typeof fs.readFileSync): HashCache;
10
- export declare function saveCache(cache: HashCache, deps?: typeof fs): void;
11
- export declare function applyCache(prev: HashCache, repoKey: string, candidates: Candidate[]): {
12
- changed: Candidate[];
13
- next: HashCache;
14
- };
@@ -1,2 +0,0 @@
1
- export declare function hasSkillFrontmatter(md: string): boolean;
2
- export declare function isArtifactPath(rel: string, getContent: () => string): boolean;
@@ -1,25 +0,0 @@
1
- import { type HashCache, type Candidate } from "./cache";
2
- export interface SelectDeps {
3
- readFile: (rel: string) => string;
4
- sha256: (content: string) => string;
5
- }
6
- export declare function unionPaths(a: string[], b: string[]): string[];
7
- export declare function selectBackupFiles(input: {
8
- repoKey: string;
9
- statusPaths: string[];
10
- prevCache: HashCache;
11
- deps: SelectDeps;
12
- }): {
13
- changed: Candidate[];
14
- next: HashCache;
15
- };
16
- import { readConfig } from "../utils";
17
- import { loadCache, saveCache } from "./cache";
18
- export declare function gitCandidatePaths(root: string): string[];
19
- export declare function runBackup(cwd: string, hookScriptPath: string): void;
20
- export interface BackupUploadDeps {
21
- readConfig: typeof readConfig;
22
- loadCache: typeof loadCache;
23
- saveCache: typeof saveCache;
24
- }
25
- export declare function runBackupUpload(jobFile: string, deps?: BackupUploadDeps): Promise<void>;
@@ -1,30 +0,0 @@
1
- import type { CodiedevConfig } from "./utils";
2
- export interface NormalizeCapturePathDeps {
3
- cwd?: () => string;
4
- homedir?: () => string;
5
- realpathSync?: (value: string) => string;
6
- }
7
- /**
8
- * Convert a user-entered path into the canonical absolute form persisted in
9
- * ~/.codiedev/config.json. Existing symlinks resolve to their real target so a
10
- * session cannot bypass an exclusion by entering the same folder through a
11
- * different alias. Non-existent paths still normalize deterministically.
12
- */
13
- export declare function normalizeCapturePath(input: string, deps?: NormalizeCapturePathDeps): string;
14
- export declare function findMatchingCaptureExclusion(candidate: string | string[] | undefined, ignoredPaths: string[] | undefined): string | null;
15
- export declare function isCaptureIgnored(candidate: string | string[] | undefined, ignoredPaths: string[] | undefined): boolean;
16
- export interface CaptureScopeInput {
17
- cwd?: string;
18
- workspace_roots?: string[];
19
- }
20
- /** Every local root associated with a hook event, deduped in stable order. */
21
- export declare function captureScopePaths(input: CaptureScopeInput, fallback?: string): string[];
22
- export declare function shouldIgnoreCaptureInput(config: Pick<CodiedevConfig, "captureIgnoredPaths"> | null | undefined, input: CaptureScopeInput, fallback?: string): boolean;
23
- /**
24
- * Final egress decision for queued transcript uploads. Jobs written by older
25
- * CLI versions have no scope metadata; once any exclusion exists, dropping
26
- * those legacy jobs is safer than guessing that they are public.
27
- */
28
- export declare function shouldSkipCaptureUploadJob(job: {
29
- scopePaths?: string[];
30
- }, config: Pick<CodiedevConfig, "captureIgnoredPaths"> | null | undefined): boolean;
@@ -1,20 +0,0 @@
1
- import * as fs from "fs";
2
- export declare const CAPTURE_LOG_MAX_BYTES: number;
3
- export declare const CAPTURE_LOG_PATH: string;
4
- export interface CaptureLogEntry {
5
- stage: "capture-finish" | "upload" | "upload-deferred" | "stderr" | "limit" | "self-update";
6
- sessionId: string | undefined;
7
- outcome: string;
8
- detail?: string;
9
- }
10
- interface LogDeps {
11
- readFileSync: typeof fs.readFileSync;
12
- writeFileSync: typeof fs.writeFileSync;
13
- appendFileSync: typeof fs.appendFileSync;
14
- existsSync: typeof fs.existsSync;
15
- mkdirSync: typeof fs.mkdirSync;
16
- statSync: typeof fs.statSync;
17
- }
18
- export declare function appendCaptureLog(entry: CaptureLogEntry, deps?: LogDeps, filePath?: string, now?: () => number): void;
19
- export declare function readCaptureLogTail(n: number, deps?: Pick<LogDeps, "readFileSync" | "existsSync">, filePath?: string): string[];
20
- export {};
@@ -1,65 +0,0 @@
1
- import type { LastCaptureRecord } from "./utils";
2
- export interface CaptureReadinessDeps<R = unknown> {
3
- exec: (cmd: string, cwd: string) => string;
4
- getRemoteUrl: (cwd: string) => string | null;
5
- matchRepo: (url: string, repos: R[]) => R | null;
6
- getBranch: (cwd: string) => string | null;
7
- getHeadSha: (cwd: string) => string | null;
8
- }
9
- export interface CaptureReadiness {
10
- gitOnPath: boolean;
11
- insideWorkTree: boolean;
12
- remoteUrl: string | null;
13
- matched: boolean;
14
- branch: string | null;
15
- headSha: string | null;
16
- }
17
- export declare function assessCaptureReadiness<R>(cwd: string, repos: R[], deps: CaptureReadinessDeps<R>): CaptureReadiness;
18
- export interface WorkspaceRepoScanDeps<R = unknown> {
19
- listChildDirs: (cwd: string) => string[];
20
- isRepo: (dir: string) => boolean;
21
- getRemoteUrl: (dir: string) => string | null;
22
- matchRepo: (url: string, repos: R[]) => R | null;
23
- }
24
- export interface WorkspaceRepoScan {
25
- repoCount: number;
26
- matchedCount: number;
27
- }
28
- export declare function assessWorkspaceRepos<R>(cwd: string, repos: R[], deps: WorkspaceRepoScanDeps<R>): WorkspaceRepoScan;
29
- export declare function formatRelativeAge(ms: number): string;
30
- export interface LastCaptureSummary {
31
- status: "pass" | "warn";
32
- detail: string;
33
- }
34
- export declare function summarizeLastCapture(record: LastCaptureRecord | null, nowMs: number): LastCaptureSummary;
35
- export interface CaptureActivitySummary {
36
- status: "pass" | "warn" | "fail";
37
- detail: string;
38
- }
39
- /**
40
- * When `text` (an error message, code, or capture.log detail) indicates a
41
- * TLS-trust failure from SSL inspection, return the remediation hint;
42
- * otherwise null.
43
- */
44
- export declare function tlsInterceptionHint(text: string, host: string): string | null;
45
- /**
46
- * Flatten a thrown fetch/network error to "<message> (<code>)". undici's
47
- * fetch wraps the real failure in TypeError("fetch failed") with the cause
48
- * chained on `.cause` — walk to the deepest cause so doctor reports the
49
- * actual TLS/socket error instead of "fetch failed".
50
- */
51
- export declare function describeFetchError(err: unknown): string;
52
- export declare function summarizeCaptureActivity(tailLines: string[], pendingJobCount: number, backendHost?: string): CaptureActivitySummary;
53
- export interface ServerCaptureResponse {
54
- found: boolean;
55
- latest: {
56
- sessionId: string;
57
- capturedAt: number;
58
- createdAt: number;
59
- repoMatched: boolean;
60
- branch: string | null;
61
- headSha: string | null;
62
- } | null;
63
- sessionFound?: boolean;
64
- }
65
- export declare function summarizeServerCapture(server: ServerCaptureResponse | null, local: LastCaptureRecord | null, nowMs: number): LastCaptureSummary;
@@ -1,47 +0,0 @@
1
- export declare const CAPTURE_SIGNALS_VERSION = 1;
2
- export type CaptureSignals = {
3
- version: 1;
4
- parsedRecords: number;
5
- timestampCount: number;
6
- firstAt?: number;
7
- lastAt?: number;
8
- activeMs: number;
9
- idleThresholdMs: number;
10
- skillInvocations: string[];
11
- /** How many times each invoked skill ran (each Skill tool call and each
12
- * slash command): three review runs in one session count three. Absent
13
- * from older CLIs, which only sent the unique set above. */
14
- skillInvocationCounts?: Array<{
15
- skill: string;
16
- count: number;
17
- }>;
18
- /** Which skill ARTIFACT an invocation ran, when the loaded skill content
19
- * carried a `codiedev:artifact=<id>` marker. Lets the server tell two
20
- * authors' same-named skills apart. Absent when no marker was seen. */
21
- skillInvocationArtifacts?: Array<{
22
- skill: string;
23
- artifactId: string;
24
- }>;
25
- skillPulls: string[];
26
- toolCalls: Array<{
27
- name: string;
28
- calls: number;
29
- }>;
30
- /** How the harness was launched, raw: Claude Code's "cli" / "sdk-cli",
31
- * Codex's "codex:cli" / "codex:exec". Absent when the harness records none. */
32
- entrypoints?: string[];
33
- /** Claude Code subagent transcripts folded into these signals. */
34
- subagents?: {
35
- count: number;
36
- truncated: boolean;
37
- };
38
- /** GitHub Copilot subscription usage: premium requests and nano-AIU, from
39
- * the session's latest usage checkpoint or its shutdown. Not dollars. */
40
- premiumRequests?: number;
41
- nanoAiu?: number;
42
- truncated: boolean;
43
- };
44
- /** Compact diagnostic inputs only: never persist prompts, commands or tool output. */
45
- export declare function parseCaptureSignals(content: string, source?: string): CaptureSignals;
46
- /** Add a launch value the hook detected (harnesses that do not record one). */
47
- export declare function withLaunch(signals: CaptureSignals, launch: string | undefined): CaptureSignals;
package/dist/cli.d.ts DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Codiedev CLI dispatcher.
4
- *
5
- * Subcommands:
6
- * codiedev connect — link agent CLIs to your org
7
- * codiedev push <file> — author/update a spec/review/decision/etc.
8
- * codiedev pull <key> — fetch an artifact by filename key
9
- * codiedev ping <user> "<msg>" — send a message (optionally --with <key>)
10
- * codiedev inbox — list pings (use --unread to filter)
11
- * codiedev read <ping-id> — mark read + show full message
12
- * codiedev note "<text>" — capture a thought
13
- * codiedev help — show this help
14
- */
15
- export {};
@@ -1,108 +0,0 @@
1
- import type { CodiedevConfig } from "./utils";
2
- export interface BrowserAuth {
3
- kind: "browser";
4
- clientId: string;
5
- refreshToken: string;
6
- /** epoch ms when `token` (the access token) stops working */
7
- accessTokenExpiresAt: number;
8
- }
9
- export interface TokenSet {
10
- accessToken: string;
11
- refreshToken: string;
12
- expiresAt: number;
13
- clientId: string;
14
- }
15
- /** Default: refresh when less than 10 minutes remain. */
16
- export declare const DEFAULT_MIN_VALIDITY_MS: number;
17
- /** A lock older than this was left by a crashed process. Refresh calls time
18
- * out well before it (REFRESH_TIMEOUT_MS), so a live holder never looks stale. */
19
- export declare const LOCK_STALE_MS = 30000;
20
- export interface SessionDeps {
21
- configPath: string;
22
- fetchImpl?: typeof fetch;
23
- now?: () => number;
24
- sleep?: (ms: number) => Promise<void>;
25
- }
26
- export declare function readConfigAt(configPath: string): CodiedevConfig | null;
27
- /** rename(), retrying the transient Windows sharing errors. Exported for tests. */
28
- export declare function renameWithRetry(from: string, to: string, rename?: (a: string, b: string) => void, sleep?: (ms: number) => void): void;
29
- /**
30
- * Write via temp file + rename so a concurrent reader never sees a torn file.
31
- * If the rename still fails after ~1.6s of retries (a handle held that long),
32
- * fall back to writing in place: a rare torn read beats failing `connect`.
33
- */
34
- export declare function writeConfigAtomic(configPath: string, config: CodiedevConfig): void;
35
- export type FreshResult = {
36
- status: "fresh";
37
- config: CodiedevConfig;
38
- } | {
39
- status: "refreshed";
40
- config: CodiedevConfig;
41
- } | {
42
- status: "adopted";
43
- config: CodiedevConfig;
44
- } | {
45
- status: "unavailable";
46
- config: CodiedevConfig;
47
- } | {
48
- status: "signed_out";
49
- config: CodiedevConfig;
50
- } | {
51
- status: "none";
52
- config: CodiedevConfig | null;
53
- };
54
- /**
55
- * Make sure config.token is a usable access token for at least
56
- * `minValidityMs`. Never throws: auth problems surface as the next request's
57
- * 401, which every command already explains.
58
- */
59
- export declare function ensureFreshToken(deps: SessionDeps, minValidityMs?: number): Promise<FreshResult>;
60
- export declare function pkcePair(): {
61
- verifier: string;
62
- challenge: string;
63
- };
64
- export declare function openBrowser(url: string): boolean;
65
- export interface LoginOptions {
66
- backendUrl: string;
67
- clientName?: string;
68
- fetchImpl?: typeof fetch;
69
- /** Test hook: called with the authorize URL instead of opening a browser. */
70
- onAuthorizeUrl?: (url: string) => void;
71
- log?: (line: string) => void;
72
- now?: () => number;
73
- }
74
- /** Parse `code`/`state` (or `error`) out of a loopback callback URL. */
75
- export declare function parseCallback(input: string): {
76
- code?: string;
77
- state?: string;
78
- error?: string;
79
- };
80
- export declare function browserLogin(opts: LoginOptions): Promise<TokenSet>;
81
- export declare const DEVICE_CODE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
82
- /**
83
- * True when a browser opened here can't reach the user: an SSH session, or a
84
- * Linux box with no display. Then `connect` uses the device flow (a code the
85
- * user approves on any device) instead of a loopback redirect, with no flag.
86
- */
87
- export declare function isHeadless(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
88
- export interface DeviceLoginOptions {
89
- backendUrl: string;
90
- clientName?: string;
91
- fetchImpl?: typeof fetch;
92
- log?: (line: string) => void;
93
- now?: () => number;
94
- sleep?: (ms: number) => Promise<void>;
95
- /** Test hook: receives the code + link instead of only printing them. */
96
- onCode?: (info: {
97
- userCode: string;
98
- verificationUri: string;
99
- verificationUriComplete: string;
100
- }) => void;
101
- }
102
- export declare function deviceLogin(opts: DeviceLoginOptions): Promise<TokenSet>;
103
- /** `codiedev logout`: end a browser sign-in server-side, forget it locally. */
104
- export declare function logout(deps: SessionDeps): Promise<{
105
- wasConnected: boolean;
106
- hadBrowserAuth: boolean;
107
- serverRevoked: boolean;
108
- }>;
@@ -1,49 +0,0 @@
1
- interface CommandHandler {
2
- type?: unknown;
3
- command?: unknown;
4
- commandWindows?: unknown;
5
- command_windows?: unknown;
6
- timeout?: unknown;
7
- async?: unknown;
8
- statusMessage?: unknown;
9
- additionalContextLimit?: unknown;
10
- }
11
- interface MatcherGroup {
12
- matcher?: unknown;
13
- hooks?: unknown;
14
- }
15
- export interface CodexHookTrustEntry {
16
- key: string;
17
- eventName: string;
18
- command: string;
19
- currentHash: string;
20
- /** Plugin hooks only: Codex also pins approval to the bundle's contents. */
21
- contentHash?: string;
22
- }
23
- /** Codex's fingerprint of an installed plugin bundle, byte-for-byte the
24
- * algorithm in codex-rs hooks/src/engine/plugin_fingerprint.rs. Codex skips a
25
- * plugin hook unless `trusted_content_hash` equals this (Codex 0.163+). */
26
- export declare function codexPluginContentHash(root: string): string;
27
- /** Codex hashes a canonical, normalized hook identity before it will execute a
28
- * user hook. Keep this compatible with codex_config::version_for_toml. */
29
- export declare function codexCommandHookHash(eventName: string, group: MatcherGroup, handler: CommandHandler): string;
30
- export declare function codiedevCodexHookTrustEntries(hooksPath: string, hooksFile: unknown): CodexHookTrustEntry[];
31
- /** `codiedev connect` is an explicit install action, so trust only the exact
32
- * Codiedev commands it just wrote. Any later command change produces a new
33
- * hash and Codex disables that hook until connect is run again. */
34
- export declare function writeCodexHookTrust(configPath: string, hooksPath: string, hooksFile: unknown): CodexHookTrustEntry[];
35
- export declare function inspectCodexHookTrust(configPath: string, hooksPath: string, hooksFile: unknown, requiredSubcommands?: string[]): {
36
- ok: boolean;
37
- total: number;
38
- trusted: number;
39
- };
40
- /** Trust entries for every command handler in a pack's hooks.json. */
41
- export declare function packCodexHookTrustEntries(hooksPath: string, hooksFile: unknown, plugin?: {
42
- id: string;
43
- root: string;
44
- }): CodexHookTrustEntry[];
45
- /** Regenerate the pack trust block from scratch with exactly `entries`.
46
- * Entries for packs that were removed or whose hooks changed disappear; the
47
- * `codiedev-hook-trust` block and all other config are left untouched. */
48
- export declare function writeCodexPackHookTrust(configPath: string, entries: CodexHookTrustEntry[]): CodexHookTrustEntry[];
49
- export {};
@@ -1,64 +0,0 @@
1
- import { type LimitEvent } from "./limitEvent";
2
- import type { LimitEventPayload } from "./limitEventReporter";
3
- export interface CodexLimitHit {
4
- event: LimitEvent;
5
- /** Byte offset just past the matched line — the tail ends here, not at EOF. */
6
- lineEnd: number;
7
- }
8
- export interface ScanOptions {
9
- chunkSize?: number;
10
- maxScanBytes?: number;
11
- }
12
- /**
13
- * Find the LAST rate-limit/credit block recorded in a Codex rollout file.
14
- * Returns null when the session was never blocked.
15
- */
16
- export declare function scanCodexRolloutForLimit(filePath: string, options?: ScanOptions): CodexLimitHit | null;
17
- /**
18
- * Read up to `maxBytes` of the rollout ENDING at `lineEnd` — the work the
19
- * developer was doing when the block hit, not whatever the session did after
20
- * the window reset. Resumes at a line boundary so every JSONL line parses.
21
- */
22
- export declare function readTailEndingAt(filePath: string, lineEnd: number, maxBytes?: number): string;
23
- export interface FindRolloutOptions {
24
- withinMs?: number;
25
- maxFiles?: number;
26
- now?: number;
27
- }
28
- /** Codex rollout files, newest first, limited by age and count. */
29
- export declare function findRecentCodexRollouts(sessionsDir: string, options?: FindRolloutOptions): string[];
30
- /** Codex names rollouts `rollout-<ISO local time>-<session id>.jsonl`. */
31
- export declare function sessionIdFromRolloutPath(filePath: string): string | undefined;
32
- /** Where Codex writes its rollout JSONL files. */
33
- export declare function codexSessionsDir(): string;
34
- export declare const CODEX_LIMIT_STATE_PATH: string;
35
- /**
36
- * Record a block reported outside the sweep (the Stop path), so the next
37
- * prompt sweep neither re-scans the rollout nor re-posts the event.
38
- */
39
- export declare function recordCodexLimitReported(filePath: string, at: number, statePath?: string): void;
40
- export interface SweepArgs {
41
- sessionsDir: string;
42
- statePath?: string;
43
- post: (payload: LimitEventPayload) => Promise<void>;
44
- findOptions?: FindRolloutOptions;
45
- scanOptions?: ScanOptions;
46
- /** How many rollouts may actually be READ in one sweep. */
47
- maxScans?: number;
48
- /** Stop starting new scans once this many ms have elapsed. */
49
- deadlineMs?: number;
50
- }
51
- /**
52
- * Report every Codex block this machine has not reported yet. Returns how many
53
- * events were posted. Never throws — it runs inside a hook.
54
- *
55
- * State is kept PER FILE, not as one newest-wins timestamp. A single global
56
- * watermark loses data: rollouts are capped per sweep, so a block in a file
57
- * outside the cap can be older than one already reported and would then be
58
- * suppressed forever. A per-file record can only ever cause a re-report, which
59
- * the server deduplicates on (companyId, userId, at).
60
- *
61
- * A file is recorded only after its POST succeeds, so a failed send is retried
62
- * on the next prompt.
63
- */
64
- export declare function sweepCodexLimits(args: SweepArgs): Promise<number>;
package/dist/codie.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,11 +0,0 @@
1
- /**
2
- * The usage module this install should load. The shipped package has the
3
- * compiled file; a source checkout (and the test run) has the TypeScript one.
4
- * Naming a path that does not exist would cost the status line silently, so a
5
- * miss raises instead and the caller falls back to the plain plugin.
6
- */
7
- export declare function usageModulePath(): string;
8
- /** The engine resolves its config dir per the XDG spec, so a customized
9
- * XDG_CONFIG_HOME must be honored or tui.json lands where it never reads. */
10
- export declare function openCodeConfigDir(): string;
11
- export declare function installTuiPlugin(): void;