let-them-talk 5.3.0 → 5.4.0
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/CHANGELOG.md +3 -1
- package/README.md +158 -592
- package/SECURITY.md +3 -3
- package/USAGE.md +151 -0
- package/agent-contracts.js +447 -0
- package/api-agents.js +760 -0
- package/autonomy/decision-v2.js +380 -0
- package/autonomy/watchdog-policy.js +572 -0
- package/cli.js +454 -298
- package/conversation-templates/autonomous-feature.json +83 -22
- package/conversation-templates/code-review.json +69 -21
- package/conversation-templates/debug-squad.json +69 -21
- package/conversation-templates/feature-build.json +69 -21
- package/conversation-templates/research-write.json +69 -21
- package/dashboard.html +3148 -174
- package/dashboard.js +823 -786
- package/data-dir.js +58 -0
- package/docs/architecture/branch-semantics.md +157 -0
- package/docs/architecture/canonical-event-schema.md +88 -0
- package/docs/architecture/markdown-workspace.md +183 -0
- package/docs/architecture/runtime-contract.md +459 -0
- package/docs/architecture/runtime-migration-hardening.md +64 -0
- package/events/hooks.js +154 -0
- package/events/log.js +457 -0
- package/events/replay.js +33 -0
- package/events/schema.js +432 -0
- package/managed-team-integration.js +261 -0
- package/office/agents.js +704 -597
- package/office/animation.js +1 -1
- package/office/assets/arcade-cabinet.js +141 -0
- package/office/assets/archway.js +77 -0
- package/office/assets/bar-counter.js +91 -0
- package/office/assets/bar-stool.js +71 -0
- package/office/assets/beanbag.js +64 -0
- package/office/assets/bench.js +99 -0
- package/office/assets/bollard.js +87 -0
- package/office/assets/cactus.js +100 -0
- package/office/assets/carpet-tile.js +46 -0
- package/office/assets/chair.js +123 -0
- package/office/assets/chandelier.js +107 -0
- package/office/assets/coffee-machine.js +95 -0
- package/office/assets/coffee-table.js +81 -0
- package/office/assets/column.js +95 -0
- package/office/assets/desk-lamp.js +102 -0
- package/office/assets/desk.js +76 -0
- package/office/assets/dining-table.js +105 -0
- package/office/assets/door.js +70 -0
- package/office/assets/dual-monitor.js +72 -0
- package/office/assets/fence.js +76 -0
- package/office/assets/filing-cabinet.js +111 -0
- package/office/assets/floor-lamp.js +69 -0
- package/office/assets/floor-tile.js +54 -0
- package/office/assets/flower-pot.js +76 -0
- package/office/assets/foosball.js +95 -0
- package/office/assets/fridge.js +99 -0
- package/office/assets/gaming-chair.js +154 -0
- package/office/assets/gaming-desk.js +105 -0
- package/office/assets/glass-door.js +72 -0
- package/office/assets/glass-wall.js +64 -0
- package/office/assets/half-wall.js +49 -0
- package/office/assets/hanging-plant.js +112 -0
- package/office/assets/index.js +151 -0
- package/office/assets/indoor-tree.js +90 -0
- package/office/assets/l-sofa.js +153 -0
- package/office/assets/marble-floor.js +64 -0
- package/office/assets/materials.js +40 -0
- package/office/assets/meeting-table.js +88 -0
- package/office/assets/microwave.js +94 -0
- package/office/assets/monitor.js +67 -0
- package/office/assets/neon-strip.js +73 -0
- package/office/assets/painting.js +84 -0
- package/office/assets/palm-tree.js +108 -0
- package/office/assets/pc-tower.js +91 -0
- package/office/assets/pendant-light.js +67 -0
- package/office/assets/ping-pong.js +114 -0
- package/office/assets/plant.js +72 -0
- package/office/assets/planter-box.js +95 -0
- package/office/assets/pool-table.js +94 -0
- package/office/assets/printer.js +113 -0
- package/office/assets/reception-desk.js +133 -0
- package/office/assets/rug.js +78 -0
- package/office/assets/sculpture.js +85 -0
- package/office/assets/server-rack.js +98 -0
- package/office/assets/sink.js +109 -0
- package/office/assets/sofa.js +106 -0
- package/office/assets/speaker.js +83 -0
- package/office/assets/spotlight.js +83 -0
- package/office/assets/street-lamp.js +97 -0
- package/office/assets/trash-can.js +83 -0
- package/office/assets/treadmill.js +126 -0
- package/office/assets/trophy.js +89 -0
- package/office/assets/tv-screen.js +79 -0
- package/office/assets/vase.js +84 -0
- package/office/assets/wall-clock.js +84 -0
- package/office/assets/wall.js +53 -0
- package/office/assets/water-cooler.js +146 -0
- package/office/assets/whiteboard.js +115 -0
- package/office/assets.js +3 -431
- package/office/builder.js +791 -355
- package/office/campus-env.js +1012 -1119
- package/office/environment.js +2 -0
- package/office/gallery.js +997 -0
- package/office/index.js +165 -61
- package/office/navigation.js +173 -152
- package/office/player.js +178 -68
- package/office/robot-character.js +272 -0
- package/office/spectator-camera.js +33 -10
- package/office/state.js +2 -0
- package/office/world-save.js +35 -4
- package/package.json +57 -3
- package/providers/comfyui.js +383 -0
- package/providers/dalle.js +79 -0
- package/providers/gemini.js +181 -0
- package/providers/ollama.js +184 -0
- package/providers/replicate.js +115 -0
- package/providers/zai.js +183 -0
- package/runtime-descriptor.js +270 -0
- package/scripts/check-agent-contract-advisory.js +132 -0
- package/scripts/check-api-agent-parity.js +277 -0
- package/scripts/check-autonomy-v2-decision.js +207 -0
- package/scripts/check-autonomy-v2-execution.js +588 -0
- package/scripts/check-autonomy-v2-watchdog.js +224 -0
- package/scripts/check-branch-fork-snapshot.js +337 -0
- package/scripts/check-branch-isolation.js +787 -0
- package/scripts/check-branch-semantics.js +139 -0
- package/scripts/check-dashboard-control-plane.js +1304 -0
- package/scripts/check-docs-onboarding.js +490 -0
- package/scripts/check-event-schema.js +276 -0
- package/scripts/check-evidence-completion.js +239 -0
- package/scripts/check-invariants.js +992 -0
- package/scripts/check-lifecycle-hooks.js +525 -0
- package/scripts/check-managed-team-integration.js +166 -0
- package/scripts/check-markdown-workspace-export.js +548 -0
- package/scripts/check-markdown-workspace-safety.js +347 -0
- package/scripts/check-markdown-workspace.js +136 -0
- package/scripts/check-message-replay.js +429 -0
- package/scripts/check-migration-hardening.js +300 -0
- package/scripts/check-performance-indexing.js +272 -0
- package/scripts/check-provider-capabilities.js +316 -0
- package/scripts/check-runtime-contract.js +109 -0
- package/scripts/check-session-aware-context.js +172 -0
- package/scripts/check-session-lifecycle.js +210 -0
- package/scripts/export-markdown-workspace.js +84 -0
- package/scripts/fixtures/message-replay/clean.jsonl +2 -0
- package/scripts/fixtures/message-replay/corrupt-correction-payload.jsonl +1 -0
- package/scripts/fixtures/message-replay/corrupt-jsonl.jsonl +1 -0
- package/scripts/fixtures/message-replay/corrupt-payload.jsonl +1 -0
- package/scripts/fixtures/message-replay/out-of-order.jsonl +2 -0
- package/scripts/migrate-legacy-to-canonical.js +201 -0
- package/scripts/run-verification-suite.js +242 -0
- package/scripts/sync-packaged-docs.js +69 -0
- package/server.js +9546 -7216
- package/state/agents.js +161 -0
- package/state/canonical.js +3068 -0
- package/state/dashboard-queries.js +441 -0
- package/state/evidence.js +56 -0
- package/state/io.js +69 -0
- package/state/markdown-workspace.js +951 -0
- package/state/messages.js +669 -0
- package/state/sessions.js +683 -0
- package/state/tasks-workflows.js +92 -0
- package/templates/debate.json +2 -2
- package/templates/managed.json +4 -4
- package/templates/pair.json +2 -2
- package/templates/review.json +2 -2
- package/templates/team.json +3 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const { createCanonicalState } = require(path.resolve(__dirname, '..', 'state', 'canonical.js'));
|
|
8
|
+
const { resolveAgentContract } = require(path.resolve(__dirname, '..', 'agent-contracts.js'));
|
|
9
|
+
const {
|
|
10
|
+
MANAGED_TEAM_HOOK_TOPICS,
|
|
11
|
+
buildManagedTeamContractContext,
|
|
12
|
+
readManagedTeamHookDigest,
|
|
13
|
+
} = require(path.resolve(__dirname, '..', 'managed-team-integration.js'));
|
|
14
|
+
|
|
15
|
+
const SERVER_FILE = path.resolve(__dirname, '..', 'server.js');
|
|
16
|
+
|
|
17
|
+
function fail(lines, exitCode = 1) {
|
|
18
|
+
process.stderr.write(lines.join('\n') + '\n');
|
|
19
|
+
process.exit(exitCode);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function assert(condition, message, problems) {
|
|
23
|
+
if (!condition) problems.push(message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function extractBlock(source, startAnchor, endAnchor) {
|
|
27
|
+
const startIndex = source.indexOf(startAnchor);
|
|
28
|
+
if (startIndex === -1) return '';
|
|
29
|
+
const endIndex = endAnchor ? source.indexOf(endAnchor, startIndex + startAnchor.length) : source.length;
|
|
30
|
+
if (endIndex === -1) return source.slice(startIndex);
|
|
31
|
+
return source.slice(startIndex, endIndex);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function main() {
|
|
35
|
+
const problems = [];
|
|
36
|
+
const serverSource = fs.readFileSync(SERVER_FILE, 'utf8');
|
|
37
|
+
|
|
38
|
+
const claimManagerBlock = extractBlock(serverSource, 'function toolClaimManager() {', 'function toolYieldFloor(to, prompt = null) {');
|
|
39
|
+
const yieldFloorBlock = extractBlock(serverSource, 'function toolYieldFloor(to, prompt = null) {', 'function toolSetPhase(phase) {');
|
|
40
|
+
const setPhaseBlock = extractBlock(serverSource, 'function toolSetPhase(phase) {', '// Deterministic stagger delay based on agent name');
|
|
41
|
+
const listenGroupBlock = extractBlock(serverSource, 'function buildListenGroupResponse(batch, consumed, agentName, listenStart) {', 'function toolGetHistory(limit = 50, thread_id = null) {');
|
|
42
|
+
const getBriefingBlock = extractBlock(serverSource, 'function toolGetBriefing() {', 'function toolLockFile(filePath) {');
|
|
43
|
+
const attachSignalsBlock = extractBlock(serverSource, 'function attachManagedTeamSurfaceSignals(result, options = {}) {', '// --- Autonomy Engine tools ---');
|
|
44
|
+
|
|
45
|
+
assert(serverSource.includes("require('./managed-team-integration')"), 'server.js must load the shared managed/team integration helper.', problems);
|
|
46
|
+
assert(attachSignalsBlock.includes('buildManagedTeamContractContext('), 'Managed/team server helper must derive contract signals through the shared managed/team contract helper.', problems);
|
|
47
|
+
assert(attachSignalsBlock.includes('readManagedTeamHookDigest('), 'Managed/team server helper must derive coordination hooks through the shared hook helper.', problems);
|
|
48
|
+
assert(claimManagerBlock.includes("buildManagedTeamContractContext(contract, 'claim_manager')"), 'claim_manager must reuse the shared managed/team contract helper.', problems);
|
|
49
|
+
assert(claimManagerBlock.includes("code: 'contract_violation'"), 'claim_manager must return an explicit contract_violation code when the trusted manager gate blocks.', problems);
|
|
50
|
+
assert(yieldFloorBlock.includes('attachManagedTeamSurfaceSignals('), 'yield_floor must reuse the shared managed/team signal helper.', problems);
|
|
51
|
+
assert(setPhaseBlock.includes('attachManagedTeamSurfaceSignals('), 'set_phase must reuse the shared managed/team signal helper.', problems);
|
|
52
|
+
assert(listenGroupBlock.includes('attachManagedTeamSurfaceSignals(result,'), 'listen_group responses must reuse the shared managed/team signal helper.', problems);
|
|
53
|
+
assert(getBriefingBlock.includes('attachManagedTeamSurfaceSignals(result,'), 'get_briefing must reuse the shared managed/team signal helper.', problems);
|
|
54
|
+
assert(!yieldFloorBlock.includes('canonicalState.readBranchHooks('), 'yield_floor must not duplicate direct hook reads when the shared managed/team helper exists.', problems);
|
|
55
|
+
assert(!setPhaseBlock.includes('canonicalState.readBranchHooks('), 'set_phase must not duplicate direct hook reads when the shared managed/team helper exists.', problems);
|
|
56
|
+
assert(!listenGroupBlock.includes('canonicalState.readBranchHooks('), 'listen_group must not duplicate direct hook reads when the shared managed/team helper exists.', problems);
|
|
57
|
+
assert(!getBriefingBlock.includes('canonicalState.readBranchHooks('), 'get_briefing must not duplicate direct hook reads when the shared managed/team helper exists.', problems);
|
|
58
|
+
|
|
59
|
+
const alignedManager = buildManagedTeamContractContext(
|
|
60
|
+
resolveAgentContract({ role: 'manager', archetype: 'coordinator', contract_mode: 'strict' }),
|
|
61
|
+
'claim_manager'
|
|
62
|
+
);
|
|
63
|
+
assert(alignedManager && alignedManager.contract_advisory && alignedManager.contract_advisory.status === 'aligned', 'Coordinator manager claims should stay aligned under the shared contract helper.', problems);
|
|
64
|
+
assert(!alignedManager.contract_violation, 'Aligned manager claims must not surface a contract violation.', problems);
|
|
65
|
+
|
|
66
|
+
const advisoryManager = buildManagedTeamContractContext(
|
|
67
|
+
resolveAgentContract({ archetype: 'advisor', contract_mode: 'advisory' }),
|
|
68
|
+
'claim_manager'
|
|
69
|
+
);
|
|
70
|
+
assert(advisoryManager && advisoryManager.contract_violation && advisoryManager.contract_violation.status === 'warning', 'Advisory-only manager mismatches must remain warnings instead of hard blocks.', problems);
|
|
71
|
+
|
|
72
|
+
const strictAdvisorManager = buildManagedTeamContractContext(
|
|
73
|
+
resolveAgentContract({ archetype: 'advisor', contract_mode: 'strict' }),
|
|
74
|
+
'claim_manager'
|
|
75
|
+
);
|
|
76
|
+
assert(strictAdvisorManager && strictAdvisorManager.contract_violation && strictAdvisorManager.contract_violation.status === 'blocked', 'Strict advisor manager claims must block at the trusted manager gate.', problems);
|
|
77
|
+
assert(strictAdvisorManager && strictAdvisorManager.contract_violation && strictAdvisorManager.contract_violation.message.includes('Strict contract mismatch'), 'Strict manager-gate contract blocks must explain that the block comes from a strict mismatch.', problems);
|
|
78
|
+
|
|
79
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'letthemtalk-managed-team-'));
|
|
80
|
+
const dataDir = path.join(tempRoot, '.agent-bridge');
|
|
81
|
+
const branchName = 'managed_team';
|
|
82
|
+
const canonicalState = createCanonicalState({ dataDir, processPid: 6111 });
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
86
|
+
|
|
87
|
+
const modeEvent = canonicalState.appendCanonicalEvent({
|
|
88
|
+
type: 'conversation.mode_updated',
|
|
89
|
+
branchId: branchName,
|
|
90
|
+
actorAgent: 'manager',
|
|
91
|
+
sessionId: 'session_manager',
|
|
92
|
+
correlationId: branchName,
|
|
93
|
+
payload: {
|
|
94
|
+
mode: 'managed',
|
|
95
|
+
previous_mode: 'group',
|
|
96
|
+
updated_at: '2026-04-16T20:00:00.000Z',
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
const phaseEvent = canonicalState.appendCanonicalEvent({
|
|
100
|
+
type: 'conversation.phase_updated',
|
|
101
|
+
branchId: branchName,
|
|
102
|
+
actorAgent: 'manager',
|
|
103
|
+
sessionId: 'session_manager',
|
|
104
|
+
correlationId: branchName,
|
|
105
|
+
payload: {
|
|
106
|
+
phase: 'execution',
|
|
107
|
+
previous_phase: 'planning',
|
|
108
|
+
floor: 'execution',
|
|
109
|
+
updated_at: '2026-04-16T20:00:05.000Z',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const stepEvent = canonicalState.appendCanonicalEvent({
|
|
113
|
+
type: 'workflow.step_started',
|
|
114
|
+
branchId: branchName,
|
|
115
|
+
actorAgent: 'manager',
|
|
116
|
+
sessionId: 'session_manager',
|
|
117
|
+
correlationId: 'wf_demo',
|
|
118
|
+
payload: {
|
|
119
|
+
workflow_id: 'wf_demo',
|
|
120
|
+
workflow_name: 'Demo workflow',
|
|
121
|
+
step_id: 2,
|
|
122
|
+
assignee: 'builder',
|
|
123
|
+
started_at: '2026-04-16T20:00:10.000Z',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
const reviewEvent = canonicalState.appendCanonicalEvent({
|
|
127
|
+
type: 'review.requested',
|
|
128
|
+
branchId: branchName,
|
|
129
|
+
actorAgent: 'builder',
|
|
130
|
+
sessionId: 'session_builder',
|
|
131
|
+
correlationId: 'rev_demo',
|
|
132
|
+
payload: {
|
|
133
|
+
review_id: 'rev_demo',
|
|
134
|
+
file: 'agent-bridge/server.js',
|
|
135
|
+
requested_by: 'builder',
|
|
136
|
+
status: 'pending',
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const digest = readManagedTeamHookDigest(canonicalState.readBranchHooks, branchName, { limit: 3 });
|
|
141
|
+
assert(digest && digest.source === 'derived_post_commit_hooks', 'Managed/team hook digest must stay explicitly derived and post-commit.', problems);
|
|
142
|
+
assert(digest && digest.branch === branchName, 'Managed/team hook digest must stay branch-scoped.', problems);
|
|
143
|
+
assert(digest && Array.isArray(digest.recent) && digest.recent.length === 3, 'Managed/team hook digest must respect deterministic hook limits.', problems);
|
|
144
|
+
assert(digest && digest.topics.every((topic) => MANAGED_TEAM_HOOK_TOPICS.includes(topic)), 'Managed/team hook digest must stay on the shared managed/team topic allowlist.', problems);
|
|
145
|
+
assert(digest && digest.recent[0].event_id === phaseEvent.event_id, 'Managed/team hook digest must preserve canonical ordering for limited hook views.', problems);
|
|
146
|
+
assert(digest && digest.recent[1].event_id === stepEvent.event_id, 'Managed/team hook digest must include workflow coordination events.', problems);
|
|
147
|
+
assert(digest && digest.recent[2].event_id === reviewEvent.event_id, 'Managed/team hook digest must include review coordination events.', problems);
|
|
148
|
+
assert(digest && digest.recent[0].summary.includes('execution'), 'Managed/team hook summaries must expose deterministic coordination-friendly descriptions.', problems);
|
|
149
|
+
assert(modeEvent && reviewEvent, 'Fixture canonical events for managed/team integration must be created successfully.', problems);
|
|
150
|
+
} finally {
|
|
151
|
+
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (problems.length > 0) {
|
|
155
|
+
fail(['Managed/team integration validation failed.', ...problems.map((problem) => `- ${problem}`)]);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log([
|
|
159
|
+
'Managed/team integration validation passed.',
|
|
160
|
+
'- Managed/team coordination surfaces reuse one shared helper for advisory contract signals and derived hook digests.',
|
|
161
|
+
'- claim_manager keeps strict hard blocking limited to explicit manager-gate mismatches while broader managed/team surfaces remain advisory.',
|
|
162
|
+
'- Derived hook digests stay branch-scoped, post-commit, and limited to the shared managed/team topic set.',
|
|
163
|
+
].join('\n'));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
main();
|