dev3000 0.0.181 → 0.0.183

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 (60) hide show
  1. package/README.md +36 -170
  2. package/bin/d3k-runtime +2 -0
  3. package/bin/dev3000 +2 -119
  4. package/dist/cdp-monitor.d.ts +4 -0
  5. package/dist/cdp-monitor.d.ts.map +1 -1
  6. package/dist/cdp-monitor.js +21 -5
  7. package/dist/cdp-monitor.js.map +1 -1
  8. package/dist/cli.js +4 -53
  9. package/dist/cli.js.map +1 -1
  10. package/dist/dev-environment.d.ts.map +1 -1
  11. package/dist/dev-environment.js +8 -46
  12. package/dist/dev-environment.js.map +1 -1
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/runtime/browser-events.d.ts +5 -0
  18. package/dist/runtime/browser-events.d.ts.map +1 -0
  19. package/dist/runtime/browser-events.js +87 -0
  20. package/dist/runtime/browser-events.js.map +1 -0
  21. package/dist/runtime/cli.d.ts +3 -0
  22. package/dist/runtime/cli.d.ts.map +1 -0
  23. package/dist/runtime/cli.js +83 -0
  24. package/dist/runtime/cli.js.map +1 -0
  25. package/dist/runtime/runtime.d.ts +10 -0
  26. package/dist/runtime/runtime.d.ts.map +1 -0
  27. package/dist/runtime/runtime.js +346 -0
  28. package/dist/runtime/runtime.js.map +1 -0
  29. package/dist/runtime/session.d.ts +18 -0
  30. package/dist/runtime/session.d.ts.map +1 -0
  31. package/dist/runtime/session.js +61 -0
  32. package/dist/runtime/session.js.map +1 -0
  33. package/dist/runtime/timeline.d.ts +40 -0
  34. package/dist/runtime/timeline.d.ts.map +1 -0
  35. package/dist/runtime/timeline.js +69 -0
  36. package/dist/runtime/timeline.js.map +1 -0
  37. package/dist/skills/d3k/internal-skill.md +20 -131
  38. package/dist/skills/index.d.ts +54 -0
  39. package/dist/skills/index.d.ts.map +1 -0
  40. package/dist/skills/index.js +214 -0
  41. package/dist/skills/index.js.map +1 -0
  42. package/dist/utils/d3k-skill-installer.d.ts +4 -0
  43. package/dist/utils/d3k-skill-installer.d.ts.map +1 -0
  44. package/dist/utils/d3k-skill-installer.js +30 -0
  45. package/dist/utils/d3k-skill-installer.js.map +1 -0
  46. package/dist/utils/version-check.d.ts +1 -21
  47. package/dist/utils/version-check.d.ts.map +1 -1
  48. package/dist/utils/version-check.js +2 -97
  49. package/dist/utils/version-check.js.map +1 -1
  50. package/package.json +7 -16
  51. package/skills/d3k/PUBLISH.md +46 -0
  52. package/skills/d3k/SKILL.md +32 -0
  53. package/skills/d3k/agents/openai.yaml +4 -0
  54. package/skills/d3k/scripts/runtime.mjs +21 -0
  55. package/dist/commands/skill-runner.d.ts +0 -40
  56. package/dist/commands/skill-runner.d.ts.map +0 -1
  57. package/dist/commands/skill-runner.js +0 -826
  58. package/dist/commands/skill-runner.js.map +0 -1
  59. package/dist/skills/index.test.ts +0 -203
  60. package/dist/skills/index.ts +0 -259
@@ -1,143 +1,32 @@
1
1
  ---
2
- name: "d3k"
3
- description: "Use when the user asks to use d3k, run/dev/test/debug a web project with d3k, or reproduce a browser issue. Own the runtime: reuse or background-start d3k non-interactively, wait for readiness, use its project-stable managed Chrome profile, and inspect unified browser/server evidence."
2
+ name: d3k
3
+ description: Run and debug a local web app with a managed browser and a shared server/browser evidence timeline. Use when asked to develop, test, or reproduce a browser issue with d3k.
4
4
  ---
5
5
 
6
- # d3k Agent Runtime
6
+ # d3k
7
7
 
