@gyoungwe/research-suite 0.1.5 → 0.1.6

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 (145) hide show
  1. package/build-manifest.json +2 -2
  2. package/node_modules/@gyoungwe/pi-core/build-manifest.json +2 -2
  3. package/node_modules/@gyoungwe/pi-core/dist/index.mjs +198 -7
  4. package/node_modules/@gyoungwe/pi-core/package.json +1 -1
  5. package/node_modules/@gyoungwe/pi-knowledge/build-manifest.json +68 -3
  6. package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts +7 -0
  7. package/node_modules/@gyoungwe/pi-knowledge/dist/core/capability-discovery.d.ts.map +1 -0
  8. package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts +30 -0
  9. package/node_modules/@gyoungwe/pi-knowledge/dist/core/claim-conflicts.d.ts.map +1 -0
  10. package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts +55 -0
  11. package/node_modules/@gyoungwe/pi-knowledge/dist/core/config.d.ts.map +1 -0
  12. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts +11 -0
  13. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery-prompt.d.ts.map +1 -0
  14. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts +26 -0
  15. package/node_modules/@gyoungwe/pi-knowledge/dist/core/daily-discovery.d.ts.map +1 -0
  16. package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts +127 -0
  17. package/node_modules/@gyoungwe/pi-knowledge/dist/core/deliverable-review.d.ts.map +1 -0
  18. package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts +39 -0
  19. package/node_modules/@gyoungwe/pi-knowledge/dist/core/evolution.d.ts.map +1 -0
  20. package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts +290 -0
  21. package/node_modules/@gyoungwe/pi-knowledge/dist/core/experience-store.d.ts.map +1 -0
  22. package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts +38 -0
  23. package/node_modules/@gyoungwe/pi-knowledge/dist/core/extension-helpers.d.ts.map +1 -0
  24. package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts +39 -0
  25. package/node_modules/@gyoungwe/pi-knowledge/dist/core/files.d.ts.map +1 -0
  26. package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts +77 -0
  27. package/node_modules/@gyoungwe/pi-knowledge/dist/core/flow-cards.d.ts.map +1 -0
  28. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts +14 -0
  29. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-cache.d.ts.map +1 -0
  30. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts +44 -0
  31. package/node_modules/@gyoungwe/pi-knowledge/dist/core/graph-retrieval.d.ts.map +1 -0
  32. package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts +9 -0
  33. package/node_modules/@gyoungwe/pi-knowledge/dist/core/host.d.ts.map +1 -0
  34. package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts +46 -0
  35. package/node_modules/@gyoungwe/pi-knowledge/dist/core/index.d.ts.map +1 -0
  36. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts +125 -0
  37. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-frontmatter.d.ts.map +1 -0
  38. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts +93 -0
  39. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-identity.d.ts.map +1 -0
  40. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts +63 -0
  41. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ingest-policy.d.ts.map +1 -0
  42. package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts +47 -0
  43. package/node_modules/@gyoungwe/pi-knowledge/dist/core/layout.d.ts.map +1 -0
  44. package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts +16 -0
  45. package/node_modules/@gyoungwe/pi-knowledge/dist/core/maintenance.d.ts.map +1 -0
  46. package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts +14 -0
  47. package/node_modules/@gyoungwe/pi-knowledge/dist/core/memory-note.d.ts.map +1 -0
  48. package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts +116 -0
  49. package/node_modules/@gyoungwe/pi-knowledge/dist/core/metacognitive-policy.d.ts.map +1 -0
  50. package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts +8 -0
  51. package/node_modules/@gyoungwe/pi-knowledge/dist/core/note-title.d.ts.map +1 -0
  52. package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts +84 -0
  53. package/node_modules/@gyoungwe/pi-knowledge/dist/core/orchestration-policy.d.ts.map +1 -0
  54. package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts +70 -0
  55. package/node_modules/@gyoungwe/pi-knowledge/dist/core/project-identity.d.ts.map +1 -0
  56. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts +39 -0
  57. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication-policy.d.ts.map +1 -0
  58. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts +24 -0
  59. package/node_modules/@gyoungwe/pi-knowledge/dist/core/publication.d.ts.map +1 -0
  60. package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts +15 -0
  61. package/node_modules/@gyoungwe/pi-knowledge/dist/core/recent-by-category.d.ts.map +1 -0
  62. package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts +4 -0
  63. package/node_modules/@gyoungwe/pi-knowledge/dist/core/related-notes.d.ts.map +1 -0
  64. package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts +124 -0
  65. package/node_modules/@gyoungwe/pi-knowledge/dist/core/reuse.d.ts.map +1 -0
  66. package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts +12 -0
  67. package/node_modules/@gyoungwe/pi-knowledge/dist/core/review-policy.d.ts.map +1 -0
  68. package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts +98 -0
  69. package/node_modules/@gyoungwe/pi-knowledge/dist/core/runtime-host.d.ts.map +1 -0
  70. package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts +14 -0
  71. package/node_modules/@gyoungwe/pi-knowledge/dist/core/search-policy.d.ts.map +1 -0
  72. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts +85 -0
  73. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-model.d.ts.map +1 -0
  74. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts +41 -0
  75. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-provider.d.ts.map +1 -0
  76. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts +30 -0
  77. package/node_modules/@gyoungwe/pi-knowledge/dist/core/semantic-settings.d.ts.map +1 -0
  78. package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts +171 -0
  79. package/node_modules/@gyoungwe/pi-knowledge/dist/core/service.d.ts.map +1 -0
  80. package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts +13 -0
  81. package/node_modules/@gyoungwe/pi-knowledge/dist/core/source-links.d.ts.map +1 -0
  82. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts +8 -0
  83. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-delivery.d.ts.map +1 -0
  84. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts +61 -0
  85. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialist-host.d.ts.map +1 -0
  86. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts +55 -0
  87. package/node_modules/@gyoungwe/pi-knowledge/dist/core/specialists.d.ts.map +1 -0
  88. package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts +57 -0
  89. package/node_modules/@gyoungwe/pi-knowledge/dist/core/task-feedback.d.ts.map +1 -0
  90. package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts +24 -0
  91. package/node_modules/@gyoungwe/pi-knowledge/dist/core/tool-budget.d.ts.map +1 -0
  92. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts +22 -0
  93. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-candidate.d.ts.map +1 -0
  94. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts +79 -0
  95. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-memory.d.ts.map +1 -0
  96. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts +2 -0
  97. package/node_modules/@gyoungwe/pi-knowledge/dist/core/topic-probe.d.ts.map +1 -0
  98. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts +360 -0
  99. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-service.d.ts.map +1 -0
  100. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts +28 -0
  101. package/node_modules/@gyoungwe/pi-knowledge/dist/core/ui-state.d.ts.map +1 -0
  102. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts +167 -0
  103. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-model-review.d.ts.map +1 -0
  104. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts +34 -0
  105. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-policy.d.ts.map +1 -0
  106. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts +74 -0
  107. package/node_modules/@gyoungwe/pi-knowledge/dist/core/wiki-review.d.ts.map +1 -0
  108. package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts +2 -0
  109. package/node_modules/@gyoungwe/pi-knowledge/dist/core/worker.d.ts.map +1 -0
  110. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts +42 -0
  111. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/internal-knowledge-extension.d.ts.map +1 -0
  112. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts +5 -0
  113. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-extension.d.ts.map +1 -0
  114. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts +6 -0
  115. package/node_modules/@gyoungwe/pi-knowledge/dist/extension/knowledge-worker.d.ts.map +1 -0
  116. package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts +7 -0
  117. package/node_modules/@gyoungwe/pi-knowledge/dist/host.d.ts.map +1 -0
  118. package/node_modules/@gyoungwe/pi-knowledge/dist/host.mjs +11638 -0
  119. package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts +6 -0
  120. package/node_modules/@gyoungwe/pi-knowledge/dist/index.d.ts.map +1 -0
  121. package/node_modules/@gyoungwe/pi-knowledge/dist/index.mjs +4728 -10301
  122. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts +41 -0
  123. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/plan.d.ts.map +1 -0
  124. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts +10 -0
  125. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/prompts.d.ts.map +1 -0
  126. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts +31 -0
  127. package/node_modules/@gyoungwe/pi-knowledge/dist/maintenance/run.d.ts.map +1 -0
  128. package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/.knowledge-worker-manifest.json +9 -0
  129. package/node_modules/@gyoungwe/pi-knowledge/lib/knowledge/runtime/worker.mjs +142 -12
  130. package/node_modules/@gyoungwe/pi-knowledge/package.json +21 -3
  131. package/node_modules/@gyoungwe/pi-knowledge/plugin.manifest.json +23 -1
  132. package/node_modules/@gyoungwe/pi-research/build-manifest.json +2 -2
  133. package/node_modules/@gyoungwe/pi-research/dist/index.mjs +3141 -613
  134. package/node_modules/@gyoungwe/pi-research/package.json +1 -1
  135. package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts +101 -0
  136. package/node_modules/@gyoungwe/plugin-api/dist/index.d.ts.map +1 -1
  137. package/node_modules/@gyoungwe/plugin-api/dist/index.js +124 -0
  138. package/node_modules/@gyoungwe/plugin-api/dist/index.js.map +1 -1
  139. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts +486 -0
  140. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.d.ts.map +1 -0
  141. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js +251 -0
  142. package/node_modules/@gyoungwe/plugin-api/dist/knowledge.js.map +1 -0
  143. package/node_modules/@gyoungwe/plugin-api/package.json +6 -1
  144. package/package.json +6 -6
  145. package/plugin.manifest.json +39 -3
