@andre.li/memoark 0.3.1 → 0.3.2
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.en.md +388 -69
- package/README.md +674 -309
- package/README.zh-CN.md +816 -0
- package/bin/memoark.mjs +7 -2
- package/dist/adapters/store.d.ts.map +1 -1
- package/dist/adapters/store.js +6 -5
- package/dist/adapters/store.js.map +1 -1
- package/dist/cli-helpers.d.ts +12 -0
- package/dist/cli-helpers.d.ts.map +1 -0
- package/dist/cli-helpers.js +11 -0
- package/dist/cli-helpers.js.map +1 -0
- package/dist/cli.js +682 -126
- package/dist/cli.js.map +1 -1
- package/dist/collectors/feishu/chat-name-resolver.d.ts +33 -0
- package/dist/collectors/feishu/chat-name-resolver.d.ts.map +1 -0
- package/dist/collectors/feishu/chat-name-resolver.js +63 -0
- package/dist/collectors/feishu/chat-name-resolver.js.map +1 -0
- package/dist/collectors/feishu/collector.d.ts +4 -0
- package/dist/collectors/feishu/collector.d.ts.map +1 -1
- package/dist/collectors/feishu/collector.js +27 -4
- package/dist/collectors/feishu/collector.js.map +1 -1
- package/dist/collectors/feishu/docs/blocks.d.ts +25 -0
- package/dist/collectors/feishu/docs/blocks.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/blocks.js +34 -0
- package/dist/collectors/feishu/docs/blocks.js.map +1 -0
- package/dist/collectors/feishu/docs/candidate.d.ts +17 -0
- package/dist/collectors/feishu/docs/candidate.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/candidate.js +36 -0
- package/dist/collectors/feishu/docs/candidate.js.map +1 -0
- package/dist/collectors/feishu/docs/config.d.ts +41 -0
- package/dist/collectors/feishu/docs/config.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/config.js +30 -0
- package/dist/collectors/feishu/docs/config.js.map +1 -0
- package/dist/collectors/feishu/docs/decision.d.ts +14 -0
- package/dist/collectors/feishu/docs/decision.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/decision.js +43 -0
- package/dist/collectors/feishu/docs/decision.js.map +1 -0
- package/dist/collectors/feishu/docs/full-builder.d.ts +17 -0
- package/dist/collectors/feishu/docs/full-builder.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/full-builder.js +136 -0
- package/dist/collectors/feishu/docs/full-builder.js.map +1 -0
- package/dist/collectors/feishu/docs/hash.d.ts +8 -0
- package/dist/collectors/feishu/docs/hash.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/hash.js +15 -0
- package/dist/collectors/feishu/docs/hash.js.map +1 -0
- package/dist/collectors/feishu/docs/ingest.d.ts +54 -0
- package/dist/collectors/feishu/docs/ingest.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/ingest.js +120 -0
- package/dist/collectors/feishu/docs/ingest.js.map +1 -0
- package/dist/collectors/feishu/docs/llm-json.d.ts +13 -0
- package/dist/collectors/feishu/docs/llm-json.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/llm-json.js +40 -0
- package/dist/collectors/feishu/docs/llm-json.js.map +1 -0
- package/dist/collectors/feishu/docs/pointer-builder.d.ts +7 -0
- package/dist/collectors/feishu/docs/pointer-builder.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/pointer-builder.js +11 -0
- package/dist/collectors/feishu/docs/pointer-builder.js.map +1 -0
- package/dist/collectors/feishu/docs/render.d.ts +8 -0
- package/dist/collectors/feishu/docs/render.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/render.js +105 -0
- package/dist/collectors/feishu/docs/render.js.map +1 -0
- package/dist/collectors/feishu/docs/run.d.ts +37 -0
- package/dist/collectors/feishu/docs/run.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/run.js +143 -0
- package/dist/collectors/feishu/docs/run.js.map +1 -0
- package/dist/collectors/feishu/docs/status.d.ts +16 -0
- package/dist/collectors/feishu/docs/status.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/status.js +24 -0
- package/dist/collectors/feishu/docs/status.js.map +1 -0
- package/dist/collectors/feishu/docs/store-writer.d.ts +32 -0
- package/dist/collectors/feishu/docs/store-writer.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/store-writer.js +71 -0
- package/dist/collectors/feishu/docs/store-writer.js.map +1 -0
- package/dist/collectors/feishu/docs/toc.d.ts +3 -0
- package/dist/collectors/feishu/docs/toc.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/toc.js +19 -0
- package/dist/collectors/feishu/docs/toc.js.map +1 -0
- package/dist/collectors/feishu/docs/triggers.d.ts +7 -0
- package/dist/collectors/feishu/docs/triggers.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/triggers.js +31 -0
- package/dist/collectors/feishu/docs/triggers.js.map +1 -0
- package/dist/collectors/feishu/docs/types.d.ts +109 -0
- package/dist/collectors/feishu/docs/types.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/types.js +2 -0
- package/dist/collectors/feishu/docs/types.js.map +1 -0
- package/dist/collectors/feishu/docs/upgrade-queue.d.ts +19 -0
- package/dist/collectors/feishu/docs/upgrade-queue.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/upgrade-queue.js +36 -0
- package/dist/collectors/feishu/docs/upgrade-queue.js.map +1 -0
- package/dist/collectors/feishu/docs/url-parser.d.ts +3 -0
- package/dist/collectors/feishu/docs/url-parser.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/url-parser.js +39 -0
- package/dist/collectors/feishu/docs/url-parser.js.map +1 -0
- package/dist/collectors/feishu/docs/walkers.d.ts +24 -0
- package/dist/collectors/feishu/docs/walkers.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/walkers.js +90 -0
- package/dist/collectors/feishu/docs/walkers.js.map +1 -0
- package/dist/collectors/feishu/docs/wiki-resolver.d.ts +15 -0
- package/dist/collectors/feishu/docs/wiki-resolver.d.ts.map +1 -0
- package/dist/collectors/feishu/docs/wiki-resolver.js +24 -0
- package/dist/collectors/feishu/docs/wiki-resolver.js.map +1 -0
- package/dist/collectors/feishu/lark-cli-client.d.ts +12 -0
- package/dist/collectors/feishu/lark-cli-client.d.ts.map +1 -1
- package/dist/collectors/feishu/lark-cli-client.js +37 -2
- package/dist/collectors/feishu/lark-cli-client.js.map +1 -1
- package/dist/collectors/feishu/lark-cli-identity-backend.d.ts +28 -0
- package/dist/collectors/feishu/lark-cli-identity-backend.d.ts.map +1 -0
- package/dist/collectors/feishu/lark-cli-identity-backend.js +110 -0
- package/dist/collectors/feishu/lark-cli-identity-backend.js.map +1 -0
- package/dist/collectors/feishu/self-open-id.d.ts +20 -0
- package/dist/collectors/feishu/self-open-id.d.ts.map +1 -0
- package/dist/collectors/feishu/self-open-id.js +31 -0
- package/dist/collectors/feishu/self-open-id.js.map +1 -0
- package/dist/collectors/feishu/sources/dm.d.ts.map +1 -1
- package/dist/collectors/feishu/sources/dm.js +4 -0
- package/dist/collectors/feishu/sources/dm.js.map +1 -1
- package/dist/collectors/feishu/sources/mail.d.ts.map +1 -1
- package/dist/collectors/feishu/sources/mail.js +18 -20
- package/dist/collectors/feishu/sources/mail.js.map +1 -1
- package/dist/collectors/feishu/sources/messages.d.ts +2 -0
- package/dist/collectors/feishu/sources/messages.d.ts.map +1 -1
- package/dist/collectors/feishu/sources/messages.js +28 -1
- package/dist/collectors/feishu/sources/messages.js.map +1 -1
- package/dist/collectors/feishu/types.d.ts +37 -3
- package/dist/collectors/feishu/types.d.ts.map +1 -1
- package/dist/collectors/feishu/types.js.map +1 -1
- package/dist/config-center/connection-checks.d.ts.map +1 -1
- package/dist/config-center/connection-checks.js +1 -1
- package/dist/config-center/connection-checks.js.map +1 -1
- package/dist/config-center/schema.d.ts.map +1 -1
- package/dist/config-center/schema.js +77 -0
- package/dist/config-center/schema.js.map +1 -1
- package/dist/consolidator/consolidator.d.ts +13 -1
- package/dist/consolidator/consolidator.d.ts.map +1 -1
- package/dist/consolidator/consolidator.js +12 -2
- package/dist/consolidator/consolidator.js.map +1 -1
- package/dist/core/canonicalize.js +5 -1
- package/dist/core/canonicalize.js.map +1 -1
- package/dist/core/config.d.ts +52 -9
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +86 -24
- package/dist/core/config.js.map +1 -1
- package/dist/core/env-validation.d.ts +9 -0
- package/dist/core/env-validation.d.ts.map +1 -0
- package/dist/core/env-validation.js +94 -0
- package/dist/core/env-validation.js.map +1 -0
- package/dist/core/identity-resolver.d.ts +24 -3
- package/dist/core/identity-resolver.d.ts.map +1 -1
- package/dist/core/identity-resolver.js +147 -2
- package/dist/core/identity-resolver.js.map +1 -1
- package/dist/core/person-identity.d.ts +124 -0
- package/dist/core/person-identity.d.ts.map +1 -0
- package/dist/core/person-identity.js +342 -0
- package/dist/core/person-identity.js.map +1 -0
- package/dist/core/person-slug.d.ts +21 -0
- package/dist/core/person-slug.d.ts.map +1 -0
- package/dist/core/person-slug.js +93 -0
- package/dist/core/person-slug.js.map +1 -0
- package/dist/core/pipeline-factory.d.ts +1 -1
- package/dist/core/pipeline-factory.d.ts.map +1 -1
- package/dist/core/pipeline-factory.js +8 -3
- package/dist/core/pipeline-factory.js.map +1 -1
- package/dist/core/pipeline.d.ts +16 -0
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +49 -1
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/resource-loader.d.ts +2 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +12 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/schemas.d.ts +2981 -309
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/schemas.js +27 -0
- package/dist/core/schemas.js.map +1 -1
- package/dist/core/signal-scoring.d.ts.map +1 -1
- package/dist/core/signal-scoring.js +5 -1
- package/dist/core/signal-scoring.js.map +1 -1
- package/dist/core/source-ref.d.ts +4 -0
- package/dist/core/source-ref.d.ts.map +1 -0
- package/dist/core/source-ref.js +24 -0
- package/dist/core/source-ref.js.map +1 -0
- package/dist/core/state.d.ts +1 -1
- package/dist/core/state.d.ts.map +1 -1
- package/dist/core/state.js +3 -2
- package/dist/core/state.js.map +1 -1
- package/dist/core/types.d.ts +34 -6
- package/dist/core/types.d.ts.map +1 -1
- package/dist/daemon/reload-manager.d.ts +27 -0
- package/dist/daemon/reload-manager.d.ts.map +1 -0
- package/dist/daemon/reload-manager.js +67 -0
- package/dist/daemon/reload-manager.js.map +1 -0
- package/dist/daemon/scheduler.d.ts +9 -1
- package/dist/daemon/scheduler.d.ts.map +1 -1
- package/dist/daemon/scheduler.js +113 -38
- package/dist/daemon/scheduler.js.map +1 -1
- package/dist/daemon/serve-runtime.d.ts +31 -0
- package/dist/daemon/serve-runtime.d.ts.map +1 -0
- package/dist/daemon/serve-runtime.js +230 -0
- package/dist/daemon/serve-runtime.js.map +1 -0
- package/dist/embedded-assets.generated.d.ts.map +1 -1
- package/dist/embedded-assets.generated.js +3 -3
- package/dist/embedded-assets.generated.js.map +1 -1
- package/dist/extractors/playbook-extractor.d.ts +35 -0
- package/dist/extractors/playbook-extractor.d.ts.map +1 -0
- package/dist/extractors/playbook-extractor.js +98 -0
- package/dist/extractors/playbook-extractor.js.map +1 -0
- package/dist/extractors/prompts/examples/agent-session.md +257 -0
- package/dist/extractors/prompts/signal-extract.md +199 -0
- package/dist/extractors/prompts/system.md +45 -0
- package/dist/extractors/signal-extractor.d.ts +2 -1
- package/dist/extractors/signal-extractor.d.ts.map +1 -1
- package/dist/extractors/signal-extractor.js +99 -7
- package/dist/extractors/signal-extractor.js.map +1 -1
- package/dist/hooks/handlers.d.ts +21 -0
- package/dist/hooks/handlers.d.ts.map +1 -0
- package/dist/hooks/handlers.js +22 -0
- package/dist/hooks/handlers.js.map +1 -0
- package/dist/hooks/inject.d.ts +7 -0
- package/dist/hooks/inject.d.ts.map +1 -0
- package/dist/hooks/inject.js +18 -0
- package/dist/hooks/inject.js.map +1 -0
- package/dist/hooks/install.d.ts +14 -0
- package/dist/hooks/install.d.ts.map +1 -0
- package/dist/hooks/install.js +34 -0
- package/dist/hooks/install.js.map +1 -0
- package/dist/hooks/output.d.ts +19 -0
- package/dist/hooks/output.d.ts.map +1 -0
- package/dist/hooks/output.js +13 -0
- package/dist/hooks/output.js.map +1 -0
- package/dist/hooks/recall-client.d.ts +25 -0
- package/dist/hooks/recall-client.d.ts.map +1 -0
- package/dist/hooks/recall-client.js +56 -0
- package/dist/hooks/recall-client.js.map +1 -0
- package/dist/hooks/run-event.d.ts +13 -0
- package/dist/hooks/run-event.d.ts.map +1 -0
- package/dist/hooks/run-event.js +20 -0
- package/dist/hooks/run-event.js.map +1 -0
- package/dist/hooks/settings-edit.d.ts +10 -0
- package/dist/hooks/settings-edit.d.ts.map +1 -0
- package/dist/hooks/settings-edit.js +44 -0
- package/dist/hooks/settings-edit.js.map +1 -0
- package/dist/hooks/writeback.d.ts +12 -0
- package/dist/hooks/writeback.d.ts.map +1 -0
- package/dist/hooks/writeback.js +48 -0
- package/dist/hooks/writeback.js.map +1 -0
- package/dist/install/clients/claude-code.d.ts +3 -0
- package/dist/install/clients/claude-code.d.ts.map +1 -0
- package/dist/install/clients/claude-code.js +30 -0
- package/dist/install/clients/claude-code.js.map +1 -0
- package/dist/install/clients/claude-desktop.d.ts +3 -0
- package/dist/install/clients/claude-desktop.d.ts.map +1 -0
- package/dist/install/clients/claude-desktop.js +31 -0
- package/dist/install/clients/claude-desktop.js.map +1 -0
- package/dist/install/clients/codex.d.ts +3 -0
- package/dist/install/clients/codex.d.ts.map +1 -0
- package/dist/install/clients/codex.js +32 -0
- package/dist/install/clients/codex.js.map +1 -0
- package/dist/install/clients/cursor.d.ts +3 -0
- package/dist/install/clients/cursor.d.ts.map +1 -0
- package/dist/install/clients/cursor.js +35 -0
- package/dist/install/clients/cursor.js.map +1 -0
- package/dist/install/clients/hermes.d.ts +3 -0
- package/dist/install/clients/hermes.d.ts.map +1 -0
- package/dist/install/clients/hermes.js +35 -0
- package/dist/install/clients/hermes.js.map +1 -0
- package/dist/install/clients/index.d.ts +4 -0
- package/dist/install/clients/index.d.ts.map +1 -0
- package/dist/install/clients/index.js +18 -0
- package/dist/install/clients/index.js.map +1 -0
- package/dist/install/clients/windsurf.d.ts +3 -0
- package/dist/install/clients/windsurf.d.ts.map +1 -0
- package/dist/install/clients/windsurf.js +32 -0
- package/dist/install/clients/windsurf.js.map +1 -0
- package/dist/install/command.d.ts +14 -0
- package/dist/install/command.d.ts.map +1 -0
- package/dist/install/command.js +34 -0
- package/dist/install/command.js.map +1 -0
- package/dist/install/directive.d.ts +7 -0
- package/dist/install/directive.d.ts.map +1 -0
- package/dist/install/directive.js +31 -0
- package/dist/install/directive.js.map +1 -0
- package/dist/install/index.d.ts +26 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +117 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/json-config.d.ts +11 -0
- package/dist/install/json-config.d.ts.map +1 -0
- package/dist/install/json-config.js +39 -0
- package/dist/install/json-config.js.map +1 -0
- package/dist/install/marked-block.d.ts +11 -0
- package/dist/install/marked-block.d.ts.map +1 -0
- package/dist/install/marked-block.js +34 -0
- package/dist/install/marked-block.js.map +1 -0
- package/dist/install/skill.d.ts +4 -0
- package/dist/install/skill.d.ts.map +1 -0
- package/dist/install/skill.js +61 -0
- package/dist/install/skill.js.map +1 -0
- package/dist/install/toml-config.d.ts +4 -0
- package/dist/install/toml-config.d.ts.map +1 -0
- package/dist/install/toml-config.js +51 -0
- package/dist/install/toml-config.js.map +1 -0
- package/dist/install/types.d.ts +37 -0
- package/dist/install/types.d.ts.map +1 -0
- package/dist/install/types.js +4 -0
- package/dist/install/types.js.map +1 -0
- package/dist/install/yaml-config.d.ts +4 -0
- package/dist/install/yaml-config.d.ts.map +1 -0
- package/dist/install/yaml-config.js +18 -0
- package/dist/install/yaml-config.js.map +1 -0
- package/dist/processors/privacy.d.ts +4 -1
- package/dist/processors/privacy.d.ts.map +1 -1
- package/dist/processors/privacy.js +5 -3
- package/dist/processors/privacy.js.map +1 -1
- package/dist/profile/accumulate.d.ts +28 -0
- package/dist/profile/accumulate.d.ts.map +1 -0
- package/dist/profile/accumulate.js +48 -0
- package/dist/profile/accumulate.js.map +1 -0
- package/dist/profile/behavior.d.ts +32 -0
- package/dist/profile/behavior.d.ts.map +1 -0
- package/dist/profile/behavior.js +122 -0
- package/dist/profile/behavior.js.map +1 -0
- package/dist/profile/four-color.d.ts +12 -0
- package/dist/profile/four-color.d.ts.map +1 -0
- package/dist/profile/four-color.js +39 -0
- package/dist/profile/four-color.js.map +1 -0
- package/dist/profile/profile-synth.d.ts +27 -0
- package/dist/profile/profile-synth.d.ts.map +1 -0
- package/dist/profile/profile-synth.js +174 -0
- package/dist/profile/profile-synth.js.map +1 -0
- package/dist/profile/types.d.ts +84 -0
- package/dist/profile/types.d.ts.map +1 -0
- package/dist/profile/types.js +11 -0
- package/dist/profile/types.js.map +1 -0
- package/dist/server/api.d.ts +8 -2
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js +69 -34
- package/dist/server/api.js.map +1 -1
- package/dist/server/backfill-routes.d.ts.map +1 -1
- package/dist/server/backfill-routes.js +14 -1
- package/dist/server/backfill-routes.js.map +1 -1
- package/dist/server/chat-name-refresh-job.d.ts +33 -0
- package/dist/server/chat-name-refresh-job.d.ts.map +1 -0
- package/dist/server/chat-name-refresh-job.js +120 -0
- package/dist/server/chat-name-refresh-job.js.map +1 -0
- package/dist/server/chat-name-routes.d.ts +13 -0
- package/dist/server/chat-name-routes.d.ts.map +1 -0
- package/dist/server/chat-name-routes.js +81 -0
- package/dist/server/chat-name-routes.js.map +1 -0
- package/dist/server/config-routes.d.ts +2 -0
- package/dist/server/config-routes.d.ts.map +1 -1
- package/dist/server/config-routes.js +2 -1
- package/dist/server/config-routes.js.map +1 -1
- package/dist/server/mcp-http.d.ts +26 -0
- package/dist/server/mcp-http.d.ts.map +1 -0
- package/dist/server/mcp-http.js +102 -0
- package/dist/server/mcp-http.js.map +1 -0
- package/dist/server/mcp.d.ts +191 -25
- package/dist/server/mcp.d.ts.map +1 -1
- package/dist/server/mcp.js +1111 -68
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/open-browser.d.ts +3 -0
- package/dist/server/open-browser.d.ts.map +1 -0
- package/dist/server/open-browser.js +12 -0
- package/dist/server/open-browser.js.map +1 -0
- package/dist/server/runtime.d.ts +13 -0
- package/dist/server/runtime.d.ts.map +1 -0
- package/dist/server/runtime.js +27 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/setup-server.d.ts.map +1 -1
- package/dist/server/setup-server.js +8 -11
- package/dist/server/setup-server.js.map +1 -1
- package/dist/setup/connection-tests.d.ts +1 -1
- package/dist/setup/connection-tests.d.ts.map +1 -1
- package/dist/setup/connection-tests.js +4 -2
- package/dist/setup/connection-tests.js.map +1 -1
- package/dist/setup/generate-config.d.ts.map +1 -1
- package/dist/setup/generate-config.js +31 -1
- package/dist/setup/generate-config.js.map +1 -1
- package/dist/setup/init-wizard.d.ts +1 -0
- package/dist/setup/init-wizard.d.ts.map +1 -1
- package/dist/setup/init-wizard.js +38 -21
- package/dist/setup/init-wizard.js.map +1 -1
- package/dist/setup/validate-config.d.ts +5 -1
- package/dist/setup/validate-config.d.ts.map +1 -1
- package/dist/setup/validate-config.js +18 -0
- package/dist/setup/validate-config.js.map +1 -1
- package/dist/store/data-dir-lock.d.ts +15 -0
- package/dist/store/data-dir-lock.d.ts.map +1 -0
- package/dist/store/data-dir-lock.js +96 -0
- package/dist/store/data-dir-lock.js.map +1 -0
- package/dist/store/database.d.ts +2 -0
- package/dist/store/database.d.ts.map +1 -1
- package/dist/store/database.js +23 -10
- package/dist/store/database.js.map +1 -1
- package/dist/store/graph.d.ts +22 -0
- package/dist/store/graph.d.ts.map +1 -1
- package/dist/store/graph.js +97 -7
- package/dist/store/graph.js.map +1 -1
- package/dist/store/migrations/index.d.ts.map +1 -1
- package/dist/store/migrations/index.js +52 -0
- package/dist/store/migrations/index.js.map +1 -1
- package/dist/store/pages.d.ts +7 -0
- package/dist/store/pages.d.ts.map +1 -1
- package/dist/store/pages.js +56 -1
- package/dist/store/pages.js.map +1 -1
- package/dist/store/person-behavior.d.ts +28 -0
- package/dist/store/person-behavior.d.ts.map +1 -0
- package/dist/store/person-behavior.js +127 -0
- package/dist/store/person-behavior.js.map +1 -0
- package/dist/store/pglite-assets.d.ts +15 -0
- package/dist/store/pglite-assets.d.ts.map +1 -0
- package/dist/store/pglite-assets.js +47 -0
- package/dist/store/pglite-assets.js.map +1 -0
- package/dist/store/query-rewrite.d.ts +28 -0
- package/dist/store/query-rewrite.d.ts.map +1 -0
- package/dist/store/query-rewrite.js +97 -0
- package/dist/store/query-rewrite.js.map +1 -0
- package/dist/store/schema.sql +107 -0
- package/dist/store/search.d.ts +36 -8
- package/dist/store/search.d.ts.map +1 -1
- package/dist/store/search.js +188 -76
- package/dist/store/search.js.map +1 -1
- package/dist/store/tags.d.ts.map +1 -1
- package/dist/store/tags.js +6 -2
- package/dist/store/tags.js.map +1 -1
- package/dist/store/timeline.d.ts +13 -1
- package/dist/store/timeline.d.ts.map +1 -1
- package/dist/store/timeline.js +134 -4
- package/dist/store/timeline.js.map +1 -1
- package/dist/store/trgm-search.d.ts +13 -0
- package/dist/store/trgm-search.d.ts.map +1 -0
- package/dist/store/trgm-search.js +53 -0
- package/dist/store/trgm-search.js.map +1 -0
- package/dist/store/wikilink.d.ts +17 -0
- package/dist/store/wikilink.d.ts.map +1 -0
- package/dist/store/wikilink.js +58 -0
- package/dist/store/wikilink.js.map +1 -0
- package/dist/sync/obsidian.d.ts.map +1 -1
- package/dist/sync/obsidian.js +5 -1
- package/dist/sync/obsidian.js.map +1 -1
- package/dist/synth/cache.d.ts +17 -0
- package/dist/synth/cache.d.ts.map +1 -0
- package/dist/synth/cache.js +67 -0
- package/dist/synth/cache.js.map +1 -0
- package/dist/synth/citations.d.ts +12 -0
- package/dist/synth/citations.d.ts.map +1 -0
- package/dist/synth/citations.js +28 -0
- package/dist/synth/citations.js.map +1 -0
- package/dist/synth/context.d.ts +10 -0
- package/dist/synth/context.d.ts.map +1 -0
- package/dist/synth/context.js +67 -0
- package/dist/synth/context.js.map +1 -0
- package/dist/synth/engine.d.ts +16 -0
- package/dist/synth/engine.d.ts.map +1 -0
- package/dist/synth/engine.js +111 -0
- package/dist/synth/engine.js.map +1 -0
- package/dist/synth/gaps.d.ts +17 -0
- package/dist/synth/gaps.d.ts.map +1 -0
- package/dist/synth/gaps.js +57 -0
- package/dist/synth/gaps.js.map +1 -0
- package/dist/synth/index.d.ts +6 -0
- package/dist/synth/index.d.ts.map +1 -0
- package/dist/synth/index.js +6 -0
- package/dist/synth/index.js.map +1 -0
- package/dist/synth/intent.d.ts +6 -0
- package/dist/synth/intent.d.ts.map +1 -0
- package/dist/synth/intent.js +13 -0
- package/dist/synth/intent.js.map +1 -0
- package/dist/synth/intents/daily-report.d.ts +7 -0
- package/dist/synth/intents/daily-report.d.ts.map +1 -0
- package/dist/synth/intents/daily-report.js +37 -0
- package/dist/synth/intents/daily-report.js.map +1 -0
- package/dist/synth/intents/index.d.ts +2 -0
- package/dist/synth/intents/index.d.ts.map +1 -0
- package/dist/synth/intents/index.js +12 -0
- package/dist/synth/intents/index.js.map +1 -0
- package/dist/synth/intents/person-strategy.d.ts +40 -0
- package/dist/synth/intents/person-strategy.d.ts.map +1 -0
- package/dist/synth/intents/person-strategy.js +66 -0
- package/dist/synth/intents/person-strategy.js.map +1 -0
- package/dist/synth/intents/recall.d.ts +8 -0
- package/dist/synth/intents/recall.d.ts.map +1 -0
- package/dist/synth/intents/recall.js +26 -0
- package/dist/synth/intents/recall.js.map +1 -0
- package/dist/synth/intents/troubleshoot.d.ts +11 -0
- package/dist/synth/intents/troubleshoot.d.ts.map +1 -0
- package/dist/synth/intents/troubleshoot.js +66 -0
- package/dist/synth/intents/troubleshoot.js.map +1 -0
- package/dist/synth/scope.d.ts +13 -0
- package/dist/synth/scope.d.ts.map +1 -0
- package/dist/synth/scope.js +139 -0
- package/dist/synth/scope.js.map +1 -0
- package/dist/synth/types.d.ts +117 -0
- package/dist/synth/types.d.ts.map +1 -0
- package/dist/synth/types.js +2 -0
- package/dist/synth/types.js.map +1 -0
- package/package.json +18 -6
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline-side behavior accumulation (Spec 8 §4.1 / §9).
|
|
3
|
+
*
|
|
4
|
+
* Gated by config.profile: when disabled, nothing is written. Per-person
|
|
5
|
+
* allow/deny lists (canonical slugs) further gate which people are profiled.
|
|
6
|
+
* Group vs DM is inferred from the block channel ("group/..." → group).
|
|
7
|
+
*/
|
|
8
|
+
import { computeContribution } from "./behavior.js";
|
|
9
|
+
/** Whether a person (by canonical slug) is allowed to be profiled. */
|
|
10
|
+
export function isPersonProfilable(slug, config) {
|
|
11
|
+
if (config.deny.includes(slug))
|
|
12
|
+
return false;
|
|
13
|
+
if (config.allow.length > 0 && !config.allow.includes(slug))
|
|
14
|
+
return false;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function isGroupBlock(block) {
|
|
18
|
+
return block.channel.startsWith("group/");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Accumulate behavior counters for a single conversation block.
|
|
22
|
+
* No-op when profiling is disabled (the pipeline writes 0 rows in that case).
|
|
23
|
+
*/
|
|
24
|
+
export async function accumulateBehavior(block, deps) {
|
|
25
|
+
if (!deps.config.enabled)
|
|
26
|
+
return;
|
|
27
|
+
// Pre-resolve each unique sender once (resolveSender may be async), then feed a
|
|
28
|
+
// synchronous lookup to computeContribution.
|
|
29
|
+
const resolved = new Map();
|
|
30
|
+
for (const m of block.messages) {
|
|
31
|
+
if (!resolved.has(m.contact)) {
|
|
32
|
+
resolved.set(m.contact, await deps.resolveSender(m.contact));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const contributions = computeContribution(block, {
|
|
36
|
+
resolveSender: (contact) => resolved.get(contact) ?? `people/${contact}`,
|
|
37
|
+
isGroup: isGroupBlock(block),
|
|
38
|
+
tzOffsetHours: deps.config.tz_offset_hours,
|
|
39
|
+
});
|
|
40
|
+
for (const [slug, contribution] of contributions) {
|
|
41
|
+
if (!isPersonProfilable(slug, deps.config))
|
|
42
|
+
continue;
|
|
43
|
+
if (contribution.msg_count === 0)
|
|
44
|
+
continue;
|
|
45
|
+
await deps.store.upsertContribution(contribution);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=accumulate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accumulate.js","sourceRoot":"","sources":["../../src/profile/accumulate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAapD,sEAAsE;AACtE,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAAqB;IACpE,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,KAAwB;IAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAwB,EACxB,IAAoB;IAEpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO;IAEjC,gFAAgF;IAChF,6CAA6C;IAC7C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,EAAE;QAC/C,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,UAAU,OAAO,EAAE;QACxE,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC5B,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;KAC3C,CAAC,CAAC;IAEH,KAAK,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,aAAa,EAAE,CAAC;QACjD,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YAAE,SAAS;QACrD,IAAI,YAAY,CAAC,SAAS,KAAK,CAAC;YAAE,SAAS;QAC3C,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavior layer (Spec 8 §4.1) — pure functions, zero LLM.
|
|
3
|
+
*
|
|
4
|
+
* `computeContribution(block, opts)` turns a single conversation block into
|
|
5
|
+
* per-person incremental counters (keyed by the OTHER person's canonical slug).
|
|
6
|
+
* `deriveProfile(row)` turns stored counters into a usable view.
|
|
7
|
+
*
|
|
8
|
+
* Direction handling does NOT depend on Spec 9's isMe()/entities/me:
|
|
9
|
+
* - DM: read the `direction` field already set at collection time (sources/dm.ts).
|
|
10
|
+
* The other person's messages are those with direction === "received";
|
|
11
|
+
* response latency is measured for received → sent adjacent pairs.
|
|
12
|
+
* - Group: no direction. "initiated" = the sender of the block's FIRST message;
|
|
13
|
+
* everyone else's messages count as replies.
|
|
14
|
+
*/
|
|
15
|
+
import type { ConversationBlock } from "../core/types.js";
|
|
16
|
+
import type { BehaviorContribution, BehaviorProfile, PersonBehaviorRow } from "./types.js";
|
|
17
|
+
export interface ComputeOpts {
|
|
18
|
+
/** Map a message's `contact` (sender id) to its canonical person slug. */
|
|
19
|
+
resolveSender: (contact: string) => string;
|
|
20
|
+
/** Treat the block as a group conversation (use first-sender = initiator). */
|
|
21
|
+
isGroup?: boolean;
|
|
22
|
+
/** Hours to add to the message's UTC hour for the active-hours histogram (default 0). */
|
|
23
|
+
tzOffsetHours?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compute per-person behavior contributions from one conversation block.
|
|
27
|
+
* Returns a Map keyed by canonical person slug (only the OTHER party, never self).
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeContribution(block: ConversationBlock, opts: ComputeOpts): Map<string, BehaviorContribution>;
|
|
30
|
+
/** Derive a usable BehaviorProfile view from stored counters. */
|
|
31
|
+
export declare function deriveProfile(row: PersonBehaviorRow): BehaviorProfile;
|
|
32
|
+
//# sourceMappingURL=behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behavior.d.ts","sourceRoot":"","sources":["../../src/profile/behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3F,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA8BD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,WAAW,GAChB,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAqDnC;AASD,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,GAAG,EAAE,iBAAiB,GAAG,eAAe,CAWrE"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavior layer (Spec 8 §4.1) — pure functions, zero LLM.
|
|
3
|
+
*
|
|
4
|
+
* `computeContribution(block, opts)` turns a single conversation block into
|
|
5
|
+
* per-person incremental counters (keyed by the OTHER person's canonical slug).
|
|
6
|
+
* `deriveProfile(row)` turns stored counters into a usable view.
|
|
7
|
+
*
|
|
8
|
+
* Direction handling does NOT depend on Spec 9's isMe()/entities/me:
|
|
9
|
+
* - DM: read the `direction` field already set at collection time (sources/dm.ts).
|
|
10
|
+
* The other person's messages are those with direction === "received";
|
|
11
|
+
* response latency is measured for received → sent adjacent pairs.
|
|
12
|
+
* - Group: no direction. "initiated" = the sender of the block's FIRST message;
|
|
13
|
+
* everyone else's messages count as replies.
|
|
14
|
+
*/
|
|
15
|
+
const AT_RE = /@/g;
|
|
16
|
+
function emptyContribution(slug) {
|
|
17
|
+
return {
|
|
18
|
+
person_slug: slug,
|
|
19
|
+
msg_count: 0,
|
|
20
|
+
sum_msg_chars: 0,
|
|
21
|
+
initiated_count: 0,
|
|
22
|
+
reply_count: 0,
|
|
23
|
+
resp_latency_n: 0,
|
|
24
|
+
resp_latency_sum_s: 0,
|
|
25
|
+
hour_histogram: new Array(24).fill(0),
|
|
26
|
+
at_count: 0,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function hourOf(ts, tzOffsetHours = 0) {
|
|
30
|
+
const d = new Date(ts);
|
|
31
|
+
const h = d.getUTCHours();
|
|
32
|
+
if (Number.isNaN(h))
|
|
33
|
+
return 0;
|
|
34
|
+
return (h + tzOffsetHours + 24) % 24;
|
|
35
|
+
}
|
|
36
|
+
function countAts(content) {
|
|
37
|
+
const m = content.match(AT_RE);
|
|
38
|
+
return m ? m.length : 0;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Compute per-person behavior contributions from one conversation block.
|
|
42
|
+
* Returns a Map keyed by canonical person slug (only the OTHER party, never self).
|
|
43
|
+
*/
|
|
44
|
+
export function computeContribution(block, opts) {
|
|
45
|
+
const out = new Map();
|
|
46
|
+
const tzOffsetHours = opts.tzOffsetHours ?? 0;
|
|
47
|
+
const sorted = [...block.messages].sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
48
|
+
const get = (slug) => {
|
|
49
|
+
let c = out.get(slug);
|
|
50
|
+
if (!c) {
|
|
51
|
+
c = emptyContribution(slug);
|
|
52
|
+
out.set(slug, c);
|
|
53
|
+
}
|
|
54
|
+
return c;
|
|
55
|
+
};
|
|
56
|
+
if (opts.isGroup) {
|
|
57
|
+
const firstSender = sorted[0]?.contact;
|
|
58
|
+
let firstAttributed = false;
|
|
59
|
+
for (const m of sorted) {
|
|
60
|
+
const slug = opts.resolveSender(m.contact);
|
|
61
|
+
const c = get(slug);
|
|
62
|
+
accumulateBasics(c, m, tzOffsetHours);
|
|
63
|
+
if (!firstAttributed && m.contact === firstSender) {
|
|
64
|
+
c.initiated_count += 1;
|
|
65
|
+
firstAttributed = true;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
c.reply_count += 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
// DM: only the other party (direction === "received") gets a contribution.
|
|
74
|
+
// Response latency = their message → our next sent message.
|
|
75
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
76
|
+
const m = sorted[i];
|
|
77
|
+
if (m.direction === "sent")
|
|
78
|
+
continue; // our own messages don't profile us
|
|
79
|
+
const slug = opts.resolveSender(m.contact);
|
|
80
|
+
const c = get(slug);
|
|
81
|
+
accumulateBasics(c, m, tzOffsetHours);
|
|
82
|
+
// find the next sent message after this received one (adjacent reply by us)
|
|
83
|
+
const next = sorted[i + 1];
|
|
84
|
+
if (next && next.direction === "sent") {
|
|
85
|
+
const latency = (new Date(next.timestamp).getTime() - new Date(m.timestamp).getTime()) / 1000;
|
|
86
|
+
if (latency >= 0) {
|
|
87
|
+
c.resp_latency_n += 1;
|
|
88
|
+
c.resp_latency_sum_s += Math.round(latency);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
function accumulateBasics(c, m, tzOffsetHours = 0) {
|
|
95
|
+
c.msg_count += 1;
|
|
96
|
+
c.sum_msg_chars += m.content.length;
|
|
97
|
+
c.hour_histogram[hourOf(m.timestamp, tzOffsetHours)] += 1;
|
|
98
|
+
c.at_count += countAts(m.content);
|
|
99
|
+
}
|
|
100
|
+
/** Derive a usable BehaviorProfile view from stored counters. */
|
|
101
|
+
export function deriveProfile(row) {
|
|
102
|
+
const denom = row.initiated_count + row.reply_count;
|
|
103
|
+
return {
|
|
104
|
+
person_slug: row.person_slug,
|
|
105
|
+
avg_msg_chars: row.msg_count > 0 ? row.sum_msg_chars / row.msg_count : 0,
|
|
106
|
+
initiation_ratio: denom > 0 ? row.initiated_count / denom : 0,
|
|
107
|
+
avg_response_sec: row.resp_latency_n > 0 ? row.resp_latency_sum_s / row.resp_latency_n : null,
|
|
108
|
+
peak_hours: topHours(row.hour_histogram, 3),
|
|
109
|
+
at_per_msg: row.msg_count > 0 ? row.at_count / row.msg_count : 0,
|
|
110
|
+
sample_size: row.msg_count,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Return the indices of the top-k hours by count (descending), excluding zero-count hours. */
|
|
114
|
+
function topHours(hist, k) {
|
|
115
|
+
return hist
|
|
116
|
+
.map((count, hour) => ({ count, hour }))
|
|
117
|
+
.filter((e) => e.count > 0)
|
|
118
|
+
.sort((a, b) => b.count - a.count || a.hour - b.hour)
|
|
119
|
+
.slice(0, k)
|
|
120
|
+
.map((e) => e.hour);
|
|
121
|
+
}
|
|
122
|
+
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C;SAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;SACpD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavior-quadrant (D/I/S/C) → four-color shell (Spec 8 §5).
|
|
3
|
+
*
|
|
4
|
+
* Pure, deterministic mapping. The dominant axes (level === "high") select the
|
|
5
|
+
* colour(s); dual colours are allowed. Every output carries the mandatory
|
|
6
|
+
* "通俗映射,非临床诊断" disclaimer — we present a popular framing, NOT a clinical
|
|
7
|
+
* diagnosis, and we do not use the "DiSC" trademark.
|
|
8
|
+
*/
|
|
9
|
+
import type { FourColor, TraitLayer } from "./types.js";
|
|
10
|
+
export declare const FOUR_COLOR_DISCLAIMER = "\u901A\u4FD7\u6620\u5C04\uFF0C\u975E\u4E34\u5E8A\u8BCA\u65AD";
|
|
11
|
+
export declare function toFourColor(trait: TraitLayer): FourColor;
|
|
12
|
+
//# sourceMappingURL=four-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"four-color.d.ts","sourceRoot":"","sources":["../../src/profile/four-color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAQ,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,qBAAqB,iEAAe,CAAC;AAmBlD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAmBxD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Behavior-quadrant (D/I/S/C) → four-color shell (Spec 8 §5).
|
|
3
|
+
*
|
|
4
|
+
* Pure, deterministic mapping. The dominant axes (level === "high") select the
|
|
5
|
+
* colour(s); dual colours are allowed. Every output carries the mandatory
|
|
6
|
+
* "通俗映射,非临床诊断" disclaimer — we present a popular framing, NOT a clinical
|
|
7
|
+
* diagnosis, and we do not use the "DiSC" trademark.
|
|
8
|
+
*/
|
|
9
|
+
export const FOUR_COLOR_DISCLAIMER = "通俗映射,非临床诊断";
|
|
10
|
+
const AXIS_COLOR = {
|
|
11
|
+
D: "🔴 红",
|
|
12
|
+
I: "🟡 黄",
|
|
13
|
+
S: "🟢 绿",
|
|
14
|
+
C: "🔵 蓝",
|
|
15
|
+
};
|
|
16
|
+
const AXIS_DESC = {
|
|
17
|
+
D: "直接、目标导向、要结论",
|
|
18
|
+
I: "活跃、重关系、爱表达",
|
|
19
|
+
S: "温和、求稳、重配合",
|
|
20
|
+
C: "严谨、重数据、求准确",
|
|
21
|
+
};
|
|
22
|
+
// Stable display order so dual colours are deterministic regardless of input order.
|
|
23
|
+
const AXIS_ORDER = ["D", "I", "S", "C"];
|
|
24
|
+
export function toFourColor(trait) {
|
|
25
|
+
if (trait.insufficient) {
|
|
26
|
+
return { colors: [], descriptions: [], disclaimer: FOUR_COLOR_DISCLAIMER };
|
|
27
|
+
}
|
|
28
|
+
const highAxes = new Set(trait.dimensions.filter((d) => d.level === "high").map((d) => d.axis));
|
|
29
|
+
const colors = [];
|
|
30
|
+
const descriptions = [];
|
|
31
|
+
for (const axis of AXIS_ORDER) {
|
|
32
|
+
if (highAxes.has(axis)) {
|
|
33
|
+
colors.push(AXIS_COLOR[axis]);
|
|
34
|
+
descriptions.push(AXIS_DESC[axis]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { colors, descriptions, disclaimer: FOUR_COLOR_DISCLAIMER };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=four-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"four-color.js","source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C;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nightly profile synthesis (Spec 8 §7) — the trait + relation layers.
|
|
3
|
+
*
|
|
4
|
+
* This is a SEPARATE structured LLM path, NOT the Spec 7 synthesize() engine.
|
|
5
|
+
* synthesize() produces narrative answers for humans; this produces a structured
|
|
6
|
+
* TraitLayer/RelationLayer object stored into the person page's frontmatter.profile
|
|
7
|
+
* so person_strategy can later inject it via buildPinnedContext.
|
|
8
|
+
*
|
|
9
|
+
* Modeled on consolidator/infer-preferences.ts: iterate type=person pages, read
|
|
10
|
+
* the behavior layer + backlinks + timeline, ask the LLM (responseFormat:"json")
|
|
11
|
+
* for the trait + relation layers, combine the deterministic four-color shell,
|
|
12
|
+
* and write frontmatter.profile. Insufficient samples skip the LLM entirely.
|
|
13
|
+
*/
|
|
14
|
+
import type { ProfileConfig } from "../core/config.js";
|
|
15
|
+
import type { LLMProvider } from "../extractors/providers/types.js";
|
|
16
|
+
import type { GraphStore } from "../store/graph.js";
|
|
17
|
+
import type { PageStore } from "../store/pages.js";
|
|
18
|
+
import type { PersonBehaviorStore } from "../store/person-behavior.js";
|
|
19
|
+
import type { TimelineStore } from "../store/timeline.js";
|
|
20
|
+
export interface ProfileSynthStores {
|
|
21
|
+
pages: PageStore;
|
|
22
|
+
graph: GraphStore;
|
|
23
|
+
timeline: TimelineStore;
|
|
24
|
+
behavior: PersonBehaviorStore;
|
|
25
|
+
}
|
|
26
|
+
export declare function synthesizeProfiles(stores: ProfileSynthStores, llm: LLMProvider, config: ProfileConfig): Promise<number>;
|
|
27
|
+
//# sourceMappingURL=profile-synth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-synth.d.ts","sourceRoot":"","sources":["../../src/profile/profile-synth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAiDD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CAqIjB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nightly profile synthesis (Spec 8 §7) — the trait + relation layers.
|
|
3
|
+
*
|
|
4
|
+
* This is a SEPARATE structured LLM path, NOT the Spec 7 synthesize() engine.
|
|
5
|
+
* synthesize() produces narrative answers for humans; this produces a structured
|
|
6
|
+
* TraitLayer/RelationLayer object stored into the person page's frontmatter.profile
|
|
7
|
+
* so person_strategy can later inject it via buildPinnedContext.
|
|
8
|
+
*
|
|
9
|
+
* Modeled on consolidator/infer-preferences.ts: iterate type=person pages, read
|
|
10
|
+
* the behavior layer + backlinks + timeline, ask the LLM (responseFormat:"json")
|
|
11
|
+
* for the trait + relation layers, combine the deterministic four-color shell,
|
|
12
|
+
* and write frontmatter.profile. Insufficient samples skip the LLM entirely.
|
|
13
|
+
*/
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { isPersonProfilable } from "./accumulate.js";
|
|
16
|
+
import { deriveProfile } from "./behavior.js";
|
|
17
|
+
import { toFourColor } from "./four-color.js";
|
|
18
|
+
const SYSTEM_PROMPT = [
|
|
19
|
+
"你从用户与某人的客观互动行为统计、共享历史信号(带 slug)里,推断该人的「行为四象限」(D/I/S/C:支配/影响/稳健/谨慎) 特质层与关系层。",
|
|
20
|
+
"方法论硬约束:行为统计是垫底证据,每个维度必须给出 evidence_refs(引用提供的信号 slug)与 confidence;不得脱离证据编造性格判断;证据不足就不给该维度。",
|
|
21
|
+
"对外是「行为四象限」通俗映射,不是临床诊断,不使用 DiSC 商标。",
|
|
22
|
+
'只输出 JSON:{"trait":{"dimensions":[{"axis":"D|I|S|C","level":"low|medium|high","confidence":"low|medium|high","evidence_count":n,"evidence_refs":["slug"],"note":"一句话"}],"insufficient":false},"relation":{"tone":"...","concerns":["..."],"landmines":["..."],"evidence_refs":["slug"]}}',
|
|
23
|
+
].join("\n");
|
|
24
|
+
function emptyRelation() {
|
|
25
|
+
return { tone: "", concerns: [], landmines: [], evidence_refs: [] };
|
|
26
|
+
}
|
|
27
|
+
function insufficientProfile() {
|
|
28
|
+
return {
|
|
29
|
+
trait: { dimensions: [], insufficient: true },
|
|
30
|
+
relation: emptyRelation(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function renderBehaviorSummary(bp) {
|
|
34
|
+
return [
|
|
35
|
+
`平均消息长度: ${bp.avg_msg_chars.toFixed(1)} 字`,
|
|
36
|
+
`主动发起比例: ${(bp.initiation_ratio * 100).toFixed(0)}%`,
|
|
37
|
+
`平均回复时延: ${bp.avg_response_sec === null ? "无样本" : `${bp.avg_response_sec.toFixed(0)} 秒`}`,
|
|
38
|
+
`活跃时段(小时): ${bp.peak_hours.join(", ") || "无"}`,
|
|
39
|
+
`@频率: ${bp.at_per_msg.toFixed(2)}/条`,
|
|
40
|
+
`样本量: ${bp.sample_size} 条`,
|
|
41
|
+
].join("\n");
|
|
42
|
+
}
|
|
43
|
+
function computeInputHash(personSlug, sampleSize, evidenceSlugs) {
|
|
44
|
+
const key = `${personSlug}|${sampleSize}|${[...evidenceSlugs].sort().join(",")}`;
|
|
45
|
+
return createHash("sha256").update(key).digest("hex");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Write the structured profile into the page's frontmatter.profile WITHOUT
|
|
49
|
+
* bumping updated_at or re-chunking (nightly synthesis must not pollute recency).
|
|
50
|
+
*/
|
|
51
|
+
async function writeProfile(pages, slug, profile) {
|
|
52
|
+
await pages.patchFrontmatter(slug, { profile });
|
|
53
|
+
}
|
|
54
|
+
export async function synthesizeProfiles(stores, llm, config) {
|
|
55
|
+
if (!config.enabled)
|
|
56
|
+
return 0;
|
|
57
|
+
const personPages = await stores.pages.listPages({ type: "person" });
|
|
58
|
+
let written = 0;
|
|
59
|
+
for (const person of personPages) {
|
|
60
|
+
if (!isPersonProfilable(person.slug, config))
|
|
61
|
+
continue;
|
|
62
|
+
const row = await stores.behavior.get(person.slug);
|
|
63
|
+
if (!row)
|
|
64
|
+
continue; // no behavior data → nothing to profile
|
|
65
|
+
const bp = deriveProfile(row);
|
|
66
|
+
const nowIso = new Date().toISOString();
|
|
67
|
+
// Insufficient sample → honest "信息不足", no LLM call, no forced profile.
|
|
68
|
+
if (bp.sample_size < config.min_sample_size) {
|
|
69
|
+
const { trait, relation } = insufficientProfile();
|
|
70
|
+
const profile = {
|
|
71
|
+
trait,
|
|
72
|
+
relation,
|
|
73
|
+
four_color: toFourColor(trait),
|
|
74
|
+
generated_at: nowIso,
|
|
75
|
+
input_hash: computeInputHash(person.slug, bp.sample_size, []),
|
|
76
|
+
sample_size: bp.sample_size,
|
|
77
|
+
};
|
|
78
|
+
await writeProfile(stores.pages, person.slug, profile);
|
|
79
|
+
written++;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
// Gather shared-history evidence (backlinked signals + timeline).
|
|
83
|
+
const backlinks = await stores.graph.getBacklinks(person.slug);
|
|
84
|
+
const evidenceSlugs = backlinks.map((b) => b.from_slug).filter(Boolean);
|
|
85
|
+
// Skip re-synthesis when the evidence is unchanged (avoids redundant LLM calls).
|
|
86
|
+
const newHash = computeInputHash(person.slug, bp.sample_size, evidenceSlugs);
|
|
87
|
+
const existing = person.frontmatter.profile;
|
|
88
|
+
if (existing?.input_hash === newHash)
|
|
89
|
+
continue; // no LLM, no write
|
|
90
|
+
const timeline = await stores.timeline.getTimeline(person.slug);
|
|
91
|
+
const timelineSummary = timeline
|
|
92
|
+
.slice(0, 50)
|
|
93
|
+
.map((e) => `[${e.date}] ${e.summary}`)
|
|
94
|
+
.join("\n");
|
|
95
|
+
const evidenceList = backlinks
|
|
96
|
+
.slice(0, 50)
|
|
97
|
+
.map((b) => `- ${b.from_slug} (${b.link_type}): ${b.context ?? ""}`)
|
|
98
|
+
.join("\n");
|
|
99
|
+
let raw;
|
|
100
|
+
try {
|
|
101
|
+
raw = await llm.chat([
|
|
102
|
+
{ role: "system", content: SYSTEM_PROMPT },
|
|
103
|
+
{
|
|
104
|
+
role: "user",
|
|
105
|
+
content: [
|
|
106
|
+
`人物: ${person.title} (${person.slug})`,
|
|
107
|
+
"",
|
|
108
|
+
"行为统计 (客观,垫底证据):",
|
|
109
|
+
renderBehaviorSummary(bp),
|
|
110
|
+
"",
|
|
111
|
+
"可引用信号 (evidence_refs 用这些 slug):",
|
|
112
|
+
evidenceList || "(无)",
|
|
113
|
+
"",
|
|
114
|
+
"时间线:",
|
|
115
|
+
timelineSummary || "(无)",
|
|
116
|
+
].join("\n"),
|
|
117
|
+
},
|
|
118
|
+
], { responseFormat: "json" });
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
continue; // LLM failure → leave existing profile untouched (graceful degrade)
|
|
122
|
+
}
|
|
123
|
+
let parsed;
|
|
124
|
+
try {
|
|
125
|
+
parsed = JSON.parse(raw.trim());
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
continue; // non-JSON → skip
|
|
129
|
+
}
|
|
130
|
+
// Validate LLM output against the schema and enforce evidence grounding:
|
|
131
|
+
// only dimensions with a valid axis/level survive, and every cited slug must
|
|
132
|
+
// exist in the gathered evidence set (drop hallucinated refs).
|
|
133
|
+
const evidenceSet = new Set(evidenceSlugs);
|
|
134
|
+
const rawDims = Array.isArray(parsed.trait?.dimensions) ? parsed.trait.dimensions : [];
|
|
135
|
+
const validDims = rawDims
|
|
136
|
+
.filter((d) => d &&
|
|
137
|
+
["D", "I", "S", "C"].includes(d.axis) &&
|
|
138
|
+
["low", "medium", "high"].includes(d.level))
|
|
139
|
+
.map((d) => {
|
|
140
|
+
const refs = Array.isArray(d.evidence_refs)
|
|
141
|
+
? d.evidence_refs.filter((s) => evidenceSet.has(s))
|
|
142
|
+
: [];
|
|
143
|
+
return { ...d, evidence_refs: refs, evidence_count: refs.length };
|
|
144
|
+
});
|
|
145
|
+
const trait = {
|
|
146
|
+
dimensions: validDims,
|
|
147
|
+
big_five: parsed.trait?.big_five,
|
|
148
|
+
insufficient: parsed.trait?.insufficient === true,
|
|
149
|
+
};
|
|
150
|
+
// If the LLM declares insufficient, enforce empty dimensions.
|
|
151
|
+
if (trait.insufficient)
|
|
152
|
+
trait.dimensions = [];
|
|
153
|
+
const relation = {
|
|
154
|
+
tone: parsed.relation?.tone ?? "",
|
|
155
|
+
concerns: Array.isArray(parsed.relation?.concerns) ? parsed.relation.concerns : [],
|
|
156
|
+
landmines: Array.isArray(parsed.relation?.landmines) ? parsed.relation.landmines : [],
|
|
157
|
+
evidence_refs: Array.isArray(parsed.relation?.evidence_refs)
|
|
158
|
+
? parsed.relation.evidence_refs.filter((s) => evidenceSet.has(s))
|
|
159
|
+
: [],
|
|
160
|
+
};
|
|
161
|
+
const profile = {
|
|
162
|
+
trait,
|
|
163
|
+
relation,
|
|
164
|
+
four_color: toFourColor(trait),
|
|
165
|
+
generated_at: nowIso,
|
|
166
|
+
input_hash: newHash,
|
|
167
|
+
sample_size: bp.sample_size,
|
|
168
|
+
};
|
|
169
|
+
await writeProfile(stores.pages, person.slug, profile);
|
|
170
|
+
written++;
|
|
171
|
+
}
|
|
172
|
+
return written;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=profile-synth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-synth.js","sourceRoot":"","sources":["../../src/profile/profile-synth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAU9C,MAAM,aAAa,GAAG;IACpB,6EAA6E;IAC7E,4FAA4F;IAC5F,oCAAoC;IACpC,yRAAyR;CAC1R,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,SAAS,aAAa;IACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QAC7C,QAAQ,EAAE,aAAa,EAAE;KAC1B,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,EAAmB;IAChD,OAAO;QACL,WAAW,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QAC1C,WAAW,CAAC,EAAE,CAAC,gBAAgB,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QACpD,WAAW,EAAE,CAAC,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAA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
4
|
+
* Three layers:
|
|
5
|
+
* - Behavior layer (objective, zero-LLM): incremental, mergeable counters
|
|
6
|
+
* persisted to `person_behavior`, keyed by the OTHER person's canonical slug.
|
|
7
|
+
* - Trait layer (inferred behaviour-quadrant D/I/S/C with evidence + confidence).
|
|
8
|
+
* - Relation layer (the bespoke you-and-them relationship summary).
|
|
9
|
+
*/
|
|
10
|
+
/** A single conversation block's incremental contribution, additively merged into the table. */
|
|
11
|
+
export interface BehaviorContribution {
|
|
12
|
+
person_slug: string;
|
|
13
|
+
msg_count: number;
|
|
14
|
+
sum_msg_chars: number;
|
|
15
|
+
initiated_count: number;
|
|
16
|
+
reply_count: number;
|
|
17
|
+
resp_latency_n: number;
|
|
18
|
+
resp_latency_sum_s: number;
|
|
19
|
+
hour_histogram: number[];
|
|
20
|
+
at_count: number;
|
|
21
|
+
}
|
|
22
|
+
/** A row read back from `person_behavior` (raw stored counters). */
|
|
23
|
+
export interface PersonBehaviorRow {
|
|
24
|
+
person_slug: string;
|
|
25
|
+
msg_count: number;
|
|
26
|
+
sum_msg_chars: number;
|
|
27
|
+
initiated_count: number;
|
|
28
|
+
reply_count: number;
|
|
29
|
+
resp_latency_n: number;
|
|
30
|
+
resp_latency_sum_s: number;
|
|
31
|
+
hour_histogram: number[];
|
|
32
|
+
at_count: number;
|
|
33
|
+
window_start: string | null;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
}
|
|
36
|
+
/** Derived, usable view computed on read from a PersonBehaviorRow. */
|
|
37
|
+
export interface BehaviorProfile {
|
|
38
|
+
person_slug: string;
|
|
39
|
+
avg_msg_chars: number;
|
|
40
|
+
initiation_ratio: number;
|
|
41
|
+
avg_response_sec: number | null;
|
|
42
|
+
peak_hours: number[];
|
|
43
|
+
at_per_msg: number;
|
|
44
|
+
sample_size: number;
|
|
45
|
+
}
|
|
46
|
+
export type Axis = "D" | "I" | "S" | "C";
|
|
47
|
+
export type Level = "low" | "medium" | "high";
|
|
48
|
+
export type Confidence = "low" | "medium" | "high";
|
|
49
|
+
export interface TraitDimension {
|
|
50
|
+
axis: Axis;
|
|
51
|
+
level: Level;
|
|
52
|
+
confidence: Confidence;
|
|
53
|
+
evidence_count: number;
|
|
54
|
+
evidence_refs: string[];
|
|
55
|
+
note: string;
|
|
56
|
+
}
|
|
57
|
+
export interface TraitLayer {
|
|
58
|
+
/** 4 dimensions (D/I/S/C) when sufficient; empty [] when insufficient. */
|
|
59
|
+
dimensions: TraitDimension[];
|
|
60
|
+
big_five?: Record<string, number>;
|
|
61
|
+
insufficient: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface RelationLayer {
|
|
64
|
+
tone: string;
|
|
65
|
+
concerns: string[];
|
|
66
|
+
landmines: string[];
|
|
67
|
+
evidence_refs: string[];
|
|
68
|
+
}
|
|
69
|
+
/** Four-color shell (通俗映射,非临床诊断). */
|
|
70
|
+
export interface FourColor {
|
|
71
|
+
colors: string[];
|
|
72
|
+
descriptions: string[];
|
|
73
|
+
disclaimer: string;
|
|
74
|
+
}
|
|
75
|
+
/** The structured profile cached into a person page's frontmatter.profile. */
|
|
76
|
+
export interface ProfileObject {
|
|
77
|
+
trait: TraitLayer;
|
|
78
|
+
relation: RelationLayer;
|
|
79
|
+
four_color: FourColor;
|
|
80
|
+
generated_at: string;
|
|
81
|
+
input_hash: string;
|
|
82
|
+
sample_size: number;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/profile/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gGAAgG;AAChG,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB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IACzB,0EAA0E;IAC1E,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,EAAE,SAAS,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Person communication profile — type definitions (Spec 8 §4).
|
|
3
|
+
*
|
|
4
|
+
* Three layers:
|
|
5
|
+
* - Behavior layer (objective, zero-LLM): incremental, mergeable counters
|
|
6
|
+
* persisted to `person_behavior`, keyed by the OTHER person's canonical slug.
|
|
7
|
+
* - Trait layer (inferred behaviour-quadrant D/I/S/C with evidence + confidence).
|
|
8
|
+
* - Relation layer (the bespoke you-and-them relationship summary).
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/profile/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/server/api.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { PageStore } from "../store/pages.js";
|
|
|
7
7
|
import type { SearchEngine } from "../store/search.js";
|
|
8
8
|
import type { TagStore } from "../store/tags.js";
|
|
9
9
|
import type { TimelineStore } from "../store/timeline.js";
|
|
10
|
+
import type { ChatNameRefreshJob } from "./chat-name-refresh-job.js";
|
|
10
11
|
import type { EventBus } from "./event-bus.js";
|
|
11
12
|
export interface DaemonStatus {
|
|
12
13
|
running: boolean;
|
|
@@ -23,13 +24,18 @@ export interface StoreContext {
|
|
|
23
24
|
tags: TagStore;
|
|
24
25
|
timeline: TimelineStore;
|
|
25
26
|
embedding: EmbeddingService;
|
|
26
|
-
getDaemonStatus?: () => DaemonStatus;
|
|
27
|
+
getDaemonStatus?: () => DaemonStatus | undefined;
|
|
27
28
|
eventBus?: EventBus;
|
|
28
29
|
runExtract?: (source?: string) => Promise<{
|
|
29
30
|
written: number;
|
|
30
31
|
skipped: number;
|
|
31
32
|
errors: number;
|
|
32
33
|
}>;
|
|
34
|
+
chatNameRefreshJob?: ChatNameRefreshJob;
|
|
33
35
|
}
|
|
34
|
-
export
|
|
36
|
+
export interface ApiAppOpts {
|
|
37
|
+
/** Fired after a successful config save (triggers async hot-reload). Not awaited. */
|
|
38
|
+
onConfigSaved?: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function createApiApp(stores: StoreContext, apiOpts?: ApiAppOpts): Hono;
|
|
35
41
|
//# sourceMappingURL=api.d.ts.map
|