codiedev 0.9.51 → 0.9.53

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 (50) hide show
  1. package/README.md +8 -1
  2. package/dist/captureLog.d.ts +1 -1
  3. package/dist/cli.js +7 -22
  4. package/dist/codie.js +1 -146
  5. package/dist/codieLauncher.d.ts +0 -5
  6. package/dist/codieLauncher.js +1 -22
  7. package/dist/codieRuntime.d.ts +1 -11
  8. package/dist/codieRuntime.js +3 -20
  9. package/dist/codieRuntimeInstall.d.ts +11 -12
  10. package/dist/codieRuntimeInstall.js +1 -3
  11. package/dist/commands/doctor.js +0 -8
  12. package/dist/connect.js +4 -53
  13. package/dist/cursorHooks.d.ts +9 -0
  14. package/dist/cursorHooks.js +56 -0
  15. package/dist/hook.js +95 -227
  16. package/dist/limitEvent.d.ts +4 -1
  17. package/dist/limitEvent.js +54 -0
  18. package/dist/limitEventReporter.d.ts +21 -0
  19. package/dist/limitEventReporter.js +91 -0
  20. package/dist/mcp.js +1 -93
  21. package/dist/repoResolver.js +1 -1
  22. package/dist/upgradeNudge.d.ts +0 -1
  23. package/dist/upgradeNudge.js +0 -1
  24. package/dist/utils.d.ts +10 -8
  25. package/dist/utils.js +174 -199
  26. package/package.json +5 -11
  27. package/dist/codieStartup.d.ts +0 -24
  28. package/dist/codieStartup.js +0 -29
  29. package/dist/commands/post.d.ts +0 -2
  30. package/dist/commands/post.js +0 -96
  31. package/dist/commands/security.d.ts +0 -1
  32. package/dist/commands/security.js +0 -156
  33. package/dist/security.d.ts +0 -97
  34. package/dist/security.js +0 -422
  35. package/dist/securityDeepScan.d.ts +0 -41
  36. package/dist/securityDeepScan.js +0 -248
  37. package/dist/securityDoctor.d.ts +0 -32
  38. package/dist/securityDoctor.js +0 -63
  39. package/dist/securityFeature.d.ts +0 -5
  40. package/dist/securityFeature.js +0 -7
  41. package/dist/securityInstall.d.ts +0 -62
  42. package/dist/securityInstall.js +0 -227
  43. package/dist/securityInventory.d.ts +0 -54
  44. package/dist/securityInventory.js +0 -556
  45. package/dist/securityPilot.d.ts +0 -19
  46. package/dist/securityPilot.js +0 -61
  47. package/dist/securityPolicy.d.ts +0 -32
  48. package/dist/securityPolicy.js +0 -179
  49. package/dist/securitySession.d.ts +0 -6
  50. package/dist/securitySession.js +0 -72
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.postLimitEvent = postLimitEvent;
37
+ exports.reportTranscriptLimitEvent = reportTranscriptLimitEvent;
38
+ const http = __importStar(require("node:http"));
39
+ const https = __importStar(require("node:https"));
40
+ const version_1 = require("./version");
41
+ const limitEvent_1 = require("./limitEvent");
42
+ function postLimitEvent(config, payload, timeoutMs = 5_000) {
43
+ return new Promise((resolve, reject) => {
44
+ const target = new URL("/api/cli/limitEvent", config.backendUrl);
45
+ const data = JSON.stringify(payload);
46
+ const transport = target.protocol === "https:" ? https : http;
47
+ const request = transport.request({
48
+ hostname: target.hostname,
49
+ port: target.port || (target.protocol === "https:" ? 443 : 80),
50
+ path: target.pathname + target.search,
51
+ method: "POST",
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ "Content-Length": Buffer.byteLength(data),
55
+ Authorization: `Bearer ${config.token}`,
56
+ "X-Codiedev-Cli-Version": version_1.CLI_VERSION,
57
+ },
58
+ }, (response) => {
59
+ let responseBody = "";
60
+ response.on("data", (chunk) => { responseBody += chunk; });
61
+ response.on("end", () => {
62
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode < 300) {
63
+ resolve();
64
+ }
65
+ else {
66
+ reject(new Error(`HTTP ${response.statusCode}: ${responseBody}`));
67
+ }
68
+ });
69
+ });
70
+ request.on("error", reject);
71
+ request.setTimeout(timeoutMs, () => request.destroy(new Error(`timeout after ${timeoutMs}ms`)));
72
+ request.write(data);
73
+ request.end();
74
+ });
75
+ }
76
+ async function reportTranscriptLimitEvent(args) {
77
+ const parse = args.source === "codex"
78
+ ? limitEvent_1.parseCodexLimitEventFromTranscript
79
+ : limitEvent_1.parseLimitEventFromTranscript;
80
+ const parsed = parse(args.transcript);
81
+ if (!parsed && !args.emitMinimalOnMiss)
82
+ return false;
83
+ const event = parsed ?? { kind: "other", at: Date.now(), resetText: null };
84
+ await postLimitEvent(args.config, {
85
+ source: args.source,
86
+ ...event,
87
+ sessionId: args.sessionId,
88
+ transcriptTail: args.transcript ? (0, limitEvent_1.tailForLimitEvent)(args.transcript) : undefined,
89
+ });
90
+ return true;
91
+ }
package/dist/mcp.js CHANGED
@@ -260,68 +260,6 @@ const TOOLS = [
260
260
  required: ["artifactId"],
261
261
  },
