@unisonlabs/sixminute-admin 0.1.1317-next → 0.1.1320-next
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/sixminute-admin.mjs +118 -5
- package/package.json +1 -1
package/dist/sixminute-admin.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { homedir } from "node:os";
|
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
|
|
23
23
|
// tools/admin/src/build-info.ts
|
|
24
|
-
var BUILT = { version: "0.1.
|
|
24
|
+
var BUILT = { version: "0.1.1320-next", commit: "d38eeb6af899eb78371236cc2761f69908f21297", surface: "b6f5e5ab99843501" };
|
|
25
25
|
|
|
26
26
|
// tools/admin/src/run.ts
|
|
27
27
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -5043,7 +5043,8 @@ var JobKindSchema = oneOf([
|
|
|
5043
5043
|
"scrub_plaintext",
|
|
5044
5044
|
"purge_expired",
|
|
5045
5045
|
"research_purge",
|
|
5046
|
-
"sweep"
|
|
5046
|
+
"sweep",
|
|
5047
|
+
"matter_learning"
|
|
5047
5048
|
]);
|
|
5048
5049
|
var SettingSchema = oneOf([
|
|
5049
5050
|
"unit_minutes",
|
|
@@ -6493,7 +6494,8 @@ var CompletionPurposeSchema = exports_external.enum([
|
|
|
6493
6494
|
"judge_shortlist",
|
|
6494
6495
|
"judge_calendar_event",
|
|
6495
6496
|
"judge_calendar_matter",
|
|
6496
|
-
"judge_calendar_attendance"
|
|
6497
|
+
"judge_calendar_attendance",
|
|
6498
|
+
"learn_terms"
|
|
6497
6499
|
]);
|
|
6498
6500
|
var CompletionDecisionSchema = exports_external.object({
|
|
6499
6501
|
property: exports_external.string().min(1),
|
|
@@ -6732,6 +6734,50 @@ var AdminNarrativeActivitiesSchema = exports_external.object({
|
|
|
6732
6734
|
language: NarrativeLanguageSchema,
|
|
6733
6735
|
activities: exports_external.array(NarrativeActivitySchema)
|
|
6734
6736
|
});
|
|
6737
|
+
var AdminLearningQuerySchema = exports_external.object({
|
|
6738
|
+
member: MemberIdSchema.optional(),
|
|
6739
|
+
from: exports_external.string().date().optional(),
|
|
6740
|
+
to: exports_external.string().date().optional()
|
|
6741
|
+
});
|
|
6742
|
+
var AdminLearnedTermSchema = exports_external.object({
|
|
6743
|
+
member_id: MemberIdSchema,
|
|
6744
|
+
email: exports_external.string(),
|
|
6745
|
+
scope: exports_external.enum(["matter", "client"]),
|
|
6746
|
+
owner_id: exports_external.string(),
|
|
6747
|
+
matter_code: exports_external.string().nullable(),
|
|
6748
|
+
client_name: exports_external.string().nullable(),
|
|
6749
|
+
term: exports_external.string(),
|
|
6750
|
+
kind: exports_external.string(),
|
|
6751
|
+
status: exports_external.enum(["candidate", "promoted"]),
|
|
6752
|
+
sightings: exports_external.number().int(),
|
|
6753
|
+
first_seen: exports_external.string(),
|
|
6754
|
+
last_seen: exports_external.string()
|
|
6755
|
+
});
|
|
6756
|
+
var AdminLearnedTermsSchema = exports_external.object({
|
|
6757
|
+
tenant: exports_external.object({ id: TenantIdSchema, name: exports_external.string() }),
|
|
6758
|
+
terms: exports_external.array(AdminLearnedTermSchema)
|
|
6759
|
+
});
|
|
6760
|
+
var AdminLearningRanksSchema = exports_external.object({ at1: exports_external.number().int(), top20: exports_external.number().int() });
|
|
6761
|
+
var AdminLearningMemberReportSchema = exports_external.object({
|
|
6762
|
+
member_id: MemberIdSchema,
|
|
6763
|
+
email: exports_external.string(),
|
|
6764
|
+
intervals: exports_external.number().int(),
|
|
6765
|
+
decided_by: exports_external.record(exports_external.string(), exports_external.number().int()),
|
|
6766
|
+
lifted: exports_external.number().int(),
|
|
6767
|
+
scored: exports_external.number().int(),
|
|
6768
|
+
baseline: AdminLearningRanksSchema,
|
|
6769
|
+
learned: AdminLearningRanksSchema,
|
|
6770
|
+
picked_right: exports_external.number().int(),
|
|
6771
|
+
helped: exports_external.number().int(),
|
|
6772
|
+
hurt: exports_external.number().int(),
|
|
6773
|
+
lifts: exports_external.array(exports_external.object({ matter_id: exports_external.string(), lifted: exports_external.number().int(), right: exports_external.number().int(), wrong: exports_external.number().int() }))
|
|
6774
|
+
});
|
|
6775
|
+
var AdminLearningReportSchema = exports_external.object({
|
|
6776
|
+
tenant: exports_external.object({ id: TenantIdSchema, name: exports_external.string() }),
|
|
6777
|
+
from: exports_external.string(),
|
|
6778
|
+
to: exports_external.string(),
|
|
6779
|
+
members: exports_external.array(AdminLearningMemberReportSchema)
|
|
6780
|
+
});
|
|
6735
6781
|
// packages/contracts/src/admin-firm-acting.ts
|
|
6736
6782
|
var ACTING_AS_HEADER = "X-Six-Minute-Acting-As";
|
|
6737
6783
|
var TeamApplyRequestSchema = exports_external.object({
|
|
@@ -8671,6 +8717,58 @@ async function runDemo(run2, subcommand) {
|
|
|
8671
8717
|
throw new AdminUsageError(`unknown command: demo ${subcommand ?? ""}`.trim());
|
|
8672
8718
|
}
|
|
8673
8719
|
|
|
8720
|
+
// tools/admin/src/learning.ts
|
|
8721
|
+
var DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
8722
|
+
var pct = (n, of) => of === 0 ? "-" : `${(100 * n / of).toFixed(1)}%`;
|
|
8723
|
+
async function runLearning(run2, subcommand) {
|
|
8724
|
+
const { flags } = run2;
|
|
8725
|
+
const tenant = required(flags, "tenant", "whose matter learning");
|
|
8726
|
+
const query = new URLSearchParams;
|
|
8727
|
+
const member = optional(flags, "member");
|
|
8728
|
+
if (member !== undefined)
|
|
8729
|
+
query.set("member", member);
|
|
8730
|
+
if (subcommand === "terms") {
|
|
8731
|
+
const answer = await call(run2.api, "GET", `${tenantPath(tenant, "/learning/terms")}${query.size === 0 ? "" : `?${query}`}`);
|
|
8732
|
+
if (answer.status !== 200)
|
|
8733
|
+
return refused(run2, answer, [actingHead(tenant, answer)]);
|
|
8734
|
+
const { terms } = AdminLearnedTermsSchema.parse(answer.body);
|
|
8735
|
+
const promoted = terms.filter((t) => t.status === "promoted").length;
|
|
8736
|
+
return render(run2, { member: member ?? null, terms }, [
|
|
8737
|
+
actingHead(tenant, answer),
|
|
8738
|
+
`${terms.length} term(s), ${promoted} promoted`,
|
|
8739
|
+
...terms.map((t) => [
|
|
8740
|
+
` ${t.email}`,
|
|
8741
|
+
t.scope === "matter" ? `matter ${t.matter_code ?? t.owner_id}` : `client ${t.client_name ?? t.owner_id}`,
|
|
8742
|
+
t.kind,
|
|
8743
|
+
t.status,
|
|
8744
|
+
`${t.sightings} sighting(s)`,
|
|
8745
|
+
`${t.first_seen.slice(0, 10)}..${t.last_seen.slice(0, 10)}`,
|
|
8746
|
+
JSON.stringify(t.term)
|
|
8747
|
+
].join(" "))
|
|
8748
|
+
]);
|
|
8749
|
+
}
|
|
8750
|
+
if (subcommand === "report") {
|
|
8751
|
+
for (const name of ["from", "to"]) {
|
|
8752
|
+
const value = optional(flags, name);
|
|
8753
|
+
if (value === undefined)
|
|
8754
|
+
continue;
|
|
8755
|
+
if (!DATE.test(value))
|
|
8756
|
+
throw new AdminUsageError(`--${name} is a date, YYYY-MM-DD, got ${JSON.stringify(value)}`);
|
|
8757
|
+
query.set(name, value);
|
|
8758
|
+
}
|
|
8759
|
+
const answer = await call(run2.api, "GET", `${tenantPath(tenant, "/learning/report")}${query.size === 0 ? "" : `?${query}`}`);
|
|
8760
|
+
if (answer.status !== 200)
|
|
8761
|
+
return refused(run2, answer, [actingHead(tenant, answer)]);
|
|
8762
|
+
const report = AdminLearningReportSchema.parse(answer.body);
|
|
8763
|
+
const lines = [actingHead(tenant, answer), `window ${report.from} to ${report.to}`];
|
|
8764
|
+
for (const m of report.members) {
|
|
8765
|
+
lines.push("", `${m.email} ${m.member_id}`, ` intervals ${m.intervals}, ${m.lifted} lifted by a learned term, ${m.scored} under a released entry`, ` decided by ${Object.entries(m.decided_by).sort().map(([kind, n]) => `${kind} ${n}`).join(", ") || "-"}`, ` rank@1 baseline ${pct(m.baseline.at1, m.scored)} learned ${pct(m.learned.at1, m.scored)}`, ` top 20 baseline ${pct(m.baseline.top20, m.scored)} learned ${pct(m.learned.top20, m.scored)}`, ` charged ${pct(m.picked_right, m.scored)} the released matter`, ` lifts ${m.helped} helped, ${m.hurt} hurt`, ...m.lifts.slice(0, 10).map((l) => ` ${l.matter_id} lifted ${l.lifted} right ${l.right} wrong ${l.wrong}`));
|
|
8766
|
+
}
|
|
8767
|
+
return render(run2, report, lines);
|
|
8768
|
+
}
|
|
8769
|
+
throw new AdminUsageError(`unknown command: learning ${subcommand ?? ""}`.trim());
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8674
8772
|
// tools/admin/src/member.ts
|
|
8675
8773
|
var enc = encodeURIComponent;
|
|
8676
8774
|
async function runMember(run2, subcommand) {
|
|
@@ -8963,6 +9061,19 @@ is required; without one every command answers 403.
|
|
|
8963
9061
|
empty table, a repeated key, or a table where no row has a pattern in
|
|
8964
9062
|
the firm's default narrative language.
|
|
8965
9063
|
|
|
9064
|
+
sixminute-admin learning terms --env <env> --tenant tenant_... [--member member_...] [--json]
|
|
9065
|
+
The learned matter terms of one member, or of every member of the
|
|
9066
|
+
firm, opened: member, matter or client, kind, status, how many entries
|
|
9067
|
+
carried it, first and last seen, and the term. An internal firm only:
|
|
9068
|
+
the terms are copied from a lawyer's screens. Each read is audited.
|
|
9069
|
+
|
|
9070
|
+
sixminute-admin learning report --env <env> --tenant tenant_... [--member member_...] [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--json]
|
|
9071
|
+
Matter learning's shadow comparison, per member, over the window (the
|
|
9072
|
+
last 30 days by default): how often the matter the person released was
|
|
9073
|
+
first, and in the first 20, of the word order without learned terms
|
|
9074
|
+
and with them, how often the matter call charged it, and how many lifts
|
|
9075
|
+
helped or hurt. Matter ids and counts only.
|
|
9076
|
+
|
|
8966
9077
|
sixminute-admin pipeline shadow-report --env <env> --day YYYY-MM-DD [--json]
|
|
8967
9078
|
The cloud pipeline's shadow against the device for one local day, for
|
|
8968
9079
|
every person of an internal firm with a shadow recording: intervals
|
|
@@ -9399,6 +9510,8 @@ async function runAdmin(argv, deps) {
|
|
|
9399
9510
|
return runTenantShow(run2);
|
|
9400
9511
|
if (group === "member")
|
|
9401
9512
|
return runMember(run2, subcommand);
|
|
9513
|
+
if (group === "learning")
|
|
9514
|
+
return runLearning(run2, subcommand);
|
|
9402
9515
|
if (group === "client")
|
|
9403
9516
|
return runClient(run2, subcommand);
|
|
9404
9517
|
if (group === "matter")
|
|
@@ -9585,10 +9698,10 @@ async function runRawArchive(run2, subcommand) {
|
|
|
9585
9698
|
async function runShadowReport(run2) {
|
|
9586
9699
|
const day2 = required(run2.flags, "day", "which local day, YYYY-MM-DD");
|
|
9587
9700
|
const found = ShadowReportSchema.parse(expectOk(await call(run2.api, "GET", `/v1/admin/pipeline/shadow-report?day=${encodeURIComponent(day2)}`)));
|
|
9588
|
-
const
|
|
9701
|
+
const pct2 = (part, whole) => whole === 0 ? "-" : `${Math.round(100 * part / whole)}%`;
|
|
9589
9702
|
return render(run2, found, [
|
|
9590
9703
|
`day ${found.day}`,
|
|
9591
|
-
...found.people.length === 0 ? ["no shadow recording on this day"] : found.people.map((p) => `${p.member_id} intervals device ${p.intervals_device} cloud ${p.intervals_cloud} both ${p.intervals_both}, ` + `same matter ${
|
|
9704
|
+
...found.people.length === 0 ? ["no shadow recording on this day"] : found.people.map((p) => `${p.member_id} intervals device ${p.intervals_device} cloud ${p.intervals_cloud} both ${p.intervals_both}, ` + `same matter ${pct2(p.matter_agree, p.intervals_both)}; minutes device ${p.minutes_device} cloud ${p.minutes_cloud}, ` + `same matter ${pct2(p.minutes_matter_agree, p.minutes_device)}, same client ${pct2(p.minutes_client_agree, p.minutes_device)}; ` + `latency p50 ${p.latency_p50_s ?? "-"} s p95 ${p.latency_p95_s ?? "-"} s; $${p.cost_usd.toFixed(3)}; ` + `failed ${p.runs_failed} held ${p.runs_held}`)
|
|
9592
9705
|
]);
|
|
9593
9706
|
}
|
|
9594
9707
|
async function runRetentionSet(run2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unisonlabs/sixminute-admin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1320-next",
|
|
4
4
|
"description": "Sixminute operator tool: the admin commands of the Sixminute API, run with your own operator sign-in.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|