8
- d3k is the local web runtime for this task. It starts the dev server behind a stable Portless URL, owns a project-stable Chrome profile, and records server logs, browser console output, network activity, interactions, and screenshots in one timeline.
8
+ Own the project's dev server and monitored browser through a small background runtime. No global d3k installation is needed. Evidence stays in bounded memory; browser authentication stays in the project Chrome profile.
9
9
 
10
- When this skill triggers, operate d3k. Do not merely tell the user how to run it.
10
+ Use `d3k-runtime` as `runtime` below when running from an installed dev3000 package, or `pnpm --package=dev3000 dlx d3k-runtime` without a global install. Run from the **target project root**. For unreleased development use `node <dev3000-checkout>/skills/d3k/scripts/runtime.mjs` instead; that helper runs the checkout source without downloading a published version.
11
11
 
12
- ## Interpret the Request
12
+ ## Prepare
13
13
 
14
- - "Let me test/dev my project with d3k": prepare the runtime and headed browser, confirm it is ready, then hand control to the user. Wait for them to reproduce the issue before inspecting evidence.
15
- - "Test/debug/fix this with d3k": prepare the runtime, then drive the managed browser and investigate autonomously.
16
- - If ambiguous, start the runtime and browser first. That action is safe and useful for either path.
14
+ 1. Run `runtime portless status`. Canonical HTTPS must be ready (`canonical: true`, `serviceInstalled: true`, `setupRequired: false`) before starting the app or browser. If needed run `runtime portless setup`, wait for the one-time administrator authorization, then check again. Stop if setup is unavailable; never silently substitute direct localhost.
15
+ 2. Run `runtime status`. Reuse a ready runtime for this project. If it is starting, wait for readiness. Do not start another dev server. A legacy d3k session must be stopped before switching runtimes.
16
+ 3. Start `runtime start` in a retained background tool session. Keep its process handle. The runtime detects the package manager and `dev` script; use `--command '<dev command>'` when needed. Poll `runtime status` until `ready: true` and `browserConnected: true` with a port-free `https://...localhost` URL. Inspect `runtime events` if startup fails while the runtime is still alive, and the retained process output if it exits.
17
17
 
18
- ## Start or Reuse d3k
18
+ ## Reproduce and inspect
19
19
 
20
- Run from the project root.
20
+ - For “let me test,” give the user the app URL and leave the browser running while they reproduce the issue.
21
+ - For autonomous debugging, drive the same browser with `runtime browser snapshot -i`, `runtime browser click @e2`, and other agent-browser commands. The runtime supplies the CDP connection; never open a separate browser or profile.
22
+ - Before a reproduction, read `runtime status` and keep its `sessionId` and `cursor`.
23
+ - After the interaction, read `runtime events --session <id> --after <cursor>`. Server output, console messages, exceptions, network requests, and navigation share sequence numbers. Requests and responses carry CDP request IDs; adjacent server lines are chronological context, not proof of causation.
24
+ - Continue from the returned `cursor` while `hasMore` is true. Use `--limit 1..500`, `--source server|browser|runtime`, or `--level error` for focused reads. For error context, read the unfiltered interval as well. Filters advance the cursor through examined events; retain the original cursor if you need another view of the same interval.
25
+ - `reset: true` means the runtime restarted. `dropped` reports evicted events. Never claim complete evidence across either gap. Replay the interaction if necessary.
26
+ - Fix the code and repeat the same interaction, then inspect the new interval. Keep the runtime alive across edits.
21
27
 
22
- 1. Check canonical Portless readiness before starting any app process:
28
+ ## Lifecycle
23
29
 
24
- ```bash
25
- d3k portless status --json
26
- ```
30
+ Keep the runtime's project-stable profile for sign-in state. Use `--headless` for CI or when requested; `--servers-only` deliberately omits the browser. Automatic screenshots and persistent log files are off; request a screenshot through `runtime browser screenshot <absolute-path>` when visual evidence is needed.
27
31
 
