@homeostat/core 0.1.2 → 0.1.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.
- package/dist/src/conflicts.d.ts +9 -0
- package/dist/src/conflicts.js +22 -0
- package/dist/src/events.js +9 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/src/conflicts.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Entry } from "./entry.ts";
|
|
1
2
|
import type { Severity } from "./issues.ts";
|
|
2
3
|
import type { Frontmatter } from "./schema.ts";
|
|
3
4
|
export type ConflictKind = "duplicate-id" | "missing-reference" | "one-sided-conflict" | "supersedes-cycle" | "superseded-not-retired" | "possible-duplicate";
|
|
@@ -21,3 +22,11 @@ export declare function titleSimilarity(a: string, b: string): number;
|
|
|
21
22
|
* the other. It can report overlap for globs that are in fact disjoint, never the reverse.
|
|
22
23
|
*/
|
|
23
24
|
export declare function scopesOverlap(a: readonly string[], b: readonly string[]): boolean;
|
|
25
|
+
/** Functions, file paths and code spans a rule names: `withRetry()`, `services/http.ts`. */
|
|
26
|
+
export declare function codeReferences(text: string): Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Whether two rules teach the same lesson, for the daily run: near-identical titles, or the same
|
|
29
|
+
* code named in both (two people rarely word a lesson alike, but they name the same function).
|
|
30
|
+
* Scopes must overlap either way.
|
|
31
|
+
*/
|
|
32
|
+
export declare function sameLesson(a: Entry, b: Entry): boolean;
|
package/dist/src/conflicts.js
CHANGED
|
@@ -130,3 +130,25 @@ export function scopesOverlap(a, b) {
|
|
|
130
130
|
return pa.slice(0, n).every((s, i) => s === pb[i]);
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
+
/** Functions, file paths and code spans a rule names: `withRetry()`, `services/http.ts`. */
|
|
134
|
+
export function codeReferences(text) {
|
|
135
|
+
const found = text.match(/[A-Za-z_$][\w$.]*\(\)|[\w.-]+(?:\/[\w.-]+)+\.\w{1,5}|`[^`\n]+`/g) ?? [];
|
|
136
|
+
return new Set(found.map((s) => s.replace(/`/g, "").toLowerCase()));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Whether two rules teach the same lesson, for the daily run: near-identical titles, or the same
|
|
140
|
+
* code named in both (two people rarely word a lesson alike, but they name the same function).
|
|
141
|
+
* Scopes must overlap either way.
|
|
142
|
+
*/
|
|
143
|
+
export function sameLesson(a, b) {
|
|
144
|
+
if (!scopesOverlap(a.frontmatter.scope, b.frontmatter.scope))
|
|
145
|
+
return false;
|
|
146
|
+
if (titleSimilarity(a.frontmatter.title, b.frontmatter.title) >= TITLE_SIMILARITY)
|
|
147
|
+
return true;
|
|
148
|
+
const ra = codeReferences(a.sections.rule ?? "");
|
|
149
|
+
const rb = codeReferences(b.sections.rule ?? "");
|
|
150
|
+
if (ra.size === 0 || rb.size === 0)
|
|
151
|
+
return false;
|
|
152
|
+
const shared = [...ra].filter((r) => rb.has(r)).length;
|
|
153
|
+
return shared / new Set([...ra, ...rb]).size >= 0.5;
|
|
154
|
+
}
|
package/dist/src/events.js
CHANGED
|
@@ -116,6 +116,15 @@ export function describeEvent(e) {
|
|
|
116
116
|
return `${rest.entries?.join(", ") ?? ""} in ${rest.url}`;
|
|
117
117
|
case "agent-run":
|
|
118
118
|
return `${rest.agent} ${rest.ok ? "ok" : "failed"}: ${rest.summary ?? ""}`;
|
|
119
|
+
case "doc-read":
|
|
120
|
+
return `${rest.doc}${rest.section ? `#${rest.section}` : ""}`;
|
|
121
|
+
case "doc-injection": {
|
|
122
|
+
const docs = rest.docs ?? [];
|
|
123
|
+
const sections = rest.sections ?? [];
|
|
124
|
+
return `${docs.length} document${docs.length === 1 ? "" : "s"} listed, ${sections.length} section${sections.length === 1 ? "" : "s"} included`;
|
|
125
|
+
}
|
|
126
|
+
case "seed-run":
|
|
127
|
+
return `${rest.repo}: ${rest.topics?.join(", ") ?? ""} from ${rest.paths} paths (${rest.chars} chars sent)`;
|
|
119
128
|
default:
|
|
120
129
|
return JSON.stringify(rest);
|
|
121
130
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { bedrockAsker, bedrockModelId, type CloudAskerOptions, type CloudClient,
|
|
|
8
8
|
export { CODEOWNERS_FILE, generateCodeowners } from "./codeowners.ts";
|
|
9
9
|
export { type Confidence, type ConfidenceInput, confidence, explainConfidence, } from "./confidence.ts";
|
|
10
10
|
export { CONFIG_FILE, type Config, configSchema, DEFAULT_AGENT_MODEL, DEFAULT_WEIGHTS, EXPORT_TARGETS, isSenior, parseConfig, ROLES, type Role, type Weights, } from "./config.ts";
|
|
11
|
-
export { type Conflict, type ConflictKind, detectConflicts, scopesOverlap, TITLE_SIMILARITY, titleSimilarity, } from "./conflicts.ts";
|
|
11
|
+
export { type Conflict, type ConflictKind, codeReferences, detectConflicts, sameLesson, scopesOverlap, TITLE_SIMILARITY, titleSimilarity, } from "./conflicts.ts";
|
|
12
12
|
export { type AgentName, cronMatches, digestCron, digestDue, dueAgents, nextRun, } from "./cron.ts";
|
|
13
13
|
export { type CuratedEntry, CurateError, type CurateInput, type CurateResult, curate, type DocUpdate, type Skipped, } from "./curator/curate.ts";
|
|
14
14
|
export { ClaudeDocPatcher, DOC_PATCH_SYSTEM, type DocCandidate, type DocPatcher, type DocProposal, docPatchPrompt, docPatchSchema, } from "./curator/doc-patcher.ts";
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { bedrockAsker, bedrockModelId, vertexAsker, } from "./cloud.js";
|
|
|
8
8
|
export { CODEOWNERS_FILE, generateCodeowners } from "./codeowners.js";
|
|
9
9
|
export { confidence, explainConfidence, } from "./confidence.js";
|
|
10
10
|
export { CONFIG_FILE, configSchema, DEFAULT_AGENT_MODEL, DEFAULT_WEIGHTS, EXPORT_TARGETS, isSenior, parseConfig, ROLES, } from "./config.js";
|
|
11
|
-
export { detectConflicts, scopesOverlap, TITLE_SIMILARITY, titleSimilarity, } from "./conflicts.js";
|
|
11
|
+
export { codeReferences, detectConflicts, sameLesson, scopesOverlap, TITLE_SIMILARITY, titleSimilarity, } from "./conflicts.js";
|
|
12
12
|
export { cronMatches, digestCron, digestDue, dueAgents, nextRun, } from "./cron.js";
|
|
13
13
|
export { CurateError, curate, } from "./curator/curate.js";
|
|
14
14
|
export { ClaudeDocPatcher, DOC_PATCH_SYSTEM, docPatchPrompt, docPatchSchema, } from "./curator/doc-patcher.js";
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The release version; `scripts/version.mjs` keeps it in step with every package.json. */
|
|
2
|
-
export declare const VERSION = "0.1.
|
|
2
|
+
export declare const VERSION = "0.1.3";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The release version; `scripts/version.mjs` keeps it in step with every package.json. */
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.3";
|