@adhdev/daemon-core 0.9.82-rc.376 → 0.9.82-rc.377

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 (41) hide show
  1. package/dist/commands/chat-commands-debug-bundle.d.ts +14 -0
  2. package/dist/commands/chat-commands-read.d.ts +7 -0
  3. package/dist/commands/chat-commands-scope.d.ts +39 -0
  4. package/dist/commands/chat-commands-shared.d.ts +33 -0
  5. package/dist/commands/chat-commands-write.d.ts +14 -0
  6. package/dist/commands/chat-commands.d.ts +9 -49
  7. package/dist/index.js +2976 -2943
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2971 -2938
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/mesh/mesh-event-classify.d.ts +5 -0
  12. package/dist/mesh/mesh-event-forwarding.d.ts +18 -0
  13. package/dist/mesh/mesh-events-coordinator.d.ts +4 -92
  14. package/dist/mesh/mesh-events-utils.d.ts +3 -0
  15. package/dist/mesh/mesh-ledger-reconciliation.d.ts +0 -1
  16. package/dist/mesh/mesh-queue-assignment.d.ts +86 -0
  17. package/dist/mesh/mesh-runtime-store.d.ts +0 -3
  18. package/dist/providers/native-history/constants.d.ts +12 -0
  19. package/dist/runtime-defaults.d.ts +2 -0
  20. package/package.json +2 -2
  21. package/src/commands/chat-commands-debug-bundle.ts +398 -0
  22. package/src/commands/chat-commands-read.ts +2327 -0
  23. package/src/commands/chat-commands-scope.ts +54 -0
  24. package/src/commands/chat-commands-shared.ts +114 -0
  25. package/src/commands/chat-commands-write.ts +880 -0
  26. package/src/commands/chat-commands.ts +20 -3697
  27. package/src/commands/router.ts +5 -12
  28. package/src/mesh/mesh-event-classify.ts +51 -0
  29. package/src/mesh/mesh-event-forwarding.ts +1502 -0
  30. package/src/mesh/mesh-events-coordinator.ts +30 -2993
  31. package/src/mesh/mesh-events-pending.ts +1 -10
  32. package/src/mesh/mesh-events-stale.ts +3 -14
  33. package/src/mesh/mesh-events-utils.ts +52 -14
  34. package/src/mesh/mesh-ledger-reconciliation.ts +0 -2
  35. package/src/mesh/mesh-queue-assignment.ts +1457 -0
  36. package/src/mesh/mesh-runtime-store.ts +0 -37
  37. package/src/providers/cli-provider-instance.ts +40 -1
  38. package/src/providers/native-history/constants.ts +19 -0
  39. package/src/providers/native-history/dispatcher.ts +2 -3
  40. package/src/providers/spec/native-history-executor.ts +1 -9
  41. package/src/runtime-defaults.ts +39 -0
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Chat Commands — get_chat_debug_bundle: sanitize, summarize and store a
3
+ * diagnostic snapshot of the current read_chat / provider / session state.
4
+ */
5
+ import type { CommandResult, CommandHelpers } from './handler.js';
6
+ interface DebugSanitizeOptions {
7
+ maxDepth?: number;
8
+ maxArrayLength?: number;
9
+ maxObjectKeys?: number;
10
+ maxStringLength?: number;
11
+ }
12
+ export declare function sanitizeDebugBundleValue(value: unknown, options?: DebugSanitizeOptions, depth?: number, keyHint?: string): unknown;
13
+ export declare function handleGetChatDebugBundle(h: CommandHelpers, args: any): Promise<CommandResult>;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Chat Commands — read side: handleReadChat, handleChatHistory and the
3
+ * native-history / source-resolution / normalization helpers they use.
4
+ */
5
+ import type { CommandResult, CommandHelpers } from './handler.js';
6
+ export declare function handleChatHistory(h: CommandHelpers, args: any): Promise<CommandResult>;
7
+ export declare function handleReadChat(h: CommandHelpers, args: any): Promise<CommandResult>;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Chat Commands — read_chat node workspace scope guard.
3
+ */
4
+ import type { CommandHelpers } from './handler.js';
5
+ /**
6
+ * read_chat node scope verdict. One physical daemon hosts a base node plus several
7
+ * worktree nodes; mesh_read_chat always dispatches read_chat with the requested
8
+ * node's workspace (`args.workspace`). When the resolved target session actually
9
+ * lives in a DIFFERENT worktree, returning its transcript — or worse, letting the
10
+ * native-history-by-workspace fallback splice sibling worktree turns into the
11
+ * reply — makes the coordinator believe one session received every worktree's
12
+ * work. This guard refuses a CONFIRMED cross-workspace read instead of mixing.
13
+ *
14
+ * Conservative by design (mirrors the WTCLAIM fix-B "unknown → allow" rule): only
15
+ * a session id that resolves to a known workspace which is unequal to a known
16
+ * intended workspace blocks. When either side is unknown — no targetSessionId, no
17
+ * args.workspace, an unregistered session, the coordinator self-session, or a
18
+ * plain dashboard read that never passes a node workspace — the read proceeds
19
+ * untouched, so base-node and same-daemon coordinator reads never regress.
20
+ */
21
+ export declare function evaluateReadChatNodeWorkspaceScope(args: {
22
+ targetSessionId?: string;
23
+ intendedWorkspace?: string;
24
+ sessionWorkspace?: string;
25
+ }): {
26
+ scoped: false;
27
+ } | {
28
+ scoped: true;
29
+ intended: string;
30
+ actual: string;
31
+ };
32
+ /**
33
+ * Resolve the target session's ACTUAL workspace from the most authoritative source
34
+ * available on this daemon: the session registry record (stamped at register
35
+ * time), then the live CLI adapter's working directory, then the bound instance
36
+ * state. Returns '' when nothing knows the session's workspace — the caller treats
37
+ * that as "unknown" and does not block.
38
+ */
39
+ export declare function resolveTargetSessionActualWorkspace(h: CommandHelpers, targetSessionId: string): string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Chat Commands — shared private helpers used by more than one handler group.
3
+ *
4
+ * These were module-local helpers/consts/interfaces in chat-commands.ts. They
5
+ * are exported here only so the split read/write/debug/scope sub-modules can
6
+ * import them; they are NOT part of the public chat-commands surface (except
7
+ * READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS and buildSendInputSignature, which the
8
+ * chat-commands barrel re-exports).
9
+ */
10
+ import type { CommandHelpers } from './handler.js';
11
+ import type { CliAdapter } from '../cli-adapter-types.js';
12
+ import { type InputEnvelope, type ProviderModule } from '../providers/contracts.js';
13
+ import type { ProviderInstance } from '../providers/provider-instance.js';
14
+ import type { ChatMessage } from '../types.js';
15
+ import type { SessionTransport } from '../shared-types.js';
16
+ export declare const READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25000;
17
+ export interface ApprovalSelectableInstance extends ProviderInstance {
18
+ recordApprovalSelection?(buttonText: string): void;
19
+ }
20
+ export interface RuntimeChatMessageMerger extends ProviderInstance {
21
+ mergeRuntimeChatMessages?(messages: ChatMessage[]): ChatMessage[];
22
+ recordAcknowledgedUserInput?(input: InputEnvelope | string): void;
23
+ }
24
+ export declare function getCurrentProviderType(h: CommandHelpers, fallback?: string): string;
25
+ export declare function getCurrentManagerKey(h: CommandHelpers): string;
26
+ export declare function getTargetedCliAdapter(h: CommandHelpers, args: any, providerType?: string): CliAdapter | null;
27
+ export declare function getTargetInstance(h: CommandHelpers, args: any): ApprovalSelectableInstance | null;
28
+ export declare function getTargetTransport(h: CommandHelpers, provider?: ProviderModule): SessionTransport | null;
29
+ export declare function isCliLikeTransport(transport: SessionTransport | null): boolean;
30
+ export declare function isExtensionTransport(transport: SessionTransport | null): boolean;
31
+ export declare function buildSendInputSignature(input: InputEnvelope): string;
32
+ export declare function parseMaybeJson(value: any): any;
33
+ export declare function getChatMessageSignature(message: ChatMessage | null | undefined): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Chat Commands — write side: handleSendChat, handleListChats, handleNewChat,
3
+ * handleSwitchChat, handleSetMode, handleChangeModel, handleSetThoughtLevel,
4
+ * handleResolveAction and the send/mode/model helpers they use.
5
+ */
6
+ import type { CommandResult, CommandHelpers } from './handler.js';
7
+ export declare function handleSendChat(h: CommandHelpers, args: any): Promise<CommandResult>;
8
+ export declare function handleListChats(h: CommandHelpers, args: any): Promise<CommandResult>;
9
+ export declare function handleNewChat(h: CommandHelpers, args: any): Promise<CommandResult>;
10
+ export declare function handleSwitchChat(h: CommandHelpers, args: any): Promise<CommandResult>;
11
+ export declare function handleSetMode(h: CommandHelpers, args: any): Promise<CommandResult>;
12
+ export declare function handleChangeModel(h: CommandHelpers, args: any): Promise<CommandResult>;
13
+ export declare function handleSetThoughtLevel(h: CommandHelpers, args: any): Promise<CommandResult>;
14
+ export declare function handleResolveAction(h: CommandHelpers, args: any): Promise<CommandResult>;
@@ -1,54 +1,14 @@
1
1
  /**
2
2
  * Chat Commands — readChat, sendChat, listChats, newChat, switchChat,
3
3
  * setMode, changeModel, setThoughtLevel, resolveAction, chatHistory
4
- */
5
- import type { CommandResult, CommandHelpers } from './handler.js';
6
- import { type InputEnvelope } from '../providers/contracts.js';
7
- export declare const READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25000;
8
- export declare function buildSendInputSignature(input: InputEnvelope): string;
9
- /**
10
- * read_chat node scope verdict. One physical daemon hosts a base node plus several
11
- * worktree nodes; mesh_read_chat always dispatches read_chat with the requested
12
- * node's workspace (`args.workspace`). When the resolved target session actually
13
- * lives in a DIFFERENT worktree, returning its transcript — or worse, letting the
14
- * native-history-by-workspace fallback splice sibling worktree turns into the
15
- * reply — makes the coordinator believe one session received every worktree's
16
- * work. This guard refuses a CONFIRMED cross-workspace read instead of mixing.
17
4
  *
18
- * Conservative by design (mirrors the WTCLAIM fix-B "unknown allow" rule): only
19
- * a session id that resolves to a known workspace which is unequal to a known
20
- * intended workspace blocks. When either side is unknown no targetSessionId, no
21
- * args.workspace, an unregistered session, the coordinator self-session, or a
22
- * plain dashboard read that never passes a node workspace — the read proceeds
23
- * untouched, so base-node and same-daemon coordinator reads never regress.
5
+ * This module is a re-export barrel. The implementation was split into focused
6
+ * sub-modules (chat-commands-shared / -scope / -debug-bundle / -read / -write)
7
+ * as a pure move; the public export surface here is unchanged. handler.ts does
8
+ * `import * as Chat from './chat-commands.js'` and keeps working unchanged.
24
9
  */
