amp-acp 0.3.0 → 0.3.7

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 (3) hide show
  1. package/AGENTS.md +22 -0
  2. package/package.json +6 -2
  3. package/src/server.js +34 -2
package/AGENTS.md ADDED
@@ -0,0 +1,22 @@
1
+ # AGENTS.md
2
+
3
+ ## Commands
4
+ - `npm start` or `node src/index.js` — Run the ACP adapter
5
+ - `npm run lint` — Lint (currently a no-op)
6
+ - `npm test` — Test (currently a no-op)
7
+
8
+ ## Architecture
9
+ This is an ACP (Agent Client Protocol) adapter that bridges Amp Code to ACP-compatible clients like Zed.
10
+
11
+ - `src/index.js` — Entry point, redirects console to stderr (stdout reserved for ACP stream)
12
+ - `src/run-acp.js` — Sets up ACP connection using stdin/stdout JSON streams
13
+ - `src/server.js` — `AmpAcpAgent` class: handles sessions, prompts, MCP config, and calls `@sourcegraph/amp-sdk`
14
+ - `src/to-acp.js` — Converts Amp stream events to ACP `sessionUpdate` notifications
15
+ - `src/utils.js` — Node-to-Web stream converters
16
+
17
+ ## Code Style
18
+ - ES modules (`"type": "module"` in package.json), use `.js` extension in imports
19
+ - No TypeScript; plain JavaScript with JSDoc if needed
20
+ - Use `console.error` for logging (stdout is for ACP protocol only)
21
+ - Error handling: throw `RequestError` from `@agentclientprotocol/sdk` for protocol errors
22
+ - Naming: camelCase for variables/functions, PascalCase for classes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amp-acp",
3
- "version": "0.3.0",
3
+ "version": "0.3.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,6 +8,10 @@
8
8
  },
9
9
  "description": "ACP adapter that bridges Amp Code to Agent Client Protocol (Zed external agent)",
10
10
  "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/tao12345666333/amp-acp"
14
+ },
11
15
  "scripts": {
12
16
  "start": "node src/index.js",
13
17
  "lint": "echo 'no lint'",
@@ -18,4 +22,4 @@
18
22
  "@sourcegraph/amp": "^0.0.1765685598-g5365e6",
19
23
  "@sourcegraph/amp-sdk": "^0.1.0-20251214200908-g3251f72"
20
24
  }
21
- }
25
+ }
package/src/server.js CHANGED
@@ -50,7 +50,7 @@ export class AmpAcpAgent {
50
50
  mcpConfig,
51
51
  });
52
52
 
53
- return {
53
+ const result = {
54
54
  sessionId,
55
55
  modes: {
56
56
  currentModeId: 'default',
@@ -60,6 +60,27 @@ export class AmpAcpAgent {
60
60
  ],
61
61
  },
62
62
  };
63
+
64
+ setImmediate(async () => {
65
+ try {
66
+ await this.client.sessionUpdate({
67
+ sessionId,
68
+ update: {
69
+ sessionUpdate: 'available_commands_update',
70
+ availableCommands: [
71
+ {
72
+ name: 'init',
73
+ description: 'Generate an AGENTS.md file for the project',
74
+ },
75
+ ],
76
+ },
77
+ });
78
+ } catch (e) {
79
+ console.error('[acp] failed to send available_commands_update', e);
80
+ }
81
+ });
82
+
83
+ return result;
63
84
  }
64
85
 
65
86
  async authenticate(_params) {
@@ -77,7 +98,18 @@ export class AmpAcpAgent {
77
98
  for (const chunk of params.prompt) {
78
99
  switch (chunk.type) {
79
100
  case 'text':
80
- textInput += chunk.text;
101
+ if (chunk.text.trim() === '/init') {
102
+ textInput += `Please analyze this codebase and create an AGENTS.md file containing:
103
+ 1. Build/lint/test commands - especially for running a single test
104
+ 2. Architecture and codebase structure information, including important subprojects, internal APIs, databases, etc.
105
+ 3. Code style guidelines, including imports, conventions, formatting, types, naming conventions, error handling, etc.
106
+
107
+ The file you create will be given to agentic coding tools (such as yourself) that operate in this repository. Make it about 20 lines long.
108
+
109
+ If there are Cursor rules (in .cursor/rules/ or .cursorrules), Claude rules (CLAUDE.md), Windsurf rules (.windsurfrules), Cline rules (.clinerules), Goose rules (.goosehints), or Copilot rules (in .github/copilot-instructions.md), make sure to include them. Also, first check if there is an existing AGENTS.md or AGENT.md file, and if so, update it instead of overwriting it.`;
110
+ } else {
111
+ textInput += chunk.text;
112
+ }
81
113
  break;
82
114
  case 'resource_link':
83
115
  textInput += `\n${chunk.uri}\n`;