@mgsoftwarebv/mg-dashboard-mcp 7.4.26 → 7.4.27
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/index.js +349 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6430,6 +6430,7 @@ pgTable(
|
|
|
6430
6430
|
lastVerifiedOn: date("last_verified_on"),
|
|
6431
6431
|
verifyCount: integer("verify_count").notNull().default(0),
|
|
6432
6432
|
verifyNote: text("verify_note"),
|
|
6433
|
+
/** Pending git export. Not indexed: a dirty btree blocked HOT updates (2026-DASMG-208). */
|
|
6433
6434
|
dirty: boolean("dirty").notNull().default(false),
|
|
6434
6435
|
vaultSyncedAt: timestamp("vault_synced_at", { withTimezone: true }),
|
|
6435
6436
|
/** Flattened frontmatter aliases for tsv weight A. */
|
|
@@ -6445,7 +6446,6 @@ pgTable(
|
|
|
6445
6446
|
(table) => [
|
|
6446
6447
|
index("idx_wiki_page_status").on(table.status),
|
|
6447
6448
|
index("idx_wiki_page_last_verified").on(table.lastVerifiedOn),
|
|
6448
|
-
index("idx_wiki_page_dirty").on(table.dirty),
|
|
6449
6449
|
index("idx_wiki_page_lease_expires").on(table.leaseExpiresAt).where(sql`${table.leaseExpiresAt} IS NOT NULL`)
|
|
6450
6450
|
]
|
|
6451
6451
|
);
|
|
@@ -6497,6 +6497,54 @@ pgTable(
|
|
|
6497
6497
|
index("idx_wiki_page_evidence_created").on(table.createdAt)
|
|
6498
6498
|
]
|
|
6499
6499
|
);
|
|
6500
|
+
pgTable(
|
|
6501
|
+
"wiki_source_origin",
|
|
6502
|
+
{
|
|
6503
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
6504
|
+
sourceType: text("source_type").notNull(),
|
|
6505
|
+
sourceRef: text("source_ref").notNull(),
|
|
6506
|
+
originEventId: uuid("origin_event_id"),
|
|
6507
|
+
derivedFromType: text("derived_from_type"),
|
|
6508
|
+
derivedFromRef: text("derived_from_ref"),
|
|
6509
|
+
contentHash: text("content_hash"),
|
|
6510
|
+
contentVersion: text("content_version"),
|
|
6511
|
+
observationType: text("observation_type").notNull().default("unknown"),
|
|
6512
|
+
observedAt: timestamp("observed_at", { withTimezone: true }),
|
|
6513
|
+
fetchStatus: text("fetch_status").notNull().default("unknown"),
|
|
6514
|
+
clusterReason: text("cluster_reason"),
|
|
6515
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6516
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6517
|
+
},
|
|
6518
|
+
(table) => [
|
|
6519
|
+
uniqueIndex("wiki_source_origin_source_type_source_ref_key").on(
|
|
6520
|
+
table.sourceType,
|
|
6521
|
+
table.sourceRef
|
|
6522
|
+
),
|
|
6523
|
+
index("idx_wiki_source_origin_event").on(table.originEventId),
|
|
6524
|
+
index("idx_wiki_source_origin_hash").on(table.contentHash)
|
|
6525
|
+
]
|
|
6526
|
+
);
|
|
6527
|
+
pgTable(
|
|
6528
|
+
"wiki_evidence_decision",
|
|
6529
|
+
{
|
|
6530
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
6531
|
+
pageSlug: text("page_slug").notNull(),
|
|
6532
|
+
mode: text("mode").notNull(),
|
|
6533
|
+
contractVersion: text("contract_version").notNull(),
|
|
6534
|
+
sourceVersions: jsonb("source_versions").$type().notNull().default([]),
|
|
6535
|
+
clusters: jsonb("clusters").$type().notNull().default([]),
|
|
6536
|
+
clusterReasons: text("cluster_reasons").array().notNull().default([]),
|
|
6537
|
+
legacyConfidence: text("legacy_confidence"),
|
|
6538
|
+
originConfidence: text("origin_confidence"),
|
|
6539
|
+
liveAutoAccept: boolean("live_auto_accept").notNull().default(false),
|
|
6540
|
+
originAutoAccept: boolean("origin_auto_accept").notNull().default(false),
|
|
6541
|
+
hasConflict: boolean("has_conflict").notNull().default(false),
|
|
6542
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6543
|
+
},
|
|
6544
|
+
(table) => [
|
|
6545
|
+
index("idx_wiki_evidence_decision_slug").on(table.pageSlug, table.createdAt)
|
|
6546
|
+
]
|
|
6547
|
+
);
|
|
6500
6548
|
pgTable(
|
|
6501
6549
|
"wiki_page_link",
|
|
6502
6550
|
{
|
|
@@ -6523,11 +6571,16 @@ pgTable(
|
|
|
6523
6571
|
slug: text("slug").notNull(),
|
|
6524
6572
|
caller: text("caller"),
|
|
6525
6573
|
includedArchive: boolean("included_archive").notNull().default(false),
|
|
6574
|
+
requestId: uuid("request_id"),
|
|
6575
|
+
sessionId: text("session_id"),
|
|
6576
|
+
taskId: text("task_id"),
|
|
6577
|
+
callerKind: text("caller_kind"),
|
|
6526
6578
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6527
6579
|
},
|
|
6528
6580
|
(table) => [
|
|
6529
6581
|
index("idx_wiki_page_read_slug").on(table.slug, table.createdAt),
|
|
6530
|
-
index("idx_wiki_page_read_created").on(table.createdAt)
|
|
6582
|
+
index("idx_wiki_page_read_created").on(table.createdAt),
|
|
6583
|
+
index("idx_wiki_page_read_request_id").on(table.requestId)
|
|
6531
6584
|
]
|
|
6532
6585
|
);
|
|
6533
6586
|
pgTable(
|
|
@@ -6616,9 +6669,17 @@ pgTable(
|
|
|
6616
6669
|
topScore: real("top_score"),
|
|
6617
6670
|
topSlug: text("top_slug"),
|
|
6618
6671
|
caller: text("caller"),
|
|
6672
|
+
requestId: uuid("request_id"),
|
|
6673
|
+
sessionId: text("session_id"),
|
|
6674
|
+
taskId: text("task_id"),
|
|
6675
|
+
callerKind: text("caller_kind"),
|
|
6676
|
+
configRevision: text("config_revision"),
|
|
6619
6677
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6620
6678
|
},
|
|
6621
|
-
(table) => [
|
|
6679
|
+
(table) => [
|
|
6680
|
+
index("idx_wiki_search_log_created").on(table.createdAt),
|
|
6681
|
+
index("idx_wiki_search_log_request_id").on(table.requestId)
|
|
6682
|
+
]
|
|
6622
6683
|
);
|
|
6623
6684
|
pgTable(
|
|
6624
6685
|
"team_memory_search_log",
|
|
@@ -6631,9 +6692,16 @@ pgTable(
|
|
|
6631
6692
|
caller: text("caller"),
|
|
6632
6693
|
repo: text("repo"),
|
|
6633
6694
|
confident: boolean("confident"),
|
|
6695
|
+
requestId: uuid("request_id"),
|
|
6696
|
+
sessionId: text("session_id"),
|
|
6697
|
+
taskId: text("task_id"),
|
|
6698
|
+
callerKind: text("caller_kind"),
|
|
6634
6699
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6635
6700
|
},
|
|
6636
|
-
(table) => [
|
|
6701
|
+
(table) => [
|
|
6702
|
+
index("idx_team_memory_search_log_created").on(table.createdAt),
|
|
6703
|
+
index("idx_team_memory_search_log_request_id").on(table.requestId)
|
|
6704
|
+
]
|
|
6637
6705
|
);
|
|
6638
6706
|
pgTable(
|
|
6639
6707
|
"wiki_agent_run",
|
|
@@ -6730,7 +6798,8 @@ pgTable("brain_config", {
|
|
|
6730
6798
|
key: text("key").primaryKey(),
|
|
6731
6799
|
value: jsonb("value").$type().notNull(),
|
|
6732
6800
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6733
|
-
updatedBy: text("updated_by")
|
|
6801
|
+
updatedBy: text("updated_by"),
|
|
6802
|
+
revision: bigint("revision", { mode: "number" }).notNull().default(1)
|
|
6734
6803
|
});
|
|
6735
6804
|
pgTable(
|
|
6736
6805
|
"brain_metrics_daily",
|
|
@@ -6782,18 +6851,61 @@ pgTable(
|
|
|
6782
6851
|
baselineMetrics: jsonb("baseline_metrics"),
|
|
6783
6852
|
outcomeMetrics: jsonb("outcome_metrics"),
|
|
6784
6853
|
verdict: text("verdict").notNull().default("pending"),
|
|
6854
|
+
operationalStatus: text("operational_status").notNull().default("pending"),
|
|
6855
|
+
effectVerdict: text("effect_verdict"),
|
|
6856
|
+
effectReason: text("effect_reason"),
|
|
6857
|
+
experiment: jsonb("experiment").$type().notNull().default({}),
|
|
6858
|
+
activatedAt: timestamp("activated_at", { withTimezone: true }),
|
|
6859
|
+
activationEvidence: jsonb("activation_evidence"),
|
|
6785
6860
|
evidenceRefs: text("evidence_refs").array().notNull().default([]),
|
|
6786
6861
|
createdBy: text("created_by"),
|
|
6787
6862
|
suggestionId: uuid("suggestion_id"),
|
|
6788
6863
|
ticketNumber: text("ticket_number"),
|
|
6789
6864
|
ticketId: text("ticket_id"),
|
|
6865
|
+
configRevision: bigint("config_revision", { mode: "number" }),
|
|
6866
|
+
mutationStatus: text("mutation_status").notNull().default("applied"),
|
|
6790
6867
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6791
6868
|
verdictAt: timestamp("verdict_at", { withTimezone: true }),
|
|
6792
6869
|
revertedAt: timestamp("reverted_at", { withTimezone: true })
|
|
6793
6870
|
},
|
|
6794
6871
|
(table) => [
|
|
6795
6872
|
index("idx_brain_change_ledger_verdict").on(table.verdict, table.createdAt),
|
|
6796
|
-
index("idx_brain_change_ledger_scope").on(table.scope, table.createdAt)
|
|
6873
|
+
index("idx_brain_change_ledger_scope").on(table.scope, table.createdAt),
|
|
6874
|
+
index("idx_brain_change_ledger_operational").on(
|
|
6875
|
+
table.operationalStatus,
|
|
6876
|
+
table.createdAt
|
|
6877
|
+
)
|
|
6878
|
+
]
|
|
6879
|
+
);
|
|
6880
|
+
pgTable(
|
|
6881
|
+
"brain_suggestion_implementation",
|
|
6882
|
+
{
|
|
6883
|
+
suggestionId: uuid("suggestion_id").primaryKey(),
|
|
6884
|
+
ledgerId: uuid("ledger_id").notNull(),
|
|
6885
|
+
claimedAt: timestamp("claimed_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6886
|
+
claimedBy: text("claimed_by")
|
|
6887
|
+
},
|
|
6888
|
+
(table) => [
|
|
6889
|
+
uniqueIndex("brain_suggestion_implementation_ledger_id_key").on(
|
|
6890
|
+
table.ledgerId
|
|
6891
|
+
)
|
|
6892
|
+
]
|
|
6893
|
+
);
|
|
6894
|
+
pgTable(
|
|
6895
|
+
"brain_ticket_outbox",
|
|
6896
|
+
{
|
|
6897
|
+
ledgerId: uuid("ledger_id").primaryKey(),
|
|
6898
|
+
idempotencyKey: text("idempotency_key").notNull(),
|
|
6899
|
+
status: text("status").notNull().default("pending"),
|
|
6900
|
+
ticketNumber: text("ticket_number"),
|
|
6901
|
+
ticketId: text("ticket_id"),
|
|
6902
|
+
attempts: integer("attempts").notNull().default(0),
|
|
6903
|
+
lastError: text("last_error"),
|
|
6904
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6905
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6906
|
+
},
|
|
6907
|
+
(table) => [
|
|
6908
|
+
uniqueIndex("brain_ticket_outbox_idempotency_key").on(table.idempotencyKey)
|
|
6797
6909
|
]
|
|
6798
6910
|
);
|
|
6799
6911
|
pgTable(
|
|
@@ -6829,6 +6941,134 @@ pgTable(
|
|
|
6829
6941
|
},
|
|
6830
6942
|
(table) => [index("idx_wiki_eval_label_snapshot").on(table.snapshotId)]
|
|
6831
6943
|
);
|
|
6944
|
+
pgTable("wiki_eval_dataset", {
|
|
6945
|
+
version: text("version").primaryKey(),
|
|
6946
|
+
evaluatorVersion: text("evaluator_version").notNull(),
|
|
6947
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6948
|
+
});
|
|
6949
|
+
pgTable(
|
|
6950
|
+
"wiki_eval_case",
|
|
6951
|
+
{
|
|
6952
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
6953
|
+
datasetVersion: text("dataset_version").notNull(),
|
|
6954
|
+
caseKey: text("case_key").notNull(),
|
|
6955
|
+
query: text("query").notNull(),
|
|
6956
|
+
language: text("language").notNull().default("en"),
|
|
6957
|
+
originEventId: text("origin_event_id").notNull(),
|
|
6958
|
+
partition: text("partition").notNull(),
|
|
6959
|
+
aclFolders: text("acl_folders").array().notNull().default([]),
|
|
6960
|
+
goldSlugs: text("gold_slugs").array().notNull().default([]),
|
|
6961
|
+
supportedSlugs: text("supported_slugs").array().notNull().default([]),
|
|
6962
|
+
labelKind: text("label_kind").notNull().default("gold"),
|
|
6963
|
+
unanswerable: boolean("unanswerable").notNull().default(false),
|
|
6964
|
+
queryEmbedding: real("query_embedding").array(),
|
|
6965
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6966
|
+
},
|
|
6967
|
+
(table) => [
|
|
6968
|
+
uniqueIndex("wiki_eval_case_dataset_version_case_key_key").on(
|
|
6969
|
+
table.datasetVersion,
|
|
6970
|
+
table.caseKey
|
|
6971
|
+
),
|
|
6972
|
+
index("idx_wiki_eval_case_origin").on(table.originEventId)
|
|
6973
|
+
]
|
|
6974
|
+
);
|
|
6975
|
+
pgTable(
|
|
6976
|
+
"wiki_eval_corpus_snapshot",
|
|
6977
|
+
{
|
|
6978
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
6979
|
+
version: text("version").notNull(),
|
|
6980
|
+
fingerprint: text("fingerprint").notNull(),
|
|
6981
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6982
|
+
},
|
|
6983
|
+
(table) => [
|
|
6984
|
+
uniqueIndex("wiki_eval_corpus_snapshot_version_key").on(table.version)
|
|
6985
|
+
]
|
|
6986
|
+
);
|
|
6987
|
+
pgTable(
|
|
6988
|
+
"wiki_eval_corpus_page",
|
|
6989
|
+
{
|
|
6990
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
6991
|
+
snapshotId: uuid("snapshot_id").notNull(),
|
|
6992
|
+
slug: text("slug").notNull(),
|
|
6993
|
+
title: text("title").notNull().default(""),
|
|
6994
|
+
content: text("content").notNull().default(""),
|
|
6995
|
+
aliases: text("aliases").array().notNull().default([]),
|
|
6996
|
+
embedding: real("embedding").array(),
|
|
6997
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6998
|
+
},
|
|
6999
|
+
(table) => [
|
|
7000
|
+
uniqueIndex("wiki_eval_corpus_page_snapshot_id_slug_key").on(
|
|
7001
|
+
table.snapshotId,
|
|
7002
|
+
table.slug
|
|
7003
|
+
),
|
|
7004
|
+
index("idx_wiki_eval_corpus_page_snapshot").on(table.snapshotId)
|
|
7005
|
+
]
|
|
7006
|
+
);
|
|
7007
|
+
pgTable(
|
|
7008
|
+
"wiki_eval_corpus_chunk",
|
|
7009
|
+
{
|
|
7010
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
7011
|
+
snapshotId: uuid("snapshot_id").notNull(),
|
|
7012
|
+
slug: text("slug").notNull(),
|
|
7013
|
+
headingPath: text("heading_path").notNull().default(""),
|
|
7014
|
+
chunkIndex: integer("chunk_index").notNull().default(0),
|
|
7015
|
+
content: text("content").notNull().default(""),
|
|
7016
|
+
embedding: real("embedding").array()
|
|
7017
|
+
},
|
|
7018
|
+
(table) => [
|
|
7019
|
+
index("idx_wiki_eval_corpus_chunk_snapshot_slug").on(
|
|
7020
|
+
table.snapshotId,
|
|
7021
|
+
table.slug
|
|
7022
|
+
)
|
|
7023
|
+
]
|
|
7024
|
+
);
|
|
7025
|
+
pgTable(
|
|
7026
|
+
"wiki_eval_run",
|
|
7027
|
+
{
|
|
7028
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
7029
|
+
datasetVersion: text("dataset_version").notNull(),
|
|
7030
|
+
corpusSnapshotId: uuid("corpus_snapshot_id"),
|
|
7031
|
+
evaluatorVersion: text("evaluator_version").notNull(),
|
|
7032
|
+
experimentId: text("experiment_id").notNull(),
|
|
7033
|
+
baselineVariantId: text("baseline_variant_id").notNull(),
|
|
7034
|
+
candidateVariantId: text("candidate_variant_id").notNull(),
|
|
7035
|
+
baselineConfig: jsonb("baseline_config").$type().notNull().default({}),
|
|
7036
|
+
candidateConfig: jsonb("candidate_config").$type().notNull().default({}),
|
|
7037
|
+
status: text("status").notNull().default("running"),
|
|
7038
|
+
availability: text("availability").notNull().default("incomplete"),
|
|
7039
|
+
plannedCases: integer("planned_cases").notNull().default(0),
|
|
7040
|
+
attemptedCases: integer("attempted_cases").notNull().default(0),
|
|
7041
|
+
completedPairs: integer("completed_pairs").notNull().default(0),
|
|
7042
|
+
failedCases: integer("failed_cases").notNull().default(0),
|
|
7043
|
+
timeoutCases: integer("timeout_cases").notNull().default(0),
|
|
7044
|
+
report: jsonb("report").$type().notNull().default({}),
|
|
7045
|
+
lockKey: text("lock_key"),
|
|
7046
|
+
startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
|
|
7047
|
+
heartbeatAt: timestamp("heartbeat_at", { withTimezone: true }).notNull().defaultNow(),
|
|
7048
|
+
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
7049
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
7050
|
+
},
|
|
7051
|
+
(table) => [
|
|
7052
|
+
index("idx_wiki_eval_run_created").on(table.createdAt),
|
|
7053
|
+
uniqueIndex("wiki_eval_run_lock_key_running_key").on(table.lockKey).where(sql`${table.status} = 'running'`)
|
|
7054
|
+
]
|
|
7055
|
+
);
|
|
7056
|
+
pgTable(
|
|
7057
|
+
"wiki_eval_trial",
|
|
7058
|
+
{
|
|
7059
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
7060
|
+
runId: uuid("run_id").notNull(),
|
|
7061
|
+
caseKey: text("case_key").notNull(),
|
|
7062
|
+
variantId: text("variant_id").notNull(),
|
|
7063
|
+
rankedSlugs: text("ranked_slugs").array().notNull().default([]),
|
|
7064
|
+
latencyMs: integer("latency_ms"),
|
|
7065
|
+
status: text("status").notNull().default("ok"),
|
|
7066
|
+
error: text("error"),
|
|
7067
|
+
costsAvailable: boolean("costs_available").notNull().default(false),
|
|
7068
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
7069
|
+
},
|
|
7070
|
+
(table) => [index("idx_wiki_eval_trial_run").on(table.runId)]
|
|
7071
|
+
);
|
|
6832
7072
|
pgTable("wiki_status_dirty", {
|
|
6833
7073
|
slug: text("slug").primaryKey(),
|
|
6834
7074
|
markedAt: timestamp("marked_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -6875,7 +7115,8 @@ pgTable(
|
|
|
6875
7115
|
index("idx_agent_memory_repo").on(table.gitRepository),
|
|
6876
7116
|
index("idx_agent_memory_user").on(table.userId),
|
|
6877
7117
|
index("idx_agent_memory_kind").on(table.kind),
|
|
6878
|
-
index("idx_agent_memory_automated_created").on(table.createdAt).where(sql`kind = 'automated'`)
|
|
7118
|
+
index("idx_agent_memory_automated_created").on(table.createdAt).where(sql`kind = 'automated'`),
|
|
7119
|
+
index("idx_agent_memory_non_transcript_join").on(table.localConversationId).where(sql`source IS DISTINCT FROM 'transcript'`)
|
|
6879
7120
|
]
|
|
6880
7121
|
);
|
|
6881
7122
|
var contentSourceType = pgEnum("content_source_type", [
|
|
@@ -9473,6 +9714,8 @@ var TRANSIENT_GITHUB_STATUSES = /* @__PURE__ */ new Set([
|
|
|
9473
9714
|
var DEFAULT_BUDGET_PER_MINUTE = 75;
|
|
9474
9715
|
var DEFAULT_INTERACTIVE_CACHE_MAX_AGE_MS = 5 * 6e4;
|
|
9475
9716
|
var DEFAULT_INTERACTIVE_STALE_MAX_AGE_MS = 30 * 6e4;
|
|
9717
|
+
var GITHUB_API_CACHE_MAX_BODY_BYTES = 1024 * 1024;
|
|
9718
|
+
var GITHUB_API_CACHE_META_COLUMNS = "etag, status, expires_at, updated_at";
|
|
9476
9719
|
var BUDGET_STATE_KEY = "github_api_budget_per_minute";
|
|
9477
9720
|
var DEFAULT_BLOCK_MS = 15 * 60 * 1e3;
|
|
9478
9721
|
var MAX_ATTEMPTS = 4;
|
|
@@ -9573,6 +9816,12 @@ function mergeGithubApiStatDelta(current, add) {
|
|
|
9573
9816
|
breakerHitCount: current.breakerHitCount + add.breakerHitCount
|
|
9574
9817
|
};
|
|
9575
9818
|
}
|
|
9819
|
+
function githubApiCacheBodyBytes(body) {
|
|
9820
|
+
return Buffer.byteLength(body, "utf8");
|
|
9821
|
+
}
|
|
9822
|
+
function shouldPersistGithubApiCacheBody(body) {
|
|
9823
|
+
return githubApiCacheBodyBytes(body) <= GITHUB_API_CACHE_MAX_BODY_BYTES;
|
|
9824
|
+
}
|
|
9576
9825
|
function cacheKeyFor(url, tokenKey) {
|
|
9577
9826
|
return createHash("sha256").update(`${tokenKey}:${url}`).digest("hex");
|
|
9578
9827
|
}
|
|
@@ -9825,9 +10074,9 @@ async function recordBreakerHit(input) {
|
|
|
9825
10074
|
breakerHit: true
|
|
9826
10075
|
});
|
|
9827
10076
|
}
|
|
9828
|
-
async function
|
|
10077
|
+
async function loadEtagCacheMeta(key) {
|
|
9829
10078
|
const rows = await getDb().execute(sql`
|
|
9830
|
-
SELECT
|
|
10079
|
+
SELECT ${sql.raw(GITHUB_API_CACHE_META_COLUMNS)}
|
|
9831
10080
|
FROM github_api_cache
|
|
9832
10081
|
WHERE cache_key = ${key}
|
|
9833
10082
|
LIMIT 1
|
|
@@ -9836,13 +10085,22 @@ async function loadEtagCache(key) {
|
|
|
9836
10085
|
if (!row) return null;
|
|
9837
10086
|
return {
|
|
9838
10087
|
etag: row.etag,
|
|
9839
|
-
body: row.body,
|
|
9840
10088
|
status: row.status,
|
|
9841
10089
|
expiresAt: row.expires_at,
|
|
9842
10090
|
updatedAt: row.updated_at
|
|
9843
10091
|
};
|
|
9844
10092
|
}
|
|
10093
|
+
async function loadEtagCacheBody(key) {
|
|
10094
|
+
const rows = await getDb().execute(sql`
|
|
10095
|
+
SELECT body
|
|
10096
|
+
FROM github_api_cache
|
|
10097
|
+
WHERE cache_key = ${key}
|
|
10098
|
+
LIMIT 1
|
|
10099
|
+
`);
|
|
10100
|
+
return rows[0]?.body ?? null;
|
|
10101
|
+
}
|
|
9845
10102
|
async function saveEtagCache(input) {
|
|
10103
|
+
if (!shouldPersistGithubApiCacheBody(input.body)) return;
|
|
9846
10104
|
const expiresAt = input.maxAgeMs != null && input.maxAgeMs > 0 ? new Date(Date.now() + input.maxAgeMs).toISOString() : null;
|
|
9847
10105
|
await getDb().execute(sql`
|
|
9848
10106
|
INSERT INTO github_api_cache (
|
|
@@ -9913,8 +10171,8 @@ async function githubGatewayFetch(url, init, options) {
|
|
|
9913
10171
|
}
|
|
9914
10172
|
const key = useCache ? cacheKeyFor(url, options.tokenKey) : null;
|
|
9915
10173
|
if (key && !options.bypassSoftCache) {
|
|
9916
|
-
const soft = await
|
|
9917
|
-
const softOk = soft
|
|
10174
|
+
const soft = await loadEtagCacheMeta(key);
|
|
10175
|
+
const softOk = soft != null && (priority === "interactive" ? canInteractiveSoftServe({
|
|
9918
10176
|
expiresAt: soft.expiresAt,
|
|
9919
10177
|
updatedAt: soft.updatedAt,
|
|
9920
10178
|
maxAgeMs
|
|
@@ -9923,27 +10181,30 @@ async function githubGatewayFetch(url, init, options) {
|
|
|
9923
10181
|
updatedAt: soft.updatedAt,
|
|
9924
10182
|
maxAgeMs
|
|
9925
10183
|
}));
|
|
9926
|
-
if (softOk
|
|
9927
|
-
const
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
void githubGatewayFetch(url, init, {
|
|
9939
|
-
...options,
|
|
9940
|
-
bypassSoftCache: true,
|
|
9941
|
-
priority: "background",
|
|
9942
|
-
maxAgeMs: maxAgeMs ?? DEFAULT_INTERACTIVE_CACHE_MAX_AGE_MS
|
|
9943
|
-
}).catch(() => {
|
|
10184
|
+
if (softOk) {
|
|
10185
|
+
const body = await loadEtagCacheBody(key);
|
|
10186
|
+
if (body != null) {
|
|
10187
|
+
const isFresh = isSoftCacheFresh({
|
|
10188
|
+
expiresAt: soft.expiresAt,
|
|
10189
|
+
updatedAt: soft.updatedAt,
|
|
10190
|
+
maxAgeMs
|
|
10191
|
+
});
|
|
10192
|
+
await recordStat({
|
|
10193
|
+
tokenKey: options.tokenKey,
|
|
10194
|
+
jobId: options.jobId,
|
|
10195
|
+
cacheHit: true
|
|
9944
10196
|
});
|
|
10197
|
+
if (priority === "interactive" && !isFresh) {
|
|
10198
|
+
void githubGatewayFetch(url, init, {
|
|
10199
|
+
...options,
|
|
10200
|
+
bypassSoftCache: true,
|
|
10201
|
+
priority: "background",
|
|
10202
|
+
maxAgeMs: maxAgeMs ?? DEFAULT_INTERACTIVE_CACHE_MAX_AGE_MS
|
|
10203
|
+
}).catch(() => {
|
|
10204
|
+
});
|
|
10205
|
+
}
|
|
10206
|
+
return cachedJsonResponse(body, soft.status ?? 200, "soft");
|
|
9945
10207
|
}
|
|
9946
|
-
return cachedJsonResponse(soft.body, soft.status ?? 200, "soft");
|
|
9947
10208
|
}
|
|
9948
10209
|
}
|
|
9949
10210
|
const budgetPerMinute = await resolveGithubBudgetPerMinute(
|
|
@@ -9983,7 +10244,7 @@ async function githubGatewayFetch(url, init, options) {
|
|
|
9983
10244
|
headers.set("X-GitHub-Api-Version", "2022-11-28");
|
|
9984
10245
|
}
|
|
9985
10246
|
if (key) {
|
|
9986
|
-
const cached = await
|
|
10247
|
+
const cached = await loadEtagCacheMeta(key);
|
|
9987
10248
|
if (cached?.etag) headers.set("If-None-Match", cached.etag);
|
|
9988
10249
|
}
|
|
9989
10250
|
let lastError = null;
|
|
@@ -10010,17 +10271,14 @@ async function githubGatewayFetch(url, init, options) {
|
|
|
10010
10271
|
}
|
|
10011
10272
|
await updateRateLimitHeaders(options.tokenKey, response);
|
|
10012
10273
|
if (response.status === 304 && key) {
|
|
10013
|
-
const cached = await
|
|
10274
|
+
const cached = await loadEtagCacheMeta(key);
|
|
10275
|
+
const body = await loadEtagCacheBody(key);
|
|
10014
10276
|
await recordStat({
|
|
10015
10277
|
tokenKey: options.tokenKey,
|
|
10016
10278
|
jobId: options.jobId,
|
|
10017
10279
|
cacheHit: true
|
|
10018
10280
|
});
|
|
10019
|
-
return cachedJsonResponse(
|
|
10020
|
-
cached?.body ?? "",
|
|
10021
|
-
cached?.status ?? 200,
|
|
10022
|
-
"hit"
|
|
10023
|
-
);
|
|
10281
|
+
return cachedJsonResponse(body ?? "", cached?.status ?? 200, "hit");
|
|
10024
10282
|
}
|
|
10025
10283
|
if (response.status === 403 || response.status === 429 || isTransientGitHubStatus(response.status)) {
|
|
10026
10284
|
const bodyText = summarizeGitHubErrorBody(
|
|
@@ -15317,6 +15575,18 @@ var TOOLS = [
|
|
|
15317
15575
|
limit: {
|
|
15318
15576
|
type: "number",
|
|
15319
15577
|
description: "Max results to return (1-25, default 8)."
|
|
15578
|
+
},
|
|
15579
|
+
requestId: {
|
|
15580
|
+
type: "string",
|
|
15581
|
+
description: "Parent wiki search requestId when this is a fallback after search-wiki."
|
|
15582
|
+
},
|
|
15583
|
+
sessionId: {
|
|
15584
|
+
type: "string",
|
|
15585
|
+
description: "Optional session id (distinct from API key)."
|
|
15586
|
+
},
|
|
15587
|
+
taskId: {
|
|
15588
|
+
type: "string",
|
|
15589
|
+
description: "Optional agent task id for the same request chain."
|
|
15320
15590
|
}
|
|
15321
15591
|
},
|
|
15322
15592
|
required: ["query"]
|
|
@@ -15387,6 +15657,18 @@ var TOOLS = [
|
|
|
15387
15657
|
includeArchived: {
|
|
15388
15658
|
type: "boolean",
|
|
15389
15659
|
description: "Include lifecycle-archived pages (decommissioned systems). Default false \u2014 archived is hidden unless you opt in."
|
|
15660
|
+
},
|
|
15661
|
+
requestId: {
|
|
15662
|
+
type: "string",
|
|
15663
|
+
description: "Optional correlation UUID. Generated by the server when omitted; pass it to get-wiki-page and search-team-memory."
|
|
15664
|
+
},
|
|
15665
|
+
sessionId: {
|
|
15666
|
+
type: "string",
|
|
15667
|
+
description: "Optional session id (distinct from API key)."
|
|
15668
|
+
},
|
|
15669
|
+
taskId: {
|
|
15670
|
+
type: "string",
|
|
15671
|
+
description: "Optional agent task id for the same request chain."
|
|
15390
15672
|
}
|
|
15391
15673
|
},
|
|
15392
15674
|
required: ["query"]
|
|
@@ -15405,6 +15687,18 @@ var TOOLS = [
|
|
|
15405
15687
|
include_all_sources: {
|
|
15406
15688
|
type: "boolean",
|
|
15407
15689
|
description: "Return every active source plus the archived history (also enriched). Default false \u2014 compact active list only."
|
|
15690
|
+
},
|
|
15691
|
+
requestId: {
|
|
15692
|
+
type: "string",
|
|
15693
|
+
description: "Pass the requestId returned by search-wiki so this read joins the same request."
|
|
15694
|
+
},
|
|
15695
|
+
sessionId: {
|
|
15696
|
+
type: "string",
|
|
15697
|
+
description: "Optional session id (distinct from API key)."
|
|
15698
|
+
},
|
|
15699
|
+
taskId: {
|
|
15700
|
+
type: "string",
|
|
15701
|
+
description: "Optional agent task id for the same request chain."
|
|
15408
15702
|
}
|
|
15409
15703
|
},
|
|
15410
15704
|
required: ["slug"]
|
|
@@ -15935,7 +16229,10 @@ async function executeToolCall(name, a, _serverId) {
|
|
|
15935
16229
|
query,
|
|
15936
16230
|
repo: typeof a.repo === "string" ? a.repo : void 0,
|
|
15937
16231
|
scope: a.scope === "mine" ? "mine" : "team",
|
|
15938
|
-
limit: typeof a.limit === "number" ? a.limit : void 0
|
|
16232
|
+
limit: typeof a.limit === "number" ? a.limit : void 0,
|
|
16233
|
+
requestId: typeof a.requestId === "string" ? a.requestId : void 0,
|
|
16234
|
+
sessionId: typeof a.sessionId === "string" ? a.sessionId : void 0,
|
|
16235
|
+
taskId: typeof a.taskId === "string" ? a.taskId : void 0
|
|
15939
16236
|
})
|
|
15940
16237
|
});
|
|
15941
16238
|
if (!res.ok) {
|
|
@@ -16152,7 +16449,10 @@ Searchable via search-team-memory once indexing completes (usually immediate).`
|
|
|
16152
16449
|
body: JSON.stringify({
|
|
16153
16450
|
query,
|
|
16154
16451
|
limit: typeof a.limit === "number" ? a.limit : void 0,
|
|
16155
|
-
includeArchived: typeof a.includeArchived === "boolean" ? a.includeArchived : void 0
|
|
16452
|
+
includeArchived: typeof a.includeArchived === "boolean" ? a.includeArchived : void 0,
|
|
16453
|
+
requestId: typeof a.requestId === "string" ? a.requestId : void 0,
|
|
16454
|
+
sessionId: typeof a.sessionId === "string" ? a.sessionId : void 0,
|
|
16455
|
+
taskId: typeof a.taskId === "string" ? a.taskId : void 0
|
|
16156
16456
|
})
|
|
16157
16457
|
});
|
|
16158
16458
|
if (!res.ok) {
|
|
@@ -16168,11 +16468,13 @@ Searchable via search-team-memory once indexing completes (usually immediate).`
|
|
|
16168
16468
|
}
|
|
16169
16469
|
const data = await res.json();
|
|
16170
16470
|
if (data.count === 0 || data.confident === false) {
|
|
16471
|
+
const requestLine = data.requestId ? `
|
|
16472
|
+
Pass requestId ${data.requestId} to search-team-memory so the fallback joins this wiki search.` : "";
|
|
16171
16473
|
return {
|
|
16172
16474
|
content: [
|
|
16173
16475
|
{
|
|
16174
16476
|
type: "text",
|
|
16175
|
-
text: data.hint ?? "No confident wiki answer. Fall back to search-team-memory for raw history \u2014 repeated misses here become insight-scout / gap-filler signals automatically."
|
|
16477
|
+
text: (data.hint ?? "No confident wiki answer. Fall back to search-team-memory for raw history \u2014 repeated misses here become insight-scout / gap-filler signals automatically.") + requestLine
|
|
16176
16478
|
}
|
|
16177
16479
|
]
|
|
16178
16480
|
};
|
|
@@ -16191,9 +16493,8 @@ Searchable via search-team-memory once indexing completes (usually immediate).`
|
|
|
16191
16493
|
{
|
|
16192
16494
|
type: "text",
|
|
16193
16495
|
text: `Found ${data.count} wiki page(s) (${data.mode} search) \u2014 curated team knowledge.
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
` + lines.join("\n\n")
|
|
16496
|
+
` + (data.requestId ? `requestId: ${data.requestId} \u2014 pass this to get-wiki-page and search-team-memory for the same request.
|
|
16497
|
+
` : "") + "Call get-wiki-page with a slug for the full page; follow its sources (team-memory ids, tickets) for raw detail. Treat stale `updated` dates as a signal to also check team memory.\n\n" + lines.join("\n\n")
|
|
16197
16498
|
}
|
|
16198
16499
|
]
|
|
16199
16500
|
};
|
|
@@ -16213,7 +16514,10 @@ Call get-wiki-page with a slug for the full page; follow its sources (team-memor
|
|
|
16213
16514
|
},
|
|
16214
16515
|
body: JSON.stringify({
|
|
16215
16516
|
slug,
|
|
16216
|
-
include_all_sources: includeAllSources
|
|
16517
|
+
include_all_sources: includeAllSources,
|
|
16518
|
+
requestId: typeof a.requestId === "string" ? a.requestId : void 0,
|
|
16519
|
+
sessionId: typeof a.sessionId === "string" ? a.sessionId : void 0,
|
|
16520
|
+
taskId: typeof a.taskId === "string" ? a.taskId : void 0
|
|
16217
16521
|
})
|
|
16218
16522
|
});
|
|
16219
16523
|
if (!res.ok) {
|
package/package.json
CHANGED