sentinelayer-cli 0.46.4 → 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.
Files changed (137) hide show
  1. package/README.md +63 -3
  2. package/package.json +12 -7
  3. package/skills/omar-gate-setup/SKILL.md +103 -0
  4. package/skills/senti-agent-identity/SKILL.md +80 -0
  5. package/skills/senti-judge/SKILL.md +139 -0
  6. package/skills/senti-room-notifications/SKILL.md +73 -0
  7. package/skills/senti-room-notifications/listen-wrapper.cjs +150 -0
  8. package/skills/senti-room-notifications/package.json +1 -0
  9. package/skills/senti-room-notifications/test-classifier.js +109 -0
  10. package/skills/senti-room-notifications/test-receipt.js +54 -0
  11. package/skills/sentinelayer-cli/SKILL.md +222 -0
  12. package/src/agents/devtestbot/runner.js +22 -11
  13. package/src/agents/devtestbot/tool.js +24 -11
  14. package/src/agents/jules/fix-cycle.js +7 -1
  15. package/src/agents/jules/tools/runtime-audit.js +17 -12
  16. package/src/agents/shared-tools/dispatch-core.js +10 -5
  17. package/src/ai/aidenid.js +4 -2
  18. package/src/ai/domain-target-store.js +11 -5
  19. package/src/ai/identity-store.js +11 -5
  20. package/src/ai/site-store.js +8 -4
  21. package/src/audit/orchestrator.js +21 -14
  22. package/src/audit/package.js +6 -4
  23. package/src/audit/persona-loop.js +7 -0
  24. package/src/audit/replay.js +4 -2
  25. package/src/auth/gate.js +46 -8
  26. package/src/auth/service.js +34 -15
  27. package/src/auth/session-store.js +105 -47
  28. package/src/board/evidence-resolvers.js +3 -4
  29. package/src/cli.js +23 -3
  30. package/src/commands/ai/identity-lifecycle.js +30 -26
  31. package/src/commands/ai/provision-governance.js +32 -24
  32. package/src/commands/ai/shared.js +6 -4
  33. package/src/commands/audit.js +14 -12
  34. package/src/commands/auth.js +24 -4
  35. package/src/commands/board.js +2 -2
  36. package/src/commands/chat.js +8 -6
  37. package/src/commands/judge.js +125 -0
  38. package/src/commands/legacy-args.js +1 -0
  39. package/src/commands/mcp.js +45 -52
  40. package/src/commands/omargate.js +2 -1
  41. package/src/commands/plugin.js +11 -3
  42. package/src/commands/review.js +9 -4
  43. package/src/commands/scan.js +7 -7
  44. package/src/commands/session.js +607 -57
  45. package/src/commands/skills.js +45 -0
  46. package/src/commands/watch.js +9 -7
  47. package/src/config/output-filesystem.js +156 -0
  48. package/src/config/schema.js +4 -2
  49. package/src/config/service.js +40 -4
  50. package/src/cost/history.js +15 -9
  51. package/src/daemon/artifact-lineage.js +15 -12
  52. package/src/daemon/assignment-ledger.js +31 -25
  53. package/src/daemon/ast-drift.js +7 -3
  54. package/src/daemon/budget-governor.js +26 -20
  55. package/src/daemon/error-worker.js +28 -22
  56. package/src/daemon/fix-cycle.js +5 -4
  57. package/src/daemon/hybrid-mapper.js +19 -16
  58. package/src/daemon/ingest-refresh.js +4 -0
  59. package/src/daemon/jira-lifecycle.js +21 -17
  60. package/src/daemon/operator-control.js +18 -15
  61. package/src/daemon/reliability-lane.js +18 -15
  62. package/src/daemon/scope-engine.js +12 -8
  63. package/src/daemon/watchdog.js +15 -12
  64. package/src/engram/build-state.js +24 -3
  65. package/src/engram/capability-index.js +367 -0
  66. package/src/engram/compile-graph.js +1063 -0
  67. package/src/engram/contracts/action-receipt.js +82 -0
  68. package/src/engram/contracts/capability-index.js +259 -0
  69. package/src/engram/contracts/capability.js +377 -0
  70. package/src/engram/contracts/content-hash.js +8 -0
  71. package/src/engram/contracts/evidence.js +258 -0
  72. package/src/engram/contracts/graph.js +594 -0
  73. package/src/engram/contracts/identity.js +8 -0
  74. package/src/engram/contracts/index.js +149 -0
  75. package/src/engram/contracts/media-asset.js +85 -0
  76. package/src/engram/contracts/money.js +249 -0
  77. package/src/engram/contracts/source-snapshot.js +57 -0
  78. package/src/engram/contracts/task-context-pack.js +114 -0
  79. package/src/engram/contracts/temporal-segment.js +72 -0
  80. package/src/engram/contracts/versions.js +96 -0
  81. package/src/engram/extract-html.js +692 -0
  82. package/src/engram/graph-store.js +877 -0
  83. package/src/engram/index.js +98 -14
  84. package/src/engram/ingest-site.js +132 -0
  85. package/src/engram/live-state.js +1180 -0
  86. package/src/engram/namespace.js +34 -1
  87. package/src/engram/retrieve-site.js +753 -0
  88. package/src/engram/safe-reader.js +597 -0
  89. package/src/engram/source-intake.js +251 -0
  90. package/src/engram/store.js +227 -9
  91. package/src/ingest/engine.js +21 -28
  92. package/src/judge/verdict.js +305 -0
  93. package/src/legacy-cli.js +96 -19
  94. package/src/mcp/bridge-inputs.js +28 -4
  95. package/src/mcp/cli-command-tools.js +70 -0
  96. package/src/mcp/registry.js +17 -13
  97. package/src/mcp/session-stdio-server.js +297 -19
  98. package/src/memory/blackboard.js +5 -4
  99. package/src/net/gh-api-path.js +35 -9
  100. package/src/net/test-egress-guard.js +16 -4
  101. package/src/plugin/manifest.js +12 -8
  102. package/src/review/ai-review.js +110 -10
  103. package/src/review/investor-dd-devtestbot.js +17 -6
  104. package/src/review/investor-dd-orchestrator.js +21 -13
  105. package/src/review/local-review.js +26 -16
  106. package/src/review/omargate-cache.js +5 -5
  107. package/src/review/omargate-orchestrator.js +89 -17
  108. package/src/review/replay.js +9 -4
  109. package/src/review/report.js +22 -13
  110. package/src/review/typesafe-severity.js +201 -0
  111. package/src/session/admission-auth.js +34 -7
  112. package/src/session/admission.js +322 -71
  113. package/src/session/agent-access.js +137 -0
  114. package/src/session/agent-registry.js +2 -1
  115. package/src/session/attachment-summary.js +77 -0
  116. package/src/session/edit-summary.js +19 -0
  117. package/src/session/invitations.js +65 -1
  118. package/src/session/mentions.js +17 -9
  119. package/src/session/message-edits.js +5 -4
  120. package/src/session/preview.js +10 -2
  121. package/src/session/recap.js +3 -2
  122. package/src/session/room-files.js +519 -0
  123. package/src/session/route-classes.js +22 -8
  124. package/src/session/setup-guides.js +4 -0
  125. package/src/session/standup.js +192 -0
  126. package/src/session/sync.js +229 -10
  127. package/src/session/tickets.js +41 -0
  128. package/src/session/transcript.js +2 -1
  129. package/src/session/wake/resolve-target.js +7 -3
  130. package/src/skills/listener-runtime.cjs +92 -0
  131. package/src/skills/service.js +207 -0
  132. package/src/swarm/factory.js +5 -5
  133. package/src/swarm/pentest.js +9 -9
  134. package/src/swarm/report.js +4 -4
  135. package/src/swarm/runtime.js +15 -12
  136. package/src/swarm/scenario-dsl.js +7 -5
  137. package/src/telemetry/ledger.js +16 -7
@@ -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
- storeRoot,
57
- adapters = {},
58
- embedder = createEmbedder(),
59
- consent = createLocalConsent(),
60
- governance = createGovernance(),
61
- renderer = null,
62
- isAuthorizedForSealed,
63
- } = {}) {
64
- const store = createStore({ storeRoot, adapters });
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 = (options) =>
71
- ingestDocumentIntoNamespace({ ...options, deps: { store, buildState } });
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
+ }