262
262
  },
263
- {
264
- name: "codiedev_post_to_feed",
265
- description: "Publish an artifact to the team's break-room feed with an intent " +
266
- "and optional @mentions. Use when the user asks to 'post this to " +
267
- "the team', 'publish to the feed', 'share with the team', 'ask the " +
268
- "team', or when they want broader visibility than a single ping. " +
269
- "Pass the artifact's filename (e.g., 'spec-214.md') and pick an " +
270
- "intent that matches the request: share = here's a skill/spec; " +
271
- "request_review = please review; request_expertise = I'm stuck, " +
272
- "who knows this; link_share = fyi; rfc = proposing a change. " +
273
- "Optionally @mention teammates (by first name) so they get a " +
274
- "notification. Returns the feed post id.",
275
- inputSchema: {
276
- type: "object",
277
- properties: {
278
- filename: {
279
- type: "string",
280
- description: "Artifact filename to attach (e.g., 'spec-214.md'). The post " +
281
- "will render a preview card linking to it.",
282
- },
283
- title: {
284
- type: "string",
285
- description: "Headline of the post. Short, imperative — e.g., 'Check my " +
286
- "OAuth middleware spec' or 'Anyone know how we handle X?'.",
287
- },
288
- body: {
289
- type: "string",
290
- description: "Body of the post in markdown. A short explanation of why the " +
291
- "user is posting (the artifact carries the detail).",
292
- },
293
- intent: {
294
- type: "string",
295
- enum: [
296
- "share",
297
- "request_review",
298
- "request_expertise",
299
- "link_share",
300
- "rfc",
301
- ],
302
- description: "Why the user is posting. See tool description.",
303
- },
304
- mentions: {
305
- type: "array",
306
- items: { type: "string" },
307
- description: "Teammate first names (or handles) to @mention. Each mention " +
308
- "creates a notification for that teammate.",
309
- },
310
- format: {
311
- type: "string",
312
- enum: ["article", "quick", "workflow", "review"],
313
- description: "Post format. Default 'article' if omitted. Use 'quick' for " +
314
- "short one-liners.",
315
- },
316
- tags: {
317
- type: "array",
318
- items: { type: "string" },
319
- description: "Optional tags, lowercase, hyphen-safe.",
320
- },
321
- },
322
- required: ["title", "body"],
323
- },
324
- },
325
263
  {
326
264
  name: "codiedev_share_with",
327
265
  description: "Grant a teammate persistent read (or edit) access to an artifact " +
@@ -374,7 +312,7 @@ const TOOLS = [
374
312
  "to that post with X', 'mark as used', or 'upvote'. The 🛠 " +
375
313
  "reaction is the signal for 'I used this' and bumps the linked " +
376
314
  "artifact's reuse count. Pass the post id (get it from " +
377
- "codiedev_get_library or a previous post-to-feed response).",
315
+ "codiedev_get_library or a previous feed response).",
378
316
  inputSchema: {
379
317
  type: "object",
380
318
  properties: {
@@ -602,8 +540,6 @@ async function dispatchTool(name, args, config) {
602
540
  return await handleNote(args, config);
603
541
  case "codiedev_promote":
604
542
  return await handlePromote(args, config);
605
- case "codiedev_post_to_feed":
606
- return await handlePostToFeed(args, config);
607
543
  case "codiedev_share_with":
608
544
  return await handleShareWith(args, config);
609
545
  case "codiedev_send_to":
@@ -784,34 +720,6 @@ async function handlePromote(args, config) {
784
720
  ],
785
721
  };
786
722
  }
787
- async function handlePostToFeed(args, config) {
788
- const filename = asStringOrUndefined(args.filename);
789
- const title = asString(args.title);
790
- const body = asString(args.body);
791
- const intent = asStringOrUndefined(args.intent);
792
- const format = asStringOrUndefined(args.format);
793
- const mentionsRaw = Array.isArray(args.mentions) ? args.mentions : [];
794
- const mentions = mentionsRaw.filter((m) => typeof m === "string");
795
- const tagsRaw = Array.isArray(args.tags) ? args.tags : [];
796
- const tags = tagsRaw.filter((t) => typeof t === "string");
797
- if (!title)
798
- throw new Error("title required");
799
- if (!body)
800
- throw new Error("body required");
801
- const res = await (0, shared_1.apiRequest)("POST", "/api/cli/post-to-feed", {
802
- config,
803
- body: { filename, title, body, intent, format, mentions, tags },
804
- });
805
- const pieces = [`✓ Posted to feed (id=${res.postId}).`];
806
- if (res.linkedArtifact?.key)
807
- pieces.push(` attached: ${res.linkedArtifact.key}`);
808
- if (res.intent)
809
- pieces.push(` intent: ${res.intent}`);
810
- if (res.mentions?.length) {
811
- pieces.push(` mentioned: ${res.mentions.map((m) => m.name).join(", ")}`);
812
- }
813
- return { content: [{ type: "text", text: pieces.join("\n") }] };
814
- }
815
723
  async function handleShareWith(args, config) {
816
724
  const filename = asString(args.filename);
817
725
  const to = asString(args.to);
@@ -23,7 +23,7 @@ function parseRemoteUrl(url) {
23
23
  // Harness checkout loses its repoId even though transcript capture can
24
24
  // resolve the same raw remote correctly. Check this after URL forms so the
25
25
  // colon in `https://` is never mistaken for an SCP separator.
26
- const scp = s.match(/^(?:[^@\s]+@)?([^:/\s]+):(.+)$/);
26
+ const scp = s.match(/^(?:[^@\s]+@)?([^:/\s]+):([^/]+\/.+)$/);
27
27
  if (scp) {
28
28
  return { host: scp[1].toLowerCase(), ownerName: scp[2].toLowerCase() };
29
29
  }
@@ -13,7 +13,6 @@ export interface OfferOpts {
13
13
  log?: (line: string) => void;
14
14
  isTty?: boolean;
15
15
  }
16
- export declare function promptYesNo(question: string): Promise<boolean>;
17
16
  /**
18
17
  * Prompt-capable sibling of maybePrintUpgradeNudge. Call this before handing
19
18
  * the terminal to a TUI. A successful upgrade relaunches the fresh CLI and
@@ -43,7 +43,6 @@ var __importStar = (this && this.__importStar) || (function () {
43
43
  })();
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.maybePrintUpgradeNudge = maybePrintUpgradeNudge;
46
- exports.promptYesNo = promptYesNo;
47
46
  exports.maybeOfferUpgrade = maybeOfferUpgrade;
48
47
  const fs = __importStar(require("fs"));
49
48
  const path = __importStar(require("path"));
package/dist/utils.d.ts CHANGED
@@ -14,7 +14,6 @@ export interface CodiedevConfig {
14
14
  }>;
15
15
  lastSynced: string;
16
16
  backendUrl: string;
17
- agentSecurityEnabled?: boolean;
18
17
  deviceId?: string;
19
18
  deviceName?: string;
20
19
  captureIgnoredPaths?: string[];
@@ -97,21 +96,19 @@ export declare function openCodeInstalled(): boolean;
97
96
  /** Install a dormant global OpenCode adapter. Installing it unconditionally
98
97
  * keeps `codiedev connect` as the only setup step even when Codie/OpenCode is
99
98
  * installed later. OpenCode loads this file from its documented plugin dir. */
100
- export declare function installOpenCodeCapturePlugin(agentSecurityEnabled?: boolean): void;
99
+ export declare function installOpenCodeCapturePlugin(): void;
101
100
  /**
102
101
  * VS Code with the GitHub Copilot Chat extension installed. The extension
103
102
  * directory pattern is `~/.vscode/extensions/github.copilot-chat-*`. We treat
104
103
  * the presence of any `github.copilot*` directory as the Copilot fingerprint.
105
104
  */
106
105
  export declare function vscodeCopilotInstalled(): boolean;
107
- export declare function upsertCodiedevHook(hooks: Record<string, unknown>, eventName: string, subcommand: string, matcher?: string): void;
108
- /** Remove Codiedev's entries for one event while preserving foreign hooks. */
109
- export declare function removeCodiedevHook(hooks: Record<string, unknown>, eventName: string): boolean;
110
- export declare function installHook(agentSecurityEnabled?: boolean): void;
106
+ export declare function upsertCodiedevHook(hooks: Record<string, unknown>, eventName: string, subcommand: string, matcher?: string | null): void;
107
+ export declare function installHook(): void;
111
108
  export declare function ensureDiscoveryHookInstalled(): void;
112
109
  export declare function ensureBackupHookInstalled(): void;
113
110
  export declare function ensureLimitHookInstalled(): void;
114
- export declare function ensureAllCodiedevHooksInstalled(agentSecurityEnabled?: boolean): void;
111
+ export declare function ensureAllCodiedevHooksInstalled(): void;
115
112
  export declare function ensureSessionStartHookInstalled(): void;
116
113
  export declare function installClaudeCodeInstructions(): void;
117
114
  export declare function installCodexInstructions(): void;
@@ -169,8 +166,10 @@ export declare function cleanupCodexMcp(): void;
169
166
  * so we append a well-marked block if one isn't already present. Idempotent.
170
167
  */
171
168
  export declare function installCodexMcp(): boolean;
172
- export declare function installCodexHook(agentSecurityEnabled?: boolean): void;
169
+ export declare function installCodexHook(): void;
170
+ export declare function ensureCodexLimitHookInstalled(): void;
173
171
  export declare function installCursorHook(): void;
172
+ export declare function ensureCursorCodiedevHooksInstalled(): void;
174
173
  export interface ParsedStats {
175
174
  messageCount: number;
176
175
  toolCallCount: number;
@@ -258,6 +257,8 @@ export declare const CAPTURE_THROTTLE_MS: number;
258
257
  export declare const SWEEP_MIN_AGE_MS: number;
259
258
  export declare function resolveCaptureFinal(argv2: string | undefined): boolean | undefined;
260
259
  export declare function finishInputTmpFile(sessionId: string | undefined): string;
260
+ export declare function captureUploadTmpFile(sessionId: string | undefined, mode: "immediate" | "deferred", pid?: number, now?: number): string;
261
+ export declare function cancelDeferredCaptureUpload(sessionId: string, deps?: Pick<typeof fs, "unlinkSync">): boolean;
261
262
  export declare function decideDispatch(args: {
262
263
  final: boolean;
263
264
  lastUploadAt: number | null;
@@ -332,3 +333,4 @@ interface DeferredUploadDeps extends UploadDeps {
332
333
  }
333
334
  export declare function runDeferredUpload(jobFile: string, delayMs: number, deps: DeferredUploadDeps): Promise<void>;
334
335
  export declare function transcriptReadSkipReason(err: unknown): string;
336
+ export declare function shouldReportCaptureSkip(final: boolean | undefined): boolean;