bikky 0.4.1 → 0.4.3

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/CODE_OF_CONDUCT.md +1 -1
  3. package/CONTRIBUTING.md +1 -1
  4. package/README.md +23 -17
  5. package/SUPPORT.md +3 -2
  6. package/dist/config.d.ts +11 -1
  7. package/dist/config.js +88 -20
  8. package/dist/daemon/capture-policy.d.ts +0 -1
  9. package/dist/daemon/capture-policy.js +0 -1
  10. package/dist/daemon/consolidation.d.ts +2 -1
  11. package/dist/daemon/consolidation.js +28 -11
  12. package/dist/daemon/entity-typing.js +10 -0
  13. package/dist/daemon/episode-summary.d.ts +4 -0
  14. package/dist/daemon/episode-summary.js +39 -8
  15. package/dist/daemon/extraction.d.ts +1 -1
  16. package/dist/daemon/extraction.js +52 -17
  17. package/dist/daemon/qdrant.d.ts +32 -10
  18. package/dist/daemon/qdrant.js +177 -60
  19. package/dist/daemon/relations.d.ts +3 -3
  20. package/dist/daemon/relations.js +27 -15
  21. package/dist/daemon/session-index.d.ts +5 -0
  22. package/dist/daemon/session-index.js +36 -9
  23. package/dist/daemon/session-summary.d.ts +3 -0
  24. package/dist/daemon/session-summary.js +48 -15
  25. package/dist/daemon/staleness.js +2 -2
  26. package/dist/daemon/transcript-sources.js +3 -2
  27. package/dist/daemon/watcher.js +2 -0
  28. package/dist/daemon/workstream-summary.d.ts +4 -0
  29. package/dist/daemon/workstream-summary.js +58 -16
  30. package/dist/install.d.ts +11 -0
  31. package/dist/install.js +38 -0
  32. package/dist/llm/embedding/index.js +2 -1
  33. package/dist/llm/embedding/providers/openai.js +8 -2
  34. package/dist/llm/embedding/providers/portkey.js +9 -2
  35. package/dist/llm/inference/index.js +2 -1
  36. package/dist/llm/util.d.ts +12 -0
  37. package/dist/llm/util.js +18 -0
  38. package/dist/mcp/helpers.d.ts +5 -0
  39. package/dist/mcp/helpers.js +27 -3
  40. package/dist/mcp/taxonomy.js +12 -1
  41. package/dist/mcp/tools.js +161 -57
  42. package/dist/mcp/types.d.ts +12 -0
  43. package/dist/package-verifier.d.ts +19 -0
  44. package/dist/package-verifier.js +83 -0
  45. package/dist/provenance/origin.d.ts +57 -0
  46. package/dist/provenance/origin.js +254 -0
  47. package/docs/config/fully-hosted.md +33 -13
  48. package/docs/config/hosted-models.md +33 -13
  49. package/docs/configuration.md +23 -5
  50. package/package.json +6 -2
@@ -4,6 +4,7 @@
4
4
  * Every function here is pure (or depends only on its inputs + Date.now()).
5
5
  */
6
6
  import type { FactPayload, FilterParams, QdrantFilter, QdrantPoint } from "./types.js";