28
- If `"setupRequired": true`, run:
29
-
30
- ```bash
31
- d3k portless setup
32
- ```
33
-
34
- On macOS this opens the system administrator authorization dialog. Wait for the user to approve it, then rerun `d3k portless status --json`. Do not start d3k until `"canonical": true`, `"serviceInstalled": true`, and `"setupRequired": false`. If authorization is declined or unavailable, stop and explain the blocker. Never silently substitute direct localhost.
35
-
36
- 2. Check for an existing project runtime:
37
-
38
- ```bash
39
- d3k status --json
40
- ```
41
-
42
- Reuse it only if it reports `"running": true`, `"ready": true`, `"routing": "portless"`, `"browserConnected": true`, and a genuinely port-free `https://...localhost` `appUrl`. If an active session reports `"routing": "direct"`, stop that retained d3k session and restart after Portless is ready. Do not start a second dev server or browser.
43
-
44
- 3. If d3k is not installed, install it:
45
-
46
- ```bash
47
- bun install -g dev3000
48
- ```
49
-
50
- Use `npm install -g dev3000` only when Bun is unavailable.
51
-
52
- 4. Start d3k with the agent's shell/process tool as a retained background or yielded session:
53
-
54
- ```bash
55
- d3k -t
56
- ```
57
-
58
- Do not wait for this long-running command to exit. Keep its process/session handle so you can monitor or stop it later. Prefer the execution tool's background/session support over shelling with `&`.
59
-
60
- If the target URL is already known, pass it so the managed browser opens there:
61
-
62
- ```bash
63
- d3k -t --app-url "<url>"
64
- ```
65
-
66
- Let d3k auto-detect the package manager, dev command, and port. Add `--command`, `--script`, or `--port` only when detection is wrong or the user specified them.
67
-
68
- 5. Poll until the runtime is ready:
69
-
70
- ```bash
71
- d3k status --json
72
- ```
73
-
74
- A successful status response is the readiness boundary only when it reports `"ready": true`, `"routing": "portless"`, `"browserConnected": true`, and a port-free `https://...localhost` `appUrl`. The underlying app port may still change between runs. If startup fails, inspect the retained process output and `d3k logs --type server`; do not launch a separate dev server.
75
-
76
- ## User-Driven Testing
77
-
78
- When the user says "let me test":
79
-
80
- 1. Confirm the status response includes the app URL and `"browserConnected": true`.
81
- 2. Tell the user the monitored browser is ready.
82
- 3. Keep the d3k process running and wait for the user to reproduce the behavior.
83
- 4. When they report that it happened, begin with:
84
-
85
- ```bash
86
- d3k errors --context
87
- d3k logs -n 200
88
- ```
89
-
90
- Do not replace the headed browser with automation while the user is testing.
91
-
92
- ## Agent-Driven Testing
93
-
94
- Drive the exact browser d3k is monitoring:
95
-
96
- ```bash
97
- d3k agent-browser snapshot -i
98
- d3k agent-browser click @e2
99
- d3k agent-browser fill @e3 "text"
100
- d3k errors --context
101
- ```
102
-
103
- Use `--require-d3k-browser` when opening a URL so failure cannot silently create another browser:
104
-
105
- ```bash
106
- d3k agent-browser --require-d3k-browser open "<url>"
107
- ```
108
-
109
- After every reproduction or code change, replay the relevant interaction and check `d3k errors --context` again.
110
-
111
- ## Evidence Commands
112
-
113
- Prefer these over ad-hoc log scraping:
114
-
115
- ```bash
116
- d3k status --json
117
- d3k errors --context
118
- d3k logs -n 200
119
- d3k logs --type browser
120
- d3k logs --type server
121
- ```
122
-
123
- Artifacts live under `~/.d3k/<project>/`, including `session.json`, logs, screenshots, and the Chrome profile.
124
-
125
- ## Browser and Auth Safety
126
-
127
- d3k must own browser startup by default. Its per-project Chrome profile preserves login state, cookies, and local storage.
128
-
129
- For Google OAuth, Supabase auth, and other auth-sensitive flows, never substitute raw Chrome, Playwright, a browser MCP session, manual CDP attachment, or `agent-browser --profile`. Those paths use a different browser/profile and can trigger "This browser or app may not be secure."
130
-
131
- If the managed browser is unavailable, stop or interrupt the retained d3k process and restart d3k cleanly. Do not work around it by creating another browser.
132
-
133
- Use `--headless` only for CI or when explicitly requested. Use `--servers-only` only when browser monitoring is intentionally unwanted.
134
-
135
- ## Operating Rules
136
-
137
- - Do not run `npm run dev`, `bun run dev`, or another dev server alongside d3k.
138
- - Do not start a second d3k when `d3k status --json` reports an active one.
139
- - Keep d3k alive across edits and retests.
140
- - Preserve the project-stable Chrome profile unless the user explicitly asks for a fresh profile.
141
- - Leave the runtime running when handing a headed browser to the user; stop it only when asked or when the task requires a clean restart.
142
- - Canonical Portless HTTPS routing is required by default. Never add `--no-portless` or set `PORTLESS=0` unless the user explicitly requests direct localhost routing.
143
- - Treat Portless as active only when the reported URL is genuinely port-free. Never describe a URL with an explicit proxy port as Portless routing.
32
+ Stop with `runtime stop` or the retained process handle when asked. Leaving the browser open for user testing means leaving the runtime alive. Events are lost when it exits; only profile and session discovery data persist. Console/server text may contain application secrets; inspect selectively and avoid copying sensitive values into reports.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Skill module for d3k
3
+ *
4
+ * Skills are managed by `npx skills` and stored in .agents/skills/
5
+ * d3k also bundles a project-local fallback for agents without a global d3k skill.
6
+ */
7
+ export interface SkillInfo {
8
+ name: string;
9
+ description: string;
10
+ path: string;
11
+ }
12
+ export interface SkillResult {
13
+ found: boolean;
14
+ name: string;
15
+ content?: string;
16
+ path?: string;
17
+ error?: string;
18
+ availableSkills?: string[];
19
+ }
20
+ /**
21
+ * Get the path to d3k's bundled skills directory.
22
+ * Returns null if not found (e.g., running in development without build).
23
+ */
24
+ export declare function getBundledSkillsPath(): string | null;
25
+ /**
26
+ * Get d3k's bundled internal skill file.
27
+ *
28
+ * The bundled package stores this as internal-skill.md so the repository has a
29
+ * single public SKILL.md at skills/d3k/SKILL.md. When d3k installs the skill
30
+ * into an agent skills directory, it still writes the target as SKILL.md.
31
+ */
32
+ export declare function getBundledD3kSkillPath(): string | null;
33
+ /**
34
+ * Get directories where skills can be found.
35
+ * Skills are managed by `npx skills` in .agents/skills/
36
+ */
37
+ export declare function getSkillDirectories(cwd?: string): string[];
38
+ /**
39
+ * Find a skill by name.
40
+ */
41
+ export declare function findSkill(name: string, cwd?: string): string | null;
42
+ /**
43
+ * Get the content of a skill by name.
44
+ */
45
+ export declare function getSkill(name: string, cwd?: string): SkillResult;
46
+ /**
47
+ * List all available skills.
48
+ */
49
+ export declare function listAvailableSkills(cwd?: string): string[];
50
+ /**
51
+ * Get detailed info about all available skills.
52
+ */
53
+ export declare function getSkillsInfo(cwd?: string): SkillInfo[];
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B;AAQD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAkCpD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAetD;AAoBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAiB1D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQnE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAuBhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CA4BvD"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Skill module for d3k
3
+ *
4
+ * Skills are managed by `npx skills` and stored in .agents/skills/
5
+ * d3k also bundles a project-local fallback for agents without a global d3k skill.
6
+ */
7
+ import { existsSync, readdirSync, readFileSync } from "fs";
8
+ import { homedir } from "os";
9
+ import { dirname, join, resolve } from "path";
10
+ import { fileURLToPath } from "url";
11
+ const SKILL_FILENAME = "SKILL.md";
12
+ const BUNDLED_D3K_SKILL_FILENAME = "internal-skill.md";
13
+ function hasBundledD3kSkill(skillsDir) {
14
+ return (existsSync(join(skillsDir, "d3k", BUNDLED_D3K_SKILL_FILENAME)) || existsSync(join(skillsDir, "d3k", SKILL_FILENAME)));
15
+ }
16
+ /**
17
+ * Get the path to d3k's bundled skills directory.
18
+ * Returns null if not found (e.g., running in development without build).
19
+ */
20
+ export function getBundledSkillsPath() {
21
+ // Check if running from compiled binary
22
+ const moduleUrl = import.meta.url;
23
+ const isCompiledBinary = moduleUrl.startsWith("file:///$bunfs") || moduleUrl.startsWith("/$bunfs");
24
+ if (isCompiledBinary) {
25
+ // Try process.argv[0] first (more reliable for Bun compiled binaries)
26
+ // Then fall back to process.execPath
27
+ const possiblePaths = [process.argv[0], process.execPath].filter(Boolean);
28
+ for (const binaryPath of possiblePaths) {
29
+ if (binaryPath && existsSync(binaryPath)) {
30
+ const binDir = dirname(binaryPath);
31
+ const packageDir = dirname(binDir);
32
+ const skillsDir = join(packageDir, "skills");
33
+ if (existsSync(skillsDir)) {
34
+ return skillsDir;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ // Fallback for npm-installed package: look for dist/skills relative to this module
40
+ // import.meta.url is like "file:///path/to/node_modules/dev3000/dist/skills/index.js"
41
+ if (moduleUrl.startsWith("file://")) {
42
+ const modulePath = fileURLToPath(moduleUrl);
43
+ // This file is at dist/skills/index.js, so skills are at dist/skills/
44
+ const skillsDir = dirname(modulePath);
45
+ if (hasBundledD3kSkill(skillsDir)) {
46
+ return skillsDir;
47
+ }
48
+ }
49
+ return null;
50
+ }
51
+ /**
52
+ * Get d3k's bundled internal skill file.
53
+ *
54
+ * The bundled package stores this as internal-skill.md so the repository has a
55
+ * single public SKILL.md at skills/d3k/SKILL.md. When d3k installs the skill
56
+ * into an agent skills directory, it still writes the target as SKILL.md.
57
+ */
58
+ export function getBundledD3kSkillPath() {
59
+ const bundledSkillsDir = getBundledSkillsPath();
60
+ if (!bundledSkillsDir)
61
+ return null;
62
+ const internalSkillPath = join(bundledSkillsDir, "d3k", BUNDLED_D3K_SKILL_FILENAME);
63
+ if (existsSync(internalSkillPath)) {
64
+ return internalSkillPath;
65
+ }
66
+ const legacySkillPath = join(bundledSkillsDir, "d3k", SKILL_FILENAME);
67
+ if (existsSync(legacySkillPath)) {
68
+ return legacySkillPath;
69
+ }
70
+ return null;
71
+ }
72
+ function isBundledSkillsDirectory(dir) {
73
+ const bundledSkillsDir = getBundledSkillsPath();
74
+ return bundledSkillsDir !== null && resolve(dir) === resolve(bundledSkillsDir);
75
+ }
76
+ function getSkillPathInDirectory(dir, name) {
77
+ const skillPath = join(dir, name, SKILL_FILENAME);
78
+ if (existsSync(skillPath)) {
79
+ return skillPath;
80
+ }
81
+ if (name === "d3k" && isBundledSkillsDirectory(dir)) {
82
+ return getBundledD3kSkillPath();
83
+ }
84
+ return null;
85
+ }
86
+ /**
87
+ * Get directories where skills can be found.
88
+ * Skills are managed by `npx skills` in .agents/skills/
89
+ */
90
+ export function getSkillDirectories(cwd) {
91
+ const dirs = [];
92
+ const projectDir = cwd || process.cwd();
93
+ // Project-local skills (highest priority)
94
+ dirs.push(join(projectDir, ".agents", "skills"));
95
+ // Global skills
96
+ dirs.push(join(homedir(), ".agents", "skills"));
97
+ // d3k's bundled skills (fallback for d3k skill before it's copied)
98
+ const bundled = getBundledSkillsPath();
99
+ if (bundled) {
100
+ dirs.push(bundled);
101
+ }
102
+ return dirs.filter((dir) => existsSync(dir));
103
+ }
104
+ /**
105
+ * Find a skill by name.
106
+ */
107
+ export function findSkill(name, cwd) {
108
+ for (const dir of getSkillDirectories(cwd)) {
109
+ const skillPath = getSkillPathInDirectory(dir, name);
110
+ if (skillPath) {
111
+ return skillPath;
112
+ }
113
+ }
114
+ return null;
115
+ }
116
+ /**
117
+ * Get the content of a skill by name.
118
+ */
119
+ export function getSkill(name, cwd) {
120
+ const skillPath = findSkill(name, cwd);
121
+ if (skillPath) {
122
+ try {
123
+ const content = readFileSync(skillPath, "utf-8");
124
+ return { found: true, name, content, path: skillPath };
125
+ }
126
+ catch (error) {
127
+ return {
128
+ found: false,
129
+ name,
130
+ error: `Failed to read skill: ${error instanceof Error ? error.message : String(error)}`,
131
+ availableSkills: listAvailableSkills(cwd)
132
+ };
133
+ }
134
+ }
135
+ return {
136
+ found: false,
137
+ name,
138
+ error: `Skill "${name}" not found`,
139
+ availableSkills: listAvailableSkills(cwd)
140
+ };
141
+ }
142
+ /**
143
+ * List all available skills.
144
+ */
145
+ export function listAvailableSkills(cwd) {
146
+ const skills = new Set();
147
+ for (const dir of getSkillDirectories(cwd)) {
148
+ try {
149
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
150
+ if (entry.isDirectory() && getSkillPathInDirectory(dir, entry.name)) {
151
+ skills.add(entry.name);
152
+ }
153
+ }
154
+ }
155
+ catch {
156
+ // Directory not readable
157
+ }
158
+ }
159
+ return Array.from(skills).sort();
160
+ }
161
+ /**
162
+ * Get detailed info about all available skills.
163
+ */
164
+ export function getSkillsInfo(cwd) {
165
+ const skillsMap = new Map();
166
+ for (const dir of getSkillDirectories(cwd)) {
167
+ try {
168
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
169
+ if (entry.isDirectory() && !skillsMap.has(entry.name)) {
170
+ const skillPath = getSkillPathInDirectory(dir, entry.name);
171
+ if (skillPath) {
172
+ try {
173
+ const content = readFileSync(skillPath, "utf-8");
174
+ skillsMap.set(entry.name, {
175
+ name: entry.name,
176
+ description: extractDescription(content),
177
+ path: skillPath
178
+ });
179
+ }
180
+ catch {
181
+ // Skip unreadable
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ catch {
188
+ // Directory not readable
189
+ }
190
+ }
191
+ return Array.from(skillsMap.values()).sort((a, b) => a.name.localeCompare(b.name));
192
+ }
193
+ /**
194
+ * Extract description from SKILL.md frontmatter or first paragraph.
195
+ */
196
+ function extractDescription(content) {
197
+ // Try YAML frontmatter
198
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
199
+ if (frontmatterMatch) {
200
+ const descMatch = frontmatterMatch[1].match(/description:\s*(.+)/);
201
+ if (descMatch) {
202
+ return descMatch[1].trim();
203
+ }
204
+ }
205
+ // Fallback: first non-heading, non-empty line
206
+ for (const line of content.split("\n")) {
207
+ const trimmed = line.trim();
208
+ if (trimmed && !trimmed.startsWith("#") && !trimmed.startsWith("---")) {
209
+ return trimmed.length > 100 ? `${trimmed.slice(0, 97)}...` : trimmed;
210
+ }
211
+ }
212
+ return "No description available";
213
+ }
214
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,cAAc,GAAG,UAAU,CAAA;AACjC,MAAM,0BA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MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAClE,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,8CAA8C;IAC9C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QAC3B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACtE,OAAO,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;QACtE,CAAC;IACH,CAAC;IAED,OAAO,0BAA0B,CAAA;AACnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type SkillsAgentId } from "./skill-installer.js";
2
+ /** Reuse an agent's global d3k skill before installing a project-local fallback. */
3
+ export declare function ensureD3kSkill(agentId?: SkillsAgentId): void;
4
+ //# sourceMappingURL=d3k-skill-installer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d3k-skill-installer.d.ts","sourceRoot":"","sources":["../../src/utils/d3k-skill-installer.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEnF,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,OAAO,GAAE,aAAuB,GAAG,IAAI,CAyBrE"}
@@ -0,0 +1,30 @@
1
+ import { copyFileSync, existsSync, mkdirSync, readFileSync } from "fs";
2
+ import { homedir } from "os";
3
+ import { join } from "path";
4
+ import { getBundledD3kSkillPath } from "../skills/index.js";
5
+ import { getSkillsPathForLocation } from "./skill-installer.js";
6
+ /** Reuse an agent's global d3k skill before installing a project-local fallback. */
7
+ export function ensureD3kSkill(agentId = "codex") {
8
+ try {
9
+ const globalSkillsRoot = getSkillsPathForLocation(agentId, "global")?.path || join(homedir(), ".agents", "skills");
10
+ if (existsSync(join(globalSkillsRoot, "d3k", "SKILL.md"))) {
11
+ return;
12
+ }
13
+ const bundledSkillPath = getBundledD3kSkillPath();
14
+ if (!bundledSkillPath)
15
+ return;
16
+ const projectSkillsRoot = getSkillsPathForLocation(agentId, "project")?.path || join(process.cwd(), ".agents", "skills");
17
+ const skillDir = join(projectSkillsRoot, "d3k");
18
+ const skillPath = join(skillDir, "SKILL.md");
19
+ const bundledContent = readFileSync(bundledSkillPath, "utf-8");
20
+ if (existsSync(skillPath) && readFileSync(skillPath, "utf-8") === bundledContent) {
21
+ return;
22
+ }
23
+ mkdirSync(skillDir, { recursive: true });
24
+ copyFileSync(bundledSkillPath, skillPath);
25
+ }
26
+ catch {
27
+ // Skill installation is optional and must not prevent the runtime from starting.
28
+ }
29
+ }
30
+ //# sourceMappingURL=d3k-skill-installer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d3k-skill-installer.js","sourceRoot":"","sources":["../../src/utils/d3k-skill-installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,wBAAwB,EAAsB,MAAM,sBAAsB,CAAA;AAEnF,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,OAAO,GAAkB,OAAO;IAC7D,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;QAClH,IAAI,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAM;QACR,CAAC;QAED,MAAM,gBAAgB,GAAG,sBAAsB,EAAE,CAAA;QACjD,IAAI,CAAC,gBAAgB;YAAE,OAAM;QAE7B,MAAM,iBAAiB,GACrB,wBAAwB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;QAChG,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAC5C,MAAM,cAAc,GAAG,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;QAE9D,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,cAAc,EAAE,CAAC;YACjF,OAAM;QACR,CAAC;QAED,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxC,YAAY,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;AACH,CAAC"}
@@ -4,32 +4,12 @@ interface VersionInfo {
4
4
  updateAvailable: boolean;
5
5
  packageManager: "npm" | "pnpm" | "yarn" | null;
6
6
  }
7
- /**
8
- * Initialize a new telemetry session
9
- * Call this once at CLI startup
10
- * Skips telemetry for canary versions
11
- */
12
- export declare function initTelemetrySession(framework?: string): {
13
- sessionId: string;
14
- startTime: number;
15
- } | null;
16
- /**
17
- * Get current session info (returns null if not initialized)
18
- */
19
- export declare function getTelemetrySession(): {
20
- sessionId: string;
21
- startTime: number;
22
- } | null;
23
- /**
24
- * Send session end telemetry (fire-and-forget with short timeout)
25
- */
26
- export declare function sendSessionEndTelemetry(): Promise<void>;
27
7
  /**
28
8
  * Get the current installed version of dev3000
29
9
  */
30
10
  export declare function getCurrentVersion(): string;
31
11
  /**
32
- * Fetch the latest version from our API (with telemetry) or npm registry as fallback
12
+ * Fetch the latest version directly from npm
33
13
  */
34
14
  export declare function fetchLatestVersion(): Promise<string | null>;
35
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AAUA,UAAU,WAAW;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,EAAE,OAAO,CAAA;IACxB,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/C;AAwBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMxG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGrF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CA2B7D;AAgDD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA2EjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAyDrE;AAED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AAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CA4BvE;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC,CAgB5D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAoBrE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgD9G"}
@@ -1,75 +1,9 @@
1
1
  import { execSync, spawnSync } from "child_process";
2
- import { randomUUID } from "crypto";
3
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
4
- import { homedir, platform } from "os";
3
+ import { homedir } from "os";
5
4
  import { dirname, join } from "path";
6
5
  import { fileURLToPath } from "url";
7
6
  const CACHE_TTL_MS = 1000 * 60 * 60; // 1 hour cache
8
- // Telemetry API endpoint
9
- const TELEMETRY_API_URL = "https://dev3000.ai/api/version";
10
- // Session tracking for telemetry
11
- let sessionId = null;
12
- let sessionStartTime = null;
13
- let sessionFramework = null;
14
- /**
15
- * Check if this is a canary version (skip telemetry for local testing)
16
- */
17
- function isCanaryVersion() {
18
- return getCurrentVersion().includes("-canary");
19
- }
20
- /**
21
- * Initialize a new telemetry session
22
- * Call this once at CLI startup
23
- * Skips telemetry for canary versions
24
- */
25
- export function initTelemetrySession(framework) {
26
- if (isCanaryVersion())
27
- return null;
28
- sessionId = randomUUID();
29
- sessionStartTime = Date.now();
30
- sessionFramework = framework || null;
31
- return { sessionId, startTime: sessionStartTime };
32
- }
33
- /**
34
- * Get current session info (returns null if not initialized)
35
- */
36
- export function getTelemetrySession() {
37
- if (!sessionId || !sessionStartTime)
38
- return null;
39
- return { sessionId, startTime: sessionStartTime };
40
- }
41
- /**
42
- * Send session end telemetry (fire-and-forget with short timeout)
43
- */
44
- export async function sendSessionEndTelemetry() {
45
- if (!sessionId || !sessionStartTime)
46
- return;
47
- const duration = Math.round((Date.now() - sessionStartTime) / 1000); // seconds
48
- const currentVersion = getCurrentVersion();
49
- try {
50
- const controller = new AbortController();
51
- const timeout = setTimeout(() => controller.abort(), 2000); // 2 second timeout
52
- await fetch(TELEMETRY_API_URL, {
53
- method: "POST",
54
- headers: { "Content-Type": "application/json" },
55
- body: JSON.stringify({
56
- sid: sessionId,
57
- os: platform(),
58
- v: currentVersion,
59
- d: duration,
60
- fw: sessionFramework
61
- }),
62
- signal: controller.signal
63
- });
64
- clearTimeout(timeout);
65
- }
66
- catch {
67
- // Silently ignore - telemetry should never affect CLI behavior
68
- }
69
- }
70
- /**
71
- * Get the cache file path for version info
72
- */
73
7
  function getCacheFilePath() {
74
8
  return join(homedir(), ".d3k", "version-cache.json");
75
9
  }
@@ -132,7 +66,7 @@ export function getCurrentVersion() {
132
66
  }
133
67
  }
134
68
  /**
135
- * Fetch the latest version from our API (with telemetry) or npm registry as fallback
69
+ * Fetch the latest version directly from npm
136
70
  */
137
71
  export async function fetchLatestVersion() {
138
72
  // Check cache first
@@ -140,35 +74,6 @@ export async function fetchLatestVersion() {
140
74
  if (cached) {
141
75
  return cached;
142
76
  }
143
- // Try our API first (includes telemetry tracking)
144
- try {
145
- const controller = new AbortController();
146
- const timeout = setTimeout(() => controller.abort(), 3000);
147
- // Build URL with telemetry params if session is active
148
- const url = new URL(TELEMETRY_API_URL);
149
- if (sessionId) {
150
- url.searchParams.set("sid", sessionId);
151
- url.searchParams.set("os", platform());
152
- url.searchParams.set("v", getCurrentVersion());
153
- if (sessionFramework) {
154
- url.searchParams.set("fw", sessionFramework);
155
- }
156
- }
157
- const response = await fetch(url.toString(), {
158
- signal: controller.signal
159
- });
160
- clearTimeout(timeout);
161
- if (response.ok) {
162
- const data = await response.json();
163
- if (data.version) {
164
- writeCachedVersion(data.version);
165
- return data.version;
166
- }
167
- }
168
- }
169
- catch {
170
- // Our API failed, fall through to npm fallback
171
- }
172
77
  // Fallback to npm directly (no telemetry)
173
78
  try {
174
79
  // Use npm view with a short timeout