@lucern/sdk 0.2.0-alpha.9 → 0.3.0-alpha.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 (101) hide show
  1. package/README.md +6 -0
  2. package/dist/adminClient.d.ts +15 -9
  3. package/dist/adminClient.js.map +1 -1
  4. package/dist/audience/index.d.ts +38 -0
  5. package/dist/audience/index.js +110 -0
  6. package/dist/audience/index.js.map +1 -0
  7. package/dist/beliefs/index.d.ts +463 -0
  8. package/dist/beliefs/index.js +6694 -0
  9. package/dist/beliefs/index.js.map +1 -0
  10. package/dist/beliefs/lifecycle.d.ts +24 -0
  11. package/dist/beliefs/lifecycle.js +98 -0
  12. package/dist/beliefs/lifecycle.js.map +1 -0
  13. package/dist/beliefsClient.d.ts +91 -12
  14. package/dist/beliefsClient.js +176 -7
  15. package/dist/beliefsClient.js.map +1 -1
  16. package/dist/client-DAuKnDlx.d.ts +2547 -0
  17. package/dist/client.d.ts +31 -2377
  18. package/dist/client.js +783 -245
  19. package/dist/client.js.map +1 -1
  20. package/dist/contracts/api-enums.contract.d.ts +1 -1
  21. package/dist/contracts/api-enums.contract.js +8 -2
  22. package/dist/contracts/api-enums.contract.js.map +1 -1
  23. package/dist/contracts/index.d.ts +4 -2
  24. package/dist/contracts/index.js +118 -4282
  25. package/dist/contracts/index.js.map +1 -1
  26. package/dist/contracts/mcpTools.d.ts +2 -1
  27. package/dist/contracts/mcpTools.js +22 -2981
  28. package/dist/contracts/mcpTools.js.map +1 -1
  29. package/dist/contracts/sdk-tools.contract.d.ts +1 -2
  30. package/dist/contracts/sdk-tools.contract.js +1 -4132
  31. package/dist/contracts/sdk-tools.contract.js.map +1 -1
  32. package/dist/contracts/sdkTools.d.ts +1 -2
  33. package/dist/contracts/sdkTools.js +20 -4127
  34. package/dist/contracts/sdkTools.js.map +1 -1
  35. package/dist/contracts/tool-contracts.d.ts +1 -0
  36. package/dist/contracts/tool-contracts.js +3 -0
  37. package/dist/contracts/tool-contracts.js.map +1 -0
  38. package/dist/contradictions/index.d.ts +156 -0
  39. package/dist/contradictions/index.js +6688 -0
  40. package/dist/contradictions/index.js.map +1 -0
  41. package/dist/customTools.d.ts +1 -1
  42. package/dist/decisions/index.d.ts +66 -0
  43. package/dist/decisions/index.js +6690 -0
  44. package/dist/decisions/index.js.map +1 -0
  45. package/dist/edges/index.d.ts +202 -0
  46. package/dist/edges/index.js +6689 -0
  47. package/dist/edges/index.js.map +1 -0
  48. package/dist/events.js +7 -5
  49. package/dist/events.js.map +1 -1
  50. package/dist/evidence/index.d.ts +293 -0
  51. package/dist/evidence/index.js +6689 -0
  52. package/dist/evidence/index.js.map +1 -0
  53. package/dist/evidenceClient.d.ts +119 -0
  54. package/dist/evidenceClient.js +350 -0
  55. package/dist/evidenceClient.js.map +1 -0
  56. package/dist/gatewayFacades.d.ts +8 -10
  57. package/dist/gatewayFacades.js +54 -1
  58. package/dist/gatewayFacades.js.map +1 -1
  59. package/dist/identityClient.d.ts +3 -3
  60. package/dist/identityClient.js.map +1 -1
  61. package/dist/index.d.ts +7 -6
  62. package/dist/index.js +1092 -3294
  63. package/dist/index.js.map +1 -1
  64. package/dist/lenses/index.d.ts +192 -0
  65. package/dist/lenses/index.js +6688 -0
  66. package/dist/lenses/index.js.map +1 -0
  67. package/dist/nodes/index.d.ts +61 -0
  68. package/dist/nodes/index.js +6690 -0
  69. package/dist/nodes/index.js.map +1 -0
  70. package/dist/ontologies/index.d.ts +179 -0
  71. package/dist/ontologies/index.js +6691 -0
  72. package/dist/ontologies/index.js.map +1 -0
  73. package/dist/opinion.d.ts +11 -0
  74. package/dist/opinion.js +35 -0
  75. package/dist/opinion.js.map +1 -0
  76. package/dist/questions/index.d.ts +295 -0
  77. package/dist/questions/index.js +6691 -0
  78. package/dist/questions/index.js.map +1 -0
  79. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +22 -0
  80. package/dist/sourcesClient.d.ts +24 -0
  81. package/dist/{mcpParityClient.js → sourcesClient.js} +15 -192
  82. package/dist/sourcesClient.js.map +1 -0
  83. package/dist/tool-contracts-BUiL9P6z.d.ts +22 -0
  84. package/dist/topics/index.d.ts +66 -0
  85. package/dist/topics/index.js +6689 -0
  86. package/dist/topics/index.js.map +1 -0
  87. package/dist/types.d.ts +20 -1
  88. package/dist/worktrees/index.d.ts +208 -0
  89. package/dist/worktrees/index.js +6691 -0
  90. package/dist/worktrees/index.js.map +1 -0
  91. package/package.json +55 -3
  92. package/dist/contracts/mcp-tools.contract.d.ts +0 -1
  93. package/dist/contracts/mcp-tools.contract.js +0 -2986
  94. package/dist/contracts/mcp-tools.contract.js.map +0 -1
  95. package/dist/mcpParityClient.d.ts +0 -74
  96. package/dist/mcpParityClient.js.map +0 -1
  97. package/dist/mcpParitySurface.d.ts +0 -12
  98. package/dist/mcpParitySurface.js +0 -65
  99. package/dist/mcpParitySurface.js.map +0 -1
  100. package/dist/mcpTools-DPZxowDX.d.ts +0 -254
  101. package/dist/sdkTools-CwXJDACb.d.ts +0 -150
package/dist/index.js CHANGED
@@ -1,4 +1,201 @@
1
1
  import { z } from 'zod';
2
+ import * as tool_contracts_star from '@lucern/contracts/tool-contracts';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
21
+
22
+ // src/index.ts
23
+ var src_exports = {};
24
+ __export(src_exports, {
25
+ BELIEF_STATUSES: () => BELIEF_STATUSES,
26
+ BRANCH_DEPRECATION_MESSAGE: () => BRANCH_DEPRECATION_MESSAGE,
27
+ CANONICAL_WORKFLOW_DEFINITIONS: () => CANONICAL_WORKFLOW_DEFINITIONS,
28
+ CONFIDENCE_TRIGGERS: () => CONFIDENCE_TRIGGERS,
29
+ CONTRADICTION_SEVERITIES: () => CONTRADICTION_SEVERITIES,
30
+ CONTRADICTION_STATUSES: () => CONTRADICTION_STATUSES,
31
+ CONTROL_OBJECT_BLAST_RADII: () => CONTROL_OBJECT_BLAST_RADII,
32
+ CONTROL_OBJECT_EDIT_SURFACES: () => CONTROL_OBJECT_EDIT_SURFACES,
33
+ CONTROL_OBJECT_INHERITANCE_RULES: () => CONTROL_OBJECT_INHERITANCE_RULES,
34
+ CONTROL_OBJECT_KINDS: () => CONTROL_OBJECT_KINDS,
35
+ CONTROL_OBJECT_OWNERSHIP_CONTRACT: () => CONTROL_OBJECT_OWNERSHIP_CONTRACT,
36
+ CONTROL_OBJECT_OWNERSHIP_MATRIX: () => CONTROL_OBJECT_OWNERSHIP_MATRIX,
37
+ CONTROL_OBJECT_OWNERSHIP_ROWS: () => CONTROL_OBJECT_OWNERSHIP_ROWS,
38
+ CONTROL_OBJECT_OWNER_SCOPES: () => CONTROL_OBJECT_OWNER_SCOPES,
39
+ CustomToolRegistryError: () => CustomToolRegistryError,
40
+ DEFAULT_TIER_APPROVAL_MODE: () => DEFAULT_TIER_APPROVAL_MODE,
41
+ DEFAULT_WORKFLOW_AUTO_FIX_POLICY: () => DEFAULT_WORKFLOW_AUTO_FIX_POLICY,
42
+ DEFEAT_TYPES: () => DEFEAT_TYPES,
43
+ DOMAIN_EVENT_TYPES: () => DOMAIN_EVENT_TYPES,
44
+ DOMAIN_EVENT_VERSION: () => DOMAIN_EVENT_VERSION,
45
+ EDGE_TYPES: () => EDGE_TYPES,
46
+ EPISTEMIC_EDGE_TYPES: () => EPISTEMIC_EDGE_TYPES,
47
+ EPISTEMIC_LAYERS: () => EPISTEMIC_LAYERS,
48
+ EVENT_RETENTION_DEFAULT_DAYS: () => EVENT_RETENTION_DEFAULT_DAYS,
49
+ FORK_REASONS: () => FORK_REASONS,
50
+ FUNCTION_SURFACE_METHOD_PATHS: () => FUNCTION_SURFACE_METHOD_PATHS,
51
+ JUDGMENT_TYPES: () => JUDGMENT_TYPES,
52
+ LENS_PERSPECTIVE_TYPES: () => LENS_PERSPECTIVE_TYPES,
53
+ LENS_STATUSES: () => LENS_STATUSES,
54
+ LENS_TASK_TEMPLATE_PRIORITIES: () => LENS_TASK_TEMPLATE_PRIORITIES,
55
+ LUCERN_SDK_VERSION: () => LUCERN_SDK_VERSION,
56
+ LucernApiError: () => LucernApiError,
57
+ MAX_ENTITY_LIMIT: () => MAX_ENTITY_LIMIT,
58
+ MERGE_OUTCOMES: () => MERGE_OUTCOMES,
59
+ MORNING_BRIEF_WORKFLOW_ID: () => MORNING_BRIEF_WORKFLOW_ID,
60
+ NIGHTLY_RECONCILIATION_WORKFLOW_ID: () => NIGHTLY_RECONCILIATION_WORKFLOW_ID,
61
+ REASONING_METHODS: () => REASONING_METHODS,
62
+ SESSION_AUTH_MODES: () => SESSION_AUTH_MODES,
63
+ SESSION_LIFECYCLE_STATUSES: () => SESSION_LIFECYCLE_STATUSES,
64
+ SESSION_PRINCIPAL_TYPES: () => SESSION_PRINCIPAL_TYPES,
65
+ STRUCTURAL_EDGE_TYPES: () => STRUCTURAL_EDGE_TYPES,
66
+ WEBHOOK_MAX_ATTEMPTS: () => WEBHOOK_MAX_ATTEMPTS,
67
+ WEBHOOK_RETRY_DELAYS_MS: () => WEBHOOK_RETRY_DELAYS_MS,
68
+ WORKFLOW_ACTION_KINDS: () => WORKFLOW_ACTION_KINDS,
69
+ WORKFLOW_APPROVAL_MODES: () => WORKFLOW_APPROVAL_MODES,
70
+ WORKFLOW_AUTO_FIX_MODES: () => WORKFLOW_AUTO_FIX_MODES,
71
+ WORKFLOW_HOOK_EVENTS: () => WORKFLOW_HOOK_EVENTS,
72
+ WORKFLOW_INTEGRITY_CHECKS: () => WORKFLOW_INTEGRITY_CHECKS,
73
+ WORKFLOW_MUTATION_TIERS: () => WORKFLOW_MUTATION_TIERS,
74
+ WORKFLOW_OUTPUT_KINDS: () => WORKFLOW_OUTPUT_KINDS,
75
+ WORKFLOW_PROOF_ARTIFACT_KINDS: () => WORKFLOW_PROOF_ARTIFACT_KINDS,
76
+ WORKFLOW_RUNTIME_SCHEMA_VERSION: () => WORKFLOW_RUNTIME_SCHEMA_VERSION,
77
+ WORKFLOW_RUN_STATUSES: () => WORKFLOW_RUN_STATUSES,
78
+ WORKFLOW_STAFFING_HINTS: () => WORKFLOW_STAFFING_HINTS,
79
+ WORKFLOW_TRIGGER_KINDS: () => WORKFLOW_TRIGGER_KINDS,
80
+ WORKTREE_PHASES: () => WORKTREE_PHASES,
81
+ asListItems: () => asListItems,
82
+ assertValidWebhookSecret: () => assertValidWebhookSecret,
83
+ assertValidWebhookUrl: () => assertValidWebhookUrl,
84
+ buildDeprecatedBranchMetadata: () => buildDeprecatedBranchMetadata,
85
+ buildDomainEvent: () => buildDomainEvent,
86
+ clearRegisteredCustomTools: () => clearRegisteredCustomTools,
87
+ compareEventCursor: () => compareEventCursor,
88
+ compileContextPackFromSnapshot: () => compileContextPackFromSnapshot,
89
+ computeWebhookSignature: () => computeWebhookSignature,
90
+ createAdminClient: () => createAdminClient,
91
+ createAnswersClient: () => createAnswersClient,
92
+ createAudiencesClient: () => createAudiencesClient,
93
+ createAuditClient: () => createAuditClient,
94
+ createBeliefsClient: () => createBeliefsClient,
95
+ createContextClient: () => createContextClient,
96
+ createContextFacade: () => createContextFacade,
97
+ createDecisionsClient: () => createDecisionsClient,
98
+ createEventId: () => createEventId,
99
+ createEventsClientCore: () => createEventsClientCore,
100
+ createEvidenceClient: () => createEvidenceClient,
101
+ createFunctionSurfaceClient: () => createFunctionSurfaceClient,
102
+ createGatewayRequestClient: () => createGatewayRequestClient,
103
+ createGraphClient: () => createGraphClient,
104
+ createHarnessClient: () => createHarnessClient,
105
+ createIdentityClient: () => createIdentityClient,
106
+ createLearningClient: () => createLearningClient,
107
+ createListResult: () => createListResult,
108
+ createLucernClient: () => createLucernClient,
109
+ createOntologyClient: () => createOntologyClient,
110
+ createPacksClient: () => createPacksClient,
111
+ createPolicyClient: () => createPolicyClient,
112
+ createReportsClient: () => createReportsClient,
113
+ createSchemaClient: () => createSchemaClient,
114
+ createSourcesClient: () => createSourcesClient,
115
+ createTopicsClient: () => createTopicsClient,
116
+ createWebhooksClientCore: () => createWebhooksClientCore,
117
+ createWorkflowClient: () => createWorkflowClient,
118
+ decodeEventCursor: () => decodeEventCursor,
119
+ emitDomainEvent: () => emitDomainEvent,
120
+ encodeEventCursor: () => encodeEventCursor,
121
+ eventPatternToRegExp: () => eventPatternToRegExp,
122
+ getControlObjectOwnershipCase: () => getControlObjectOwnershipCase,
123
+ getRegisteredCustomTool: () => getRegisteredCustomTool,
124
+ inferActorType: () => inferActorType,
125
+ inferLensPerspectiveTypeFromBranchSchema: () => inferLensPerspectiveTypeFromBranchSchema,
126
+ inferSessionPrincipalType: () => inferSessionPrincipalType,
127
+ invokeRegisteredCustomTool: () => invokeRegisteredCustomTool,
128
+ isAfterCursor: () => isAfterCursor,
129
+ isLensFilterCriteria: () => isLensFilterCriteria,
130
+ isLucernPrompt: () => isLucernPrompt,
131
+ isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV1,
132
+ lastDelegator: () => lastDelegator,
133
+ listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
134
+ listRegisteredCustomTools: () => listRegisteredCustomTools,
135
+ mapAliasedList: () => mapAliasedList,
136
+ mapGatewayData: () => mapGatewayData,
137
+ mapOpinionHistoryEntriesFromGatewayData: () => mapOpinionHistoryEntriesFromGatewayData,
138
+ matchesAnyEventPattern: () => matchesAnyEventPattern,
139
+ matchesEventPattern: () => matchesEventPattern,
140
+ migrateBranchToLens: () => migrateBranchToLens,
141
+ nextDeliveryAttemptAt: () => nextDeliveryAttemptAt,
142
+ normalizeDelegationChain: () => normalizeDelegationChain,
143
+ normalizeNodeVerificationStatus: () => normalizeNodeVerificationStatus,
144
+ normalizeNodeWriteInput: () => normalizeNodeWriteInput,
145
+ normalizeRetentionDays: () => normalizeRetentionDays,
146
+ normalizeTopicQuery: () => normalizeTopicQuery,
147
+ normalizeWebhookPatterns: () => normalizeWebhookPatterns,
148
+ opinionFromBaseRate: () => opinionFromBaseRate,
149
+ opinionFromDogmatic: () => opinionFromDogmatic,
150
+ opinionFromProjected: () => opinionFromProjected,
151
+ planContextPackCompilation: () => planContextPackCompilation,
152
+ randomIdempotencyKey: () => randomIdempotencyKey,
153
+ registerCustomTool: () => registerCustomTool,
154
+ resolveDeliveryFailureStatus: () => resolveDeliveryFailureStatus,
155
+ resolveText: () => resolveText,
156
+ resolveTopicId: () => resolveTopicId,
157
+ sanitizeWebhookRecord: () => sanitizeWebhookRecord,
158
+ sortEventsByCursor: () => sortEventsByCursor,
159
+ toQueryString: () => toQueryString,
160
+ truncateWebhookResponseBody: () => truncateWebhookResponseBody,
161
+ unregisterCustomTool: () => unregisterCustomTool,
162
+ validateFilterCriteria: () => validateFilterCriteria,
163
+ withSdkAliases: () => withSdkAliases,
164
+ withTextAlias: () => withTextAlias,
165
+ withTopicAlias: () => withTopicAlias
166
+ });
167
+
168
+ // src/opinion.ts
169
+ function clamp01(value) {
170
+ if (!Number.isFinite(value)) {
171
+ return 0;
172
+ }
173
+ return Math.max(0, Math.min(1, value));
174
+ }
175
+ function vacuous(baseRate = 0.5) {
176
+ return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
177
+ }
178
+ function dogmatic(probability, baseRate = 0.5) {
179
+ const p = clamp01(probability);
180
+ return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
181
+ }
182
+ function opinionFromBaseRate(probability) {
183
+ return vacuous(clamp01(probability));
184
+ }
185
+ function opinionFromDogmatic(probability, baseRate = 0.5) {
186
+ return dogmatic(clamp01(probability), clamp01(baseRate));
187
+ }
188
+ function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
189
+ const p = clamp01(probability);
190
+ const u = clamp01(uncertainty);
191
+ const remainingMass = 1 - u;
192
+ return {
193
+ b: p * remainingMass,
194
+ d: (1 - p) * remainingMass,
195
+ u,
196
+ a: clamp01(baseRate)
197
+ };
198
+ }
2
199
 
3
200
  // src/coreClient.ts
4
201
  var LucernApiError = class extends Error {
@@ -998,31 +1195,168 @@ function createAuditClient(config = {}) {
998
1195
  }
999
1196
 
1000
1197
  // src/beliefsClient.ts
1198
+ function asRecord2(value) {
1199
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1200
+ }
1201
+ function readString(value) {
1202
+ if (typeof value !== "string") {
1203
+ return void 0;
1204
+ }
1205
+ const normalized = value.trim();
1206
+ return normalized.length > 0 ? normalized : void 0;
1207
+ }
1208
+ function readNumber(value) {
1209
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
1210
+ }
1211
+ function clamp012(value) {
1212
+ return Math.max(0, Math.min(1, value));
1213
+ }
1214
+ function normalizeOpinionTuple(record) {
1215
+ const opinion = asRecord2(record.opinion);
1216
+ const rawBelief = readNumber(opinion.b) ?? readNumber(record.belief);
1217
+ const rawDisbelief = readNumber(opinion.d) ?? readNumber(record.disbelief);
1218
+ const rawUncertainty = readNumber(opinion.u) ?? readNumber(record.uncertainty);
1219
+ const rawBaseRate = readNumber(opinion.a) ?? readNumber(record.baseRate);
1220
+ if (rawBelief === void 0 && rawDisbelief === void 0 && rawUncertainty === void 0) {
1221
+ const projected = clamp012(readNumber(record.confidence) ?? 0);
1222
+ return {
1223
+ b: projected,
1224
+ d: 1 - projected,
1225
+ u: 0,
1226
+ a: 0.5
1227
+ };
1228
+ }
1229
+ return {
1230
+ b: clamp012(rawBelief ?? 0),
1231
+ d: clamp012(rawDisbelief ?? 0),
1232
+ u: clamp012(rawUncertainty ?? 0),
1233
+ a: clamp012(rawBaseRate ?? 0.5)
1234
+ };
1235
+ }
1236
+ function mapOpinionHistoryEntriesFromGatewayData(payload) {
1237
+ const entries = Array.isArray(payload.entries) ? payload.entries : [];
1238
+ return entries.map((value) => {
1239
+ const record = asRecord2(value);
1240
+ const tuple = normalizeOpinionTuple(record);
1241
+ const projected = readNumber(record.confidence) ?? clamp012(tuple.b + tuple.a * tuple.u);
1242
+ const triggeringEvidenceId = readString(record.triggeringEvidenceId);
1243
+ const triggeringWorktreeId = readString(record.triggeringWorktreeId);
1244
+ return {
1245
+ t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
1246
+ b: tuple.b,
1247
+ d: tuple.d,
1248
+ u: tuple.u,
1249
+ a: tuple.a,
1250
+ P: clamp012(projected),
1251
+ trigger: readString(record.trigger) ?? "manual",
1252
+ ...triggeringEvidenceId ? {
1253
+ triggeringRef: {
1254
+ kind: "evidence",
1255
+ id: triggeringEvidenceId
1256
+ }
1257
+ } : triggeringWorktreeId ? {
1258
+ triggeringRef: {
1259
+ kind: "worktree",
1260
+ id: triggeringWorktreeId
1261
+ }
1262
+ } : {},
1263
+ ...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
1264
+ ...readString(record.userId) ? { userId: readString(record.userId) } : {},
1265
+ ...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
1266
+ };
1267
+ }).sort((left, right) => left.t - right.t);
1268
+ }
1269
+ function normalizeModulateConfidenceInput(input) {
1270
+ const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
1271
+ input.confidence,
1272
+ input.uncertainty,
1273
+ input.baseRate
1274
+ );
1275
+ return {
1276
+ belief: opinion.b,
1277
+ disbelief: opinion.d,
1278
+ uncertainty: opinion.u,
1279
+ baseRate: opinion.a,
1280
+ trigger: input.trigger,
1281
+ rationale: input.rationale,
1282
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
1283
+ };
1284
+ }
1001
1285
  function createBeliefsClient(config = {}) {
1002
1286
  const gateway = createGatewayRequestClient(config);
1287
+ function requireBaseRate2(value) {
1288
+ const baseRate = readNumber(value);
1289
+ if (baseRate === void 0) {
1290
+ throw new Error("baseRate is required for belief creation.");
1291
+ }
1292
+ if (baseRate < 0 || baseRate > 1) {
1293
+ throw new Error("baseRate must be within [0, 1].");
1294
+ }
1295
+ return baseRate;
1296
+ }
1297
+ const modulateConfidence = async (beliefId, input, idempotencyKey) => gateway.request({
1298
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1299
+ method: "POST",
1300
+ body: normalizeModulateConfidenceInput(input),
1301
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1302
+ });
1303
+ async function getOpinionHistory(beliefId) {
1304
+ const response = await gateway.request({
1305
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
1306
+ });
1307
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
1308
+ }
1003
1309
  return {
1004
1310
  /**
1005
1311
  * Create a belief within a topic scope.
1006
1312
  */
1007
1313
  async createBelief(input, idempotencyKey) {
1314
+ const baseRate = requireBaseRate2(input.baseRate);
1008
1315
  return gateway.request({
1009
1316
  path: "/api/platform/v1/beliefs",
1010
1317
  method: "POST",
1011
- body: normalizeNodeWriteInput(input),
1318
+ body: {
1319
+ ...normalizeNodeWriteInput(input),
1320
+ baseRate
1321
+ },
1012
1322
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1013
1323
  });
1014
1324
  },
1015
1325
  /**
1016
- * Record a confidence change for an existing belief.
1326
+ * Refine a draft belief in place.
1017
1327
  */
1018
- async modulateConfidence(beliefId, input, idempotencyKey) {
1328
+ async refineBelief(beliefId, input, idempotencyKey) {
1019
1329
  return gateway.request({
1020
- path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
1021
- method: "POST",
1022
- body: input,
1330
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}`,
1331
+ method: "PATCH",
1332
+ body: normalizeNodeWriteInput(input),
1023
1333
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1024
1334
  });
1025
1335
  },
1336
+ /**
1337
+ * Record a confidence change for an existing belief.
1338
+ */
1339
+ modulateConfidence,
1340
+ /**
1341
+ * Returns the belief's confidence trajectory as a chronological array.
1342
+ *
1343
+ * Canonical UI trend shape (what every trend component consumes):
1344
+ * { t: number, b: number, d: number, u: number, a: number, P: number, trigger: string, triggeringRef?: { kind: "evidence" | "worktree"; id: string } }[]
1345
+ *
1346
+ * Where:
1347
+ * t = assessedAt (epoch ms)
1348
+ * b, d, u, a = Opinion 4-tuple components
1349
+ * P = projected probability = b + a*u (precomputed for UI convenience)
1350
+ * trigger = cause of the score change
1351
+ * triggeringRef = optional pointer to the evidence or worktree that drove the change
1352
+ */
1353
+ async getOpinionHistory(beliefId) {
1354
+ return getOpinionHistory(beliefId);
1355
+ },
1356
+ /** @deprecated Use getOpinionHistory(). */
1357
+ async getConfidenceHistory(beliefId) {
1358
+ return getOpinionHistory(beliefId);
1359
+ },
1026
1360
  /**
1027
1361
  * Fork a scored belief into a new formulation.
1028
1362
  */
@@ -1113,6 +1447,57 @@ function createBeliefsClient(config = {}) {
1113
1447
  }
1114
1448
  };
1115
1449
  }
1450
+
1451
+ // src/sourcesClient.ts
1452
+ function createSourcesClient(config = {}) {
1453
+ const gateway = createGatewayRequestClient(config);
1454
+ return {
1455
+ async upsert(spec, idempotencyKey = randomIdempotencyKey()) {
1456
+ return gateway.request({
1457
+ path: "/api/platform/v1/sources/upsert",
1458
+ method: "POST",
1459
+ body: spec,
1460
+ idempotencyKey
1461
+ });
1462
+ },
1463
+ async get(sourceId) {
1464
+ return gateway.request({
1465
+ path: `/api/platform/v1/sources/${encodeURIComponent(sourceId)}`
1466
+ });
1467
+ }
1468
+ };
1469
+ }
1470
+
1471
+ // src/evidenceClient.ts
1472
+ function createEvidenceClient(config = {}) {
1473
+ const gateway = createGatewayRequestClient(config);
1474
+ return {
1475
+ async classifyEvidence(beliefId, evidenceId, classificationConfig, idempotencyKey) {
1476
+ return gateway.request({
1477
+ path: "/api/platform/v1/evidence/classify",
1478
+ method: "POST",
1479
+ body: {
1480
+ beliefId,
1481
+ evidenceId,
1482
+ config: classificationConfig
1483
+ },
1484
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1485
+ });
1486
+ },
1487
+ async classifyEvidenceBatch(beliefId, evidence, classificationConfig, idempotencyKey) {
1488
+ return gateway.request({
1489
+ path: "/api/platform/v1/evidence/classify-batch",
1490
+ method: "POST",
1491
+ body: {
1492
+ beliefId,
1493
+ evidence,
1494
+ config: classificationConfig
1495
+ },
1496
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
1497
+ });
1498
+ }
1499
+ };
1500
+ }
1116
1501
  var DEFAULT_CUSTOM_NAMESPACE = "custom";
1117
1502
  var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
1118
1503
  var CustomToolRegistryError = class extends Error {
@@ -1902,14 +2287,14 @@ function createIdentityClient(config = {}) {
1902
2287
  }
1903
2288
 
1904
2289
  // src/topicsClient.ts
1905
- function asRecord2(value) {
2290
+ function asRecord3(value) {
1906
2291
  return value && typeof value === "object" ? value : {};
1907
2292
  }
1908
2293
  function cleanString2(value) {
1909
2294
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1910
2295
  }
1911
2296
  function normalizeTopicRecord(value) {
1912
- const record = asRecord2(value);
2297
+ const record = asRecord3(value);
1913
2298
  const topicId = cleanString2(record.topicId) ?? cleanString2(record.id) ?? cleanString2(record._id);
1914
2299
  return withTopicAlias({
1915
2300
  ...record,
@@ -1934,7 +2319,7 @@ function createTopicsClient(config = {}) {
1934
2319
  })}`
1935
2320
  }).then(
1936
2321
  (response) => mapGatewayData(response, (data) => {
1937
- const record = asRecord2(data);
2322
+ const record = asRecord3(data);
1938
2323
  const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
1939
2324
  return {
1940
2325
  ...createListResult(items, "topics"),
@@ -1951,7 +2336,7 @@ function createTopicsClient(config = {}) {
1951
2336
  }).then(
1952
2337
  (response) => mapGatewayData(
1953
2338
  response,
1954
- (data) => normalizeTopicRecord(asRecord2(data).topic ?? data)
2339
+ (data) => normalizeTopicRecord(asRecord3(data).topic ?? data)
1955
2340
  )
1956
2341
  );
1957
2342
  },
@@ -1987,7 +2372,7 @@ function createTopicsClient(config = {}) {
1987
2372
  )}`
1988
2373
  }).then(
1989
2374
  (response) => mapGatewayData(response, (data) => {
1990
- const record = asRecord2(data);
2375
+ const record = asRecord3(data);
1991
2376
  return {
1992
2377
  tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
1993
2378
  };
@@ -2021,6 +2406,22 @@ function createTopicsClient(config = {}) {
2021
2406
  }
2022
2407
 
2023
2408
  // src/gatewayFacades.ts
2409
+ function normalizeBeliefConfidenceInput(input) {
2410
+ const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
2411
+ input.confidence,
2412
+ input.uncertainty,
2413
+ input.baseRate
2414
+ );
2415
+ return {
2416
+ belief: opinion.b,
2417
+ disbelief: opinion.d,
2418
+ uncertainty: opinion.u,
2419
+ baseRate: opinion.a,
2420
+ trigger: input.trigger,
2421
+ rationale: input.rationale,
2422
+ maxInlinePropagationTargets: input.maxInlinePropagationTargets
2423
+ };
2424
+ }
2024
2425
  function serializeTypes(types) {
2025
2426
  return Array.isArray(types) && types.length > 0 ? types.join(",") : void 0;
2026
2427
  }
@@ -2072,7 +2473,7 @@ function createBeliefsFacade(config = {}) {
2072
2473
  return gateway.request({
2073
2474
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence`,
2074
2475
  method: "POST",
2075
- body: input,
2476
+ body: normalizeBeliefConfidenceInput(input),
2076
2477
  idempotencyKey
2077
2478
  });
2078
2479
  },
@@ -2150,6 +2551,11 @@ function createBeliefsFacade(config = {}) {
2150
2551
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2151
2552
  });