7
+ import { type OperationOrigin } from "../provenance/origin.js";
7
8
  export interface StructuredFact {
8
9
  id: string;
9
10
  content: string;
@@ -11,7 +12,11 @@ export interface StructuredFact {
11
12
  domain?: string;
12
13
  kind?: string;
13
14
  memory_subtype?: string | null;
15
+ origin?: OperationOrigin;
16
+ last_operation_origin?: OperationOrigin;
17
+ /** @deprecated Origin is canonical for new writes. */
14
18
  actor_id?: string;
19
+ /** @deprecated Origin is canonical for new writes. */
15
20
  source?: string;
16
21
  entities: string[];
17
22
  confidence?: number;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import crypto from "node:crypto";
7
7
  import { DEFAULT_DOMAIN, getDecayHalfLife, STALENESS_DAYS } from "./taxonomy.js";
8
+ import { isOperationOrigin } from "../provenance/origin.js";
8
9
  // ---------------------------------------------------------------------------
9
10
  // Hashing
10
11
  // ---------------------------------------------------------------------------
@@ -97,7 +98,7 @@ export function isStale(payload) {
97
98
  export const MEMORY_RECALL_EXCLUDED_KINDS = ["telemetry"];
98
99
  /** Build a Qdrant filter object from optional params. */
99
100
  export function buildFilter(params = {}) {
100
- const { category, domain, kind, memory_subtype, actor_id, entity, session_id, episode_id, workstream_key, task_key, repo, branch, review_status, since, until, excludeSuperseded = true, excludeKinds = [], metadata, } = params;
101
+ const { category, domain, kind, memory_subtype, origin_user_id, origin_agent_id, origin_interface, actor_id, entity, session_id, episode_id, workstream_key, task_key, repo, branch, review_status, since, until, excludeSuperseded = true, excludeKinds = [], metadata, } = params;
101
102
  const must = [];
102
103
  const must_not = [];
103
104
  if (excludeSuperseded) {
@@ -115,8 +116,23 @@ export function buildFilter(params = {}) {
115
116
  if (memory_subtype) {
116
117
  must.push({ key: "memory_subtype", match: { value: memory_subtype } });
117
118
  }
119
+ if (origin_user_id) {
120
+ must.push({ key: "origin.user.id", match: { value: origin_user_id } });
121
+ }
122
+ if (origin_agent_id) {
123
+ must.push({ key: "origin.agent.id", match: { value: origin_agent_id } });
124
+ }
125
+ if (origin_interface) {
126
+ must.push({ key: "origin.interface", match: { value: origin_interface } });
127
+ }
118
128
  if (actor_id) {
119
- must.push({ key: "actor_id", match: { value: actor_id } });
129
+ must.push({
130
+ should: [
131
+ { key: "origin.user.id", match: { value: actor_id } },
132
+ { key: "origin.agent.id", match: { value: actor_id } },
133
+ { key: "actor_id", match: { value: actor_id } },
134
+ ],
135
+ });
120
136
  }
121
137
  if (entity) {
122
138
  must.push({ key: "entities", match: { value: entity.toLowerCase() } });
@@ -173,8 +189,14 @@ export function formatFact(point) {
173
189
  parts.push(`kind: ${p.kind}`);
174
190
  if (p.memory_subtype)
175
191
  parts.push(`subtype: ${p.memory_subtype}`);
176
- if (p.actor_id)
192
+ if (isOperationOrigin(p.origin)) {
193
+ const user = p.origin.user?.name ?? p.origin.user?.id;
194
+ const agent = p.origin.agent.name ?? p.origin.agent.id ?? p.origin.agent.type;
195
+ parts.push(`origin: ${user ? `${user} via ` : ""}${agent} (${p.origin.interface}/${p.origin.operation.action})`);
196
+ }
197
+ else if (p.actor_id) {
177
198
  parts.push(`actor: ${p.actor_id}`);
199
+ }
178
200
  if (p.workstream_key)
179
201
  parts.push(`workstream: ${p.workstream_key}`);
180
202
  if (p.episode_id)
@@ -234,6 +256,8 @@ export function structuredFact(point) {
234
256
  ...(p.domain ? { domain: p.domain } : {}),
235
257
  ...(p.kind ? { kind: p.kind } : {}),
236
258
  ...(p.memory_subtype ? { memory_subtype: p.memory_subtype } : {}),
259
+ ...(isOperationOrigin(p.origin) ? { origin: p.origin } : {}),
260
+ ...(isOperationOrigin(p.last_operation_origin) ? { last_operation_origin: p.last_operation_origin } : {}),
237
261
  ...(p.actor_id ? { actor_id: p.actor_id } : {}),
238
262
  ...(p.source ? { source: p.source } : {}),
239
263
  entities: p.entities ?? [],
@@ -291,11 +291,22 @@ export const QDRANT_INDEXES = [
291
291
  { field_name: "domain", field_schema: "keyword" },
292
292
  { field_name: "kind", field_schema: "keyword" },
293
293
  { field_name: "memory_subtype", field_schema: "keyword" },
294
- { field_name: "source", field_schema: "keyword" },
295
294
  { field_name: "content_hash", field_schema: "keyword" },
296
295
  { field_name: "entities", field_schema: "keyword" },
297
296
  { field_name: "workspace_id", field_schema: "keyword" },
297
+ // Deprecated legacy provenance fields remain indexed for fresh collections
298
+ // that still need to browse/filter records written before origin metadata.
299
+ { field_name: "source", field_schema: "keyword" },
298
300
  { field_name: "actor_id", field_schema: "keyword" },
301
+ { field_name: "origin.user.id", field_schema: "keyword" },
302
+ { field_name: "origin.user.source", field_schema: "keyword" },
303
+ { field_name: "origin.agent.id", field_schema: "keyword" },
304
+ { field_name: "origin.agent.type", field_schema: "keyword" },
305
+ { field_name: "origin.agent.source", field_schema: "keyword" },
306
+ { field_name: "origin.interface", field_schema: "keyword" },
307
+ { field_name: "origin.operation.action", field_schema: "keyword" },
308
+ { field_name: "last_operation_origin.agent.id", field_schema: "keyword" },
309
+ { field_name: "last_operation_origin.operation.action", field_schema: "keyword" },
299
310
  { field_name: "entity_name", field_schema: "keyword" },
300
311
  { field_name: "from_entity", field_schema: "keyword" },
301
312
  { field_name: "to_entity", field_schema: "keyword" },