engine7 7.1.124 → 7.1.125
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/bg-worker.mjs +19294 -15844
- package/dist/cli.mjs +15717 -13337
- package/dist/cpu-router-worker.mjs +90 -0
- package/dist/engine-startup.mjs +24373 -20701
- package/dist/main.mjs +24117 -20445
- package/dist/models/cpu-router-v2/LICENSE +172 -0
- package/dist/models/cpu-router-v2/NOTICE.md +9 -0
- package/dist/models/cpu-router-v2/metadata.json +17 -0
- package/dist/models/cpu-router-v2/router.fp32.onnx +4 -0
- package/dist/models/cpu-router-v2/runtime.json +10 -0
- package/dist/models/cpu-router-v2/tokenizer.json +21278 -0
- package/dist/models/cpu-router-v2/tokenizer_config.json +58 -0
- package/dist/sqlite-maintenance-worker.mjs +1311 -0
- package/dist/topics-worker.mjs +12834 -0
- package/package.json +133 -117
- package/scripts/check-cpu-router-payload.mjs +23 -0
- package/scripts/verify-cpu-router-package.mjs +33 -0
- package/templates/config.template.json +3 -1
- package/templates/workspace/emotion/companion.md +1 -1
- package/templates/workspace/scripts/emotion_state_machine.mjs +4 -0
- package/templates/workspace/scripts/emotion_state_machine.py +3 -0
package/package.json
CHANGED
|
@@ -1,117 +1,133 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "engine7",
|
|
3
|
-
"license": "Apache-2.0",
|
|
4
|
-
"version": "7.1.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"description": "Engine 7 — 给助手一个家 / A home for your AI assistant",
|
|
7
|
-
"main": "dist/main.mjs",
|
|
8
|
-
"bin": {
|
|
9
|
-
"engine7": "bin/engine7"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "node scripts/build.mjs",
|
|
13
|
-
"test:
|
|
14
|
-
"test:
|
|
15
|
-
"test:
|
|
16
|
-
"test:
|
|
17
|
-
"test:
|
|
18
|
-
"test:mem7:
|
|
19
|
-
"test:mem7:
|
|
20
|
-
"test:mem7:
|
|
21
|
-
"test:
|
|
22
|
-
"
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
25
|
-
"test:
|
|
26
|
-
"test:
|
|
27
|
-
"test:
|
|
28
|
-
"test:
|
|
29
|
-
"test:
|
|
30
|
-
"test:
|
|
31
|
-
"
|
|
32
|
-
"test:goal
|
|
33
|
-
"test:goal:
|
|
34
|
-
"test:goal:
|
|
35
|
-
"test:goal:
|
|
36
|
-
"test:
|
|
37
|
-
"test:
|
|
38
|
-
"test:
|
|
39
|
-
"test:
|
|
40
|
-
"test:
|
|
41
|
-
"test:
|
|
42
|
-
"
|
|
43
|
-
"test:
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"test:
|
|
50
|
-
"test:
|
|
51
|
-
"
|
|
52
|
-
"test:
|
|
53
|
-
"test:
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "engine7",
|
|
3
|
+
"license": "Apache-2.0",
|
|
4
|
+
"version": "7.1.125",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Engine 7 — 给助手一个家 / A home for your AI assistant",
|
|
7
|
+
"main": "dist/main.mjs",
|
|
8
|
+
"bin": {
|
|
9
|
+
"engine7": "bin/engine7"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "node scripts/build.mjs",
|
|
13
|
+
"test:mem7:cognition": "tsx src/mem7/core/__tests__/relationship-cognition.test.ts && tsx src/mem7/core/__tests__/cognition-single-pass.test.ts",
|
|
14
|
+
"test:mem7:social-boundary": "tsx src/mem7/core/__tests__/social-material-boundary.test.ts && tsx src/mem7/core/__tests__/social-demand-context.test.ts",
|
|
15
|
+
"test:mem7:usable": "tsx src/mem7/core/__tests__/projection-window.test.ts && tsx src/mem7/core/__tests__/artifact-basis-bounded.test.ts && tsx src/mem7/core/__tests__/foresight-context-retention.test.ts && tsx src/mem7/core/__tests__/empty-keyword-search.test.ts && tsx src/mem7/core/__tests__/retire-graph-audits.test.ts && tsx src/memory/proactive/__tests__/bounded-memory-graph.test.ts && tsx src/memory/proactive/__tests__/retire-stale-derived.test.ts && tsx src/memory/proactive/__tests__/foresight-opportunity-release.test.ts && tsx src/memory/proactive/__tests__/scoped-opportunity-delivery.test.ts && tsx src/mem7/core/__tests__/graph-memory-context.test.ts && tsx src/mem7/core/__tests__/scoped-opportunity.test.ts && tsx src/mem7/core/__tests__/milestones-e2e.test.ts",
|
|
16
|
+
"test:mem7:events": "tsx src/mem7/core/__tests__/social-update-coalescing.test.ts && tsx src/memory/proactive/__tests__/source-event-coalescing.test.ts && tsx src/mem7/worker-projection.test.ts && tsx src/mem7/core/__tests__/projection-runtime.test.ts && tsx src/mem7/core/__tests__/projection-visibility.test.ts && tsx src/mem7/core/__tests__/graph-reasoning-basis.test.ts && tsx src/memory/proactive/__tests__/poison-delivery-skip.test.ts",
|
|
17
|
+
"test:mem7:runtime": "tsx src/mem7/core/__tests__/pipeline-priority.test.ts && tsx src/mem7/core/__tests__/pipeline-social-identity.test.ts && tsx src/bg/worker-input-priority.test.ts && tsx src/memory/proactive/__tests__/opportunity-user-evidence.test.ts && tsx src/mem7/core/__tests__/graph-plan-failure.test.ts && tsx src/mem7/core/__tests__/dependency-invalidation-idempotent.test.ts && tsx src/bg/worker-projection-fairness.test.ts && tsx src/bg/worker-runtime.test.ts && tsx src/bg/worker-opportunity-coverage.test.ts && tsx src/bg/worker-scan-recovery.test.ts && tsx src/core/handle-query.push-identity.test.ts",
|
|
18
|
+
"test:mem7:scale": "tsx src/mem7/core/__tests__/usable-scale.test.ts",
|
|
19
|
+
"test:mem7:boot": "node scripts/boot-mem7-usable.mjs",
|
|
20
|
+
"test:mem7:interpretation": "tsx src/mem7/core/__tests__/interpreter.test.ts && tsx src/mem7/core/__tests__/interpreter-budget.test.ts && tsx src/mem7/core/__tests__/occurrence-overlay.test.ts && tsx src/mem7/core/__tests__/prose-review-recovery.test.ts",
|
|
21
|
+
"test:cpu-router": "tsx src/router/cpu-router.test.ts && tsx src/router/skill-gate-cpu.test.ts && tsx src/router/cpu-router-release.test.ts && tsx src/router/cpu-router.integration.test.ts",
|
|
22
|
+
"test:latency": "tsx src/mem7/core/__tests__/search-timing.test.ts && tsx src/mem7/core/__tests__/historical-guard-index.test.ts && tsx src/mem7/core/__tests__/relationship-selection-latency.test.ts && tsx src/mem7/core/__tests__/relationship-context-cost.test.ts && tsx src/hooks/executor.test.ts && tsx src/tools/tts/latency.test.ts && tsx src/core/query.retry-latency.test.ts && tsx src/mem7/core/__tests__/context-packing-cost.test.ts && tsx src/mem-serve/mem7-search-cost.test.ts && tsx src/memory/proactive/__tests__/foresight-guard-cost.test.ts",
|
|
23
|
+
"test:webhook": "tsx src/integrations/webhook.test.ts",
|
|
24
|
+
"test:mode-routing": "tsx src/emotion-hook.test.ts && tsx src/emotion-hook.golden.test.ts",
|
|
25
|
+
"test:companion": "tsx src/tools/memory-on-demand.test.ts && tsx src/light-mode.test.ts && npm run test:mode-routing && tsx src/mem7/core/__tests__/relationship-dimensions.test.ts && tsx src/memory/memdir/companion-context.test.ts && tsx src/mem7/core/__tests__/deep-recall.test.ts && tsx src/mem7/core/__tests__/status-doc.test.ts && tsx src/core/handle-query.companion-memory.test.ts && tsx src/handle-query.evidence.test.ts && tsx src/core/handle-query.recall.test.ts && tsx src/mem7/core/__tests__/history-rerank.test.ts && tsx src/mem7/core/__tests__/cross-encoder-body-timeout.test.ts",
|
|
26
|
+
"test:session": "tsx src/session/restore-head-align.test.ts && tsx src/session/responses-reasoning-roundtrip.test.ts && tsx src/session/memory-source-roundtrip.test.ts && tsx src/session/evidence-roundtrip.test.ts && tsx src/session/tool-error-roundtrip.test.ts && tsx src/core/handle-query.history-restore.test.ts",
|
|
27
|
+
"test:mem7:state": "tsx src/mem7/core/__tests__/migrations.test.ts && tsx src/mem7/core/__tests__/source-store.test.ts && tsx src/mem7/core/__tests__/job-runner.test.ts && tsx src/mem7/core/__tests__/episode.test.ts && tsx src/mem7/core/__tests__/pipeline-recovery.test.ts && tsx src/mem7/core/__tests__/agent-recovery.test.ts && tsx src/mem7/core/__tests__/facts.test.ts && tsx src/mem7/core/__tests__/interpreter.test.ts && tsx src/mem7/core/__tests__/interpretation-backlog.test.ts && tsx src/mem7/core/__tests__/interpretation-input-isolation.test.ts && tsx src/mem7/core/__tests__/provider-cooldown.test.ts && tsx src/mem7/core/__tests__/fact-conflict-classification.test.ts && tsx src/mem7/core/__tests__/interpretation-concurrency.test.ts && tsx src/mem7/core/__tests__/schedule-interpretation.test.ts && tsx src/mem7/core/__tests__/projection-input-sources.test.ts && tsx src/mem7/core/__tests__/change-feed.test.ts && tsx src/mem7/core/__tests__/change-feed-process.test.ts && tsx src/memory/proactive/__tests__/mutation-service.test.ts && tsx src/memory/proactive/__tests__/intent-runs.test.ts && tsx src/memory/proactive/__tests__/intent-lifecycle.test.ts && tsx src/mem7/core/__tests__/projection-runtime.test.ts && tsx src/mem7/core/__tests__/graph-memory-context.test.ts && tsx src/mem7/core/__tests__/scoped-opportunity.test.ts && tsx src/mem7/core/__tests__/interpretation-runtime.test.ts && tsx src/mem7/core/__tests__/basis-check.test.ts && tsx src/mem7/core/__tests__/context-service.test.ts && tsx src/mem7/core/__tests__/context-budget.test.ts && tsx src/memory/memdir/current-context-pending.test.ts && tsx src/mem7/core/__tests__/knowledge-history.test.ts && tsx src/mem7/core/__tests__/projection-read.test.ts && tsx src/mem7/core/__tests__/tombstones.test.ts && tsx src/mem7/core/__tests__/artifact-revalidation.test.ts && tsx src/mem7/core/__tests__/artifact-context.test.ts && tsx src/mem7/core/__tests__/context-time.test.ts && tsx src/mem7/core/__tests__/milestones-e2e.test.ts && tsx src/mem7/core/__tests__/migration-rehearsal.test.ts && tsx src/calendar/memory-binding.test.ts && tsx src/calendar/memory-occurrences.test.ts && tsx src/calendar/delivery-reconciliation.test.ts && tsx src/tools/memory-bridge.test.ts && tsx src/tools/memory-write.test.ts && tsx src/mem-serve/mem7-mcp.test.ts && tsx src/core/message-dispatcher.memory.test.ts && tsx src/core/message-dispatcher.host-context.test.ts && tsx src/session/memory-source-roundtrip.test.ts && tsx src/tools/notification-durable.test.ts && tsx src/tools/notification-state.test.ts && tsx src/channels/memory-send-guard.test.ts && tsx src/mem7/core/__tests__/vector-indexes.test.ts && tsx src/mem7/core/__tests__/vector-publications.test.ts && tsx src/mem7/core/__tests__/project-projections.test.ts && tsx src/memory/proactive/__tests__/host-deliveries.test.ts && tsx src/memory/proactive/__tests__/delivery-reconciliation.test.ts && tsx src/mem7/core/__tests__/host-turns.test.ts && tsx src/mem7/host-turn.test.ts && tsx src/core/handle-query.memory.test.ts && tsx src/core/handle-query.recall.test.ts && tsx src/channels/host-send-guard.test.ts && tsx src/optional/voice-chat/bridge.memory.test.ts && tsx src/mem7/core/__tests__/job-provenance.test.ts && tsx src/mem7/core/__tests__/artifact-history.test.ts && tsx src/mem7/core/__tests__/legacy-recovery.test.ts && tsx src/mem7/core/__tests__/read-visibility.test.ts && tsx src/mem7/core/__tests__/cascade-visibility.test.ts && tsx src/mem7/core/__tests__/entity-redirect-context.test.ts && tsx src/mem7/core/__tests__/projection-visibility.test.ts && tsx src/mem7/core/__tests__/search-visibility.test.ts && tsx src/mem7/core/__tests__/visibility-cache.test.ts && tsx src/mem7/core/__tests__/generation-visibility.test.ts && tsx src/mem7/core/__tests__/artifact-file-inputs.test.ts && tsx src/calendar/memory-read.test.ts && tsx src/memory/proactive/__tests__/consumer-visibility.test.ts && tsx src/memory/memdir/recall-visibility.test.ts && tsx src/memory/memdir/recall-compatibility.test.ts && tsx src/memory/proactive/__tests__/legacy-read-visibility.test.ts && tsx src/mem7/core/__tests__/prose-review-recovery.test.ts && npx tsx src/mem7/core/__tests__/change-feed-baseline.test.ts && npm run test:mem7:person && npm run test:mem7:worker",
|
|
28
|
+
"test:mem7:person": "tsx src/mem7/core/__tests__/person-relations.test.ts && tsx src/mem7/core/__tests__/person-import-cards.test.ts",
|
|
29
|
+
"test:mem7:worker": "tsx src/mem7/core/__tests__/job-claim-liveness.test.ts && tsx src/mem7/core/__tests__/ready-cell-liveness.test.ts && tsx src/mem7/core/__tests__/social-registration-liveness.test.ts && tsx src/mem7/core/__tests__/social-coverage-lifecycle.test.ts && tsx src/mem7/core/__tests__/social-classification-migration.test.ts && tsx src/mem7/core/__tests__/social-conversation-order.test.ts && tsx src/mem7/core/__tests__/social-processing-liveness.test.ts && tsx src/mem7/core/__tests__/social-identity-context.test.ts && tsx src/mem7/core/__tests__/social-structured-identity.test.ts && tsx src/mem7/core/__tests__/social-evidence-retention.test.ts && tsx src/mem7/core/__tests__/social-alias-provenance.test.ts && tsx src/mem7/core/__tests__/social-discovery-budget.test.ts && tsx src/mem7/core/__tests__/social-name-budget.test.ts && tsx src/mem7/core/__tests__/read-budget-diagnostics.test.ts && tsx src/mem7/core/__tests__/relationship-write-budget.test.ts && tsx src/mem7/worker-log.test.ts && tsx src/mem7/foresight-belief.test.ts && tsx src/mem7/intake-queue.test.ts && tsx src/mem7/sqlite-statistics.test.ts && tsx src/mem7/lance-optimize.test.ts && tsx src/mem7/owner-rpc.test.ts && tsx src/mem7/worker-projection.test.ts && tsx src/tools/memory-people-update.test.ts && tsx src/tools/memory-people-usability.test.ts",
|
|
30
|
+
"test:mem7:relationships": "tsx src/mem7/core/__tests__/social-sources.test.ts && tsx src/mem7/core/__tests__/provenance-cache.test.ts && tsx src/mem7/core/__tests__/grounding-liveness.test.ts && tsx src/mem7/core/__tests__/open-relationships.test.ts && tsx src/mem7/core/__tests__/qualified-relationship-guards.test.ts && tsx src/mem7/core/__tests__/social-interpretation.test.ts && tsx src/memory/proactive/__tests__/relationship-projection.test.ts && tsx src/memory/proactive/__tests__/relationship-snapshot.test.ts && tsx src/mem7/core/__tests__/relationship-context.test.ts && tsx src/mem7/core/__tests__/relationship-recall-lightweight.test.ts && tsx src/mem7/core/__tests__/relationship-undated-recall.test.ts && tsx src/mem7/core/__tests__/relationship-history.test.ts && tsx src/inner-voice/reflection-memory.test.ts && tsx src/mem7/core/__tests__/relationship-cognition.test.ts && tsx src/memory/proactive/__tests__/relationship-notifications.test.ts && tsx src/memory/proactive/__tests__/relationship-notification-runtime.test.ts && tsx src/mem7/core/__tests__/relationships-e2e.test.ts && tsx scripts/relations-replay.test.ts && tsx src/core/query.relationship-budget.test.ts && tsx src/core/handle-query.relationship-provenance.test.ts",
|
|
31
|
+
"replay:relationships": "tsx scripts/relations-replay.ts",
|
|
32
|
+
"test:goal": "tsx src/goals/store.test.ts",
|
|
33
|
+
"test:goal:aim": "tsx src/goals/aim-adapter.test.ts",
|
|
34
|
+
"test:goal:task": "tsx src/goals/task-adapter.test.ts",
|
|
35
|
+
"test:goal:remote": "tsx src/goals/remote-task-adapter.test.ts",
|
|
36
|
+
"test:goal:recovery": "tsx src/goals/recovery.test.ts",
|
|
37
|
+
"test:goal:gate": "tsx src/nudge/registration-gate.test.ts",
|
|
38
|
+
"test:goal:command": "tsx src/commands/goal.test.ts",
|
|
39
|
+
"test:goal:step": "tsx src/tools/goal-step.test.ts",
|
|
40
|
+
"test:goal:tools": "tsx src/tools/goal-tools.test.ts && tsx src/tools/goal-clear.test.ts",
|
|
41
|
+
"test:goal:all": "npm run test:goal && npm run test:goal:calendar && npm run test:goal:restart && npm run test:goal:aim && npm run test:goal:task && npm run test:goal:remote && npm run test:goal:recovery && npm run test:goal:gate && npm run test:goal:command && npm run test:goal:step && npm run test:goal:tools && npm run test:goal:e2e",
|
|
42
|
+
"test:goal:calendar": "tsx src/goals/calendar-adapter.test.ts",
|
|
43
|
+
"test:goal:restart": "powershell -NoProfile -Command \"$d = Join-Path ([System.IO.Path]::GetTempPath()) ('engine7-goal-' + [guid]::NewGuid()); New-Item -ItemType Directory -Path $d | Out-Null; $id = (npx tsx src/goals/restart-writer.ts $d); npx tsx src/goals/restart-reader.ts $d $id; Remove-Item -Recurse -Force $d\"",
|
|
44
|
+
"test:goal:e2e": "powershell -NoProfile -Command \"$d = Join-Path ([System.IO.Path]::GetTempPath()) ('engine7-goal-e2e-' + [guid]::NewGuid()); New-Item -ItemType Directory -Path $d | Out-Null; npx tsx src/goals/e2e-phase1.ts $d; if ($LASTEXITCODE -ne 0) { Remove-Item -Recurse -Force $d; exit 1 }; npx tsx src/goals/e2e-phase2.ts $d; $code = $LASTEXITCODE; Remove-Item -Recurse -Force $d; exit $code\"",
|
|
45
|
+
"test:reload": "tsx src/reload/orchestrator.test.ts && tsx src/reload/secrets-watch.test.ts && tsx src/hooks/config.test.ts && tsx src/startup/hooks-boot.test.ts && tsx src/channels/manager.reconcile.test.ts && tsx src/channels/cc-bridge.test.ts && tsx src/engine-startup.shouldSkipReload.test.ts && tsx src/optional/voice-chat/plugin.deps.test.ts && tsx src/optional/voice-chat/config.test.ts && tsx src/cron/cron-plugin.resync.test.ts && tsx src/cron/scheduler.renderer.test.ts && tsx src/channels/renderer.test.ts && tsx src/startup/message-pipeline.test.ts && tsx src/utils/sanitize-error.test.ts && tsx src/reload/config-watch-selfwrite.test.ts && tsx src/channels/feishu.typing.test.ts && tsx src/channels/feishu.sendfile-apicheck.test.ts",
|
|
46
|
+
"test:installer": "tsx src/cli-events.test.ts && tsx src/cli-init-config.test.ts && tsx src/cli-init-answers.test.ts && tsx src/cli-init.headless.e2e.test.ts && tsx src/cli-reconfig.test.ts && tsx src/cli-doctor.test.ts && tsx src/config/secrets-env.test.ts && tsx src/startup/api-status.test.ts && tsx src/cli-service.test.ts && tsx src/emotion-hook.test.ts && tsx src/emotion-hook.golden.test.ts && tsx src/tools/tavily-pool.test.ts && tsx src/tools/service.test.ts",
|
|
47
|
+
"test:skill-install": "tsx src/installer/installer.test.ts && tsx src/startup/skill-sync.test.ts",
|
|
48
|
+
"test:feishu-card": "tsx src/tools/AskUserQuestionTool/feishu-card.test.ts && tsx src/tools/AskUserQuestionTool/collect.test.ts && tsx src/tools/AskUserQuestionTool/AskUserQuestionTool.test.ts",
|
|
49
|
+
"test:persona": "tsx src/config/persona-files.test.ts && tsx src/light-mode.test.ts && tsx src/inner-voice/plugin.test.ts && tsx src/inner-voice/context.test.ts && tsx src/cli-init-config.test.ts",
|
|
50
|
+
"test:responses": "tsx src/models/openai-responses-provider.test.ts && tsx src/session/responses-reasoning-roundtrip.test.ts && tsx src/compact/tokenEstimate.test.ts",
|
|
51
|
+
"build:public": "node scripts/build.mjs --public",
|
|
52
|
+
"test:mem7:retention": "tsx src/mem7/core/__tests__/job-retention.test.ts && tsx src/memory/topics-history/import-backups.test.ts && tsx src/memory/topics-history/import-mem7.test.ts && tsx --test src/mem7/core/__tests__/automatic-graph-retention.test.ts src/mem7/sqlite-maintenance.test.ts src/bg/sqlite-maintenance.test.ts src/bg/worker-storage-retention.test.ts src/memory/topics-history/legacy-backup-retention.test.ts src/memory/topics-history/backup-expiry.test.ts",
|
|
53
|
+
"test:mem7:indexes": "tsx src/mem7/core/__tests__/index-catalog.test.ts && tsx src/mem7/core/__tests__/job-result-cleanup.test.ts && tsx src/memory/proactive/__tests__/dependency-replacement-cost.test.ts && tsx src/memory/proactive/__tests__/projection-invalidation-cost.test.ts && npm run test:mem7:retention",
|
|
54
|
+
"prepublishOnly": "npm run test:mem7:indexes && npm run build:public",
|
|
55
|
+
"start": "node dist/main.mjs",
|
|
56
|
+
"smoke:boot": "node scripts/boot-smoke.mjs",
|
|
57
|
+
"smoke:boot:baseline": "node scripts/boot-smoke.mjs --baseline",
|
|
58
|
+
"gen:template": "tsx scripts/gen-config-template.ts",
|
|
59
|
+
"test:config": "tsx src/config/registry.test.ts && tsx src/config/writer.test.ts && tsx src/config/secrets-io.test.ts && tsx src/config/secrets-env.test.ts && tsx src/config/migrations/index.test.ts && tsx src/config/migrations/persona.test.ts && tsx src/config/migrations/channel-secrets.test.ts && tsx src/config/cli-config.test.ts && tsx src/config/tts-providers.test.ts && tsx src/config/tts-voices.test.ts && tsx src/free-tier-apply.test.ts && tsx src/startup/free-tier-video-fixup.test.ts && tsx src/startup/free-tier-voice-fixup.test.ts",
|
|
60
|
+
"test:time": "tsx src/time/tz-matrix.test.ts && tsx src/time/time-discipline.test.ts && tsx src/time/tsc-guard.test.ts",
|
|
61
|
+
"test:tts": "tsx src/config/tts-providers.test.ts && tsx src/tools/tts/pick.test.ts && tsx src/tools/tts/route.test.ts && tsx src/tools/tts/relay.test.ts && tsx src/tools/tts/providers.test.ts && tsx src/tools/tts/impl.test.ts && tsx src/tools/tts/usage.test.ts && tsx src/tools/my-voice.dispatch.test.ts",
|
|
62
|
+
"test:toolstate": "tsx src/core/names-from-history.test.ts",
|
|
63
|
+
"test:loopbrake": "tsx src/tools/loop-brake.test.ts",
|
|
64
|
+
"test:mcp": "tsx src/mcp/convert-input-schema.test.ts",
|
|
65
|
+
"test:proactive": "tsx src/memory/proactive/__tests__/stream-guard-cost.test.ts && tsx src/memory/proactive/__tests__/verdict-parse.test.ts && tsx src/memory/proactive/__tests__/sweep.test.ts && tsx src/memory/proactive/__tests__/persistence.test.ts && tsx src/memory/proactive/__tests__/graph-store-p0.test.ts && tsx src/memory/proactive/__tests__/opportunity.test.ts && tsx src/memory/proactive/__tests__/opportunity-provider-budget.test.ts && tsx src/memory/proactive/__tests__/opportunity-failure.test.ts && tsx src/memory/proactive/__tests__/planning-context.test.ts && tsx src/memory/proactive/__tests__/calendar-bridge.test.ts && tsx src/memory/proactive/__tests__/timezone-fix.test.ts && tsx src/memory/proactive/__tests__/stale-fix.test.ts && tsx src/memory/proactive/__tests__/completion-evidence.test.ts && tsx src/memory/proactive/__tests__/plugin.test.ts && tsx src/memory/proactive/__tests__/plan-finalization.test.ts && tsx src/memory/memdir/extractMemories.test.ts",
|
|
66
|
+
"prepack": "node scripts/verify-cpu-router-package.mjs . && npm run test:time && npm run test:proactive && npm run test:persona && npm run test:config && npm run test:toolstate && npm run test:loopbrake && npm run test:mcp && npm run test:tts"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22"
|
|
70
|
+
},
|
|
71
|
+
"os": [
|
|
72
|
+
"win32",
|
|
73
|
+
"linux",
|
|
74
|
+
"darwin"
|
|
75
|
+
],
|
|
76
|
+
"cpu": [
|
|
77
|
+
"x64",
|
|
78
|
+
"arm64"
|
|
79
|
+
],
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@types/node": "^22.19.19",
|
|
82
|
+
"@types/turndown": "^5.0.6",
|
|
83
|
+
"@types/ws": "^8.18.2",
|
|
84
|
+
"esbuild": "^0.25.10",
|
|
85
|
+
"tsx": "^4.22.3",
|
|
86
|
+
"typescript": "^6.0.0"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"@larksuiteoapi/node-sdk": "^1.66.1",
|
|
90
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
91
|
+
"baileys": "7.0.0-rc14",
|
|
92
|
+
"chokidar": "^5.0.0",
|
|
93
|
+
"croner": "^10.0.1",
|
|
94
|
+
"discord.js": "^14.26.4",
|
|
95
|
+
"https-proxy-agent": "^9.1.0",
|
|
96
|
+
"qrcode-terminal": "^0.12.0",
|
|
97
|
+
"sharp": "^0.34.5",
|
|
98
|
+
"sqlite-vec": "^0.1.9",
|
|
99
|
+
"turndown": "^7.2.4",
|
|
100
|
+
"typebox": "^1.1.38",
|
|
101
|
+
"ws": "^8.22.0"
|
|
102
|
+
},
|
|
103
|
+
"optionalDependencies": {
|
|
104
|
+
"@discordjs/opus": "^0.10.0",
|
|
105
|
+
"@engine7/lancedb-intel": "^1.0.0",
|
|
106
|
+
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
107
|
+
"@huggingface/tokenizers": "0.2.0",
|
|
108
|
+
"@lancedb/lancedb": "^0.38.0",
|
|
109
|
+
"@node-rs/jieba": "^2.0.3",
|
|
110
|
+
"apache-arrow": "18.1.0",
|
|
111
|
+
"onnxruntime-node": "1.19.2",
|
|
112
|
+
"sqlite-vec-darwin-arm64": "^0.1.9",
|
|
113
|
+
"sqlite-vec-darwin-x64": "^0.1.9",
|
|
114
|
+
"sqlite-vec-linux-arm64": "^0.1.9",
|
|
115
|
+
"sqlite-vec-linux-x64": "^0.1.9",
|
|
116
|
+
"sqlite-vec-windows-x64": "^0.1.9"
|
|
117
|
+
},
|
|
118
|
+
"files": [
|
|
119
|
+
"dist/**/*.mjs",
|
|
120
|
+
"dist/prompts/**/*.md",
|
|
121
|
+
"dist/models/cpu-router-v2/**/*",
|
|
122
|
+
"scripts/check-cpu-router-payload.mjs",
|
|
123
|
+
"scripts/verify-cpu-router-package.mjs",
|
|
124
|
+
"bin/**/*",
|
|
125
|
+
"templates/**/*",
|
|
126
|
+
"src/memory/everos/python/**/*",
|
|
127
|
+
"!**/__pycache__/**",
|
|
128
|
+
"!**/*.pyc",
|
|
129
|
+
"!**/node_modules/**",
|
|
130
|
+
"!**/.env",
|
|
131
|
+
"README.md"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { createHash } from 'node:crypto'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
export function checkCpuRouterPayload(dir) {
|
|
7
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'runtime.json'), 'utf8'))
|
|
8
|
+
if (manifest.schemaVersion !== 1 || manifest.maxLength !== 384 ||
|
|
9
|
+
manifest.sha256?.['router.fp32.onnx'] !== '931494f26dfc3d379dac3c2d7a8c27f73e2859b1bb246afb77eb3f0b25aa0306') throw new Error('Unapproved CPU router model')
|
|
10
|
+
for (const name of ['router.fp32.onnx', 'tokenizer.json', 'tokenizer_config.json', 'metadata.json']) {
|
|
11
|
+
const data = fs.readFileSync(path.join(dir, name))
|
|
12
|
+
if (createHash('sha256').update(data).digest('hex') !== manifest.sha256[name]) throw new Error(`CPU router payload mismatch: ${name}`)
|
|
13
|
+
}
|
|
14
|
+
const metadata = JSON.parse(fs.readFileSync(path.join(dir, 'metadata.json'), 'utf8'))
|
|
15
|
+
if (JSON.stringify(Object.keys(metadata).sort()) !== JSON.stringify(['schema_version', 'task_labels', 'trained_tasks']) ||
|
|
16
|
+
JSON.stringify(metadata.trained_tasks) !== JSON.stringify(['dev', 'mode']) ||
|
|
17
|
+
JSON.stringify(metadata.task_labels) !== JSON.stringify({ dev: ['nodev', 'dev'], mode: ['emotion', 'work'] })) throw new Error('CPU router release metadata must contain only dev/mode schema')
|
|
18
|
+
for (const name of ['LICENSE', 'NOTICE.md']) if (!fs.readFileSync(path.join(dir, name), 'utf8').trim()) throw new Error(`Missing model ${name}`)
|
|
19
|
+
}
|
|
20
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
21
|
+
checkCpuRouterPayload(path.resolve(process.argv[2] ?? 'dist/models/cpu-router-v2'))
|
|
22
|
+
console.log('[cpu-router] release payload verified')
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { pathToFileURL } from 'node:url'
|
|
5
|
+
import { Worker } from 'node:worker_threads'
|
|
6
|
+
import { checkCpuRouterPayload } from './check-cpu-router-payload.mjs'
|
|
7
|
+
|
|
8
|
+
const root = path.resolve(process.argv[2] ?? '.')
|
|
9
|
+
const modelDir = path.join(root, 'dist/models/cpu-router-v2')
|
|
10
|
+
checkCpuRouterPayload(modelDir)
|
|
11
|
+
assert.ok(fs.existsSync(path.join(root, 'dist/cpu-router-worker.mjs')))
|
|
12
|
+
if (!process.argv.includes('--manifest-only')) {
|
|
13
|
+
const worker = new Worker(pathToFileURL(path.join(root, 'dist/cpu-router-worker.mjs')), {
|
|
14
|
+
workerData: { modelDir, threads: 4 }, execArgv: [],
|
|
15
|
+
})
|
|
16
|
+
const pending = new Map()
|
|
17
|
+
worker.on('message', ({ id, result }) => pending.get(id)?.resolve(result))
|
|
18
|
+
worker.on('error', error => { for (const request of pending.values()) request.reject(error) })
|
|
19
|
+
const classify = (id, text) => new Promise((resolve, reject) => {
|
|
20
|
+
const timer = setTimeout(() => reject(new Error('Packaged CPU router timed out')), 5000)
|
|
21
|
+
pending.set(id, { resolve: result => { clearTimeout(timer); pending.delete(id); resolve(result) }, reject: error => { clearTimeout(timer); pending.delete(id); reject(error) } })
|
|
22
|
+
worker.postMessage({ id, text, context: [] })
|
|
23
|
+
})
|
|
24
|
+
try {
|
|
25
|
+
const work = await classify(1, '修复接口报错然后测试')
|
|
26
|
+
assert.equal(work?.dev?.label, 'dev')
|
|
27
|
+
assert.equal(work?.mode?.label, 'work')
|
|
28
|
+
const emotion = await classify(2, '亲爱的,陪我聊聊天')
|
|
29
|
+
assert.equal(emotion?.mode?.label, 'emotion')
|
|
30
|
+
assert.deepEqual(Object.keys(emotion), ['dev', 'mode'])
|
|
31
|
+
} finally { await worker.terminate() }
|
|
32
|
+
}
|
|
33
|
+
console.log(`[cpu-router] packaged payload verified${process.argv.includes('--manifest-only') ? ' (cross-platform manifest only)' : '; native Worker dev+mode inference passed'}`)
|
|
@@ -178,7 +178,8 @@
|
|
|
178
178
|
"AGENTS.md",
|
|
179
179
|
"USER.md",
|
|
180
180
|
"MEMORY.md",
|
|
181
|
-
"memory/distill-output.md"
|
|
181
|
+
"memory/distill-output.md",
|
|
182
|
+
"memory/distill-emotion.md"
|
|
182
183
|
],
|
|
183
184
|
"order": [
|
|
184
185
|
"soul",
|
|
@@ -188,6 +189,7 @@
|
|
|
188
189
|
"USER.md",
|
|
189
190
|
"MEMORY.md",
|
|
190
191
|
"memory/distill-output.md",
|
|
192
|
+
"memory/distill-emotion.md",
|
|
191
193
|
"auto-memory-instructions"
|
|
192
194
|
]
|
|
193
195
|
},
|
|
@@ -254,6 +254,10 @@ async function main() {
|
|
|
254
254
|
emitMode('work')
|
|
255
255
|
return
|
|
256
256
|
}
|
|
257
|
+
if (input.cpu_router_mode === 'emotion' || input.cpu_router_mode === 'work') {
|
|
258
|
+
emitMode(input.cpu_router_mode)
|
|
259
|
+
return
|
|
260
|
+
}
|
|
257
261
|
const recent = Array.isArray(input.recent_user_texts)
|
|
258
262
|
? input.recent_user_texts.filter(value => typeof value === 'string').slice(-3).map(value => value.slice(0, 100)) : []
|
|
259
263
|
emitMode(await classifyMode(text, recent) ?? fallbackMode(text))
|
|
@@ -261,6 +261,9 @@ def main():
|
|
|
261
261
|
if looks_like_debug_log(text) or has_attachment(text):
|
|
262
262
|
emit_mode('work')
|
|
263
263
|
return
|
|
264
|
+
if value.get('cpu_router_mode') in ('emotion', 'work'):
|
|
265
|
+
emit_mode(value['cpu_router_mode'])
|
|
266
|
+
return
|
|
264
267
|
recent = value.get('recent_user_texts')
|
|
265
268
|
recent = [item[:100] for item in [item for item in recent if isinstance(item, str)][-3:]] if isinstance(recent, list) else []
|
|
266
269
|
emit_mode(classify_mode(text, recent) or fallback_mode(text))
|