@@ -0,0 +1,127 @@
1
+ import type { MetacognitiveArtifactNumber, MetacognitiveSnapshot } from "./metacognitive-policy.js";
2
+ export type ReviewerSeverity = "low" | "medium" | "high";
3
+ export type ReviewerTrigger = "deliverable-write" | "milestone-complete" | "publication-projection";
4
+ export interface DeliverableReviewLocation {
5
+ kind: "body" | "paragraph" | "line" | "artifact";
6
+ paragraph?: number;
7
+ line?: number;
8
+ artifactId?: string;
9
+ path?: string;
10
+ }
11
+ export interface DeliverableReviewFinding {
12
+ id: string;
13
+ code: "untraceable-number" | "figure-code-mismatch" | "citation-without-receipt" | "review-timeout" | "review-budget-exhausted";
14
+ severity: ReviewerSeverity;
15
+ location: DeliverableReviewLocation;
16
+ detail: string;
17
+ suggestion: string;
18
+ handled: boolean;
19
+ independent?: boolean;
20
+ nonIndependentReason?: string;
21
+ }
22
+ export interface ReviewDeliverableRecord {
23
+ id: string;
24
+ path?: string;
25
+ kind?: string;
26
+ sha256?: string;
27
+ attemptId?: string;
28
+ receiptId?: string;
29
+ }
30
+ export interface ReviewAttemptRecord {
31
+ id: string;
32
+ artifactIds?: readonly string[];
33
+ startedAt?: string;
34
+ finishedAt?: string;
35
+ /** Latest output hashes keyed by artifact id. */
36
+ outputs?: readonly {
37
+ artifactId: string;
38
+ sha256: string;
39
+ }[];
40
+ /** Compatibility shape used by inquiry/compute adapters. */
41
+ artifactSha256?: Readonly<Record<string, string>>;
42
+ }
43
+ export interface ReviewReadReceipt {
44
+ path: string;
45
+ hash?: string;
46
+ receiptRef?: string;
47
+ text?: string;
48
+ numbers?: readonly MetacognitiveArtifactNumber[];
49
+ }
50
+ export interface DeliverableReviewSnapshot extends MetacognitiveSnapshot {
51
+ /** Public answer/deliverable body. `answer` is accepted as a compatibility alias. */
52
+ body?: string;
53
+ answer?: string;
54
+ deliverables?: readonly ReviewDeliverableRecord[];
55
+ attempts?: readonly ReviewAttemptRecord[];
56
+ readReceipts?: readonly ReviewReadReceipt[];
57
+ /** Optional explicit citations when the body is not available. */
58
+ citations?: readonly string[];
59
+ }
60
+ export interface DeliverableReviewResult {
61
+ contentHash: string;
62
+ findings: readonly DeliverableReviewFinding[];
63
+ }
64
+ export interface ReviewerModelProvider {
65
+ provider: string;
66
+ model?: string;
67
+ }
68
+ export interface ReviewerProviderSelection {
69
+ provider: string;
70
+ model?: string;
71
+ independent: boolean;
72
+ nonIndependentReason?: string;
73
+ }
74
+ export interface BackgroundReviewerOptions {
75
+ timeoutMs?: number;
76
+ maxPerSession?: number;
77
+ review?: (snapshot: DeliverableReviewSnapshot) => DeliverableReviewFinding[] | Promise<DeliverableReviewFinding[]>;
78
+ /** Optional model-backed pass; the host selects the provider by provider id. */
79
+ modelReview?: (snapshot: DeliverableReviewSnapshot, selection: ReviewerProviderSelection) => DeliverableReviewFinding[] | Promise<DeliverableReviewFinding[]>;
80
+ mainProvider?: string;
81
+ providers?: readonly ReviewerModelProvider[];
82
+ getProviders?: () => readonly ReviewerModelProvider[] | Promise<readonly ReviewerModelProvider[]>;
83
+ useModel?: () => boolean | Promise<boolean>;
84
+ onResult?: (sessionId: string, result: DeliverableReviewResult, trigger: ReviewerTrigger) => void | Promise<void>;
85
+ now?: () => number;
86
+ }
87
+ export interface BackgroundReviewerBridge {
88
+ schedule(request: BackgroundReviewRequest): void;
89
+ getCached?(sessionId: string, snapshot: DeliverableReviewSnapshot): DeliverableReviewResult | undefined;
90
+ getFindings?(sessionId: string): readonly DeliverableReviewFinding[];
91
+ clearSession?(sessionId: string): void;
92
+ }
93
+ export interface BackgroundReviewRequest {
94
+ sessionId: string;
95
+ snapshot: DeliverableReviewSnapshot;
96
+ trigger: ReviewerTrigger;
97
+ mainProvider?: string;
98
+ }
99
+ export declare function reviewDeliverable(snapshot: DeliverableReviewSnapshot): DeliverableReviewResult;
100
+ export declare function selectReviewerProvider(mainProvider: string | undefined, providers: readonly ReviewerModelProvider[]): ReviewerProviderSelection | null;
101
+ export declare class BackgroundReviewer {
102
+ private readonly timeoutMs;
103
+ private readonly maxPerSession;
104
+ private readonly review;
105
+ private readonly modelReview?;
106
+ private readonly mainProvider?;
107
+ private readonly providers;
108
+ private readonly getProviders?;
109
+ private readonly useModel?;
110
+ private readonly onResult?;
111
+ private readonly now;
112
+ private readonly cache;
113
+ private readonly results;
114
+ private readonly counts;
115
+ private readonly emitted;
116
+ private readonly latest;
117
+ private disposed;
118
+ constructor(options?: BackgroundReviewerOptions);
119
+ private timeoutFinding;
120
+ reviewOnce(request: BackgroundReviewRequest): Promise<DeliverableReviewResult>;
121
+ getCached(sessionId: string, snapshot: DeliverableReviewSnapshot): DeliverableReviewResult | undefined;
122
+ schedule(request: BackgroundReviewRequest): void;
123
+ getFindings(sessionId: string): readonly DeliverableReviewFinding[];
124
+ clearSession(sessionId: string): void;
125
+ dispose(): void;
126
+ }
127
+ //# sourceMappingURL=deliverable-review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliverable-review.d.ts","sourceRoot":"","sources":["../../src/core/deliverable-review.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEX,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAEpG,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,0BAA0B,GAAG,gBAAgB,GAAG,yBAAyB,CAAC;IAChI,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mB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GAAG,OAAO,CAAC,uBAAuB,CAAC;IA+DpF,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,yBAAyB,GAAG,uBAAuB,GAAG,SAAS;IAKtG,QAAQ,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAgBhD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,wBAAwB,EAAE;IAInE,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAQrC,OAAO,IAAI,IAAI;CAQf"}
@@ -0,0 +1,39 @@
1
+ import { createEvolutionCandidate, createKnowledgeReuseDecision, type EvolutionCandidate, type KnowledgeReuseDecisionRecord, type ContractParentRef } from "@gyoungwe/plugin-api/knowledge";
2
+ export interface EvolutionIndexStore {
3
+ read(): Promise<{
4
+ readonly candidates: readonly EvolutionCandidate[];
5
+ readonly decisions: readonly KnowledgeReuseDecisionRecord[];
6
+ }>;
7
+ write(value: {
8
+ readonly candidates: readonly EvolutionCandidate[];
9
+ readonly decisions: readonly KnowledgeReuseDecisionRecord[];
10
+ }): Promise<void>;
11
+ }
12
+ /**
13
+ * Durable host-neutral index for knowledge reuse and evolution proposals.
14
+ * JsonStore is injected by the backend; this package only owns lifecycle and
15
+ * fail-closed approval rules.
16
+ */
17
+ export declare class EvolutionIndex {
18
+ private readonly store?;
19
+ private readonly candidates;
20
+ private readonly decisions;
21
+ private writeQueue;
22
+ constructor(store?: EvolutionIndexStore | undefined);
23
+ load(): Promise<void>;
24
+ propose(input: Parameters<typeof createEvolutionCandidate>[0]): Promise<EvolutionCandidate>;
25
+ getCandidate(id: string): EvolutionCandidate | undefined;
26
+ listCandidates(): readonly EvolutionCandidate[];
27
+ approveCandidate(id: string, approvalRef: ContractParentRef, now: string): Promise<EvolutionCandidate>;
28
+ supersedeCandidate(id: string, supersedingRef: ContractParentRef, now: string): Promise<EvolutionCandidate>;
29
+ revokeCandidate(id: string, revokedByRef: ContractParentRef, reason: string, now: string): Promise<EvolutionCandidate>;
30
+ recordReuseDecision(input: Parameters<typeof createKnowledgeReuseDecision>[0]): Promise<KnowledgeReuseDecisionRecord>;
31
+ getReuseDecision(id: string): KnowledgeReuseDecisionRecord | undefined;
32
+ listReuseDecisions(): readonly KnowledgeReuseDecisionRecord[];
33
+ approveReuse(id: string, approvalRef: ContractParentRef, now: string): Promise<KnowledgeReuseDecisionRecord>;
34
+ revokeReuse(id: string, revokedByRef: ContractParentRef, now: string): Promise<KnowledgeReuseDecisionRecord>;
35
+ private requireCandidate;
36
+ private requireDecision;
37
+ private persist;
38
+ }
39
+ //# sourceMappingURL=evolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evolution.d.ts","sourceRoot":"","sources":["../../src/core/evolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,wBAAwB,EACxB,4BAA4B,EAI5B,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,mBAAmB;IACnC,IAAI,IAAI,OAAO,CAAC;QACf,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;QACnD,QAAQ,CAAC,SAAS,EAAE,SAAS,4BAA4B,EAAE,CAAC;KAC5D,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE;QACZ,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;QACnD,QAAQ,CAAC,SAAS,EAAE,SAAS,4BAA4B,EAAE,CAAC;KAC5D,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IAKd,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAJnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAyC;IACpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmD;IAC7E,OAAO,CAAC,UAAU,CAAoC;gBAEzB,KAAK,CAAC,EAAE,mBAAmB,YAAA;IAElD,I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ionally separate from evidence and instructions. */
2
+ export declare const EXPERIENCE_VERSION = 1;
3
+ export declare const EXPERIENCE_LIMITS: Readonly<{
4
+ maxRecords: 128;
5
+ maxFileBytes: number;
6
+ maxSummaryChars: 1200;
7
+ maxReasonChars: 600;
8
+ maxTags: 16;
9
+ maxArtifacts: 16;
10
+ maxSources: 16;
11
+ maxObservationIds: 8;
12
+ maxJobIds: 8;
13
+ maxWorkflowSpecDiffs: 16;
14
+ maxQcMetrics: 24;
15
+ maxQcValues: 128;
16
+ maxModelSummaryChars: 500;
17
+ maxSearchResults: 24;
18
+ maxHostIdChars: 64;
19
+ maxProjectChars: 96;
20
+ maxWorkflowChars: 180;
21
+ maxSchedulerChars: 32;
22
+ maxRevisionChars: 180;
23
+ maxSchedulerJobIdChars: 180;
24
+ maxQueryChars: 200;
25
+ }>;
26
+ export type ExperienceStatus = "observed" | "verified";
27
+ export type ExperienceOutcome = "success" | "failure" | "blocked" | "unknown";
28
+ export interface ExperienceBinding {
29
+ vaultId: string;
30
+ }
31
+ export interface ExperienceArtifact {
32
+ path?: string;
33
+ sha256: string;
34
+ bytes?: number;
35
+ }
36
+ /** Host-observed execution facts copied from a terminal compute completion. */
37
+ export interface ExperienceExecutionFacts {
38
+ contractHash?: string | null;
39
+ workflow?: string | null;
40
+ workflowRevision?: string | null;
41
+ scheduler?: string | null;
42
+ schedulerJobId?: string | null;
43
+ artifactRefs?: readonly ExperienceArtifact[] | null;
44
+ }
45
+ export interface ExperienceRepair {
46
+ succeeded: boolean;
47
+ summary?: string | null;
48
+ observationId?: string | null;
49
+ }
50
+ export type WorkflowSpecDiffValue = string | number | boolean | null;
51
+ export interface WorkflowSpecDiff {
52
+ path: string;
53
+ before?: WorkflowSpecDiffValue;
54
+ after?: WorkflowSpecDiffValue;
55
+ }
56
+ export interface ExperienceResourceUse {
57
+ [key: string]: number;
58
+ }
59
+ export interface ExperienceQcDistribution {
60
+ [key: string]: number | undefined;
61
+ min?: number;
62
+ max?: number;
63
+ mean?: number;
64
+ median?: number;
65
+ p95?: number;
66
+ count?: number;
67
+ }
68
+ export interface ExperienceQcMetric {
69
+ name: string;
70
+ unit?: string | null;
71
+ value?: number | null;
72
+ count?: number | null;
73
+ distribution?: ExperienceQcDistribution;
74
+ values?: number[];
75
+ }
76
+ export interface ExperienceProvenance {
77
+ runId?: string | null;
78
+ observationId?: string | null;
79
+ receiptId?: string | null;
80
+ manifestSha256?: string | null;
81
+ artifactHashes?: readonly ExperienceArtifact[];
82
+ }
83
+ export interface ExperienceObservation {
84
+ id: string;
85
+ outcome: ExperienceOutcome;
86
+ observedAt?: string;
87
+ exitCode?: number | null;
88
+ featureKey?: string;
89
+ repairSucceeded?: boolean;
90
+ failureSignature?: string | null;
91
+ failedStep?: string | null;
92
+ step?: string | null;
93
+ repair?: ExperienceRepair | null;
94
+ workflowSpecDiff?: readonly WorkflowSpecDiff[] | null;
95
+ resourceUse?: ExperienceResourceUse | null;
96
+ qcMetrics?: readonly ExperienceQcMetric[] | null;
97
+ qc?: readonly ExperienceQcMetric[] | null;
98
+ modelSummary?: string | null;
99
+ contractHash?: string | null;
100
+ workflow?: string | null;
101
+ workflowRevision?: string | null;
102
+ scheduler?: string | null;
103
+ schedulerJobId?: string | null;
104
+ artifactRefs?: readonly ExperienceArtifact[] | null;
105
+ provenance?: ExperienceProvenance;
106
+ }
107
+ export interface TerminalJobExperienceInput {
108
+ jobId: string;
109
+ featureKey?: string;
110
+ summary: string;
111
+ outcome: ExperienceOutcome;
112
+ exitCode?: number | null;
113
+ step?: string | null;
114
+ failureSignature?: string | null;
115
+ repairSucceeded?: boolean;
116
+ failedStep?: string | null;
117
+ repair?: ExperienceRepair | null;
118
+ workflowSpecDiff?: readonly WorkflowSpecDiff[] | null;
119
+ resourceUse?: ExperienceResourceUse | null;
120
+ qcMetrics?: readonly ExperienceQcMetric[] | null;
121
+ qc?: readonly ExperienceQcMetric[] | null;
122
+ modelSummary?: string | null;
123
+ /** Immutable task/compute contract and exact workflow facts observed by the host. */
124
+ contractHash?: string | null;
125
+ workflow?: string | null;
126
+ workflowRevision?: string | null;
127
+ scheduler?: string | null;
128
+ schedulerJobId?: string | null;
129
+ artifactRefs?: readonly ExperienceArtifact[] | null;
130
+ observationId: string;
131
+ observedAt?: string;
132
+ topicId?: string | null;
133
+ provenance: ExperienceProvenance;
134
+ tags?: readonly string[];
135
+ sourceRefs?: readonly string[];
136
+ }
137
+ export interface ExperienceStorePort {
138
+ record(input: ExperienceInput, expectedRevision?: number): Promise<{
139
+ classification: string;
140
+ record: ExperienceRecord;
141
+ revision: number;
142
+ }>;
143
+ }
144
+ export interface ExperienceInput {
145
+ /** Stable job identifier from the terminal runner. */
146
+ jobId?: string;
147
+ /** A stable semantic pattern key. Different observations of this key can verify an experience. */
148
+ featureKey?: string;
149
+ summary: string;
150
+ observation?: ExperienceObservation;
151
+ hostObservation?: ExperienceObservation;
152
+ provenance?: ExperienceProvenance;
153
+ topicId?: string | null;
154
+ reason?: string | null;
155
+ tags?: readonly string[];
156
+ sourceRefs?: readonly string[];
157
+ exitCode?: number | null;
158
+ failureSignature?: string | null;
159
+ failedStep?: string | null;
160
+ repairSucceeded?: boolean;
161
+ step?: string | null;
162
+ repair?: ExperienceRepair | null;
163
+ workflowSpecDiff?: readonly WorkflowSpecDiff[] | null;
164
+ resourceUse?: ExperienceResourceUse | null;
165
+ qcMetrics?: readonly ExperienceQcMetric[] | null;
166
+ qc?: readonly ExperienceQcMetric[] | null;
167
+ /** Compatibility alias for qcMetrics at the adapter boundary. */
168
+ modelSummary?: string | null;
169
+ contractHash?: string | null;
170
+ workflow?: string | null;
171
+ workflowRevision?: string | null;
172
+ scheduler?: string | null;
173
+ schedulerJobId?: string | null;
174
+ artifactRefs?: readonly ExperienceArtifact[] | null;
175
+ /** Accepted for compatibility at the adapter boundary but intentionally never persisted. */
176
+ command?: unknown;
177
+ output?: unknown;
178
+ credentials?: unknown;
179
+ }
180
+ export interface ExperienceRecord {
181
+ id: string;
182
+ version: 1;
183
+ vaultId: string;
184
+ project: string;
185
+ hostId: string;
186
+ jobId: string;
187
+ featureKey: string;
188
+ topicId: string | null;
189
+ summary: string;
190
+ reason: string | null;
191
+ outcome: ExperienceOutcome;
192
+ status: ExperienceStatus;
193
+ observedAt: string;
194
+ observationIds: string[];
195
+ observationCount: number;
196
+ jobIds: string[];
197
+ jobCount: number;
198
+ failureSignature: string | null;
199
+ exitCode: number | null;
200
+ failedStep: string | null;
201
+ repair: ExperienceRepair | null;
202
+ workflowSpecDiff: WorkflowSpecDiff[];
203
+ resourceUse: ExperienceResourceUse;
204
+ qcMetrics: ExperienceQcMetric[];
205
+ modelSummary: string | null;
206
+ modelGenerated: boolean;
207
+ contractHash: string | null;
208
+ workflow: string | null;
209
+ workflowRevision: string | null;
210
+ scheduler: string | null;
211
+ schedulerJobId: string | null;
212
+ artifactRefs: ExperienceArtifact[];
213
+ provenance: ExperienceProvenance;
214
+ tags: string[];
215
+ sourceRefs: string[];
216
+ navigationOnly: true;
217
+ evidenceEligible: false;
218
+ instructionEligible: false;
219
+ createdAt: string;
220
+ updatedAt: string;
221
+ }
222
+ export interface ExperienceDocument {
223
+ version: 1;
224
+ vaultId: string;
225
+ project: string;
226
+ hostId: string;
227
+ revision: number;
228
+ updatedAt: string;
229
+ records: ExperienceRecord[];
230
+ }
231
+ export interface ExperienceSearchHit {
232
+ score: number;
233
+ record: ExperienceRecord;
234
+ }
235
+ export interface ExperienceSearchResult {
236
+ revision: number;
237
+ query: string;
238
+ records: ExperienceSearchHit[];
239
+ navigationOnly: true;
240
+ evidenceEligible: false;
241
+ instructionEligible: false;
242
+ }
243
+ export interface ExperienceStoreOptions {
244
+ binding: ExperienceBinding;
245
+ project: string;
246
+ hostId: string;
247
+ directory?: string | null;
248
+ }
249
+ export interface ExperienceStore {
250
+ path: string;
251
+ scope: {
252
+ vaultId: string;
253
+ project: string;
254
+ hostId: string;
255
+ };
256
+ read: () => Promise<ExperienceDocument>;
257
+ record: (input: ExperienceInput, expectedRevision?: number) => Promise<{
258
+ classification: "new" | "updated" | "duplicate";
259
+ revision: number;
260
+ record: ExperienceRecord;
261
+ }>;
262
+ search: (query?: string, options?: {
263
+ limit?: number;
264
+ includeObserved?: boolean;
265
+ workflow?: string;
266
+ hostId?: string;
267
+ failureSignature?: string;
268
+ }) => Promise<ExperienceSearchResult>;
269
+ }
270
+ /** Convert a stable B1/B3 terminal-job observation into the redacted Experience input.
271
+ * The adapter accepts only host-observed fields and provenance pointers; runner output and commands stay out.
272
+ */
273
+ export declare function experienceInputFromTerminalJob(input: TerminalJobExperienceInput): ExperienceInput;
274
+ export declare const terminalJobExperienceInput: typeof experienceInputFromTerminalJob;
275
+ export declare function recordTerminalJobExperience(store: ExperienceStorePort, input: TerminalJobExperienceInput, expectedRevision?: number): Promise<{
276
+ classification: string;
277
+ record: ExperienceRecord;
278
+ revision: number;
279
+ }>;
280
+ /** Build a bounded, host-isolated experience log backed by atomic JSON and revision CAS. */
281
+ export declare function createExperienceStore(options: ExperienceStoreOptions): ExperienceStore;
282
+ export declare function searchExperiences(options: ExperienceStoreOptions & {
283
+ query?: string;
284
+ limit?: number;
285
+ includeObserved?: boolean;
286
+ workflow?: string;
287
+ failureSignature?: string;
288
+ hostFilter?: string;
289
+ }): Promise<ExperienceSearchResult>;
290
+ //# sourceMappingURL=experience-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experience-store.d.ts","sourceRoot":"","sources":["../../src/core/experience-store.ts"],"names":[],"mappings":"AAMA,+GAA+G;AAC/G,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAsB5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC;AACvD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE9E,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAC;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,CACP,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,KAClH,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACrC;AAoZD;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,0BAA0B,GAAG,eAAe,CAgDjG;AAED,eAAO,MAAM,0BAA0B,uCAAiC,CAAC;AAEzE,wBAAsB,2BAA2B,CAChD,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,0BAA0B,EACjC,gBAAgB,CAAC,EAAE,MAAM;oBAllB4D,MAAM;YAAU,gBAAgB;cAAY,MAAM;GAqlBvI;AAED,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CA2KtF;AAED,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,sBAAsB,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GACC,OAAO,CAAC,sBAAsB,CAAC,CAIjC"}
@@ -0,0 +1,38 @@
1
+ import { type SessionContextLike } from "./project-identity.js";
2
+ /** Tool result envelope shared by knowledge extension adapters. */
3
+ export interface KnowledgeToolResult<T = unknown> {
4
+ content: Array<{
5
+ type: "text";
6
+ text: string;
7
+ }>;
8
+ details: T;
9
+ }
10
+ /** JSON-safe result envelope for a knowledge tool. */
11
+ export declare function result<T>(data: T): KnowledgeToolResult<T>;
12
+ /**
13
+ * Resolve the knowledge project for a tool call or turn through the shared resolver
14
+ * (`project-identity.ts`): the daily-space session choice, then the workspace's configured
15
+ * `knowledgeProjectId`, then the stable directory-derived identity.
16
+ */
17
+ export declare function currentProject(cwd: string, ctx?: SessionContextLike | null): Promise<string>;
18
+ /** Normalise a stable explainer topic id, dropping generated timestamp suffixes. */
19
+ export declare function explainerTopicId(value: unknown, title?: string): string;
20
+ export interface SessionIdentityContext {
21
+ sessionManager?: {
22
+ getSessionId?: () => string | null | undefined;
23
+ };
24
+ sessionId?: string | null;
25
+ }
26
+ /** Prefer the host session manager, with the event context as a compatibility fallback. */
27
+ export declare function sessionIdentity(ctx: SessionIdentityContext | null | undefined): string | null;
28
+ /** Whether a prompt contains a signal that it continues the previous topic. */
29
+ export declare function continuationHint(value: unknown): boolean;
30
+ export interface TopicForContinuation {
31
+ id?: unknown;
32
+ title?: unknown;
33
+ aliases?: readonly unknown[];
34
+ entities?: readonly unknown[];
35
+ }
36
+ /** Decide whether a prompt continues a topic using explicit switches and topic terms. */
37
+ export declare function continuesTopic(prompt: unknown, topic: TopicForContinuation | null | undefined): boolean;
38
+ //# sourceMappingURL=extension-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-helpers.d.ts","sourceRoot":"","sources":["../../src/core/extension-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,kBAAkB,EAAoB,MAAM,uBAAuB,CAAC;AAE3G,mEAAmE;AACnE,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC/C,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC;CACX;AAED,sDAAsD;AACtD,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAKzD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,kBAAkB,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAElG;AAED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAmB,GAAG,MAAM,CASjF;AAED,MAAM,WAAW,sBAAsB;IACtC,cAAc,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,CAAC;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAE7F;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIxD;AAED,MAAM,WAAW,oBAAoB;IACpC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAUvG"}
@@ -0,0 +1,39 @@
1
+ import { lstat } from "node:fs/promises";
2
+ export declare const MAX_NOTE_BYTES: number;
3
+ export interface NoteStat {
4
+ full: string;
5
+ stat: Awaited<ReturnType<typeof lstat>>;
6
+ signature: string;
7
+ }
8
+ export interface ReadNoteResult {
9
+ path: string;
10
+ text: string;
11
+ hash: string;
12
+ signature: string;
13
+ bytes: number;
14
+ }
15
+ export interface NoteSnippet {
16
+ text: string;
17
+ startLine: number;
18
+ endLine: number;
19
+ totalLines: number;
20
+ truncated: boolean;
21
+ }
22
+ export declare function allowedSegment(name: string): boolean;
23
+ export declare function validateNote(path: unknown): string;
24
+ export declare function noteScope(path: string): string;
25
+ export declare function canRead(path: string, project: string): boolean;
26
+ export declare function fileVersion(stat: {
27
+ mtimeMs: number | bigint;
28
+ ctimeMs: number | bigint;
29
+ size: number | bigint;
30
+ ino: number | bigint;
31
+ }): string;
32
+ export declare function safeNotePath(vault: string, path: string): Promise<string>;
33
+ export declare function inspectNote(vault: string, path: string): Promise<NoteStat>;
34
+ export declare function readNoteFile(vault: string, path: string): Promise<ReadNoteResult>;
35
+ export declare function snippet(text: string, { startLine, maxChars }?: {
36
+ startLine?: number;
37
+ maxChars?: number;
38
+ }): NoteSnippet;
39
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/core/files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkB,MAAM,kBAAkB,CAAC;AAGzD,eAAO,MAAM,cAAc,QAAc,CAAC;AAkB1C,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAalD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IACjC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,GAAG,MAAM,CAET;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY/E;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAKhF;AAUD,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAoCvF;AAED,wBAAgB,OAAO,CACtB,IAAI,EAAE,MAAM,EACZ,EAAE,SAAa,EAAE,QAAe,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAChF,WAAW,CAwBb"}
@@ -0,0 +1,77 @@
1
+ export type FlowTone = "ok" | "error" | "muted" | "warn" | string;
2
+ export interface FlowCardField {
3
+ label: string;
4
+ i18n?: unknown;
5
+ value: string;
6
+ status?: boolean;
7
+ code?: string | null;
8
+ note?: string | null;
9
+ tone: FlowTone;
10
+ }
11
+ export interface FlowCardLink {
12
+ kind: "external" | "resource" | "note" | "path";
13
+ target: string;
14
+ label: string;
15
+ i18n?: unknown;
16
+ }
17
+ export interface FlowCard {
18
+ key: string;
19
+ kind: string;
20
+ title: string;
21
+ provisionalTitle: boolean;
22
+ subtitle: string | null;
23
+ status: string;
24
+ tone: FlowTone;
25
+ detail: string | null;
26
+ path: string | null;
27
+ fields: FlowCardField[];
28
+ links: FlowCardLink[];
29
+ source: string | null;
30
+ at: number;
31
+ }
32
+ export interface CardFieldOptions {
33
+ i18n?: unknown;
34
+ status?: boolean;
35
+ code?: unknown;
36
+ note?: unknown;
37
+ tone?: FlowTone;
38
+ }
39
+ export interface FlowCardInput {
40
+ key?: unknown;
41
+ kind?: unknown;
42
+ title?: unknown;
43
+ subtitle?: unknown;
44
+ status?: unknown;
45
+ tone?: FlowTone;
46
+ detail?: unknown;
47
+ path?: unknown;
48
+ fields?: readonly (FlowCardField | null | undefined)[];
49
+ links?: readonly (FlowCardLink | null | undefined)[];
50
+ source?: unknown;
51
+ provisionalTitle?: unknown;
52
+ }
53
+ export interface FlowEventContent {
54
+ type?: unknown;
55
+ text?: unknown;
56
+ }
57
+ export interface FlowEvent {
58
+ toolCallId?: unknown;
59
+ toolName?: unknown;
60
+ result?: {
61
+ content?: readonly FlowEventContent[];
62
+ details?: unknown;
63
+ };
64
+ }
65
+ /** Status marker to tone mapping; display classification never changes the marker. */
66
+ export declare function statusTone(status: unknown): FlowTone;
67
+ export declare function cardField(label: unknown, value: unknown, extra?: CardFieldOptions): FlowCardField;
68
+ export declare function cardLink(kind: FlowCardLink["kind"] | string, target: unknown, label: unknown, i18n?: unknown): FlowCardLink | null;
69
+ /** Construct one generic receipt card; empty fields and null links are omitted. */
70
+ export declare function flowCard(input: FlowCardInput): FlowCard;
71
+ /** Failure card generated when a flow-enabled tool reports an error. */
72
+ export declare function failureCard(event: FlowEvent): FlowCard;
73
+ /** Literature receipt card merged by DOI across Zotero and Vault observations. */
74
+ export declare function literatureCard(event: FlowEvent, { write }?: {
75
+ write?: boolean;
76
+ }): FlowCard | null;
77
+ //# sourceMappingURL=flow-cards.d.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