@agfpd/iapeer 0.2.5 → 0.2.6
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.
- package/package.json +1 -1
- package/src/launch/adapters/claude.ts +40 -13
- package/src/launch/launch.test.ts +27 -6
package/package.json
CHANGED
|
@@ -30,15 +30,17 @@ import type { ControlCommand, ControlPlan, LaunchAdapterConfig, LaunchSpec, Runt
|
|
|
30
30
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* Markers that a claude startup dialog / picker is on screen — used by isInputReady
|
|
34
|
+
* to GATE delivery (a dialog up ⇒ not ready). The KEYS that clear each live in
|
|
35
|
+
* bootDialogKeys (NOT uniformly Enter — the resume picker must be NAVIGATED, see there):
|
|
35
36
|
* - 'trust this folder' — first-run folder-trust modal.
|
|
36
37
|
* - 'Allow external CLAUDE.md file imports?' — external-import consent.
|
|
37
38
|
* - 'I am using this for local development' — dev-channels accept
|
|
38
39
|
* (claude-start.sh:337), shown when PEER_START_ARGS carries
|
|
39
40
|
* --dangerously-load-development-channels.
|
|
40
|
-
* - 'Resume from summary'
|
|
41
|
-
*
|
|
41
|
+
* - 'Resume from summary' — the resume compact-picker (default cursor =
|
|
42
|
+
* "summary (recommended)", which compacts; bootDialogKeys picks "full" instead).
|
|
43
|
+
* - 'Resuming the full session' — the post-select load state (still not ready).
|
|
42
44
|
*/
|
|
43
45
|
const CLAUDE_BOOT_DIALOG_MARKERS = [
|
|
44
46
|
'trust this folder',
|
|
@@ -104,7 +106,7 @@ export const claudeAdapter: RuntimeAdapter = {
|
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* argv = claudeBin + headless flags + (system-prompt-file when set) +
|
|
107
|
-
* (--
|
|
109
|
+
* (--continue when resuming) + extraArgs.
|
|
108
110
|
*
|
|
109
111
|
* - '--dangerously-skip-permissions' claude-start.sh:318, spawner.ts:776 —
|
|
110
112
|
* headless peer has no interactive owner to grant per-tool permission.
|
|
@@ -117,8 +119,15 @@ export const claudeAdapter: RuntimeAdapter = {
|
|
|
117
119
|
* ONLY when set (a tui runtime that usesDoctrine composes one). Swaps the
|
|
118
120
|
* CC coding baseline for the merged peer doctrine; plugin/MCP/CLAUDE.md
|
|
119
121
|
* layers stay intact (claude-start.sh:293-303).
|
|
120
|
-
* - '--
|
|
121
|
-
*
|
|
122
|
+
* - '--continue' when spec.resume — continue the cwd's MOST-RECENT session
|
|
123
|
+
* (one session-lineage per peer cwd, so most-recent == the warm peer's
|
|
124
|
+
* session, == the newest transcript resolveResume validated). NOT
|
|
125
|
+
* '--resume <uuid>': in claude 2.1.169 `--resume <arg>` treats arg as a
|
|
126
|
+
* SEARCH QUERY (opens a session-list picker), not a session-id — so a bare
|
|
127
|
+
* uuid no longer resumes directly. `--continue` resumes the last session
|
|
128
|
+
* with no session-list step. The summary-vs-full compact picker still
|
|
129
|
+
* appears (handled in bootDialogKeys: pick "full", never the recommended
|
|
130
|
+
* summary). resolveResume still gates resume-vs-fresh upstream (fail-loud).
|
|
122
131
|
* - ...extraArgs PEER_START_ARGS passthrough (LaunchSpec.extraArgs).
|
|
123
132
|
* NO currency — no marketplace/install/update on this path.
|
|
124
133
|
*/
|
|
@@ -129,19 +138,37 @@ export const claudeAdapter: RuntimeAdapter = {
|
|
|
129
138
|
'--disallowedTools',
|
|
130
139
|
'AskUserQuestion',
|
|
131
140
|
...(spec.systemPromptFile ? ['--system-prompt-file', spec.systemPromptFile] : []),
|
|
132
|
-
...(spec.
|
|
141
|
+
...(spec.resume ? ['--continue'] : []),
|
|
133
142
|
...(spec.extraArgs ?? []),
|
|
134
143
|
]
|
|
135
144
|
},
|
|
136
145
|
|
|
137
146
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
147
|
+
* Map a visible startup dialog to the keys that clear it correctly:
|
|
148
|
+
*
|
|
149
|
+
* - RESUME COMPACT-PICKER ('Resume from summary …') → ['Down','Enter'].
|
|
150
|
+
* This menu's cursor DEFAULTS to "1. Resume from summary (recommended)",
|
|
151
|
+
* and selecting it COMPACTS the session (claude implements that choice as an
|
|
152
|
+
* internal /compact). A bare Enter would therefore silently compact a warm
|
|
153
|
+
* peer on EVERY idle-reap→resume — losing its full context. Move the cursor
|
|
154
|
+
* DOWN one to "2. Resume full session as-is" and confirm, keeping full
|
|
155
|
+
* context. (Verified against the live picker: ❯ on option 1, ↑↓ navigation,
|
|
156
|
+
* "Enter to confirm".)
|
|
157
|
+
* - OTHER MODALS (folder-trust / external-import / dev-channels) → ['Enter']:
|
|
158
|
+
* their default-highlighted option IS the proceed path, so a bare Enter clears
|
|
159
|
+
* each (claude-start.sh:341).
|
|
160
|
+
* - anything else (incl. the post-select "Resuming…" load state) → null (wait).
|
|
142
161
|
*/
|
|
143
162
|
bootDialogKeys(pane: string): string[] | null {
|
|
144
|
-
|
|
163
|
+
if (pane.includes('Resume from summary')) return ['Down', 'Enter']
|
|
164
|
+
if (
|
|
165
|
+
pane.includes('trust this folder') ||
|
|
166
|
+
pane.includes('Allow external CLAUDE.md file imports?') ||
|
|
167
|
+
pane.includes('I am using this for local development')
|
|
168
|
+
) {
|
|
169
|
+
return ['Enter']
|
|
170
|
+
}
|
|
171
|
+
return null
|
|
145
172
|
},
|
|
146
173
|
|
|
147
174
|
/**
|
|
@@ -120,9 +120,12 @@ describe('claudeAdapter', () => {
|
|
|
120
120
|
])
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
-
test('buildArgv with system-prompt-file + resume + extras (
|
|
123
|
+
test('buildArgv with system-prompt-file + resume + extras → --continue (NOT --resume <uuid>)', () => {
|
|
124
|
+
// resume uses `--continue` (continue the cwd's most-recent session), NOT
|
|
125
|
+
// `--resume <uuid>` — in claude 2.1.169 `--resume <arg>` is a search query, not a
|
|
126
|
+
// session-id. resumeRef is set by the daemon but no longer consumed by the launch.
|
|
124
127
|
const argv = claudeAdapter.buildArgv(
|
|
125
|
-
spec({ systemPromptFile: '/tmp/sp.md', resumeRef: 'uuid-1', extraArgs: ['--foo'] }),
|
|
128
|
+
spec({ systemPromptFile: '/tmp/sp.md', resume: true, resumeRef: 'uuid-1', extraArgs: ['--foo'] }),
|
|
126
129
|
cfg,
|
|
127
130
|
)
|
|
128
131
|
expect(argv).toEqual([
|
|
@@ -132,10 +135,17 @@ describe('claudeAdapter', () => {
|
|
|
132
135
|
'AskUserQuestion',
|
|
133
136
|
'--system-prompt-file',
|
|
134
137
|
'/tmp/sp.md',
|
|
135
|
-
'--
|
|
136
|
-
'uuid-1',
|
|
138
|
+
'--continue',
|
|
137
139
|
'--foo',
|
|
138
140
|
])
|
|
141
|
+
expect(argv).not.toContain('--resume')
|
|
142
|
+
expect(argv).not.toContain('uuid-1')
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
test('buildArgv: resume FALSE (fresh) → no --continue / --resume', () => {
|
|
146
|
+
const argv = claudeAdapter.buildArgv(spec({ resume: false, resumeRef: 'uuid-1' }), cfg)
|
|
147
|
+
expect(argv).not.toContain('--continue')
|
|
148
|
+
expect(argv).not.toContain('--resume')
|
|
139
149
|
})
|
|
140
150
|
|
|
141
151
|
test('buildArgv carries NO currency (no marketplace/plugin tokens)', () => {
|
|
@@ -153,12 +163,23 @@ describe('claudeAdapter', () => {
|
|
|
153
163
|
expect(claudeAdapter.isInputReady('❯ just a prompt')).toBe(false)
|
|
154
164
|
})
|
|
155
165
|
|
|
156
|
-
test('bootDialogKeys:
|
|
166
|
+
test('bootDialogKeys: proceed-modals → [Enter]; clean/load pane → null', () => {
|
|
157
167
|
expect(claudeAdapter.bootDialogKeys('I am using this for local development')).toEqual(['Enter'])
|
|
158
|
-
expect(claudeAdapter.bootDialogKeys('
|
|
168
|
+
expect(claudeAdapter.bootDialogKeys('trust this folder')).toEqual(['Enter'])
|
|
169
|
+
expect(claudeAdapter.bootDialogKeys('Allow external CLAUDE.md file imports?')).toEqual(['Enter'])
|
|
170
|
+
// the post-select "Resuming…" load state is NOT a modal to Enter — just wait.
|
|
171
|
+
expect(claudeAdapter.bootDialogKeys('Resuming the full session')).toBeNull()
|
|
159
172
|
expect(claudeAdapter.bootDialogKeys('❯ ready')).toBeNull()
|
|
160
173
|
})
|
|
161
174
|
|
|
175
|
+
test('bootDialogKeys: resume compact-picker → [Down, Enter] (pick "full", NOT the recommended summary)', () => {
|
|
176
|
+
// Default cursor is "1. Resume from summary (recommended)"; bare Enter would compact.
|
|
177
|
+
// Move DOWN to "2. Resume full session as-is" and confirm → full context preserved.
|
|
178
|
+
expect(
|
|
179
|
+
claudeAdapter.bootDialogKeys('❯ 1. Resume from summary (recommended)\n 2. Resume full session as-is'),
|
|
180
|
+
).toEqual(['Down', 'Enter'])
|
|
181
|
+
})
|
|
182
|
+
|
|
162
183
|
test('permissionDialog: proceed prompt → active, [Enter]', () => {
|
|
163
184
|
expect(claudeAdapter.permissionDialogActive('Do you want to proceed?')).toBe(true)
|
|
164
185
|
expect(claudeAdapter.permissionDialogActive('nothing')).toBe(false)
|