engine7 7.1.123 → 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/{mem7-worker.mjs → bg-worker.mjs} +21071 -11753
- package/dist/cli.mjs +17692 -12540
- package/dist/cpu-router-worker.mjs +90 -0
- package/dist/engine-startup.mjs +41722 -32132
- package/dist/main.mjs +41560 -31976
- 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 +34 -11
- package/scripts/check-cpu-router-payload.mjs +23 -0
- package/scripts/verify-cpu-router-package.mjs +33 -0
- package/templates/config.template.json +4 -1
- package/templates/doubao-bridge/SKILL.md +39 -0
- package/templates/doubao-bridge/scripts/e7_send.py +83 -0
- package/templates/doubao-bridge/scripts/e7_status.py +30 -0
- package/templates/workspace/emotion/_default.md +1 -1
- package/templates/workspace/emotion/assistant.md +1 -1
- package/templates/workspace/emotion/butler.md +1 -1
- package/templates/workspace/emotion/companion.md +1 -1
- package/templates/workspace/emotion/friend.md +1 -1
- package/templates/workspace/scripts/emotion_state_machine.mjs +53 -375
- package/templates/workspace/scripts/emotion_state_machine.py +68 -344
- package/templates/workspace/emotion-states/assistant.json +0 -22
- package/templates/workspace/emotion-states/butler.json +0 -24
- package/templates/workspace/emotion-states/companion.json +0 -30
- package/templates/workspace/emotion-states/friend.json +0 -24
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "engine7",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.125",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Engine 7 — 给助手一个家 / A home for your AI assistant",
|
|
7
7
|
"main": "dist/main.mjs",
|
|
@@ -10,11 +10,24 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "node scripts/build.mjs",
|
|
13
|
-
"test:
|
|
14
|
-
"test:mem7:
|
|
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",
|
|
15
28
|
"test:mem7:person": "tsx src/mem7/core/__tests__/person-relations.test.ts && tsx src/mem7/core/__tests__/person-import-cards.test.ts",
|
|
16
|
-
"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/worker-log.test.ts && tsx src/tools/memory-people-update.test.ts",
|
|
17
|
-
"test:mem7:relationships": "tsx src/mem7/core/__tests__/social-sources.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-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",
|
|
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",
|
|
18
31
|
"replay:relationships": "tsx scripts/relations-replay.ts",
|
|
19
32
|
"test:goal": "tsx src/goals/store.test.ts",
|
|
20
33
|
"test:goal:aim": "tsx src/goals/aim-adapter.test.ts",
|
|
@@ -29,12 +42,16 @@
|
|
|
29
42
|
"test:goal:calendar": "tsx src/goals/calendar-adapter.test.ts",
|
|
30
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\"",
|
|
31
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\"",
|
|
32
|
-
"test:reload": "tsx src/reload/orchestrator.test.ts && tsx src/reload/secrets-watch.test.ts && tsx src/hooks/config.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/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",
|
|
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",
|
|
33
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",
|
|
34
|
-
"test:
|
|
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",
|
|
35
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",
|
|
36
51
|
"build:public": "node scripts/build.mjs --public",
|
|
37
|
-
"
|
|
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",
|
|
38
55
|
"start": "node dist/main.mjs",
|
|
39
56
|
"smoke:boot": "node scripts/boot-smoke.mjs",
|
|
40
57
|
"smoke:boot:baseline": "node scripts/boot-smoke.mjs --baseline",
|
|
@@ -45,8 +62,8 @@
|
|
|
45
62
|
"test:toolstate": "tsx src/core/names-from-history.test.ts",
|
|
46
63
|
"test:loopbrake": "tsx src/tools/loop-brake.test.ts",
|
|
47
64
|
"test:mcp": "tsx src/mcp/convert-input-schema.test.ts",
|
|
48
|
-
"test:proactive": "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__/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",
|
|
49
|
-
"prepack": "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"
|
|
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"
|
|
50
67
|
},
|
|
51
68
|
"engines": {
|
|
52
69
|
"node": ">=22"
|
|
@@ -87,8 +104,11 @@
|
|
|
87
104
|
"@discordjs/opus": "^0.10.0",
|
|
88
105
|
"@engine7/lancedb-intel": "^1.0.0",
|
|
89
106
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
107
|
+
"@huggingface/tokenizers": "0.2.0",
|
|
90
108
|
"@lancedb/lancedb": "^0.38.0",
|
|
91
109
|
"@node-rs/jieba": "^2.0.3",
|
|
110
|
+
"apache-arrow": "18.1.0",
|
|
111
|
+
"onnxruntime-node": "1.19.2",
|
|
92
112
|
"sqlite-vec-darwin-arm64": "^0.1.9",
|
|
93
113
|
"sqlite-vec-darwin-x64": "^0.1.9",
|
|
94
114
|
"sqlite-vec-linux-arm64": "^0.1.9",
|
|
@@ -98,6 +118,9 @@
|
|
|
98
118
|
"files": [
|
|
99
119
|
"dist/**/*.mjs",
|
|
100
120
|
"dist/prompts/**/*.md",
|
|
121
|
+
"dist/models/cpu-router-v2/**/*",
|
|
122
|
+
"scripts/check-cpu-router-payload.mjs",
|
|
123
|
+
"scripts/verify-cpu-router-package.mjs",
|
|
101
124
|
"bin/**/*",
|
|
102
125
|
"templates/**/*",
|
|
103
126
|
"src/memory/everos/python/**/*",
|
|
@@ -107,4 +130,4 @@
|
|
|
107
130
|
"!**/.env",
|
|
108
131
|
"README.md"
|
|
109
132
|
]
|
|
110
|
-
}
|
|
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'}`)
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"shell": true,
|
|
95
95
|
"webSearch": true,
|
|
96
96
|
"webFetch": true,
|
|
97
|
+
"installer": true,
|
|
97
98
|
"memory": true,
|
|
98
99
|
"topics": true,
|
|
99
100
|
"topic-extract": true,
|
|
@@ -177,7 +178,8 @@
|
|
|
177
178
|
"AGENTS.md",
|
|
178
179
|
"USER.md",
|
|
179
180
|
"MEMORY.md",
|
|
180
|
-
"memory/distill-output.md"
|
|
181
|
+
"memory/distill-output.md",
|
|
182
|
+
"memory/distill-emotion.md"
|
|
181
183
|
],
|
|
182
184
|
"order": [
|
|
183
185
|
"soul",
|
|
@@ -187,6 +189,7 @@
|
|
|
187
189
|
"USER.md",
|
|
188
190
|
"MEMORY.md",
|
|
189
191
|
"memory/distill-output.md",
|
|
192
|
+
"memory/distill-emotion.md",
|
|
190
193
|
"auto-memory-instructions"
|
|
191
194
|
]
|
|
192
195
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e7-assistant
|
|
3
|
+
description: 用户的 engine7 本机助理(127.0.0.1 本机服务)。当用户说「让助理帮我…」「让 engine7 …」「问一下助理」「帮我查/写/做 XX(交给引擎)」等要把任务交给 engine7 助理时使用;也用于检查 engine7 是否在运行。任务交给引擎后,必须把引擎的回复原样带回给用户,禁止编造执行结果。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- managed-by: engine7-console -->
|
|
7
|
+
|
|
8
|
+
# e7-assistant(用户的 engine7 助理桥)
|
|
9
|
+
|
|
10
|
+
用户电脑上运行着 engine7 引擎(本机 HTTP 服务)。本技能把任务转交给引擎并带回回复。
|
|
11
|
+
**你只有两个动作:转交、探活。** 引擎内部怎么做不归你管。
|
|
12
|
+
|
|
13
|
+
## 转交任务(用户要 engine7 干活时)
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
python scripts/e7_send.py "用户要交给引擎的任务原文"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- 任务原文**原样转发**:不摘要、不改写、不替用户做决定。
|
|
20
|
+
- 脚本会等引擎完整回复(可能几分钟,引擎要多轮工具调用)。超时/失败时**如实说**
|
|
21
|
+
「引擎没在或没回复」,禁止编造「已经完成」。
|
|
22
|
+
- 脚本输出就是引擎的回复,原样带给用户即可。
|
|
23
|
+
|
|
24
|
+
## 探活(用户问引擎状态 / 转交失败时)
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
python scripts/e7_status.py
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- 输出 `running` + 版本 = 引擎在跑;输出「未启动」→ 告诉用户「engine7 没在运行,
|
|
31
|
+
打开 http://127.0.0.1:__E7_API_PORT__/console 看状态,或重启 engine7 服务」。
|
|
32
|
+
|
|
33
|
+
## 铁律
|
|
34
|
+
|
|
35
|
+
1. 只认脚本执行结果,不认口头承诺;脚本失败要如实报错。
|
|
36
|
+
2. 不重复轰炸:转交失败至少隔 30 秒再试,最多重试 2 次就停。
|
|
37
|
+
3. 引擎回复里的日期、人名、路径原样保留,不要模糊化。
|
|
38
|
+
4. 用户要改 engine7 自身配置(换模型/key/开关)→ 告诉他「打开设置页
|
|
39
|
+
http://127.0.0.1:__E7_API_PORT__/console,或直接在 engine7 里说」——这事不经过本技能。
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""e7 任务转交 —— POST 本机 engine7 /api/webhook,等完整回复带回去。
|
|
4
|
+
|
|
5
|
+
__E7_API_PORT__/__E7_BRIDGE_TOKEN__ 由 engine7 init 落盘本技能时替换成实值
|
|
6
|
+
(端口不许硬编码猜:基准 16890 + 多 profile 偏移 + init 默认 16990,三处口径猜不中)。
|
|
7
|
+
|
|
8
|
+
契约(1019 妹妹评审钉死):
|
|
9
|
+
- scope='doubao-bridge' 显式隔离——绝不落用户主会话池(scope 缺省会灌 scope:main);
|
|
10
|
+
不用 background:true——那是立即返回拿不到回复文本,桥要带回完整答复。
|
|
11
|
+
- 客户端限速:失败退避 30s,最多重试 2 次(SKILL.md 铁律 2 同口径)。
|
|
12
|
+
"""
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
import time
|
|
16
|
+
import urllib.error
|
|
17
|
+
import urllib.request
|
|
18
|
+
|
|
19
|
+
PORT = '__E7_API_PORT__'
|
|
20
|
+
TOKEN = '__E7_BRIDGE_TOKEN__'
|
|
21
|
+
BASE = 'http://127.0.0.1:' + PORT
|
|
22
|
+
TIMEOUT = 300 # 引擎多轮工具调用可能几分钟,必须大于单轮时长
|
|
23
|
+
RETRY_BACKOFF = 30
|
|
24
|
+
MAX_RETRY = 2
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def die(msg, code=1):
|
|
28
|
+
print(msg)
|
|
29
|
+
sys.exit(code)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def send_once(text):
|
|
33
|
+
body = json.dumps({
|
|
34
|
+
'text': text,
|
|
35
|
+
'fromName': 'doubao-bridge',
|
|
36
|
+
'scope': 'doubao-bridge',
|
|
37
|
+
'bridgeToken': TOKEN,
|
|
38
|
+
}).encode('utf-8')
|
|
39
|
+
req = urllib.request.Request(
|
|
40
|
+
BASE + '/api/webhook', data=body,
|
|
41
|
+
headers={'Content-Type': 'application/json; charset=utf-8'},
|
|
42
|
+
method='POST')
|
|
43
|
+
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
|
|
44
|
+
return json.loads(resp.read().decode('utf-8'))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def main():
|
|
48
|
+
if len(sys.argv) < 2 or not sys.argv[1].strip():
|
|
49
|
+
die('用法: python e7_send.py "要交给引擎的任务"')
|
|
50
|
+
text = sys.argv[1]
|
|
51
|
+
|
|
52
|
+
attempt = 0
|
|
53
|
+
while True:
|
|
54
|
+
try:
|
|
55
|
+
j = send_once(text)
|
|
56
|
+
break
|
|
57
|
+
except urllib.error.HTTPError as e:
|
|
58
|
+
detail = ''
|
|
59
|
+
try:
|
|
60
|
+
detail = e.read().decode('utf-8', 'replace')[:200]
|
|
61
|
+
except Exception:
|
|
62
|
+
pass
|
|
63
|
+
# 4xx 是契约错误(引擎没开 webhook/参数不对),重试无意义
|
|
64
|
+
if e.code < 500 or attempt >= MAX_RETRY:
|
|
65
|
+
die('引擎拒绝了转交(HTTP %s)%s —— 如实告知用户,别重试轰炸' % (e.code, detail), 2)
|
|
66
|
+
except (urllib.error.URLError, TimeoutError, OSError) as e:
|
|
67
|
+
if attempt >= MAX_RETRY:
|
|
68
|
+
die('引擎未启动或无响应(%s)—— 告诉用户打开 http://127.0.0.1:%s/console 检查' % (e, PORT), 3)
|
|
69
|
+
attempt += 1
|
|
70
|
+
time.sleep(RETRY_BACKOFF)
|
|
71
|
+
|
|
72
|
+
# 回复体:{ok, reply?} —— reply 是引擎的完整答复文本
|
|
73
|
+
reply = j.get('reply') or j.get('text') or ''
|
|
74
|
+
if j.get('ok') and reply:
|
|
75
|
+
print(reply)
|
|
76
|
+
elif j.get('ok'):
|
|
77
|
+
print('引擎已接收任务(background 执行,无同步回复)——如实告知用户任务已提交')
|
|
78
|
+
else:
|
|
79
|
+
die('引擎返回失败:%s' % json.dumps(j, ensure_ascii=False)[:300], 4)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == '__main__':
|
|
83
|
+
main()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""e7 探活 —— GET 本机 engine7 /api/status,打印 running/未启动 与版本。
|
|
4
|
+
|
|
5
|
+
端口 __E7_API_PORT__ 由 engine7 init 落盘本技能时替换成实值(不硬编码)。
|
|
6
|
+
标准库实现(urllib),零第三方依赖——豆包侧 python 环境无保证,stdlib 是底线。
|
|
7
|
+
"""
|
|
8
|
+
import json
|
|
9
|
+
import sys
|
|
10
|
+
import urllib.error
|
|
11
|
+
import urllib.request
|
|
12
|
+
|
|
13
|
+
PORT = '__E7_API_PORT__'
|
|
14
|
+
BASE = 'http://127.0.0.1:' + PORT
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main():
|
|
18
|
+
try:
|
|
19
|
+
with urllib.request.urlopen(BASE + '/api/status', timeout=10) as resp:
|
|
20
|
+
j = json.loads(resp.read().decode('utf-8'))
|
|
21
|
+
except (urllib.error.URLError, TimeoutError, OSError):
|
|
22
|
+
print('未启动 —— engine7 没在运行。告诉用户打开 http://127.0.0.1:%s/console 检查,或重启 engine7 服务。' % PORT)
|
|
23
|
+
sys.exit(1)
|
|
24
|
+
version = j.get('version') or j.get('engine', {}).get('version') or 'unknown'
|
|
25
|
+
uptime = j.get('uptime') or j.get('uptimeSec') or ''
|
|
26
|
+
print('running | version=%s | uptime=%s' % (version, uptime))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == '__main__':
|
|
30
|
+
main()
|