sentinelayer-cli 0.46.5 → 0.48.0
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/README.md +47 -3
- package/package.json +12 -7
- package/skills/omar-gate-setup/SKILL.md +103 -0
- package/skills/senti-agent-identity/SKILL.md +80 -0
- package/skills/senti-judge/SKILL.md +139 -0
- package/skills/senti-room-notifications/SKILL.md +73 -0
- package/skills/senti-room-notifications/listen-wrapper.cjs +150 -0
- package/skills/senti-room-notifications/package.json +1 -0
- package/skills/senti-room-notifications/test-classifier.js +109 -0
- package/skills/senti-room-notifications/test-receipt.js +54 -0
- package/skills/sentinelayer-cli/SKILL.md +222 -0
- package/src/agents/devtestbot/runner.js +22 -11
- package/src/agents/devtestbot/tool.js +24 -11
- package/src/agents/jules/fix-cycle.js +7 -1
- package/src/agents/jules/tools/runtime-audit.js +17 -12
- package/src/agents/shared-tools/dispatch-core.js +10 -5
- package/src/ai/aidenid.js +4 -2
- package/src/ai/domain-target-store.js +11 -5
- package/src/ai/identity-store.js +11 -5
- package/src/ai/site-store.js +8 -4
- package/src/audit/orchestrator.js +21 -14
- package/src/audit/package.js +6 -4
- package/src/audit/persona-loop.js +7 -0
- package/src/audit/replay.js +4 -2
- package/src/auth/gate.js +32 -1
- package/src/auth/session-store.js +37 -0
- package/src/board/evidence-resolvers.js +3 -4
- package/src/cli.js +23 -3
- package/src/commands/ai/identity-lifecycle.js +30 -26
- package/src/commands/ai/provision-governance.js +32 -24
- package/src/commands/ai/shared.js +6 -4
- package/src/commands/audit.js +14 -12
- package/src/commands/board.js +2 -2
- package/src/commands/chat.js +8 -6
- package/src/commands/judge.js +125 -0
- package/src/commands/legacy-args.js +1 -0
- package/src/commands/mcp.js +45 -52
- package/src/commands/omargate.js +2 -1
- package/src/commands/plugin.js +11 -3
- package/src/commands/review.js +9 -4
- package/src/commands/scan.js +7 -7
- package/src/commands/session.js +516 -30
- package/src/commands/skills.js +45 -0
- package/src/commands/watch.js +9 -7
- package/src/config/output-filesystem.js +156 -0
- package/src/config/schema.js +4 -2
- package/src/config/service.js +40 -4
- package/src/cost/history.js +15 -9
- package/src/daemon/artifact-lineage.js +15 -12
- package/src/daemon/assignment-ledger.js +31 -25
- package/src/daemon/ast-drift.js +7 -3
- package/src/daemon/budget-governor.js +26 -20
- package/src/daemon/error-worker.js +28 -22
- package/src/daemon/fix-cycle.js +5 -4
- package/src/daemon/hybrid-mapper.js +19 -16
- package/src/daemon/ingest-refresh.js +4 -0
- package/src/daemon/jira-lifecycle.js +21 -17
- package/src/daemon/operator-control.js +18 -15
- package/src/daemon/reliability-lane.js +18 -15
- package/src/daemon/scope-engine.js +12 -8
- package/src/daemon/watchdog.js +15 -12
- package/src/engram/build-state.js +24 -3
- package/src/engram/capability-index.js +367 -0
- package/src/engram/compile-graph.js +1063 -0
- package/src/engram/contracts/action-receipt.js +82 -0
- package/src/engram/contracts/capability-index.js +259 -0
- package/src/engram/contracts/capability.js +377 -0
- package/src/engram/contracts/content-hash.js +8 -0
- package/src/engram/contracts/evidence.js +258 -0
- package/src/engram/contracts/graph.js +594 -0
- package/src/engram/contracts/identity.js +8 -0
- package/src/engram/contracts/index.js +149 -0
- package/src/engram/contracts/media-asset.js +85 -0
- package/src/engram/contracts/money.js +249 -0
- package/src/engram/contracts/source-snapshot.js +57 -0
- package/src/engram/contracts/task-context-pack.js +114 -0
- package/src/engram/contracts/temporal-segment.js +72 -0
- package/src/engram/contracts/versions.js +96 -0
- package/src/engram/extract-html.js +692 -0
- package/src/engram/graph-store.js +877 -0
- package/src/engram/index.js +98 -14
- package/src/engram/ingest-site.js +132 -0
- package/src/engram/live-state.js +1180 -0
- package/src/engram/namespace.js +34 -1
- package/src/engram/retrieve-site.js +753 -0
- package/src/engram/safe-reader.js +597 -0
- package/src/engram/source-intake.js +251 -0
- package/src/engram/store.js +227 -9
- package/src/ingest/engine.js +21 -28
- package/src/judge/verdict.js +305 -0
- package/src/legacy-cli.js +96 -19
- package/src/mcp/bridge-inputs.js +25 -4
- package/src/mcp/cli-command-tools.js +70 -0
- package/src/mcp/registry.js +17 -13
- package/src/mcp/session-stdio-server.js +297 -19
- package/src/memory/blackboard.js +5 -4
- package/src/net/gh-api-path.js +35 -9
- package/src/net/test-egress-guard.js +16 -4
- package/src/plugin/manifest.js +12 -8
- package/src/review/ai-review.js +110 -10
- package/src/review/investor-dd-devtestbot.js +17 -6
- package/src/review/investor-dd-orchestrator.js +21 -13
- package/src/review/local-review.js +26 -16
- package/src/review/omargate-cache.js +5 -5
- package/src/review/omargate-orchestrator.js +89 -17
- package/src/review/replay.js +9 -4
- package/src/review/report.js +22 -13
- package/src/review/typesafe-severity.js +201 -0
- package/src/session/admission-auth.js +34 -7
- package/src/session/admission.js +110 -15
- package/src/session/attachment-summary.js +77 -0
- package/src/session/edit-summary.js +19 -0
- package/src/session/invitations.js +65 -1
- package/src/session/mentions.js +17 -9
- package/src/session/message-edits.js +5 -4
- package/src/session/preview.js +10 -2
- package/src/session/recap.js +3 -2
- package/src/session/room-files.js +519 -0
- package/src/session/route-classes.js +22 -8
- package/src/session/setup-guides.js +4 -0
- package/src/session/standup.js +192 -0
- package/src/session/sync.js +229 -10
- package/src/session/tickets.js +41 -0
- package/src/session/transcript.js +2 -1
- package/src/session/wake/resolve-target.js +7 -3
- package/src/skills/listener-runtime.cjs +92 -0
- package/src/skills/service.js +207 -0
- package/src/swarm/factory.js +5 -5
- package/src/swarm/pentest.js +9 -9
- package/src/swarm/report.js +4 -4
- package/src/swarm/runtime.js +15 -12
- package/src/swarm/scenario-dsl.js +7 -5
- package/src/telemetry/ledger.js +16 -7
package/src/engram/index.js
CHANGED
|
@@ -7,11 +7,21 @@
|
|
|
7
7
|
* store adapter (see the CLI wiring in src/mcp/session-stdio-server.js).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export { createStore, itemId } from "./store.js";
|
|
10
|
+
export { createStore, itemId, LegacyStorageError } from "./store.js";
|
|
11
|
+
export {
|
|
12
|
+
compileGraph,
|
|
13
|
+
compileCandidate,
|
|
14
|
+
CompileGraphError,
|
|
15
|
+
EW05_PREDICATES,
|
|
16
|
+
EW05_PREDICATE_SET,
|
|
17
|
+
ENTITY_KIND,
|
|
18
|
+
GENERATION_STATUS,
|
|
19
|
+
} from "./compile-graph.js";
|
|
11
20
|
export {
|
|
12
21
|
parseNamespace,
|
|
13
22
|
authorize,
|
|
14
23
|
createLocalConsent,
|
|
24
|
+
createScopedConsent,
|
|
15
25
|
AccessDeniedError,
|
|
16
26
|
ACTION_SCOPES,
|
|
17
27
|
} from "./namespace.js";
|
|
@@ -28,8 +38,55 @@ export {
|
|
|
28
38
|
export { createGovernance } from "./governance.js";
|
|
29
39
|
export { createMemoryTools } from "./tools.js";
|
|
30
40
|
export { runEngramSla } from "./sla.js";
|
|
41
|
+
export * from "./contracts/index.js";
|
|
31
42
|
export { ingestDocumentIntoNamespace } from "./ingest-document.js";
|
|
43
|
+
export { captureSourceBytes, SourceIntakeError, MAX_SOURCE_BYTES } from "./source-intake.js";
|
|
44
|
+
export { createSafeReader, SafeReaderError } from "./safe-reader.js";
|
|
45
|
+
export { extractFromHtml } from "./extract-html.js";
|
|
46
|
+
export { ingestSite } from "./ingest-site.js";
|
|
47
|
+
export {
|
|
48
|
+
createGraphStore,
|
|
49
|
+
GraphValidationError,
|
|
50
|
+
VersionNotFoundError,
|
|
51
|
+
IntegrityError,
|
|
52
|
+
} from "./graph-store.js";
|
|
53
|
+
export {
|
|
54
|
+
buildSiteRetrievalIndex,
|
|
55
|
+
retrieveSiteEntities,
|
|
56
|
+
retrieveFromGraphStore,
|
|
57
|
+
RETRIEVE_SITE_INDEX_VERSION,
|
|
58
|
+
REQUIRED_EMBEDDER_DIM,
|
|
59
|
+
SITE_RETRIEVAL_DEFAULTS,
|
|
60
|
+
} from "./retrieve-site.js";
|
|
61
|
+
|
|
32
62
|
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
FRESHNESS_CLASSES,
|
|
66
|
+
classifyFreshness,
|
|
67
|
+
isValidFreshnessClass,
|
|
68
|
+
createFreshnessMarker,
|
|
69
|
+
isFreshnessStale,
|
|
70
|
+
FreshnessClassError,
|
|
71
|
+
SOURCE_STATUSES,
|
|
72
|
+
createSourceVersion,
|
|
73
|
+
resolveAuthoritativeSource,
|
|
74
|
+
SourceVersionError,
|
|
75
|
+
mustRevalidate,
|
|
76
|
+
RevalidationRequiredError,
|
|
77
|
+
disabledByOutage,
|
|
78
|
+
SourceOutageError,
|
|
79
|
+
createCommerceContext,
|
|
80
|
+
CommerceContextError,
|
|
81
|
+
} from "./live-state.js";
|
|
82
|
+
export {
|
|
83
|
+
validateAdapterShape,
|
|
84
|
+
hydrate,
|
|
85
|
+
revalidateForAction,
|
|
86
|
+
LiveStateError,
|
|
87
|
+
VOLATILE_FIELD_NAMES,
|
|
88
|
+
isVolatileField,
|
|
89
|
+
} from "./live-state.js";
|
|
33
90
|
import { createStore } from "./store.js";
|
|
34
91
|
import { createLocalConsent } from "./namespace.js";
|
|
35
92
|
import { createGovernance } from "./governance.js";
|
|
@@ -38,6 +95,8 @@ import { ingestDocumentIntoNamespace } from "./ingest-document.js";
|
|
|
38
95
|
import { createMemoryTools } from "./tools.js";
|
|
39
96
|
import { createEmbedder } from "../session/recall/embedder.js";
|
|
40
97
|
|
|
98
|
+
const DEFAULT_CONSENT = Symbol("default consent");
|
|
99
|
+
|
|
41
100
|
/**
|
|
42
101
|
* Convenience factory: wire a default CLI-local MaaS instance (permissive-local
|
|
43
102
|
* consent, stub governance, hash-projection embedder) over a store. Callers
|
|
@@ -52,22 +111,47 @@ import { createEmbedder } from "../session/recall/embedder.js";
|
|
|
52
111
|
* @param {object} [options.renderer]
|
|
53
112
|
* @returns {{tools: object, store: object}}
|
|
54
113
|
*/
|
|
55
|
-
export function createMemoryService({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
114
|
+
export function createMemoryService(options = {}) {
|
|
115
|
+
const {
|
|
116
|
+
storeRoot,
|
|
117
|
+
adapters = {},
|
|
118
|
+
embedder = createEmbedder(),
|
|
119
|
+
consent: rawConsent = DEFAULT_CONSENT,
|
|
120
|
+
governance = createGovernance(),
|
|
121
|
+
renderer = null,
|
|
122
|
+
isAuthorizedForSealed,
|
|
123
|
+
} = options;
|
|
124
|
+
|
|
125
|
+
// Detect whether the caller injected a consent. When options.consent is
|
|
126
|
+
// undefined the rawConsent is the DEFAULT_CONSENT sentinel; any other
|
|
127
|
+
// value (including createLocalConsent() passed explicitly) means the
|
|
128
|
+
// caller injected one.
|
|
129
|
+
const callerInjectedConsent = rawConsent !== DEFAULT_CONSENT;
|
|
130
|
+
const consent = callerInjectedConsent ? rawConsent : createLocalConsent();
|
|
131
|
+
|
|
132
|
+
// Default local consent: use "first-claim" to migrate legacy dirs
|
|
133
|
+
// safely (one user's own namespaces, no cross-tenant risk).
|
|
134
|
+
// Injected (non-default) consent: "refuse" — never trust legacy dirs
|
|
135
|
+
// when a scoped or hosted consent is in play.
|
|
136
|
+
const legacyLossyDirs = callerInjectedConsent ? "refuse" : "first-claim";
|
|
137
|
+
|
|
138
|
+
const store = createStore({ storeRoot, adapters, legacyLossyDirs });
|
|
65
139
|
// Wired by DEFAULT, not opt-in: a readiness gate nobody injects is a comment.
|
|
66
|
-
const buildState = createBuildState({ storeRoot });
|
|
140
|
+
const buildState = createBuildState({ storeRoot, legacyLossyDirs });
|
|
67
141
|
const tools = createMemoryTools({ store, consent, governance, embedder, renderer, isAuthorizedForSealed, buildState });
|
|
68
142
|
// Exposed on the service so the lifecycle cannot be bypassed by a caller who has a
|
|
69
143
|
// store but forgets the buildState -- the deps are bound here, once.
|
|
70
|
-
const ingestDocument = (
|
|
71
|
-
ingestDocumentIntoNamespace({ ...
|
|
144
|
+
const ingestDocument = (opts) =>
|
|
145
|
+
ingestDocumentIntoNamespace({ ...opts, deps: { store, buildState } });
|
|
72
146
|
return { tools, store, buildState, ingestDocument };
|
|
73
147
|
}
|
|
148
|
+
|
|
149
|
+
// Capability Index (EW08)
|
|
150
|
+
export {
|
|
151
|
+
buildCapabilityIndex,
|
|
152
|
+
verifyCapabilityIndex,
|
|
153
|
+
toMcpTool,
|
|
154
|
+
renderSkillText,
|
|
155
|
+
checkRevocation,
|
|
156
|
+
findSkill,
|
|
157
|
+
} from "./capability-index.js";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENGRAM §EW04 — Site-to-memory ingestion pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Wires: source-intake (authorization) → safe-reader (SSRF-safe fetch) →
|
|
5
|
+
* extract-html (byte-offset facts) → graph-store (immutable snapshot).
|
|
6
|
+
*
|
|
7
|
+
* An unchanged page re-ingests as `reused: true`.
|
|
8
|
+
* An unavailable source is recorded as unknown, never as empty.
|
|
9
|
+
*
|
|
10
|
+
* Library only. Node builtins + existing zod contracts. No new dependency.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { captureSourceBytes } from "./source-intake.js";
|
|
14
|
+
import { extractFromHtml } from "./extract-html.js";
|
|
15
|
+
import { parseNamespace } from "./namespace.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Ingest a site from an approved source through to the graph store.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} options
|
|
21
|
+
* @param {string} options.sourceId
|
|
22
|
+
* @param {string} options.tenantScope
|
|
23
|
+
* @param {Map} options.sources — the approved source registry
|
|
24
|
+
* @param {Set<string>} options.allowedOrigins
|
|
25
|
+
* @param {function} options.authorize — tenant policy function
|
|
26
|
+
* @param {object} options.reader — a safe-reader { read } instance
|
|
27
|
+
* @param {object} options.graphStore — EW03 graph store (with writeSourceSnapshot)
|
|
28
|
+
* @param {object} options.caller — caller identity for graph store
|
|
29
|
+
* @param {string} options.namespace — namespace for graph store
|
|
30
|
+
* @param {number} [options.maxBytes] — byte cap
|
|
31
|
+
* @returns {Promise<{snapshot: object, facts: object, reused: boolean}>}
|
|
32
|
+
*/
|
|
33
|
+
export async function ingestSite({
|
|
34
|
+
sourceId,
|
|
35
|
+
tenantScope,
|
|
36
|
+
sources,
|
|
37
|
+
allowedOrigins,
|
|
38
|
+
authorize,
|
|
39
|
+
reader,
|
|
40
|
+
graphStore,
|
|
41
|
+
caller,
|
|
42
|
+
namespace,
|
|
43
|
+
maxBytes,
|
|
44
|
+
}) {
|
|
45
|
+
// 1. source-intake: authorize + validate source record (does NOT read bytes)
|
|
46
|
+
// We use captureSourceBytes as an authorization gate; we supply our own read function
|
|
47
|
+
// that calls safe-reader, but captureSourceBytes handles all the policy checks.
|
|
48
|
+
|
|
49
|
+
let captured;
|
|
50
|
+
try {
|
|
51
|
+
captured = await captureSourceBytes({
|
|
52
|
+
sourceId,
|
|
53
|
+
tenantScope,
|
|
54
|
+
sources,
|
|
55
|
+
allowedOrigins,
|
|
56
|
+
authorize,
|
|
57
|
+
read: async ({ url, version: approvedVersion }) => {
|
|
58
|
+
// safe-reader fetch
|
|
59
|
+
const result = await reader.read(url, { approvedOrigins: allowedOrigins });
|
|
60
|
+
|
|
61
|
+
// Pass the reader's ACTUAL version (sha256 of bytes) so source-intake
|
|
62
|
+
// can verify it matches the approved version. Never echo the registry
|
|
63
|
+
// version; the trusted connector reports what it actually received.
|
|
64
|
+
return {
|
|
65
|
+
status: 200,
|
|
66
|
+
url: result.finalUrl,
|
|
67
|
+
version: result.version,
|
|
68
|
+
mediaType: result.contentType,
|
|
69
|
+
contentLength: result.bytes.length,
|
|
70
|
+
body: result.bytes,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
maxBytes,
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
// An unavailable source is recorded as thrown, never as empty bytes.
|
|
77
|
+
// The caller may catch SourceIntakeError and record unavailability upstream.
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 2. Check for reuse: does a snapshot with the same contentHash already exist?
|
|
82
|
+
const { snapshot, bytes } = captured;
|
|
83
|
+
const ns = parseNamespace(namespace);
|
|
84
|
+
|
|
85
|
+
// source-intake emits contentHash prefixed `sha256:` but the graph store
|
|
86
|
+
// computes its own raw hex hash from bytes (not caller-supplied). Drop the
|
|
87
|
+
// field so the graph store computes the hash, keeping the single source of truth.
|
|
88
|
+
const { contentHash: _ch, ...snapForStore } = snapshot;
|
|
89
|
+
|
|
90
|
+
let reused = false;
|
|
91
|
+
let persistedSnapshot = snapshot;
|
|
92
|
+
try {
|
|
93
|
+
const existing = await graphStore.listSourceSnapshots(caller, ns);
|
|
94
|
+
// graph store returns contentHash without prefix; source-intake snapshots have the prefix.
|
|
95
|
+
// Normalize for comparison: strip `sha256:` from the intake snapshot's hash.
|
|
96
|
+
const normalizedHash = snapshot.contentHash.startsWith("sha256:")
|
|
97
|
+
? snapshot.contentHash.slice(7)
|
|
98
|
+
: snapshot.contentHash;
|
|
99
|
+
const match = existing.find((s) =>
|
|
100
|
+
s.contentHash === normalizedHash && s.sourceId === sourceId,
|
|
101
|
+
);
|
|
102
|
+
if (match) {
|
|
103
|
+
reused = true;
|
|
104
|
+
// Content bytes are identical — a snapshot with this (sourceId, version, contentHash)
|
|
105
|
+
// already exists. Return the existing record; do not write a duplicate.
|
|
106
|
+
// Normalize: graph store returns raw hex, but callers expect the sha256: prefix.
|
|
107
|
+
persistedSnapshot = { ...match, contentHash: "sha256:" + match.contentHash };
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
// If listing fails, proceed with write
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!reused) {
|
|
114
|
+
// 3. Write source snapshot to graph store (without caller-supplied contentHash;
|
|
115
|
+
// the graph store computes its own from bytes).
|
|
116
|
+
await graphStore.writeSourceSnapshot(caller, ns, snapForStore, bytes);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 4. Extract facts with byte offsets
|
|
120
|
+
let facts;
|
|
121
|
+
try {
|
|
122
|
+
facts = extractFromHtml(bytes);
|
|
123
|
+
} catch {
|
|
124
|
+
facts = { title: null, description: null, canonical: null, headings: [], links: [], jsonLd: [] };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
snapshot: persistedSnapshot,
|
|
129
|
+
facts,
|
|
130
|
+
reused,
|
|
131
|
+
};
|
|
132
|
+
}
|