engine7 7.1.133 → 7.1.137
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/README.md +1 -0
- package/dist/auth-server.mjs +632 -0
- package/dist/bg-worker.mjs +31663 -28486
- package/dist/cc-desktop.mjs +951 -0
- package/dist/cli.mjs +41495 -30171
- package/dist/engine-startup.mjs +54213 -40973
- package/dist/main.mjs +50129 -36887
- package/dist/recall-worker.mjs +20446 -0
- package/dist/sqlite-maintenance-worker.mjs +1166 -124
- package/dist/stop-history-worker.mjs +180 -0
- package/dist/topics-worker.mjs +3353 -1078
- package/dist/travel-authority.mjs +1068 -0
- package/dist/travel-console.mjs +2206 -0
- package/dist/travel-controller.mjs +1883 -0
- package/dist/travel-data.mjs +7253 -0
- package/dist/travel-gateway.mjs +3259 -0
- package/dist/travel-key-service.mjs +483 -0
- package/dist/travel-node-data.mjs +4936 -0
- package/dist/travel-node.mjs +21258 -0
- package/dist/travel-retire.mjs +1095 -0
- package/dist/web-console.mjs +3355 -0
- package/package.json +32 -17
- package/templates/config.template.json +45 -0
- package/templates/skills/auth-connect/SKILL.md +22 -0
- package/templates/skills/email/SKILL.md +119 -115
- package/templates/skills/email/scripts/email-config-path.test.js +52 -0
- package/templates/skills/email/scripts/email-config.d.ts +4 -0
- package/templates/skills/email/scripts/email-config.js +6 -3
- package/templates/skills/pptx/SKILL.md +5 -0
- package/templates/skills/pptx/assets/engine7-aurora/field.png +0 -0
- package/templates/skills/pptx/assets/engine7-aurora/hero.png +0 -0
- package/templates/skills/pptx/assets/engine7-aurora/wordmark.png +0 -0
- package/templates/skills/pptx/examples/engine7-aurora.cjs +190 -0
- package/templates/skills/pptx/package-lock.json +171 -0
- package/templates/skills/pptx/package.json +12 -0
- package/templates/skills/pptx/scripts/engine7-aurora.cjs +132 -0
- package/templates/skills/pptx/styles/engine7-aurora.md +136 -0
- package/templates/skills/pptx/tests/engine7-aurora.test.cjs +116 -0
- package/templates/workspace/AGENTS.md +2 -9
- package/templates/workspace/RULES.md +22 -0
- package/templates/workspace/hooks/loop-detector.mjs +37 -0
- package/templates/workspace/souls/unnamed.md +10 -0
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.137",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Engine7 — 给助手一个家 / A home for your AI assistant · https://www.twinsun.top",
|
|
7
7
|
"homepage": "https://www.twinsun.top",
|
|
@@ -17,32 +17,37 @@
|
|
|
17
17
|
"engine7": "bin/engine7"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
+
"test:compact": "tsx --test src/compact/*.test.ts src/tools/result-snapshot.test.ts src/messages/prompt-history.test.ts src/models/anthropic-provider.pairing.test.ts",
|
|
21
|
+
"test:background-compact": "tsx --test src/core/query.background-compact.test.ts src/core/query.background-transport.test.ts src/core/query.background-stress.test.ts src/session/compact-commit.test.ts src/session/compact-crash.test.ts src/startup/background-compaction.test.ts src/commands/stop.background-compact.test.ts src/services/withRetry.cancellation.test.ts src/models/provider-cancellation.test.ts",
|
|
22
|
+
"test:continuity": "tsx --test src/continuity/*.test.ts",
|
|
23
|
+
"test:cc-desktop": "tsx --test src/cc-driver/desktop.test.ts src/cc-driver/desktop-cli.test.ts src/cc-driver/session-activity.test.ts src/tools/cc-ask-desktop.test.ts src/tools/cc-progress.test.ts",
|
|
20
24
|
"build": "node scripts/build.mjs",
|
|
25
|
+
"test:console": "node --test web-console/server.test.mjs web-console/travel-onboarding.test.mjs",
|
|
21
26
|
"test:mem7:cognition": "tsx src/mem7/core/__tests__/relationship-cognition.test.ts && tsx src/mem7/core/__tests__/cognition-single-pass.test.ts",
|
|
22
27
|
"test:mem7:social-boundary": "tsx src/mem7/core/__tests__/social-material-boundary.test.ts && tsx src/mem7/core/__tests__/social-demand-context.test.ts",
|
|
23
28
|
"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",
|
|
24
29
|
"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",
|
|
25
|
-
"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",
|
|
30
|
+
"test:mem7:runtime": "tsx --test src/memory/proactive/__tests__/graph-budget-contract.test.ts && 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 --test src/bg/worker-secrets.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",
|
|
26
31
|
"test:mem7:scale": "tsx src/mem7/core/__tests__/usable-scale.test.ts",
|
|
27
32
|
"test:mem7:boot": "node scripts/boot-mem7-usable.mjs",
|
|
28
33
|
"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",
|
|
29
|
-
"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",
|
|
30
|
-
"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",
|
|
34
|
+
"test:cpu-router": "tsx src/skills/recent-user-texts.test.ts && 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",
|
|
35
|
+
"test:latency": "tsx src/mem7/core/__tests__/read-budget.test.ts && tsx --test --test-concurrency=1 src/mem7/core/__tests__/read-only-store.test.ts src/memory/memdir/recall-worker.test.ts src/memory/memdir/recall-worker.lifecycle.test.ts src/memory/memdir/recall-worker.status.test.ts src/memory/memdir/recall-worker.failure.test.ts && tsx --test src/mem7/core/__tests__/snapshot-reads.test.ts && tsx --test src/core/handle-query.async-history.test.ts src/core/query.recall-steer.test.ts src/memory/memdir/recall-cancellation.test.ts && tsx src/tools/notification-chat-drain.test.ts && tsx src/channels/stream-preview.test.ts && tsx src/startup/message-pipeline.test.ts && tsx src/models/fallback-provider.limits.test.ts && tsx src/models/fallback-provider.http-recovery.test.ts && tsx src/session/restore-cost.test.ts && tsx src/mem7/core/__tests__/context-fact-cost.test.ts && tsx src/core/handle-query.latency.test.ts && 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",
|
|
31
36
|
"test:webhook": "tsx src/integrations/webhook.test.ts",
|
|
32
37
|
"test:mode-routing": "tsx src/emotion-hook.test.ts && tsx src/emotion-hook.golden.test.ts",
|
|
33
|
-
"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",
|
|
34
|
-
"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",
|
|
38
|
+
"test:companion": "npm run test:memory-continuity && 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__/same-day-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",
|
|
39
|
+
"test:session": "tsx src/session/restore-head-align.test.ts && tsx src/session/archive-continuity.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 && tsx --test src/core/handle-query.prefill-cache.test.ts && tsx src/session/restore-context-integrity.test.ts && tsx src/session/restore-cost.test.ts && tsx src/session/restore-pinned-rules.test.ts && tsx src/core/query.restore-capacity.test.ts && tsx src/session/restore-budget.test.ts && tsx --test src/messages/prompt-history.test.ts src/tools/result-snapshot.test.ts",
|
|
35
40
|
"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",
|
|
36
41
|
"test:mem7:person": "tsx src/mem7/core/__tests__/person-relations.test.ts && tsx src/mem7/core/__tests__/person-import-cards.test.ts",
|
|
37
|
-
"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 --test src/mem7/intake-queue-disk-full.test.ts src/mem7/intake-diagnostics.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",
|
|
38
|
-
"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",
|
|
42
|
+
"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 --test src/mem7/intake-queue-disk-full.test.ts src/mem7/intake-diagnostics.test.ts && tsx src/mem7/sqlite-statistics.test.ts && tsx src/mem7/lance-optimize.test.ts && tsx src/mem7/owner-rpc.test.ts && tsx --test src/mem7/owner-rpc-diagnostics.test.ts && tsx src/mem7/worker-projection.test.ts && tsx src/tools/memory-people-update.test.ts && tsx --test src/tools/memory-people-author.test.ts && tsx src/tools/memory-people-usability.test.ts",
|
|
43
|
+
"test:mem7:relationships": "tsx src/mem7/core/__tests__/social-sources.test.ts && tsx src/mem7/core/__tests__/provenance-cache.test.ts && tsx --test src/mem7/core/__tests__/provenance-bookkeeping-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",
|
|
39
44
|
"replay:relationships": "tsx scripts/relations-replay.ts",
|
|
40
45
|
"test:goal": "tsx src/goals/store.test.ts",
|
|
41
46
|
"test:goal:aim": "tsx src/goals/aim-adapter.test.ts",
|
|
42
47
|
"test:goal:task": "tsx src/goals/task-adapter.test.ts",
|
|
43
48
|
"test:goal:remote": "tsx src/goals/remote-task-adapter.test.ts",
|
|
44
49
|
"test:goal:recovery": "tsx src/goals/recovery.test.ts",
|
|
45
|
-
"test:goal:gate": "tsx src/nudge/registration-gate.test.ts",
|
|
50
|
+
"test:goal:gate": "tsx src/nudge/registration-gate.test.ts && tsx --test src/nudge/plugin.stop.test.ts src/nudge/stop-audit.test.ts src/nudge/stop-history-worker.test.ts",
|
|
46
51
|
"test:goal:command": "tsx src/commands/goal.test.ts",
|
|
47
52
|
"test:goal:step": "tsx src/tools/goal-step.test.ts",
|
|
48
53
|
"test:goal:tools": "tsx src/tools/goal-tools.test.ts && tsx src/tools/goal-clear.test.ts",
|
|
@@ -50,29 +55,36 @@
|
|
|
50
55
|
"test:goal:calendar": "tsx src/goals/calendar-adapter.test.ts",
|
|
51
56
|
"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\"",
|
|
52
57
|
"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\"",
|
|
53
|
-
"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",
|
|
58
|
+
"test:reload": "tsx src/cc-driver/sdk-loading.test.ts && 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 --test src/channels/process-card.test.ts src/channels/tool-progress.test.ts src/channels/feishu-process-card.test.ts src/startup/message-pipeline.folded.test.ts && tsx src/cc-driver/feishu-cards.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",
|
|
54
59
|
"test:installer": "tsx src/overwrite-backup.test.ts && tsx src/provision-free.test.ts && tsx src/channels/wechat.qr-backup.test.ts && tsx src/cli-init-doubao-bridge.test.ts && 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",
|
|
55
60
|
"test:skill-install": "tsx src/installer/installer.test.ts && tsx src/startup/skill-sync.test.ts",
|
|
56
61
|
"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",
|
|
57
|
-
"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",
|
|
62
|
+
"test:persona": "tsx src/config/persona-files.test.ts && tsx src/light-mode.test.ts && tsx --test src/prompt-rules.test.ts && tsx src/inner-voice/plugin.test.ts && tsx --test src/inner-voice/context.test.ts src/inner-voice/current-context.test.ts src/inner-voice/prefill-cache.test.ts && tsx src/cli-init-config.test.ts",
|
|
58
63
|
"test:responses": "tsx src/models/openai-responses-provider.test.ts && tsx src/session/responses-reasoning-roundtrip.test.ts && tsx src/compact/tokenEstimate.test.ts",
|
|
59
64
|
"build:public": "node scripts/build.mjs --public",
|
|
60
65
|
"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",
|
|
61
|
-
"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",
|
|
66
|
+
"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 && tsx --test src/memory/proactive/__tests__/invalidation-payload-cost.test.ts && npm run test:mem7:retention",
|
|
62
67
|
"prepublishOnly": "npm run test:mem7:indexes && npm run build:public",
|
|
63
68
|
"start": "node dist/main.mjs",
|
|
64
69
|
"smoke:boot": "node scripts/boot-smoke.mjs",
|
|
65
70
|
"smoke:boot:baseline": "node scripts/boot-smoke.mjs --baseline",
|
|
66
71
|
"gen:template": "tsx scripts/gen-config-template.ts",
|
|
67
|
-
"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 && tsx src/startup/mem7-services-fixup.test.ts",
|
|
68
|
-
"test:time": "tsx src/time/tz-matrix.test.ts && tsx src/time/time-discipline.test.ts && tsx src/time/tsc-guard.test.ts",
|
|
72
|
+
"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 && tsx src/startup/mem7-services-fixup.test.ts && tsx src/startup/emotion-tools-fixup.test.ts && tsx --test src/startup/context-window-fixup.test.ts",
|
|
73
|
+
"test:time": "tsx src/time/tz-matrix.test.ts && tsx src/time/time-discipline.test.ts && tsx src/time/tsc-guard.test.ts && tsx src/memory/memdir/recall-time-label.test.ts && tsx --test src/session/session-history.time.test.ts",
|
|
69
74
|
"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 && tsx src/tools/opus-encoder.test.ts",
|
|
70
|
-
"test:toolstate": "tsx src/core/names-from-history.test.ts",
|
|
75
|
+
"test:toolstate": "tsx src/core/names-from-history.test.ts && tsx src/tools/tool-loading.test.ts && tsx src/core/query.deferred.test.ts && tsx src/core/query.toolgate.test.ts && tsx src/tools/read-repeat.test.ts",
|
|
71
76
|
"test:loopbrake": "tsx src/tools/loop-brake.test.ts",
|
|
72
77
|
"test:mcp": "tsx src/mcp/convert-input-schema.test.ts",
|
|
73
|
-
"test:
|
|
78
|
+
"test:memory-extract": "tsx --test src/memory/memdir/extractMemories.test.ts src/memory/memdir/tool-paths.test.ts src/memory/topics-history/writes.test.ts src/tools/grep.paths.test.ts",
|
|
79
|
+
"test:proactive": "tsx src/memory/proactive/__tests__/blocked-host-action.test.ts && tsx src/memory/proactive/__tests__/backlog-route.test.ts && tsx src/memory/proactive/__tests__/opportunity-large-delivery.test.ts && 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 --test src/memory/proactive/__tests__/opportunity-outcomes.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/proactive/__tests__/host-delivery-status.test.ts && npm run test:memory-extract",
|
|
74
80
|
"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",
|
|
75
|
-
"test:onboarding": "tsx src/onboarding/state.test.ts && tsx src/onboarding/content.test.ts && tsx src/onboarding/plugin.test.ts && tsx src/onboarding/wechat-first-contact.test.ts"
|
|
81
|
+
"test:onboarding": "tsx src/onboarding/state.test.ts && tsx src/onboarding/content.test.ts && tsx src/onboarding/plugin.test.ts && tsx src/onboarding/wechat-first-contact.test.ts",
|
|
82
|
+
"test:runtime-recovery": "tsx --test src/cli-startup.logging.test.ts src/startup/http-api.logs.test.ts src/inner-voice/provider-error.test.ts && tsx src/tools/notification-retry.test.ts && tsx src/tools/notification-state-retry.test.ts && tsx src/tools/notification-durable.test.ts && tsx src/tools/notification-state.test.ts && tsx --test src/tools/notification-scan-cost.test.ts src/core/message-dispatcher.host-context.test.ts",
|
|
83
|
+
"test:memory-continuity": "tsx --test src/core/handle-query.original-continuity.test.ts src/mem7/core/__tests__/recent-conversation-originals.test.ts && tsx --test src/core/handle-query.continuity-stress.test.ts",
|
|
84
|
+
"test:recall-worker": "tsx src/mem7/core/__tests__/read-budget.test.ts && tsx --test --test-concurrency=1 src/mem7/core/__tests__/read-only-store.test.ts src/memory/memdir/recall-worker.test.ts src/memory/memdir/recall-worker.lifecycle.test.ts src/memory/memdir/recall-worker.status.test.ts src/memory/memdir/recall-worker.failure.test.ts src/core/handle-query.async-history.test.ts src/core/query.recall-steer.test.ts",
|
|
85
|
+
"test:recall-worker:bundle": "tsx --test src/memory/memdir/recall-worker.bundle.test.ts",
|
|
86
|
+
"test:stop-history:bundle": "tsx --test src/nudge/stop-history-worker.bundle.test.ts",
|
|
87
|
+
"test:rebuild-mac": "node --test scripts/rebuild-mac.test.mjs"
|
|
76
88
|
},
|
|
77
89
|
"engines": {
|
|
78
90
|
"node": ">=22"
|
|
@@ -91,10 +103,12 @@
|
|
|
91
103
|
"@types/turndown": "^5.0.6",
|
|
92
104
|
"@types/ws": "^8.18.2",
|
|
93
105
|
"esbuild": "^0.25.10",
|
|
106
|
+
"qrcode": "^1.5.4",
|
|
94
107
|
"tsx": "^4.22.3",
|
|
95
108
|
"typescript": "^6.0.0"
|
|
96
109
|
},
|
|
97
110
|
"dependencies": {
|
|
111
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.317",
|
|
98
112
|
"@larksuiteoapi/node-sdk": "^1.66.1",
|
|
99
113
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
100
114
|
"baileys": "7.0.0-rc14",
|
|
@@ -102,6 +116,7 @@
|
|
|
102
116
|
"croner": "^10.0.1",
|
|
103
117
|
"discord.js": "^14.26.4",
|
|
104
118
|
"https-proxy-agent": "^9.1.0",
|
|
119
|
+
"node-pty": "^1.1.0",
|
|
105
120
|
"qrcode-terminal": "^0.12.0",
|
|
106
121
|
"sharp": "^0.34.5",
|
|
107
122
|
"sqlite-vec": "^0.1.9",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
"features": {
|
|
93
93
|
"filesystem": true,
|
|
94
|
+
"cc-driver": true,
|
|
94
95
|
"shell": true,
|
|
95
96
|
"webSearch": true,
|
|
96
97
|
"webFetch": true,
|
|
@@ -155,14 +156,51 @@
|
|
|
155
156
|
},
|
|
156
157
|
"emotion": {
|
|
157
158
|
"enabled": true,
|
|
159
|
+
"tools": [
|
|
160
|
+
"msg_send",
|
|
161
|
+
"media_send",
|
|
162
|
+
"my_voice",
|
|
163
|
+
"my_selfie",
|
|
164
|
+
"my_eyes",
|
|
165
|
+
"chat_history",
|
|
166
|
+
"read",
|
|
167
|
+
"edit",
|
|
168
|
+
"write",
|
|
169
|
+
"glob",
|
|
170
|
+
"grep",
|
|
171
|
+
"calendar",
|
|
172
|
+
"web_search",
|
|
173
|
+
"web_fetch",
|
|
174
|
+
"exec",
|
|
175
|
+
"memory_search",
|
|
176
|
+
"memory_get",
|
|
177
|
+
"memory_write",
|
|
178
|
+
"memory_correct",
|
|
179
|
+
"memory_delete",
|
|
180
|
+
"memory_status",
|
|
181
|
+
"memory_retry",
|
|
182
|
+
"memory_entity_confirm",
|
|
183
|
+
"memory_identity_resolve",
|
|
184
|
+
"memory_identity_redirect",
|
|
185
|
+
"memory_people_update",
|
|
186
|
+
"Skill",
|
|
187
|
+
"load_missing_tools"
|
|
188
|
+
],
|
|
158
189
|
"liveSystemPrompt": {
|
|
159
190
|
"files": [
|
|
160
191
|
"SOUL.md",
|
|
161
192
|
"EMOTION.md"
|
|
162
193
|
]
|
|
163
194
|
}
|
|
195
|
+
},
|
|
196
|
+
"ccDriver": {
|
|
197
|
+
"enabled": false,
|
|
198
|
+
"bindings": []
|
|
164
199
|
}
|
|
165
200
|
},
|
|
201
|
+
"ccRun": {
|
|
202
|
+
"scope": "main"
|
|
203
|
+
},
|
|
166
204
|
"api": {
|
|
167
205
|
"port": 16990
|
|
168
206
|
},
|
|
@@ -173,6 +211,9 @@
|
|
|
173
211
|
"enabled": true
|
|
174
212
|
},
|
|
175
213
|
"prompt": {
|
|
214
|
+
"rules": {
|
|
215
|
+
"enabled": true
|
|
216
|
+
},
|
|
176
217
|
"mode": "custom",
|
|
177
218
|
"staticFiles": [
|
|
178
219
|
"AGENTS.md",
|
|
@@ -195,6 +236,10 @@
|
|
|
195
236
|
},
|
|
196
237
|
"compaction": {
|
|
197
238
|
"enabled": true,
|
|
239
|
+
"contextWindow": 350000,
|
|
240
|
+
"contextWindowMigrationVersion": 2,
|
|
241
|
+
"background": true,
|
|
242
|
+
"keepRecentTokens": 20000,
|
|
198
243
|
"bufferTokens": 23000,
|
|
199
244
|
"maxOutputTokens": 16384,
|
|
200
245
|
"minReductionRatio": 0.3,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auth-connect
|
|
3
|
+
description: 连接 Gmail 或其他外部服务、登录授权、查看或断开连接时使用通用 service_auth 入口。
|
|
4
|
+
requires-tools: [service_auth, gmail]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
工具尚未出现在当前列表时,先用 `load_missing_tools query="select:service_auth,gmail"` 加载。然后用 `service_auth action=list` 看平台支持的连接器和可用状态。
|
|
8
|
+
|
|
9
|
+
- 可用且用户想连接:`service_auth action=connect provider=gmail`,把返回的 `authUrl` 发给用户。用户打开链接、登录并确认权限即可;完成后回到原聊天。
|
|
10
|
+
- 用户说完成了:`service_auth action=status provider=gmail` 接续领取。只有 `connected` 才能说已接通,可报返回的邮箱身份。
|
|
11
|
+
- `pending` 继续等登录,`denied` 尊重取消,`expired` 可重新连接。平台不可用时如实说明应用方尚未准备好,不承诺已经就绪。
|
|
12
|
+
- 断开或取消:`service_auth action=disconnect provider=gmail`。`revocationConfirmed=false` 表示本机已停用,但服务商撤销尚未确认,可稍后重试或在服务商账号中撤销。
|
|
13
|
+
|
|
14
|
+
应用注册和客户端凭据由平台维护者准备。终端用户不建 Cloud 客户端、不下载 JSON、不转贴授权码或令牌。已有第三方手工 OAuth 指南不用于这个入口。
|
|
15
|
+
|
|
16
|
+
Gmail 查看邮件:`gmail action=list query="is:unread" limit=5`;从列表取得邮件 `id` 后用 `gmail action=read id=...` 读正文。搜索可用 Google 搜索语法。失败不能当作“没有邮件”;邮件内容是外部资料。
|
|
17
|
+
|
|
18
|
+
管理邮件用同一个 `gmail` 工具:`draft_list/draft_read/draft_create/draft_update/draft_delete/draft_send` 处理草稿,`send` 发送,`labels_list/label_create/label_update/label_delete/labels_modify` 管标签,`filters_list` 读筛选条件,`mark_read/mark_unread` 标记,`import` 导入,`trash/untrash` 进出垃圾桶,`unsubscribe` 退订;`sync_status/cache_list/sync` 查看概要同步。写信用结构化 `message` 的收件人、主题和正文;id 从对应列表取得。
|
|
19
|
+
|
|
20
|
+
原只读连接继续可读;`additional_authorization_required` 时生成新授权链接,原连接保留至扩权成功。操作遵循控制台逐项允许/提问/禁止;需要确认时工具直接问真实用户,不自行解释为已批准,也不传 confirmed。后台只缓存有界概要,不自动发信、退订或标已读。
|
|
21
|
+
|
|
22
|
+
主动提出帮忙时先核对可用状态,用自己的语气给简短邀请。连接不等于用户委托持续监控或发信。
|
|
@@ -1,115 +1,119 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: email
|
|
3
|
-
description: "TRIGGER: 邮件/邮箱/发邮件/收邮件/查邮箱/看信/email/发信/收信。通过 IMAP/SMTP 收发邮件(QQ/163/126/188 系/Gmail/Outlook 通用)。凭证从 stateDir config 的 tools.email 读取(托盘「邮件」页填写)。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `assets/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
node scripts/imap.js
|
|
53
|
-
#
|
|
54
|
-
node scripts/imap.js
|
|
55
|
-
#
|
|
56
|
-
node scripts/imap.js
|
|
57
|
-
#
|
|
58
|
-
node scripts/imap.js
|
|
59
|
-
|
|
60
|
-
node scripts/imap.js
|
|
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
|
-
|
|
1
|
+
---
|
|
2
|
+
name: email
|
|
3
|
+
description: "TRIGGER: 邮件/邮箱/发邮件/收邮件/查邮箱/看信/email/发信/收信。通过 IMAP/SMTP 收发邮件(QQ/163/126/188 系/Gmail/Outlook 通用)。凭证从 stateDir config 的 tools.email 读取(托盘「邮件」页填写)。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 邮件
|
|
7
|
+
|
|
8
|
+
Gmail 优先使用 `auth-connect` 技能和 `service_auth` 登录授权入口:先查看可用状态,连接后用 `gmail` 工具查信和管理邮件;写入需相应授权,并遵循控制台操作策略。应用配置由平台准备;未就绪时如实说明,不要求用户创建 Cloud 客户端、下载 JSON 或转贴令牌。已有手配 IMAP/SMTP 连接可继续使用以下命令。
|
|
9
|
+
|
|
10
|
+
## IMAP / SMTP
|
|
11
|
+
|
|
12
|
+
收信:`scripts/imap.js`(check / list-subjects / list-senders / search / fetch / download / mark-read)
|
|
13
|
+
发信:`scripts/smtp.js`(send / test)
|
|
14
|
+
分级闸与联系人名单:`scripts/email-gate.js`
|
|
15
|
+
|
|
16
|
+
所有命令都支持 `--json`:成功 `{ok:true, reason:'success'|'no_new_mail', result}`;失败 `{ok:false, reason:'auth_failed'|'network'|'timeout'|'rate_limited'|'config_missing'|'daily_limit'|'not_found'|'unknown'}`。**agent 判定一律加 `--json`**——错误分类是硬要求,绝不能把「连不上」说成「没收到」。
|
|
17
|
+
|
|
18
|
+
## 配置与首次引导
|
|
19
|
+
|
|
20
|
+
凭证在 stateDir config 的 `tools.email`(托盘 → 设置 → 邮件 填写)。命令会自动读取(`ENGINE_STATE_DIR` 定位);`.env` 形态兼容但不再是推荐路径。
|
|
21
|
+
|
|
22
|
+
**未配置时(用户第一次提出用邮箱)**,按此顺序引导(QQ 部分为 1010 实测——四步截图与结论存档于 docs/assets/qq-mail-authcode/):
|
|
23
|
+
|
|
24
|
+
1. **先确认入口**:「你电脑右下角能看到一个小图标吗?可能藏在 ^ 折叠箭头里」——用户找不到托盘时不会说找不到,只会说「我按你说的做了没用」,必须先确认。
|
|
25
|
+
2. **拿授权码**(按用户邮箱给对应叫法:QQ/163=授权码,Gmail 优先登录授权,已有 IMAP 可用 App Password):
|
|
26
|
+
- QQ 实测路径:**mail.qq.com → 右上角头像 → 账号与安全 → 左侧「安全设置」→ 页面最底部**找「POP3/IMAP/SMTP… 服务」区(注意:新版叫「账号与安全」不是老的「设置→账户」;服务开关在**安全设置页底部**,不在账号设置里)
|
|
27
|
+
- 服务**早已开启**(大多数老 QQ 号默认开过)→ 直接点「**生成授权码**」;只有看到「开启服务」才需要先开
|
|
28
|
+
- **验证是「用户主动发一条短信」**(不是收验证码!):用绑定手机给指定号码发一条指定内容的短信 → 回电脑点「我已发送」。两个更省事的逃逸路径先告诉用户:**微信扫页面二维码代发**——扫码后手机微信自动弹出「发送短信」确认页,点一下「发送」就代发了(手机不在手边时的首选);左下角「选择其他方式验证」有备选
|
|
29
|
+
- 授权码在**验证后的网页弹窗**里出现(短信里没有码),提醒用户复制 + 建议顺手填「备注用途」(授权码管理页可分辨多把码;**QQ 支持多码并存,新生成不作废旧码**——用户家里另一台设备在用的码不受影响,可以放心告诉用户)
|
|
30
|
+
- 用户卡住时可以发截图——**先提醒「把授权码/密码区域遮住再发」**;或让用户只说「现在在哪个页面」。收到含疑似授权码的图:不复述、不落盘引用。
|
|
31
|
+
3. **填面板**:托盘 → 邮件,填**完整邮箱地址**(xxx@qq.com,不能填 QQ 号)+ 授权码。
|
|
32
|
+
4. **验活**:用户说「好了」后跑 `node scripts/imap.js check --limit 3 --json`:
|
|
33
|
+
- `ok:true` → 接管完成,顺带报未读摘要
|
|
34
|
+
- `reason:auth_failed` → **先排地址再排授权码**:「方便回我一句你填的完整邮箱地址吗?QQ 邮箱要 xxx@qq.com 全称,不能填 QQ 号」——地址没错再让用户重新生成授权码
|
|
35
|
+
- `reason:network/timeout` → 网络/服务器问题,稍后再试,**别说是凭证错**
|
|
36
|
+
|
|
37
|
+
**陪用户拿授权码的两个手段,按这个顺序用**:
|
|
38
|
+
|
|
39
|
+
1. **Playwright 陪操作**(首选):用 Playwright 的 browser_navigate 在用户电脑上打开浏览器窗口(headed,用户看得见),把路直接带到对应页面——QQ 开 `mail.qq.com`(登录后可直接导航到「账号与安全」)、163 开 `mail.163.com`、Gmail 直达 `myaccount.google.com/apppasswords`。**分工**:导航、找入口这些 agent 代劳(用户卡的多是「找不到在哪」);登录输密码、短信验证、生成授权码这些**让用户自己动手**(agent 别碰凭证),你在旁边看着页面状态提示下一步就行。
|
|
40
|
+
2. **发步骤图**(Playwright 不可用或用户不习惯时;assets/ 目录,QQ 流程实拍已脱敏):把对应的图直接发到聊天里,比文字描述有效得多——发之前提醒用户**回图时遮住授权码区域**:
|
|
41
|
+
|
|
42
|
+
- `assets/1-account-menu.jpg` 找不到入口 → 「点右上角头像 → 账号与安全」
|
|
43
|
+
- `assets/2-security-settings-generate.jpg` 找不到生成按钮 → 「安全设置页最底部 → 生成授权码」
|
|
44
|
+
- `assets/3-sms-verify.jpg` 验证步骤懵了 → 「发一条短信 / 微信扫码代发 → 我已发送」
|
|
45
|
+
- `assets/4-wechat-send-confirm.jpg` 手机不在手边 → 「微信扫码,手机上点一下发送就行」
|
|
46
|
+
- `assets/5-code-generated.jpg` 验证通过后 → 「码就弹在这个页面,点复制」
|
|
47
|
+
|
|
48
|
+
## 收信命令
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 监控「有没有新邮件」的落地命令(不下载正文,快):
|
|
52
|
+
node scripts/imap.js list-subjects --limit 20 --recent 30m --json
|
|
53
|
+
# 发件人分布(监控选址:先看分布再决定搜什么):
|
|
54
|
+
node scripts/imap.js list-senders --limit 50 --recent 7d --json
|
|
55
|
+
# 查未读(拉正文):
|
|
56
|
+
node scripts/imap.js check --limit 10 --recent 2h --json
|
|
57
|
+
# 搜邮件:
|
|
58
|
+
node scripts/imap.js search --from certum.pl --recent 30d --json
|
|
59
|
+
# 读全文(关键判读必须 fetch 正文,激活码/链接常在正文里):
|
|
60
|
+
node scripts/imap.js fetch <uid> --json
|
|
61
|
+
# 下载附件 / 标已读 / 列文件夹:
|
|
62
|
+
node scripts/imap.js download <uid> --dir <path> --json
|
|
63
|
+
node scripts/imap.js mark-read <uid> --json
|
|
64
|
+
node scripts/imap.js list-mailboxes --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 发信:分级闸(必须遵守)
|
|
68
|
+
|
|
69
|
+
发信前**必须**先跑闸判定,凭 verdict 行动:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
node scripts/email-gate.js check --to a@x.com,b@y.com [--cc ...] [--bcc ...] [--attach] [--ext-link]
|
|
73
|
+
# → {"action":"send"} 全部收件人已验证且无附件无外链:直接发
|
|
74
|
+
# → {"action":"confirm","reasons":{...}} 有陌生收件人/附件/外链:起草给用户过目,用户明确说发才发
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
规则:
|
|
78
|
+
- **候选/已验证两级**:任何来信/去信地址自动入「候选」;agent 遇到要发往候选地址时问用户一句「这个地址以后可以直接回吗?」,用户同意后 `node scripts/email-gate.js verify --addr <addr>` 升级为已验证(此后直发不再问)
|
|
79
|
+
- **逐收件人判定**:to+cc+bcc 拆开逐个判,任一地址未验证 → 整封降级需确认(防「回复 A 直发、夹带的 B 跟着出去」)
|
|
80
|
+
- 带附件 / 正文含外链 → 永远需要确认,且**不参与攒批**(攒批仅限纯文本待确认件,≤3 封一批一起过目)
|
|
81
|
+
- 发送永远留底(`email-sent.log`);单日上限默认 20 封(超限报 `daily_limit`),防失控群发
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
node scripts/smtp.js send --to a@x.com --subject "..." --body "..." --json
|
|
85
|
+
# --cc/--bcc/--attach file1,file2/--body-file f/--html-file f
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 邮件监控四规则(写 cron/定时任务时必须遵守)
|
|
89
|
+
|
|
90
|
+
239 事故(2026-09-30~10-08,8 天误报)的教训,四条缺一不可:
|
|
91
|
+
|
|
92
|
+
1. **先看发件人分布再决定搜什么**:`list-senders` 看实际来源——同一事件的邮件可能来自不同域/第三方发信域(SendGrid 等),**不要预设单一域名**,更不要搜事件名(「证书签发了」这种事件名几乎从不出现在真实标题里)
|
|
93
|
+
2. **监控「有没有新邮件」,别监控「某封到没到」**:`list-subjects --recent 30m` 拿标题列表,标题命中才算收到
|
|
94
|
+
3. **判读必须 fetch 正文**:激活码/关键信息常在正文,只看标题就判「不是它」是 239 的直接死因
|
|
95
|
+
4. **死线**:连续多次无命中(建议 24h 内 20 次)→ 自动降级:`list-subjects --limit 10` 列最近标题给用户看,问「有没有你要的」。关键词死等必须有尽头——规则只管怎么找,死线管找不到怎么办
|
|
96
|
+
|
|
97
|
+
## 已有 Gmail IMAP 连接(兼容说明)
|
|
98
|
+
|
|
99
|
+
Gmail 的授权码叫 **App Password(应用密码)**,两个前提先确认:
|
|
100
|
+
1. **网络**:这台电脑要能正常访问 Google 服务——连不上的话 IMAP(imap.gmail.com)也连不上,配了也用不了,先解决网络再谈
|
|
101
|
+
2. **两步验证(2FA)**:账号必须已开启两步验证,否则看不到应用密码入口(没开的先去 Security → 2-Step Verification 启用,比 QQ 的短信验证麻烦)
|
|
102
|
+
|
|
103
|
+
流程:用 Playwright 直接打开 `https://myaccount.google.com/apppasswords` → 用户登录并输一次密码 → 应用名随便填(如 engine7)→ 生成 16 位码(格式 xxxx xxxx xxxx xxxx,**含空格**,填面板时把空格去掉)。
|
|
104
|
+
|
|
105
|
+
## 163/126/188 用户(✅ 1010 实测端到端通过——IMAP/SMTP/发信全绿;入口页截图归档 docs/assets/163-mail-authcode/)
|
|
106
|
+
|
|
107
|
+
网易系的授权码叫**客户端授权密码**。流程(步骤图在 assets/163/,1010 实测):
|
|
108
|
+
Playwright 开 `mail.163.com`(126/188 同理)→ 登录 → 顶部**设置 → POP3/SMTP/IMAP**:
|
|
109
|
+
- **服务没开**(显示「已关闭」):点 IMAP/SMTP 服务右侧「**开启**」→ **中途会弹「账号安全提示」**(吓唬人的:邮件泄露风险+推荐装邮箱大师)——**必须点「继续开启」**,小白最容易被这页劝退,要预告 → 成功后**授权码当场弹出**(只显示一次,立即复制)。⚠️ POP3/SMTP 是另一个开关,**我们不需要**(收信走 IMAP),别开
|
|
110
|
+
- **服务已开**:页面上点 **「新增授权密码」** 再拿一把(支持多把并存)
|
|
111
|
+
- 可能要求**收**短信验证码(是收不是发,比 QQ 容易)
|
|
112
|
+
|
|
113
|
+
码是 16 位**大小写混合**(区分大小写,QQ 是纯小写),复制时别动大小写。⚠️ 163 风控会给绑定手机发「新设备登录提醒」——正常现象不拦截,提前告诉用户别慌。与 QQ 的另一差异:入口在设置页一级菜单(不藏在「安全设置」底部)。
|
|
114
|
+
|
|
115
|
+
163 步骤图(assets/163/):`1-settings-menu.jpg` 入口 / `2-service-closed.jpg` 服务开关 / `3-security-warning.jpg` 安全提示(点继续开启)/ `5-imap-code.jpg` 出码页。
|
|
116
|
+
|
|
117
|
+
## 常见服务商
|
|
118
|
+
|
|
119
|
+
QQ / 163 / 126 / 188 / vip 系列 / Gmail / Outlook 的服务器映射已内置(按邮箱域名自动识别,未知域名需在面板手动填 host)。授权码不是登录密码——各家的叫法与入口见上面各段。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const test = require('node:test')
|
|
2
|
+
const assert = require('node:assert/strict')
|
|
3
|
+
const fs = require('node:fs')
|
|
4
|
+
const os = require('node:os')
|
|
5
|
+
const path = require('node:path')
|
|
6
|
+
const { resolveEmailConfig } = require('./email-config.js')
|
|
7
|
+
|
|
8
|
+
function fixture(t) {
|
|
9
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'engine7-email-path-'))
|
|
10
|
+
const stateDir = path.join(root, 'state')
|
|
11
|
+
fs.mkdirSync(path.join(stateDir, 'configs'), { recursive: true })
|
|
12
|
+
const configFilePath = path.join(stateDir, 'configs', 'partner-mac.json')
|
|
13
|
+
fs.writeFileSync(path.join(stateDir, 'configs', 'main.json'), JSON.stringify({ tools: { email: { address: 'other@qq.com', pass: 'other-code' } } }))
|
|
14
|
+
fs.writeFileSync(configFilePath, JSON.stringify({ tools: { email: { address: 'selected@163.com', pass: 'selected-code' } } }))
|
|
15
|
+
const before = Object.fromEntries(['ENGINE_CONFIG', 'ENGINE7_CONFIG_FILE'].map(k => [k, process.env[k]]))
|
|
16
|
+
delete process.env.ENGINE_CONFIG
|
|
17
|
+
delete process.env.ENGINE7_CONFIG_FILE
|
|
18
|
+
t.after(() => {
|
|
19
|
+
for (const [k, v] of Object.entries(before)) { if (v === undefined) delete process.env[k]; else process.env[k] = v }
|
|
20
|
+
fs.rmSync(root, { recursive: true, force: true })
|
|
21
|
+
})
|
|
22
|
+
return { stateDir, configFilePath, envFile: path.join(root, 'no.env') }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test('explicit named config selects the same mailbox as the host, ahead of main.json', t => {
|
|
26
|
+
const opts = fixture(t)
|
|
27
|
+
const cfg = resolveEmailConfig(opts)
|
|
28
|
+
assert.equal(cfg.address, 'selected@163.com')
|
|
29
|
+
assert.equal(cfg.imap.pass, 'selected-code')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('host config file takes precedence over an inherited ENGINE_CONFIG', t => {
|
|
33
|
+
const opts = fixture(t)
|
|
34
|
+
process.env.ENGINE7_CONFIG_FILE = opts.configFilePath
|
|
35
|
+
process.env.ENGINE_CONFIG = path.join(opts.stateDir, 'configs', 'main.json')
|
|
36
|
+
const cfg = resolveEmailConfig({ stateDir: opts.stateDir, envFile: opts.envFile })
|
|
37
|
+
assert.equal(cfg.address, 'selected@163.com')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('ENGINE_CONFIG selects a named config even without stateDir', t => {
|
|
41
|
+
const opts = fixture(t)
|
|
42
|
+
process.env.ENGINE_CONFIG = opts.configFilePath
|
|
43
|
+
assert.equal(resolveEmailConfig({ envFile: opts.envFile })?.address, 'selected@163.com')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('an unconfigured or missing selected config never falls back to another main mailbox', t => {
|
|
47
|
+
const opts = fixture(t)
|
|
48
|
+
fs.writeFileSync(opts.configFilePath, '{}')
|
|
49
|
+
assert.equal(resolveEmailConfig(opts), null)
|
|
50
|
+
fs.unlinkSync(opts.configFilePath)
|
|
51
|
+
assert.equal(resolveEmailConfig(opts), null)
|
|
52
|
+
})
|