2152
2553
  },
2554
+ async opinionHistory(id) {
2555
+ return gateway.request({
2556
+ path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`
2557
+ });
2558
+ },
2153
2559
  async createContract(id, input, idempotencyKey = randomIdempotencyKey()) {
2154
2560
  return gateway.request({
2155
2561
  path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/contracts`,
@@ -3370,199 +3776,589 @@ function createLearningClient(config = {}) {
3370
3776
  };
3371
3777
  }
3372
3778
 
3373
- // src/mcpParityClient.ts
3374
- function withSdkSessionId(args, sessionId) {
3779
+ // src/generated/functionSurface.ts
3780
+ var FUNCTION_SURFACE_METHOD_PATHS = [
3781
+ "answers.answerQuestion",
3782
+ "answers.createAnswer",
3783
+ "answers.getAnswer",
3784
+ "beliefs.archiveBelief",
3785
+ "beliefs.bisectConfidence",
3786
+ "beliefs.createBelief",
3787
+ "beliefs.forkBelief",
3788
+ "beliefs.getBelief",
3789
+ "beliefs.getConfidenceHistory",
3790
+ "beliefs.listBeliefs",
3791
+ "beliefs.modulateConfidence",
3792
+ "beliefs.refineBelief",
3793
+ "beliefs.searchBeliefs",
3794
+ "bootstrap.generateSessionHandoff",
3795
+ "coding.getChangeHistory",
3796
+ "coding.getCodeContext",
3797
+ "coding.getFailureLog",
3798
+ "coding.recordAttempt",
3799
+ "context.analyzeTopicDensity",
3800
+ "context.applyAutoBranching",
3801
+ "context.compileContext",
3802
+ "context.discover",
3803
+ "context.discoverEntityConnections",
3804
+ "context.getLatticeCoverage",
3805
+ "context.recordScopeLearning",
3806
+ "context.seedBeliefLattice",
3807
+ "context.triggerBeliefReview",
3808
+ "contracts.createEpistemicContract",
3809
+ "contracts.evaluateContract",
3810
+ "contracts.getContractStatus",
3811
+ "contradictions.flagContradiction",
3812
+ "coordination.broadcastMessage",
3813
+ "coordination.claimFiles",
3814
+ "coordination.endSession",
3815
+ "coordination.getAgentInbox",
3816
+ "coordination.heartbeatSession",
3817
+ "coordination.listActiveSessions",
3818
+ "coordination.registerSession",
3819
+ "coordination.sendAgentMessage",
3820
+ "edges.createEdge",
3821
+ "edges.queryLineage",
3822
+ "evidence.addEvidence",
3823
+ "evidence.createEvidence",
3824
+ "evidence.getEvidence",
3825
+ "evidence.linkEvidence",
3826
+ "evidence.linkEvidenceToBelief",
3827
+ "evidence.linkEvidenceToQuestion",
3828
+ "evidence.listEvidence",
3829
+ "evidence.searchEvidence",
3830
+ "graph.detectConfirmationBias",
3831
+ "graph.findContradictions",
3832
+ "graph.getGraphGaps",
3833
+ "graph.getGraphNeighborhood",
3834
+ "graph.getGraphStructureAnalysis",
3835
+ "graph.getTopicCoverage",
3836
+ "graph.traceEntityImpact",
3837
+ "graph.traverseGraph",
3838
+ "identity.checkPermission",
3839
+ "identity.filterByPermission",
3840
+ "identity.whoami",
3841
+ "judgments.getAuditTrail",
3842
+ "judgments.recordJudgment",
3843
+ "lenses.applyLensToTopic",
3844
+ "lenses.createLens",
3845
+ "lenses.listLenses",
3846
+ "lenses.removeLensFromTopic",
3847
+ "observations.getObservationContext",
3848
+ "observations.ingestObservation",
3849
+ "ontologies.applyOntology",
3850
+ "ontologies.archiveOntology",
3851
+ "ontologies.createOntology",
3852
+ "ontologies.createOntologyVersion",
3853
+ "ontologies.deprecateOntologyVersion",
3854
+ "ontologies.getOntology",
3855
+ "ontologies.listOntologies",
3856
+ "ontologies.matchEntityType",
3857
+ "ontologies.publishOntologyVersion",
3858
+ "ontologies.resolveEffectiveOntology",
3859
+ "ontologies.updateOntology",
3860
+ "policy.manageWritePolicy",
3861
+ "questions.archiveQuestion",
3862
+ "questions.createQuestion",
3863
+ "questions.findMissingQuestions",
3864
+ "questions.getFalsificationQuestions",
3865
+ "questions.getHighPriorityQuestions",
3866
+ "questions.getQuestion",
3867
+ "questions.listQuestions",
3868
+ "questions.refineQuestion",
3869
+ "questions.updateQuestionStatus",
3870
+ "tasks.completeTask",
3871
+ "tasks.createTask",
3872
+ "tasks.listTasks",
3873
+ "tasks.updateTask",
3874
+ "topics.createTopic",
3875
+ "topics.getTopic",
3876
+ "topics.getTopicTree",
3877
+ "topics.listTopics",
3878
+ "topics.updateTopic",
3879
+ "worktrees.activateWorktree",
3880
+ "worktrees.addWorktree",
3881
+ "worktrees.listAllWorktrees",
3882
+ "worktrees.listWorktrees",
3883
+ "worktrees.merge",
3884
+ "worktrees.openPullRequest",
3885
+ "worktrees.pipelineSnapshot",
3886
+ "worktrees.push",
3887
+ "worktrees.updateWorktreeMetadata",
3888
+ "worktrees.updateWorktreeTargets"
3889
+ ];
3890
+ var CONTRACTS = {
3891
+ "activate_worktree": { method: "POST", path: "/worktrees/activate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3892
+ "add_evidence": { method: "POST", path: "/evidence/add", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3893
+ "add_worktree": { method: "POST", path: "/worktrees", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3894
+ "analyze_topic_density": { method: "POST", path: "/scope/topic-density", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3895
+ "answer_question": { method: "POST", path: "/questions/answer", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3896
+ "apply_auto_branching": { method: "POST", path: "/scope/auto-branching", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3897
+ "apply_lens_to_topic": { method: "POST", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3898
+ "apply_ontology": { method: "POST", path: "/ontologies/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3899
+ "archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3900
+ "archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3901
+ "archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3902
+ "bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3903
+ "broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3904
+ "check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3905
+ "claim_files": { method: "POST", path: "/coordination/file-claims", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3906
+ "compile_context": { method: "POST", path: "/context/compile", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3907
+ "complete_task": { method: "POST", path: "/tasks/complete", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3908
+ "create_answer": { method: "POST", path: "/answers", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3909
+ "create_belief": { method: "POST", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3910
+ "create_edge": { method: "POST", path: "/edges", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3911
+ "create_epistemic_contract": { method: "POST", path: "/contracts", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3912
+ "create_evidence": { method: "POST", path: "/evidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3913
+ "create_lens": { method: "POST", path: "/lenses", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3914
+ "create_ontology": { method: "POST", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3915
+ "create_ontology_version": { method: "POST", path: "/ontologies/versions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3916
+ "create_question": { method: "POST", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3917
+ "create_task": { method: "POST", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3918
+ "create_topic": { method: "POST", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3919
+ "deprecate_ontology_version": { method: "POST", path: "/ontologies/versions/deprecate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3920
+ "detect_confirmation_bias": { method: "POST", path: "/graph/confirmation-bias", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3921
+ "discover": { method: "POST", path: "/context/discover", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3922
+ "discover_entity_connections": { method: "POST", path: "/context/entity-connections", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3923
+ "end_session": { method: "POST", path: "/coordination/end-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3924
+ "evaluate_contract": { method: "POST", path: "/contracts/evaluate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3925
+ "filter_by_permission": { method: "POST", path: "/identity/filter-by-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3926
+ "find_contradictions": { method: "POST", path: "/graph/contradictions", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3927
+ "find_missing_questions": { method: "POST", path: "/questions/missing", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3928
+ "flag_contradiction": { method: "POST", path: "/contradictions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3929
+ "fork_belief": { method: "POST", path: "/beliefs/fork", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3930
+ "generate_session_handoff": { method: "POST", path: "/bootstrap/session-handoff", kind: "query", idempotent: false, surfaceIntent: "system" },
3931
+ "get_agent_inbox": { method: "POST", path: "/coordination/messages/inbox", kind: "query", idempotent: false, surfaceIntent: "system" },
3932
+ "get_answer": { method: "GET", path: "/answers/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3933
+ "get_audit_trail": { method: "POST", path: "/judgments/audit-trail", kind: "query", idempotent: false, surfaceIntent: "system" },
3934
+ "get_belief": { method: "GET", path: "/beliefs/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3935
+ "get_change_history": { method: "POST", path: "/coding/change-history", kind: "query", idempotent: false, surfaceIntent: "system" },
3936
+ "get_code_context": { method: "POST", path: "/coding/context", kind: "query", idempotent: false, surfaceIntent: "system" },
3937
+ "get_confidence_history": { method: "POST", path: "/beliefs/confidence-history", kind: "query", idempotent: false, surfaceIntent: "compatibility" },
3938
+ "get_contract_status": { method: "POST", path: "/contracts/status", kind: "query", idempotent: false, surfaceIntent: "mcp_governance" },
3939
+ "get_evidence": { method: "GET", path: "/evidence/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3940
+ "get_failure_log": { method: "POST", path: "/coding/failure-log", kind: "query", idempotent: false, surfaceIntent: "system" },
3941
+ "get_falsification_questions": { method: "POST", path: "/questions/falsification", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3942
+ "get_graph_gaps": { method: "POST", path: "/graph/gaps", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3943
+ "get_graph_neighborhood": { method: "POST", path: "/graph/neighborhood", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3944
+ "get_graph_structure_analysis": { method: "POST", path: "/graph/structure-analysis", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3945
+ "get_high_priority_questions": { method: "POST", path: "/questions/high-priority", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3946
+ "get_lattice_coverage": { method: "POST", path: "/scope/belief-lattice/coverage", kind: "query", idempotent: false, surfaceIntent: "system" },
3947
+ "get_observation_context": { method: "POST", path: "/observations/context", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3948
+ "get_ontology": { method: "GET", path: "/ontologies/get", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3949
+ "get_question": { method: "GET", path: "/questions/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3950
+ "get_topic": { method: "GET", path: "/topics/get", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3951
+ "get_topic_coverage": { method: "POST", path: "/graph/topic-coverage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3952
+ "get_topic_tree": { method: "GET", path: "/topics/tree", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3953
+ "heartbeat_session": { method: "POST", path: "/coordination/heartbeat-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3954
+ "identity_whoami": { method: "GET", path: "/identity/whoami", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3955
+ "ingest_observation": { method: "POST", path: "/observations/ingest", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3956
+ "link_evidence": { method: "POST", path: "/evidence/link", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
3957
+ "link_evidence_to_belief": { method: "POST", path: "/evidence/link-belief", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3958
+ "link_evidence_to_question": { method: "POST", path: "/evidence/link-question", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3959
+ "list_active_sessions": { method: "POST", path: "/coordination/active-sessions", kind: "query", idempotent: false, surfaceIntent: "system" },
3960
+ "list_all_worktrees": { method: "GET", path: "/worktrees/all", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3961
+ "list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3962
+ "list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3963
+ "list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3964
+ "list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3965
+ "list_questions": { method: "GET", path: "/questions", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3966
+ "list_tasks": { method: "GET", path: "/tasks", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3967
+ "list_topics": { method: "GET", path: "/topics", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3968
+ "list_worktrees": { method: "GET", path: "/worktrees", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3969
+ "manage_write_policy": { method: "POST", path: "/policy/write-policy/manage", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3970
+ "match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3971
+ "merge": { method: "POST", path: "/worktrees/merge", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3972
+ "modulate_confidence": { method: "POST", path: "/beliefs/confidence", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3973
+ "open_pull_request": { method: "POST", path: "/worktrees/open-pull-request", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3974
+ "pipeline_snapshot": { method: "POST", path: "/worktrees/pipeline-snapshot", kind: "query", idempotent: false, surfaceIntent: "system" },
3975
+ "publish_ontology_version": { method: "POST", path: "/ontologies/versions/publish", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3976
+ "push": { method: "POST", path: "/worktrees/push", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3977
+ "query_lineage": { method: "POST", path: "/edges/lineage", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3978
+ "record_attempt": { method: "POST", path: "/coding/attempts", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3979
+ "record_judgment": { method: "POST", path: "/judgments", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3980
+ "record_scope_learning": { method: "POST", path: "/scope/learnings", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3981
+ "refine_belief": { method: "PATCH", path: "/beliefs/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3982
+ "refine_question": { method: "PATCH", path: "/questions/refine", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3983
+ "register_session": { method: "POST", path: "/coordination/register-session", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3984
+ "remove_lens_from_topic": { method: "DELETE", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3985
+ "resolve_effective_ontology": { method: "POST", path: "/ontologies/effective", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
3986
+ "search_beliefs": { method: "POST", path: "/beliefs/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3987
+ "search_evidence": { method: "POST", path: "/evidence/search", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
3988
+ "seed_belief_lattice": { method: "POST", path: "/scope/belief-lattice/seed", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3989
+ "send_agent_message": { method: "POST", path: "/coordination/messages/send", kind: "mutation", idempotent: true, surfaceIntent: "system" },
3990
+ "trace_entity_impact": { method: "POST", path: "/graph/trace-entity-impact", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3991
+ "traverse_graph": { method: "POST", path: "/graph/traverse", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
3992
+ "trigger_belief_review": { method: "POST", path: "/context/belief-review", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
3993
+ "update_ontology": { method: "PATCH", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
3994
+ "update_question_status": { method: "PATCH", path: "/questions/status", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3995
+ "update_task": { method: "PATCH", path: "/tasks", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3996
+ "update_topic": { method: "PATCH", path: "/topics", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
3997
+ "update_worktree_metadata": { method: "PATCH", path: "/worktrees/metadata", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
3998
+ "update_worktree_targets": { method: "PATCH", path: "/worktrees/targets", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" }
3999
+ };
4000
+ function createSessionId() {
4001
+ return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : randomIdempotencyKey();
4002
+ }
4003
+ function withSdkSessionId(input, sessionId) {
3375
4004
  return {
3376
- ...args ?? {},
3377
- __sdkSessionId: sessionId
4005
+ ...input,
4006
+ __sdkSessionId: typeof input.__sdkSessionId === "string" ? input.__sdkSessionId : sessionId
3378
4007
  };
3379
4008
  }
3380
- function createMcpParityClient(config = {}) {
3381
- const gateway = createGatewayRequestClient(config);
3382
- const sessionId = crypto.randomUUID();
3383
- function executeRead(toolName, args) {
3384
- return gateway.request({
3385
- path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
3386
- method: "POST",
3387
- body: withSdkSessionId(args, sessionId)
3388
- });
4009
+ function toFunctionSurfaceQuery(input) {
4010
+ const params = new URLSearchParams();
4011
+ for (const [key, value] of Object.entries(input)) {
4012
+ if (value === void 0) {
4013
+ continue;
4014
+ }
4015
+ const serialized2 = typeof value === "string" ? value : JSON.stringify(value);
4016
+ if (serialized2 !== void 0) {
4017
+ params.set(key, serialized2);
4018
+ }
3389
4019
  }
3390
- function executeMutation(toolName, args, idempotencyKey) {
4020
+ const serialized = params.toString();
4021
+ return serialized ? `?${serialized}` : "";
4022
+ }
4023
+ function createFunctionSurfaceClient(config = {}) {
4024
+ const gateway = createGatewayRequestClient(config);
4025
+ const sessionId = createSessionId();
4026
+ function execute(name, input, idempotencyKey) {
4027
+ const contract = CONTRACTS[name];
4028
+ const payload = withSdkSessionId(input, sessionId);
4029
+ const path = contract.method === "GET" ? `${contract.path}${toFunctionSurfaceQuery(payload)}` : contract.path;
3391
4030
  return gateway.request({
3392
- path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
3393
- method: "POST",
3394
- body: withSdkSessionId(args, sessionId),
3395
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
4031
+ path: `/api/platform/v1${path}`,
4032
+ method: contract.method,
4033
+ body: contract.method === "GET" ? void 0 : payload,
4034
+ idempotencyKey: contract.kind !== "query" && Boolean(contract.idempotent) ? idempotencyKey ?? randomIdempotencyKey() : void 0
3396
4035
  });
3397
4036
  }
3398
4037
  return {
3399
4038
  sessionId,
3400
- listTopics(args = {}) {
3401
- return executeRead("list_topics", args);
4039
+ activateWorktree(input = {}, idempotencyKey) {
4040
+ return execute("activate_worktree", input, idempotencyKey);
3402
4041
  },
3403
- createTopic(args, idempotencyKey) {
3404
- return executeMutation("create_topic", args, idempotencyKey);
4042
+ addEvidence(input = {}, idempotencyKey) {
4043
+ return execute("add_evidence", input, idempotencyKey);
3405
4044
  },
3406
- getTopic(args) {
3407
- return executeRead("get_topic", args);
4045
+ addWorktree(input = {}, idempotencyKey) {
4046
+ return execute("add_worktree", input, idempotencyKey);
3408
4047
  },
3409
- getTopicTree(args) {
3410
- return executeRead("get_topic_tree", args);
4048
+ analyzeTopicDensity(input = {}, idempotencyKey) {
4049
+ return execute("analyze_topic_density", input, idempotencyKey);
3411
4050
  },
3412
- activateWorktree(args, idempotencyKey) {
3413
- return executeMutation("activate_worktree", args, idempotencyKey);
4051
+ answerQuestion(input = {}, idempotencyKey) {
4052
+ return execute("answer_question", input, idempotencyKey);
3414
4053
  },
3415
- updateWorktreeMetadata(args, idempotencyKey) {
3416
- return executeMutation("update_worktree_metadata", args, idempotencyKey);
4054
+ applyAutoBranching(input = {}, idempotencyKey) {
4055
+ return execute("apply_auto_branching", input, idempotencyKey);
3417
4056
  },
3418
- updateWorktreeTargets(args, idempotencyKey) {
3419
- return executeMutation("update_worktree_targets", args, idempotencyKey);
4057
+ applyLensToTopic(input = {}, idempotencyKey) {
4058
+ return execute("apply_lens_to_topic", input, idempotencyKey);
3420
4059
  },
3421
- listAllWorktrees(args = {}) {
3422
- return executeRead("list_all_worktrees", args);
4060
+ applyOntology(input = {}, idempotencyKey) {
4061
+ return execute("apply_ontology", input, idempotencyKey);
3423
4062
  },
3424
- pipelineSnapshot(args) {
3425
- return executeRead("pipeline_snapshot", args);
4063
+ archiveBelief(input = {}, idempotencyKey) {
4064
+ return execute("archive_belief", input, idempotencyKey);
3426
4065
  },
3427
- recordScopeLearning(args, idempotencyKey) {
3428
- return executeMutation("record_scope_learning", args, idempotencyKey);
4066
+ archiveOntology(input = {}, idempotencyKey) {
4067
+ return execute("archive_ontology", input, idempotencyKey);
3429
4068
  },
3430
- discover(args) {
3431
- return executeRead("discover", args);
4069
+ archiveQuestion(input = {}, idempotencyKey) {
4070
+ return execute("archive_question", input, idempotencyKey);
3432
4071
  },
3433
- analyzeTopicDensity(args) {
3434
- return executeRead("analyze_topic_density", args);
4072
+ bisectConfidence(input = {}, idempotencyKey) {
4073
+ return execute("bisect_confidence", input, idempotencyKey);
3435
4074
  },
3436
- applyAutoBranching(args, idempotencyKey) {
3437
- return executeMutation("apply_auto_branching", args, idempotencyKey);
4075
+ broadcastMessage(input = {}, idempotencyKey) {
4076
+ return execute("broadcast_message", input, idempotencyKey);
3438
4077
  },
3439
- seedBeliefLattice(args = {}, idempotencyKey) {
3440
- return executeMutation("seed_belief_lattice", args, idempotencyKey);
4078
+ checkPermission(input = {}, idempotencyKey) {
4079
+ return execute("check_permission", input, idempotencyKey);
3441
4080
  },
3442
- getLatticeCoverage(args = {}) {
3443
- return executeRead("get_lattice_coverage", args);
4081
+ claimFiles(input = {}, idempotencyKey) {
4082
+ return execute("claim_files", input, idempotencyKey);
3444
4083
  },
3445
- matchEntityType(args) {
3446
- return executeRead("match_entity_type", args);
4084
+ compileContext(input = {}, idempotencyKey) {
4085
+ return execute("compile_context", input, idempotencyKey);
3447
4086
  },
3448
- discoverEntityConnections(args) {
3449
- return executeRead("discover_entity_connections", args);
4087
+ completeTask(input = {}, idempotencyKey) {
4088
+ return execute("complete_task", input, idempotencyKey);
3450
4089
  },
3451
- triggerBeliefReview(args, idempotencyKey) {
3452
- return executeMutation("trigger_belief_review", args, idempotencyKey);
4090
+ createAnswer(input = {}, idempotencyKey) {
4091
+ return execute("create_answer", input, idempotencyKey);
3453
4092
  },
3454
- listOntologies(args = {}) {
3455
- return executeRead("list_ontologies", args);
4093
+ createBelief(input = {}, idempotencyKey) {
4094
+ return execute("create_belief", input, idempotencyKey);
3456
4095
  },
3457
- getOntology(args) {
3458
- return executeRead("get_ontology", args);
4096
+ createEdge(input = {}, idempotencyKey) {
4097
+ return execute("create_edge", input, idempotencyKey);
3459
4098
  },
3460
- applyOntology(args, idempotencyKey) {
3461
- return executeMutation("apply_ontology", args, idempotencyKey);
4099
+ createEpistemicContract(input = {}, idempotencyKey) {
4100
+ return execute("create_epistemic_contract", input, idempotencyKey);
3462
4101
  },
3463
- createOntology(args, idempotencyKey) {
3464
- return executeMutation("create_ontology", args, idempotencyKey);
4102
+ createEvidence(input = {}, idempotencyKey) {
4103
+ return execute("create_evidence", input, idempotencyKey);
3465
4104
  },
3466
- updateOntology(args, idempotencyKey) {
3467
- return executeMutation("update_ontology", args, idempotencyKey);
4105
+ createLens(input = {}, idempotencyKey) {
4106
+ return execute("create_lens", input, idempotencyKey);
3468
4107
  },
3469
- archiveOntology(args, idempotencyKey) {
3470
- return executeMutation("archive_ontology", args, idempotencyKey);
4108
+ createOntology(input = {}, idempotencyKey) {
4109
+ return execute("create_ontology", input, idempotencyKey);
3471
4110
  },
3472
- createOntologyVersion(args, idempotencyKey) {
3473
- return executeMutation("create_ontology_version", args, idempotencyKey);
4111
+ createOntologyVersion(input = {}, idempotencyKey) {
4112
+ return execute("create_ontology_version", input, idempotencyKey);
3474
4113
  },
3475
- publishOntologyVersion(args, idempotencyKey) {
3476
- return executeMutation("publish_ontology_version", args, idempotencyKey);
4114
+ createQuestion(input = {}, idempotencyKey) {
4115
+ return execute("create_question", input, idempotencyKey);
3477
4116
  },
3478
- deprecateOntologyVersion(args, idempotencyKey) {
3479
- return executeMutation(
3480
- "deprecate_ontology_version",
3481
- args,
3482
- idempotencyKey
3483
- );
4117
+ createTask(input = {}, idempotencyKey) {
4118
+ return execute("create_task", input, idempotencyKey);
3484
4119
  },
3485
- resolveEffectiveOntology(args) {
3486
- return executeRead("resolve_effective_ontology", args);
4120
+ createTopic(input = {}, idempotencyKey) {
4121
+ return execute("create_topic", input, idempotencyKey);
3487
4122
  },
3488
- registerSession(args = {}, idempotencyKey) {
3489
- return executeMutation("register_session", args, idempotencyKey);
4123
+ deprecateOntologyVersion(input = {}, idempotencyKey) {
4124
+ return execute("deprecate_ontology_version", input, idempotencyKey);
3490
4125
  },
3491
- heartbeatSession(args = {}, idempotencyKey) {
3492
- return executeMutation("heartbeat_session", args, idempotencyKey);
4126
+ detectConfirmationBias(input = {}, idempotencyKey) {
4127
+ return execute("detect_confirmation_bias", input, idempotencyKey);
3493
4128
  },
3494
- endSession(args = {}, idempotencyKey) {
3495
- return executeMutation("end_session", args, idempotencyKey);
4129
+ discover(input = {}, idempotencyKey) {
4130
+ return execute("discover", input, idempotencyKey);
3496
4131
  },
3497
- listActiveSessions(args = {}) {
3498
- return executeRead("list_active_sessions", args);
4132
+ discoverEntityConnections(input = {}, idempotencyKey) {
4133
+ return execute("discover_entity_connections", input, idempotencyKey);
3499
4134
  },
3500
- sendAgentMessage(args, idempotencyKey) {
3501
- return executeMutation("send_agent_message", args, idempotencyKey);
4135
+ endSession(input = {}, idempotencyKey) {
4136
+ return execute("end_session", input, idempotencyKey);
3502
4137
  },
3503
- broadcastMessage(args, idempotencyKey) {
3504
- return executeMutation("broadcast_message", args, idempotencyKey);
4138
+ evaluateContract(input = {}, idempotencyKey) {
4139
+ return execute("evaluate_contract", input, idempotencyKey);
3505
4140
  },
3506
- getAgentInbox(args = {}) {
3507
- return executeRead("get_agent_inbox", args);
4141
+ filterByPermission(input = {}, idempotencyKey) {
4142
+ return execute("filter_by_permission", input, idempotencyKey);
3508
4143
  },
3509
- claimFiles(args, idempotencyKey) {
3510
- return executeMutation("claim_files", args, idempotencyKey);
4144
+ findContradictions(input = {}, idempotencyKey) {
4145
+ return execute("find_contradictions", input, idempotencyKey);
3511
4146
  },
3512
- listTasks(args) {
3513
- return executeRead("list_tasks", args);
4147
+ findMissingQuestions(input = {}, idempotencyKey) {
4148
+ return execute("find_missing_questions", input, idempotencyKey);
3514
4149
  },
3515
- createAnswer(args, idempotencyKey) {
3516
- return executeMutation("create_answer", args, idempotencyKey);
4150
+ flagContradiction(input = {}, idempotencyKey) {
4151
+ return execute("flag_contradiction", input, idempotencyKey);
3517
4152
  },
3518
- getAnswer(args) {
3519
- return executeRead("get_answer", args);
4153
+ forkBelief(input = {}, idempotencyKey) {
4154
+ return execute("fork_belief", input, idempotencyKey);
3520
4155
  },
3521
- flagContradiction(args, idempotencyKey) {
3522
- return executeMutation("flag_contradiction", args, idempotencyKey);
4156
+ generateSessionHandoff(input = {}, idempotencyKey) {
4157
+ return execute("generate_session_handoff", input, idempotencyKey);
3523
4158
  },
3524
- ingestObservation(args, idempotencyKey) {
3525
- return executeMutation("ingest_observation", args, idempotencyKey);
4159
+ getAgentInbox(input = {}, idempotencyKey) {
4160
+ return execute("get_agent_inbox", input, idempotencyKey);
3526
4161
  },
3527
- getObservationContext(args) {
3528
- return executeRead("get_observation_context", args);
4162
+ getAnswer(input = {}, idempotencyKey) {
4163
+ return execute("get_answer", input, idempotencyKey);
3529
4164
  },
3530
- getCodeContext(args) {
3531
- return executeRead("get_code_context", args);
4165
+ getAuditTrail(input = {}, idempotencyKey) {
4166
+ return execute("get_audit_trail", input, idempotencyKey);
3532
4167
  },
3533
- getChangeHistory(args) {
3534
- return executeRead("get_change_history", args);
4168
+ getBelief(input = {}, idempotencyKey) {
4169
+ return execute("get_belief", input, idempotencyKey);
3535
4170
  },
3536
- recordAttempt(args, idempotencyKey) {
3537
- return executeMutation("record_attempt", args, idempotencyKey);
4171
+ getChangeHistory(input = {}, idempotencyKey) {
4172
+ return execute("get_change_history", input, idempotencyKey);
3538
4173
  },
3539
- getFailureLog(args) {
3540
- return executeRead("get_failure_log", args);
4174
+ getCodeContext(input = {}, idempotencyKey) {
4175
+ return execute("get_code_context", input, idempotencyKey);
3541
4176
  },
3542
- createEpistemicContract(args, idempotencyKey) {
3543
- return executeMutation(
3544
- "create_epistemic_contract",
3545
- args,
3546
- idempotencyKey
3547
- );
4177
+ getConfidenceHistory(input = {}, idempotencyKey) {
4178
+ return execute("get_confidence_history", input, idempotencyKey);
4179
+ },
4180
+ getContractStatus(input = {}, idempotencyKey) {
4181
+ return execute("get_contract_status", input, idempotencyKey);
4182
+ },
4183
+ getEvidence(input = {}, idempotencyKey) {
4184
+ return execute("get_evidence", input, idempotencyKey);
4185
+ },
4186
+ getFailureLog(input = {}, idempotencyKey) {
4187
+ return execute("get_failure_log", input, idempotencyKey);
4188
+ },
4189
+ getFalsificationQuestions(input = {}, idempotencyKey) {
4190
+ return execute("get_falsification_questions", input, idempotencyKey);
4191
+ },
4192
+ getGraphGaps(input = {}, idempotencyKey) {
4193
+ return execute("get_graph_gaps", input, idempotencyKey);
4194
+ },
4195
+ getGraphNeighborhood(input = {}, idempotencyKey) {
4196
+ return execute("get_graph_neighborhood", input, idempotencyKey);
4197
+ },
4198
+ getGraphStructureAnalysis(input = {}, idempotencyKey) {
4199
+ return execute("get_graph_structure_analysis", input, idempotencyKey);
4200
+ },
4201
+ getHighPriorityQuestions(input = {}, idempotencyKey) {
4202
+ return execute("get_high_priority_questions", input, idempotencyKey);
4203
+ },
4204
+ getLatticeCoverage(input = {}, idempotencyKey) {
4205
+ return execute("get_lattice_coverage", input, idempotencyKey);
4206
+ },
4207
+ getObservationContext(input = {}, idempotencyKey) {
4208
+ return execute("get_observation_context", input, idempotencyKey);
4209
+ },
4210
+ getOntology(input = {}, idempotencyKey) {
4211
+ return execute("get_ontology", input, idempotencyKey);
4212
+ },
4213
+ getQuestion(input = {}, idempotencyKey) {
4214
+ return execute("get_question", input, idempotencyKey);
4215
+ },
4216
+ getTopic(input = {}, idempotencyKey) {
4217
+ return execute("get_topic", input, idempotencyKey);
4218
+ },
4219
+ getTopicCoverage(input = {}, idempotencyKey) {
4220
+ return execute("get_topic_coverage", input, idempotencyKey);
4221
+ },
4222
+ getTopicTree(input = {}, idempotencyKey) {
4223
+ return execute("get_topic_tree", input, idempotencyKey);
4224
+ },
4225
+ heartbeatSession(input = {}, idempotencyKey) {
4226
+ return execute("heartbeat_session", input, idempotencyKey);
4227
+ },
4228
+ whoami(input = {}, idempotencyKey) {
4229
+ return execute("identity_whoami", input, idempotencyKey);
4230
+ },
4231
+ ingestObservation(input = {}, idempotencyKey) {
4232
+ return execute("ingest_observation", input, idempotencyKey);
4233
+ },
4234
+ linkEvidence(input = {}, idempotencyKey) {
4235
+ return execute("link_evidence", input, idempotencyKey);
4236
+ },
4237
+ linkEvidenceToBelief(input = {}, idempotencyKey) {
4238
+ return execute("link_evidence_to_belief", input, idempotencyKey);
4239
+ },
4240
+ linkEvidenceToQuestion(input = {}, idempotencyKey) {
4241
+ return execute("link_evidence_to_question", input, idempotencyKey);
4242
+ },
4243
+ listActiveSessions(input = {}, idempotencyKey) {
4244
+ return execute("list_active_sessions", input, idempotencyKey);
4245
+ },
4246
+ listAllWorktrees(input = {}, idempotencyKey) {
4247
+ return execute("list_all_worktrees", input, idempotencyKey);
4248
+ },
4249
+ listBeliefs(input = {}, idempotencyKey) {
4250
+ return execute("list_beliefs", input, idempotencyKey);
4251
+ },
4252
+ listEvidence(input = {}, idempotencyKey) {
4253
+ return execute("list_evidence", input, idempotencyKey);
4254
+ },
4255
+ listLenses(input = {}, idempotencyKey) {
4256
+ return execute("list_lenses", input, idempotencyKey);
4257
+ },
4258
+ listOntologies(input = {}, idempotencyKey) {
4259
+ return execute("list_ontologies", input, idempotencyKey);
4260
+ },
4261
+ listQuestions(input = {}, idempotencyKey) {
4262
+ return execute("list_questions", input, idempotencyKey);
4263
+ },
4264
+ listTasks(input = {}, idempotencyKey) {
4265
+ return execute("list_tasks", input, idempotencyKey);
4266
+ },
4267
+ listTopics(input = {}, idempotencyKey) {
4268
+ return execute("list_topics", input, idempotencyKey);
4269
+ },
4270
+ listWorktrees(input = {}, idempotencyKey) {
4271
+ return execute("list_worktrees", input, idempotencyKey);
3548
4272
  },
3549
- evaluateContract(args, idempotencyKey) {
3550
- return executeMutation("evaluate_contract", args, idempotencyKey);
4273
+ manageWritePolicy(input = {}, idempotencyKey) {
4274
+ return execute("manage_write_policy", input, idempotencyKey);
3551
4275
  },
3552
- getContractStatus(args) {
3553
- return executeRead("get_contract_status", args);
4276
+ matchEntityType(input = {}, idempotencyKey) {
4277
+ return execute("match_entity_type", input, idempotencyKey);
3554
4278
  },
3555
- checkPermission(args) {
3556
- return executeRead("check_permission", args);
4279
+ merge(input = {}, idempotencyKey) {
4280
+ return execute("merge", input, idempotencyKey);
3557
4281
  },
3558
- filterByPermission(args) {
3559
- return executeRead("filter_by_permission", args);
4282
+ modulateConfidence(input = {}, idempotencyKey) {
4283
+ return execute("modulate_confidence", input, idempotencyKey);
3560
4284
  },
3561
- manageWritePolicy(args, idempotencyKey) {
3562
- return args.action === "set" ? executeMutation("manage_write_policy", args, idempotencyKey) : executeRead("manage_write_policy", args);
4285
+ openPullRequest(input = {}, idempotencyKey) {
4286
+ return execute("open_pull_request", input, idempotencyKey);
3563
4287
  },
3564
- generateSessionHandoff(args) {
3565
- return executeRead("generate_session_handoff", args);
4288
+ pipelineSnapshot(input = {}, idempotencyKey) {
4289
+ return execute("pipeline_snapshot", input, idempotencyKey);
4290
+ },
4291
+ publishOntologyVersion(input = {}, idempotencyKey) {
4292
+ return execute("publish_ontology_version", input, idempotencyKey);
4293
+ },
4294
+ push(input = {}, idempotencyKey) {
4295
+ return execute("push", input, idempotencyKey);
4296
+ },
4297
+ queryLineage(input = {}, idempotencyKey) {
4298
+ return execute("query_lineage", input, idempotencyKey);
4299
+ },
4300
+ recordAttempt(input = {}, idempotencyKey) {
4301
+ return execute("record_attempt", input, idempotencyKey);
4302
+ },
4303
+ recordJudgment(input = {}, idempotencyKey) {
4304
+ return execute("record_judgment", input, idempotencyKey);
4305
+ },
4306
+ recordScopeLearning(input = {}, idempotencyKey) {
4307
+ return execute("record_scope_learning", input, idempotencyKey);
4308
+ },
4309
+ refineBelief(input = {}, idempotencyKey) {
4310
+ return execute("refine_belief", input, idempotencyKey);
4311
+ },
4312
+ refineQuestion(input = {}, idempotencyKey) {
4313
+ return execute("refine_question", input, idempotencyKey);
4314
+ },
4315
+ registerSession(input = {}, idempotencyKey) {
4316
+ return execute("register_session", input, idempotencyKey);
4317
+ },
4318
+ removeLensFromTopic(input = {}, idempotencyKey) {
4319
+ return execute("remove_lens_from_topic", input, idempotencyKey);
4320
+ },
4321
+ resolveEffectiveOntology(input = {}, idempotencyKey) {
4322
+ return execute("resolve_effective_ontology", input, idempotencyKey);
4323
+ },
4324
+ searchBeliefs(input = {}, idempotencyKey) {
4325
+ return execute("search_beliefs", input, idempotencyKey);
4326
+ },
4327
+ searchEvidence(input = {}, idempotencyKey) {
4328
+ return execute("search_evidence", input, idempotencyKey);
4329
+ },
4330
+ seedBeliefLattice(input = {}, idempotencyKey) {
4331
+ return execute("seed_belief_lattice", input, idempotencyKey);
4332
+ },
4333
+ sendAgentMessage(input = {}, idempotencyKey) {
4334
+ return execute("send_agent_message", input, idempotencyKey);
4335
+ },
4336
+ traceEntityImpact(input = {}, idempotencyKey) {
4337
+ return execute("trace_entity_impact", input, idempotencyKey);
4338
+ },
4339
+ traverseGraph(input = {}, idempotencyKey) {
4340
+ return execute("traverse_graph", input, idempotencyKey);
4341
+ },
4342
+ triggerBeliefReview(input = {}, idempotencyKey) {
4343
+ return execute("trigger_belief_review", input, idempotencyKey);
4344
+ },
4345
+ updateOntology(input = {}, idempotencyKey) {
4346
+ return execute("update_ontology", input, idempotencyKey);
4347
+ },
4348
+ updateQuestionStatus(input = {}, idempotencyKey) {
4349
+ return execute("update_question_status", input, idempotencyKey);
4350
+ },
4351
+ updateTask(input = {}, idempotencyKey) {
4352
+ return execute("update_task", input, idempotencyKey);
4353
+ },
4354
+ updateTopic(input = {}, idempotencyKey) {
4355
+ return execute("update_topic", input, idempotencyKey);
4356
+ },
4357
+ updateWorktreeMetadata(input = {}, idempotencyKey) {
4358
+ return execute("update_worktree_metadata", input, idempotencyKey);
4359
+ },
4360
+ updateWorktreeTargets(input = {}, idempotencyKey) {
4361
+ return execute("update_worktree_targets", input, idempotencyKey);
3566
4362
  }
3567
4363
  };
3568
4364
  }
@@ -4629,13 +5425,24 @@ function requireText(args) {
4629
5425
  }
4630
5426
  return text;
4631
5427
  }
5428
+ function requireBaseRate(args) {
5429
+ if (typeof args.baseRate !== "number" || !Number.isFinite(args.baseRate)) {
5430
+ throw new Error("baseRate is required.");
5431
+ }
5432
+ if (args.baseRate < 0 || args.baseRate > 1) {
5433
+ throw new Error("baseRate must be within [0, 1].");
5434
+ }
5435
+ return args.baseRate;
5436
+ }
4632
5437
  function exposeGatewayData(response) {
4633
5438
  return Object.assign({}, response, response.data);
4634
5439
  }
4635
5440
  function createLucernClient(config = {}) {
4636
5441
  const gatewayConfig = toGatewayConfig(config);
4637
5442
  const beliefsClient = createBeliefsClient(gatewayConfig);
5443
+ const sourcesClient = createSourcesClient(gatewayConfig);
4638
5444
  const beliefsFacade = createBeliefsFacade(gatewayConfig);
5445
+ const evidenceClient = createEvidenceClient(gatewayConfig);
4639
5446
  const graphClient = createGraphClient(gatewayConfig);
4640
5447
  const graphFacade = createGraphFacade(gatewayConfig);
4641
5448
  const decisionsClient = createDecisionsClient(gatewayConfig);
@@ -4659,7 +5466,7 @@ function createLucernClient(config = {}) {
4659
5466
  const worktreesFacade = createWorktreesFacade(gatewayConfig);
4660
5467
  const policyClient = createPolicyClient(gatewayConfig);
4661
5468
  const ontologyClient = createOntologyClient(gatewayConfig);
4662
- const mcpParityClient = createMcpParityClient(gatewayConfig);
5469
+ const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
4663
5470
  const packsClient = createPacksClient(gatewayConfig);
4664
5471
  const reportsClient = createReportsClient(gatewayConfig);
4665
5472
  const learningClient = createLearningClient(gatewayConfig);
@@ -4739,7 +5546,6 @@ function createLucernClient(config = {}) {
4739
5546
  }
4740
5547
  );
4741
5548
  async function createEvidenceCompat(args) {
4742
- const topicId = requireTopicId(args);
4743
5549
  const text = resolveText(args);
4744
5550
  if (!text) {
4745
5551
  throw new Error("text is required");
@@ -4749,7 +5555,7 @@ function createLucernClient(config = {}) {
4749
5555
  ...args.supports?.reasoning ? { rationale: args.supports.reasoning } : {}
4750
5556
  };
4751
5557
  return evidenceFacade.create({
4752
- topicId,
5558
+ topicId: resolveTopicId(args),
4753
5559
  text,
4754
5560
  source: args.source ?? args.sourceUrl,
4755
5561
  targetId: args.targetId ?? args.supports?.nodeId,
@@ -4876,6 +5682,10 @@ function createLucernClient(config = {}) {
4876
5682
  async function getConfidenceHistory(nodeId) {
4877
5683
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
4878
5684
  }
5685
+ async function getOpinionHistory(nodeId) {
5686
+ const response = await beliefsFacade.opinionHistory(nodeId);
5687
+ return mapOpinionHistoryEntriesFromGatewayData(response.data);
5688
+ }
4879
5689
  async function getAuditTrail(nodeId, limit = 50) {
4880
5690
  const events = await auditClient.listEvents({ limit });
4881
5691
  const entries = asListItems(events.data, "events").filter((event) => matchesAuditNodeReference(event, nodeId)).slice(0, limit).map((event) => {
@@ -5056,11 +5866,12 @@ function createLucernClient(config = {}) {
5056
5866
  beliefs: {
5057
5867
  create(input) {
5058
5868
  return beliefsFacade.create({
5059
- topicId: requireTopicId(input),
5869
+ topicId: resolveTopicId(input),
5060
5870
  text: requireText(input),
5061
5871
  rationale: input.rationale,
5062
5872
  worktreeId: input.worktreeId,
5063
5873
  pillar: input.pillar,
5874
+ baseRate: requireBaseRate(input),
5064
5875
  sourceBeliefIds: input.sourceBeliefIds,
5065
5876
  sourceType: input.sourceType,
5066
5877
  beliefType: input.beliefType,
@@ -5134,6 +5945,9 @@ function createLucernClient(config = {}) {
5134
5945
  confidenceHistory(nodeId) {
5135
5946
  return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
5136
5947
  },
5948
+ opinionHistory(nodeId) {
5949
+ return getOpinionHistory(nodeId);
5950
+ },
5137
5951
  createContract(nodeId, input) {
5138
5952
  return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
5139
5953
  },
@@ -5265,6 +6079,12 @@ function createLucernClient(config = {}) {
5265
6079
  beliefId: args.beliefId
5266
6080
  }));
5267
6081
  },
6082
+ classifyEvidence(beliefId, evidenceId, config2, idempotencyKey) {
6083
+ return evidenceClient.classifyEvidence(beliefId, evidenceId, config2, idempotencyKey).then(exposeGatewayData);
6084
+ },
6085
+ classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey) {
6086
+ return evidenceClient.classifyEvidenceBatch(beliefId, evidence, config2, idempotencyKey).then(exposeGatewayData);
6087
+ },
5268
6088
  updateStatus(input, idempotencyKey) {
5269
6089
  return evidenceFacade.updateStatus(input, idempotencyKey).then(exposeGatewayData);
5270
6090
  },
@@ -5281,10 +6101,18 @@ function createLucernClient(config = {}) {
5281
6101
  return evidenceFacade.updateVerificationStatus(input, idempotencyKey).then(exposeGatewayData);
5282
6102
  }
5283
6103
  },
6104
+ sources: {
6105
+ upsert(input, idempotencyKey) {
6106
+ return sourcesClient.upsert(input, idempotencyKey).then(exposeGatewayData);
6107
+ },
6108
+ get(sourceId) {
6109
+ return sourcesClient.get(sourceId).then(exposeGatewayData);
6110
+ }
6111
+ },
5284
6112
  questions: {
5285
6113
  create(args) {
5286
6114
  return questionsFacade.create({
5287
- topicId: requireTopicId(args),
6115
+ topicId: resolveTopicId(args),
5288
6116
  text: args.text,
5289
6117
  priority: args.priority,
5290
6118
  linkedBeliefId: args.linkedBeliefId,
@@ -5317,10 +6145,22 @@ function createLucernClient(config = {}) {
5317
6145
  }).then(exposeGatewayData);
5318
6146
  },
5319
6147
  batchCreate(input, idempotencyKey) {
5320
- return questionsFacade.batchCreate(input, idempotencyKey).then(exposeGatewayData);
6148
+ return questionsFacade.batchCreate(
6149
+ {
6150
+ ...input,
6151
+ topicId: resolveTopicId(input)
6152
+ },
6153
+ idempotencyKey
6154
+ ).then(exposeGatewayData);
5321
6155
  },
5322
6156
  add(input, idempotencyKey) {
5323
- return questionsFacade.add(input, idempotencyKey).then(exposeGatewayData);
6157
+ return questionsFacade.add(
6158
+ {
6159
+ ...input,
6160
+ topicId: resolveTopicId(input)
6161
+ },
6162
+ idempotencyKey
6163
+ ).then(exposeGatewayData);
5324
6164
  },
5325
6165
  updatePriority(input, idempotencyKey) {
5326
6166
  return questionsFacade.updatePriority(input, idempotencyKey).then(exposeGatewayData);
@@ -5406,6 +6246,7 @@ function createLucernClient(config = {}) {
5406
6246
  },
5407
6247
  queryLineage,
5408
6248
  getConfidenceHistory,
6249
+ getOpinionHistory,
5409
6250
  getAuditTrail,
5410
6251
  traverse(args) {
5411
6252
  return graphFacade.traverse({
@@ -5634,7 +6475,7 @@ function createLucernClient(config = {}) {
5634
6475
  return workflowClient.openPullRequest(worktreeId, input);
5635
6476
  },
5636
6477
  pipelineSnapshot(topicId) {
5637
- return mcpParityClient.pipelineSnapshot({ topicId });
6478
+ return functionSurfaceClient.pipelineSnapshot({ topicId });
5638
6479
  },
5639
6480
  complete(input, idempotencyKey) {
5640
6481
  return worktreesFacade.complete(input, idempotencyKey);
@@ -5670,23 +6511,23 @@ function createLucernClient(config = {}) {
5670
6511
  compile(topicId, input = {}) {
5671
6512
  return contextClient.compile(topicId, input);
5672
6513
  },
5673
- recordScopeLearning(input) {
5674
- return mcpParityClient.recordScopeLearning(input);
6514
+ recordScopeLearning(input, idempotencyKey) {
6515
+ return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
5675
6516
  },
5676
6517
  discover(input) {
5677
6518
  return discoverTopics(input);
5678
6519
  },
5679
6520
  analyzeTopicDensity(input) {
5680
- return mcpParityClient.analyzeTopicDensity(input);
6521
+ return functionSurfaceClient.analyzeTopicDensity(input);
5681
6522
  },
5682
- applyAutoBranching(input) {
5683
- return mcpParityClient.applyAutoBranching(input);
6523
+ applyAutoBranching(input, idempotencyKey) {
6524
+ return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
5684
6525
  },
5685
- seedBeliefLattice(input = {}) {
5686
- return mcpParityClient.seedBeliefLattice(input);
6526
+ seedBeliefLattice(input = {}, idempotencyKey) {
6527
+ return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
5687
6528
  },
5688
6529
  getLatticeCoverage(input = {}) {
5689
- return mcpParityClient.getLatticeCoverage(input);
6530
+ return functionSurfaceClient.getLatticeCoverage(input);
5690
6531
  },
5691
6532
  matchEntityType(input) {
5692
6533
  return ontologiesFacade.match(input).then(exposeGatewayData);
@@ -5701,7 +6542,7 @@ function createLucernClient(config = {}) {
5701
6542
  tasks: {
5702
6543
  create(input) {
5703
6544
  return tasksFacade.create({
5704
- topicId: requireTopicId(input),
6545
+ topicId: resolveTopicId(input),
5705
6546
  title: input.title,
5706
6547
  description: input.description,
5707
6548
  taskType: input.taskType,
@@ -5834,7 +6675,7 @@ function createLucernClient(config = {}) {
5834
6675
  beliefA: args.beliefA,
5835
6676
  beliefB: args.beliefB,
5836
6677
  description: args.description,
5837
- topicId: requireTopicId(args),
6678
+ topicId: resolveTopicId(args),
5838
6679
  severity: args.severity,
5839
6680
  defeatType: args.defeatType
5840
6681
  }).then(exposeGatewayData);
@@ -5880,38 +6721,50 @@ function createLucernClient(config = {}) {
5880
6721
  publishVersion(input) {
5881
6722
  return publishOntologyVersionCompat(input);
5882
6723
  },
6724
+ publishOntologyVersion(input) {
6725
+ return publishOntologyVersionCompat(input);
6726
+ },
5883
6727
  deprecateVersion(input) {
5884
6728
  return deprecateOntologyVersionCompat(input);
5885
6729
  },
6730
+ deprecateOntologyVersion(input) {
6731
+ return deprecateOntologyVersionCompat(input);
6732
+ },
5886
6733
  resolveEffective(input) {
5887
6734
  return resolveEffectiveOntologyCompat(input);
5888
6735
  },
6736
+ resolveEffectiveOntology(input) {
6737
+ return resolveEffectiveOntologyCompat(input);
6738
+ },
5889
6739
  raw: ontologyClient
5890
6740
  },
5891
6741
  coordination: {
5892
- registerSession(input = {}) {
5893
- return mcpParityClient.registerSession(input);
6742
+ registerSession(input = {}, idempotencyKey) {
6743
+ return functionSurfaceClient.registerSession(input, idempotencyKey);
5894
6744
  },
5895
- heartbeatSession(input = {}) {
5896
- return mcpParityClient.heartbeatSession(input);
6745
+ heartbeatSession(input = {}, idempotencyKey) {
6746
+ return functionSurfaceClient.heartbeatSession(input, idempotencyKey);
5897
6747
  },
5898
- endSession(input = {}) {
5899
- return mcpParityClient.endSession(input);
6748
+ endSession(input = {}, idempotencyKey) {
6749
+ return functionSurfaceClient.endSession(input, idempotencyKey);
5900
6750
  },
5901
6751
  listActiveSessions(input = {}) {
5902
- return mcpParityClient.listActiveSessions(input);
6752
+ return functionSurfaceClient.listActiveSessions(input);
5903
6753
  },
5904
- sendAgentMessage(input) {
5905
- return mcpParityClient.sendAgentMessage(input);
6754
+ sendAgentMessage(input, idempotencyKey) {
6755
+ return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
5906
6756
  },
5907
- broadcastMessage(input) {
5908
- return mcpParityClient.broadcastMessage(input);
6757
+ broadcastMessage(input, idempotencyKey) {
6758
+ return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
5909
6759
  },
5910
6760
  getInbox(input = {}) {
5911
- return mcpParityClient.getAgentInbox(input);
6761
+ return functionSurfaceClient.getAgentInbox(input);
5912
6762
  },
5913
- claimFiles(input) {
5914
- return mcpParityClient.claimFiles(input);
6763
+ getAgentInbox(input = {}) {
6764
+ return functionSurfaceClient.getAgentInbox(input);
6765
+ },
6766
+ claimFiles(input, idempotencyKey) {
6767
+ return functionSurfaceClient.claimFiles(input, idempotencyKey);
5915
6768
  }
5916
6769
  },
5917
6770
  policy: {
@@ -5943,107 +6796,65 @@ function createLucernClient(config = {}) {
5943
6796
  principalId: typeof input.principalId === "string" ? input.principalId : void 0
5944
6797
  });
5945
6798
  },
5946
- manageWritePolicy(input) {
5947
- return mcpParityClient.manageWritePolicy(input);
6799
+ manageWritePolicy(input, idempotencyKey) {
6800
+ return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
5948
6801
  },
5949
6802
  raw: policyClient
5950
6803
  },
5951
6804
  observations: {
5952
- ingest(input) {
5953
- return mcpParityClient.ingestObservation(input);
6805
+ ingest(input, idempotencyKey) {
6806
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
6807
+ },
6808
+ ingestObservation(input, idempotencyKey) {
6809
+ return functionSurfaceClient.ingestObservation(input, idempotencyKey);
5954
6810
  },
5955
6811
  getContext(input) {
5956
- return mcpParityClient.getObservationContext(input);
6812
+ return functionSurfaceClient.getObservationContext(input);
6813
+ },
6814
+ getObservationContext(input) {
6815
+ return functionSurfaceClient.getObservationContext(input);
5957
6816
  }
5958
6817
  },
5959
6818
  coding: {
5960
6819
  getCodeContext(input) {
5961
- return mcpParityClient.getCodeContext(input);
6820
+ return functionSurfaceClient.getCodeContext(input);
5962
6821
  },
5963
6822
  getChangeHistory(input) {
5964
- return mcpParityClient.getChangeHistory(input);
6823
+ return functionSurfaceClient.getChangeHistory(input);
5965
6824
  },
5966
- recordAttempt(input) {
5967
- return mcpParityClient.recordAttempt(input);
6825
+ recordAttempt(input, idempotencyKey) {
6826
+ return functionSurfaceClient.recordAttempt(input, idempotencyKey);
5968
6827
  },
5969
6828
  getFailureLog(input) {
5970
- return mcpParityClient.getFailureLog(input);
6829
+ return functionSurfaceClient.getFailureLog(input);
5971
6830
  }
5972
6831
  },
5973
6832
  contracts: {
5974
6833
  create(input) {
5975
6834
  return createContractCompat(input);
5976
6835
  },
6836
+ createEpistemicContract(input) {
6837
+ return createContractCompat(input);
6838
+ },
5977
6839
  list(input = {}) {
5978
6840
  return listContractsCompat(input);
5979
6841
  },
5980
6842
  evaluate(input) {
5981
6843
  return evaluateContractCompat(input);
5982
6844
  },
6845
+ evaluateContract(input) {
6846
+ return evaluateContractCompat(input);
6847
+ },
5983
6848
  getStatus(input) {
5984
6849
  return getContractStatusCompat(input);
6850
+ },
6851
+ getContractStatus(input) {
6852
+ return getContractStatusCompat(input);
5985
6853
  }
5986
6854
  },
5987
6855
  bootstrap: {
5988
6856
  generateSessionHandoff(input) {
5989
- return mcpParityClient.generateSessionHandoff(input);
5990
- }
5991
- },
5992
- research: {
5993
- searchSources(args) {
5994
- const topicId = requireTopicId(args);
5995
- return graphClient.listNodes({
5996
- topicId,
5997
- nodeType: "source",
5998
- limit: 100
5999
- }).then((response) => {
6000
- const query = args.query.toLowerCase();
6001
- const results = asNodeArray(response.data).filter((node) => {
6002
- const text = `${node.canonicalText ?? ""} ${typeof node.metadata?.title === "string" ? node.metadata.title : ""}`.toLowerCase();
6003
- if (!text.includes(query)) {
6004
- return false;
6005
- }
6006
- if (!args.sources || args.sources.length === 0) {
6007
- return true;
6008
- }
6009
- const sourceType = typeof node.metadata?.sourceType === "string" ? node.metadata.sourceType.toLowerCase() : "";
6010
- return args.sources.some(
6011
- (source) => sourceType.includes(source.toLowerCase())
6012
- );
6013
- }).map((node) => ({
6014
- title: typeof node.metadata?.title === "string" ? node.metadata.title : node.canonicalText ?? "Untitled source",
6015
- url: typeof node.metadata?.sourceUrl === "string" ? node.metadata.sourceUrl : "",
6016
- snippet: node.canonicalText ?? "",
6017
- relevanceScore: 1,
6018
- suggestedEvidence: node.canonicalText ?? ""
6019
- }));
6020
- return { results };
6021
- });
6022
- },
6023
- async executeDeepResearch(args) {
6024
- const sources = await this.searchSources({
6025
- query: args.query,
6026
- topicId: requireTopicId(args),
6027
- sources: ["web"]
6028
- });
6029
- const sampleSize = args.depth === "deep" ? 10 : args.depth === "quick" ? 3 : 5;
6030
- const selected = sources.results.slice(0, sampleSize);
6031
- return {
6032
- report: {
6033
- summary: selected.length > 0 ? `Research completed for "${args.query}" with ${selected.length} relevant sources.` : `No relevant sources found for "${args.query}".`,
6034
- findings: selected.map((source) => ({
6035
- title: source.title,
6036
- summary: source.snippet,
6037
- sourceUrl: source.url
6038
- })),
6039
- sources: selected.map((source) => ({
6040
- title: source.title,
6041
- url: source.url
6042
- })),
6043
- linkedEvidence: [],
6044
- linkedQuestions: []
6045
- }
6046
- };
6857
+ return functionSurfaceClient.generateSessionHandoff(input);
6047
6858
  }
6048
6859
  },
6049
6860
  tools: {
@@ -6108,6 +6919,8 @@ function createLucernClient(config = {}) {
6108
6919
  extensions: extensionNamespaces,
6109
6920
  raw: {
6110
6921
  beliefs: beliefsClient,
6922
+ sources: sourcesClient,
6923
+ evidence: evidenceClient,
6111
6924
  graph: graphClient,
6112
6925
  decisions: decisionsClient,
6113
6926
  workflow: workflowClient,
@@ -6117,7 +6930,7 @@ function createLucernClient(config = {}) {
6117
6930
  policy: policyClient,
6118
6931
  answers: answersClient,
6119
6932
  ontology: ontologyClient,
6120
- mcpParity: mcpParityClient,
6933
+ functionSurface: functionSurfaceClient,
6121
6934
  packs: packsClient,
6122
6935
  reports: reportsClient,
6123
6936
  learning: learningClient,
@@ -6291,7 +7104,7 @@ function tokenHits(text, tokens) {
6291
7104
  }
6292
7105
  return hits;
6293
7106
  }
6294
- function clamp01(value) {
7107
+ function clamp013(value) {
6295
7108
  if (!Number.isFinite(value)) {
6296
7109
  return 0;
6297
7110
  }
@@ -6304,13 +7117,13 @@ function recencyScore(updatedAt, referenceTimeMs = nowMs()) {
6304
7117
  const ageMs = Math.max(0, referenceTimeMs - updatedAt);
6305
7118
  const ageDays = ageMs / (1e3 * 60 * 60 * 24);
6306
7119
  const decay = 0.5 ** (ageDays / RECENCY_HALF_LIFE_DAYS);
6307
- return clamp01(decay);
7120
+ return clamp013(decay);
6308
7121
  }
6309
7122
  function confidenceScore(confidence) {
6310
7123
  if (typeof confidence !== "number" || !Number.isFinite(confidence)) {
6311
7124
  return 0.5;
6312
7125
  }
6313
- return clamp01(confidence);
7126
+ return clamp013(confidence);
6314
7127
  }
6315
7128
  function priorityScore(priority) {
6316
7129
  const value = normalizeText(priority || "");
@@ -6378,7 +7191,7 @@ function computeBaselineScore(candidate, queryTokens) {
6378
7191
  }
6379
7192
  function computeWeightedScore(section, candidate, queryTokens, effectiveWeights, referenceTimeMs) {
6380
7193
  const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
6381
- const queryComponent = queryTokens.length === 0 ? 0.4 : clamp01(tokenHits(candidate.text, queryTokens) / queryTokens.length);
7194
+ const queryComponent = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(candidate.text, queryTokens) / queryTokens.length);
6382
7195
  const recencyComponent = recencyScore(
6383
7196
  candidate.updatedAt || candidate.createdAt || null,
6384
7197
  referenceTimeMs
@@ -6528,9 +7341,9 @@ function rankEntities(candidates, queryTokens, limit) {
6528
7341
  );
6529
7342
  const scored = candidates.map((candidate) => {
6530
7343
  const searchText = `${candidate.title} ${candidate.entityType} ${candidate.canonicalText}`;
6531
- const queryScore = queryTokens.length === 0 ? 0.4 : clamp01(tokenHits(searchText, queryTokens) / queryTokens.length);
7344
+ const queryScore = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(searchText, queryTokens) / queryTokens.length);
6532
7345
  const totalConnections = candidate.connectedBeliefCount + candidate.connectedEvidenceCount;
6533
- const connectivityScore = clamp01(totalConnections / maxConnections);
7346
+ const connectivityScore = clamp013(totalConnections / maxConnections);
6534
7347
  const score = queryScore * ENTITY_RANKING_WEIGHTS.query + connectivityScore * ENTITY_RANKING_WEIGHTS.connectivity;
6535
7348
  return { ...candidate, score };
6536
7349
  });
@@ -7515,11 +8328,17 @@ var FORK_REASONS = [
7515
8328
  ];
7516
8329
  var CONFIDENCE_TRIGGERS = [
7517
8330
  "evidence_added",
8331
+ "evidence_removed",
7518
8332
  "contradiction_detected",
7519
- "merge_outcome",
8333
+ "contradiction_resolved",
8334
+ "agent_assessment",
7520
8335
  "worktree_outcome",
8336
+ "worktree_completed",
7521
8337
  "manual",
7522
- "decay"
8338
+ "decay",
8339
+ "fusion",
8340
+ "discount",
8341
+ "deduction"
7523
8342
  ];
7524
8343
  var EPISTEMIC_EDGE_TYPES = [
7525
8344
  "supports",
@@ -7753,2979 +8572,18 @@ function buildDeprecatedBranchMetadata(args) {
7753
8572
  };
7754
8573
  }
7755
8574
 
7756
- // src/contracts/mcp-tools.contract.ts
7757
- var CREATE_BELIEF = {
7758
- name: "create_belief",
7759
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object. The belief starts as unscored (draft). Score it with modulate_confidence to freeze the formulation.",
7760
- parameters: {
7761
- canonicalText: {
7762
- type: "string",
7763
- description: "The belief statement \u2014 what the agent holds to be true"
7764
- },
7765
- topicId: { type: "string", description: "Topic scope for the belief" },
7766
- beliefType: {
7767
- type: "string",
7768
- description: "Belief type (e.g., hypothesis, belief, principle, invariant, tenet, forecast). Validated against schemaEnumConfig."
7769
- },
7770
- metadata: {
7771
- type: "object",
7772
- description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
7773
- }
7774
- },
7775
- required: ["canonicalText", "topicId"],
7776
- response: {
7777
- description: "The created canonical belief record",
7778
- fields: {
7779
- id: "string \u2014 canonical belief ID",
7780
- nodeId: "string \u2014 canonical belief ID",
7781
- beliefId: "string \u2014 canonical belief ID",
7782
- text: "string \u2014 canonical belief formulation",
7783
- topicId: "string",
7784
- status: "string \u2014 active | superseded | archived",
7785
- scoringState: "string \u2014 unscored | scored"
7786
- }
7787
- },
7788
- ownerModule: "graph-primitives",
7789
- ontologyPrimitive: "belief",
7790
- tier: "showcase"
7791
- };
7792
- var GET_BELIEF = {
7793
- name: "get_belief",
7794
- description: "Read one belief by ID. Like `git show` \u2014 resolves the canonical belief payload for a single identifier.",
7795
- parameters: {
7796
- id: { type: "string", description: "Canonical belief ID" }
7797
- },
7798
- required: ["id"],
7799
- response: {
7800
- description: "The canonical belief record",
7801
- fields: {
7802
- id: "string \u2014 canonical belief ID",
7803
- nodeId: "string \u2014 canonical belief ID",
7804
- beliefId: "string \u2014 canonical belief ID",
7805
- text: "string \u2014 canonical belief formulation",
7806
- topicId: "string",
7807
- status: "string \u2014 active | superseded | archived",
7808
- scoringState: "string \u2014 unscored | scored"
7809
- }
7810
- },
7811
- ownerModule: "graph-primitives",
7812
- ontologyPrimitive: "belief",
7813
- tier: "workhorse"
7814
- };
7815
- var REFINE_BELIEF = {
7816
- name: "refine_belief",
7817
- description: "Amend a draft belief in-place within an active worktree. Like `git commit --amend` \u2014 rewrites the last commit on a feature branch. Only valid before merge to main. Fails if the belief is already scored.",
7818
- parameters: {
7819
- nodeId: { type: "string", description: "The belief to refine" },
7820
- canonicalText: { type: "string", description: "Updated belief statement" },
7821
- rationale: { type: "string", description: "Why the refinement was made" }
7822
- },
7823
- required: ["nodeId", "canonicalText"],
7824
- response: {
7825
- description: "The updated belief node",
7826
- fields: {
7827
- nodeId: "string",
7828
- canonicalText: "string \u2014 updated text",
7829
- updatedAt: "number \u2014 timestamp"
7830
- }
7831
- },
7832
- ownerModule: "graph-primitives",
7833
- ontologyPrimitive: "belief",
7834
- tier: "showcase"
7835
- };
7836
- var MODULATE_CONFIDENCE = {
7837
- name: "modulate_confidence",
7838
- description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Triggers: evidence_added, contradiction_detected, merge_outcome, manual, decay.",
7839
- parameters: {
7840
- nodeId: { type: "string", description: "The belief to score" },
7841
- confidence: { type: "number", description: "Confidence level in [0, 1]" },
7842
- trigger: {
7843
- type: "string",
7844
- description: "What caused this confidence change",
7845
- enum: [
7846
- "evidence_added",
7847
- "contradiction_detected",
7848
- "merge_outcome",
7849
- "manual",
7850
- "decay"
7851
- ]
7852
- },
7853
- rationale: {
7854
- type: "string",
7855
- description: "Human-readable explanation of why confidence changed"
7856
- }
7857
- },
7858
- required: ["nodeId", "confidence", "trigger", "rationale"],
7859
- response: {
7860
- description: "Confidence modulation result",
7861
- fields: {
7862
- beliefId: "string \u2014 canonical belief ID",
7863
- nodeId: "string \u2014 canonical belief ID",
7864
- newConfidence: "number",
7865
- previousConfidence: "number",
7866
- trigger: "string",
7867
- requestId: "string \u2014 request identifier for the scheduled cascade",
7868
- propagationSummary: "object \u2014 bounded inline cascade summary with totalCandidateTargets, inlineTargets, and remainingTargetCount"
7869
- }
7870
- },
7871
- ownerModule: "graph-primitives",
7872
- ontologyPrimitive: "belief",
7873
- tier: "showcase"
7874
- };
7875
- var FORK_BELIEF = {
7876
- name: "fork_belief",
7877
- description: "Branch off a scored belief to create a new version with a different formulation. Like `git fork` \u2014 the parent remains immutable with full history. The new belief gets a `supersedes` edge to the parent. Fork reasons: refinement, contradiction_response, scope_change, confidence_collapse, manual.",
7878
- parameters: {
7879
- nodeId: { type: "string", description: "The scored belief to fork from" },
7880
- newFormulation: {
7881
- type: "string",
7882
- description: "The evolved belief statement"
7883
- },
7884
- forkReason: {
7885
- type: "string",
7886
- description: "Why this fork was created",
7887
- enum: [
7888
- "refinement",
7889
- "contradiction_response",
7890
- "scope_change",
7891
- "confidence_collapse",
7892
- "manual"
7893
- ]
7894
- }
7895
- },
7896
- required: ["nodeId", "newFormulation", "forkReason"],
7897
- response: {
7898
- description: "The forked canonical belief record",
7899
- fields: {
7900
- id: "string \u2014 canonical child belief ID",
7901
- nodeId: "string \u2014 canonical child belief ID",
7902
- beliefId: "string \u2014 canonical child belief ID",
7903
- parentBeliefId: "string \u2014 canonical parent belief ID",
7904
- forkReason: "string"
7905
- }
7906
- },
7907
- ownerModule: "graph-primitives",
7908
- ontologyPrimitive: "belief",
7909
- tier: "showcase"
7910
- };
7911
- var ARCHIVE_BELIEF = {
7912
- name: "archive_belief",
7913
- description: "Soft-delete a belief by setting its status to archived. Like `git rm` \u2014 removed from the working tree but preserved in history. Beliefs are never truly deleted. Archived beliefs retain full lineage and confidence history.",
7914
- parameters: {
7915
- nodeId: { type: "string", description: "The belief to archive" },
7916
- rationale: {
7917
- type: "string",
7918
- description: "Why this belief is being archived"
7919
- }
7920
- },
7921
- required: ["nodeId"],
7922
- response: {
7923
- description: "Archived canonical belief record",
7924
- fields: {
7925
- beliefId: "string \u2014 canonical belief ID",
7926
- nodeId: "string \u2014 canonical belief ID",
7927
- previousStatus: "string | undefined",
7928
- newStatus: "string \u2014 'archived'",
7929
- status: "string \u2014 'archived'"
7930
- }
7931
- },
7932
- ownerModule: "graph-primitives",
7933
- ontologyPrimitive: "belief",
7934
- tier: "showcase"
7935
- };
7936
- var CREATE_EPISTEMIC_CONTRACT = {
7937
- name: "create_epistemic_contract",
7938
- description: "Bind a machine-evaluable epistemic contract to a belief. Like `git add` for falsification rules \u2014 records the verification condition, modulation policy, and evaluation schedule that keep a belief accountable to reality.",
7939
- parameters: {
7940
- beliefNodeId: {
7941
- type: "string",
7942
- description: "The belief node to bind this contract to"
7943
- },
7944
- title: {
7945
- type: "string",
7946
- description: "Contract title"
7947
- },
7948
- description: {
7949
- type: "string",
7950
- description: "Optional contract description"
7951
- },
7952
- conditionType: {
7953
- type: "string",
7954
- description: "What kind of contract condition to evaluate",
7955
- enum: ["assertion", "temporal", "evidential", "threshold", "composite"]
7956
- },
7957
- direction: {
7958
- type: "string",
7959
- description: "Whether satisfying the condition confirms or falsifies",
7960
- enum: ["confirms", "falsifies"]
7961
- },
7962
- condition: {
7963
- type: "object",
7964
- description: "Condition payload: { expression, evaluator, evaluatorConfig? }"
7965
- },
7966
- deadline: {
7967
- type: "number",
7968
- description: "Optional Unix timestamp deadline for temporal contracts"
7969
- },
7970
- compositeOf: {
7971
- type: "array",
7972
- description: "Optional array of sub-contract IDs for composite contracts"
7973
- },
7974
- compositeOperator: {
7975
- type: "string",
7976
- description: "How composite sub-contracts should be combined",
7977
- enum: ["all", "any", "majority"]
7978
- },
7979
- modulation: {
7980
- type: "object",
7981
- description: "Asymmetric modulation rules for confirmed, disconfirmed, expired, and partial outcomes"
7982
- },
7983
- evaluationSchedule: {
7984
- type: "string",
7985
- description: "When this contract should be evaluated",
7986
- enum: ["on_demand", "on_evidence", "periodic", "event_driven"]
7987
- },
7988
- periodicIntervalMs: {
7989
- type: "number",
7990
- description: "Optional interval in milliseconds for periodic contracts"
7991
- }
7992
- },
7993
- required: [
7994
- "beliefNodeId",
7995
- "title",
7996
- "conditionType",
7997
- "direction",
7998
- "condition",
7999
- "modulation",
8000
- "evaluationSchedule"
8001
- ],
8002
- response: {
8003
- description: "The created epistemic contract binding",
8004
- fields: {
8005
- id: "string \u2014 storage record ID",
8006
- contractId: "string \u2014 contract identifier",
8007
- beliefId: "string \u2014 canonical belief ID",
8008
- status: "string \u2014 initial contract status",
8009
- title: "string \u2014 contract title"
8010
- }
8011
- },
8012
- ownerModule: "graph-primitives",
8013
- ontologyPrimitive: "belief",
8014
- tier: "workhorse"
8015
- };
8016
- var ADD_EVIDENCE = {
8017
- name: "add_evidence",
8018
- description: "Commit evidence to the reasoning graph and attach it to a belief. Like `git add && git commit` \u2014 an atomic write that creates a traceable evidence object. Weight ranges from -1.0 (contradicts) to +1.0 (strongly supports). Evidence is always context-bound: tied to its source, the time it was captured, and the belief it informs.",
8019
- parameters: {
8020
- canonicalText: { type: "string", description: "The evidence statement" },
8021
- topicId: { type: "string", description: "Topic scope" },
8022
- sourceUrl: { type: "string", description: "URL of the source material" },
8023
- targetNodeId: {
8024
- type: "string",
8025
- description: "The belief this evidence bears on"
8026
- },
8027
- weight: {
8028
- type: "number",
8029
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
8030
- },
8031
- reasoning: {
8032
- type: "string",
8033
- description: "Why this evidence is relevant to the target belief"
8034
- },
8035
- title: {
8036
- type: "string",
8037
- description: "Optional short title for the evidence node"
8038
- },
8039
- content: {
8040
- type: "string",
8041
- description: "Optional long-form content (separate from canonicalText summary)"
8042
- },
8043
- contentType: {
8044
- type: "string",
8045
- description: "Content MIME type or format hint (e.g., 'text/markdown', 'code')"
8046
- },
8047
- metadata: {
8048
- type: "object",
8049
- description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
8050
- }
8051
- },
8052
- required: ["canonicalText", "topicId", "targetNodeId"],
8053
- response: {
8054
- description: "The created evidence node and its edge",
8055
- fields: {
8056
- nodeId: "string \u2014 evidence node ID",
8057
- edgeId: "string \u2014 edge to target belief"
8058
- }
8059
- },
8060
- ownerModule: "graph-primitives",
8061
- ontologyPrimitive: "evidence",
8062
- tier: "showcase"
8063
- };
8064
- var FLAG_CONTRADICTION = {
8065
- name: "flag_contradiction",
8066
- description: "Flag a contradiction between two beliefs. Contradictions are first-class objects with their own lifecycle \u2014 they may remain permanently unresolved. Like a merge conflict that is allowed to persist. Contradictions can trigger structural changes: forking, confidence collapse, or decision blocking. Resolution is NEVER automatic \u2014 always surfaces for human review.",
8067
- parameters: {
8068
- beliefA: {
8069
- type: "string",
8070
- description: "First belief in the contradiction"
8071
- },
8072
- beliefB: {
8073
- type: "string",
8074
- description: "Second belief in the contradiction"
8075
- },
8076
- description: { type: "string", description: "What the tension is about" },
8077
- severity: {
8078
- type: "string",
8079
- description: "How serious the contradiction is",
8080
- enum: ["low", "medium", "high", "critical"]
8081
- },
8082
- topicId: { type: "string", description: "Topic scope" },
8083
- defeatType: {
8084
- type: "string",
8085
- description: "Pollock defeat classification: rebuts (direct contradiction), undercuts (attacks the inferential link), undermines (attacks a premise)",
8086
- enum: ["rebuts", "undercuts", "undermines"]
8087
- }
8088
- },
8089
- required: ["beliefA", "beliefB", "description", "topicId"],
8090
- response: {
8091
- description: "The created contradiction object",
8092
- fields: {
8093
- contradictionId: "string",
8094
- status: "string \u2014 'unresolved'",
8095
- beliefA: "string",
8096
- beliefB: "string"
8097
- }
8098
- },
8099
- ownerModule: "graph-primitives",
8100
- ontologyPrimitive: "belief",
8101
- tier: "showcase"
8102
- };
8103
- var ADD_WORKTREE = {
8104
- name: "add_worktree",
8105
- description: "Check out a branch into an active worktree for investigation. Like `git worktree add <branch>` \u2014 creates independent working state on a thematic branch. Beliefs committed within the worktree can be freely amended (draft code on a feature branch). When investigation is complete, `merge` integrates findings into main.",
8106
- parameters: {
8107
- title: { type: "string", description: "Worktree name/objective" },
8108
- topicId: { type: "string", description: "Topic scope" },
8109
- branchId: {
8110
- type: "string",
8111
- description: "The branch this worktree investigates"
8112
- },
8113
- objective: {
8114
- type: "string",
8115
- description: "Plain-text reasoning objective to auto-shape into a hypothesis, questions, tasks, and dependencies"
8116
- },
8117
- hypothesis: {
8118
- type: "string",
8119
- description: "The testable claim this worktree investigates"
8120
- },
8121
- beliefIds: {
8122
- type: "array",
8123
- description: "Beliefs to test in this worktree"
8124
- },
8125
- autoShape: {
8126
- type: "boolean",
8127
- description: "Whether to invoke inquiry auto-shaping during worktree creation"
8128
- },
8129
- domainPackId: {
8130
- type: "string",
8131
- description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
8132
- },
8133
- executionOrder: {
8134
- type: "number",
8135
- description: "Global execution order for this worktree"
8136
- },
8137
- dependsOn: {
8138
- type: "array",
8139
- description: "Worktree IDs that must complete before this one can activate"
8140
- },
8141
- blocks: {
8142
- type: "array",
8143
- description: "Worktree IDs blocked by this worktree"
8144
- },
8145
- gate: {
8146
- type: "string",
8147
- description: "Exit gate name for this worktree"
8148
- }
8149
- },
8150
- required: ["title", "topicId"],
8151
- response: {
8152
- description: "The created worktree",
8153
- fields: {
8154
- worktreeId: "string",
8155
- branchId: "string | null",
8156
- status: "string \u2014 usually 'planning' or 'active'",
8157
- title: "string",
8158
- hypothesis: "string | null",
8159
- questionCount: "number",
8160
- taskCount: "number",
8161
- autoShapeApplied: "boolean",
8162
- frameworkSuggestions: "array",
8163
- dependencySuggestions: "array"
8164
- }
8165
- },
8166
- ownerModule: "workflow-engine",
8167
- ontologyPrimitive: "worktree",
8168
- tier: "showcase"
8169
- };
8170
- var MERGE = {
8171
- name: "merge",
8172
- description: "Merge a worktree's findings into the stable knowledge base (main). Like `git merge` to main \u2014 formulations freeze, confidence is recorded, findings are integrated. Each belief gets a confidence score and rationale. After merge, beliefs can only evolve via fork. Low-confidence beliefs may need forking.",
8173
- parameters: {
8174
- worktreeId: { type: "string", description: "The worktree to merge" },
8175
- outcomes: {
8176
- type: "array",
8177
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
8178
- },
8179
- summary: { type: "string", description: "Overall findings summary" }
8180
- },
8181
- required: ["worktreeId", "outcomes"],
8182
- response: {
8183
- description: "Merge result",
8184
- fields: {
8185
- worktreeId: "string",
8186
- status: "string \u2014 'merged'",
8187
- beliefsScored: "number"
8188
- }
8189
- },
8190
- ownerModule: "workflow-engine",
8191
- ontologyPrimitive: "worktree",
8192
- tier: "showcase"
8193
- };
8194
- var QUERY_LINEAGE = {
8195
- name: "query_lineage",
8196
- description: "Trace a belief's full ancestry \u2014 every fork, score, and confidence modulation. Like `git log --graph`. Returns the complete evolution chain showing how understanding developed over time. Lineage is permanent and can never be erased (Invariant #3).",
8197
- parameters: {
8198
- nodeId: { type: "string", description: "Starting node to trace from" },
8199
- depth: {
8200
- type: "number",
8201
- description: "How many generations to traverse (default: 5)"
8202
- }
8203
- },
8204
- required: ["nodeId"],
8205
- response: {
8206
- description: "Canonical lineage result",
8207
- fields: {
8208
- beliefId: "string \u2014 canonical belief ID",
8209
- lineage: "array \u2014 ancestry entries with beliefId, nodeId, formulation, forkReason, and createdAt"
8210
- }
8211
- },
8212
- ownerModule: "graph-search",
8213
- ontologyPrimitive: "belief",
8214
- tier: "workhorse"
8215
- };
8216
- var GET_CONFIDENCE_HISTORY = {
8217
- name: "get_confidence_history",
8218
- description: "Get the full confidence history for a belief. Each entry records the confidence level, trigger, rationale, and actor. Like `git log` for a single metric \u2014 append-only, never overwritten.",
8219
- parameters: {
8220
- nodeId: { type: "string", description: "The belief to get history for" }
8221
- },
8222
- required: ["nodeId"],
8223
- response: {
8224
- description: "Confidence history entries",
8225
- fields: {
8226
- beliefId: "string \u2014 canonical belief ID",
8227
- entries: "array \u2014 { confidence, trigger, rationale, timestamp, userId }",
8228
- nextCursor: "string | null"
8229
- }
8230
- },
8231
- ownerModule: "graph-primitives",
8232
- ontologyPrimitive: "belief",
8233
- tier: "workhorse"
8234
- };
8235
- var GET_AUDIT_TRAIL = {
8236
- name: "get_audit_trail",
8237
- description: "Get the full audit trail for a node \u2014 every mutation, who made it, when, and why. Like `git blame` for knowledge. All state transitions are explicit, attributable, and permanently queryable. No silent changes are possible (Invariant #14).",
8238
- parameters: {
8239
- nodeId: { type: "string", description: "The node to audit" },
8240
- limit: {
8241
- type: "number",
8242
- description: "Maximum entries to return (default: 50)"
8243
- }
8244
- },
8245
- required: ["nodeId"],
8246
- response: {
8247
- description: "Audit trail entries",
8248
- fields: {
8249
- entries: "array \u2014 { action, actor, timestamp, before, after, rationale }"
8250
- }
8251
- },
8252
- ownerModule: "graph-primitives",
8253
- ontologyPrimitive: "graph",
8254
- tier: "workhorse"
8255
- };
8256
- var TRAVERSE_GRAPH = {
8257
- name: "traverse_graph",
8258
- description: "Walk the reasoning graph from a starting node. Like `git log --graph` \u2014 traverses connected lineage across nodes and edges. Traversal follows epistemic layers: L4 (judgments) \u2192 L3 (beliefs, questions) \u2192 L2 (evidence) \u2192 L1 (sources). Never skips layers. Use direction 'up' to trace what a piece of evidence supports, 'down' to trace what supports a judgment.",
8259
- parameters: {
8260
- startNode: { type: "string", description: "Node to start traversal from" },
8261
- direction: {
8262
- type: "string",
8263
- description: "Traversal direction",
8264
- enum: ["up", "down", "both"]
8265
- },
8266
- maxDepth: {
8267
- type: "number",
8268
- description: "Maximum traversal depth (default: 3)"
8269
- }
8270
- },
8271
- required: ["startNode"],
8272
- response: {
8273
- description: "Subgraph of traversed nodes and edges",
8274
- fields: {
8275
- nodes: "array \u2014 traversed nodes",
8276
- edges: "array \u2014 traversed edges",
8277
- depth: "number"
8278
- }
8279
- },
8280
- ownerModule: "graph-search",
8281
- ontologyPrimitive: "graph",
8282
- tier: "workhorse"
8283
- };
8284
- var GET_GRAPH_NEIGHBORHOOD = {
8285
- name: "get_graph_neighborhood",
8286
- description: "Retrieve the local neighborhood around one or more graph nodes. Like `git log --graph --boundary` for a focused reasoning window. Returns the canonical neighborhood payload shared by HTTP and SDK graph surfaces.",
8287
- parameters: {
8288
- globalId: {
8289
- type: "string",
8290
- description: "Single root node global identifier."
8291
- },
8292
- globalIds: {
8293
- type: "array",
8294
- description: "Optional list of root node global identifiers."
8295
- },
8296
- maxDepth: {
8297
- type: "number",
8298
- description: "Maximum traversal depth (default: 2)."
8299
- }
8300
- },
8301
- required: [],
8302
- response: {
8303
- description: "Canonical graph neighborhood payload",
8304
- fields: {
8305
- nodes: "array \u2014 graph nodes in the returned neighborhood",
8306
- edges: "array \u2014 graph edges in the returned neighborhood",
8307
- depth: "number \u2014 deepest traversed node depth"
8308
- }
8309
- },
8310
- ownerModule: "graph-search",
8311
- ontologyPrimitive: "graph",
8312
- tier: "workhorse"
8313
- };
8314
- var TRACE_ENTITY_IMPACT = {
8315
- name: "trace_entity_impact",
8316
- description: "Returns code-grounded beliefs, contracts, migration states, and failed attempts anchored to a specific file or function path. Like `git log -- <path>` \u2014 filters the knowledge graph to nodes anchored to a file path via metadata.codeAnchors. Results are separated by coding belief type: decisions, contracts, migrations, patterns, deprecations, and failures.",
8317
- parameters: {
8318
- nodeId: {
8319
- type: "string",
8320
- description: "Entity node ID to trace impact from"
8321
- }
8322
- },
8323
- required: ["nodeId"],
8324
- response: {
8325
- description: "Entity impact trace: direct beliefs, evidence, and indirect belief reach",
8326
- fields: {
8327
- entityNodeId: "string \u2014 the traced entity",
8328
- entityType: "string \u2014 nodeType of the entity",
8329
- directBeliefConnections: "array \u2014 beliefs directly connected via bridge edges",
8330
- evidenceConnections: "array \u2014 evidence referencing this entity",
8331
- indirectBeliefConnections: "array \u2014 beliefs reached through evidence",
8332
- totalBeliefReach: "number \u2014 total unique beliefs impacted"
8333
- }
8334
- },
8335
- ownerModule: "graph-search",
8336
- ontologyPrimitive: "graph",
8337
- tier: "workhorse"
8338
- };
8339
- var SEARCH_BELIEFS = {
8340
- name: "search_beliefs",
8341
- description: "Search for beliefs in the reasoning graph. Like `git grep` \u2014 finds relevant beliefs across the full history and active state. Supports semantic search, filtering by status (unscored, scored, archived), confidence thresholds, and topic scope. Returns beliefs with their current confidence, lineage depth, and contradiction count.",
8342
- parameters: {
8343
- query: { type: "string", description: "Semantic search query" },
8344
- status: {
8345
- type: "string",
8346
- description: "Filter by belief status",
8347
- enum: ["unscored", "scored", "archived"]
8348
- },
8349
- minConfidence: {
8350
- type: "number",
8351
- description: "Minimum confidence threshold (0-1)"
8352
- },
8353
- topicId: { type: "string", description: "Filter by topic" },
8354
- limit: { type: "number", description: "Maximum results (default: 10)" }
8355
- },
8356
- required: ["query"],
8357
- response: {
8358
- description: "Matching beliefs with metadata",
8359
- fields: {
8360
- results: "array \u2014 { nodeId, canonicalText, confidence, status, contradictionCount }"
8361
- }
8362
- },
8363
- ownerModule: "graph-search",
8364
- ontologyPrimitive: "belief",
8365
- tier: "workhorse"
8366
- };
8367
- var SEARCH_RESOURCES = {
8368
- name: "search_resources",
8369
- description: "Search beliefs, evidence, and questions in one cross-resource call. Like `git grep` across the reasoning stack \u2014 returns one ranked payload with grouped hits by resource type.",
8370
- parameters: {
8371
- q: { type: "string", description: "Search query" },
8372
- topicId: { type: "string", description: "Topic scope" },
8373
- types: {
8374
- type: "array",
8375
- description: "Optional resource filters: belief, evidence, question"
8376
- },
8377
- status: {
8378
- type: "string",
8379
- description: "Optional belief/question status filter"
8380
- },
8381
- minConfidence: {
8382
- type: "number",
8383
- description: "Optional minimum belief confidence threshold"
8384
- },
8385
- limit: { type: "number", description: "Maximum results (default: 25)" },
8386
- cursor: { type: "string", description: "Optional pagination cursor" }
8387
- },
8388
- required: ["q", "topicId"],
8389
- response: {
8390
- description: "Canonical cross-resource search payload",
8391
- fields: {
8392
- q: "string \u2014 echoed query text",
8393
- topicId: "string \u2014 canonical topic scope",
8394
- types: "array \u2014 the resource types included in the search",
8395
- results: "array \u2014 ranked mixed resource hits",
8396
- beliefs: "array \u2014 grouped belief hits",
8397
- evidence: "array \u2014 grouped evidence hits",
8398
- questions: "array \u2014 grouped question hits"
8399
- }
8400
- },
8401
- ownerModule: "graph-search",
8402
- ontologyPrimitive: "graph",
8403
- tier: "workhorse"
8404
- };
8405
- var FIND_CONTRADICTIONS = {
8406
- name: "find_contradictions",
8407
- description: "Find contradictions in the reasoning graph \u2014 beliefs that are in tension with each other. Like a merge conflict in `git` \u2014 surfaces incompatible states that require explicit resolution. Contradictions are first-class objects that may remain permanently unresolved. They can block judgments, trigger forks, or collapse confidence. Filter by project, status (unresolved, resolved, accepted), and severity.",
8408
- parameters: {
8409
- topicId: { type: "string", description: "Filter by topic" },
8410
- nodeId: {
8411
- type: "string",
8412
- description: "Find contradictions involving a specific belief"
8413
- },
8414
- status: {
8415
- type: "string",
8416
- description: "Filter by status",
8417
- enum: ["unresolved", "resolved", "accepted"]
8418
- }
8419
- },
8420
- required: [],
8421
- response: {
8422
- description: "Contradiction objects",
8423
- fields: {
8424
- contradictions: "array \u2014 { beliefA, beliefB, description, severity, status, defeatType }"
8425
- }
8426
- },
8427
- ownerModule: "graph-search",
8428
- ontologyPrimitive: "belief",
8429
- tier: "showcase"
8430
- };
8431
- var CREATE_EDGE = {
8432
- name: "create_edge",
8433
- description: "Commit a typed relationship between two nodes in the reasoning graph. Like `git commit` \u2014 an atomic write that declares a dependency between nodes. The engine enforces layer transition rules \u2014 for example, L1 \u2192 L3 direct edges are forbidden (must go through L2).",
8434
- parameters: {
8435
- sourceId: {
8436
- type: "string",
8437
- description: "Source node of the relationship"
8438
- },
8439
- targetId: {
8440
- type: "string",
8441
- description: "Target node of the relationship"
8442
- },
8443
- edgeType: {
8444
- type: "string",
8445
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
8446
- },
8447
- weight: {
8448
- type: "number",
8449
- description: "Edge weight: -1.0 to +1.0 for informs edges, 0-1 for structural"
8450
- },
8451
- reasoning: { type: "string", description: "Why this relationship exists" },
8452
- reasoningMethod: {
8453
- type: "string",
8454
- description: "How this was determined",
8455
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
8456
- }
8457
- },
8458
- required: ["sourceId", "targetId", "edgeType"],
8459
- response: {
8460
- description: "The created edge",
8461
- fields: {
8462
- globalId: "string \u2014 edge identifier",
8463
- edgeType: "string",
8464
- fromLayer: "string",
8465
- toLayer: "string"
8466
- }
8467
- },
8468
- ownerModule: "graph-primitives",
8469
- ontologyPrimitive: "edge",
8470
- tier: "showcase"
8471
- };
8472
- var RECORD_JUDGMENT = {
8473
- name: "record_judgment",
8474
- description: "Record a judgment \u2014 an irreversible commitment based on the current epistemic state. Like a `git tag` marking a release. A judgment synthesizes beliefs, evidence, and uncertainties into a determination. Once issued, a judgment is evaluated against the epistemic state that existed when it was made (knowledge horizon evaluation, Invariant #10).",
8475
- parameters: {
8476
- title: { type: "string", description: "Short judgment statement" },
8477
- rationale: {
8478
- type: "string",
8479
- description: "Full reasoning behind the judgment"
8480
- },
8481
- topicId: { type: "string", description: "Topic scope" },
8482
- beliefIds: {
8483
- type: "array",
8484
- description: "Beliefs that warrant this judgment"
8485
- },
8486
- confidence: {
8487
- type: "number",
8488
- description: "Confidence in the judgment (0-1)"
8489
- }
8490
- },
8491
- required: ["title", "rationale", "topicId"],
8492
- response: {
8493
- description: "The recorded judgment",
8494
- fields: {
8495
- judgmentId: "string",
8496
- title: "string",
8497
- status: "string \u2014 'issued'"
8498
- }
8499
- },
8500
- ownerModule: "decision-state",
8501
- ontologyPrimitive: "judgment",
8502
- tier: "showcase"
8503
- };
8504
- var CREATE_LENS = {
8505
- name: "create_lens",
8506
- description: "Create a reusable lens that overlays a workspace topic with a specific analytical perspective. Like `git branch <name>` for operational scaffolding \u2014 a lens persists across worktrees and carries prompts, workflows, and task templates. Multiple topics in the same workspace can reuse the same lens.",
8507
- parameters: {
8508
- name: {
8509
- type: "string",
8510
- description: "Lens name (e.g., 'market dynamics', 'team quality')"
8511
- },
8512
- workspaceId: {
8513
- type: "string",
8514
- description: "Workspace scope for the lens. Required unless topicId resolves to a workspace-scoped topic."
8515
- },
8516
- topicId: {
8517
- type: "string",
8518
- description: "Optional originating topic scope. Lenses remain reusable across topics even when this is set."
8519
- },
8520
- description: {
8521
- type: "string",
8522
- description: "What this lens is designed to investigate or monitor"
8523
- },
8524
- perspectiveType: {
8525
- type: "string",
8526
- description: "Perspective type for the lens. Validated against schemaEnumConfig category 'lens_perspective_type'.",
8527
- enum: [...LENS_PERSPECTIVE_TYPES]
8528
- },
8529
- promptTemplates: {
8530
- type: "array",
8531
- description: "Langfuse prompt references used when operating through this lens"
8532
- },
8533
- workflowTemplates: {
8534
- type: "array",
8535
- description: "Guided workflow templates for lens-driven investigations"
8536
- },
8537
- taskTemplates: {
8538
- type: "array",
8539
- description: "Default task templates instantiated when the lens is applied"
8540
- },
8541
- filterCriteria: {
8542
- type: "object",
8543
- description: "Belief/evidence filtering rules applied by the lens"
8544
- }
8545
- },
8546
- required: ["name", "perspectiveType"],
8547
- response: {
8548
- description: "The created lens",
8549
- fields: {
8550
- lensId: "string",
8551
- name: "string",
8552
- workspaceId: "string",
8553
- status: "string \u2014 'active'"
8554
- }
8555
- },
8556
- ownerModule: "schema-management",
8557
- ontologyPrimitive: "lens",
8558
- tier: "showcase"
8559
- };
8560
- var LIST_LENSES = {
8561
- name: "list_lenses",
8562
- description: "List reusable lenses for a workspace, optionally scored by whether they are active on a topic. Like `git branch --list` \u2014 shows the available named frames you can activate. When topicId is provided, the response can indicate which lenses are already applied there.",
8563
- parameters: {
8564
- workspaceId: {
8565
- type: "string",
8566
- description: "Workspace scope to list lenses from"
8567
- },
8568
- topicId: {
8569
- type: "string",
8570
- description: "Optional topic scope used to derive workspace and annotate applied lenses"
8571
- },
8572
- status: {
8573
- type: "string",
8574
- description: "Filter by lens lifecycle status",
8575
- enum: ["draft", "active", "archived"]
8576
- },
8577
- perspectiveType: {
8578
- type: "string",
8579
- description: "Filter by perspective type",
8580
- enum: [...LENS_PERSPECTIVE_TYPES]
8581
- }
8582
- },
8583
- required: [],
8584
- response: {
8585
- description: "Available lenses",
8586
- fields: {
8587
- lenses: "array \u2014 each item includes lensId, name, workspaceId, perspectiveType, status, and optional isAppliedToTopic"
8588
- }
8589
- },
8590
- ownerModule: "schema-management",
8591
- ontologyPrimitive: "lens",
8592
- tier: "workhorse"
8593
- };
8594
- var APPLY_LENS_TO_TOPIC = {
8595
- name: "apply_lens_to_topic",
8596
- description: "Apply a lens to a topic so it becomes an active perspective overlay. Like `git checkout <branch>` for a reusable frame \u2014 the topic keeps its knowledge, but the active lens shapes guidance and retrieval. Multiple active lenses can coexist on the same topic.",
8597
- parameters: {
8598
- lensId: { type: "string", description: "Lens to activate on the topic" },
8599
- topicId: { type: "string", description: "Topic that should receive the lens" }
8600
- },
8601
- required: ["lensId", "topicId"],
8602
- response: {
8603
- description: "Lens activation result",
8604
- fields: {
8605
- bindingId: "string",
8606
- lensId: "string",
8607
- topicId: "string",
8608
- status: "string \u2014 'active'"
8609
- }
8610
- },
8611
- ownerModule: "schema-management",
8612
- ontologyPrimitive: "lens",
8613
- tier: "workhorse"
8614
- };
8615
- var REMOVE_LENS_FROM_TOPIC = {
8616
- name: "remove_lens_from_topic",
8617
- description: "Remove an active lens overlay from a topic. Like `git switch` away from a frame \u2014 the topic remains, but the lens stops shaping the investigation context. Historical binding state is preserved for auditability.",
8618
- parameters: {
8619
- lensId: { type: "string", description: "Lens to remove from the topic" },
8620
- topicId: { type: "string", description: "Topic that currently has the lens applied" }
8621
- },
8622
- required: ["lensId", "topicId"],
8623
- response: {
8624
- description: "Lens removal result",
8625
- fields: {
8626
- bindingId: "string",
8627
- lensId: "string",
8628
- topicId: "string",
8629
- status: "string \u2014 'removed'"
8630
- }
8631
- },
8632
- ownerModule: "schema-management",
8633
- ontologyPrimitive: "lens",
8634
- tier: "workhorse"
8635
- };
8636
- var PUSH = {
8637
- name: "push",
8638
- description: "Push scored beliefs from a merged worktree to other contexts. Like `git push` \u2014 makes local findings available on the remote. Only merged beliefs can be pushed. Publication makes findings visible to other projects, teams, or external consumers.",
8639
- parameters: {
8640
- worktreeId: {
8641
- type: "string",
8642
- description: "The merged worktree whose findings to push"
8643
- },
8644
- targetContext: {
8645
- type: "string",
8646
- description: "Where to push (e.g., 'portfolio', 'ic_review', 'external')"
8647
- },
8648
- beliefIds: {
8649
- type: "array",
8650
- description: "Optional subset of beliefs to push (default: all scored)"
8651
- }
8652
- },
8653
- required: ["worktreeId", "targetContext"],
8654
- response: {
8655
- description: "Push result",
8656
- fields: {
8657
- pushedCount: "number",
8658
- targetContext: "string",
8659
- pushedAt: "number"
8660
- }
8661
- },
8662
- ownerModule: "workflow-engine",
8663
- ontologyPrimitive: "worktree",
8664
- tier: "workhorse"
8665
- };
8666
- var OPEN_PULL_REQUEST = {
8667
- name: "open_pull_request",
8668
- description: "Open a pull request for peer review before merging a worktree. Like opening a `git pull request` \u2014 the worktree's findings are ready but await approval before merge. Reviewers can approve, request changes, or block the merge. This is the gate between draft work and scored knowledge.",
8669
- parameters: {
8670
- worktreeId: {
8671
- type: "string",
8672
- description: "The worktree to submit for review"
8673
- },
8674
- reviewers: {
8675
- type: "array",
8676
- description: "User IDs of requested reviewers"
8677
- },
8678
- summary: {
8679
- type: "string",
8680
- description: "Summary of findings and why they're ready for merge"
8681
- }
8682
- },
8683
- required: ["worktreeId", "summary"],
8684
- response: {
8685
- description: "The pull request",
8686
- fields: {
8687
- pullRequestId: "string",
8688
- worktreeId: "string",
8689
- status: "string \u2014 'pending_review'"
8690
- }
8691
- },
8692
- ownerModule: "workflow-engine",
8693
- ontologyPrimitive: "worktree",
8694
- tier: "showcase"
8695
- };
8696
- var BISECT_CONFIDENCE = {
8697
- name: "bisect_confidence",
8698
- description: "Find when a belief's confidence diverged from reality. Like `git bisect` \u2014 binary search through the credence history to find the inflection point. Given a belief that is now known to be wrong (or right), traces back through confidence modulations to identify which evidence or event caused the divergence.",
8699
- parameters: {
8700
- nodeId: { type: "string", description: "The belief to bisect" },
8701
- expectedDirection: {
8702
- type: "string",
8703
- description: "Was confidence too high or too low?",
8704
- enum: ["overconfident", "underconfident"]
8705
- },
8706
- timeRange: {
8707
- type: "object",
8708
- description: "Optional time range to search within: { start: number, end: number }"
8709
- }
8710
- },
8711
- required: ["nodeId", "expectedDirection"],
8712
- response: {
8713
- description: "The inflection point in confidence history",
8714
- fields: {
8715
- beliefId: "string \u2014 canonical belief ID",
8716
- expectedDirection: "string \u2014 overconfident | underconfident",
8717
- inflectionEntry: "object \u2014 the confidence modulation where divergence began",
8718
- triggerEvent: "string | null \u2014 what caused the divergence",
8719
- confidenceBefore: "number | null",
8720
- confidenceAfter: "number | null",
8721
- totalEntries: "number",
8722
- inflectionIndex: "number | null"
8723
- }
8724
- },
8725
- ownerModule: "graph-search",
8726
- ontologyPrimitive: "belief",
8727
- tier: "showcase"
8728
- };
8729
- var DETECT_CONFIRMATION_BIAS = {
8730
- name: "detect_confirmation_bias",
8731
- description: "Detect confirmation bias in the evidence graph. Like `git diff --stat` for reasoning \u2014 analyzes the ratio of supporting vs challenging evidence per belief and flags beliefs where the evidence is suspiciously one-sided. Returns risk classification (critical/high/moderate/healthy).",
8732
- parameters: {
8733
- topicId: { type: "string", description: "Topic to analyze" },
8734
- threshold: {
8735
- type: "number",
8736
- description: "Bias threshold (0-1, default 0.7)"
8737
- }
8738
- },
8739
- required: ["topicId"],
8740
- response: {
8741
- description: "Beliefs with bias scores, risk levels, and evidence counts",
8742
- fields: {
8743
- beliefs: "array \u2014 { nodeId, biasScore, riskLevel, supportingCount, challengingCount }"
8744
- }
8745
- },
8746
- ownerModule: "graph-search",
8747
- ontologyPrimitive: "graph",
8748
- tier: "showcase"
8749
- };
8750
- var GET_GRAPH_STRUCTURE_ANALYSIS = {
8751
- name: "get_graph_structure_analysis",
8752
- description: "Run comprehensive structural analysis on the knowledge graph. Like `git fsck` combined with PageRank \u2014 runs 14 algorithmic detectors including PageRank centrality, Louvain community detection, Tarjan SCC, Fiedler vector spectral analysis, Bayesian surprise, and overconfidence detection.",
8753
- parameters: {
8754
- topicId: { type: "string", description: "Topic to analyze" }
8755
- },
8756
- required: ["topicId"],
8757
- response: {
8758
- description: "Structural analysis with detector results and recommendations",
8759
- fields: {
8760
- topicId: "string \u2014 canonical topic scope",
8761
- metric: "string \u2014 analysis metric identifier",
8762
- payload: "object \u2014 detector results, recommendations, graph metrics"
8763
- }
8764
- },
8765
- ownerModule: "graph-search",
8766
- ontologyPrimitive: "graph",
8767
- tier: "showcase"
8768
- };
8769
- var GET_FALSIFICATION_QUESTIONS = {
8770
- name: "get_falsification_questions",
8771
- description: "Generate Popperian falsification questions for beliefs. Like `git test` \u2014 identifies the questions most likely to disprove current beliefs. Karl Popper as a tool: surfaces what would need to be true to invalidate each belief.",
8772
- parameters: {
8773
- topicId: { type: "string", description: "Topic to analyze" },
8774
- beliefIds: { type: "array", description: "Specific beliefs to target" }
8775
- },
8776
- required: ["topicId"],
8777
- response: {
8778
- description: "Questions with falsification potential scores and target beliefs",
8779
- fields: {
8780
- questions: "array \u2014 { questionText, falsificationPotential, targetBeliefId, targetBeliefText }"
8781
- }
8782
- },
8783
- ownerModule: "graph-search",
8784
- ontologyPrimitive: "question",
8785
- tier: "showcase"
8786
- };
8787
- var SEARCH_SOURCES = {
8788
- name: "search_sources",
8789
- description: "Search and ingest external sources into the knowledge graph. Like `git fetch` \u2014 pulls information from external sources (web, documents, APIs) and stages it for evidence creation. Does not commit \u2014 you decide what becomes evidence.",
8790
- parameters: {
8791
- query: { type: "string", description: "Search query" },
8792
- sources: {
8793
- type: "array",
8794
- description: "Source types to search: web, news, academic"
8795
- }
8796
- },
8797
- required: ["query"],
8798
- response: {
8799
- description: "Results with source metadata, relevance scores, and suggested evidence",
8800
- fields: {
8801
- results: "array \u2014 { title, url, snippet, relevanceScore, suggestedEvidence }"
8802
- }
8803
- },
8804
- ownerModule: "research-engine",
8805
- ontologyPrimitive: "source",
8806
- tier: "showcase"
8807
- };
8808
- var EXECUTE_DEEP_RESEARCH = {
8809
- name: "execute_deep_research",
8810
- description: "Execute multi-source deep research on a topic. Like `git submodule update --recursive` \u2014 launches a comprehensive research agent that searches multiple sources, synthesizes findings, and produces a structured report. Auto-links results to relevant questions and beliefs.",
8811
- parameters: {
8812
- query: { type: "string", description: "Research question or topic" },
8813
- topicId: { type: "string", description: "Topic scope" },
8814
- depth: {
8815
- type: "string",
8816
- description: "Research depth: quick, standard, deep",
8817
- enum: ["quick", "standard", "deep"]
8818
- }
8819
- },
8820
- required: ["query", "topicId"],
8821
- response: {
8822
- description: "Report with findings, sources, auto-linked evidence and questions",
8823
- fields: {
8824
- report: "object \u2014 { summary, findings, sources, linkedEvidence, linkedQuestions }"
8825
- }
8826
- },
8827
- ownerModule: "research-engine",
8828
- ontologyPrimitive: "source",
8829
- tier: "showcase"
8830
- };
8831
- var SEARCH_EVIDENCE = {
8832
- name: "search_evidence",
8833
- description: "Search for evidence across the reasoning graph. Like `git grep` \u2014 returns the evidence records that best match a textual query. Results share the same canonical semantics as the HTTP and SDK evidence search surface.",
8834
- parameters: {
8835
- q: { type: "string", description: "Search text" },
8836
- topicId: { type: "string", description: "Topic scope filter" },
8837
- targetId: {
8838
- type: "string",
8839
- description: "Optional belief or question identifier to scope the search"
8840
- },
8841
- limit: { type: "number", description: "Max results" },
8842
- cursor: { type: "string", description: "Pagination cursor" }
8843
- },
8844
- required: ["q"],
8845
- response: {
8846
- description: "Canonical evidence search results page",
8847
- fields: {
8848
- results: "array \u2014 { evidenceId, nodeId, globalId?, text, source?, kind?, relevanceScore }",
8849
- nextCursor: "string | null"
8850
- }
8851
- },
8852
- ownerModule: "graph-search",
8853
- ontologyPrimitive: "evidence",
8854
- tier: "workhorse"
8855
- };
8856
- var CREATE_EVIDENCE = {
8857
- name: "create_evidence",
8858
- description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation.",
8859
- parameters: {
8860
- topicId: { type: "string", description: "Topic scope" },
8861
- text: { type: "string", description: "Canonical evidence text" },
8862
- source: { type: "string", description: "Source URL or source label" },
8863
- targetId: {
8864
- type: "string",
8865
- description: "Optional belief or question identifier to link immediately"
8866
- },
8867
- weight: {
8868
- type: "number",
8869
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
8870
- },
8871
- metadata: {
8872
- type: "object",
8873
- description: "Optional metadata merged into the canonical evidence node"
8874
- },
8875
- title: { type: "string", description: "Optional short title" },
8876
- content: { type: "string", description: "Optional long-form content" },
8877
- contentType: {
8878
- type: "string",
8879
- description: "Optional content format or MIME hint"
8880
- },
8881
- kind: { type: "string", description: "Optional evidence kind" }
8882
- },
8883
- required: ["topicId", "text"],
8884
- response: {
8885
- description: "The created canonical evidence record",
8886
- fields: {
8887
- id: "string \u2014 canonical evidence ID",
8888
- nodeId: "string \u2014 canonical evidence ID",
8889
- evidenceId: "string \u2014 canonical evidence ID",
8890
- text: "string",
8891
- topicId: "string"
8892
- }
8893
- },
8894
- ownerModule: "graph-primitives",
8895
- ontologyPrimitive: "evidence",
8896
- tier: "workhorse"
8897
- };
8898
- var GET_EVIDENCE = {
8899
- name: "get_evidence",
8900
- description: "Read one evidence record by ID. Like `git show` \u2014 resolves the canonical evidence payload for a single identifier.",
8901
- parameters: {
8902
- id: { type: "string", description: "Canonical evidence ID" }
8903
- },
8904
- required: ["id"],
8905
- response: {
8906
- description: "The canonical evidence record",
8907
- fields: {
8908
- id: "string \u2014 canonical evidence ID",
8909
- nodeId: "string \u2014 canonical evidence ID",
8910
- evidenceId: "string \u2014 canonical evidence ID",
8911
- text: "string",
8912
- topicId: "string"
8913
- }
8914
- },
8915
- ownerModule: "graph-primitives",
8916
- ontologyPrimitive: "evidence",
8917
- tier: "workhorse"
8918
- };
8919
- var LIST_EVIDENCE = {
8920
- name: "list_evidence",
8921
- description: "List evidence records within a topic or linked to a target. Like `git log -- path` \u2014 returns the canonical evidence page for a topic, belief, or question scope.",
8922
- parameters: {
8923
- topicId: { type: "string", description: "Topic scope filter" },
8924
- targetId: {
8925
- type: "string",
8926
- description: "Optional belief or question identifier to scope by linkage"
8927
- },
8928
- limit: { type: "number", description: "Max results" },
8929
- cursor: { type: "string", description: "Pagination cursor" }
8930
- },
8931
- required: [],
8932
- response: {
8933
- description: "Canonical evidence page",
8934
- fields: {
8935
- evidence: "array \u2014 canonical evidence records",
8936
- nextCursor: "string | null"
8937
- }
8938
- },
8939
- ownerModule: "graph-primitives",
8940
- ontologyPrimitive: "evidence",
8941
- tier: "workhorse"
8942
- };
8943
- var LINK_EVIDENCE = {
8944
- name: "link_evidence",
8945
- description: "Link evidence to a belief or question. Like `git notes add` \u2014 attaches a supporting or contradicting edge without rewriting the evidence itself.",
8946
- parameters: {
8947
- evidenceId: { type: "string", description: "Canonical evidence ID" },
8948
- targetId: {
8949
- type: "string",
8950
- description: "Canonical belief or question ID"
8951
- },
8952
- weight: {
8953
- type: "number",
8954
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
8955
- },
8956
- rationale: { type: "string", description: "Why this link exists" }
8957
- },
8958
- required: ["evidenceId", "targetId"],
8959
- response: {
8960
- description: "The created canonical evidence edge summary",
8961
- fields: {
8962
- edgeId: "string",
8963
- evidenceId: "string",
8964
- targetId: "string",
8965
- targetType: "string \u2014 belief | question",
8966
- weight: "number"
8967
- }
8968
- },
8969
- ownerModule: "graph-primitives",
8970
- ontologyPrimitive: "edge",
8971
- tier: "workhorse"
8972
- };
8973
- var LINK_EVIDENCE_TO_BELIEF = {
8974
- name: "link_evidence_to_belief",
8975
- description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports).",
8976
- parameters: {
8977
- evidenceId: { type: "string", description: "The evidence node ID" },
8978
- beliefId: { type: "string", description: "The belief node ID" },
8979
- weight: {
8980
- type: "number",
8981
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
8982
- },
8983
- rationale: { type: "string", description: "Why this evidence is relevant" }
8984
- },
8985
- required: ["evidenceId", "beliefId", "weight"],
8986
- response: {
8987
- description: "The created edge linking evidence to belief",
8988
- fields: {
8989
- edgeId: "string",
8990
- evidenceId: "string",
8991
- beliefId: "string",
8992
- weight: "number"
8993
- }
8994
- },
8995
- ownerModule: "graph-primitives",
8996
- ontologyPrimitive: "edge",
8997
- tier: "workhorse"
8998
- };
8999
- var CREATE_QUESTION = {
9000
- name: "create_question",
9001
- description: "Commit an investigation question to the reasoning graph. Like `git issue` \u2014 creates a traceable question that drives research and evidence collection. Questions test beliefs and guide worktree investigation.",
9002
- parameters: {
9003
- text: { type: "string", description: "The question text" },
9004
- topicId: { type: "string", description: "Topic scope" },
9005
- priority: {
9006
- type: "string",
9007
- description: "Priority: urgent, high, medium, low",
9008
- enum: ["urgent", "high", "medium", "low"]
9009
- },
9010
- linkedBeliefId: {
9011
- type: "string",
9012
- description: "Belief this question tests"
9013
- },
9014
- metadata: {
9015
- type: "object",
9016
- description: "Optional metadata merged into the question record"
9017
- }
9018
- },
9019
- required: ["text", "topicId"],
9020
- response: {
9021
- description: "The created canonical question record",
9022
- fields: {
9023
- id: "string \u2014 canonical question ID",
9024
- nodeId: "string \u2014 canonical question ID",
9025
- questionId: "string \u2014 canonical question ID",
9026
- text: "string",
9027
- status: "string"
9028
- }
9029
- },
9030
- ownerModule: "graph-primitives",
9031
- ontologyPrimitive: "question",
9032
- tier: "workhorse"
9033
- };
9034
- var GET_QUESTION = {
9035
- name: "get_question",
9036
- description: "Read one question by ID. Like `git show` \u2014 resolves the canonical question payload for a single identifier.",
9037
- parameters: {
9038
- id: { type: "string", description: "Canonical question ID" }
9039
- },
9040
- required: ["id"],
9041
- response: {
9042
- description: "The canonical question record",
9043
- fields: {
9044
- id: "string \u2014 canonical question ID",
9045
- nodeId: "string \u2014 canonical question ID",
9046
- questionId: "string \u2014 canonical question ID",
9047
- text: "string",
9048
- status: "string"
9049
- }
9050
- },
9051
- ownerModule: "graph-primitives",
9052
- ontologyPrimitive: "question",
9053
- tier: "workhorse"
9054
- };
9055
- var REFINE_QUESTION = {
9056
- name: "refine_question",
9057
- description: "Refine a question's framing or scope. Like `git commit --amend` for questions \u2014 updates the question text while preserving its identity and linked evidence.",
9058
- parameters: {
9059
- id: { type: "string", description: "The question to refine" },
9060
- text: { type: "string", description: "Updated question text" },
9061
- rationale: {
9062
- type: "string",
9063
- description: "Why the question is being refined"
9064
- }
9065
- },
9066
- required: ["id", "text"],
9067
- response: {
9068
- description: "The refined question",
9069
- fields: {
9070
- id: "string",
9071
- questionId: "string",
9072
- updatedText: "string",
9073
- previousText: "string"
9074
- }
9075
- },
9076
- ownerModule: "graph-primitives",
9077
- ontologyPrimitive: "question",
9078
- tier: "workhorse"
9079
- };
9080
- var LIST_QUESTIONS = {
9081
- name: "list_questions",
9082
- description: "List questions scoped to a topic or worktree. Like `git issue list` \u2014 returns questions with their status, priority, and linked belief context. Supports filtering by status and priority.",
9083
- parameters: {
9084
- topicId: { type: "string", description: "Topic scope" },
9085
- worktreeId: { type: "string", description: "Filter to worktree scope" },
9086
- status: {
9087
- type: "string",
9088
- description: "Filter by canonical question status",
9089
- enum: ["open", "researching", "answered", "parked", "closed"]
9090
- },
9091
- priority: {
9092
- type: "string",
9093
- description: "Filter by canonical question priority",
9094
- enum: ["urgent", "high", "medium", "low"]
9095
- },
9096
- limit: { type: "number", description: "Max results" },
9097
- cursor: { type: "string", description: "Pagination cursor" }
9098
- },
9099
- required: ["topicId"],
9100
- response: {
9101
- description: "Canonical question page",
9102
- fields: {
9103
- questions: "array \u2014 canonical question records",
9104
- nextCursor: "string | null"
9105
- }
9106
- },
9107
- ownerModule: "graph-primitives",
9108
- ontologyPrimitive: "question",
9109
- tier: "workhorse"
9110
- };
9111
- var ANSWER_QUESTION = {
9112
- name: "answer_question",
9113
- description: "Answer a question with optional evidence links. Like `git commit` on the question thread \u2014 records the answer and closes the loop with a canonical answered state.",
9114
- parameters: {
9115
- id: { type: "string", description: "Canonical question ID" },
9116
- text: { type: "string", description: "Answer text" },
9117
- confidence: {
9118
- type: "string",
9119
- description: "Optional answer confidence",
9120
- enum: ["weak", "medium", "strong"]
9121
- },
9122
- evidenceIds: {
9123
- type: "array",
9124
- description: "Optional canonical evidence IDs supporting the answer"
9125
- },
9126
- rationale: { type: "string", description: "Why this answer is credible" }
9127
- },
9128
- required: ["id", "text"],
9129
- response: {
9130
- description: "Answer result",
9131
- fields: {
9132
- questionId: "string",
9133
- answerId: "string",
9134
- status: "string \u2014 answered"
9135
- }
9136
- },
9137
- ownerModule: "graph-primitives",
9138
- ontologyPrimitive: "question",
9139
- tier: "workhorse"
9140
- };
9141
- var UPDATE_QUESTION_STATUS = {
9142
- name: "update_question_status",
9143
- description: "Transition a question's status through its lifecycle. Like `git issue update` \u2014 moves a question through the canonical reasoning lifecycle. Status transitions preserve history and keep linked evidence intact.",
9144
- parameters: {
9145
- id: { type: "string", description: "The question to update" },
9146
- status: {
9147
- type: "string",
9148
- description: "New status",
9149
- enum: ["open", "researching", "answered", "parked", "closed"]
9150
- },
9151
- rationale: { type: "string", description: "Why the status is changing" }
9152
- },
9153
- required: ["id", "status"],
9154
- response: {
9155
- description: "Updated question status",
9156
- fields: {
9157
- id: "string",
9158
- questionId: "string",
9159
- previousStatus: "string",
9160
- newStatus: "string"
9161
- }
9162
- },
9163
- ownerModule: "graph-primitives",
9164
- ontologyPrimitive: "question",
9165
- tier: "workhorse"
9166
- };
9167
- var ARCHIVE_QUESTION = {
9168
- name: "archive_question",
9169
- description: "Archive a question no longer relevant to current investigation scope. Like `git issue close` \u2014 removes it from active work while preserving audit history. Archived questions keep their existing links to beliefs and evidence.",
9170
- parameters: {
9171
- questionId: { type: "string", description: "The question to archive" },
9172
- reason: {
9173
- type: "string",
9174
- description: "Why the question is being archived"
9175
- }
9176
- },
9177
- required: ["questionId"],
9178
- response: {
9179
- description: "Archive confirmation",
9180
- fields: {
9181
- questionId: "string",
9182
- status: "string \u2014 'archived'",
9183
- archivedAt: "number"
9184
- }
9185
- },
9186
- ownerModule: "graph-primitives",
9187
- ontologyPrimitive: "question",
9188
- tier: "workhorse"
9189
- };
9190
- var LINK_EVIDENCE_TO_QUESTION = {
9191
- name: "link_evidence_to_question",
9192
- description: "Link evidence to the question it helps answer. Like `git notes add` \u2014 attaches supporting detail to an active question. Question-level links improve answer quality and traceability to beliefs.",
9193
- parameters: {
9194
- evidenceId: { type: "string", description: "The evidence to link" },
9195
- questionId: {
9196
- type: "string",
9197
- description: "The question this evidence addresses"
9198
- },
9199
- relevance: { type: "number", description: "Relevance score in [0,1]" },
9200
- rationale: {
9201
- type: "string",
9202
- description: "How this evidence bears on the question"
9203
- }
9204
- },
9205
- required: ["evidenceId", "questionId"],
9206
- response: {
9207
- description: "The created edge",
9208
- fields: {
9209
- edgeId: "string",
9210
- evidenceId: "string",
9211
- questionId: "string",
9212
- relevance: "number"
9213
- }
9214
- },
9215
- ownerModule: "graph-primitives",
9216
- ontologyPrimitive: "edge",
9217
- tier: "workhorse"
9218
- };
9219
- var CREATE_ANSWER = {
9220
- name: "create_answer",
9221
- description: "Create an answer node responding to a question. Like `git commit` for resolved questions \u2014 creates an immutable answer snapshot at L2. New answers supersede old ones, preserving full version history. Answers link to supporting evidence via based_on edges.",
9222
- parameters: {
9223
- questionNodeId: {
9224
- type: "string",
9225
- description: "The question node ID this answers"
9226
- },
9227
- answerText: {
9228
- type: "string",
9229
- description: "The answer content \u2014 the actual response to the question"
9230
- },
9231
- topicId: {
9232
- type: "string",
9233
- description: "Topic scope (optional if question already has topicId)"
9234
- },
9235
- confidence: {
9236
- type: "string",
9237
- description: "Answer confidence: definitive, strong, moderate, weak, speculative"
9238
- },
9239
- evidenceNodeIds: {
9240
- type: "array",
9241
- description: "Supporting evidence node IDs to link via based_on edges"
9242
- },
9243
- answerSource: {
9244
- type: "string",
9245
- description: "How the answer was produced: human, ai_generated, deep_research, synthesis"
9246
- }
9247
- },
9248
- required: ["questionNodeId", "answerText"],
9249
- response: {
9250
- description: "The created answer node with version metadata",
9251
- fields: {
9252
- nodeId: "string \u2014 unique node identifier",
9253
- globalId: "string \u2014 globally unique ID",
9254
- versionNumber: "number \u2014 version of this answer (auto-incremented)",
9255
- questionNodeId: "string \u2014 the question this answers",
9256
- confidence: "string \u2014 answer confidence level"
9257
- }
9258
- },
9259
- ownerModule: "graph-primitives",
9260
- ontologyPrimitive: "evidence",
9261
- tier: "showcase"
9262
- };
9263
- var GET_ANSWER = {
9264
- name: "get_answer",
9265
- description: "Get the latest answer for a question. Like `git show HEAD` for a question's resolution \u2014 returns the active answer snapshot. Returns null if the question is unanswered.",
9266
- parameters: {
9267
- questionNodeId: {
9268
- type: "string",
9269
- description: "The question node ID to get the answer for"
9270
- }
9271
- },
9272
- required: ["questionNodeId"],
9273
- response: {
9274
- description: "The active answer node or null",
9275
- fields: {
9276
- nodeId: "string | null",
9277
- globalId: "string | null",
9278
- answerText: "string | null",
9279
- versionNumber: "number",
9280
- isLatest: "boolean",
9281
- evidenceCount: "number",
9282
- confidence: "string"
9283
- }
9284
- },
9285
- ownerModule: "graph-primitives",
9286
- ontologyPrimitive: "evidence",
9287
- tier: "workhorse"
9288
- };
9289
- var GET_HIGH_PRIORITY_QUESTIONS = {
9290
- name: "get_high_priority_questions",
9291
- description: "Rank open questions by urgency and expected decision impact. Like `git issue list --sort=priority` \u2014 brings the highest-leverage open questions to the top. Ranking accounts for linked belief criticality and evidence gaps.",
9292
- parameters: {
9293
- topicId: { type: "string", description: "Topic scope" },
9294
- limit: { type: "number", description: "Maximum results (default: 20)" },
9295
- includeAnswered: {
9296
- type: "boolean",
9297
- description: "Include answered questions (default: false)"
9298
- }
9299
- },
9300
- required: ["topicId"],
9301
- response: {
9302
- description: "Priority-ranked questions",
9303
- fields: {
9304
- questions: "array \u2014 { questionId, text, priority, urgencyScore, linkedBeliefCount, evidenceGapCount }"
9305
- }
9306
- },
9307
- ownerModule: "graph-search",
9308
- ontologyPrimitive: "question",
9309
- tier: "workhorse"
9310
- };
9311
- var FIND_MISSING_QUESTIONS = {
9312
- name: "find_missing_questions",
9313
- description: "Identify beliefs missing testing questions. Like `git diff --check` \u2014 surfaces reasoning coverage gaps before merge. Returns candidate beliefs that need explicit question coverage.",
9314
- parameters: {
9315
- topicId: { type: "string", description: "Topic scope" },
9316
- minConfidence: {
9317
- type: "number",
9318
- description: "Only check beliefs above this confidence (default: 0)"
9319
- }
9320
- },
9321
- required: ["topicId"],
9322
- response: {
9323
- description: "Beliefs missing testing questions",
9324
- fields: {
9325
- gaps: "array \u2014 { beliefId, canonicalText, confidence, suggestedQuestions }",
9326
- totalGaps: "number"
9327
- }
9328
- },
9329
- ownerModule: "graph-search",
9330
- ontologyPrimitive: "question",
9331
- tier: "workhorse"
9332
- };
9333
- var LIST_BELIEFS = {
9334
- name: "list_beliefs",
9335
- description: "List beliefs scoped to a topic or worktree. Like `git log --oneline` \u2014 returns beliefs with their confidence, status, and scoring state. Supports filtering by status and confidence threshold.",
9336
- parameters: {
9337
- topicId: { type: "string", description: "Topic scope" },
9338
- worktreeId: { type: "string", description: "Filter to worktree scope" },
9339
- status: {
9340
- type: "string",
9341
- description: "Filter: unscored, scored, archived",
9342
- enum: ["unscored", "scored", "archived"]
9343
- },
9344
- minConfidence: {
9345
- type: "number",
9346
- description: "Minimum confidence threshold"
9347
- }
9348
- },
9349
- required: ["topicId"],
9350
- response: {
9351
- description: "Canonical belief page",
9352
- fields: {
9353
- beliefs: "array \u2014 canonical belief records",
9354
- nextCursor: "string | null"
9355
- }
9356
- },
9357
- ownerModule: "graph-primitives",
9358
- ontologyPrimitive: "belief",
9359
- tier: "workhorse"
9360
- };
9361
- var LIST_WORKTREES = {
9362
- name: "list_worktrees",
9363
- description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with their phase, status, and belief counts.",
9364
- parameters: {
9365
- topicId: { type: "string", description: "Topic scope" },
9366
- status: {
9367
- type: "string",
9368
- description: "Filter: active, merged, abandoned",
9369
- enum: ["active", "merged", "abandoned"]
9370
- }
9371
- },
9372
- required: ["topicId"],
9373
- response: {
9374
- description: "Worktrees with phase, status, belief count, and creation time",
9375
- fields: {
9376
- worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
9377
- }
9378
- },
9379
- ownerModule: "workflow-engine",
9380
- ontologyPrimitive: "worktree",
9381
- tier: "workhorse"
9382
- };
9383
- var LIST_ALL_WORKTREES = {
9384
- name: "list_all_worktrees",
9385
- description: "List ALL worktrees across ALL topics in one query. No topic scope required. Like `git worktree list --all` \u2014 returns the complete pipeline inventory with track, trackPosition, executionBand, dependencies, and status. Supports filtering by status, track, and executionBand. This is the PM's primary pipeline query \u2014 one call, full picture.",
9386
- parameters: {
9387
- status: {
9388
- type: "string",
9389
- description: "Filter by status: planning, active, completed, abandoned, superseded, long_term, idea, paused, suggested, dismissed",
9390
- enum: [
9391
- "planning",
9392
- "active",
9393
- "completed",
9394
- "abandoned",
9395
- "superseded",
9396
- "long_term",
9397
- "idea",
9398
- "paused",
9399
- "suggested",
9400
- "dismissed"
9401
- ]
9402
- },
9403
- track: {
9404
- type: "string",
9405
- description: "Filter by track name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
9406
- },
9407
- executionBand: {
9408
- type: "number",
9409
- description: "Filter by execution band number (e.g., 1, 2, 3). Returns only worktrees in that parallel execution group."
9410
- },
9411
- limit: {
9412
- type: "number",
9413
- description: "Maximum results to return (default: 500, max: 1000)"
9414
- }
9415
- },
9416
- required: [],
9417
- response: {
9418
- description: "All worktrees across all topics with full pipeline metadata",
9419
- fields: {
9420
- worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, track, trackPosition, executionBand, executionOrder, dependsOn, blocks, gate, createdAt }",
9421
- total: "number \u2014 total count after filtering",
9422
- tracks: "object \u2014 { trackName: count } summary of worktrees per track",
9423
- bands: "object \u2014 { bandNumber: count } summary of worktrees per execution band"
9424
- }
9425
- },
9426
- ownerModule: "workflow-engine",
9427
- ontologyPrimitive: "worktree",
9428
- tier: "showcase"
9429
- };
9430
- var ACTIVATE_WORKTREE = {
9431
- name: "activate_worktree",
9432
- description: "Activate a worktree to begin investigation. Like `git checkout <branch>` \u2014 transitions a worktree from planning to active status. Sets the initial phase and enables belief/question editing within the worktree scope.",
9433
- parameters: {
9434
- worktreeId: { type: "string", description: "The worktree to activate" }
9435
- },
9436
- required: ["worktreeId"],
9437
- response: {
9438
- description: "Activation result with initial phase",
9439
- fields: {
9440
- worktreeId: "string",
9441
- status: "string \u2014 'active'",
9442
- phase: "string"
9443
- }
9444
- },
9445
- ownerModule: "workflow-engine",
9446
- ontologyPrimitive: "worktree",
9447
- tier: "workhorse"
9448
- };
9449
- var UPDATE_WORKTREE_TARGETS = {
9450
- name: "update_worktree_targets",
9451
- description: "Update the target beliefs and questions tracked by a worktree. Like `git add/rm <files>` \u2014 stages or unstages beliefs/questions for investigation within the worktree scope. Supports adding and removing targets atomically.",
9452
- parameters: {
9453
- worktreeId: { type: "string", description: "The worktree to update" },
9454
- addBeliefIds: {
9455
- type: "array",
9456
- description: "Belief node IDs to add to the worktree"
9457
- },
9458
- addQuestionIds: {
9459
- type: "array",
9460
- description: "Question node IDs to add to the worktree"
9461
- },
9462
- removeBeliefIds: {
9463
- type: "array",
9464
- description: "Belief node IDs to remove from the worktree"
9465
- },
9466
- removeQuestionIds: {
9467
- type: "array",
9468
- description: "Question node IDs to remove from the worktree"
9469
- }
9470
- },
9471
- required: ["worktreeId"],
9472
- response: {
9473
- description: "Updated target counts",
9474
- fields: {
9475
- worktreeId: "string",
9476
- beliefCount: "number",
9477
- questionCount: "number"
9478
- }
9479
- },
9480
- ownerModule: "workflow-engine",
9481
- ontologyPrimitive: "worktree",
9482
- tier: "workhorse"
9483
- };
9484
- var UPDATE_WORKTREE_METADATA = {
9485
- name: "update_worktree_metadata",
9486
- description: "Update worktree sequencing metadata \u2014 execution order, dependencies, blocking relations, and gates. Like `git config` for a worktree \u2014 sets the scheduling and dependency metadata that determines when this worktree can activate relative to others. Use to backfill or correct sequencing data.",
9487
- parameters: {
9488
- worktreeId: { type: "string", description: "The worktree to update" },
9489
- hypothesis: {
9490
- type: "string",
9491
- description: "Testable claim this worktree investigates"
9492
- },
9493
- executionOrder: {
9494
- type: "number",
9495
- description: "Global execution order (1 = first, higher = later)"
9496
- },
9497
- dependsOn: {
9498
- type: "array",
9499
- description: "Worktree IDs that must complete before this one can activate"
9500
- },
9501
- blocks: {
9502
- type: "array",
9503
- description: "Worktree IDs that are blocked until this one completes"
9504
- },
9505
- gate: {
9506
- type: "string",
9507
- description: "Exit gate name (e.g., 'gate:ontology-schema-hardened')"
9508
- },
9509
- rationale: {
9510
- type: "string",
9511
- description: "Why this worktree is sequenced here"
9512
- },
9513
- objective: {
9514
- type: "string",
9515
- description: "What we're trying to learn/prove"
9516
- },
9517
- proofArtifacts: {
9518
- type: "array",
9519
- description: "Typed proof artifacts that define what evidence or deliverables this worktree must emit before it can claim success."
9520
- },
9521
- staffingHint: {
9522
- type: "string",
9523
- description: "Advisory staffing shape for the worktree (for example `backend+tests` or `fullstack`)."
9524
- },
9525
- lastReconciledAt: {
9526
- type: "number",
9527
- description: "Timestamp of the last deterministic workflow reconciliation pass against this worktree."
9528
- },
9529
- autoFixPolicy: {
9530
- type: "object",
9531
- description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
9532
- },
9533
- track: {
9534
- type: "string",
9535
- description: "Parallel workstream name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity', 'execution-program'). Groups worktrees into named lanes for pipeline visualization and PM analysis."
9536
- },
9537
- trackPosition: {
9538
- type: "number",
9539
- description: "Position within the track (1-indexed). E.g., TC-A=1, TC-B=2, TC-C=3 within the 'tc-scope' track."
9540
- },
9541
- executionBand: {
9542
- type: "number",
9543
- description: "Parallel execution band number. All worktrees in the same band can run simultaneously. Band 2 = OE-B + TC-A, Band 3 = TC-B + 11D-R + S2-13A, etc."
9544
- },
9545
- status: {
9546
- type: "string",
9547
- description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
9548
- enum: [
9549
- "suggested",
9550
- "planning",
9551
- "active",
9552
- "paused",
9553
- "completed",
9554
- "dismissed",
9555
- "abandoned",
9556
- "superseded",
9557
- "long_term",
9558
- "idea"
9559
- ]
9560
- },
9561
- topicId: {
9562
- type: "string",
9563
- description: "Reassign this worktree's primary topic. Validates the target topic exists before updating."
9564
- },
9565
- additionalTopicIds: {
9566
- type: "array",
9567
- description: "Set additional topic associations for cross-topic worktrees. Each topic ID is validated before updating. Use when a worktree spans multiple knowledge domains."
9568
- }
9569
- },
9570
- required: ["worktreeId"],
9571
- response: {
9572
- description: "Update confirmation",
9573
- fields: { worktreeId: "string", success: "boolean" }
9574
- },
9575
- ownerModule: "workflow-engine",
9576
- ontologyPrimitive: "worktree",
9577
- tier: "workhorse"
9578
- };
9579
- var IDENTITY_WHOAMI = {
9580
- name: "identity_whoami",
9581
- description: "Read the authenticated identity summary for the current session. Like `git config --get user.name` \u2014 shows who the current MCP session is acting as.",
9582
- parameters: {},
9583
- required: [],
9584
- response: {
9585
- description: "Canonical identity summary for the current session",
9586
- fields: {
9587
- principalId: "string \u2014 canonical federated principal identifier",
9588
- principalType: "string \u2014 human, service, or agent",
9589
- tenantId: "string | undefined \u2014 resolved tenant scope",
9590
- workspaceId: "string | undefined \u2014 resolved workspace scope",
9591
- scopes: "string[] | undefined \u2014 granted scopes for this session",
9592
- roles: "string[] | undefined \u2014 canonical roles for this session"
9593
- }
9594
- },
9595
- ownerModule: "identity-core",
9596
- ontologyPrimitive: "identity",
9597
- tier: "workhorse"
9598
- };
9599
- var COMPILE_CONTEXT = {
9600
- name: "compile_context",
9601
- description: "Compile a focused reasoning context for a topic. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
9602
- parameters: {
9603
- topicId: {
9604
- type: "string",
9605
- description: "Topic scope ID to compile"
9606
- },
9607
- query: {
9608
- type: "string",
9609
- description: "Optional focus query used to rank context items"
9610
- },
9611
- budget: {
9612
- type: "number",
9613
- description: "Token budget for prompt injection planning"
9614
- },
9615
- ranking: {
9616
- type: "string",
9617
- description: "Ranking profile for context ordering",
9618
- enum: ["baseline_v1", "weighted_v1"]
9619
- },
9620
- limit: {
9621
- type: "number",
9622
- description: "Optional per-section item limit"
9623
- },
9624
- maxDepth: {
9625
- type: "number",
9626
- description: "Optional descendant topic depth for neighborhood expansion"
9627
- },
9628
- includeEntities: {
9629
- type: "boolean",
9630
- description: "Include related ontological entities in the compiled result"
9631
- }
9632
- },
9633
- required: ["topicId"],
9634
- response: {
9635
- description: "Compiled context pack for the requested topic",
9636
- fields: {
9637
- schemaVersion: "string",
9638
- topicId: "string",
9639
- topicName: "string",
9640
- scopedTopicIds: "array \u2014 topic IDs included in the compilation neighborhood",
9641
- generatedAt: "number \u2014 deterministic graph-backed reference timestamp for this compilation",
9642
- ranking: "string \u2014 baseline_v1 | weighted_v1",
9643
- summary: "object \u2014 counts and scoped health signals",
9644
- invariants: "array \u2014 high-confidence invariant beliefs",
9645
- activeBeliefs: "array \u2014 current high-signal beliefs",
9646
- openQuestions: "array \u2014 unresolved questions ranked for this query",
9647
- recentEvidence: "array \u2014 recent evidence ranked for this query",
9648
- contradictions: "array \u2014 unresolved contradiction records",
9649
- relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
9650
- contextNarrative: "array \u2014 guidance for prompt assembly",
9651
- injectionPolicy: "object \u2014 token-budgeted section selections",
9652
- diagnostics: "object \u2014 scoring and utilization telemetry"
9653
- }
9654
- },
9655
- ownerModule: "reasoning-kernel",
9656
- ontologyPrimitive: "graph",
9657
- tier: "showcase"
9658
- };
9659
- var CHECK_PERMISSION = {
9660
- name: "check_permission",
9661
- description: "Check whether a principal can read or mutate a topic scope. Like `git check-ref-format` for ACLs \u2014 validates whether the requested operation is allowed before execution.",
9662
- parameters: {
9663
- topicId: { type: "string", description: "Topic scope to evaluate" },
9664
- permission: {
9665
- type: "string",
9666
- description: "Permission to evaluate",
9667
- enum: ["read", "write"]
9668
- },
9669
- principal: {
9670
- type: "string",
9671
- description: "Optional principal override (defaults to current principal)"
9672
- },
9673
- beliefClusterId: {
9674
- type: "string",
9675
- description: "Optional neighborhood scope within a topic"
9676
- }
9677
- },
9678
- required: ["topicId", "permission"],
9679
- response: {
9680
- description: "Permission evaluation result",
9681
- fields: {
9682
- allowed: "boolean",
9683
- decision: "string \u2014 allow | deny",
9684
- reasonCode: "string",
9685
- principalId: "string",
9686
- topicId: "string",
9687
- permission: "string \u2014 read | write"
9688
- }
9689
- },
9690
- ownerModule: "access-control",
9691
- ontologyPrimitive: "policy",
9692
- tier: "workhorse"
9693
- };
9694
- var FILTER_BY_PERMISSION = {
9695
- name: "filter_by_permission",
9696
- description: "Filter a topic set down to ACL-authorized topics. Like `git rev-list --ancestry-path` for policy boundaries \u2014 keeps only topics permitted for the requested action.",
9697
- parameters: {
9698
- topicIds: { type: "array", description: "Topic IDs to evaluate" },
9699
- permission: {
9700
- type: "string",
9701
- description: "Permission filter",
9702
- enum: ["read", "write"]
9703
- },
9704
- principal: {
9705
- type: "string",
9706
- description: "Optional principal override (tenant admin only)"
9707
- }
9708
- },
9709
- required: ["topicIds", "permission"],
9710
- response: {
9711
- description: "Allowed/denied split for the requested topic set",
9712
- fields: {
9713
- permission: "string \u2014 read | write",
9714
- allowedTopicIds: "array \u2014 topic IDs allowed by policy",
9715
- deniedTopics: "array \u2014 { topicId, reasonCode }",
9716
- count: "number"
9717
- }
9718
- },
9719
- ownerModule: "access-control",
9720
- ontologyPrimitive: "policy",
9721
- tier: "workhorse"
9722
- };
9723
- var INGEST_OBSERVATION = {
9724
- name: "ingest_observation",
9725
- description: "Record an observational delta for a topic context stream. Like `git notes add` \u2014 attaches structured observation metadata without mutating graph state directly. Used by watcher/cowork agents to stage candidate updates before explicit write confirmation.",
9726
- parameters: {
9727
- topicId: {
9728
- type: "string",
9729
- description: "Topic scope for the observation"
9730
- },
9731
- observationType: {
9732
- type: "string",
9733
- description: "Observation class",
9734
- enum: [
9735
- "claim",
9736
- "evidence",
9737
- "question",
9738
- "contradiction",
9739
- "judgment",
9740
- "note"
9741
- ]
9742
- },
9743
- summary: {
9744
- type: "string",
9745
- description: "Human-readable observation summary"
9746
- },
9747
- source: {
9748
- type: "string",
9749
- description: "Optional source (message ID, tool name, URL, etc.)"
9750
- },
9751
- confidence: { type: "number", description: "Optional confidence in [0,1]" },
9752
- tags: { type: "array", description: "Optional observation tags" },
9753
- metadata: {
9754
- type: "object",
9755
- description: "Optional structured metadata payload"
9756
- }
9757
- },
9758
- required: ["topicId", "observationType", "summary"],
9759
- response: {
9760
- description: "Recorded observation entry",
9761
- fields: {
9762
- observationId: "string",
9763
- topicId: "string",
9764
- observationType: "string",
9765
- createdAt: "number",
9766
- contextResourceUri: "string"
9767
- }
9768
- },
9769
- ownerModule: "agent-harness",
9770
- ontologyPrimitive: "graph",
9771
- tier: "workhorse"
9772
- };
9773
- var GET_OBSERVATION_CONTEXT = {
9774
- name: "get_observation_context",
9775
- description: "Retrieve observer-ready context for a topic, including recent deltas and semantic matches. Like `git log --grep` \u2014 shows recent context and filtered matches across observation history. This powers prompt context injection without mutating graph state.",
9776
- parameters: {
9777
- topicId: { type: "string", description: "Topic scope" },
9778
- query: {
9779
- type: "string",
9780
- description: "Optional semantic query over observation history"
9781
- },
9782
- limit: {
9783
- type: "number",
9784
- description: "Maximum entries in each returned collection"
9785
- }
9786
- },
9787
- required: ["topicId"],
9788
- response: {
9789
- description: "Observation context payload",
9790
- fields: {
9791
- topicId: "string",
9792
- totalObservations: "number",
9793
- latest: "array",
9794
- semanticMatches: "array",
9795
- byType: "object",
9796
- generatedAt: "number"
9797
- }
9798
- },
9799
- ownerModule: "agent-harness",
9800
- ontologyPrimitive: "graph",
9801
- tier: "workhorse"
9802
- };
9803
- var CREATE_TASK = {
9804
- name: "create_task",
9805
- description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
9806
- parameters: {
9807
- title: { type: "string", description: "Task description" },
9808
- topicId: { type: "string", description: "Topic scope" },
9809
- taskType: {
9810
- type: "string",
9811
- description: "Type: research, interview, analysis, data_collection",
9812
- enum: ["research", "interview", "analysis", "data_collection"]
9813
- },
9814
- linkedQuestionId: {
9815
- type: "string",
9816
- description: "Question this task addresses"
9817
- },
9818
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
9819
- },
9820
- required: ["title", "topicId"],
9821
- response: {
9822
- description: "The created task",
9823
- fields: {
9824
- taskId: "string",
9825
- status: "string \u2014 'pending'",
9826
- createdAt: "number"
9827
- }
9828
- },
9829
- ownerModule: "workflow-engine",
9830
- ontologyPrimitive: "task",
9831
- tier: "workhorse"
9832
- };
9833
- var COMPLETE_TASK = {
9834
- name: "complete_task",
9835
- description: "Mark a task as complete with an output summary. Like `git tag` for work items \u2014 records the discrete completion event and captures what was learned. Completed tasks feed back into the evidence graph.",
9836
- parameters: {
9837
- taskId: { type: "string", description: "The task to complete" },
9838
- outputSummary: {
9839
- type: "string",
9840
- description: "What was accomplished or learned"
9841
- },
9842
- evidenceCreated: {
9843
- type: "boolean",
9844
- description: "Whether new evidence was created from this task"
9845
- }
9846
- },
9847
- required: ["taskId", "outputSummary"],
9848
- response: {
9849
- description: "The completed task",
9850
- fields: {
9851
- taskId: "string",
9852
- completedAt: "number",
9853
- outputSummary: "string"
9854
- }
9855
- },
9856
- ownerModule: "workflow-engine",
9857
- ontologyPrimitive: "task",
9858
- tier: "workhorse"
9859
- };
9860
- var UPDATE_TASK = {
9861
- name: "update_task",
9862
- description: "Update a task's fields \u2014 relink to a different worktree, belief, or question, change title/priority/status. Like `git task edit` \u2014 mutates an existing task in place instead of requiring recreate-plus-supersede.",
9863
- parameters: {
9864
- taskId: { type: "string", description: "The task to update" },
9865
- linkedWorktreeId: {
9866
- type: "string",
9867
- description: "Reassign this task to a different worktree"
9868
- },
9869
- linkedBeliefId: {
9870
- type: "string",
9871
- description: "Link or relink this task to a belief node"
9872
- },
9873
- linkedQuestionId: {
9874
- type: "string",
9875
- description: "Link or relink this task to a question node"
9876
- },
9877
- title: { type: "string", description: "Updated task title" },
9878
- description: {
9879
- type: "string",
9880
- description: "Updated task description"
9881
- },
9882
- priority: {
9883
- type: "string",
9884
- description: "Updated priority",
9885
- enum: ["critical", "high", "medium", "low"]
9886
- },
9887
- status: {
9888
- type: "string",
9889
- description: "Updated status",
9890
- enum: ["todo", "in_progress", "blocked", "done"]
9891
- }
9892
- },
9893
- required: ["taskId"],
9894
- response: {
9895
- description: "The updated task",
9896
- fields: {
9897
- taskId: "string",
9898
- updatedAt: "number"
9899
- }
9900
- },
9901
- ownerModule: "workflow-engine",
9902
- ontologyPrimitive: "task",
9903
- tier: "workhorse"
9904
- };
9905
- var LIST_TASKS = {
9906
- name: "list_tasks",
9907
- description: "List tasks for a topic or worktree. Like `git task list` \u2014 returns tasks with status, priority, and linked nodes. Filter by worktree to see tasks for a specific investigation, or by status to find incomplete work.",
9908
- parameters: {
9909
- topicId: { type: "string", description: "Topic scope" },
9910
- linkedWorktreeId: {
9911
- type: "string",
9912
- description: "Filter to tasks linked to this worktree"
9913
- },
9914
- status: {
9915
- type: "string",
9916
- description: "Filter by status: todo, in_progress, blocked, done",
9917
- enum: ["todo", "in_progress", "blocked", "done"]
9918
- },
9919
- limit: { type: "number", description: "Maximum results (default: 100)" }
9920
- },
9921
- required: ["topicId"],
9922
- response: {
9923
- description: "List of tasks with metadata",
9924
- fields: { tasks: "array of task objects", count: "number" }
9925
- },
9926
- ownerModule: "workflow-engine",
9927
- ontologyPrimitive: "task",
9928
- tier: "workhorse"
9929
- };
9930
- var CREATE_TOPIC = {
9931
- name: "create_topic",
9932
- description: "Create a new topic container for scoping knowledge. Like `git init` \u2014 initializes a new repository for a knowledge domain. Topics are hierarchical: a deal topic can nest under a theme topic. Types: domain, theme, deal, strategy, constitution, project, portfolio.",
9933
- parameters: {
9934
- name: { type: "string", description: "Topic name" },
9935
- type: {
9936
- type: "string",
9937
- description: "Topic type. Validated against schemaEnumConfig category 'topic_type'."
9938
- },
9939
- description: { type: "string", description: "What this topic covers" },
9940
- parentTopicId: {
9941
- type: "string",
9942
- description: "Optional parent topic for nesting"
9943
- },
9944
- createdBy: { type: "string", description: "Who created this topic" }
9945
- },
9946
- required: ["name", "type"],
9947
- response: {
9948
- description: "The created topic",
9949
- fields: {
9950
- id: "string \u2014 topic ID",
9951
- globalId: "string \u2014 globally unique ID",
9952
- depth: "number \u2014 nesting depth"
9953
- }
9954
- },
9955
- ownerModule: "schema-management",
9956
- ontologyPrimitive: "graph",
9957
- tier: "showcase"
9958
- };
9959
- var LIST_TOPICS = {
9960
- name: "list_topics",
9961
- description: "List topics, optionally filtered by type or parent. Like `git remote -v` \u2014 shows all knowledge containers with their types and hierarchy.",
9962
- parameters: {
9963
- type: {
9964
- type: "string",
9965
- description: "Filter by topic type (e.g., 'theme', 'deal')"
9966
- },
9967
- parentTopicId: {
9968
- type: "string",
9969
- description: "Filter to children of this parent"
9970
- },
9971
- status: {
9972
- type: "string",
9973
- description: "Filter by status",
9974
- enum: ["active", "archived", "watching"]
9975
- }
9976
- },
9977
- required: [],
9978
- response: {
9979
- description: "List of topics with metadata",
9980
- fields: {
9981
- topics: "array \u2014 { id, name, type, depth, status, parentTopicId }"
9982
- }
9983
- },
9984
- ownerModule: "schema-management",
9985
- ontologyPrimitive: "graph",
9986
- tier: "workhorse"
9987
- };
9988
- var GET_TOPIC = {
9989
- name: "get_topic",
9990
- description: "Get one topic by ID. Like `git remote show origin` \u2014 inspects a single knowledge container in detail.",
9991
- parameters: {
9992
- topicId: {
9993
- type: "string",
9994
- description: "Canonical topic ID to retrieve"
9995
- },
9996
- id: {
9997
- type: "string",
9998
- description: "Legacy alias for topicId"
9999
- }
10000
- },
10001
- required: [],
10002
- response: {
10003
- description: "Single topic record",
10004
- fields: {
10005
- topic: "object \u2014 { id, globalId, name, type, depth, status, parentTopicId, description }"
10006
- }
10007
- },
10008
- ownerModule: "schema-management",
10009
- ontologyPrimitive: "graph",
10010
- tier: "workhorse"
10011
- };
10012
- var UPDATE_TOPIC = {
10013
- name: "update_topic",
10014
- description: "Update an existing topic's metadata. Like `git remote set-url` \u2014 changes the canonical configuration for a knowledge container without recreating it.",
10015
- parameters: {
10016
- topicId: {
10017
- type: "string",
10018
- description: "Canonical topic ID to update"
10019
- },
10020
- id: {
10021
- type: "string",
10022
- description: "Legacy alias for topicId"
10023
- },
10024
- name: { type: "string", description: "Updated topic name" },
10025
- description: { type: "string", description: "Updated topic description" },
10026
- type: {
10027
- type: "string",
10028
- description: "Updated topic type. Validated against schemaEnumConfig category 'topic_type'."
10029
- },
10030
- ontologyId: {
10031
- type: "string",
10032
- description: "Updated ontology binding"
10033
- },
10034
- clearOntologyId: {
10035
- type: "boolean",
10036
- description: "Clear the current ontology binding"
10037
- },
10038
- status: {
10039
- type: "string",
10040
- description: "Updated topic status",
10041
- enum: ["active", "archived", "watching"]
10042
- },
10043
- visibility: {
10044
- type: "string",
10045
- description: "Updated topic visibility",
10046
- enum: ["private", "team", "firm", "external", "public"]
10047
- }
10048
- },
10049
- required: [],
10050
- response: {
10051
- description: "The updated topic",
10052
- fields: {
10053
- id: "string \u2014 topic ID",
10054
- globalId: "string \u2014 globally unique ID",
10055
- status: "string \u2014 topic lifecycle status",
10056
- visibility: "string \u2014 topic visibility"
10057
- }
10058
- },
10059
- ownerModule: "schema-management",
10060
- ontologyPrimitive: "graph",
10061
- tier: "workhorse"
10062
- };
10063
- var GET_TOPIC_TREE = {
10064
- name: "get_topic_tree",
10065
- description: "Get the full topic hierarchy from a root. Like `git log --graph --all` \u2014 shows the complete tree of nested topics.",
10066
- parameters: {
10067
- rootId: { type: "string", description: "Root topic to start from" },
10068
- maxDepth: {
10069
- type: "number",
10070
- description: "Maximum depth to traverse (default: 5)"
10071
- }
10072
- },
10073
- required: ["rootId"],
10074
- response: {
10075
- description: "Tree of topics with nesting",
10076
- fields: { tree: "array \u2014 topics in BFS order with depth and path" }
10077
- },
10078
- ownerModule: "schema-management",
10079
- ontologyPrimitive: "graph",
10080
- tier: "workhorse"
10081
- };
10082
- var GET_CODE_CONTEXT = {
10083
- name: "get_code_context",
10084
- description: "Returns code-grounded beliefs, contracts, migration states, and failed attempts anchored to a specific file or function path. Like `git log -- <path>` \u2014 filters the knowledge graph to nodes anchored to a file path via metadata.codeAnchors. Results are separated by coding belief type: decisions, contracts, migrations, patterns, deprecations, and failures.",
10085
- parameters: {
10086
- filePath: {
10087
- type: "string",
10088
- description: "File path to search for (partial matches supported, e.g. 'epistemicBeliefs.ts' or 'convex/epistemicBeliefs.ts')"
10089
- },
10090
- topicId: {
10091
- type: "string",
10092
- description: "Topic scope (optional, uses default if not provided)"
10093
- },
10094
- includeFailures: {
10095
- type: "boolean",
10096
- description: "Whether to include failed attempt evidence (default: true)"
10097
- }
10098
- },
10099
- required: ["filePath"],
10100
- response: {
10101
- description: "Code-anchored beliefs and evidence grouped by type",
10102
- fields: {
10103
- filePath: "string \u2014 queried path",
10104
- decisions: "array \u2014 implementation_decision beliefs",
10105
- contracts: "array \u2014 interface_contract beliefs",
10106
- migrations: "array \u2014 migration_state beliefs",
10107
- patterns: "array \u2014 code_pattern beliefs",
10108
- deprecations: "array \u2014 deprecation_notice beliefs",
10109
- failures: "array \u2014 failed attempt evidence",
10110
- totalMatched: "number"
10111
- }
10112
- },
10113
- ownerModule: "coding-intelligence",
10114
- ontologyPrimitive: "belief",
10115
- tier: "showcase"
10116
- };
10117
- var GET_CHANGE_HISTORY = {
10118
- name: "get_change_history",
10119
- description: "Returns recent changes and decisions for a file path \u2014 the 'why' behind recent code changes. Like `git log --follow <path>` \u2014 shows the evolution of understanding anchored to a specific file. Searches beliefs and evidence updated recently, sorted by most recent first.",
10120
- parameters: {
10121
- filePath: { type: "string", description: "File path to get history for" },
10122
- topicId: { type: "string", description: "Topic scope (optional)" },
10123
- limit: { type: "number", description: "Max results (default: 10)" }
10124
- },
10125
- required: ["filePath"],
10126
- response: {
10127
- description: "Recent code-anchored changes sorted by recency",
10128
- fields: {
10129
- filePath: "string \u2014 queried path",
10130
- changes: "array \u2014 nodes with coding view (nodeId, beliefType, canonicalText, codeAnchors, timestamps)",
10131
- totalFound: "number",
10132
- showing: "number"
10133
- }
10134
- },
10135
- ownerModule: "coding-intelligence",
10136
- ontologyPrimitive: "belief",
10137
- tier: "workhorse"
10138
- };
10139
- var RECORD_ATTEMPT = {
10140
- name: "record_attempt",
10141
- description: "Log a failed approach as evidence linked to a belief. Like `git stash` for failed experiments \u2014 preserves what was tried so the same mistake isn't repeated. Creates evidence with metadata.failedApproach=true and metadata.codeAnchors. The key anti-repetition mechanism: future agents check the failure log before trying new approaches.",
10142
- parameters: {
10143
- description: {
10144
- type: "string",
10145
- description: "What was attempted and why it failed"
10146
- },
10147
- filePaths: {
10148
- type: "array",
10149
- description: "File paths involved in the attempt"
10150
- },
10151
- errorMessage: {
10152
- type: "string",
10153
- description: "Error message or failure reason"
10154
- },
10155
- linkedBeliefId: {
10156
- type: "string",
10157
- description: "Belief this attempt was targeting (creates -0.5 weight edge)"
10158
- },
10159
- topicId: { type: "string", description: "Topic scope (optional)" }
10160
- },
10161
- required: ["description"],
10162
- response: {
10163
- description: "The recorded failed attempt evidence node",
10164
- fields: {
10165
- nodeId: "string \u2014 evidence node ID",
10166
- edgeId: "string | null \u2014 edge to linked belief",
10167
- recorded: "boolean \u2014 true",
10168
- filePaths: "array \u2014 anchored file paths"
10169
- }
10170
- },
10171
- ownerModule: "coding-intelligence",
10172
- ontologyPrimitive: "evidence",
10173
- tier: "showcase"
10174
- };
10175
- var GET_FAILURE_LOG = {
10176
- name: "get_failure_log",
10177
- description: "Search past failed attempts matching a task description. Like `git log --grep='FAILED'` \u2014 finds evidence of what was tried before and didn't work. Before trying a new approach, check this log to avoid repeating the same mistake. Filters to evidence with metadata.failedApproach=true, sorted by recency.",
10178
- parameters: {
10179
- query: {
10180
- type: "string",
10181
- description: "Description of the task or approach to search for"
10182
- },
10183
- filePath: {
10184
- type: "string",
10185
- description: "Optional file path to narrow results"
10186
- },
10187
- topicId: { type: "string", description: "Topic scope (optional)" },
10188
- limit: { type: "number", description: "Max results (default: 5)" }
10189
- },
10190
- required: ["query"],
10191
- response: {
10192
- description: "Failed attempts matching the query",
10193
- fields: {
10194
- query: "string \u2014 search query",
10195
- failures: "array \u2014 failed attempt evidence with coding view",
10196
- totalFound: "number",
10197
- showing: "number"
10198
- }
10199
- },
10200
- ownerModule: "coding-intelligence",
10201
- ontologyPrimitive: "evidence",
10202
- tier: "showcase"
10203
- };
10204
- var GET_TOPIC_COVERAGE = {
10205
- name: "get_topic_coverage",
10206
- description: "Returns per-topic belief/question/evidence counts across the topic tree. Like `git diff --stat` for the knowledge graph \u2014 shows coverage density and empty spots across the topic hierarchy. Use to identify which topics need more beliefs, which lack questions, and overall graph health.",
10207
- parameters: {
10208
- topicId: {
10209
- type: "string",
10210
- description: "Topic scope ID (optional, uses default if not provided)"
10211
- },
10212
- includeDescendants: {
10213
- type: "boolean",
10214
- description: "Whether to include descendant topics in the coverage report (default: true)"
10215
- },
10216
- maxDepth: {
10217
- type: "number",
10218
- description: "Maximum descendant topic depth for neighborhood expansion. Defaults to 4 for root/theme scopes, 2 for deeper scopes."
10219
- }
10220
- },
10221
- required: [],
10222
- response: {
10223
- description: "Per-topic coverage metrics and aggregate summary",
10224
- fields: {
10225
- topics: "array \u2014 per-topic { topicId, name, type, depth, beliefs, questions, evidence, coverage }",
10226
- summary: "object \u2014 { totalTopics, coveredTopics, emptyTopics, coveragePercent, totalBeliefs, totalQuestions, totalEvidence }",
10227
- scopeTopicId: "string \u2014 the root topic used for scoping"
10228
- }
10229
- },
10230
- ownerModule: "coverage-intelligence",
10231
- ontologyPrimitive: "graph",
10232
- tier: "showcase"
10233
- };
10234
- var GET_GRAPH_GAPS = {
10235
- name: "get_graph_gaps",
10236
- description: "Identify structural gaps in the knowledge graph \u2014 empty topics, beliefs without questions, beliefs without evidence, and orphan edges. Like `git fsck` for reasoning coverage \u2014 surfaces holes that weaken the epistemic foundation. Returns prioritized gap list.",
10237
- parameters: {
10238
- topicId: {
10239
- type: "string",
10240
- description: "Topic scope ID (optional, uses default if not provided)"
10241
- },
10242
- maxDepth: {
10243
- type: "number",
10244
- description: "Maximum descendant topic depth for neighborhood expansion (default: 4)"
10245
- }
10246
- },
10247
- required: ["topicId"],
10248
- response: {
10249
- description: "Prioritized list of graph gaps by category",
10250
- fields: {
10251
- emptyTopics: "array \u2014 topics with zero beliefs { topicId, name, type, depth }",
10252
- beliefsWithoutQuestions: "array \u2014 beliefs that have no testing questions { nodeId, canonicalText, topicId }",
10253
- beliefsWithoutEvidence: "array \u2014 beliefs that have no supporting evidence { nodeId, canonicalText, topicId }",
10254
- summary: "object \u2014 { totalGaps, emptyTopicCount, untestedBeliefCount, unsupportedBeliefCount }",
10255
- scopeTopicId: "string \u2014 the root topic used for scoping"
10256
- }
10257
- },
10258
- ownerModule: "coverage-intelligence",
10259
- ontologyPrimitive: "graph",
10260
- tier: "showcase"
10261
- };
10262
- var MANAGE_WRITE_POLICY = {
10263
- name: "manage_write_policy",
10264
- description: "Manage write policies for MCP mutation tools. Like `git config` for write permissions \u2014 sets per-topic or global policies that control which roles can mutate the graph.",
10265
- parameters: {
10266
- action: {
10267
- type: "string",
10268
- description: "Action to perform: 'get' (read policies) or 'set' (upsert a policy)",
10269
- enum: ["get", "set"]
10270
- },
10271
- topicId: {
10272
- type: "string",
10273
- description: "Topic scope for the policy. Omit for global policies."
10274
- },
10275
- role: {
10276
- type: "string",
10277
- description: "Role to set policy for (required for 'set'). E.g. 'agent:internal', 'user:analyst'."
10278
- },
10279
- permission: {
10280
- type: "string",
10281
- description: "Permission level (required for 'set').",
10282
- enum: ["allow", "deny", "read_only"]
10283
- },
10284
- maxWritesPerSession: {
10285
- type: "number",
10286
- description: "Optional per-session write limit for this role+scope."
10287
- },
10288
- rationale: {
10289
- type: "string",
10290
- description: "Why this policy is being set (audit trail)."
10291
- }
10292
- },
10293
- required: ["action"],
10294
- response: {
10295
- description: "Policy operation result",
10296
- fields: {
10297
- action: "string \u2014 get | set",
10298
- topicId: "string|null \u2014 topic scope or null for global",
10299
- policies: "array \u2014 (for get) list of matching policies",
10300
- role: "string \u2014 (for set) role that was updated",
10301
- permission: "string \u2014 (for set) new permission level",
10302
- maxWritesPerSession: "number|null \u2014 (for set) session write cap"
10303
- }
10304
- },
10305
- ownerModule: "access-control",
10306
- ontologyPrimitive: "policy",
10307
- tier: "workhorse"
10308
- };
10309
- var LIST_ONTOLOGIES = {
10310
- name: "list_ontologies",
10311
- description: "List ontology definitions with optional filters. Like `git remote -v` for ontologies \u2014 shows all registered ontology definitions with their tier, status, and tenant scope.",
10312
- parameters: {
10313
- tenantId: {
10314
- type: "string",
10315
- description: "Filter by tenant ID. Omit for platform-level ontologies."
10316
- },
10317
- tier: {
10318
- type: "string",
10319
- description: "Filter by tier",
10320
- enum: ["platform", "pack", "tenant"]
10321
- },
10322
- status: {
10323
- type: "string",
10324
- description: "Filter by status",
10325
- enum: ["draft", "active", "deprecated", "archived"]
10326
- }
10327
- },
10328
- required: [],
10329
- response: {
10330
- description: "Array of ontology definitions",
10331
- fields: {
10332
- ontologies: "array \u2014 ontology definitions with id, ontologyKey, name, tier, status"
10333
- }
10334
- },
10335
- ownerModule: "graph-primitives",
10336
- ontologyPrimitive: "ontology",
10337
- tier: "showcase"
10338
- };
10339
- var GET_ONTOLOGY = {
10340
- name: "get_ontology",
10341
- description: "Get a single ontology definition by ID or ontologyKey. Like `git show` for an ontology \u2014 returns the definition metadata plus the latest published version with entity types and edge types.",
10342
- parameters: {
10343
- id: {
10344
- type: "string",
10345
- description: "Ontology definition ID (Convex document ID)"
10346
- },
10347
- ontologyKey: {
10348
- type: "string",
10349
- description: "Ontology key (e.g., 'investment-ontology'). Alternative to id."
10350
- },
10351
- tenantId: {
10352
- type: "string",
10353
- description: "Tenant scope for key lookup. Omit for platform-level."
10354
- }
10355
- },
10356
- required: [],
10357
- response: {
10358
- description: "Ontology definition with latest published version",
10359
- fields: {
10360
- id: "string \u2014 definition ID",
10361
- ontologyKey: "string \u2014 unique key",
10362
- name: "string \u2014 display name",
10363
- publishedVersion: "object|null \u2014 latest published version with entityTypes and edgeTypes"
10364
- }
10365
- },
10366
- ownerModule: "graph-primitives",
10367
- ontologyPrimitive: "ontology",
10368
- tier: "showcase"
10369
- };
10370
- var APPLY_ONTOLOGY = {
10371
- name: "apply_ontology",
10372
- description: "Bind an ontology definition directly to a topic. Like `git checkout` for a domain vocabulary \u2014 applies an ontology to a topic so the topic and its descendants inherit the configured entity and edge schema.",
10373
- parameters: {
10374
- ontologyId: {
10375
- type: "string",
10376
- description: "Canonical ontology identifier to bind"
10377
- },
10378
- topicId: {
10379
- type: "string",
10380
- description: "Canonical topic identifier to receive the binding"
10381
- }
10382
- },
10383
- required: ["ontologyId", "topicId"],
10384
- response: {
10385
- description: "Ontology binding summary",
10386
- fields: {
10387
- applied: "boolean \u2014 true when the binding was written",
10388
- source: "string \u2014 always 'direct' for an explicit bind",
10389
- ontologyId: "string \u2014 canonical ontology ID",
10390
- ontologyKey: "string \u2014 ontology key",
10391
- topicId: "string \u2014 canonical topic ID"
10392
- }
10393
- },
10394
- ownerModule: "schema-management",
10395
- ontologyPrimitive: "ontology",
10396
- tier: "showcase"
10397
- };
10398
- var MATCH_ENTITY_TYPE = {
10399
- name: "match_entity_type",
10400
- description: "Classify free text against the effective ontology vocabulary. Like `git grep` for ontology types \u2014 ranks the most likely entity types for the supplied text using the topic-bound or explicitly selected ontology.",
10401
- parameters: {
10402
- text: {
10403
- type: "string",
10404
- description: "Free text to classify against ontology entity types"
10405
- },
10406
- topicId: {
10407
- type: "string",
10408
- description: "Canonical topic ID used to resolve the effective ontology when ontologyId is omitted"
10409
- },
10410
- ontologyId: {
10411
- type: "string",
10412
- description: "Optional ontology definition ID to match against instead of the topic-bound ontology"
10413
- },
10414
- minScore: {
10415
- type: "number",
10416
- description: "Optional lower similarity bound for returned matches"
10417
- },
10418
- limit: {
10419
- type: "number",
10420
- description: "Optional maximum number of ranked matches to return"
10421
- }
10422
- },
10423
- required: ["text"],
10424
- response: {
10425
- description: "Ranked ontology entity type matches",
10426
- fields: {
10427
- matches: "array \u2014 ranked entity type matches with score, entityType, label, and optional description",
10428
- ontologyId: "string|null \u2014 ontology used for matching",
10429
- topicId: "string|null \u2014 topic scope used for ontology resolution"
10430
- }
10431
- },
10432
- ownerModule: "schema-management",
10433
- ontologyPrimitive: "ontology",
10434
- tier: "showcase"
10435
- };
10436
- var CREATE_ONTOLOGY = {
10437
- name: "create_ontology",
10438
- description: "Create a new ontology definition. Like `git init` for a domain vocabulary \u2014 creates a named, versioned container for entity types and edge types. Starts in 'draft' status.",
10439
- parameters: {
10440
- ontologyKey: {
10441
- type: "string",
10442
- description: "Unique key (lowercase, hyphens, e.g., 'investment-ontology')"
10443
- },
10444
- name: { type: "string", description: "Human-readable name" },
10445
- description: { type: "string", description: "What this ontology covers" },
10446
- tenantId: {
10447
- type: "string",
10448
- description: "Tenant scope. Omit for platform-level."
10449
- },
10450
- tier: {
10451
- type: "string",
10452
- description: "Ontology tier",
10453
- enum: ["platform", "pack", "tenant"]
10454
- },
10455
- parentOntologyId: {
10456
- type: "string",
10457
- description: "Parent ontology ID for layered composition"
10458
- }
10459
- },
10460
- required: ["ontologyKey", "name", "tier"],
10461
- response: {
10462
- description: "Created ontology definition",
10463
- fields: {
10464
- id: "string \u2014 new definition ID",
10465
- ontologyKey: "string \u2014 normalized key"
10466
- }
10467
- },
10468
- ownerModule: "graph-primitives",
10469
- ontologyPrimitive: "ontology",
10470
- tier: "showcase"
10471
- };
10472
- var UPDATE_ONTOLOGY = {
10473
- name: "update_ontology",
10474
- description: "Update an ontology definition's metadata (name, description, status). Like `git config` for an ontology \u2014 updates mutable fields on the definition. Only allowed while the ontology is in draft or active status.",
10475
- parameters: {
10476
- id: { type: "string", description: "Ontology definition ID" },
10477
- name: { type: "string", description: "New display name" },
10478
- description: { type: "string", description: "New description" },
10479
- status: {
10480
- type: "string",
10481
- description: "New status",
10482
- enum: ["draft", "active", "deprecated"]
10483
- }
10484
- },
10485
- required: ["id"],
10486
- response: {
10487
- description: "Update confirmation",
10488
- fields: { success: "boolean" }
10489
- },
10490
- ownerModule: "graph-primitives",
10491
- ontologyPrimitive: "ontology",
10492
- tier: "workhorse"
10493
- };
10494
- var ARCHIVE_ONTOLOGY = {
10495
- name: "archive_ontology",
10496
- description: "Archive an ontology definition. Like `git rm` for an ontology \u2014 soft-deletes the definition. Archived ontologies are preserved in history but no longer active.",
10497
- parameters: {
10498
- id: { type: "string", description: "Ontology definition ID to archive" }
10499
- },
10500
- required: ["id"],
10501
- response: {
10502
- description: "Archive confirmation",
10503
- fields: { success: "boolean" }
10504
- },
10505
- ownerModule: "graph-primitives",
10506
- ontologyPrimitive: "ontology",
10507
- tier: "workhorse"
10508
- };
10509
- var CREATE_ONTOLOGY_VERSION = {
10510
- name: "create_ontology_version",
10511
- description: "Create a new version snapshot for an ontology definition. Like `git commit` for ontology content \u2014 captures entity types and edge types in a versioned snapshot. Starts in 'draft' status. Publish to freeze.",
10512
- parameters: {
10513
- ontologyId: {
10514
- type: "string",
10515
- description: "Parent ontology definition ID"
10516
- },
10517
- version: {
10518
- type: "string",
10519
- description: "Semantic version string (X.Y.Z format)"
10520
- },
10521
- entityTypes: {
10522
- type: "array",
10523
- description: "Array of entity type definitions: [{ value, label, description?, schema?, subtypes? }]"
10524
- },
10525
- edgeTypes: {
10526
- type: "array",
10527
- description: "Array of edge type definitions: [{ value, label, description?, sourceTypes?, targetTypes?, constraintSeverity? }]"
10528
- },
10529
- releaseNotes: {
10530
- type: "string",
10531
- description: "Optional release notes for this version"
10532
- }
10533
- },
10534
- required: ["ontologyId", "version", "entityTypes", "edgeTypes"],
10535
- response: {
10536
- description: "Created version",
10537
- fields: {
10538
- id: "string \u2014 new version ID",
10539
- version: "string \u2014 version string"
10540
- }
10541
- },
10542
- ownerModule: "graph-primitives",
10543
- ontologyPrimitive: "ontology",
10544
- tier: "showcase"
10545
- };
10546
- var PUBLISH_ONTOLOGY_VERSION = {
10547
- name: "publish_ontology_version",
10548
- description: "Publish a draft ontology version \u2014 freezes it permanently. Like `git tag` for an ontology release \u2014 the version becomes immutable after publish. If the parent definition is still in 'draft', promotes it to 'active'.",
10549
- parameters: {
10550
- id: { type: "string", description: "Ontology version ID to publish" }
10551
- },
10552
- required: ["id"],
10553
- response: {
10554
- description: "Publish confirmation",
10555
- fields: {
10556
- success: "boolean",
10557
- publishedAt: "number \u2014 timestamp"
10558
- }
10559
- },
10560
- ownerModule: "graph-primitives",
10561
- ontologyPrimitive: "ontology",
10562
- tier: "showcase"
10563
- };
10564
- var DEPRECATE_ONTOLOGY_VERSION = {
10565
- name: "deprecate_ontology_version",
10566
- description: "Deprecate a published ontology version. Like `git tag -d` for an ontology release \u2014 marks the version as deprecated. Only published versions can be deprecated.",
10567
- parameters: {
10568
- id: { type: "string", description: "Ontology version ID to deprecate" }
10569
- },
10570
- required: ["id"],
10571
- response: {
10572
- description: "Deprecation confirmation",
10573
- fields: { success: "boolean" }
10574
- },
10575
- ownerModule: "graph-primitives",
10576
- ontologyPrimitive: "ontology",
10577
- tier: "workhorse"
10578
- };
10579
- var RESOLVE_EFFECTIVE_ONTOLOGY = {
10580
- name: "resolve_effective_ontology",
10581
- description: "Resolve the effective ontology by composing the parent chain. Like `git merge --squash` for ontology layers \u2014 walks parentOntologyId chain (max depth 3) and merges entity/edge types additively from root (platform) to leaf (tenant).",
10582
- parameters: {
10583
- ontologyId: {
10584
- type: "string",
10585
- description: "Ontology definition ID to resolve from"
10586
- }
10587
- },
10588
- required: ["ontologyId"],
10589
- response: {
10590
- description: "Merged ontology with composed entity and edge types",
10591
- fields: {
10592
- entityTypes: "array \u2014 merged entity types from all layers",
10593
- edgeTypes: "array \u2014 merged edge types from all layers",
10594
- layers: "array \u2014 ontology keys in composition order"
10595
- }
10596
- },
10597
- ownerModule: "graph-primitives",
10598
- ontologyPrimitive: "ontology",
10599
- tier: "workhorse"
10600
- };
10601
- var MCP_TOOL_CONTRACTS = {
10602
- // Belief lifecycle (commit, amend, fork, archive)
10603
- create_belief: CREATE_BELIEF,
10604
- get_belief: GET_BELIEF,
10605
- refine_belief: REFINE_BELIEF,
10606
- modulate_confidence: MODULATE_CONFIDENCE,
10607
- fork_belief: FORK_BELIEF,
10608
- archive_belief: ARCHIVE_BELIEF,
10609
- create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
10610
- // Evidence (commit)
10611
- create_evidence: CREATE_EVIDENCE,
10612
- get_evidence: GET_EVIDENCE,
10613
- list_evidence: LIST_EVIDENCE,
10614
- link_evidence: LINK_EVIDENCE,
10615
- add_evidence: ADD_EVIDENCE,
10616
- // Contradictions (merge conflict)
10617
- flag_contradiction: FLAG_CONTRADICTION,
10618
- // Lens lifecycle (workspace-scoped operational frames)
10619
- create_lens: CREATE_LENS,
10620
- list_lenses: LIST_LENSES,
10621
- apply_lens_to_topic: APPLY_LENS_TO_TOPIC,
10622
- remove_lens_from_topic: REMOVE_LENS_FROM_TOPIC,
10623
- // Worktree lifecycle (git worktree add → merge → push → pull request)
10624
- add_worktree: ADD_WORKTREE,
10625
- merge: MERGE,
10626
- push: PUSH,
10627
- open_pull_request: OPEN_PULL_REQUEST,
10628
- // Lineage and audit (log, blame)
10629
- query_lineage: QUERY_LINEAGE,
10630
- get_confidence_history: GET_CONFIDENCE_HISTORY,
10631
- get_audit_trail: GET_AUDIT_TRAIL,
10632
- // Graph queries (traverse, search, bisect, entity impact)
10633
- traverse_graph: TRAVERSE_GRAPH,
10634
- get_graph_neighborhood: GET_GRAPH_NEIGHBORHOOD,
10635
- trace_entity_impact: TRACE_ENTITY_IMPACT,
10636
- search_beliefs: SEARCH_BELIEFS,
10637
- search_resources: SEARCH_RESOURCES,
10638
- find_contradictions: FIND_CONTRADICTIONS,
10639
- bisect_confidence: BISECT_CONFIDENCE,
10640
- // Edges (commit)
10641
- create_edge: CREATE_EDGE,
10642
- // Judgments (tag)
10643
- record_judgment: RECORD_JUDGMENT,
10644
- // Graph intelligence (showcase)
10645
- detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
10646
- get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
10647
- get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
10648
- // Sources & research (showcase)
10649
- search_sources: SEARCH_SOURCES,
10650
- execute_deep_research: EXECUTE_DEEP_RESEARCH,
10651
- // Evidence operations (workhorse)
10652
- search_evidence: SEARCH_EVIDENCE,
10653
- link_evidence_to_belief: LINK_EVIDENCE_TO_BELIEF,
10654
- // Answer lifecycle (L2 question responses)
10655
- create_answer: CREATE_ANSWER,
10656
- get_answer: GET_ANSWER,
10657
- // Question operations (workhorse)
10658
- create_question: CREATE_QUESTION,
10659
- get_question: GET_QUESTION,
10660
- refine_question: REFINE_QUESTION,
10661
- list_questions: LIST_QUESTIONS,
10662
- answer_question: ANSWER_QUESTION,
10663
- update_question_status: UPDATE_QUESTION_STATUS,
10664
- archive_question: ARCHIVE_QUESTION,
10665
- link_evidence_to_question: LINK_EVIDENCE_TO_QUESTION,
10666
- get_high_priority_questions: GET_HIGH_PRIORITY_QUESTIONS,
10667
- find_missing_questions: FIND_MISSING_QUESTIONS,
10668
- // Listing & query (workhorse)
10669
- list_beliefs: LIST_BELIEFS,
10670
- list_worktrees: LIST_WORKTREES,
10671
- list_all_worktrees: LIST_ALL_WORKTREES,
10672
- activate_worktree: ACTIVATE_WORKTREE,
10673
- update_worktree_targets: UPDATE_WORKTREE_TARGETS,
10674
- update_worktree_metadata: UPDATE_WORKTREE_METADATA,
10675
- identity_whoami: IDENTITY_WHOAMI,
10676
- compile_context: COMPILE_CONTEXT,
10677
- // Policy / ACL (workhorse)
10678
- check_permission: CHECK_PERMISSION,
10679
- filter_by_permission: FILTER_BY_PERMISSION,
10680
- // Write policy (S2-13K Graph Compounding)
10681
- manage_write_policy: MANAGE_WRITE_POLICY,
10682
- // Observation context (workhorse)
10683
- ingest_observation: INGEST_OBSERVATION,
10684
- get_observation_context: GET_OBSERVATION_CONTEXT,
10685
- // Task lifecycle (workhorse)
10686
- create_task: CREATE_TASK,
10687
- complete_task: COMPLETE_TASK,
10688
- update_task: UPDATE_TASK,
10689
- list_tasks: LIST_TASKS,
10690
- // Topic lifecycle (init, remote)
10691
- create_topic: CREATE_TOPIC,
10692
- list_topics: LIST_TOPICS,
10693
- get_topic: GET_TOPIC,
10694
- update_topic: UPDATE_TOPIC,
10695
- get_topic_tree: GET_TOPIC_TREE,
10696
- // Coding intelligence (code-grounded knowledge)
10697
- get_code_context: GET_CODE_CONTEXT,
10698
- get_change_history: GET_CHANGE_HISTORY,
10699
- record_attempt: RECORD_ATTEMPT,
10700
- get_failure_log: GET_FAILURE_LOG,
10701
- // Graph self-intelligence (coverage, gaps)
10702
- get_topic_coverage: GET_TOPIC_COVERAGE,
10703
- get_graph_gaps: GET_GRAPH_GAPS,
10704
- // Ontology lifecycle (definition CRUD, version management)
10705
- list_ontologies: LIST_ONTOLOGIES,
10706
- get_ontology: GET_ONTOLOGY,
10707
- apply_ontology: APPLY_ONTOLOGY,
10708
- match_entity_type: MATCH_ENTITY_TYPE,
10709
- create_ontology: CREATE_ONTOLOGY,
10710
- update_ontology: UPDATE_ONTOLOGY,
10711
- archive_ontology: ARCHIVE_ONTOLOGY,
10712
- create_ontology_version: CREATE_ONTOLOGY_VERSION,
10713
- publish_ontology_version: PUBLISH_ONTOLOGY_VERSION,
10714
- deprecate_ontology_version: DEPRECATE_ONTOLOGY_VERSION,
10715
- resolve_effective_ontology: RESOLVE_EFFECTIVE_ONTOLOGY
10716
- };
10717
- var GIT_SEMANTIC_REQUIRED_TOOLS = Object.keys(MCP_TOOL_CONTRACTS);
10718
- function validateGitSemantics(tool) {
10719
- const desc = tool.description;
10720
- const hasGitReference = /Like (`git |a `git |a merge conflict|opening a `git)/.test(desc);
10721
- if (!hasGitReference) {
10722
- return {
10723
- valid: false,
10724
- reason: `Tool "${tool.name}" description missing git-semantic reference`
10725
- };
10726
- }
10727
- return { valid: true };
10728
- }
8575
+ // src/contracts/mcpTools.ts
8576
+ var mcpTools_exports = {};
8577
+
8578
+ // src/contracts/tool-contracts.ts
8579
+ var tool_contracts_exports = {};
8580
+ __reExport(tool_contracts_exports, tool_contracts_star);
8581
+
8582
+ // src/contracts/mcpTools.ts
8583
+ __reExport(mcpTools_exports, tool_contracts_exports);
8584
+
8585
+ // src/index.ts
8586
+ __reExport(src_exports, mcpTools_exports);
10729
8587
 
10730
8588
  // src/contracts/prompt.contract.ts
10731
8589
  function isLucernPrompt(value) {
@@ -11020,6 +8878,8 @@ var DOMAIN_EVENT_TYPES = [
11020
8878
  "identity.key_revoked",
11021
8879
  "webhook.test"
11022
8880
  ];
8881
+ var RUNTIME_BUFFER = globalThis.Buffer;
8882
+ var RUNTIME_ENV = globalThis.process?.env;
11023
8883
  function escapeRegex(value) {
11024
8884
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11025
8885
  }
@@ -11044,14 +8904,14 @@ function matchesAnyEventPattern(eventType, patterns) {
11044
8904
  return patterns.some((pattern) => matchesEventPattern(eventType, pattern));
11045
8905
  }
11046
8906
  function toBase64(value) {
11047
- if (typeof Buffer !== "undefined") {
11048
- return Buffer.from(value, "utf8").toString("base64url");
8907
+ if (RUNTIME_BUFFER) {
8908
+ return RUNTIME_BUFFER.from(value, "utf8").toString("base64url");
11049
8909
  }
11050
8910
  return btoa(unescape(encodeURIComponent(value))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
11051
8911
  }
11052
8912
  function fromBase64(value) {
11053
- if (typeof Buffer !== "undefined") {
11054
- return Buffer.from(value, "base64url").toString("utf8");
8913
+ if (RUNTIME_BUFFER) {
8914
+ return RUNTIME_BUFFER.from(value, "base64url").toString("utf8");
11055
8915
  }
11056
8916
  const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
11057
8917
  return decodeURIComponent(escape(atob(normalized)));
@@ -11147,7 +9007,7 @@ function normalizeUrl(url) {
11147
9007
  function assertValidWebhookUrl(url) {
11148
9008
  const parsed = normalizeUrl(url);
11149
9009
  const hostname = parsed.hostname.trim().toLowerCase();
11150
- const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
9010
+ const nodeEnv = RUNTIME_ENV?.NODE_ENV;
11151
9011
  const allowLocalHttp = nodeEnv === "test" || LOCALHOST_HOSTS.has(hostname);
11152
9012
  if (parsed.protocol !== "https:" && !(allowLocalHttp && parsed.protocol === "http:")) {
11153
9013
  throw new Error("Webhook URL must use HTTPS.");
@@ -11314,68 +9174,6 @@ function createWebhooksClientCore(config = {}) {
11314
9174
  };
11315
9175
  }
11316
9176
 
11317
- // src/mcpParitySurface.ts
11318
- var SDK_MCP_PARITY_METHODS = [
11319
- { toolName: "activate_worktree", methodPath: "worktrees.activate", kind: "mutation" },
11320
- { toolName: "update_worktree_metadata", methodPath: "worktrees.updateMetadata", kind: "mutation" },
11321
- { toolName: "update_worktree_targets", methodPath: "worktrees.updateTargets", kind: "mutation" },
11322
- { toolName: "list_all_worktrees", methodPath: "worktrees.listAll", kind: "read" },
11323
- { toolName: "pipeline_snapshot", methodPath: "worktrees.pipelineSnapshot", kind: "read" },
11324
- { toolName: "record_scope_learning", methodPath: "context.recordScopeLearning", kind: "mutation" },
11325
- { toolName: "discover", methodPath: "context.discover", kind: "read" },
11326
- { toolName: "analyze_topic_density", methodPath: "context.analyzeTopicDensity", kind: "read" },
11327
- { toolName: "apply_auto_branching", methodPath: "context.applyAutoBranching", kind: "mutation" },
11328
- { toolName: "seed_belief_lattice", methodPath: "context.seedBeliefLattice", kind: "mutation" },
11329
- { toolName: "get_lattice_coverage", methodPath: "context.getLatticeCoverage", kind: "read" },
11330
- { toolName: "match_entity_type", methodPath: "context.matchEntityType", kind: "read" },
11331
- { toolName: "discover_entity_connections", methodPath: "context.discoverEntityConnections", kind: "read" },
11332
- { toolName: "trigger_belief_review", methodPath: "context.triggerBeliefReview", kind: "mutation" },
11333
- { toolName: "list_ontologies", methodPath: "ontologies.list", kind: "read" },
11334
- { toolName: "get_ontology", methodPath: "ontologies.get", kind: "read" },
11335
- { toolName: "apply_ontology", methodPath: "ontologies.bind", kind: "mutation" },
11336
- { toolName: "create_ontology", methodPath: "ontologies.create", kind: "mutation" },
11337
- { toolName: "update_ontology", methodPath: "ontologies.update", kind: "mutation" },
11338
- { toolName: "archive_ontology", methodPath: "ontologies.archive", kind: "mutation" },
11339
- { toolName: "create_ontology_version", methodPath: "ontologies.createVersion", kind: "mutation" },
11340
- { toolName: "publish_ontology_version", methodPath: "ontologies.publishVersion", kind: "mutation" },
11341
- { toolName: "deprecate_ontology_version", methodPath: "ontologies.deprecateVersion", kind: "mutation" },
11342
- { toolName: "resolve_effective_ontology", methodPath: "ontologies.resolveEffective", kind: "read" },
11343
- { toolName: "register_session", methodPath: "coordination.registerSession", kind: "mutation" },
11344
- { toolName: "heartbeat_session", methodPath: "coordination.heartbeatSession", kind: "mutation" },
11345
- { toolName: "end_session", methodPath: "coordination.endSession", kind: "mutation" },
11346
- { toolName: "list_active_sessions", methodPath: "coordination.listActiveSessions", kind: "read" },
11347
- { toolName: "send_agent_message", methodPath: "coordination.sendAgentMessage", kind: "mutation" },
11348
- { toolName: "broadcast_message", methodPath: "coordination.broadcastMessage", kind: "mutation" },
11349
- { toolName: "get_agent_inbox", methodPath: "coordination.getInbox", kind: "read" },
11350
- { toolName: "claim_files", methodPath: "coordination.claimFiles", kind: "mutation" },
11351
- { toolName: "create_topic", methodPath: "topics.create", kind: "mutation" },
11352
- { toolName: "get_topic", methodPath: "topics.get", kind: "read" },
11353
- { toolName: "get_topic_tree", methodPath: "topics.getTree", kind: "read" },
11354
- { toolName: "list_tasks", methodPath: "tasks.list", kind: "read" },
11355
- { toolName: "create_answer", methodPath: "answers.create", kind: "mutation" },
11356
- { toolName: "get_answer", methodPath: "answers.get", kind: "read" },
11357
- { toolName: "flag_contradiction", methodPath: "contradictions.flag", kind: "mutation" },
11358
- { toolName: "ingest_observation", methodPath: "observations.ingest", kind: "mutation" },
11359
- { toolName: "get_observation_context", methodPath: "observations.getContext", kind: "read" },
11360
- { toolName: "get_code_context", methodPath: "coding.getCodeContext", kind: "read" },
11361
- { toolName: "get_change_history", methodPath: "coding.getChangeHistory", kind: "read" },
11362
- { toolName: "record_attempt", methodPath: "coding.recordAttempt", kind: "mutation" },
11363
- { toolName: "get_failure_log", methodPath: "coding.getFailureLog", kind: "read" },
11364
- { toolName: "create_epistemic_contract", methodPath: "contracts.create", kind: "mutation" },
11365
- { toolName: "evaluate_contract", methodPath: "contracts.evaluate", kind: "mutation" },
11366
- { toolName: "get_contract_status", methodPath: "contracts.getStatus", kind: "read" },
11367
- { toolName: "check_permission", methodPath: "policy.checkPermission", kind: "read" },
11368
- { toolName: "filter_by_permission", methodPath: "policy.filterByPermission", kind: "read" },
11369
- { toolName: "manage_write_policy", methodPath: "policy.manageWritePolicy", kind: "mutation" },
11370
- { toolName: "generate_session_handoff", methodPath: "bootstrap.generateSessionHandoff", kind: "read" }
11371
- ];
11372
- var SDK_MCP_PARITY_METHOD_PATHS = SDK_MCP_PARITY_METHODS.map(
11373
- (entry) => entry.methodPath
11374
- );
11375
- var SDK_MCP_PARITY_TOOL_NAMES = SDK_MCP_PARITY_METHODS.map(
11376
- (entry) => entry.toolName
11377
- );
11378
-
11379
- export { ACTIVATE_WORKTREE, ADD_EVIDENCE, ADD_WORKTREE, ANSWER_QUESTION, APPLY_LENS_TO_TOPIC, APPLY_ONTOLOGY, ARCHIVE_BELIEF, ARCHIVE_ONTOLOGY, ARCHIVE_QUESTION, BELIEF_STATUSES, BISECT_CONFIDENCE, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CHECK_PERMISSION, COMPILE_CONTEXT, COMPLETE_TASK, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CREATE_ANSWER, CREATE_BELIEF, CREATE_EDGE, CREATE_EPISTEMIC_CONTRACT, CREATE_EVIDENCE, CREATE_LENS, CREATE_ONTOLOGY, CREATE_ONTOLOGY_VERSION, CREATE_QUESTION, CREATE_TASK, CREATE_TOPIC, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DEPRECATE_ONTOLOGY_VERSION, DETECT_CONFIRMATION_BIAS, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, EDGE_TYPES, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENT_RETENTION_DEFAULT_DAYS, EXECUTE_DEEP_RESEARCH, FILTER_BY_PERMISSION, FIND_CONTRADICTIONS, FIND_MISSING_QUESTIONS, FLAG_CONTRADICTION, FORK_BELIEF, FORK_REASONS, GET_ANSWER, GET_AUDIT_TRAIL, GET_BELIEF, GET_CHANGE_HISTORY, GET_CODE_CONTEXT, GET_CONFIDENCE_HISTORY, GET_EVIDENCE, GET_FAILURE_LOG, GET_FALSIFICATION_QUESTIONS, GET_GRAPH_GAPS, GET_GRAPH_NEIGHBORHOOD, GET_GRAPH_STRUCTURE_ANALYSIS, GET_HIGH_PRIORITY_QUESTIONS, GET_OBSERVATION_CONTEXT, GET_ONTOLOGY, GET_QUESTION, GET_TOPIC, GET_TOPIC_COVERAGE, GET_TOPIC_TREE, GIT_SEMANTIC_REQUIRED_TOOLS, IDENTITY_WHOAMI, INGEST_OBSERVATION, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LINK_EVIDENCE, LINK_EVIDENCE_TO_BELIEF, LINK_EVIDENCE_TO_QUESTION, LIST_ALL_WORKTREES, LIST_BELIEFS, LIST_EVIDENCE, LIST_LENSES, LIST_ONTOLOGIES, LIST_QUESTIONS, LIST_TASKS, LIST_TOPICS, LIST_WORKTREES, LUCERN_SDK_VERSION, LucernApiError, MANAGE_WRITE_POLICY, MATCH_ENTITY_TYPE, MAX_ENTITY_LIMIT, MCP_TOOL_CONTRACTS, MERGE, MERGE_OUTCOMES, MODULATE_CONFIDENCE, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, OPEN_PULL_REQUEST, PUBLISH_ONTOLOGY_VERSION, PUSH, QUERY_LINEAGE, REASONING_METHODS, RECORD_ATTEMPT, RECORD_JUDGMENT, REFINE_BELIEF, REFINE_QUESTION, REMOVE_LENS_FROM_TOPIC, RESOLVE_EFFECTIVE_ONTOLOGY, SDK_MCP_PARITY_METHODS, SDK_MCP_PARITY_METHOD_PATHS, SDK_MCP_PARITY_TOOL_NAMES, SEARCH_BELIEFS, SEARCH_EVIDENCE, SEARCH_RESOURCES, SEARCH_SOURCES, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, TRACE_ENTITY_IMPACT, TRAVERSE_GRAPH, UPDATE_ONTOLOGY, UPDATE_QUESTION_STATUS, UPDATE_TASK, UPDATE_TOPIC, UPDATE_WORKTREE_METADATA, UPDATE_WORKTREE_TARGETS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createBeliefsClient, createContextClient, createContextFacade, createDecisionsClient, createEventId, createEventsClientCore, createGatewayRequestClient, createGraphClient, createHarnessClient, createIdentityClient, createLearningClient, createListResult, createLucernClient, createMcpParityClient, createOntologyClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getRegisteredCustomTool, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isLensFilterCriteria, isLucernPrompt, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, matchesAnyEventPattern, matchesEventPattern, migrateBranchToLens, nextDeliveryAttemptAt, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, planContextPackCompilation, randomIdempotencyKey, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, validateGitSemantics, withSdkAliases, withTextAlias, withTopicAlias };
9177
+ export { BELIEF_STATUSES, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, EDGE_TYPES, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, MAX_ENTITY_LIMIT, MERGE_OUTCOMES, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createBeliefsClient, createContextClient, createContextFacade, createDecisionsClient, createEventId, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphClient, createHarnessClient, createIdentityClient, createLearningClient, createListResult, createLucernClient, createOntologyClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getRegisteredCustomTool, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isLensFilterCriteria, isLucernPrompt, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, migrateBranchToLens, nextDeliveryAttemptAt, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, planContextPackCompilation, randomIdempotencyKey, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, withSdkAliases, withTextAlias, withTopicAlias };
11380
9178
  //# sourceMappingURL=index.js.map
11381
9179
  //# sourceMappingURL=index.js.map