@meetless/mla 0.1.4
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/LICENSE +201 -0
- package/README.md +81 -0
- package/dist/build-info.json +9 -0
- package/dist/bundles/ask-core.js +396 -0
- package/dist/bundles/mcp.js +16592 -0
- package/dist/bundles/trace-core.js +263 -0
- package/dist/cli.js +828 -0
- package/dist/commands/activate.js +781 -0
- package/dist/commands/adoption.js +130 -0
- package/dist/commands/ask.js +290 -0
- package/dist/commands/context.js +114 -0
- package/dist/commands/debug.js +313 -0
- package/dist/commands/doctor.js +1021 -0
- package/dist/commands/enrich.js +427 -0
- package/dist/commands/evidence.js +229 -0
- package/dist/commands/flush.js +184 -0
- package/dist/commands/graph.js +104 -0
- package/dist/commands/init.js +272 -0
- package/dist/commands/internal-active-review.js +322 -0
- package/dist/commands/internal-auto-index.js +188 -0
- package/dist/commands/internal-capture-decisions.js +320 -0
- package/dist/commands/internal-evidence-correlate.js +239 -0
- package/dist/commands/internal-evidence-hooks.js +240 -0
- package/dist/commands/internal-evidence-inject.js +231 -0
- package/dist/commands/internal-finalize.js +221 -0
- package/dist/commands/internal-pretool-observe.js +225 -0
- package/dist/commands/internal-refresh.js +136 -0
- package/dist/commands/internal-session-nudge.js +120 -0
- package/dist/commands/internal-steer-sync.js +117 -0
- package/dist/commands/internal-turn-recap.js +140 -0
- package/dist/commands/kb.js +375 -0
- package/dist/commands/kb_add.js +681 -0
- package/dist/commands/kb_forget.js +283 -0
- package/dist/commands/kb_move.js +45 -0
- package/dist/commands/kb_pending.js +410 -0
- package/dist/commands/kb_personal.js +149 -0
- package/dist/commands/kb_promote.js +188 -0
- package/dist/commands/kb_purge.js +168 -0
- package/dist/commands/kb_reingest.js +335 -0
- package/dist/commands/kb_retime.js +170 -0
- package/dist/commands/kb_review.js +391 -0
- package/dist/commands/kb_revision.js +179 -0
- package/dist/commands/kb_show.js +385 -0
- package/dist/commands/label.js +226 -0
- package/dist/commands/login.js +295 -0
- package/dist/commands/logout.js +108 -0
- package/dist/commands/mcp-supervisor.js +93 -0
- package/dist/commands/mcp.js +227 -0
- package/dist/commands/queue-prune.js +98 -0
- package/dist/commands/review.js +358 -0
- package/dist/commands/rewire.js +124 -0
- package/dist/commands/rules.js +728 -0
- package/dist/commands/scan-context.js +67 -0
- package/dist/commands/session.js +347 -0
- package/dist/commands/stats.js +479 -0
- package/dist/commands/status.js +61 -0
- package/dist/commands/summary.js +250 -0
- package/dist/commands/turn.js +114 -0
- package/dist/commands/uninstall.js +222 -0
- package/dist/commands/whoami.js +102 -0
- package/dist/commands/workspace.js +130 -0
- package/dist/hooks-template/ce0-post-tool-use.sh +34 -0
- package/dist/hooks-template/ce0-session-start.sh +49 -0
- package/dist/hooks-template/ce0-stop.sh +29 -0
- package/dist/hooks-template/ce0-user-prompt-submit.sh +38 -0
- package/dist/hooks-template/common.sh +934 -0
- package/dist/hooks-template/event-batch-filter.jq +67 -0
- package/dist/hooks-template/flush.sh +503 -0
- package/dist/hooks-template/post-tool-use.sh +423 -0
- package/dist/hooks-template/pre-tool-use.sh +69 -0
- package/dist/hooks-template/session-start.sh +140 -0
- package/dist/hooks-template/stop.sh +308 -0
- package/dist/hooks-template/user-prompt-submit.sh +1162 -0
- package/dist/lib/activation.js +79 -0
- package/dist/lib/active-conflict-cache.js +141 -0
- package/dist/lib/active-memory.js +59 -0
- package/dist/lib/active-review-runner.js +26 -0
- package/dist/lib/agent-decision/index.js +25 -0
- package/dist/lib/agent-decision/keys.js +49 -0
- package/dist/lib/agent-decision/normalize-claude.js +183 -0
- package/dist/lib/agent-decision/types.js +21 -0
- package/dist/lib/agent-decision/validate.js +216 -0
- package/dist/lib/analytics/capture.js +96 -0
- package/dist/lib/analytics/command-event.js +267 -0
- package/dist/lib/analytics/consent.js +58 -0
- package/dist/lib/analytics/coverage-gap.js +96 -0
- package/dist/lib/analytics/envelope.js +236 -0
- package/dist/lib/analytics/event-id.js +86 -0
- package/dist/lib/analytics/evidence.js +150 -0
- package/dist/lib/analytics/followthrough.js +194 -0
- package/dist/lib/analytics/forwarder.js +109 -0
- package/dist/lib/analytics/logs.js +78 -0
- package/dist/lib/analytics/metrics.js +78 -0
- package/dist/lib/analytics/recorder.js +92 -0
- package/dist/lib/analytics/review-analytics.js +75 -0
- package/dist/lib/analytics/sequence.js +77 -0
- package/dist/lib/analytics/store.js +131 -0
- package/dist/lib/analytics/turn-recap.js +279 -0
- package/dist/lib/artifact_id.js +108 -0
- package/dist/lib/auth-breaker.js +161 -0
- package/dist/lib/auto-index.js +112 -0
- package/dist/lib/classifier.js +88 -0
- package/dist/lib/config.js +298 -0
- package/dist/lib/conflict-advisory.js +64 -0
- package/dist/lib/debug-bundle.js +520 -0
- package/dist/lib/enrichment/ingest.js +301 -0
- package/dist/lib/enrichment/plan.js +253 -0
- package/dist/lib/enrichment/protocol.js +359 -0
- package/dist/lib/enrichment/scout-brief.js +176 -0
- package/dist/lib/failure-telemetry.js +444 -0
- package/dist/lib/git.js +200 -0
- package/dist/lib/governance-cache.js +77 -0
- package/dist/lib/governed-path-cache.js +76 -0
- package/dist/lib/http.js +677 -0
- package/dist/lib/identity-envelope.js +23 -0
- package/dist/lib/kb-candidate.js +65 -0
- package/dist/lib/kb_acl.js +98 -0
- package/dist/lib/login.js +353 -0
- package/dist/lib/mcp-fetchers.js +130 -0
- package/dist/lib/mcp-restart.js +47 -0
- package/dist/lib/observability.js +805 -0
- package/dist/lib/open-url.js +33 -0
- package/dist/lib/orphan-guard.js +70 -0
- package/dist/lib/packaged.js +21 -0
- package/dist/lib/reconcile-sessions.js +171 -0
- package/dist/lib/redactor.js +89 -0
- package/dist/lib/relationship-candidate-query.js +27 -0
- package/dist/lib/render.js +611 -0
- package/dist/lib/rules/applicability.js +64 -0
- package/dist/lib/rules/attest-code-rule-version.js +47 -0
- package/dist/lib/rules/attest-notes-location.js +217 -0
- package/dist/lib/rules/attest-rule-version.js +69 -0
- package/dist/lib/rules/canonical-json.js +97 -0
- package/dist/lib/rules/ce0-emit.js +64 -0
- package/dist/lib/rules/ce0-evidence.js +281 -0
- package/dist/lib/rules/ce0-recall-sample.js +82 -0
- package/dist/lib/rules/ce0-rule.js +55 -0
- package/dist/lib/rules/ce0-sampling-bucket.js +15 -0
- package/dist/lib/rules/ce0-store.js +683 -0
- package/dist/lib/rules/ce0-telemetry-project.js +93 -0
- package/dist/lib/rules/ce0-telemetry.js +158 -0
- package/dist/lib/rules/code-rule-registry.js +17 -0
- package/dist/lib/rules/command-match.js +185 -0
- package/dist/lib/rules/consult-evidence-binding.js +27 -0
- package/dist/lib/rules/consultation-capture-adapter.js +193 -0
- package/dist/lib/rules/content-match.js +56 -0
- package/dist/lib/rules/deny-admission.js +99 -0
- package/dist/lib/rules/durable-observation.js +190 -0
- package/dist/lib/rules/enforce-notes-version.js +421 -0
- package/dist/lib/rules/evaluation-input-hash.js +126 -0
- package/dist/lib/rules/evaluator.js +108 -0
- package/dist/lib/rules/inert-rule-families.js +51 -0
- package/dist/lib/rules/input-authority-resolver.js +241 -0
- package/dist/lib/rules/interception-schema.js +170 -0
- package/dist/lib/rules/interception-store.js +267 -0
- package/dist/lib/rules/live-input-authority.js +66 -0
- package/dist/lib/rules/local-matcher.js +108 -0
- package/dist/lib/rules/local-observe.js +79 -0
- package/dist/lib/rules/local-rule-version-repo.js +214 -0
- package/dist/lib/rules/memory-requirement.js +109 -0
- package/dist/lib/rules/notes-observe.js +39 -0
- package/dist/lib/rules/notes-path.js +261 -0
- package/dist/lib/rules/notes-rule.js +75 -0
- package/dist/lib/rules/observe-adapter.js +114 -0
- package/dist/lib/rules/observed-rule-hash.js +119 -0
- package/dist/lib/rules/prompt-submit-adapter.js +132 -0
- package/dist/lib/rules/requirement-subject.js +240 -0
- package/dist/lib/rules/rule-activity.js +67 -0
- package/dist/lib/rules/rule-version-hash.js +151 -0
- package/dist/lib/rules/runtime-scope.js +55 -0
- package/dist/lib/rules/stop-adapter.js +116 -0
- package/dist/lib/rules/stop-response-snapshot.js +174 -0
- package/dist/lib/rules/types.js +10 -0
- package/dist/lib/rules/ulid.js +46 -0
- package/dist/lib/rules/version-evaluation.js +156 -0
- package/dist/lib/scanner/agent-memory.js +99 -0
- package/dist/lib/scanner/bootstrap-summary.js +87 -0
- package/dist/lib/scanner/cache.js +59 -0
- package/dist/lib/scanner/frontmatter.js +42 -0
- package/dist/lib/scanner/parse-directives.js +69 -0
- package/dist/lib/scanner/parse-structured.js +72 -0
- package/dist/lib/scanner/render.js +73 -0
- package/dist/lib/scanner/scan.js +132 -0
- package/dist/lib/scanner/score.js +38 -0
- package/dist/lib/scanner/scout-mission.js +126 -0
- package/dist/lib/scanner/types.js +7 -0
- package/dist/lib/session-scope.js +195 -0
- package/dist/lib/spool.js +355 -0
- package/dist/lib/staleness.js +100 -0
- package/dist/lib/steer-cache.js +87 -0
- package/dist/lib/tagged-reference.js +20 -0
- package/dist/lib/temporal.js +109 -0
- package/dist/lib/turn-recap-emit.js +67 -0
- package/dist/lib/unwire.js +253 -0
- package/dist/lib/update-check.js +469 -0
- package/dist/lib/update-notifier.js +217 -0
- package/dist/lib/upgrade-apply.js +643 -0
- package/dist/lib/wire.js +1087 -0
- package/dist/lib/workspace.js +96 -0
- package/dist/lib/zip.js +154 -0
- package/dist/pretool-entry.js +37 -0
- package/package.json +75 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// A-0c (A4 surface 2): the pending-count hand-off the `mla kb pending` command
|
|
3
|
+
// writes for the user-prompt-submit hook to read.
|
|
4
|
+
//
|
|
5
|
+
// The hook nudges the coding agent when relationship candidates are pending review,
|
|
6
|
+
// but Patch 8 forbids it from adding a synchronous hot-path network call to learn
|
|
7
|
+
// the count. So the count travels OUT OF BAND: `mla kb pending` already fetched the
|
|
8
|
+
// queue (it knows the count for free), and drops it in a tiny local cache here; the
|
|
9
|
+
// hook reads that cache with zero network. The tradeoff is proactivity: the cache
|
|
10
|
+
// only refreshes when someone runs `mla kb pending`, which is accepted for v1.
|
|
11
|
+
//
|
|
12
|
+
// This path + shape MUST stay byte-identical to the bash reader (common.sh
|
|
13
|
+
// governance_count_file): $MEETLESS_HOME/logs/governance/pending-count-<ws>.json,
|
|
14
|
+
// workspace id sanitized with the SAME rule as `tr -c 'A-Za-z0-9_.-' '_'`, body
|
|
15
|
+
// {count, ts} with ts in epoch SECONDS (bash compares against `date +%s`). The
|
|
16
|
+
// governance-cache.spec pins this contract.
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.pendingCountCachePath = pendingCountCachePath;
|
|
52
|
+
exports.writePendingCountCache = writePendingCountCache;
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const config_1 = require("./config");
|
|
56
|
+
// Mirror of bash `tr -c 'A-Za-z0-9_.-' '_'`: every char OUTSIDE the allowed set
|
|
57
|
+
// becomes a single '_' (one-for-one, no collapsing), so the writer and reader
|
|
58
|
+
// always resolve the identical filename for a given workspace id.
|
|
59
|
+
function sanitizeWorkspaceId(workspaceId) {
|
|
60
|
+
return workspaceId.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
61
|
+
}
|
|
62
|
+
function pendingCountCachePath(workspaceId, home = config_1.HOME) {
|
|
63
|
+
return path.join(home, "logs", "governance", `pending-count-${sanitizeWorkspaceId(workspaceId)}.json`);
|
|
64
|
+
}
|
|
65
|
+
// Best-effort: a failure to write the cache must never break the `mla kb pending`
|
|
66
|
+
// command itself (the human still got their listing). The worst case is the hook
|
|
67
|
+
// keeps reading the previous count until the next successful write.
|
|
68
|
+
function writePendingCountCache(workspaceId, count, home = config_1.HOME) {
|
|
69
|
+
try {
|
|
70
|
+
const file = pendingCountCachePath(workspaceId, home);
|
|
71
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
72
|
+
fs.writeFileSync(file, JSON.stringify({ count, ts: Math.floor(Date.now() / 1000) }));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
/* non-fatal: the listing already succeeded; the nudge just reads a staler count */
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.governedPathCacheKey = governedPathCacheKey;
|
|
4
|
+
exports.writeGovernedPath = writeGovernedPath;
|
|
5
|
+
exports.readGovernedPath = readGovernedPath;
|
|
6
|
+
exports.governedPathEntryForReceipt = governedPathEntryForReceipt;
|
|
7
|
+
// Owner+workspace+repo+path keyed cache mapping a governed path to its KB doc id,
|
|
8
|
+
// with separate personal/shared namespaces. A bare-path key would cross owners and
|
|
9
|
+
// repos once Personal KB exists; this never uses one. 3-day TTL. See spec test 33.
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const TTL_MS = 3 * 24 * 3600 * 1000;
|
|
14
|
+
function governedPathCacheKey(k) {
|
|
15
|
+
return [k.namespace, k.workspaceId, k.ownerUserId, k.repoRootHash, k.canonicalPath].join("|");
|
|
16
|
+
}
|
|
17
|
+
function cacheFile(k, home) {
|
|
18
|
+
const dir = (0, path_1.join)(home, "logs", "governed-path", k.namespace);
|
|
19
|
+
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
20
|
+
const h = (0, crypto_1.createHash)("sha256").update(governedPathCacheKey(k)).digest("hex").slice(0, 24);
|
|
21
|
+
return (0, path_1.join)(dir, `${h}.json`);
|
|
22
|
+
}
|
|
23
|
+
function writeGovernedPath(k, docId, home) {
|
|
24
|
+
(0, fs_1.writeFileSync)(cacheFile(k, home), JSON.stringify({ key: governedPathCacheKey(k), docId, ts: 0, written: Date.now() }));
|
|
25
|
+
}
|
|
26
|
+
function readGovernedPath(k, home) {
|
|
27
|
+
const f = cacheFile(k, home);
|
|
28
|
+
if (!(0, fs_1.existsSync)(f))
|
|
29
|
+
return null;
|
|
30
|
+
try {
|
|
31
|
+
const body = JSON.parse((0, fs_1.readFileSync)(f, "utf8"));
|
|
32
|
+
if (body.key !== governedPathCacheKey(k))
|
|
33
|
+
return null; // hash-collision guard
|
|
34
|
+
if (Date.now() - body.written > TTL_MS)
|
|
35
|
+
return null; // TTL
|
|
36
|
+
return body.docId;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Reuse of kb_add.ts receiptEnqueuesExtraction: only a body-changing FILE ingest
|
|
43
|
+
// (a minted, activated revision) produced a live doc body worth caching. A corpus
|
|
44
|
+
// rollup, a noop_unchanged delivery, or a failed ingest produced nothing, so it
|
|
45
|
+
// must not be cached.
|
|
46
|
+
//
|
|
47
|
+
// NOTE (posture removal): the born-PENDING model dropped posture from the receipt,
|
|
48
|
+
// so `receipt.posture` is now always absent and namespace routing below degrades
|
|
49
|
+
// to the "personal" namespace for every entry. This is graceful (the cache is
|
|
50
|
+
// best-effort and never gated on; a miss just costs a server round-trip), but the
|
|
51
|
+
// shared/personal split is no longer meaningful here. Re-key on document scope
|
|
52
|
+
// (WORKSPACE vs PERSON) in a follow-up if the split needs to be honored.
|
|
53
|
+
function receiptProducedLiveBody(r) {
|
|
54
|
+
return r.mode === "file" && r.outcome === "ingested";
|
|
55
|
+
}
|
|
56
|
+
function governedPathEntryForReceipt(receipt, ctx) {
|
|
57
|
+
if (!receiptProducedLiveBody(receipt))
|
|
58
|
+
return null;
|
|
59
|
+
if (!receipt.documentId || !receipt.canonicalPath)
|
|
60
|
+
return null;
|
|
61
|
+
// Effective posture from the receipt; fall back to ctx.defaultPosture (then
|
|
62
|
+
// "SHADOW" -> personal) when the receipt carries no posture. Only an explicit
|
|
63
|
+
// LIVE doc goes to the shared namespace; everything else is owner-private.
|
|
64
|
+
const posture = (receipt.posture || ctx.defaultPosture || "SHADOW").toUpperCase();
|
|
65
|
+
const namespace = posture === "LIVE" ? "shared" : "personal";
|
|
66
|
+
return {
|
|
67
|
+
key: {
|
|
68
|
+
namespace,
|
|
69
|
+
workspaceId: ctx.workspaceId,
|
|
70
|
+
ownerUserId: ctx.ownerUserId,
|
|
71
|
+
repoRootHash: ctx.repoRootHash,
|
|
72
|
+
canonicalPath: receipt.canonicalPath,
|
|
73
|
+
},
|
|
74
|
+
docId: receipt.documentId,
|
|
75
|
+
};
|
|
76
|
+
}
|