modelstat 0.11.0 → 0.11.1
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/cli.mjs +13 -74
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -99,8 +99,7 @@ async function resolveGitContext(cwd) {
|
|
|
99
99
|
remote_url: null,
|
|
100
100
|
remote_host: null,
|
|
101
101
|
remote_slug: null,
|
|
102
|
-
branch: null
|
|
103
|
-
commit_sha: null
|
|
102
|
+
branch: null
|
|
104
103
|
};
|
|
105
104
|
cache.set(target, empty);
|
|
106
105
|
return empty;
|
|
@@ -115,14 +114,12 @@ async function resolveGitContext(cwd) {
|
|
|
115
114
|
};
|
|
116
115
|
const remoteUrl = await ran(["config", "--get", "remote.origin.url"]);
|
|
117
116
|
const branch = await ran(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
118
|
-
const sha = await ran(["rev-parse", "HEAD"]);
|
|
119
117
|
const parsed = remoteUrl ? parseRemote(remoteUrl) : { host: null, slug: null };
|
|
120
118
|
const ctx = {
|
|
121
119
|
remote_url: remoteUrl,
|
|
122
120
|
remote_host: parsed.host,
|
|
123
121
|
remote_slug: parsed.slug,
|
|
124
|
-
branch
|
|
125
|
-
commit_sha: sha
|
|
122
|
+
branch
|
|
126
123
|
};
|
|
127
124
|
cache.set(target, ctx);
|
|
128
125
|
return ctx;
|
|
@@ -4740,7 +4737,7 @@ var init_redact = __esm({
|
|
|
4740
4737
|
|
|
4741
4738
|
// ../../packages/core/src/session-metadata.ts
|
|
4742
4739
|
function emptyDetectedRefs() {
|
|
4743
|
-
return { repos: [], pull_requests: [],
|
|
4740
|
+
return { repos: [], pull_requests: [], issues: [] };
|
|
4744
4741
|
}
|
|
4745
4742
|
function repoFrom(host, slug, source) {
|
|
4746
4743
|
return { host, slug, branches: [], source };
|
|
@@ -4826,21 +4823,6 @@ function detectReferences(text, source = "content") {
|
|
|
4826
4823
|
confidence: 0.9
|
|
4827
4824
|
});
|
|
4828
4825
|
}
|
|
4829
|
-
for (const m of text.matchAll(GITHUB_COMMIT)) {
|
|
4830
|
-
const slug = `${m[1]}/${m[2]}`;
|
|
4831
|
-
out.commits.push({ sha: m[3] ?? "", slug, url: m[0], source, confidence: 0.95 });
|
|
4832
|
-
out.repos.push(repoFrom("github.com", slug, source));
|
|
4833
|
-
}
|
|
4834
|
-
for (const m of text.matchAll(GITLAB_COMMIT)) {
|
|
4835
|
-
out.commits.push({
|
|
4836
|
-
sha: m[2] ?? "",
|
|
4837
|
-
slug: m[1] ?? null,
|
|
4838
|
-
url: m[0],
|
|
4839
|
-
source,
|
|
4840
|
-
confidence: 0.95
|
|
4841
|
-
});
|
|
4842
|
-
if (m[1]) out.repos.push(repoFrom("gitlab.com", m[1], source));
|
|
4843
|
-
}
|
|
4844
4826
|
for (const m of text.matchAll(SLUG_HASH)) {
|
|
4845
4827
|
const slug = m[1] ?? "";
|
|
4846
4828
|
const lead = text.slice(Math.max(0, (m.index ?? 0) - 20), m.index ?? 0).toLowerCase();
|
|
@@ -4911,7 +4893,6 @@ function dedupeSessionMetadata(parts) {
|
|
|
4911
4893
|
for (const p of parts) {
|
|
4912
4894
|
all.repos.push(...p.repos);
|
|
4913
4895
|
all.pull_requests.push(...p.pull_requests);
|
|
4914
|
-
all.commits.push(...p.commits);
|
|
4915
4896
|
all.issues.push(...p.issues);
|
|
4916
4897
|
}
|
|
4917
4898
|
const repos = dedupe(
|
|
@@ -4940,22 +4921,6 @@ function dedupeSessionMetadata(parts) {
|
|
|
4940
4921
|
};
|
|
4941
4922
|
}
|
|
4942
4923
|
);
|
|
4943
|
-
const commits = dedupe(
|
|
4944
|
-
all.commits,
|
|
4945
|
-
// Key on slug + sha: two different commits in two repos can share a short
|
|
4946
|
-
// 7-hex prefix, and must not collapse into one.
|
|
4947
|
-
(c) => `${(c.slug ?? "").toLowerCase()}@${c.sha.toLowerCase()}`,
|
|
4948
|
-
(a, b) => {
|
|
4949
|
-
const [win, lose] = score(a) >= score(b) ? [a, b] : [b, a];
|
|
4950
|
-
return {
|
|
4951
|
-
sha: win.sha,
|
|
4952
|
-
slug: win.slug ?? lose.slug,
|
|
4953
|
-
url: win.url ?? lose.url,
|
|
4954
|
-
source: win.source,
|
|
4955
|
-
confidence: Math.max(win.confidence, lose.confidence)
|
|
4956
|
-
};
|
|
4957
|
-
}
|
|
4958
|
-
);
|
|
4959
4924
|
const issues = dedupe(
|
|
4960
4925
|
all.issues,
|
|
4961
4926
|
(i) => `${i.provider}:${(i.slug ?? "").toLowerCase()}#${i.key.toLowerCase()}`,
|
|
@@ -4979,12 +4944,11 @@ function dedupeSessionMetadata(parts) {
|
|
|
4979
4944
|
return {
|
|
4980
4945
|
repos: keepValid(RepoRef, repos).slice(0, 50),
|
|
4981
4946
|
pull_requests: keepValid(PullRequestRef, pull_requests).slice(0, 100),
|
|
4982
|
-
commits: keepValid(CommitRef, commits).slice(0, 200),
|
|
4983
4947
|
issues: keepValid(IssueRef, reconciledIssues).slice(0, 100)
|
|
4984
4948
|
};
|
|
4985
4949
|
}
|
|
4986
4950
|
function isEmptySessionMetadata(m) {
|
|
4987
|
-
return m.repos.length === 0 && m.pull_requests.length === 0 && m.
|
|
4951
|
+
return m.repos.length === 0 && m.pull_requests.length === 0 && m.issues.length === 0;
|
|
4988
4952
|
}
|
|
4989
4953
|
function detectEventReferences(text) {
|
|
4990
4954
|
if (!text) return null;
|
|
@@ -4993,11 +4957,10 @@ function detectEventReferences(text) {
|
|
|
4993
4957
|
return {
|
|
4994
4958
|
repos: m.repos.slice(0, 24),
|
|
4995
4959
|
pull_requests: m.pull_requests.slice(0, 24),
|
|
4996
|
-
commits: m.commits.slice(0, 24),
|
|
4997
4960
|
issues: m.issues.slice(0, 24)
|
|
4998
4961
|
};
|
|
4999
4962
|
}
|
|
5000
|
-
var REF_SOURCES, RefSource, SOURCE_RANK, RepoRef, PullRequestRef,
|
|
4963
|
+
var REF_SOURCES, RefSource, SOURCE_RANK, RepoRef, PullRequestRef, ISSUE_PROVIDERS, IssueRef, SessionMetadata, EventReferences, GITHUB_PR, GITLAB_MR, BITBUCKET_PR, GITHUB_ISSUE, GITLAB_ISSUE, LINEAR_ISSUE, JIRA_ISSUE, SLUG_HASH, BARE_TICKET;
|
|
5001
4964
|
var init_session_metadata = __esm({
|
|
5002
4965
|
"../../packages/core/src/session-metadata.ts"() {
|
|
5003
4966
|
"use strict";
|
|
@@ -5031,14 +4994,6 @@ var init_session_metadata = __esm({
|
|
|
5031
4994
|
hotfixed: external_exports.boolean().nullable().optional(),
|
|
5032
4995
|
reopened: external_exports.boolean().nullable().optional()
|
|
5033
4996
|
});
|
|
5034
|
-
CommitRef = external_exports.object({
|
|
5035
|
-
/** 7–40 char hex SHA. */
|
|
5036
|
-
sha: external_exports.string().max(64),
|
|
5037
|
-
slug: external_exports.string().max(200).nullable().default(null),
|
|
5038
|
-
url: external_exports.string().max(400).nullable().default(null),
|
|
5039
|
-
source: RefSource.default("content"),
|
|
5040
|
-
confidence: external_exports.number().min(0).max(1).default(0.8)
|
|
5041
|
-
});
|
|
5042
4997
|
ISSUE_PROVIDERS = [
|
|
5043
4998
|
"github",
|
|
5044
4999
|
"gitlab",
|
|
@@ -5058,13 +5013,11 @@ var init_session_metadata = __esm({
|
|
|
5058
5013
|
SessionMetadata = external_exports.object({
|
|
5059
5014
|
repos: external_exports.array(RepoRef).max(50).default([]),
|
|
5060
5015
|
pull_requests: external_exports.array(PullRequestRef).max(100).default([]),
|
|
5061
|
-
commits: external_exports.array(CommitRef).max(200).default([]),
|
|
5062
5016
|
issues: external_exports.array(IssueRef).max(100).default([])
|
|
5063
5017
|
});
|
|
5064
5018
|
EventReferences = external_exports.object({
|
|
5065
5019
|
repos: external_exports.array(RepoRef).max(24).default([]),
|
|
5066
5020
|
pull_requests: external_exports.array(PullRequestRef).max(24).default([]),
|
|
5067
|
-
commits: external_exports.array(CommitRef).max(24).default([]),
|
|
5068
5021
|
issues: external_exports.array(IssueRef).max(24).default([])
|
|
5069
5022
|
});
|
|
5070
5023
|
GITHUB_PR = /https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+)\/pull\/(\d+)/gi;
|
|
@@ -5072,8 +5025,6 @@ var init_session_metadata = __esm({
|
|
|
5072
5025
|
BITBUCKET_PR = /https?:\/\/bitbucket\.org\/([\w.-]+)\/([\w.-]+)\/pull-requests\/(\d+)/gi;
|
|
5073
5026
|
GITHUB_ISSUE = /https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+)\/issues\/(\d+)/gi;
|
|
5074
5027
|
GITLAB_ISSUE = /https?:\/\/gitlab\.com\/([\w./-]+?)\/-\/issues\/(\d+)/gi;
|
|
5075
|
-
GITHUB_COMMIT = /https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+)\/commit\/([0-9a-f]{7,40})/gi;
|
|
5076
|
-
GITLAB_COMMIT = /https?:\/\/gitlab\.com\/([\w./-]+?)\/-\/commit\/([0-9a-f]{7,40})/gi;
|
|
5077
5028
|
LINEAR_ISSUE = /https?:\/\/linear\.app\/[\w.-]+\/issue\/([A-Z][A-Z0-9]*-\d+)/gi;
|
|
5078
5029
|
JIRA_ISSUE = /https?:\/\/[\w.-]+\/browse\/([A-Z][A-Z0-9]+-\d+)/gi;
|
|
5079
5030
|
SLUG_HASH = /(?:^|[\s([{<])([\w.-]+\/[\w.-]+)#(\d+)\b/g;
|
|
@@ -5103,8 +5054,7 @@ var init_schemas = __esm({
|
|
|
5103
5054
|
// "github.com"
|
|
5104
5055
|
remote_slug: external_exports.string().nullable(),
|
|
5105
5056
|
// "org/repo"
|
|
5106
|
-
branch: external_exports.string().nullable()
|
|
5107
|
-
commit_sha: external_exports.string().nullable()
|
|
5057
|
+
branch: external_exports.string().nullable()
|
|
5108
5058
|
});
|
|
5109
5059
|
RawEvent = external_exports.object({
|
|
5110
5060
|
source_event_id: external_exports.string(),
|
|
@@ -5141,7 +5091,7 @@ var init_schemas = __esm({
|
|
|
5141
5091
|
// summarize prompt; it never gets stored long-term server-side, only
|
|
5142
5092
|
// used to construct the summarize input.
|
|
5143
5093
|
content_excerpt: external_exports.string().max(320).optional(),
|
|
5144
|
-
// Public code references (PRs, issues,
|
|
5094
|
+
// Public code references (PRs, issues, repos) detected on-device
|
|
5145
5095
|
// from this turn's FULL text — the high-recall feed the server rolls up into
|
|
5146
5096
|
// SessionMetadata. Only public reference shapes (forge URLs, slugs, numbers,
|
|
5147
5097
|
// ticket keys) ride here, never raw text — so it is derived pre-redaction
|
|
@@ -5299,7 +5249,7 @@ var init_schemas = __esm({
|
|
|
5299
5249
|
* no-op browser summariser). */
|
|
5300
5250
|
session_titles: external_exports.record(external_exports.string(), external_exports.string().max(120)).optional(),
|
|
5301
5251
|
/** Optional per-session deterministic metadata — session_id →
|
|
5302
|
-
* {@link SessionMetadata}: the repos, pull requests,
|
|
5252
|
+
* {@link SessionMetadata}: the repos, pull requests, and issues the
|
|
5303
5253
|
* session touched, detected on-device across git context, tool calls,
|
|
5304
5254
|
* redacted content, and the local model (so it works for any provider).
|
|
5305
5255
|
* Additive — old daemons omit it, old servers ignore it (the wire has no
|
|
@@ -6043,8 +5993,7 @@ async function parseClaudeCodeJsonl(ctx) {
|
|
|
6043
5993
|
remote_url: null,
|
|
6044
5994
|
remote_host: slug?.includes("/") ? "github.com" : null,
|
|
6045
5995
|
remote_slug: slug,
|
|
6046
|
-
branch: gitBranch
|
|
6047
|
-
commit_sha: null
|
|
5996
|
+
branch: gitBranch
|
|
6048
5997
|
} : null,
|
|
6049
5998
|
tokens: {
|
|
6050
5999
|
input: usage.input_tokens ?? 0,
|
|
@@ -6421,8 +6370,7 @@ async function parseCodexRollout(ctx) {
|
|
|
6421
6370
|
remote_url: null,
|
|
6422
6371
|
remote_host: slug.includes("/") ? "github.com" : null,
|
|
6423
6372
|
remote_slug: slug,
|
|
6424
|
-
branch: null
|
|
6425
|
-
commit_sha: null
|
|
6373
|
+
branch: null
|
|
6426
6374
|
} : null,
|
|
6427
6375
|
tokens: {
|
|
6428
6376
|
input: tk.input_tokens ?? 0,
|
|
@@ -35538,15 +35486,6 @@ async function buildSessionMetadata(segments, events, opts = {}) {
|
|
|
35538
35486
|
});
|
|
35539
35487
|
}
|
|
35540
35488
|
if (e.git.branch) refs.issues.push(...detectBranchTickets(e.git.branch));
|
|
35541
|
-
if (e.git.commit_sha) {
|
|
35542
|
-
refs.commits.push({
|
|
35543
|
-
sha: e.git.commit_sha,
|
|
35544
|
-
slug: e.git.remote_slug ?? null,
|
|
35545
|
-
url: null,
|
|
35546
|
-
source: "git",
|
|
35547
|
-
confidence: 0.6
|
|
35548
|
-
});
|
|
35549
|
-
}
|
|
35550
35489
|
parts.push(refs);
|
|
35551
35490
|
}
|
|
35552
35491
|
if (opts.resolveGit) {
|
|
@@ -37328,7 +37267,7 @@ var init_scan = __esm({
|
|
|
37328
37267
|
init_api();
|
|
37329
37268
|
init_config2();
|
|
37330
37269
|
init_pipeline2();
|
|
37331
|
-
DAEMON_VERSION = true ? "daemon-0.11.
|
|
37270
|
+
DAEMON_VERSION = true ? "daemon-0.11.1" : "daemon-dev";
|
|
37332
37271
|
BATCH_MAX_EVENTS = INGEST_BATCH_MAX_EVENTS;
|
|
37333
37272
|
BATCH_MAX_TOOL_CALLS = 2e4;
|
|
37334
37273
|
BATCH_BUFFER_HARD_CAP = BATCH_MAX_EVENTS * 2;
|
|
@@ -40275,7 +40214,7 @@ var init_daemon = __esm({
|
|
|
40275
40214
|
init_scan();
|
|
40276
40215
|
init_single_flight();
|
|
40277
40216
|
init_update();
|
|
40278
|
-
DAEMON_VERSION2 = true ? "daemon-0.11.
|
|
40217
|
+
DAEMON_VERSION2 = true ? "daemon-0.11.1" : "daemon-dev";
|
|
40279
40218
|
HEARTBEAT_INTERVAL_MS = 1e4;
|
|
40280
40219
|
SCAN_INTERVAL_MS = 5 * 60 * 1e3;
|
|
40281
40220
|
DISCOVERY_INTERVAL_MS = 6e4;
|
|
@@ -40907,7 +40846,7 @@ function tryOpenBrowser(url) {
|
|
|
40907
40846
|
return false;
|
|
40908
40847
|
}
|
|
40909
40848
|
}
|
|
40910
|
-
var DAEMON_VERSION3 = true ? "daemon-0.11.
|
|
40849
|
+
var DAEMON_VERSION3 = true ? "daemon-0.11.1" : "daemon-dev";
|
|
40911
40850
|
function osFamily() {
|
|
40912
40851
|
const p = platform6();
|
|
40913
40852
|
if (p === "darwin") return "macos";
|