25
- export declare function evaluateReadChatNodeWorkspaceScope(args: {
26
- targetSessionId?: string;
27
- intendedWorkspace?: string;
28
- sessionWorkspace?: string;
29
- }): {
30
- scoped: false;
31
- } | {
32
- scoped: true;
33
- intended: string;
34
- actual: string;
35
- };
36
- interface DebugSanitizeOptions {
37
- maxDepth?: number;
38
- maxArrayLength?: number;
39
- maxObjectKeys?: number;
40
- maxStringLength?: number;
41
- }
42
- export declare function sanitizeDebugBundleValue(value: unknown, options?: DebugSanitizeOptions, depth?: number, keyHint?: string): unknown;
43
- export declare function handleGetChatDebugBundle(h: CommandHelpers, args: any): Promise<CommandResult>;
44
- export declare function handleChatHistory(h: CommandHelpers, args: any): Promise<CommandResult>;
45
- export declare function handleReadChat(h: CommandHelpers, args: any): Promise<CommandResult>;
46
- export declare function handleSendChat(h: CommandHelpers, args: any): Promise<CommandResult>;
47
- export declare function handleListChats(h: CommandHelpers, args: any): Promise<CommandResult>;
48
- export declare function handleNewChat(h: CommandHelpers, args: any): Promise<CommandResult>;
49
- export declare function handleSwitchChat(h: CommandHelpers, args: any): Promise<CommandResult>;
50
- export declare function handleSetMode(h: CommandHelpers, args: any): Promise<CommandResult>;
51
- export declare function handleChangeModel(h: CommandHelpers, args: any): Promise<CommandResult>;
52
- export declare function handleSetThoughtLevel(h: CommandHelpers, args: any): Promise<CommandResult>;
53
- export declare function handleResolveAction(h: CommandHelpers, args: any): Promise<CommandResult>;
54
- export {};
10
+ export { READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, buildSendInputSignature } from './chat-commands-shared.js';
11
+ export { evaluateReadChatNodeWorkspaceScope } from './chat-commands-scope.js';
12
+ export { sanitizeDebugBundleValue, handleGetChatDebugBundle } from './chat-commands-debug-bundle.js';
13
+ export { handleChatHistory, handleReadChat } from './chat-commands-read.js';
14
+ export { handleSendChat, handleListChats, handleNewChat, handleSwitchChat, handleSetMode, handleChangeModel, handleSetThoughtLevel, handleResolveAction, } from './chat-commands-write.js';