@yeaft/webchat-agent 0.1.854 → 0.1.856
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/bin/yeaft-stats.js +3 -3
- package/connection/message-router.js +73 -44
- package/context.js +4 -4
- package/expert-roles.js +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
- package/service/index.js +1 -1
- package/{unify → yeaft}/attachments.js +7 -7
- package/{unify → yeaft}/cli.js +4 -4
- package/{unify → yeaft}/compact/compactor.js +10 -10
- package/{unify → yeaft}/config-api.js +12 -12
- package/{unify → yeaft}/config.js +19 -19
- package/{unify → yeaft}/conversation/migrate-messages-threadid.js +1 -1
- package/{unify → yeaft}/conversation/persist.js +194 -65
- package/{unify → yeaft}/conversation/search.js +28 -23
- package/{unify → yeaft}/debug-trace.js +1 -1
- package/{unify → yeaft}/dream-v2/limits.js +3 -3
- package/{unify → yeaft}/dream-v2/runner.js +1 -1
- package/{unify → yeaft}/dream-v2/session-wiring.js +2 -2
- package/{unify → yeaft}/effort.js +2 -2
- package/{unify → yeaft}/engine.js +8 -8
- package/{unify → yeaft}/eval/run-eval.js +11 -11
- package/{unify → yeaft}/eval/runner.js +1 -1
- package/{unify → yeaft}/groups/feature-flag.js +2 -2
- package/{unify → yeaft}/groups/index.js +2 -2
- package/{unify → yeaft}/groups/pre-flow.js +1 -1
- package/{unify → yeaft}/groups/project-doc.js +1 -1
- package/{unify → yeaft}/history-compact.js +3 -3
- package/{unify → yeaft}/index.js +1 -1
- package/{unify → yeaft}/init.js +15 -9
- package/{unify → yeaft}/llm/adapter.js +1 -1
- package/{unify → yeaft}/llm/anthropic.js +2 -2
- package/{unify → yeaft}/llm/models-dev.js +10 -3
- package/{unify → yeaft}/llm/openai-responses.js +2 -2
- package/{unify → yeaft}/llm/router.js +1 -1
- package/{unify → yeaft}/mcp.js +1 -1
- package/{unify → yeaft}/memory/ams-registry.js +1 -1
- package/{unify → yeaft}/memory/seed-backfill.js +1 -1
- package/{unify → yeaft}/memory/store-v2.js +1 -1
- package/{unify → yeaft}/models.js +3 -3
- package/{unify → yeaft}/pair-sanitize.js +2 -2
- package/{unify → yeaft}/personas.js +1 -1
- package/{unify → yeaft}/prompts.js +1 -1
- package/{unify → yeaft}/routing/index.js +1 -1
- package/{unify → yeaft}/routing/router.js +1 -1
- package/{unify → yeaft}/session.js +8 -8
- package/{unify → yeaft}/skills.js +2 -2
- package/{unify → yeaft}/stats/format.js +1 -1
- package/{unify → yeaft}/stop-hooks.js +1 -1
- package/{unify → yeaft}/sub-agent/runner.js +1 -1
- package/{unify → yeaft}/tools/ask-user.js +2 -2
- package/{unify → yeaft}/tools/enter-worktree.js +1 -1
- package/{unify → yeaft}/tools/exit-worktree.js +1 -1
- package/{unify → yeaft}/tools/mcp-tools.js +1 -1
- package/{unify → yeaft}/tools/registry.js +2 -2
- package/{unify → yeaft}/tools/skill.js +1 -1
- package/{unify → yeaft}/tools/start-plan.js +1 -1
- package/{unify → yeaft}/tools/types.js +3 -3
- package/{unify → yeaft}/tools/web-search.js +1 -1
- package/{unify → yeaft}/turn-utils.js +1 -1
- package/{unify → yeaft}/vp/index.js +1 -1
- package/{unify → yeaft}/vp/registry.js +1 -1
- package/{unify → yeaft}/vp/vp-bridge.js +8 -8
- package/{unify → yeaft}/web-bridge.js +230 -230
- /package/{unify → yeaft}/archive/tool-results.js +0 -0
- /package/{unify → yeaft}/archive/trace.js +0 -0
- /package/{unify → yeaft}/archive/turn-archive.js +0 -0
- /package/{unify → yeaft}/compact/decisions-log.js +0 -0
- /package/{unify → yeaft}/compact/orchestrator.js +0 -0
- /package/{unify → yeaft}/compact/triggers.js +0 -0
- /package/{unify → yeaft}/compact/turn-group.js +0 -0
- /package/{unify → yeaft}/dream-v2/apply.js +0 -0
- /package/{unify → yeaft}/dream-v2/merge.js +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/create.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/extract-group.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/extract-topic.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/extract-user.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/extract-vp.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/index.js +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/summarize-scope.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/triage-pass1.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/triage-pass2.md +0 -0
- /package/{unify → yeaft}/dream-v2/prompts/update.md +0 -0
- /package/{unify → yeaft}/dream-v2/schedule.js +0 -0
- /package/{unify → yeaft}/dream-v2/segment.js +0 -0
- /package/{unify → yeaft}/dream-v2/snapshot.js +0 -0
- /package/{unify → yeaft}/dream-v2/state.js +0 -0
- /package/{unify → yeaft}/dream-v2/triage.js +0 -0
- /package/{unify → yeaft}/eval/cases/e2e.js +0 -0
- /package/{unify → yeaft}/eval/cases/memory.js +0 -0
- /package/{unify → yeaft}/eval/cases/skills.js +0 -0
- /package/{unify → yeaft}/eval/cases/tool-use.js +0 -0
- /package/{unify → yeaft}/groups/coordinator.js +0 -0
- /package/{unify → yeaft}/groups/group-config.js +0 -0
- /package/{unify → yeaft}/groups/group-crud.js +0 -0
- /package/{unify → yeaft}/groups/group-store.js +0 -0
- /package/{unify → yeaft}/groups/ids.js +0 -0
- /package/{unify → yeaft}/groups/roster.js +0 -0
- /package/{unify → yeaft}/groups/seed-default.js +0 -0
- /package/{unify → yeaft}/llm/credentials/github-copilot.js +0 -0
- /package/{unify → yeaft}/llm/credentials/index.js +0 -0
- /package/{unify → yeaft}/memory/adjust.js +0 -0
- /package/{unify → yeaft}/memory/ams.js +0 -0
- /package/{unify → yeaft}/memory/budget.js +0 -0
- /package/{unify → yeaft}/memory/consolidate.js +0 -0
- /package/{unify → yeaft}/memory/index-db.js +0 -0
- /package/{unify → yeaft}/memory/keywords.js +0 -0
- /package/{unify → yeaft}/memory/preflow.js +0 -0
- /package/{unify → yeaft}/memory/segment-store.js +0 -0
- /package/{unify → yeaft}/memory/segment-sync.js +0 -0
- /package/{unify → yeaft}/memory/segment.js +0 -0
- /package/{unify → yeaft}/memory/summary-store.js +0 -0
- /package/{unify → yeaft}/router/continuity.js +0 -0
- /package/{unify → yeaft}/router/thinking.js +0 -0
- /package/{unify → yeaft}/routing/loop-guard.js +0 -0
- /package/{unify → yeaft}/stats/tool-usage.js +0 -0
- /package/{unify → yeaft}/storage/atomic.js +0 -0
- /package/{unify → yeaft}/storage/compact.js +0 -0
- /package/{unify → yeaft}/storage/index.js +0 -0
- /package/{unify → yeaft}/storage/jsonl-index.js +0 -0
- /package/{unify → yeaft}/storage/jsonl-log.js +0 -0
- /package/{unify → yeaft}/storage/shard-index.js +0 -0
- /package/{unify → yeaft}/storage/shard-store.js +0 -0
- /package/{unify → yeaft}/sub-agent/spawned-prompt.js +0 -0
- /package/{unify → yeaft}/templates/base.md +0 -0
- /package/{unify → yeaft}/templates/common-rules.md +0 -0
- /package/{unify → yeaft}/templates/harness/router-handoff.md +0 -0
- /package/{unify → yeaft}/templates/harness/router-shape.md +0 -0
- /package/{unify → yeaft}/templates/harness/worker-shape.md +0 -0
- /package/{unify → yeaft}/templates/identity-yeaft.md +0 -0
- /package/{unify → yeaft}/templates/mode-dream.md +0 -0
- /package/{unify → yeaft}/templates/mode-unified.md +0 -0
- /package/{unify → yeaft}/templates/personas/explorer.md +0 -0
- /package/{unify → yeaft}/templates/personas/implementer.md +0 -0
- /package/{unify → yeaft}/templates/personas/researcher.md +0 -0
- /package/{unify → yeaft}/templates/personas/reviewer.md +0 -0
- /package/{unify → yeaft}/templates/plan-instruction.md +0 -0
- /package/{unify → yeaft}/templates/tool-guidance.md +0 -0
- /package/{unify → yeaft}/tool-folding/exec-log.js +0 -0
- /package/{unify → yeaft}/tool-folding/fallback-stub.js +0 -0
- /package/{unify → yeaft}/tool-folding/index.js +0 -0
- /package/{unify → yeaft}/tool-folding/reflection-prompt.js +0 -0
- /package/{unify → yeaft}/tool-folding/t1-reflector.js +0 -0
- /package/{unify → yeaft}/tool-folding/t2-reflector.js +0 -0
- /package/{unify → yeaft}/tools/agent.js +0 -0
- /package/{unify → yeaft}/tools/apply-patch.js +0 -0
- /package/{unify → yeaft}/tools/bash.js +0 -0
- /package/{unify → yeaft}/tools/close-agent.js +0 -0
- /package/{unify → yeaft}/tools/file-edit.js +0 -0
- /package/{unify → yeaft}/tools/file-read.js +0 -0
- /package/{unify → yeaft}/tools/file-write.js +0 -0
- /package/{unify → yeaft}/tools/glob.js +0 -0
- /package/{unify → yeaft}/tools/grep.js +0 -0
- /package/{unify → yeaft}/tools/history-search.js +0 -0
- /package/{unify → yeaft}/tools/image-generation.js +0 -0
- /package/{unify → yeaft}/tools/index.js +0 -0
- /package/{unify → yeaft}/tools/js-repl.js +0 -0
- /package/{unify → yeaft}/tools/list-agents.js +0 -0
- /package/{unify → yeaft}/tools/list-dir.js +0 -0
- /package/{unify → yeaft}/tools/notebook-edit.js +0 -0
- /package/{unify → yeaft}/tools/route-forward.js +0 -0
- /package/{unify → yeaft}/tools/send-message.js +0 -0
- /package/{unify → yeaft}/tools/todo-write.js +0 -0
- /package/{unify → yeaft}/tools/view-image.js +0 -0
- /package/{unify → yeaft}/tools/wait-agent.js +0 -0
- /package/{unify → yeaft}/tools/web-fetch.js +0 -0
- /package/{unify → yeaft}/vp/seed-defaults.js +0 -0
- /package/{unify → yeaft}/vp/seed-topup.js +0 -0
- /package/{unify → yeaft}/vp/stock-ids.js +0 -0
- /package/{unify → yeaft}/vp/thread-classifier.js +0 -0
- /package/{unify → yeaft}/vp/vp-crud.js +0 -0
- /package/{unify → yeaft}/vp/vp-loader.js +0 -0
- /package/{unify → yeaft}/vp/vp-store.js +0 -0
- /package/{unify → yeaft}/vp-status-broker.js +0 -0
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* (a) Does NOT touch RoleInstance state machine internals (that's 334c).
|
|
23
23
|
* (b) Does NOT touch live-diff (334h).
|
|
24
24
|
* (c) Persistence routes through group.appendMessage via Coordinator.
|
|
25
|
-
* (d) Tool schema uses defineTool (agent/
|
|
25
|
+
* (d) Tool schema uses defineTool (agent/yeaft/tools/types.js).
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { resolveMemberId } from '../groups/roster.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* session.js — Session orchestrator for Yeaft
|
|
2
|
+
* session.js — Session orchestrator for Yeaft Yeaft
|
|
3
3
|
*
|
|
4
4
|
* Single entry point: loadSession(options?) → Session
|
|
5
5
|
*
|
|
@@ -101,7 +101,7 @@ function prepareToolStatsDir(yeaftDir) {
|
|
|
101
101
|
mkdirSyncSafe(statsDir, { recursive: true });
|
|
102
102
|
} catch (err) {
|
|
103
103
|
console.warn(
|
|
104
|
-
`[
|
|
104
|
+
`[Yeaft] Could not create stats dir ${statsDir}: ${err?.message || err}. ` +
|
|
105
105
|
`Tool-usage counters will live in memory only.`
|
|
106
106
|
);
|
|
107
107
|
}
|
|
@@ -161,7 +161,7 @@ export async function loadSession(options = {}) {
|
|
|
161
161
|
// completed, warn the user. Do NOT auto-run migration: that is
|
|
162
162
|
// an explicit action via bin/yeaft-migrate.js.
|
|
163
163
|
try {
|
|
164
|
-
if (config?.features?.
|
|
164
|
+
if (config?.features?.yeaftGroupChat === true) {
|
|
165
165
|
const stateFile = join(yeaftDir, '.migration-state.json');
|
|
166
166
|
let completed = false;
|
|
167
167
|
if (existsSyncSafe(stateFile)) {
|
|
@@ -173,7 +173,7 @@ export async function loadSession(options = {}) {
|
|
|
173
173
|
}
|
|
174
174
|
if (!completed) {
|
|
175
175
|
console.warn(
|
|
176
|
-
'[Yeaft] features.
|
|
176
|
+
'[Yeaft] features.yeaftGroupChat=true but storage migration is not complete. ' +
|
|
177
177
|
'Run `yeaft-migrate` before using the new group-chat tree, or unset the flag.',
|
|
178
178
|
);
|
|
179
179
|
}
|
|
@@ -402,8 +402,8 @@ export async function loadSession(options = {}) {
|
|
|
402
402
|
// ─── 9a-pre. Create per-group history Compactor ────────
|
|
403
403
|
// Owns the post-turn single-flight + race-guarded compactor that used
|
|
404
404
|
// to live inline in web-bridge.js. Bridge keeps history ownership and
|
|
405
|
-
// wires the WS sink (`
|
|
406
|
-
// `compactor.setOnCompacted` from `
|
|
405
|
+
// wires the WS sink (`yeaft_history_compacted`) via
|
|
406
|
+
// `compactor.setOnCompacted` from `installYeaftRuntimeBridge`.
|
|
407
407
|
const compactor = new Compactor({
|
|
408
408
|
summarize: ({ system, prompt, maxTokens } = {}) =>
|
|
409
409
|
engine.summarizeForCompact({ system, prompt, maxTokens }),
|
|
@@ -534,8 +534,8 @@ export async function loadSession(options = {}) {
|
|
|
534
534
|
// with web-bridge.js (which already imports this module to call
|
|
535
535
|
// loadSession).
|
|
536
536
|
async abort(opts = {}) {
|
|
537
|
-
const {
|
|
538
|
-
return
|
|
537
|
+
const { abortYeaftSession } = await import('./web-bridge.js');
|
|
538
|
+
return abortYeaftSession(opts);
|
|
539
539
|
},
|
|
540
540
|
};
|
|
541
541
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* - keywords: array of match keywords (alternative to trigger)
|
|
20
20
|
* - platforms: array of ["macos", "linux", "windows"]
|
|
21
21
|
*
|
|
22
|
-
* Reference: yeaft-
|
|
22
|
+
* Reference: yeaft-yeaft-design.md §8, yeaft-yeaft-core-systems.md
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { existsSync, readFileSync, readdirSync, writeFileSync, unlinkSync, mkdirSync, statSync } from 'fs';
|
|
@@ -385,7 +385,7 @@ export class SkillManager {
|
|
|
385
385
|
* This is the "progressive disclosure" list tier.
|
|
386
386
|
*
|
|
387
387
|
* task-311: the legacy `mode` parameter (chat/work filter) is accepted but
|
|
388
|
-
* ignored —
|
|
388
|
+
* ignored — Yeaft no longer has mode distinction, so every skill is treated
|
|
389
389
|
* as universally applicable. The `mode` field on each record is still
|
|
390
390
|
* surfaced for historic YAML compatibility.
|
|
391
391
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* format.js — human-readable formatters for tool-usage stats.
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth shared by the agent-side CLI (`bin/yeaft-stats.js`)
|
|
5
|
-
* and the REPL `/stats` command. The frontend `
|
|
5
|
+
* and the REPL `/stats` command. The frontend `YeaftToolStatsDrawer.js`
|
|
6
6
|
* copies the same logic verbatim because the no-build-step web layer can't
|
|
7
7
|
* import from `agent/`; keep the two definitions byte-identical when
|
|
8
8
|
* tweaking either side.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Dream V2 owns all background memory maintenance (scope summaries +
|
|
12
12
|
* memory writes via dream-v2/session-wiring.js → createV2DreamScheduler).
|
|
13
13
|
*
|
|
14
|
-
* Reference: yeaft-
|
|
14
|
+
* Reference: yeaft-yeaft-core-systems.md §4.4
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { isPermissionError } from './init.js';
|
|
@@ -118,7 +118,7 @@ export function startSubAgent(agent, deps = {}) {
|
|
|
118
118
|
// Share the session-shared ToolUsageStats so sub-agent tool calls
|
|
119
119
|
// land in the same on-disk snapshot the parent records into. Sub-
|
|
120
120
|
// agents are often the heaviest tool users — leaving them out
|
|
121
|
-
// skewed `
|
|
121
|
+
// skewed `yeaft_fetch_tool_stats` output.
|
|
122
122
|
toolStats: deps.toolStats || null,
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ask-user.js — Ask the user a question and wait for their response.
|
|
3
3
|
*
|
|
4
|
-
* In
|
|
4
|
+
* In Yeaft mode this tool sends a question through the web-bridge
|
|
5
5
|
* and blocks (via Promise) until the user answers. The answer is
|
|
6
6
|
* returned as the tool result.
|
|
7
7
|
*
|
|
8
|
-
* Reference: yeaft-
|
|
8
|
+
* Reference: yeaft-yeaft-design.md §8
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { defineTool } from './types.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* sub-agents that need to work on files without conflicting with
|
|
6
6
|
* the main working tree or other workers.
|
|
7
7
|
*
|
|
8
|
-
* Reference: yeaft-
|
|
8
|
+
* Reference: yeaft-yeaft-design.md §8, yeaft-yeaft-core-systems.md §3.2
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { defineTool } from './types.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Exits and optionally removes a worktree created by EnterWorktree.
|
|
5
5
|
* Can keep the worktree (preserve branch) or remove it cleanly.
|
|
6
6
|
*
|
|
7
|
-
* Reference: yeaft-
|
|
7
|
+
* Reference: yeaft-yeaft-design.md §8
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { defineTool } from './types.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* registry.js — Tool registration center for Yeaft
|
|
2
|
+
* registry.js — Tool registration center for Yeaft Yeaft
|
|
3
3
|
*
|
|
4
4
|
* Manages tool registration and execution dispatch.
|
|
5
5
|
* The engine uses this to get tool definitions for the LLM and to execute tool calls.
|
|
6
6
|
*
|
|
7
|
-
* NOTE (task-297): Mode-based filtering (chat/work) has been removed.
|
|
7
|
+
* NOTE (task-297): Mode-based filtering (chat/work) has been removed. Yeaft now runs as
|
|
8
8
|
* a single unified mode where all registered tools are available. Tool definitions may
|
|
9
9
|
* still carry a `modes` field, but the registry ignores it.
|
|
10
10
|
*/
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Directory-based skills (SKILL.md + references/ + templates/) support
|
|
11
11
|
* reading linked files via the view action's filePath parameter.
|
|
12
12
|
*
|
|
13
|
-
* Reference: yeaft-
|
|
13
|
+
* Reference: yeaft-yeaft-design.md §8
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { defineTool } from './types.js';
|
|
@@ -64,7 +64,7 @@ The tool takes the topic plus optional guiding fields (stuckAt, userProblem, exp
|
|
|
64
64
|
properties: {
|
|
65
65
|
topic: {
|
|
66
66
|
type: 'string',
|
|
67
|
-
description: 'One-sentence statement of what is being planned (e.g. "Add dark-mode toggle to
|
|
67
|
+
description: 'One-sentence statement of what is being planned (e.g. "Add dark-mode toggle to YeaftPage settings").',
|
|
68
68
|
},
|
|
69
69
|
userProblem: {
|
|
70
70
|
type: 'string',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* types.js — Tool definition interface for Yeaft
|
|
2
|
+
* types.js — Tool definition interface for Yeaft Yeaft
|
|
3
3
|
*
|
|
4
4
|
* All tools use the defineTool() function to create tool definitions.
|
|
5
5
|
* This ensures consistent shape and API-format conversion.
|
|
6
6
|
*
|
|
7
|
-
* Reference: yeaft-
|
|
7
|
+
* Reference: yeaft-yeaft-core-systems.md §3.1
|
|
8
8
|
*
|
|
9
9
|
* task-311: the legacy `modes` field (task-297 deprecated) is now fully
|
|
10
|
-
* removed —
|
|
10
|
+
* removed — Yeaft runs in a single unified mode.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -60,7 +60,7 @@ Guidelines:
|
|
|
60
60
|
const signal = ctx?.signal;
|
|
61
61
|
const errors = [];
|
|
62
62
|
|
|
63
|
-
// Backend preference set in
|
|
63
|
+
// Backend preference set in YeaftSettings → Search tab. When the
|
|
64
64
|
// user picks `playwright` we'd normally call the playwright-service;
|
|
65
65
|
// that service is not yet shipped (next PR), so the preference is
|
|
66
66
|
// recorded for forward-compat and we transparently fall through to
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* turn-utils.js — Turn-based slicing primitives for the
|
|
2
|
+
* turn-utils.js — Turn-based slicing primitives for the Yeaft history.
|
|
3
3
|
*
|
|
4
4
|
* "Turn" = one user-side round-trip, NOT one user-role message.
|
|
5
5
|
* Multi-VP fan-out emits N user messages (each `@vp-<id> <text>`) for
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* The previous RoleInstance map (per (vpId, groupId) pair, with LRU
|
|
9
9
|
* eviction) was removed in GC.2 — production fans out per-VP via
|
|
10
|
-
* `
|
|
10
|
+
* `handleYeaftGroupChat` -> `runVpTurn` directly and never instantiated
|
|
11
11
|
* RoleInstance.
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* • color / avatar → web-derived, NOT emitted here
|
|
13
13
|
*
|
|
14
14
|
* task-334h — live diff:
|
|
15
|
-
* • subscribers (Set of
|
|
15
|
+
* • subscribers (Set of sendYeaftEvent fns) receive per-vp `vp_updated`
|
|
16
16
|
* and `vp_removed` events as VpLoader's debounced rescan commits
|
|
17
17
|
* added / updated / removed vpIds.
|
|
18
18
|
* • Event shape: `{ type, vpId, vp?, reason? }` where `reason` ∈
|
|
@@ -230,21 +230,21 @@ export function buildVpSnapshot(registry = defaultRegistry) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* Handle an `
|
|
233
|
+
* Handle an `yeaft_vp_subscribe` request from the web client.
|
|
234
234
|
*
|
|
235
|
-
* Registers `
|
|
235
|
+
* Registers `sendYeaftEvent` as a live-diff subscriber, emits an initial
|
|
236
236
|
* `vp_snapshot`, and (on first call process-wide) starts the VpLoader
|
|
237
237
|
* whose debounced rescan fans out `vp_updated` / `vp_removed` events.
|
|
238
238
|
*
|
|
239
239
|
* Returns an unsubscribe fn the caller MAY invoke on WS close to prevent
|
|
240
240
|
* sending to a dead socket. Web-bridge is expected to manage this.
|
|
241
241
|
*
|
|
242
|
-
* @param {(event: object) => void}
|
|
242
|
+
* @param {(event: object) => void} sendYeaftEvent
|
|
243
243
|
* @param {import('./registry.js').Registry} [registry]
|
|
244
244
|
* @param {{dir?: string}} [options]
|
|
245
245
|
* @returns {() => void} unsubscribe fn
|
|
246
246
|
*/
|
|
247
|
-
export function handleVpSubscribe(
|
|
247
|
+
export function handleVpSubscribe(sendYeaftEvent, registry = defaultRegistry, options = {}) {
|
|
248
248
|
const { loader, fresh } = ensureLoader(registry, options);
|
|
249
249
|
// task-338-F2 + task-339-followup: replay semantics.
|
|
250
250
|
//
|
|
@@ -273,13 +273,13 @@ export function handleVpSubscribe(sendUnifyEvent, registry = defaultRegistry, op
|
|
|
273
273
|
if (shouldRescan && loader && typeof loader.rescanNow === 'function') {
|
|
274
274
|
try { loader.rescanNow(); } catch { /* never crash subscribe on rescan */ }
|
|
275
275
|
}
|
|
276
|
-
_subscribers.add(
|
|
276
|
+
_subscribers.add(sendYeaftEvent);
|
|
277
277
|
try {
|
|
278
|
-
|
|
278
|
+
sendYeaftEvent(buildVpSnapshot(registry));
|
|
279
279
|
} catch {
|
|
280
280
|
// Never crash the WS pipeline from snapshot serialisation.
|
|
281
281
|
}
|
|
282
|
-
return () => { _subscribers.delete(
|
|
282
|
+
return () => { _subscribers.delete(sendYeaftEvent); };
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/**
|