@adhdev/daemon-core 0.9.76-rc.56 → 0.9.76-rc.57
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/dist/index.js +22 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -10
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
- package/src/mesh/coordinator-prompt.ts +3 -3
- package/src/providers/chat-message-normalization.ts +12 -5
- package/src/providers/read-chat-contract.ts +8 -0
- package/src/types.ts +9 -0
package/dist/types.d.ts
CHANGED
|
@@ -42,6 +42,15 @@ export interface ChatMessage {
|
|
|
42
42
|
/** Optional: fiber metadata */
|
|
43
43
|
_type?: string;
|
|
44
44
|
_sub?: string;
|
|
45
|
+
/** Transcript visibility/audience contract for separating chat-visible content from internal/debug runtime rows. */
|
|
46
|
+
visibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
|
|
47
|
+
transcriptVisibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
|
|
48
|
+
audience?: 'chat' | 'debug' | 'trace' | 'internal' | (string & {});
|
|
49
|
+
source?: 'assistant_text' | 'tool_call' | 'terminal_command' | 'runtime_activity' | 'runtime_status' | 'provider_chrome' | 'control' | (string & {});
|
|
50
|
+
userFacing?: boolean;
|
|
51
|
+
internal?: boolean;
|
|
52
|
+
isInternal?: boolean;
|
|
53
|
+
debug?: boolean;
|
|
45
54
|
/** Meta information for thought/terminal logs etc */
|
|
46
55
|
meta?: {
|
|
47
56
|
label?: string;
|
package/package.json
CHANGED
|
@@ -145,8 +145,8 @@ const WORKFLOW_SECTION = `## Orchestration Workflow
|
|
|
145
145
|
b. If you need branch isolation for parallel work, call \`mesh_clone_node\` to create a worktree node first.
|
|
146
146
|
c. If no session exists, call \`mesh_launch_session\` to start one.
|
|
147
147
|
d. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
|
|
148
|
-
4. **Monitor** —
|
|
149
|
-
5. **Verify** — When a task reports completion, call \`mesh_git_status\` to verify changes were made.
|
|
148
|
+
4. **Monitor** — Prefer event-driven completion/status notifications. Do **not** poll \`mesh_read_chat\` repeatedly just because the delegated session has not produced a final assistant message yet; tool/terminal activity means work may still be in progress. Use at most one compact \`mesh_read_chat\` check after a completion/approval signal, an explicit user status request, or a real timeout/stall. Handle approvals via \`mesh_approve\`.
|
|
149
|
+
5. **Verify** — When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
|
|
150
150
|
6. **Checkpoint** — Call \`mesh_checkpoint\` to save the work.
|
|
151
151
|
7. **Clean up** — Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
|
|
152
152
|
8. **Report** — Summarize what was done, what changed, and any issues.`;
|
|
@@ -163,7 +163,7 @@ function buildRulesSection(coordinatorCliType?: string): string {
|
|
|
163
163
|
- **Respect explicit provider requests.** If the user names an agent/provider, pass the matching provider type to \`mesh_launch_session\`: Hermes → \`hermes-cli\`, Claude Code/Claude → \`claude-cli\`, Codex → \`codex-cli\`, Gemini → \`gemini-cli\`. Never substitute \`claude-cli\` just because the coordinator itself is Claude Code.
|
|
164
164
|
- **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
|
|
165
165
|
- **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
|
|
166
|
-
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
|
|
166
|
+
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed. Never launch a duplicate session or second worker solely because \`mesh_read_chat\` has no final assistant message while the delegated session is still showing tool/terminal activity.
|
|
167
167
|
- **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
|
|
168
168
|
- **Keep the user informed.** Report progress after each delegation round — one or two sentences, not a narration.
|
|
169
169
|
- **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
|
|
@@ -183,11 +183,16 @@ function readStringField(value: unknown): string {
|
|
|
183
183
|
return typeof value === 'string' ? value.trim().toLowerCase() : '';
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
function readVisibilityField(message: ChatMessage, meta: Record<string, unknown> | null): string {
|
|
187
|
+
const record = message as ChatMessage & Record<string, unknown>;
|
|
188
|
+
return readStringField(record.visibility ?? record.transcriptVisibility ?? meta?.visibility ?? meta?.transcriptVisibility);
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
function isExplicitlyHiddenFromTranscript(message: ChatMessage, meta: Record<string, unknown> | null): boolean {
|
|
187
192
|
const record = message as ChatMessage & Record<string, unknown>;
|
|
188
|
-
const visibility =
|
|
189
|
-
const audience = readStringField(record.audience
|
|
190
|
-
const source = readStringField(record.source
|
|
193
|
+
const visibility = readVisibilityField(message, meta);
|
|
194
|
+
const audience = readStringField(record.audience ?? meta?.audience);
|
|
195
|
+
const source = readStringField(record.source ?? meta?.source);
|
|
191
196
|
|
|
192
197
|
return visibility === 'hidden'
|
|
193
198
|
|| visibility === 'debug'
|
|
@@ -196,6 +201,7 @@ function isExplicitlyHiddenFromTranscript(message: ChatMessage, meta: Record<str
|
|
|
196
201
|
|| audience === 'trace'
|
|
197
202
|
|| audience === 'internal'
|
|
198
203
|
|| source === 'runtime_status'
|
|
204
|
+
|| source === 'runtime_activity'
|
|
199
205
|
|| source === 'provider_chrome'
|
|
200
206
|
|| source === 'control'
|
|
201
207
|
|| record.internal === true
|
|
@@ -210,10 +216,11 @@ function isExplicitlyHiddenFromTranscript(message: ChatMessage, meta: Record<str
|
|
|
210
216
|
|
|
211
217
|
function isExplicitlyVisibleInTranscript(message: ChatMessage, meta: Record<string, unknown> | null): boolean {
|
|
212
218
|
const record = message as ChatMessage & Record<string, unknown>;
|
|
213
|
-
const visibility =
|
|
214
|
-
const audience = readStringField(record.audience
|
|
219
|
+
const visibility = readVisibilityField(message, meta);
|
|
220
|
+
const audience = readStringField(record.audience ?? meta?.audience);
|
|
215
221
|
return visibility === 'visible'
|
|
216
222
|
|| visibility === 'user'
|
|
223
|
+
|| visibility === 'chat'
|
|
217
224
|
|| audience === 'chat'
|
|
218
225
|
|| record.userFacing === true
|
|
219
226
|
|| meta?.userFacing === true;
|
|
@@ -77,6 +77,14 @@ function validateMessage(message: unknown, source: string, index: number): ChatM
|
|
|
77
77
|
if (typeof message.senderName === 'string') normalized.senderName = message.senderName
|
|
78
78
|
if (typeof (message as any)._type === 'string') normalized._type = (message as any)._type
|
|
79
79
|
if (typeof (message as any)._sub === 'string') normalized._sub = (message as any)._sub
|
|
80
|
+
if (typeof (message as any).visibility === 'string') normalized.visibility = (message as any).visibility
|
|
81
|
+
if (typeof (message as any).transcriptVisibility === 'string') normalized.transcriptVisibility = (message as any).transcriptVisibility
|
|
82
|
+
if (typeof (message as any).audience === 'string') normalized.audience = (message as any).audience
|
|
83
|
+
if (typeof (message as any).source === 'string') normalized.source = (message as any).source
|
|
84
|
+
if (typeof (message as any).userFacing === 'boolean') normalized.userFacing = (message as any).userFacing
|
|
85
|
+
if (typeof (message as any).internal === 'boolean') normalized.internal = (message as any).internal
|
|
86
|
+
if (typeof (message as any).isInternal === 'boolean') normalized.isInternal = (message as any).isInternal
|
|
87
|
+
if (typeof (message as any).debug === 'boolean') normalized.debug = (message as any).debug
|
|
80
88
|
|
|
81
89
|
return normalized
|
|
82
90
|
}
|
package/src/types.ts
CHANGED
|
@@ -49,6 +49,15 @@ export interface ChatMessage {
|
|
|
49
49
|
/** Optional: fiber metadata */
|
|
50
50
|
_type?: string;
|
|
51
51
|
_sub?: string;
|
|
52
|
+
/** Transcript visibility/audience contract for separating chat-visible content from internal/debug runtime rows. */
|
|
53
|
+
visibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
|
|
54
|
+
transcriptVisibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
|
|
55
|
+
audience?: 'chat' | 'debug' | 'trace' | 'internal' | (string & {});
|
|
56
|
+
source?: 'assistant_text' | 'tool_call' | 'terminal_command' | 'runtime_activity' | 'runtime_status' | 'provider_chrome' | 'control' | (string & {});
|
|
57
|
+
userFacing?: boolean;
|
|
58
|
+
internal?: boolean;
|
|
59
|
+
isInternal?: boolean;
|
|
60
|
+
debug?: boolean;
|
|
52
61
|
/** Meta information for thought/terminal logs etc */
|
|
53
62
|
meta?: { label?: string; isRunning?: boolean } | Record<string, any>;
|
|
54
63
|
/** Sender name for shared sessions */
|