@lucern/events 0.3.0-alpha.0 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1321 -311
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +1321 -311
- package/dist/outbox.js.map +1 -1
- package/dist/types.js +1321 -311
- package/dist/types.js.map +1 -1
- package/dist/webhooks.js +1321 -311
- package/dist/webhooks.js.map +1 -1
- package/package.json +3 -2
package/dist/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { v } from 'convex/values';
|
|
2
3
|
|
|
3
4
|
// ../contracts/src/events.contract.ts
|
|
4
5
|
var DOMAIN_EVENT_VERSION = "1.0";
|
|
@@ -443,6 +444,28 @@ defineTable({
|
|
|
443
444
|
{ kind: "index", name: "by_createdAt", columns: ["createdAt"] }
|
|
444
445
|
]
|
|
445
446
|
});
|
|
447
|
+
defineTable({
|
|
448
|
+
name: "neo4jSyncQueue",
|
|
449
|
+
component: "kernel",
|
|
450
|
+
category: "infra",
|
|
451
|
+
shape: z.object({
|
|
452
|
+
"entityType": z.enum(["node", "edge"]),
|
|
453
|
+
"entityId": z.string(),
|
|
454
|
+
"operation": z.enum(["upsert", "delete"]),
|
|
455
|
+
"attempts": z.number(),
|
|
456
|
+
"maxAttempts": z.number(),
|
|
457
|
+
"lastAttemptAt": z.number().optional(),
|
|
458
|
+
"lastError": z.string().optional(),
|
|
459
|
+
"status": z.enum(["pending", "in_progress", "failed", "succeeded"]),
|
|
460
|
+
"createdAt": z.number(),
|
|
461
|
+
"updatedAt": z.number()
|
|
462
|
+
}),
|
|
463
|
+
indices: [
|
|
464
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
465
|
+
{ kind: "index", name: "by_entity", columns: ["entityType", "entityId"] },
|
|
466
|
+
{ kind: "index", name: "by_status_attempts", columns: ["status", "attempts"] }
|
|
467
|
+
]
|
|
468
|
+
});
|
|
446
469
|
defineTable({
|
|
447
470
|
name: "backgroundJobRuns",
|
|
448
471
|
component: "kernel",
|
|
@@ -512,9 +535,9 @@ defineTable({
|
|
|
512
535
|
category: "epistemic",
|
|
513
536
|
shape: z.object({
|
|
514
537
|
"beliefId": z.string(),
|
|
515
|
-
"belief": z.number()
|
|
516
|
-
"disbelief": z.number()
|
|
517
|
-
"uncertainty": z.number()
|
|
538
|
+
"belief": z.number(),
|
|
539
|
+
"disbelief": z.number(),
|
|
540
|
+
"uncertainty": z.number(),
|
|
518
541
|
"baseRate": z.number(),
|
|
519
542
|
"slOperator": z.string().optional(),
|
|
520
543
|
"confidence": z.number(),
|
|
@@ -523,10 +546,12 @@ defineTable({
|
|
|
523
546
|
"certainty": z.number().optional(),
|
|
524
547
|
"assessedAt": z.number(),
|
|
525
548
|
"assessedBy": z.string(),
|
|
526
|
-
"trigger": z.enum(["initial", "evidence_added", "evidence_removed", "contradiction_detected", "contradiction_resolved", "
|
|
549
|
+
"trigger": z.enum(["initial", "evidence_added", "evidence_removed", "contradiction_detected", "contradiction_resolved", "propagation", "agent_assessment", "worktree_outcome", "worktree_completed", "fusion", "discount", "deduction", "backfill_synthetic"]),
|
|
527
550
|
"rationale": z.string().optional(),
|
|
528
551
|
"triggeringEvidenceId": z.string().optional(),
|
|
529
552
|
"triggeringEvidenceIds": z.array(z.string()).optional(),
|
|
553
|
+
"triggeringQuestionId": z.string().optional(),
|
|
554
|
+
"triggeringAnswerId": z.string().optional(),
|
|
530
555
|
"triggeringContradictionId": idOf("contradictions").optional(),
|
|
531
556
|
"triggeringWorktreeId": z.string().optional(),
|
|
532
557
|
"triggeringAgentId": z.string().optional(),
|
|
@@ -1209,7 +1234,7 @@ defineTable({
|
|
|
1209
1234
|
"credentialRef": z.string(),
|
|
1210
1235
|
"tenantId": idOf("tenants"),
|
|
1211
1236
|
"target": z.enum(["kernelDeployment", "appDeployment"]),
|
|
1212
|
-
"environment": z.enum(["dev", "prod"]),
|
|
1237
|
+
"environment": z.enum(["dev", "staging", "prod"]),
|
|
1213
1238
|
"encryptedDeployKey": z.string(),
|
|
1214
1239
|
"encryptionVersion": z.string(),
|
|
1215
1240
|
"keyFingerprint": z.string(),
|
|
@@ -3878,13 +3903,13 @@ defineTable({
|
|
|
3878
3903
|
"rationale": z.string().optional(),
|
|
3879
3904
|
"confidenceImpact": z.enum(["high", "medium", "low"]).optional(),
|
|
3880
3905
|
"hypothesis": z.string().optional(),
|
|
3881
|
-
"executionOrder": z.number().optional(),
|
|
3882
3906
|
"dependsOn": z.array(idOf("worktrees")).optional(),
|
|
3883
3907
|
"blocks": z.array(idOf("worktrees")).optional(),
|
|
3884
3908
|
"gate": z.string().optional(),
|
|
3885
|
-
"
|
|
3886
|
-
"
|
|
3887
|
-
"
|
|
3909
|
+
"campaign": z.number().optional(),
|
|
3910
|
+
"lane": z.string().optional(),
|
|
3911
|
+
"laneOrderInCampaign": z.number().optional(),
|
|
3912
|
+
"orderInLane": z.number().optional(),
|
|
3888
3913
|
"startDate": z.number(),
|
|
3889
3914
|
"endDate": z.number(),
|
|
3890
3915
|
"durationWeeks": z.number(),
|
|
@@ -4132,10 +4157,469 @@ defineTable({
|
|
|
4132
4157
|
{ kind: "index", name: "by_topicId_index", columns: ["topicId", "index"] },
|
|
4133
4158
|
{ kind: "index", name: "by_worktreeType", columns: ["topicId", "worktreeType"] },
|
|
4134
4159
|
{ kind: "index", name: "by_topicId_priority", columns: ["topicId", "priority"] },
|
|
4160
|
+
{ kind: "index", name: "by_topicId_campaign_lane_order", columns: ["topicId", "campaign", "laneOrderInCampaign", "orderInLane"] },
|
|
4161
|
+
{ kind: "index", name: "by_topicId_lane_order", columns: ["topicId", "lane", "orderInLane"] },
|
|
4135
4162
|
{ kind: "index", name: "by_topicId_branch", columns: ["topicId", "targetBranch"] },
|
|
4136
4163
|
{ kind: "index", name: "by_topicId_scope", columns: ["topicId", "worktreeScope"] }
|
|
4137
4164
|
]
|
|
4138
4165
|
});
|
|
4166
|
+
z.object({
|
|
4167
|
+
manifestVersion: z.string(),
|
|
4168
|
+
componentName: z.enum(["kernel", "identity"]),
|
|
4169
|
+
tier: z.enum(["K", "I"]),
|
|
4170
|
+
packageVersion: z.string(),
|
|
4171
|
+
tables: z.array(
|
|
4172
|
+
z.object({
|
|
4173
|
+
name: z.string(),
|
|
4174
|
+
fields: z.array(
|
|
4175
|
+
z.object({
|
|
4176
|
+
name: z.string(),
|
|
4177
|
+
type: z.string(),
|
|
4178
|
+
optional: z.boolean(),
|
|
4179
|
+
validator: z.string().optional()
|
|
4180
|
+
})
|
|
4181
|
+
)
|
|
4182
|
+
})
|
|
4183
|
+
)
|
|
4184
|
+
});
|
|
4185
|
+
var SL_EPSILON = 1e-9;
|
|
4186
|
+
z.object({
|
|
4187
|
+
belief: z.number(),
|
|
4188
|
+
disbelief: z.number(),
|
|
4189
|
+
uncertainty: z.number(),
|
|
4190
|
+
baseRate: z.number()
|
|
4191
|
+
}).refine(
|
|
4192
|
+
(o) => Math.abs(o.belief + o.disbelief + o.uncertainty - 1) < SL_EPSILON,
|
|
4193
|
+
{
|
|
4194
|
+
message: "SL invariant b+d+u=1 violated at API boundary"
|
|
4195
|
+
}
|
|
4196
|
+
);
|
|
4197
|
+
var EpistemicNodeTypeSchema = z.enum([
|
|
4198
|
+
"belief",
|
|
4199
|
+
"evidence",
|
|
4200
|
+
"question",
|
|
4201
|
+
"answer",
|
|
4202
|
+
"topic",
|
|
4203
|
+
"edge",
|
|
4204
|
+
"ontology",
|
|
4205
|
+
"lens",
|
|
4206
|
+
"contradiction"
|
|
4207
|
+
]);
|
|
4208
|
+
var GraphRefSchema = z.discriminatedUnion("kind", [
|
|
4209
|
+
z.object({
|
|
4210
|
+
kind: z.literal("epistemic_node"),
|
|
4211
|
+
nodeId: z.string(),
|
|
4212
|
+
nodeType: EpistemicNodeTypeSchema
|
|
4213
|
+
}),
|
|
4214
|
+
z.object({
|
|
4215
|
+
kind: z.literal("external_belief"),
|
|
4216
|
+
ref: z.object({
|
|
4217
|
+
tenantId: z.string(),
|
|
4218
|
+
beliefId: z.string()
|
|
4219
|
+
})
|
|
4220
|
+
})
|
|
4221
|
+
]);
|
|
4222
|
+
var graphRefKind = z.enum(["epistemic_node", "external_belief"]);
|
|
4223
|
+
var EdgePolicyEntrySchema = z.object({
|
|
4224
|
+
edgeType: z.string(),
|
|
4225
|
+
fromKinds: z.array(graphRefKind),
|
|
4226
|
+
fromNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),
|
|
4227
|
+
toKinds: z.array(graphRefKind),
|
|
4228
|
+
toNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),
|
|
4229
|
+
description: z.string()
|
|
4230
|
+
});
|
|
4231
|
+
z.object({
|
|
4232
|
+
manifestVersion: z.literal("1.0.0"),
|
|
4233
|
+
policies: z.array(EdgePolicyEntrySchema)
|
|
4234
|
+
});
|
|
4235
|
+
function findEdgePolicy(manifest, edgeType) {
|
|
4236
|
+
return manifest.policies.find((policy) => policy.edgeType === edgeType);
|
|
4237
|
+
}
|
|
4238
|
+
function nodeTypeAllowed(allowed, ref) {
|
|
4239
|
+
return ref.kind !== "epistemic_node" || !allowed || allowed.includes(ref.nodeType);
|
|
4240
|
+
}
|
|
4241
|
+
function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
|
|
4242
|
+
const policy = findEdgePolicy(manifest, edgeType);
|
|
4243
|
+
const allowed = Boolean(policy) && policy.fromKinds.includes(from.kind) && policy.toKinds.includes(to.kind) && nodeTypeAllowed(policy.fromNodeTypes, from) && nodeTypeAllowed(policy.toNodeTypes, to);
|
|
4244
|
+
if (!allowed) {
|
|
4245
|
+
const error = new Error(
|
|
4246
|
+
`Edge policy violation for ${edgeType}: ${from.kind} -> ${to.kind}`
|
|
4247
|
+
);
|
|
4248
|
+
error.code = "POLICY_VIOLATION";
|
|
4249
|
+
error.details = { code: "POLICY_VIOLATION", edgeType, from, to };
|
|
4250
|
+
throw error;
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4254
|
+
// ../contracts/src/manifests/edge-policy-manifest.data.ts
|
|
4255
|
+
var edgePolicyManifest = {
|
|
4256
|
+
policies: [
|
|
4257
|
+
{
|
|
4258
|
+
edgeType: "evidence_derived_from_evidence",
|
|
4259
|
+
fromKinds: ["epistemic_node"],
|
|
4260
|
+
fromNodeTypes: ["evidence"],
|
|
4261
|
+
toKinds: ["epistemic_node"],
|
|
4262
|
+
toNodeTypes: ["evidence"],
|
|
4263
|
+
description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
|
|
4264
|
+
},
|
|
4265
|
+
{
|
|
4266
|
+
edgeType: "evidence_supports_belief",
|
|
4267
|
+
fromKinds: ["epistemic_node"],
|
|
4268
|
+
fromNodeTypes: ["evidence"],
|
|
4269
|
+
toKinds: ["epistemic_node"],
|
|
4270
|
+
toNodeTypes: ["belief"],
|
|
4271
|
+
description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
|
|
4272
|
+
},
|
|
4273
|
+
{
|
|
4274
|
+
edgeType: "evidence_supports_question",
|
|
4275
|
+
fromKinds: ["epistemic_node"],
|
|
4276
|
+
fromNodeTypes: ["evidence"],
|
|
4277
|
+
toKinds: ["epistemic_node"],
|
|
4278
|
+
toNodeTypes: ["question"],
|
|
4279
|
+
description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
|
|
4280
|
+
}
|
|
4281
|
+
]
|
|
4282
|
+
};
|
|
4283
|
+
z.object({
|
|
4284
|
+
manifestVersion: z.literal("1.0.0"),
|
|
4285
|
+
rules: z.array(
|
|
4286
|
+
z.object({
|
|
4287
|
+
invariant: z.string(),
|
|
4288
|
+
description: z.string(),
|
|
4289
|
+
checker: z.enum(["ast", "manifest", "runtime"]),
|
|
4290
|
+
severity: z.enum(["block_publish", "block_pr", "warn"])
|
|
4291
|
+
})
|
|
4292
|
+
)
|
|
4293
|
+
});
|
|
4294
|
+
|
|
4295
|
+
// ../contracts/src/projections/projection-dsl.ts
|
|
4296
|
+
function defineProjection(def) {
|
|
4297
|
+
return def;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
// ../contracts/src/projections/create-evidence.projection.ts
|
|
4301
|
+
var jsonRecordSchema = z.record(z.unknown());
|
|
4302
|
+
var createEvidenceInputSchemaBase = z.object({
|
|
4303
|
+
projectId: z.string().optional(),
|
|
4304
|
+
topicId: z.string().optional(),
|
|
4305
|
+
text: z.string().optional(),
|
|
4306
|
+
canonicalText: z.string().optional(),
|
|
4307
|
+
title: z.string().optional(),
|
|
4308
|
+
content: z.string().optional(),
|
|
4309
|
+
contentType: z.string().optional(),
|
|
4310
|
+
kind: z.string().optional(),
|
|
4311
|
+
tags: z.array(z.string()).optional(),
|
|
4312
|
+
source: z.string().optional(),
|
|
4313
|
+
sourceUrl: z.string().optional(),
|
|
4314
|
+
sourceType: z.string().optional(),
|
|
4315
|
+
externalSourceType: z.string().optional(),
|
|
4316
|
+
sourceQuestionId: z.string().optional(),
|
|
4317
|
+
methodology: z.string().optional(),
|
|
4318
|
+
informationAsymmetry: z.string().optional(),
|
|
4319
|
+
sourceDescription: z.string().optional(),
|
|
4320
|
+
targetId: z.string().optional(),
|
|
4321
|
+
targetNodeId: z.string().optional(),
|
|
4322
|
+
linkedBeliefNodeId: z.string().optional(),
|
|
4323
|
+
evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
|
|
4324
|
+
confidence: z.number().optional(),
|
|
4325
|
+
weight: z.number().optional(),
|
|
4326
|
+
reasoning: z.string().optional(),
|
|
4327
|
+
rationale: z.string(),
|
|
4328
|
+
metadata: jsonRecordSchema.optional(),
|
|
4329
|
+
trustedBypassAccessCheck: z.boolean().optional()
|
|
4330
|
+
}).passthrough();
|
|
4331
|
+
var createEvidenceInputSchema = createEvidenceInputSchemaBase.refine(
|
|
4332
|
+
(input) => Boolean(input.text ?? input.canonicalText),
|
|
4333
|
+
{
|
|
4334
|
+
message: "create_evidence requires text",
|
|
4335
|
+
path: ["text"]
|
|
4336
|
+
}
|
|
4337
|
+
);
|
|
4338
|
+
function compactRecord(input) {
|
|
4339
|
+
return Object.fromEntries(
|
|
4340
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
4341
|
+
);
|
|
4342
|
+
}
|
|
4343
|
+
function recordValue(value) {
|
|
4344
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
4345
|
+
}
|
|
4346
|
+
var createEvidenceProjection = defineProjection({
|
|
4347
|
+
contractName: "create_evidence",
|
|
4348
|
+
inputSchema: createEvidenceInputSchema,
|
|
4349
|
+
project: (input) => {
|
|
4350
|
+
const text = input.text ?? input.canonicalText;
|
|
4351
|
+
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
4352
|
+
return compactRecord({
|
|
4353
|
+
projectId: input.projectId,
|
|
4354
|
+
topicId: input.topicId,
|
|
4355
|
+
text,
|
|
4356
|
+
title: input.title ?? text,
|
|
4357
|
+
content: input.content ?? text,
|
|
4358
|
+
contentType: input.contentType,
|
|
4359
|
+
kind: input.kind,
|
|
4360
|
+
tags: input.tags,
|
|
4361
|
+
sourceType: input.sourceType,
|
|
4362
|
+
externalSourceType: input.externalSourceType,
|
|
4363
|
+
sourceUrl: input.sourceUrl ?? input.source,
|
|
4364
|
+
sourceQuestionId: input.sourceQuestionId,
|
|
4365
|
+
methodology: input.methodology,
|
|
4366
|
+
informationAsymmetry: input.informationAsymmetry,
|
|
4367
|
+
sourceDescription: input.sourceDescription,
|
|
4368
|
+
metadata: compactRecord({
|
|
4369
|
+
...recordValue(input.metadata),
|
|
4370
|
+
source: input.source,
|
|
4371
|
+
targetId: input.targetId,
|
|
4372
|
+
targetNodeId: input.targetNodeId,
|
|
4373
|
+
weight,
|
|
4374
|
+
reasoning: input.reasoning,
|
|
4375
|
+
rationale: input.rationale
|
|
4376
|
+
}),
|
|
4377
|
+
linkedBeliefNodeId: input.linkedBeliefNodeId ?? input.targetNodeId ?? input.targetId,
|
|
4378
|
+
evidenceRelation: input.evidenceRelation ?? (weight === void 0 ? void 0 : weight < 0 ? "contradicts" : "supports"),
|
|
4379
|
+
confidence: input.confidence ?? (weight === void 0 ? void 0 : Math.min(1, Math.max(0, Math.abs(weight)))),
|
|
4380
|
+
rationale: input.rationale,
|
|
4381
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
4382
|
+
});
|
|
4383
|
+
},
|
|
4384
|
+
convexArgsValidator: v.object({
|
|
4385
|
+
projectId: v.optional(v.string()),
|
|
4386
|
+
topicId: v.optional(v.string()),
|
|
4387
|
+
text: v.string(),
|
|
4388
|
+
title: v.optional(v.string()),
|
|
4389
|
+
content: v.optional(v.string()),
|
|
4390
|
+
contentType: v.optional(v.string()),
|
|
4391
|
+
kind: v.optional(v.string()),
|
|
4392
|
+
tags: v.optional(v.array(v.string())),
|
|
4393
|
+
sourceType: v.optional(v.string()),
|
|
4394
|
+
externalSourceType: v.optional(v.string()),
|
|
4395
|
+
sourceUrl: v.optional(v.string()),
|
|
4396
|
+
sourceQuestionId: v.optional(v.string()),
|
|
4397
|
+
methodology: v.optional(v.string()),
|
|
4398
|
+
informationAsymmetry: v.optional(v.string()),
|
|
4399
|
+
sourceDescription: v.optional(v.string()),
|
|
4400
|
+
metadata: v.optional(v.record(v.string(), v.any())),
|
|
4401
|
+
linkedBeliefNodeId: v.optional(v.string()),
|
|
4402
|
+
evidenceRelation: v.optional(
|
|
4403
|
+
v.union(
|
|
4404
|
+
v.literal("supports"),
|
|
4405
|
+
v.literal("contradicts"),
|
|
4406
|
+
v.literal("neutral")
|
|
4407
|
+
)
|
|
4408
|
+
),
|
|
4409
|
+
confidence: v.optional(v.number()),
|
|
4410
|
+
rationale: v.string(),
|
|
4411
|
+
trustedBypassAccessCheck: v.optional(v.boolean())
|
|
4412
|
+
})
|
|
4413
|
+
});
|
|
4414
|
+
var beliefStatusSchema = z.enum(["active", "superseded", "archived", "unscored", "scored"]).optional().describe("Filter by belief lifecycle or scoring status");
|
|
4415
|
+
var listBeliefsInputSchema = z.object({
|
|
4416
|
+
topicId: z.string().describe("Topic scope"),
|
|
4417
|
+
worktreeId: z.string().optional().describe("Filter to worktree scope"),
|
|
4418
|
+
status: beliefStatusSchema,
|
|
4419
|
+
minConfidence: z.number().optional().describe("Minimum confidence threshold"),
|
|
4420
|
+
limit: z.number().optional().describe("Maximum results"),
|
|
4421
|
+
includeEdgeAssociated: z.boolean().optional().describe("Include beliefs associated to the topic through edges")
|
|
4422
|
+
});
|
|
4423
|
+
function kernelStatus(status) {
|
|
4424
|
+
return status === "active" || status === "superseded" || status === "archived" ? status : void 0;
|
|
4425
|
+
}
|
|
4426
|
+
function compactRecord2(input) {
|
|
4427
|
+
return Object.fromEntries(
|
|
4428
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
4429
|
+
);
|
|
4430
|
+
}
|
|
4431
|
+
var listBeliefsProjection = defineProjection({
|
|
4432
|
+
contractName: "list_beliefs",
|
|
4433
|
+
inputSchema: listBeliefsInputSchema,
|
|
4434
|
+
project: (input) => compactRecord2({
|
|
4435
|
+
topicId: input.topicId,
|
|
4436
|
+
status: kernelStatus(input.status),
|
|
4437
|
+
limit: input.limit,
|
|
4438
|
+
includeEdgeAssociated: input.includeEdgeAssociated
|
|
4439
|
+
}),
|
|
4440
|
+
convexArgsValidator: v.object({
|
|
4441
|
+
topicId: v.string(),
|
|
4442
|
+
status: v.optional(
|
|
4443
|
+
v.union(
|
|
4444
|
+
v.literal("active"),
|
|
4445
|
+
v.literal("superseded"),
|
|
4446
|
+
v.literal("archived")
|
|
4447
|
+
)
|
|
4448
|
+
),
|
|
4449
|
+
limit: v.optional(v.number()),
|
|
4450
|
+
includeEdgeAssociated: v.optional(v.boolean())
|
|
4451
|
+
})
|
|
4452
|
+
});
|
|
4453
|
+
var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
|
|
4454
|
+
var listTasksInputSchema = z.object({
|
|
4455
|
+
topicId: z.string().describe("Topic scope"),
|
|
4456
|
+
worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
|
|
4457
|
+
linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
|
|
4458
|
+
status: taskStatusSchema,
|
|
4459
|
+
limit: z.number().optional().describe("Maximum results")
|
|
4460
|
+
});
|
|
4461
|
+
function compactRecord3(input) {
|
|
4462
|
+
return Object.fromEntries(
|
|
4463
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
4464
|
+
);
|
|
4465
|
+
}
|
|
4466
|
+
var listTasksProjection = defineProjection({
|
|
4467
|
+
contractName: "list_tasks",
|
|
4468
|
+
inputSchema: listTasksInputSchema,
|
|
4469
|
+
project: (input) => compactRecord3({
|
|
4470
|
+
topicId: input.topicId,
|
|
4471
|
+
status: input.status,
|
|
4472
|
+
userId: void 0,
|
|
4473
|
+
limit: input.limit,
|
|
4474
|
+
linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
|
|
4475
|
+
}),
|
|
4476
|
+
convexArgsValidator: v.object({
|
|
4477
|
+
topicId: v.string(),
|
|
4478
|
+
status: v.optional(
|
|
4479
|
+
v.union(
|
|
4480
|
+
v.literal("todo"),
|
|
4481
|
+
v.literal("in_progress"),
|
|
4482
|
+
v.literal("blocked"),
|
|
4483
|
+
v.literal("done")
|
|
4484
|
+
)
|
|
4485
|
+
),
|
|
4486
|
+
limit: v.optional(v.number()),
|
|
4487
|
+
linkedWorktreeId: v.optional(v.string())
|
|
4488
|
+
})
|
|
4489
|
+
});
|
|
4490
|
+
var confidenceTriggerSchema = z.enum([
|
|
4491
|
+
"evidence_added",
|
|
4492
|
+
"evidence_removed",
|
|
4493
|
+
"contradiction_resolved",
|
|
4494
|
+
"agent_assessment",
|
|
4495
|
+
"worktree_outcome",
|
|
4496
|
+
"worktree_completed",
|
|
4497
|
+
"contradiction_detected",
|
|
4498
|
+
"answer_recorded",
|
|
4499
|
+
"fusion",
|
|
4500
|
+
"discount",
|
|
4501
|
+
"deduction",
|
|
4502
|
+
"backfill_synthetic"
|
|
4503
|
+
]);
|
|
4504
|
+
var provenanceSchema = z.object({
|
|
4505
|
+
evidence: z.string().optional(),
|
|
4506
|
+
question: z.string().optional(),
|
|
4507
|
+
answer: z.string().optional(),
|
|
4508
|
+
contradiction: z.string().optional(),
|
|
4509
|
+
worktree: z.string().optional()
|
|
4510
|
+
});
|
|
4511
|
+
var slOpinionProjectionSchema = z.object({
|
|
4512
|
+
belief: z.number(),
|
|
4513
|
+
disbelief: z.number(),
|
|
4514
|
+
uncertainty: z.number(),
|
|
4515
|
+
baseRate: z.number()
|
|
4516
|
+
});
|
|
4517
|
+
var modulateConfidenceInputObjectSchema = z.object({
|
|
4518
|
+
nodeId: z.string().optional(),
|
|
4519
|
+
beliefNodeId: z.string().optional(),
|
|
4520
|
+
worktreeId: z.string().optional(),
|
|
4521
|
+
opinion: slOpinionProjectionSchema.optional(),
|
|
4522
|
+
belief: z.number().optional(),
|
|
4523
|
+
disbelief: z.number().optional(),
|
|
4524
|
+
uncertainty: z.number().optional(),
|
|
4525
|
+
baseRate: z.number().optional(),
|
|
4526
|
+
trigger: confidenceTriggerSchema,
|
|
4527
|
+
provenance: provenanceSchema.optional(),
|
|
4528
|
+
triggeringEvidenceId: z.string().optional(),
|
|
4529
|
+
triggeringQuestionId: z.string().optional(),
|
|
4530
|
+
triggeringAnswerId: z.string().optional(),
|
|
4531
|
+
triggeringContradictionId: z.string().optional(),
|
|
4532
|
+
triggeringWorktreeId: z.string().optional(),
|
|
4533
|
+
rationale: z.string(),
|
|
4534
|
+
trustedBypassAccessCheck: z.boolean().optional()
|
|
4535
|
+
});
|
|
4536
|
+
var modulateConfidenceInputSchema = modulateConfidenceInputObjectSchema.superRefine((input, ctx) => {
|
|
4537
|
+
if (hasProvenance(input)) {
|
|
4538
|
+
return;
|
|
4539
|
+
}
|
|
4540
|
+
ctx.addIssue({
|
|
4541
|
+
code: z.ZodIssueCode.custom,
|
|
4542
|
+
message: "modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance",
|
|
4543
|
+
path: ["provenance"]
|
|
4544
|
+
});
|
|
4545
|
+
});
|
|
4546
|
+
var modulateConfidenceProjection = defineProjection({
|
|
4547
|
+
contractName: "modulate_confidence",
|
|
4548
|
+
inputSchema: modulateConfidenceInputSchema,
|
|
4549
|
+
project: (input) => {
|
|
4550
|
+
const nodeId = input.beliefNodeId ?? input.nodeId;
|
|
4551
|
+
if (!nodeId) {
|
|
4552
|
+
throw new Error("modulate_confidence requires beliefNodeId or nodeId");
|
|
4553
|
+
}
|
|
4554
|
+
const opinion = input.opinion ?? {
|
|
4555
|
+
belief: requireNumber(input.belief, "belief"),
|
|
4556
|
+
disbelief: requireNumber(input.disbelief, "disbelief"),
|
|
4557
|
+
uncertainty: requireNumber(input.uncertainty, "uncertainty"),
|
|
4558
|
+
baseRate: requireNumber(input.baseRate, "baseRate")
|
|
4559
|
+
};
|
|
4560
|
+
assertProvenance(input);
|
|
4561
|
+
return {
|
|
4562
|
+
nodeId,
|
|
4563
|
+
worktreeId: input.worktreeId,
|
|
4564
|
+
belief: opinion.belief,
|
|
4565
|
+
disbelief: opinion.disbelief,
|
|
4566
|
+
uncertainty: opinion.uncertainty,
|
|
4567
|
+
baseRate: opinion.baseRate,
|
|
4568
|
+
trigger: input.trigger === "answer_recorded" ? "agent_assessment" : input.trigger,
|
|
4569
|
+
triggeringEvidenceId: input.provenance?.evidence ?? input.triggeringEvidenceId,
|
|
4570
|
+
triggeringQuestionId: input.provenance?.question ?? input.triggeringQuestionId,
|
|
4571
|
+
triggeringAnswerId: input.provenance?.answer ?? input.triggeringAnswerId,
|
|
4572
|
+
triggeringContradictionId: input.provenance?.contradiction ?? input.triggeringContradictionId,
|
|
4573
|
+
triggeringWorktreeId: input.provenance?.worktree ?? input.triggeringWorktreeId,
|
|
4574
|
+
rationale: input.rationale,
|
|
4575
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
4576
|
+
};
|
|
4577
|
+
},
|
|
4578
|
+
convexArgsValidator: v.object({
|
|
4579
|
+
nodeId: v.string(),
|
|
4580
|
+
worktreeId: v.optional(v.string()),
|
|
4581
|
+
belief: v.number(),
|
|
4582
|
+
disbelief: v.number(),
|
|
4583
|
+
uncertainty: v.number(),
|
|
4584
|
+
baseRate: v.number(),
|
|
4585
|
+
trigger: v.union(
|
|
4586
|
+
v.literal("evidence_added"),
|
|
4587
|
+
v.literal("evidence_removed"),
|
|
4588
|
+
v.literal("worktree_completed"),
|
|
4589
|
+
v.literal("contradiction_detected"),
|
|
4590
|
+
v.literal("contradiction_resolved"),
|
|
4591
|
+
v.literal("agent_assessment"),
|
|
4592
|
+
v.literal("worktree_outcome"),
|
|
4593
|
+
v.literal("fusion"),
|
|
4594
|
+
v.literal("discount"),
|
|
4595
|
+
v.literal("deduction"),
|
|
4596
|
+
v.literal("backfill_synthetic")
|
|
4597
|
+
),
|
|
4598
|
+
triggeringEvidenceId: v.optional(v.string()),
|
|
4599
|
+
triggeringQuestionId: v.optional(v.string()),
|
|
4600
|
+
triggeringAnswerId: v.optional(v.string()),
|
|
4601
|
+
triggeringContradictionId: v.optional(v.string()),
|
|
4602
|
+
triggeringWorktreeId: v.optional(v.string()),
|
|
4603
|
+
rationale: v.string(),
|
|
4604
|
+
trustedBypassAccessCheck: v.optional(v.boolean())
|
|
4605
|
+
})
|
|
4606
|
+
});
|
|
4607
|
+
function requireNumber(value, field) {
|
|
4608
|
+
if (value === void 0) {
|
|
4609
|
+
throw new Error(`modulate_confidence requires ${field}`);
|
|
4610
|
+
}
|
|
4611
|
+
return value;
|
|
4612
|
+
}
|
|
4613
|
+
function assertProvenance(input) {
|
|
4614
|
+
if (!hasProvenance(input)) {
|
|
4615
|
+
throw new Error(
|
|
4616
|
+
"modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance"
|
|
4617
|
+
);
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
function hasProvenance(input) {
|
|
4621
|
+
return input.trigger === "backfill_synthetic" || Boolean(input.provenance && Object.values(input.provenance).some(Boolean)) || Boolean(input.triggeringEvidenceId) || Boolean(input.triggeringQuestionId) || Boolean(input.triggeringAnswerId) || Boolean(input.triggeringContradictionId) || Boolean(input.triggeringWorktreeId);
|
|
4622
|
+
}
|
|
4139
4623
|
|
|
4140
4624
|
// ../contracts/src/lens-workflow.contract.ts
|
|
4141
4625
|
var LENS_PERSPECTIVE_TYPES = [
|
|
@@ -4149,7 +4633,7 @@ var LENS_PERSPECTIVE_TYPES = [
|
|
|
4149
4633
|
// ../contracts/src/tool-contracts.ts
|
|
4150
4634
|
var CREATE_BELIEF = {
|
|
4151
4635
|
name: "create_belief",
|
|
4152
|
-
description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a
|
|
4636
|
+
description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
|
|
4153
4637
|
parameters: {
|
|
4154
4638
|
canonicalText: {
|
|
4155
4639
|
type: "string",
|
|
@@ -4161,7 +4645,7 @@ var CREATE_BELIEF = {
|
|
|
4161
4645
|
},
|
|
4162
4646
|
baseRate: {
|
|
4163
4647
|
type: "number",
|
|
4164
|
-
description: "
|
|
4648
|
+
description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
|
|
4165
4649
|
},
|
|
4166
4650
|
beliefType: {
|
|
4167
4651
|
type: "string",
|
|
@@ -4172,7 +4656,7 @@ var CREATE_BELIEF = {
|
|
|
4172
4656
|
description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
|
|
4173
4657
|
}
|
|
4174
4658
|
},
|
|
4175
|
-
required: ["canonicalText"
|
|
4659
|
+
required: ["canonicalText"],
|
|
4176
4660
|
response: {
|
|
4177
4661
|
description: "The created canonical belief record",
|
|
4178
4662
|
fields: {
|
|
@@ -4235,7 +4719,7 @@ var REFINE_BELIEF = {
|
|
|
4235
4719
|
};
|
|
4236
4720
|
var MODULATE_CONFIDENCE = {
|
|
4237
4721
|
name: "modulate_confidence",
|
|
4238
|
-
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. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction
|
|
4722
|
+
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. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Every modulation must cite a truth-bearing artifact: triggeringEvidenceId, triggeringQuestionId, triggeringAnswerId, triggeringContradictionId, or triggeringWorktreeId. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction.",
|
|
4239
4723
|
parameters: {
|
|
4240
4724
|
nodeId: { type: "string", description: "The belief to score" },
|
|
4241
4725
|
belief: {
|
|
@@ -4254,9 +4738,9 @@ var MODULATE_CONFIDENCE = {
|
|
|
4254
4738
|
type: "number",
|
|
4255
4739
|
description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
|
|
4256
4740
|
},
|
|
4257
|
-
|
|
4258
|
-
type: "
|
|
4259
|
-
description: "
|
|
4741
|
+
worktreeId: {
|
|
4742
|
+
type: "string",
|
|
4743
|
+
description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
|
|
4260
4744
|
},
|
|
4261
4745
|
trigger: {
|
|
4262
4746
|
type: "string",
|
|
@@ -4271,17 +4755,43 @@ var MODULATE_CONFIDENCE = {
|
|
|
4271
4755
|
"worktree_completed",
|
|
4272
4756
|
"fusion",
|
|
4273
4757
|
"discount",
|
|
4274
|
-
"deduction"
|
|
4275
|
-
"manual",
|
|
4276
|
-
"decay"
|
|
4758
|
+
"deduction"
|
|
4277
4759
|
]
|
|
4278
4760
|
},
|
|
4761
|
+
triggeringEvidenceId: {
|
|
4762
|
+
type: "string",
|
|
4763
|
+
description: "Evidence node that caused an evidence-triggered modulation"
|
|
4764
|
+
},
|
|
4765
|
+
triggeringQuestionId: {
|
|
4766
|
+
type: "string",
|
|
4767
|
+
description: "Answered question whose resolution supports this modulation"
|
|
4768
|
+
},
|
|
4769
|
+
triggeringAnswerId: {
|
|
4770
|
+
type: "string",
|
|
4771
|
+
description: "Answer node whose content supports this modulation"
|
|
4772
|
+
},
|
|
4773
|
+
triggeringContradictionId: {
|
|
4774
|
+
type: "string",
|
|
4775
|
+
description: "Contradiction record that caused a contradiction-triggered modulation"
|
|
4776
|
+
},
|
|
4777
|
+
triggeringWorktreeId: {
|
|
4778
|
+
type: "string",
|
|
4779
|
+
description: "Completed worktree whose outcome caused a worktree-triggered modulation"
|
|
4780
|
+
},
|
|
4279
4781
|
rationale: {
|
|
4280
4782
|
type: "string",
|
|
4281
4783
|
description: "Human-readable explanation of why confidence changed"
|
|
4282
4784
|
}
|
|
4283
4785
|
},
|
|
4284
|
-
required: [
|
|
4786
|
+
required: [
|
|
4787
|
+
"nodeId",
|
|
4788
|
+
"belief",
|
|
4789
|
+
"disbelief",
|
|
4790
|
+
"uncertainty",
|
|
4791
|
+
"baseRate",
|
|
4792
|
+
"trigger",
|
|
4793
|
+
"rationale"
|
|
4794
|
+
],
|
|
4285
4795
|
response: {
|
|
4286
4796
|
description: "Confidence modulation result",
|
|
4287
4797
|
fields: {
|
|
@@ -4475,7 +4985,7 @@ var ADD_EVIDENCE = {
|
|
|
4475
4985
|
description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
|
|
4476
4986
|
}
|
|
4477
4987
|
},
|
|
4478
|
-
required: ["canonicalText", "targetNodeId"],
|
|
4988
|
+
required: ["canonicalText", "targetNodeId", "reasoning"],
|
|
4479
4989
|
response: {
|
|
4480
4990
|
description: "The created evidence node and its edge",
|
|
4481
4991
|
fields: {
|
|
@@ -4556,9 +5066,21 @@ var ADD_WORKTREE = {
|
|
|
4556
5066
|
type: "string",
|
|
4557
5067
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
4558
5068
|
},
|
|
4559
|
-
|
|
5069
|
+
campaign: {
|
|
4560
5070
|
type: "number",
|
|
4561
|
-
description: "
|
|
5071
|
+
description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
|
|
5072
|
+
},
|
|
5073
|
+
lane: {
|
|
5074
|
+
type: "string",
|
|
5075
|
+
description: "GitButler-aligned workstream lane name inside the campaign."
|
|
5076
|
+
},
|
|
5077
|
+
laneOrderInCampaign: {
|
|
5078
|
+
type: "number",
|
|
5079
|
+
description: "Ordering for this lane within its campaign."
|
|
5080
|
+
},
|
|
5081
|
+
orderInLane: {
|
|
5082
|
+
type: "number",
|
|
5083
|
+
description: "Position of this worktree inside its lane."
|
|
4562
5084
|
},
|
|
4563
5085
|
dependsOn: {
|
|
4564
5086
|
type: "array",
|
|
@@ -5216,6 +5738,10 @@ var CREATE_EVIDENCE = {
|
|
|
5216
5738
|
type: "object",
|
|
5217
5739
|
description: "Optional metadata merged into the canonical evidence node"
|
|
5218
5740
|
},
|
|
5741
|
+
rationale: {
|
|
5742
|
+
type: "string",
|
|
5743
|
+
description: "Why this evidence should enter the reasoning graph"
|
|
5744
|
+
},
|
|
5219
5745
|
title: { type: "string", description: "Optional short title" },
|
|
5220
5746
|
content: { type: "string", description: "Optional long-form content" },
|
|
5221
5747
|
contentType: {
|
|
@@ -5224,7 +5750,7 @@ var CREATE_EVIDENCE = {
|
|
|
5224
5750
|
},
|
|
5225
5751
|
kind: { type: "string", description: "Optional evidence kind" }
|
|
5226
5752
|
},
|
|
5227
|
-
required: ["text"],
|
|
5753
|
+
required: ["text", "rationale"],
|
|
5228
5754
|
response: {
|
|
5229
5755
|
description: "The created canonical evidence record",
|
|
5230
5756
|
fields: {
|
|
@@ -5272,7 +5798,7 @@ var LIST_EVIDENCE = {
|
|
|
5272
5798
|
limit: { type: "number", description: "Max results" },
|
|
5273
5799
|
cursor: { type: "string", description: "Pagination cursor" }
|
|
5274
5800
|
},
|
|
5275
|
-
required: [],
|
|
5801
|
+
required: ["topicId"],
|
|
5276
5802
|
response: {
|
|
5277
5803
|
description: "Canonical evidence page",
|
|
5278
5804
|
fields: {
|
|
@@ -5457,6 +5983,7 @@ var ANSWER_QUESTION = {
|
|
|
5457
5983
|
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.",
|
|
5458
5984
|
parameters: {
|
|
5459
5985
|
id: { type: "string", description: "Canonical question ID" },
|
|
5986
|
+
topicId: { type: "string", description: "Topic scope for the answer" },
|
|
5460
5987
|
text: { type: "string", description: "Answer text" },
|
|
5461
5988
|
confidence: {
|
|
5462
5989
|
type: "string",
|
|
@@ -5469,7 +5996,7 @@ var ANSWER_QUESTION = {
|
|
|
5469
5996
|
},
|
|
5470
5997
|
rationale: { type: "string", description: "Why this answer is credible" }
|
|
5471
5998
|
},
|
|
5472
|
-
required: ["id", "text"],
|
|
5999
|
+
required: ["id", "topicId", "text"],
|
|
5473
6000
|
response: {
|
|
5474
6001
|
description: "Answer result",
|
|
5475
6002
|
fields: {
|
|
@@ -5688,6 +6215,10 @@ var LIST_BELIEFS = {
|
|
|
5688
6215
|
minConfidence: {
|
|
5689
6216
|
type: "number",
|
|
5690
6217
|
description: "Minimum confidence threshold"
|
|
6218
|
+
},
|
|
6219
|
+
limit: {
|
|
6220
|
+
type: "number",
|
|
6221
|
+
description: "Maximum results"
|
|
5691
6222
|
}
|
|
5692
6223
|
},
|
|
5693
6224
|
required: ["topicId"],
|
|
@@ -5704,20 +6235,37 @@ var LIST_BELIEFS = {
|
|
|
5704
6235
|
};
|
|
5705
6236
|
var LIST_WORKTREES = {
|
|
5706
6237
|
name: "list_worktrees",
|
|
5707
|
-
description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with
|
|
6238
|
+
description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with lifecycle phase, pipeline campaign/lane, status, and belief counts.",
|
|
5708
6239
|
parameters: {
|
|
5709
6240
|
topicId: { type: "string", description: "Topic scope" },
|
|
5710
6241
|
status: {
|
|
5711
6242
|
type: "string",
|
|
5712
6243
|
description: "Filter: active, merged, abandoned",
|
|
5713
6244
|
enum: ["active", "merged", "abandoned"]
|
|
6245
|
+
},
|
|
6246
|
+
groupBy: {
|
|
6247
|
+
type: "string",
|
|
6248
|
+
description: "Optional grouping mode for the response.",
|
|
6249
|
+
enum: ["campaign", "lane", "flat"]
|
|
6250
|
+
},
|
|
6251
|
+
lane: {
|
|
6252
|
+
type: "string",
|
|
6253
|
+
description: "Filter by GitButler-aligned lane name."
|
|
6254
|
+
},
|
|
6255
|
+
campaign: {
|
|
6256
|
+
type: "number",
|
|
6257
|
+
description: "Filter by top-level pipeline campaign number."
|
|
6258
|
+
},
|
|
6259
|
+
limit: {
|
|
6260
|
+
type: "number",
|
|
6261
|
+
description: "Maximum results to return."
|
|
5714
6262
|
}
|
|
5715
6263
|
},
|
|
5716
6264
|
required: ["topicId"],
|
|
5717
6265
|
response: {
|
|
5718
|
-
description: "Worktrees with phase, status, belief count, and creation time",
|
|
6266
|
+
description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
|
|
5719
6267
|
fields: {
|
|
5720
|
-
worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
|
|
6268
|
+
worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
|
|
5721
6269
|
}
|
|
5722
6270
|
},
|
|
5723
6271
|
ownerModule: "workflow-engine",
|
|
@@ -5726,7 +6274,7 @@ var LIST_WORKTREES = {
|
|
|
5726
6274
|
};
|
|
5727
6275
|
var LIST_ALL_WORKTREES = {
|
|
5728
6276
|
name: "list_all_worktrees",
|
|
5729
|
-
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
|
|
6277
|
+
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 campaign, lane, lane order, dependencies, and status. Supports filtering by status, lane, and campaign. This is the PM's primary pipeline query \u2014 one call, full picture.",
|
|
5730
6278
|
parameters: {
|
|
5731
6279
|
status: {
|
|
5732
6280
|
type: "string",
|
|
@@ -5744,13 +6292,18 @@ var LIST_ALL_WORKTREES = {
|
|
|
5744
6292
|
"dismissed"
|
|
5745
6293
|
]
|
|
5746
6294
|
},
|
|
5747
|
-
|
|
6295
|
+
lane: {
|
|
5748
6296
|
type: "string",
|
|
5749
|
-
description: "Filter by
|
|
6297
|
+
description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
|
|
5750
6298
|
},
|
|
5751
|
-
|
|
6299
|
+
campaign: {
|
|
5752
6300
|
type: "number",
|
|
5753
|
-
description: "Filter by
|
|
6301
|
+
description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
|
|
6302
|
+
},
|
|
6303
|
+
groupBy: {
|
|
6304
|
+
type: "string",
|
|
6305
|
+
description: "Optional grouping mode for the response.",
|
|
6306
|
+
enum: ["campaign", "lane", "flat"]
|
|
5754
6307
|
},
|
|
5755
6308
|
limit: {
|
|
5756
6309
|
type: "number",
|
|
@@ -5761,10 +6314,39 @@ var LIST_ALL_WORKTREES = {
|
|
|
5761
6314
|
response: {
|
|
5762
6315
|
description: "All worktrees across all topics with full pipeline metadata",
|
|
5763
6316
|
fields: {
|
|
5764
|
-
worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis,
|
|
6317
|
+
worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
|
|
5765
6318
|
total: "number \u2014 total count after filtering",
|
|
5766
|
-
|
|
5767
|
-
|
|
6319
|
+
lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
|
|
6320
|
+
campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
|
|
6321
|
+
}
|
|
6322
|
+
},
|
|
6323
|
+
ownerModule: "workflow-engine",
|
|
6324
|
+
ontologyPrimitive: "worktree",
|
|
6325
|
+
tier: "showcase"
|
|
6326
|
+
};
|
|
6327
|
+
var LIST_CAMPAIGNS = {
|
|
6328
|
+
name: "list_campaigns",
|
|
6329
|
+
description: "List compact pipeline campaigns with their nested lanes. Use this to see the top-level campaign > lane > worktree shape without pulling the full worktree inventory.",
|
|
6330
|
+
parameters: {
|
|
6331
|
+
topicId: {
|
|
6332
|
+
type: "string",
|
|
6333
|
+
description: "Optional topic scope."
|
|
6334
|
+
},
|
|
6335
|
+
status: {
|
|
6336
|
+
type: "string",
|
|
6337
|
+
description: "Optional worktree status filter before grouping campaigns and lanes."
|
|
6338
|
+
},
|
|
6339
|
+
limit: {
|
|
6340
|
+
type: "number",
|
|
6341
|
+
description: "Maximum worktrees to scan before grouping."
|
|
6342
|
+
}
|
|
6343
|
+
},
|
|
6344
|
+
required: [],
|
|
6345
|
+
response: {
|
|
6346
|
+
description: "Pipeline campaigns with nested lane summaries.",
|
|
6347
|
+
fields: {
|
|
6348
|
+
campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
|
|
6349
|
+
totalWorktrees: "number \u2014 total worktrees scanned after filtering"
|
|
5768
6350
|
}
|
|
5769
6351
|
},
|
|
5770
6352
|
ownerModule: "workflow-engine",
|
|
@@ -5827,16 +6409,28 @@ var UPDATE_WORKTREE_TARGETS = {
|
|
|
5827
6409
|
};
|
|
5828
6410
|
var UPDATE_WORKTREE_METADATA = {
|
|
5829
6411
|
name: "update_worktree_metadata",
|
|
5830
|
-
description: "Update worktree sequencing metadata \u2014
|
|
6412
|
+
description: "Update worktree sequencing metadata \u2014 campaign, lane, 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.",
|
|
5831
6413
|
parameters: {
|
|
5832
6414
|
worktreeId: { type: "string", description: "The worktree to update" },
|
|
5833
6415
|
hypothesis: {
|
|
5834
6416
|
type: "string",
|
|
5835
6417
|
description: "Testable claim this worktree investigates"
|
|
5836
6418
|
},
|
|
5837
|
-
|
|
6419
|
+
campaign: {
|
|
5838
6420
|
type: "number",
|
|
5839
|
-
description: "
|
|
6421
|
+
description: "Top-level pipeline campaign number."
|
|
6422
|
+
},
|
|
6423
|
+
lane: {
|
|
6424
|
+
type: "string",
|
|
6425
|
+
description: "GitButler-aligned workstream lane name inside the campaign."
|
|
6426
|
+
},
|
|
6427
|
+
laneOrderInCampaign: {
|
|
6428
|
+
type: "number",
|
|
6429
|
+
description: "Ordering for this lane within the campaign."
|
|
6430
|
+
},
|
|
6431
|
+
orderInLane: {
|
|
6432
|
+
type: "number",
|
|
6433
|
+
description: "Position of this worktree inside its lane."
|
|
5840
6434
|
},
|
|
5841
6435
|
dependsOn: {
|
|
5842
6436
|
type: "array",
|
|
@@ -5874,18 +6468,6 @@ var UPDATE_WORKTREE_METADATA = {
|
|
|
5874
6468
|
type: "object",
|
|
5875
6469
|
description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
|
|
5876
6470
|
},
|
|
5877
|
-
track: {
|
|
5878
|
-
type: "string",
|
|
5879
|
-
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."
|
|
5880
|
-
},
|
|
5881
|
-
trackPosition: {
|
|
5882
|
-
type: "number",
|
|
5883
|
-
description: "Position within the track (1-indexed). E.g., TC-A=1, TC-B=2, TC-C=3 within the 'tc-scope' track."
|
|
5884
|
-
},
|
|
5885
|
-
executionBand: {
|
|
5886
|
-
type: "number",
|
|
5887
|
-
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."
|
|
5888
|
-
},
|
|
5889
6471
|
status: {
|
|
5890
6472
|
type: "string",
|
|
5891
6473
|
description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
|
|
@@ -6255,6 +6837,10 @@ var LIST_TASKS = {
|
|
|
6255
6837
|
type: "string",
|
|
6256
6838
|
description: "Filter to tasks linked to this worktree"
|
|
6257
6839
|
},
|
|
6840
|
+
worktreeId: {
|
|
6841
|
+
type: "string",
|
|
6842
|
+
description: "Alias for linkedWorktreeId"
|
|
6843
|
+
},
|
|
6258
6844
|
status: {
|
|
6259
6845
|
type: "string",
|
|
6260
6846
|
description: "Filter by status: todo, in_progress, blocked, done",
|
|
@@ -6342,7 +6928,7 @@ var GET_TOPIC = {
|
|
|
6342
6928
|
description: "Legacy alias for topicId"
|
|
6343
6929
|
}
|
|
6344
6930
|
},
|
|
6345
|
-
required: [],
|
|
6931
|
+
required: ["topicId"],
|
|
6346
6932
|
response: {
|
|
6347
6933
|
description: "Single topic record",
|
|
6348
6934
|
fields: {
|
|
@@ -6697,7 +7283,7 @@ var GET_ONTOLOGY = {
|
|
|
6697
7283
|
description: "Tenant scope for key lookup. Omit for platform-level."
|
|
6698
7284
|
}
|
|
6699
7285
|
},
|
|
6700
|
-
required: [],
|
|
7286
|
+
required: ["id"],
|
|
6701
7287
|
response: {
|
|
6702
7288
|
description: "Ontology definition with latest published version",
|
|
6703
7289
|
fields: {
|
|
@@ -6764,7 +7350,7 @@ var MATCH_ENTITY_TYPE = {
|
|
|
6764
7350
|
description: "Optional maximum number of ranked matches to return"
|
|
6765
7351
|
}
|
|
6766
7352
|
},
|
|
6767
|
-
required: ["text"],
|
|
7353
|
+
required: ["text", "ontologyId"],
|
|
6768
7354
|
response: {
|
|
6769
7355
|
description: "Ranked ontology entity type matches",
|
|
6770
7356
|
fields: {
|
|
@@ -7018,7 +7604,7 @@ var RECORD_SCOPE_LEARNING = {
|
|
|
7018
7604
|
};
|
|
7019
7605
|
var PIPELINE_SNAPSHOT = {
|
|
7020
7606
|
name: "pipeline_snapshot",
|
|
7021
|
-
description: "Summarize a topic's worktree pipeline in
|
|
7607
|
+
description: "Summarize a topic's worktree pipeline in campaign-and-lane form. Like `git status --short` for Lucern execution \u2014 returns the hinge worktree, next planned wave, blockers, critical path, superseded work, and graph hygiene debt.",
|
|
7022
7608
|
parameters: {
|
|
7023
7609
|
topicId: { type: "string", description: "Topic scope ID" }
|
|
7024
7610
|
},
|
|
@@ -7028,14 +7614,14 @@ var PIPELINE_SNAPSHOT = {
|
|
|
7028
7614
|
fields: {
|
|
7029
7615
|
topicId: "string",
|
|
7030
7616
|
topicName: "string",
|
|
7031
|
-
|
|
7032
|
-
|
|
7617
|
+
currentCampaign: "number | null",
|
|
7618
|
+
nextCampaign: "number | null",
|
|
7033
7619
|
activeWorktrees: "array \u2014 current hinge worktree(s)",
|
|
7034
|
-
nextWave: "array \u2014 worktrees in the next planned
|
|
7620
|
+
nextWave: "array \u2014 worktrees in the next planned campaign",
|
|
7035
7621
|
readyNow: "array \u2014 planning worktrees with dependencies completed",
|
|
7036
7622
|
blockedBy: "array \u2014 grouped blockers",
|
|
7037
7623
|
criticalPath: "array \u2014 ordered incomplete worktree chain",
|
|
7038
|
-
|
|
7624
|
+
campaigns: "array \u2014 incomplete worktrees grouped by campaign",
|
|
7039
7625
|
superseded: "array \u2014 worktrees marked superseded or not for activation",
|
|
7040
7626
|
graphHygiene: "object \u2014 untargeted and taskless worktree debt",
|
|
7041
7627
|
riskQuestions: "array \u2014 critical/high open questions",
|
|
@@ -7624,6 +8210,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
7624
8210
|
list_beliefs: LIST_BELIEFS,
|
|
7625
8211
|
list_worktrees: LIST_WORKTREES,
|
|
7626
8212
|
list_all_worktrees: LIST_ALL_WORKTREES,
|
|
8213
|
+
list_campaigns: LIST_CAMPAIGNS,
|
|
7627
8214
|
activate_worktree: ACTIVATE_WORKTREE,
|
|
7628
8215
|
update_worktree_targets: UPDATE_WORKTREE_TARGETS,
|
|
7629
8216
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
@@ -7806,6 +8393,7 @@ var MCP_WORKFLOW_PLATFORM_OPERATION_NAMES = [
|
|
|
7806
8393
|
"activate_worktree",
|
|
7807
8394
|
"list_worktrees",
|
|
7808
8395
|
"list_all_worktrees",
|
|
8396
|
+
"list_campaigns",
|
|
7809
8397
|
"update_worktree_targets",
|
|
7810
8398
|
"update_worktree_metadata",
|
|
7811
8399
|
"create_task",
|
|
@@ -8013,6 +8601,7 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
8013
8601
|
|
|
8014
8602
|
// ../contracts/src/function-registry/helpers.ts
|
|
8015
8603
|
var jsonObjectSchema = z.record(z.unknown());
|
|
8604
|
+
var sdkSessionIdSchema = z.string().optional();
|
|
8016
8605
|
function mcpContractShape(contract) {
|
|
8017
8606
|
const required = new Set(contract.required);
|
|
8018
8607
|
return Object.fromEntries(
|
|
@@ -8047,10 +8636,40 @@ function argsSchemaFromMcpContract(contract) {
|
|
|
8047
8636
|
return z.object(mcpContractShape(contract));
|
|
8048
8637
|
}
|
|
8049
8638
|
function inputSchemaFromMcpContract(contract) {
|
|
8050
|
-
return argsSchemaFromMcpContract(contract)
|
|
8639
|
+
return withInternalSurfaceFields(argsSchemaFromMcpContract(contract));
|
|
8640
|
+
}
|
|
8641
|
+
function withInternalSurfaceFields(schema) {
|
|
8642
|
+
return schema.extend({ __sdkSessionId: sdkSessionIdSchema }).strict();
|
|
8643
|
+
}
|
|
8644
|
+
function normalizeInputSchema(schema) {
|
|
8645
|
+
if (schema instanceof z.ZodObject) {
|
|
8646
|
+
return withInternalSurfaceFields(schema);
|
|
8647
|
+
}
|
|
8648
|
+
return schema;
|
|
8649
|
+
}
|
|
8650
|
+
function unwrapObjectSchema(schema) {
|
|
8651
|
+
let current = schema;
|
|
8652
|
+
while (true) {
|
|
8653
|
+
switch (current._def.typeName) {
|
|
8654
|
+
case z.ZodFirstPartyTypeKind.ZodEffects:
|
|
8655
|
+
current = current._def.schema;
|
|
8656
|
+
continue;
|
|
8657
|
+
case z.ZodFirstPartyTypeKind.ZodBranded:
|
|
8658
|
+
current = current._def.type;
|
|
8659
|
+
continue;
|
|
8660
|
+
default:
|
|
8661
|
+
return current instanceof z.ZodObject ? current : void 0;
|
|
8662
|
+
}
|
|
8663
|
+
}
|
|
8051
8664
|
}
|
|
8052
8665
|
function getObjectShape(schema) {
|
|
8053
|
-
const
|
|
8666
|
+
const objectSchema = unwrapObjectSchema(schema);
|
|
8667
|
+
if (!objectSchema) {
|
|
8668
|
+
throw new Error(
|
|
8669
|
+
`Expected a Zod object schema, received ${schema._def.typeName}.`
|
|
8670
|
+
);
|
|
8671
|
+
}
|
|
8672
|
+
const shape = typeof objectSchema._def.shape === "function" ? objectSchema._def.shape() : objectSchema._def.shape;
|
|
8054
8673
|
return shape;
|
|
8055
8674
|
}
|
|
8056
8675
|
function unwrapMcpParameterSchema(schema) {
|
|
@@ -8071,6 +8690,9 @@ function unwrapMcpParameterSchema(schema) {
|
|
|
8071
8690
|
case z.ZodFirstPartyTypeKind.ZodBranded:
|
|
8072
8691
|
current = current._def.type;
|
|
8073
8692
|
continue;
|
|
8693
|
+
case z.ZodFirstPartyTypeKind.ZodEffects:
|
|
8694
|
+
current = current._def.schema;
|
|
8695
|
+
continue;
|
|
8074
8696
|
default:
|
|
8075
8697
|
return { schema: current, required, description: description ?? current.description };
|
|
8076
8698
|
}
|
|
@@ -8090,6 +8712,7 @@ function mcpParameterFromZod(fieldName, schema, contractName) {
|
|
|
8090
8712
|
return { parameter: { type: "array", description }, required };
|
|
8091
8713
|
case z.ZodFirstPartyTypeKind.ZodObject:
|
|
8092
8714
|
case z.ZodFirstPartyTypeKind.ZodRecord:
|
|
8715
|
+
case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
8093
8716
|
return { parameter: { type: "object", description }, required };
|
|
8094
8717
|
case z.ZodFirstPartyTypeKind.ZodEnum:
|
|
8095
8718
|
return {
|
|
@@ -8151,6 +8774,14 @@ function withCreatedBy(input, context) {
|
|
|
8151
8774
|
createdBy: typeof input.createdBy === "string" ? input.createdBy : authUserId(context)
|
|
8152
8775
|
};
|
|
8153
8776
|
}
|
|
8777
|
+
function compactRecord4(input) {
|
|
8778
|
+
return Object.fromEntries(
|
|
8779
|
+
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
8780
|
+
);
|
|
8781
|
+
}
|
|
8782
|
+
function recordValue2(value) {
|
|
8783
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
8784
|
+
}
|
|
8154
8785
|
function surfaceMcpContract(name) {
|
|
8155
8786
|
const contract = MCP_TOOL_CONTRACTS[name];
|
|
8156
8787
|
if (!contract) {
|
|
@@ -8195,7 +8826,9 @@ function surfaceContract(args) {
|
|
|
8195
8826
|
const canonicalArgs = args.args ?? argsSchemaFromMcpContract(baseMcp);
|
|
8196
8827
|
const mcp = args.args ? mcpContractFromArgsSchema(baseMcp, canonicalArgs, args.name) : baseMcp;
|
|
8197
8828
|
const canonicalReturns = args.returns ?? jsonObjectSchema;
|
|
8198
|
-
const input =
|
|
8829
|
+
const input = normalizeInputSchema(
|
|
8830
|
+
args.input ?? inputSchemaFromMcpContract(mcp)
|
|
8831
|
+
);
|
|
8199
8832
|
const output = args.output ?? canonicalReturns;
|
|
8200
8833
|
return defineFunctionContract({
|
|
8201
8834
|
name: args.name,
|
|
@@ -8257,20 +8890,26 @@ function assertSurfaceCoverage(contracts) {
|
|
|
8257
8890
|
|
|
8258
8891
|
// ../contracts/src/function-registry/context.ts
|
|
8259
8892
|
var observationInput = (input, context) => withUserId(
|
|
8260
|
-
{
|
|
8261
|
-
|
|
8893
|
+
compactRecord4({
|
|
8894
|
+
projectId: input.projectId,
|
|
8895
|
+
topicId: input.topicId,
|
|
8262
8896
|
text: input.text ?? input.summary,
|
|
8263
8897
|
title: input.title ?? input.summary,
|
|
8264
8898
|
content: input.content ?? input.summary,
|
|
8899
|
+
contentType: input.contentType,
|
|
8265
8900
|
kind: input.kind ?? input.observationType ?? "observation",
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8901
|
+
tags: input.tags,
|
|
8902
|
+
sourceType: input.sourceType,
|
|
8903
|
+
externalSourceType: input.externalSourceType,
|
|
8904
|
+
sourceUrl: input.sourceUrl,
|
|
8905
|
+
metadata: compactRecord4({
|
|
8906
|
+
...recordValue2(input.metadata),
|
|
8269
8907
|
observationType: input.observationType,
|
|
8270
8908
|
source: input.source
|
|
8271
|
-
},
|
|
8909
|
+
}),
|
|
8910
|
+
rationale: input.rationale ?? input.reasoning ?? input.summary ?? input.text ?? "Recorded observation",
|
|
8272
8911
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
8273
|
-
},
|
|
8912
|
+
}),
|
|
8274
8913
|
context
|
|
8275
8914
|
);
|
|
8276
8915
|
var contextContracts = [
|
|
@@ -8322,7 +8961,13 @@ var contextContracts = [
|
|
|
8322
8961
|
convex: {
|
|
8323
8962
|
module: "evidence",
|
|
8324
8963
|
functionName: "getByTopic",
|
|
8325
|
-
kind: "query"
|
|
8964
|
+
kind: "query",
|
|
8965
|
+
inputProjection: (input) => compactRecord4({
|
|
8966
|
+
topicId: input.topicId,
|
|
8967
|
+
limit: input.limit,
|
|
8968
|
+
status: input.status,
|
|
8969
|
+
userId: input.userId
|
|
8970
|
+
})
|
|
8326
8971
|
}
|
|
8327
8972
|
})
|
|
8328
8973
|
];
|
|
@@ -8388,42 +9033,62 @@ var identityContracts = [
|
|
|
8388
9033
|
];
|
|
8389
9034
|
|
|
8390
9035
|
// ../contracts/src/function-registry/beliefs.ts
|
|
8391
|
-
var
|
|
8392
|
-
...input,
|
|
9036
|
+
var beliefLookupInput = (input) => compactRecord4({
|
|
8393
9037
|
nodeId: input.nodeId ?? input.id ?? input.beliefId,
|
|
8394
|
-
beliefId: input.beliefId
|
|
9038
|
+
beliefId: input.beliefId
|
|
8395
9039
|
});
|
|
8396
|
-
var
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
);
|
|
9040
|
+
var beliefNodeInput = (input) => compactRecord4({
|
|
9041
|
+
nodeId: input.nodeId ?? input.id ?? input.beliefId
|
|
9042
|
+
});
|
|
9043
|
+
var beliefTopicInput = (input) => {
|
|
9044
|
+
const parsed = listBeliefsProjection.inputSchema.safeParse(input);
|
|
9045
|
+
if (!parsed.success) {
|
|
9046
|
+
throw new Error(
|
|
9047
|
+
`list_beliefs projection input rejected: ${parsed.error.message}`
|
|
9048
|
+
);
|
|
9049
|
+
}
|
|
9050
|
+
return compactRecord4(listBeliefsProjection.project(parsed.data));
|
|
9051
|
+
};
|
|
9052
|
+
var createBeliefInput = (input, context) => {
|
|
9053
|
+
return withUserId(
|
|
9054
|
+
compactRecord4({
|
|
9055
|
+
projectId: input.projectId,
|
|
9056
|
+
topicId: input.topicId,
|
|
9057
|
+
formulation: input.formulation ?? input.canonicalText,
|
|
9058
|
+
beliefType: input.beliefType,
|
|
9059
|
+
rationale: input.rationale,
|
|
9060
|
+
pillar: input.pillar,
|
|
9061
|
+
worktreeId: input.worktreeId,
|
|
9062
|
+
sourceBeliefIds: input.sourceBeliefIds,
|
|
9063
|
+
sourceType: input.sourceType,
|
|
9064
|
+
reversibility: input.reversibility,
|
|
9065
|
+
predictionMeta: input.predictionMeta,
|
|
9066
|
+
baseRate: input.baseRate ?? 0.5,
|
|
9067
|
+
metadata: input.metadata,
|
|
9068
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
9069
|
+
}),
|
|
9070
|
+
context
|
|
9071
|
+
);
|
|
9072
|
+
};
|
|
8405
9073
|
var forkBeliefInput = (input, context) => withUserId(
|
|
8406
|
-
{
|
|
8407
|
-
...input,
|
|
9074
|
+
compactRecord4({
|
|
8408
9075
|
parentNodeId: input.parentNodeId ?? input.nodeId ?? input.id,
|
|
9076
|
+
newFormulation: input.newFormulation,
|
|
9077
|
+
forkReason: input.forkReason,
|
|
9078
|
+
rationale: input.rationale,
|
|
8409
9079
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
8410
|
-
},
|
|
9080
|
+
}),
|
|
8411
9081
|
context
|
|
8412
9082
|
);
|
|
8413
9083
|
var confidenceInput = (input, context) => {
|
|
8414
|
-
const
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
9084
|
+
const parsed = modulateConfidenceProjection.inputSchema.safeParse(input);
|
|
9085
|
+
if (!parsed.success) {
|
|
9086
|
+
throw new Error(
|
|
9087
|
+
`modulate_confidence projection input rejected: ${parsed.error.message}`
|
|
9088
|
+
);
|
|
9089
|
+
}
|
|
8418
9090
|
return withUserId(
|
|
8419
|
-
|
|
8420
|
-
...input,
|
|
8421
|
-
belief,
|
|
8422
|
-
disbelief,
|
|
8423
|
-
uncertainty,
|
|
8424
|
-
baseRate: input.baseRate ?? 0.5,
|
|
8425
|
-
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
8426
|
-
},
|
|
9091
|
+
compactRecord4(modulateConfidenceProjection.project(parsed.data)),
|
|
8427
9092
|
context
|
|
8428
9093
|
);
|
|
8429
9094
|
};
|
|
@@ -8458,7 +9123,7 @@ var beliefsContracts = [
|
|
|
8458
9123
|
module: "beliefs",
|
|
8459
9124
|
functionName: "getById",
|
|
8460
9125
|
kind: "query",
|
|
8461
|
-
inputProjection:
|
|
9126
|
+
inputProjection: beliefLookupInput
|
|
8462
9127
|
}
|
|
8463
9128
|
}),
|
|
8464
9129
|
surfaceContract({
|
|
@@ -8474,8 +9139,10 @@ var beliefsContracts = [
|
|
|
8474
9139
|
convex: {
|
|
8475
9140
|
module: "beliefs",
|
|
8476
9141
|
functionName: "getByTopic",
|
|
8477
|
-
kind: "query"
|
|
8478
|
-
|
|
9142
|
+
kind: "query",
|
|
9143
|
+
inputProjection: beliefTopicInput
|
|
9144
|
+
},
|
|
9145
|
+
args: listBeliefsInputSchema
|
|
8479
9146
|
}),
|
|
8480
9147
|
surfaceContract({
|
|
8481
9148
|
name: "refine_belief",
|
|
@@ -8493,7 +9160,7 @@ var beliefsContracts = [
|
|
|
8493
9160
|
kind: "mutation",
|
|
8494
9161
|
inputProjection: (input, context) => withUserId(
|
|
8495
9162
|
{
|
|
8496
|
-
...
|
|
9163
|
+
...beliefLookupInput(input),
|
|
8497
9164
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
8498
9165
|
},
|
|
8499
9166
|
context
|
|
@@ -8514,7 +9181,8 @@ var beliefsContracts = [
|
|
|
8514
9181
|
functionName: "modulateConfidence",
|
|
8515
9182
|
kind: "mutation",
|
|
8516
9183
|
inputProjection: confidenceInput
|
|
8517
|
-
}
|
|
9184
|
+
},
|
|
9185
|
+
args: modulateConfidenceInputSchema
|
|
8518
9186
|
}),
|
|
8519
9187
|
surfaceContract({
|
|
8520
9188
|
name: "fork_belief",
|
|
@@ -8547,10 +9215,10 @@ var beliefsContracts = [
|
|
|
8547
9215
|
functionName: "archive",
|
|
8548
9216
|
kind: "mutation",
|
|
8549
9217
|
inputProjection: (input, context) => withUserId(
|
|
8550
|
-
{
|
|
8551
|
-
...
|
|
9218
|
+
compactRecord4({
|
|
9219
|
+
...beliefNodeInput(input),
|
|
8552
9220
|
reason: input.reason ?? input.rationale
|
|
8553
|
-
},
|
|
9221
|
+
}),
|
|
8554
9222
|
context
|
|
8555
9223
|
)
|
|
8556
9224
|
}
|
|
@@ -8568,10 +9236,12 @@ var beliefsContracts = [
|
|
|
8568
9236
|
module: "nodes",
|
|
8569
9237
|
functionName: "search",
|
|
8570
9238
|
kind: "query",
|
|
8571
|
-
inputProjection: (input) => ({
|
|
8572
|
-
...input,
|
|
9239
|
+
inputProjection: (input) => compactRecord4({
|
|
8573
9240
|
searchQuery: input.searchQuery ?? input.query,
|
|
8574
|
-
|
|
9241
|
+
projectId: input.projectId,
|
|
9242
|
+
topicId: input.topicId,
|
|
9243
|
+
nodeType: "belief",
|
|
9244
|
+
limit: input.limit
|
|
8575
9245
|
})
|
|
8576
9246
|
}
|
|
8577
9247
|
}),
|
|
@@ -8588,7 +9258,7 @@ var beliefsContracts = [
|
|
|
8588
9258
|
module: "beliefs",
|
|
8589
9259
|
functionName: "getConfidenceHistory",
|
|
8590
9260
|
kind: "query",
|
|
8591
|
-
inputProjection:
|
|
9261
|
+
inputProjection: beliefNodeInput
|
|
8592
9262
|
}
|
|
8593
9263
|
}),
|
|
8594
9264
|
surfaceContract({
|
|
@@ -8605,25 +9275,69 @@ var beliefsContracts = [
|
|
|
8605
9275
|
module: "beliefs",
|
|
8606
9276
|
functionName: "getConfidenceHistory",
|
|
8607
9277
|
kind: "query",
|
|
8608
|
-
inputProjection:
|
|
9278
|
+
inputProjection: beliefNodeInput
|
|
8609
9279
|
}
|
|
8610
9280
|
})
|
|
8611
9281
|
];
|
|
8612
9282
|
|
|
8613
9283
|
// ../contracts/src/function-registry/evidence.ts
|
|
8614
|
-
var evidenceIdInput = (input) => ({
|
|
8615
|
-
|
|
8616
|
-
|
|
9284
|
+
var evidenceIdInput = (input) => compactRecord4({
|
|
9285
|
+
evidenceId: input.evidenceId,
|
|
9286
|
+
insightId: input.insightId,
|
|
8617
9287
|
nodeId: input.nodeId ?? input.id ?? input.evidenceId
|
|
8618
9288
|
});
|
|
8619
|
-
var
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
9289
|
+
var evidenceTopicInput = (input) => compactRecord4({
|
|
9290
|
+
topicId: input.topicId,
|
|
9291
|
+
status: input.status,
|
|
9292
|
+
userId: input.userId,
|
|
9293
|
+
limit: input.limit
|
|
9294
|
+
});
|
|
9295
|
+
var createEvidenceInput = (input, context) => {
|
|
9296
|
+
const parsed = createEvidenceProjection.inputSchema.safeParse(input);
|
|
9297
|
+
if (!parsed.success) {
|
|
9298
|
+
throw new Error(
|
|
9299
|
+
`create_evidence projection input rejected: ${parsed.error.message}`
|
|
9300
|
+
);
|
|
9301
|
+
}
|
|
9302
|
+
return withUserId(
|
|
9303
|
+
compactRecord4(createEvidenceProjection.project(parsed.data)),
|
|
9304
|
+
context
|
|
9305
|
+
);
|
|
9306
|
+
};
|
|
9307
|
+
var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
9308
|
+
compactRecord4({
|
|
9309
|
+
fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
9310
|
+
toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
|
|
9311
|
+
edgeType: "evidence_supports_belief",
|
|
9312
|
+
globalId: input.globalId ?? `edge:${String(
|
|
9313
|
+
input.insightId ?? input.evidenceNodeId ?? input.evidenceId
|
|
9314
|
+
)}:${String(
|
|
9315
|
+
input.beliefNodeId ?? input.beliefId ?? input.targetId
|
|
9316
|
+
)}:evidence_supports_belief`,
|
|
9317
|
+
weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
|
|
9318
|
+
context: input.rationale ?? input.context,
|
|
9319
|
+
skipLayerValidation: true,
|
|
9320
|
+
topicId: input.topicId,
|
|
8625
9321
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
8626
|
-
},
|
|
9322
|
+
}),
|
|
9323
|
+
context
|
|
9324
|
+
);
|
|
9325
|
+
var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
|
|
9326
|
+
compactRecord4({
|
|
9327
|
+
fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
9328
|
+
toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
|
|
9329
|
+
edgeType: "evidence_supports_question",
|
|
9330
|
+
globalId: input.globalId ?? `edge:${String(
|
|
9331
|
+
input.insightId ?? input.evidenceNodeId ?? input.evidenceId
|
|
9332
|
+
)}:${String(
|
|
9333
|
+
input.questionId ?? input.questionNodeId ?? input.targetId
|
|
9334
|
+
)}:evidence_supports_question`,
|
|
9335
|
+
weight: input.impactScore ?? input.weight,
|
|
9336
|
+
context: input.rationale ?? input.context,
|
|
9337
|
+
skipLayerValidation: true,
|
|
9338
|
+
topicId: input.topicId,
|
|
9339
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
9340
|
+
}),
|
|
8627
9341
|
context
|
|
8628
9342
|
);
|
|
8629
9343
|
var evidenceContracts = [
|
|
@@ -8667,8 +9381,9 @@ var evidenceContracts = [
|
|
|
8667
9381
|
linkedBeliefNodeId: input.linkedBeliefNodeId ?? input.targetNodeId ?? input.targetId,
|
|
8668
9382
|
evidenceRelation: weight < 0 ? "contradicts" : "supports",
|
|
8669
9383
|
confidence: Math.min(1, Math.max(0, Math.abs(weight))),
|
|
9384
|
+
rationale: input.reasoning,
|
|
8670
9385
|
metadata: {
|
|
8671
|
-
...
|
|
9386
|
+
...recordValue2(input.metadata),
|
|
8672
9387
|
reasoning: input.reasoning,
|
|
8673
9388
|
sourceUrl: input.sourceUrl
|
|
8674
9389
|
}
|
|
@@ -8708,7 +9423,8 @@ var evidenceContracts = [
|
|
|
8708
9423
|
convex: {
|
|
8709
9424
|
module: "evidence",
|
|
8710
9425
|
functionName: "getByTopic",
|
|
8711
|
-
kind: "query"
|
|
9426
|
+
kind: "query",
|
|
9427
|
+
inputProjection: evidenceTopicInput
|
|
8712
9428
|
}
|
|
8713
9429
|
}),
|
|
8714
9430
|
surfaceContract({
|
|
@@ -8724,10 +9440,12 @@ var evidenceContracts = [
|
|
|
8724
9440
|
module: "nodes",
|
|
8725
9441
|
functionName: "search",
|
|
8726
9442
|
kind: "query",
|
|
8727
|
-
inputProjection: (input) => ({
|
|
8728
|
-
...input,
|
|
9443
|
+
inputProjection: (input) => compactRecord4({
|
|
8729
9444
|
searchQuery: input.searchQuery ?? input.q ?? input.query,
|
|
8730
|
-
|
|
9445
|
+
projectId: input.projectId,
|
|
9446
|
+
topicId: input.topicId,
|
|
9447
|
+
nodeType: "evidence",
|
|
9448
|
+
limit: input.limit
|
|
8731
9449
|
})
|
|
8732
9450
|
}
|
|
8733
9451
|
}),
|
|
@@ -8741,17 +9459,10 @@ var evidenceContracts = [
|
|
|
8741
9459
|
sdkMethod: "linkEvidenceToBelief",
|
|
8742
9460
|
summary: "Link evidence to a belief.",
|
|
8743
9461
|
convex: {
|
|
8744
|
-
module: "
|
|
8745
|
-
functionName: "
|
|
9462
|
+
module: "edges",
|
|
9463
|
+
functionName: "create",
|
|
8746
9464
|
kind: "mutation",
|
|
8747
|
-
inputProjection:
|
|
8748
|
-
{
|
|
8749
|
-
...input,
|
|
8750
|
-
beliefNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
|
|
8751
|
-
evidenceNodeId: input.evidenceNodeId ?? input.evidenceId
|
|
8752
|
-
},
|
|
8753
|
-
context
|
|
8754
|
-
)
|
|
9465
|
+
inputProjection: linkEvidenceToBeliefEdgeInput
|
|
8755
9466
|
}
|
|
8756
9467
|
}),
|
|
8757
9468
|
surfaceContract({
|
|
@@ -8764,18 +9475,10 @@ var evidenceContracts = [
|
|
|
8764
9475
|
sdkMethod: "linkEvidenceToQuestion",
|
|
8765
9476
|
summary: "Link evidence to a question.",
|
|
8766
9477
|
convex: {
|
|
8767
|
-
module: "
|
|
9478
|
+
module: "edges",
|
|
8768
9479
|
functionName: "create",
|
|
8769
9480
|
kind: "mutation",
|
|
8770
|
-
inputProjection:
|
|
8771
|
-
{
|
|
8772
|
-
...input,
|
|
8773
|
-
questionId: input.questionId,
|
|
8774
|
-
insightId: input.insightId ?? input.evidenceId,
|
|
8775
|
-
helpsAnswer: input.helpsAnswer ?? true
|
|
8776
|
-
},
|
|
8777
|
-
context
|
|
8778
|
-
)
|
|
9481
|
+
inputProjection: linkEvidenceToQuestionEdgeInput
|
|
8779
9482
|
}
|
|
8780
9483
|
}),
|
|
8781
9484
|
surfaceContract({
|
|
@@ -8788,35 +9491,46 @@ var evidenceContracts = [
|
|
|
8788
9491
|
sdkMethod: "linkEvidence",
|
|
8789
9492
|
summary: "Link evidence to a target node.",
|
|
8790
9493
|
convex: {
|
|
8791
|
-
module: "
|
|
8792
|
-
functionName: "
|
|
9494
|
+
module: "edges",
|
|
9495
|
+
functionName: "create",
|
|
8793
9496
|
kind: "mutation",
|
|
8794
|
-
inputProjection:
|
|
8795
|
-
{
|
|
8796
|
-
...input,
|
|
8797
|
-
beliefNodeId: input.beliefNodeId ?? input.targetId,
|
|
8798
|
-
evidenceNodeId: input.evidenceNodeId ?? input.evidenceId
|
|
8799
|
-
},
|
|
8800
|
-
context
|
|
8801
|
-
)
|
|
9497
|
+
inputProjection: linkEvidenceToBeliefEdgeInput
|
|
8802
9498
|
}
|
|
8803
9499
|
})
|
|
8804
9500
|
];
|
|
8805
9501
|
|
|
8806
9502
|
// ../contracts/src/function-registry/questions.ts
|
|
8807
|
-
var
|
|
8808
|
-
|
|
8809
|
-
questionId: input.questionId
|
|
8810
|
-
nodeId: input.nodeId ?? input.id ?? input.questionId
|
|
9503
|
+
var questionNodeInput = (input) => compactRecord4({
|
|
9504
|
+
nodeId: input.nodeId ?? input.id ?? input.questionId,
|
|
9505
|
+
questionId: input.questionId
|
|
8811
9506
|
});
|
|
8812
|
-
var
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
9507
|
+
var questionTopicInput = (input) => compactRecord4({
|
|
9508
|
+
topicId: input.topicId,
|
|
9509
|
+
status: input.status,
|
|
9510
|
+
userId: input.userId,
|
|
9511
|
+
limit: input.limit
|
|
9512
|
+
});
|
|
9513
|
+
var createQuestionInput = (input, context) => {
|
|
9514
|
+
const priority = input.priority === "urgent" ? "high" : input.priority;
|
|
9515
|
+
return withUserId(
|
|
9516
|
+
compactRecord4({
|
|
9517
|
+
topicId: input.topicId,
|
|
9518
|
+
question: input.question ?? input.text,
|
|
9519
|
+
category: input.category,
|
|
9520
|
+
priority,
|
|
9521
|
+
source: input.source,
|
|
9522
|
+
linkedBeliefNodeId: input.linkedBeliefNodeId ?? input.linkedBeliefId,
|
|
9523
|
+
testType: input.testType,
|
|
9524
|
+
importance: input.importance,
|
|
9525
|
+
epistemicUnlock: input.epistemicUnlock,
|
|
9526
|
+
sourceQuestionIds: input.sourceQuestionIds,
|
|
9527
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
9528
|
+
questionType: input.questionType,
|
|
9529
|
+
questionPriority: input.questionPriority
|
|
9530
|
+
}),
|
|
9531
|
+
context
|
|
9532
|
+
);
|
|
9533
|
+
};
|
|
8820
9534
|
var questionsContracts = [
|
|
8821
9535
|
surfaceContract({
|
|
8822
9536
|
name: "create_question",
|
|
@@ -8848,7 +9562,7 @@ var questionsContracts = [
|
|
|
8848
9562
|
module: "questions",
|
|
8849
9563
|
functionName: "getById",
|
|
8850
9564
|
kind: "query",
|
|
8851
|
-
inputProjection:
|
|
9565
|
+
inputProjection: questionNodeInput
|
|
8852
9566
|
}
|
|
8853
9567
|
}),
|
|
8854
9568
|
surfaceContract({
|
|
@@ -8864,7 +9578,8 @@ var questionsContracts = [
|
|
|
8864
9578
|
convex: {
|
|
8865
9579
|
module: "questions",
|
|
8866
9580
|
functionName: "getByTopic",
|
|
8867
|
-
kind: "query"
|
|
9581
|
+
kind: "query",
|
|
9582
|
+
inputProjection: questionTopicInput
|
|
8868
9583
|
}
|
|
8869
9584
|
}),
|
|
8870
9585
|
surfaceContract({
|
|
@@ -8881,7 +9596,12 @@ var questionsContracts = [
|
|
|
8881
9596
|
module: "questions",
|
|
8882
9597
|
functionName: "updateQuestion",
|
|
8883
9598
|
kind: "mutation",
|
|
8884
|
-
inputProjection: (input
|
|
9599
|
+
inputProjection: (input) => compactRecord4({
|
|
9600
|
+
questionId: input.questionId ?? input.id ?? input.nodeId,
|
|
9601
|
+
question: input.question ?? input.text,
|
|
9602
|
+
category: input.category,
|
|
9603
|
+
priority: input.priority
|
|
9604
|
+
})
|
|
8885
9605
|
}
|
|
8886
9606
|
}),
|
|
8887
9607
|
surfaceContract({
|
|
@@ -8898,7 +9618,16 @@ var questionsContracts = [
|
|
|
8898
9618
|
module: "questions",
|
|
8899
9619
|
functionName: "updateStatus",
|
|
8900
9620
|
kind: "mutation",
|
|
8901
|
-
inputProjection: (input, context) => withUserId(
|
|
9621
|
+
inputProjection: (input, context) => withUserId(
|
|
9622
|
+
compactRecord4({
|
|
9623
|
+
questionId: input.questionId ?? input.id,
|
|
9624
|
+
nodeId: input.nodeId,
|
|
9625
|
+
status: input.status,
|
|
9626
|
+
answer: input.answer,
|
|
9627
|
+
answerStatus: input.answerStatus
|
|
9628
|
+
}),
|
|
9629
|
+
context
|
|
9630
|
+
)
|
|
8902
9631
|
}
|
|
8903
9632
|
}),
|
|
8904
9633
|
surfaceContract({
|
|
@@ -8915,7 +9644,12 @@ var questionsContracts = [
|
|
|
8915
9644
|
module: "questions",
|
|
8916
9645
|
functionName: "deleteQuestion",
|
|
8917
9646
|
kind: "mutation",
|
|
8918
|
-
inputProjection:
|
|
9647
|
+
inputProjection: (input, context) => withUserId(
|
|
9648
|
+
compactRecord4({
|
|
9649
|
+
questionId: input.questionId ?? input.id ?? input.nodeId
|
|
9650
|
+
}),
|
|
9651
|
+
context
|
|
9652
|
+
)
|
|
8919
9653
|
}
|
|
8920
9654
|
}),
|
|
8921
9655
|
surfaceContract({
|
|
@@ -8932,10 +9666,16 @@ var questionsContracts = [
|
|
|
8932
9666
|
functionName: "create",
|
|
8933
9667
|
kind: "mutation",
|
|
8934
9668
|
inputProjection: (input, context) => withUserId(
|
|
8935
|
-
{
|
|
8936
|
-
|
|
8937
|
-
questionNodeId: input.questionNodeId ?? input.questionId
|
|
8938
|
-
|
|
9669
|
+
compactRecord4({
|
|
9670
|
+
topicId: input.topicId,
|
|
9671
|
+
questionNodeId: input.questionNodeId ?? input.questionId,
|
|
9672
|
+
answerText: input.answerText,
|
|
9673
|
+
confidence: input.confidence,
|
|
9674
|
+
evidenceNodeIds: input.evidenceNodeIds,
|
|
9675
|
+
answerSource: input.answerSource,
|
|
9676
|
+
worktreeId: input.worktreeId,
|
|
9677
|
+
sprintId: input.sprintId
|
|
9678
|
+
}),
|
|
8939
9679
|
context
|
|
8940
9680
|
)
|
|
8941
9681
|
}
|
|
@@ -8955,13 +9695,16 @@ var questionsContracts = [
|
|
|
8955
9695
|
functionName: "create",
|
|
8956
9696
|
kind: "mutation",
|
|
8957
9697
|
inputProjection: (input, context) => withUserId(
|
|
8958
|
-
{
|
|
8959
|
-
|
|
9698
|
+
compactRecord4({
|
|
9699
|
+
topicId: input.topicId,
|
|
8960
9700
|
questionNodeId: input.questionNodeId ?? input.questionId ?? input.id,
|
|
8961
9701
|
answerText: input.answerText ?? input.text,
|
|
8962
9702
|
evidenceNodeIds: input.evidenceNodeIds ?? input.evidenceIds,
|
|
8963
|
-
answerSource: input.answerSource ?? "human"
|
|
8964
|
-
|
|
9703
|
+
answerSource: input.answerSource ?? "human",
|
|
9704
|
+
confidence: input.confidence,
|
|
9705
|
+
worktreeId: input.worktreeId,
|
|
9706
|
+
sprintId: input.sprintId
|
|
9707
|
+
}),
|
|
8965
9708
|
context
|
|
8966
9709
|
)
|
|
8967
9710
|
}
|
|
@@ -8994,7 +9737,8 @@ var questionsContracts = [
|
|
|
8994
9737
|
convex: {
|
|
8995
9738
|
module: "questions",
|
|
8996
9739
|
functionName: "getByTopic",
|
|
8997
|
-
kind: "query"
|
|
9740
|
+
kind: "query",
|
|
9741
|
+
inputProjection: questionTopicInput
|
|
8998
9742
|
}
|
|
8999
9743
|
}),
|
|
9000
9744
|
surfaceContract({
|
|
@@ -9009,7 +9753,11 @@ var questionsContracts = [
|
|
|
9009
9753
|
convex: {
|
|
9010
9754
|
module: "questions",
|
|
9011
9755
|
functionName: "getByTopic",
|
|
9012
|
-
kind: "query"
|
|
9756
|
+
kind: "query",
|
|
9757
|
+
inputProjection: (input) => compactRecord4({
|
|
9758
|
+
...questionTopicInput(input),
|
|
9759
|
+
status: input.includeAnswered === true ? void 0 : "open"
|
|
9760
|
+
})
|
|
9013
9761
|
}
|
|
9014
9762
|
}),
|
|
9015
9763
|
surfaceContract({
|
|
@@ -9024,16 +9772,28 @@ var questionsContracts = [
|
|
|
9024
9772
|
convex: {
|
|
9025
9773
|
module: "questions",
|
|
9026
9774
|
functionName: "getByTopic",
|
|
9027
|
-
kind: "query"
|
|
9775
|
+
kind: "query",
|
|
9776
|
+
inputProjection: questionTopicInput
|
|
9028
9777
|
}
|
|
9029
9778
|
})
|
|
9030
9779
|
];
|
|
9031
9780
|
|
|
9032
9781
|
// ../contracts/src/function-registry/topics.ts
|
|
9033
|
-
var topicIdInput = (input) => ({
|
|
9034
|
-
...input,
|
|
9782
|
+
var topicIdInput = (input) => compactRecord4({
|
|
9035
9783
|
id: input.id ?? input.topicId
|
|
9036
9784
|
});
|
|
9785
|
+
var updateTopicInput = (input) => compactRecord4({
|
|
9786
|
+
id: input.id ?? input.topicId,
|
|
9787
|
+
name: input.name,
|
|
9788
|
+
description: input.description,
|
|
9789
|
+
type: input.type,
|
|
9790
|
+
status: input.status,
|
|
9791
|
+
visibility: input.visibility,
|
|
9792
|
+
ontologyId: input.ontologyId,
|
|
9793
|
+
clearOntologyId: input.clearOntologyId,
|
|
9794
|
+
graphScopeProjectId: input.graphScopeProjectId,
|
|
9795
|
+
metadata: input.metadata
|
|
9796
|
+
});
|
|
9037
9797
|
var topicsContracts = [
|
|
9038
9798
|
surfaceContract({
|
|
9039
9799
|
name: "create_topic",
|
|
@@ -9098,7 +9858,7 @@ var topicsContracts = [
|
|
|
9098
9858
|
module: "topics",
|
|
9099
9859
|
functionName: "update",
|
|
9100
9860
|
kind: "mutation",
|
|
9101
|
-
inputProjection:
|
|
9861
|
+
inputProjection: updateTopicInput
|
|
9102
9862
|
}
|
|
9103
9863
|
}),
|
|
9104
9864
|
surfaceContract({
|
|
@@ -9120,6 +9880,27 @@ var topicsContracts = [
|
|
|
9120
9880
|
];
|
|
9121
9881
|
|
|
9122
9882
|
// ../contracts/src/function-registry/lenses.ts
|
|
9883
|
+
var createLensInput = (input, context) => compactRecord4({
|
|
9884
|
+
name: input.name,
|
|
9885
|
+
description: input.description,
|
|
9886
|
+
workspaceId: input.workspaceId,
|
|
9887
|
+
topicId: input.topicId,
|
|
9888
|
+
perspectiveType: input.perspectiveType,
|
|
9889
|
+
promptTemplates: input.promptTemplates,
|
|
9890
|
+
workflowTemplates: input.workflowTemplates,
|
|
9891
|
+
taskTemplates: input.taskTemplates,
|
|
9892
|
+
questionTemplates: input.questionTemplates,
|
|
9893
|
+
filterCriteria: input.filterCriteria,
|
|
9894
|
+
metadata: input.metadata,
|
|
9895
|
+
createdBy: authUserId(context)
|
|
9896
|
+
});
|
|
9897
|
+
var lensListInput = (input, context) => compactRecord4({
|
|
9898
|
+
actorId: input.actorId ?? authUserId(context),
|
|
9899
|
+
workspaceId: input.workspaceId,
|
|
9900
|
+
topicId: input.topicId,
|
|
9901
|
+
status: input.status,
|
|
9902
|
+
perspectiveType: input.perspectiveType
|
|
9903
|
+
});
|
|
9123
9904
|
var lensesContracts = [
|
|
9124
9905
|
surfaceContract({
|
|
9125
9906
|
name: "create_lens",
|
|
@@ -9133,7 +9914,8 @@ var lensesContracts = [
|
|
|
9133
9914
|
convex: {
|
|
9134
9915
|
module: "lenses",
|
|
9135
9916
|
functionName: "create",
|
|
9136
|
-
kind: "mutation"
|
|
9917
|
+
kind: "mutation",
|
|
9918
|
+
inputProjection: createLensInput
|
|
9137
9919
|
}
|
|
9138
9920
|
}),
|
|
9139
9921
|
surfaceContract({
|
|
@@ -9149,7 +9931,8 @@ var lensesContracts = [
|
|
|
9149
9931
|
convex: {
|
|
9150
9932
|
module: "lenses",
|
|
9151
9933
|
functionName: "list",
|
|
9152
|
-
kind: "query"
|
|
9934
|
+
kind: "query",
|
|
9935
|
+
inputProjection: lensListInput
|
|
9153
9936
|
}
|
|
9154
9937
|
}),
|
|
9155
9938
|
surfaceContract({
|
|
@@ -9164,7 +9947,13 @@ var lensesContracts = [
|
|
|
9164
9947
|
convex: {
|
|
9165
9948
|
module: "lenses",
|
|
9166
9949
|
functionName: "applyToTopic",
|
|
9167
|
-
kind: "mutation"
|
|
9950
|
+
kind: "mutation",
|
|
9951
|
+
inputProjection: (input, context) => compactRecord4({
|
|
9952
|
+
lensId: input.lensId,
|
|
9953
|
+
topicId: input.topicId,
|
|
9954
|
+
metadata: input.metadata,
|
|
9955
|
+
appliedBy: authUserId(context)
|
|
9956
|
+
})
|
|
9168
9957
|
}
|
|
9169
9958
|
}),
|
|
9170
9959
|
surfaceContract({
|
|
@@ -9180,12 +9969,28 @@ var lensesContracts = [
|
|
|
9180
9969
|
convex: {
|
|
9181
9970
|
module: "lenses",
|
|
9182
9971
|
functionName: "removeFromTopic",
|
|
9183
|
-
kind: "mutation"
|
|
9972
|
+
kind: "mutation",
|
|
9973
|
+
inputProjection: (input, context) => compactRecord4({
|
|
9974
|
+
lensId: input.lensId,
|
|
9975
|
+
topicId: input.topicId,
|
|
9976
|
+
removedBy: authUserId(context)
|
|
9977
|
+
})
|
|
9184
9978
|
}
|
|
9185
9979
|
})
|
|
9186
9980
|
];
|
|
9187
9981
|
|
|
9188
9982
|
// ../contracts/src/function-registry/ontologies.ts
|
|
9983
|
+
var ontologyIdInput = (input) => compactRecord4({
|
|
9984
|
+
id: input.id ?? input.ontologyId
|
|
9985
|
+
});
|
|
9986
|
+
var ontologyVersionIdInput = (input) => compactRecord4({
|
|
9987
|
+
id: input.id ?? input.versionId,
|
|
9988
|
+
ontologyId: input.ontologyId,
|
|
9989
|
+
actorId: input.actorId
|
|
9990
|
+
});
|
|
9991
|
+
var effectiveOntologyInput = (input) => compactRecord4({
|
|
9992
|
+
ontologyId: input.ontologyId ?? input.id
|
|
9993
|
+
});
|
|
9189
9994
|
var ontologiesContracts = [
|
|
9190
9995
|
surfaceContract({
|
|
9191
9996
|
name: "create_ontology",
|
|
@@ -9216,10 +10021,7 @@ var ontologiesContracts = [
|
|
|
9216
10021
|
module: "ontologies",
|
|
9217
10022
|
functionName: "getOntologyDefinition",
|
|
9218
10023
|
kind: "query",
|
|
9219
|
-
inputProjection:
|
|
9220
|
-
...input,
|
|
9221
|
-
id: input.id ?? input.ontologyId
|
|
9222
|
-
})
|
|
10024
|
+
inputProjection: ontologyIdInput
|
|
9223
10025
|
}
|
|
9224
10026
|
}),
|
|
9225
10027
|
surfaceContract({
|
|
@@ -9252,9 +10054,13 @@ var ontologiesContracts = [
|
|
|
9252
10054
|
module: "ontologies",
|
|
9253
10055
|
functionName: "updateOntologyDefinition",
|
|
9254
10056
|
kind: "mutation",
|
|
9255
|
-
inputProjection: (input) => ({
|
|
9256
|
-
|
|
9257
|
-
|
|
10057
|
+
inputProjection: (input) => compactRecord4({
|
|
10058
|
+
id: input.id ?? input.ontologyId,
|
|
10059
|
+
name: input.name,
|
|
10060
|
+
description: input.description,
|
|
10061
|
+
parentOntologyId: input.parentOntologyId,
|
|
10062
|
+
status: input.status,
|
|
10063
|
+
actorId: input.actorId
|
|
9258
10064
|
})
|
|
9259
10065
|
}
|
|
9260
10066
|
}),
|
|
@@ -9272,10 +10078,7 @@ var ontologiesContracts = [
|
|
|
9272
10078
|
module: "ontologies",
|
|
9273
10079
|
functionName: "archiveOntologyDefinition",
|
|
9274
10080
|
kind: "mutation",
|
|
9275
|
-
inputProjection:
|
|
9276
|
-
...input,
|
|
9277
|
-
id: input.id ?? input.ontologyId
|
|
9278
|
-
})
|
|
10081
|
+
inputProjection: ontologyIdInput
|
|
9279
10082
|
}
|
|
9280
10083
|
}),
|
|
9281
10084
|
surfaceContract({
|
|
@@ -9306,8 +10109,7 @@ var ontologiesContracts = [
|
|
|
9306
10109
|
module: "topics",
|
|
9307
10110
|
functionName: "update",
|
|
9308
10111
|
kind: "mutation",
|
|
9309
|
-
inputProjection: (input) => ({
|
|
9310
|
-
...input,
|
|
10112
|
+
inputProjection: (input) => compactRecord4({
|
|
9311
10113
|
id: input.topicId ?? input.id,
|
|
9312
10114
|
ontologyId: input.ontologyId ?? input.id
|
|
9313
10115
|
})
|
|
@@ -9325,7 +10127,8 @@ var ontologiesContracts = [
|
|
|
9325
10127
|
convex: {
|
|
9326
10128
|
module: "ontologies",
|
|
9327
10129
|
functionName: "resolveEffectiveOntology",
|
|
9328
|
-
kind: "query"
|
|
10130
|
+
kind: "query",
|
|
10131
|
+
inputProjection: effectiveOntologyInput
|
|
9329
10132
|
}
|
|
9330
10133
|
}),
|
|
9331
10134
|
surfaceContract({
|
|
@@ -9341,10 +10144,7 @@ var ontologiesContracts = [
|
|
|
9341
10144
|
module: "ontologies",
|
|
9342
10145
|
functionName: "publishOntologyVersion",
|
|
9343
10146
|
kind: "mutation",
|
|
9344
|
-
inputProjection:
|
|
9345
|
-
...input,
|
|
9346
|
-
id: input.id ?? input.versionId
|
|
9347
|
-
})
|
|
10147
|
+
inputProjection: ontologyVersionIdInput
|
|
9348
10148
|
}
|
|
9349
10149
|
}),
|
|
9350
10150
|
surfaceContract({
|
|
@@ -9360,10 +10160,7 @@ var ontologiesContracts = [
|
|
|
9360
10160
|
module: "ontologies",
|
|
9361
10161
|
functionName: "deprecateOntologyVersion",
|
|
9362
10162
|
kind: "mutation",
|
|
9363
|
-
inputProjection:
|
|
9364
|
-
...input,
|
|
9365
|
-
id: input.id ?? input.versionId
|
|
9366
|
-
})
|
|
10163
|
+
inputProjection: ontologyVersionIdInput
|
|
9367
10164
|
}
|
|
9368
10165
|
}),
|
|
9369
10166
|
surfaceContract({
|
|
@@ -9378,16 +10175,51 @@ var ontologiesContracts = [
|
|
|
9378
10175
|
convex: {
|
|
9379
10176
|
module: "ontologies",
|
|
9380
10177
|
functionName: "resolveEffectiveOntology",
|
|
9381
|
-
kind: "query"
|
|
10178
|
+
kind: "query",
|
|
10179
|
+
inputProjection: effectiveOntologyInput
|
|
9382
10180
|
}
|
|
9383
10181
|
})
|
|
9384
10182
|
];
|
|
9385
10183
|
|
|
9386
10184
|
// ../contracts/src/function-registry/worktrees.ts
|
|
9387
|
-
var
|
|
9388
|
-
...input,
|
|
10185
|
+
var worktreeIdInput = (input) => compactRecord4({
|
|
9389
10186
|
worktreeId: input.worktreeId ?? input.id
|
|
9390
10187
|
});
|
|
10188
|
+
var activateWorktreeInput = (input, context) => withUserId(worktreeIdInput(input), context);
|
|
10189
|
+
var worktreeTargetsInput = (input) => compactRecord4({
|
|
10190
|
+
worktreeId: input.worktreeId ?? input.id,
|
|
10191
|
+
addBeliefIds: input.addBeliefIds,
|
|
10192
|
+
removeBeliefIds: input.removeBeliefIds,
|
|
10193
|
+
addQuestionIds: input.addQuestionIds,
|
|
10194
|
+
removeQuestionIds: input.removeQuestionIds
|
|
10195
|
+
});
|
|
10196
|
+
var worktreeMetadataInput = (input) => compactRecord4({
|
|
10197
|
+
worktreeId: input.worktreeId ?? input.id,
|
|
10198
|
+
topicId: input.topicId,
|
|
10199
|
+
additionalTopicIds: input.additionalTopicIds,
|
|
10200
|
+
status: input.status,
|
|
10201
|
+
campaign: input.campaign,
|
|
10202
|
+
lane: input.lane,
|
|
10203
|
+
laneOrderInCampaign: input.laneOrderInCampaign,
|
|
10204
|
+
orderInLane: input.orderInLane,
|
|
10205
|
+
gate: input.gate,
|
|
10206
|
+
hypothesis: input.hypothesis,
|
|
10207
|
+
objective: input.objective,
|
|
10208
|
+
rationale: input.rationale,
|
|
10209
|
+
proofArtifacts: input.proofArtifacts,
|
|
10210
|
+
staffingHint: input.staffingHint,
|
|
10211
|
+
blocks: input.blocks,
|
|
10212
|
+
dependsOn: input.dependsOn,
|
|
10213
|
+
lensId: input.lensId,
|
|
10214
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
10215
|
+
lastReconciledAt: input.lastReconciledAt
|
|
10216
|
+
});
|
|
10217
|
+
var listAllWorktreesInput = (input) => compactRecord4({
|
|
10218
|
+
status: input.status,
|
|
10219
|
+
lane: input.lane,
|
|
10220
|
+
campaign: input.campaign,
|
|
10221
|
+
limit: input.limit
|
|
10222
|
+
});
|
|
9391
10223
|
var worktreesContracts = [
|
|
9392
10224
|
surfaceContract({
|
|
9393
10225
|
name: "add_worktree",
|
|
@@ -9403,11 +10235,43 @@ var worktreesContracts = [
|
|
|
9403
10235
|
functionName: "create",
|
|
9404
10236
|
kind: "mutation",
|
|
9405
10237
|
inputProjection: (input, context) => withCreatedBy(
|
|
9406
|
-
{
|
|
9407
|
-
...input,
|
|
10238
|
+
compactRecord4({
|
|
9408
10239
|
name: input.name ?? input.title,
|
|
9409
|
-
|
|
9410
|
-
|
|
10240
|
+
topicId: input.topicId,
|
|
10241
|
+
worktreeType: input.worktreeType,
|
|
10242
|
+
objective: input.objective,
|
|
10243
|
+
gate: input.gate,
|
|
10244
|
+
hypothesis: input.hypothesis,
|
|
10245
|
+
rationale: input.rationale,
|
|
10246
|
+
signal: input.signal,
|
|
10247
|
+
startDate: input.startDate,
|
|
10248
|
+
endDate: input.endDate,
|
|
10249
|
+
durationWeeks: input.durationWeeks,
|
|
10250
|
+
confidenceImpact: input.confidenceImpact,
|
|
10251
|
+
autoShape: input.autoShape,
|
|
10252
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
10253
|
+
beliefFocus: input.beliefFocus,
|
|
10254
|
+
targetQuestionIds: input.targetQuestionIds,
|
|
10255
|
+
targetBeliefIds: input.targetBeliefIds ?? input.beliefIds,
|
|
10256
|
+
keyQuestions: input.keyQuestions,
|
|
10257
|
+
proofArtifacts: input.proofArtifacts,
|
|
10258
|
+
decisionGate: input.decisionGate ?? (input.goCriteria || input.noGoSignals ? compactRecord4({
|
|
10259
|
+
goCriteria: input.goCriteria,
|
|
10260
|
+
noGoSignals: input.noGoSignals
|
|
10261
|
+
}) : void 0),
|
|
10262
|
+
evidenceSignals: input.evidenceSignals,
|
|
10263
|
+
dependsOn: input.dependsOn,
|
|
10264
|
+
blocks: input.blocks,
|
|
10265
|
+
campaign: input.campaign,
|
|
10266
|
+
lane: input.lane,
|
|
10267
|
+
laneOrderInCampaign: input.laneOrderInCampaign,
|
|
10268
|
+
orderInLane: input.orderInLane,
|
|
10269
|
+
staffingHint: input.staffingHint,
|
|
10270
|
+
domainPackId: input.domainPackId,
|
|
10271
|
+
lensId: input.lensId,
|
|
10272
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
10273
|
+
lastReconciledAt: input.lastReconciledAt
|
|
10274
|
+
}),
|
|
9411
10275
|
context
|
|
9412
10276
|
)
|
|
9413
10277
|
}
|
|
@@ -9425,7 +10289,7 @@ var worktreesContracts = [
|
|
|
9425
10289
|
module: "worktrees",
|
|
9426
10290
|
functionName: "activate",
|
|
9427
10291
|
kind: "mutation",
|
|
9428
|
-
inputProjection:
|
|
10292
|
+
inputProjection: activateWorktreeInput
|
|
9429
10293
|
}
|
|
9430
10294
|
}),
|
|
9431
10295
|
surfaceContract({
|
|
@@ -9441,7 +10305,36 @@ var worktreesContracts = [
|
|
|
9441
10305
|
convex: {
|
|
9442
10306
|
module: "worktrees",
|
|
9443
10307
|
functionName: "list",
|
|
9444
|
-
kind: "query"
|
|
10308
|
+
kind: "query",
|
|
10309
|
+
inputProjection: (input) => compactRecord4({
|
|
10310
|
+
topicId: input.topicId,
|
|
10311
|
+
status: input.status,
|
|
10312
|
+
groupBy: input.groupBy,
|
|
10313
|
+
lane: input.lane,
|
|
10314
|
+
campaign: input.campaign,
|
|
10315
|
+
limit: input.limit
|
|
10316
|
+
})
|
|
10317
|
+
}
|
|
10318
|
+
}),
|
|
10319
|
+
surfaceContract({
|
|
10320
|
+
name: "list_campaigns",
|
|
10321
|
+
kind: "query",
|
|
10322
|
+
domain: "worktrees",
|
|
10323
|
+
surfaceClass: "platform_public",
|
|
10324
|
+
method: "GET",
|
|
10325
|
+
path: "/worktrees/campaigns",
|
|
10326
|
+
sdkNamespace: "worktrees",
|
|
10327
|
+
sdkMethod: "listCampaigns",
|
|
10328
|
+
summary: "List compact pipeline campaigns with nested lanes.",
|
|
10329
|
+
convex: {
|
|
10330
|
+
module: "worktrees",
|
|
10331
|
+
functionName: "listCampaigns",
|
|
10332
|
+
kind: "query",
|
|
10333
|
+
inputProjection: (input) => compactRecord4({
|
|
10334
|
+
topicId: input.topicId,
|
|
10335
|
+
status: input.status,
|
|
10336
|
+
limit: input.limit
|
|
10337
|
+
})
|
|
9445
10338
|
}
|
|
9446
10339
|
}),
|
|
9447
10340
|
surfaceContract({
|
|
@@ -9457,7 +10350,8 @@ var worktreesContracts = [
|
|
|
9457
10350
|
convex: {
|
|
9458
10351
|
module: "worktrees",
|
|
9459
10352
|
functionName: "listAll",
|
|
9460
|
-
kind: "query"
|
|
10353
|
+
kind: "query",
|
|
10354
|
+
inputProjection: listAllWorktreesInput
|
|
9461
10355
|
}
|
|
9462
10356
|
}),
|
|
9463
10357
|
surfaceContract({
|
|
@@ -9474,7 +10368,7 @@ var worktreesContracts = [
|
|
|
9474
10368
|
module: "worktrees",
|
|
9475
10369
|
functionName: "updateTargets",
|
|
9476
10370
|
kind: "mutation",
|
|
9477
|
-
inputProjection:
|
|
10371
|
+
inputProjection: worktreeTargetsInput
|
|
9478
10372
|
}
|
|
9479
10373
|
}),
|
|
9480
10374
|
surfaceContract({
|
|
@@ -9491,7 +10385,7 @@ var worktreesContracts = [
|
|
|
9491
10385
|
module: "worktrees",
|
|
9492
10386
|
functionName: "updateMetadata",
|
|
9493
10387
|
kind: "mutation",
|
|
9494
|
-
inputProjection:
|
|
10388
|
+
inputProjection: worktreeMetadataInput
|
|
9495
10389
|
}
|
|
9496
10390
|
}),
|
|
9497
10391
|
surfaceContract({
|
|
@@ -9507,12 +10401,17 @@ var worktreesContracts = [
|
|
|
9507
10401
|
module: "worktrees",
|
|
9508
10402
|
functionName: "complete",
|
|
9509
10403
|
kind: "mutation",
|
|
9510
|
-
inputProjection: (input) => (
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
10404
|
+
inputProjection: (input, context) => withUserId(
|
|
10405
|
+
{
|
|
10406
|
+
...worktreeIdInput(input),
|
|
10407
|
+
keyFindings: input.keyFindings ?? [
|
|
10408
|
+
input.summary ?? "Merged worktree"
|
|
10409
|
+
],
|
|
10410
|
+
decisionsReached: input.decisionsReached ?? [],
|
|
10411
|
+
nextSteps: input.nextSteps ?? []
|
|
10412
|
+
},
|
|
10413
|
+
context
|
|
10414
|
+
)
|
|
9516
10415
|
}
|
|
9517
10416
|
}),
|
|
9518
10417
|
surfaceContract({
|
|
@@ -9528,11 +10427,7 @@ var worktreesContracts = [
|
|
|
9528
10427
|
module: "worktrees",
|
|
9529
10428
|
functionName: "updateMetadata",
|
|
9530
10429
|
kind: "mutation",
|
|
9531
|
-
inputProjection:
|
|
9532
|
-
...worktreeInput(input),
|
|
9533
|
-
lastPushTargetContext: input.targetContext,
|
|
9534
|
-
lastPushBeliefIds: input.beliefIds
|
|
9535
|
-
})
|
|
10430
|
+
inputProjection: worktreeMetadataInput
|
|
9536
10431
|
}
|
|
9537
10432
|
}),
|
|
9538
10433
|
surfaceContract({
|
|
@@ -9548,20 +10443,30 @@ var worktreesContracts = [
|
|
|
9548
10443
|
module: "worktrees",
|
|
9549
10444
|
functionName: "updateMetadata",
|
|
9550
10445
|
kind: "mutation",
|
|
9551
|
-
inputProjection:
|
|
9552
|
-
...worktreeInput(input),
|
|
9553
|
-
lastPullRequestSummary: input.summary,
|
|
9554
|
-
lastPullRequestReviewers: input.reviewers
|
|
9555
|
-
})
|
|
10446
|
+
inputProjection: worktreeMetadataInput
|
|
9556
10447
|
}
|
|
9557
10448
|
})
|
|
9558
10449
|
];
|
|
9559
10450
|
|
|
9560
10451
|
// ../contracts/src/function-registry/tasks.ts
|
|
9561
|
-
var taskInput = (input) => ({
|
|
10452
|
+
var taskInput = (input) => compactRecord4({
|
|
9562
10453
|
...input,
|
|
9563
10454
|
taskId: input.taskId ?? input.id
|
|
9564
10455
|
});
|
|
10456
|
+
var taskTopicInput = (input) => {
|
|
10457
|
+
const parsed = listTasksProjection.inputSchema.safeParse(input);
|
|
10458
|
+
if (!parsed.success) {
|
|
10459
|
+
throw new Error(
|
|
10460
|
+
`list_tasks projection input rejected: ${parsed.error.message}`
|
|
10461
|
+
);
|
|
10462
|
+
}
|
|
10463
|
+
return compactRecord4(listTasksProjection.project(parsed.data));
|
|
10464
|
+
};
|
|
10465
|
+
var completeTaskInput = (input) => compactRecord4({
|
|
10466
|
+
taskId: input.taskId ?? input.id,
|
|
10467
|
+
outputSummary: input.outputSummary ?? input.summary,
|
|
10468
|
+
userId: input.userId
|
|
10469
|
+
});
|
|
9565
10470
|
var tasksContracts = [
|
|
9566
10471
|
surfaceContract({
|
|
9567
10472
|
name: "create_task",
|
|
@@ -9591,8 +10496,10 @@ var tasksContracts = [
|
|
|
9591
10496
|
convex: {
|
|
9592
10497
|
module: "tasks",
|
|
9593
10498
|
functionName: "getByTopic",
|
|
9594
|
-
kind: "query"
|
|
9595
|
-
|
|
10499
|
+
kind: "query",
|
|
10500
|
+
inputProjection: taskTopicInput
|
|
10501
|
+
},
|
|
10502
|
+
args: listTasksInputSchema
|
|
9596
10503
|
}),
|
|
9597
10504
|
surfaceContract({
|
|
9598
10505
|
name: "update_task",
|
|
@@ -9624,12 +10531,29 @@ var tasksContracts = [
|
|
|
9624
10531
|
module: "tasks",
|
|
9625
10532
|
functionName: "complete",
|
|
9626
10533
|
kind: "mutation",
|
|
9627
|
-
inputProjection:
|
|
10534
|
+
inputProjection: completeTaskInput
|
|
9628
10535
|
}
|
|
9629
10536
|
})
|
|
9630
10537
|
];
|
|
9631
|
-
|
|
9632
|
-
|
|
10538
|
+
var createEdgeArgs = z.object({
|
|
10539
|
+
from: GraphRefSchema,
|
|
10540
|
+
to: GraphRefSchema,
|
|
10541
|
+
edgeType: z.string(),
|
|
10542
|
+
globalId: z.string().optional(),
|
|
10543
|
+
weight: z.number().optional(),
|
|
10544
|
+
confidence: z.number().optional(),
|
|
10545
|
+
context: z.string().optional(),
|
|
10546
|
+
reasoning: z.string().optional(),
|
|
10547
|
+
derivationType: z.string().optional(),
|
|
10548
|
+
topicId: z.string().optional(),
|
|
10549
|
+
trustedBypassAccessCheck: z.boolean().optional()
|
|
10550
|
+
});
|
|
10551
|
+
function graphRefNodeId(ref) {
|
|
10552
|
+
if (ref.kind === "epistemic_node") {
|
|
10553
|
+
return ref.nodeId;
|
|
10554
|
+
}
|
|
10555
|
+
return `external_belief:${ref.ref.tenantId}:${ref.ref.beliefId}`;
|
|
10556
|
+
}
|
|
9633
10557
|
var edgesContracts = [
|
|
9634
10558
|
surfaceContract({
|
|
9635
10559
|
name: "create_edge",
|
|
@@ -9644,16 +10568,35 @@ var edgesContracts = [
|
|
|
9644
10568
|
module: "edges",
|
|
9645
10569
|
functionName: "create",
|
|
9646
10570
|
kind: "mutation",
|
|
9647
|
-
inputProjection: (input, context) =>
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
10571
|
+
inputProjection: (input, context) => {
|
|
10572
|
+
const parsed = createEdgeArgs.parse(input);
|
|
10573
|
+
assertEdgePolicyAllowed(
|
|
10574
|
+
edgePolicyManifest,
|
|
10575
|
+
parsed.edgeType,
|
|
10576
|
+
parsed.from,
|
|
10577
|
+
parsed.to
|
|
10578
|
+
);
|
|
10579
|
+
const fromNodeId = graphRefNodeId(parsed.from);
|
|
10580
|
+
const toNodeId = graphRefNodeId(parsed.to);
|
|
10581
|
+
return withCreatedBy(
|
|
10582
|
+
compactRecord4({
|
|
10583
|
+
fromNodeId,
|
|
10584
|
+
toNodeId,
|
|
10585
|
+
edgeType: parsed.edgeType,
|
|
10586
|
+
globalId: parsed.globalId ?? `edge:${fromNodeId}:${toNodeId}:${parsed.edgeType}`,
|
|
10587
|
+
weight: parsed.weight,
|
|
10588
|
+
confidence: parsed.confidence,
|
|
10589
|
+
context: parsed.context ?? parsed.reasoning,
|
|
10590
|
+
derivationType: parsed.derivationType,
|
|
10591
|
+
skipLayerValidation: true,
|
|
10592
|
+
topicId: parsed.topicId,
|
|
10593
|
+
trustedBypassAccessCheck: parsed.trustedBypassAccessCheck
|
|
10594
|
+
}),
|
|
10595
|
+
context
|
|
10596
|
+
);
|
|
10597
|
+
}
|
|
10598
|
+
},
|
|
10599
|
+
args: createEdgeArgs
|
|
9657
10600
|
}),
|
|
9658
10601
|
surfaceContract({
|
|
9659
10602
|
name: "query_lineage",
|
|
@@ -9668,9 +10611,12 @@ var edgesContracts = [
|
|
|
9668
10611
|
module: "edges",
|
|
9669
10612
|
functionName: "getLineage",
|
|
9670
10613
|
kind: "query",
|
|
9671
|
-
inputProjection: (input) => ({
|
|
9672
|
-
|
|
9673
|
-
maxDepth: input.maxDepth ?? input.depth
|
|
10614
|
+
inputProjection: (input) => compactRecord4({
|
|
10615
|
+
nodeId: input.nodeId ?? input.startNode,
|
|
10616
|
+
maxDepth: input.maxDepth ?? input.depth,
|
|
10617
|
+
mode: input.mode,
|
|
10618
|
+
minLayer: input.minLayer,
|
|
10619
|
+
maxLayer: input.maxLayer
|
|
9674
10620
|
})
|
|
9675
10621
|
}
|
|
9676
10622
|
})
|
|
@@ -9690,8 +10636,7 @@ var contradictionSeverity = (value) => {
|
|
|
9690
10636
|
return "significant";
|
|
9691
10637
|
}
|
|
9692
10638
|
};
|
|
9693
|
-
var flagContradictionInput = (input, context) => ({
|
|
9694
|
-
...input,
|
|
10639
|
+
var flagContradictionInput = (input, context) => compactRecord4({
|
|
9695
10640
|
beliefId: input.beliefId ?? input.beliefA,
|
|
9696
10641
|
supportingInsightIds: Array.isArray(input.supportingInsightIds) ? input.supportingInsightIds : [],
|
|
9697
10642
|
contradictingInsightIds: Array.isArray(input.contradictingInsightIds) ? input.contradictingInsightIds : [input.beliefB].filter((value) => typeof value === "string"),
|
|
@@ -9705,6 +10650,18 @@ var flagContradictionInput = (input, context) => ({
|
|
|
9705
10650
|
},
|
|
9706
10651
|
createdBy: authUserId(context)
|
|
9707
10652
|
});
|
|
10653
|
+
var lineageInput = (input) => compactRecord4({
|
|
10654
|
+
nodeId: input.nodeId ?? input.startNode ?? input.entityId,
|
|
10655
|
+
maxDepth: input.maxDepth ?? input.depth,
|
|
10656
|
+
mode: input.mode,
|
|
10657
|
+
minLayer: input.minLayer,
|
|
10658
|
+
maxLayer: input.maxLayer
|
|
10659
|
+
});
|
|
10660
|
+
var topicEdgesInput = (input) => compactRecord4({
|
|
10661
|
+
topicId: input.topicId,
|
|
10662
|
+
userId: input.userId,
|
|
10663
|
+
limit: input.limit
|
|
10664
|
+
});
|
|
9708
10665
|
var graphContracts = [
|
|
9709
10666
|
surfaceContract({
|
|
9710
10667
|
name: "traverse_graph",
|
|
@@ -9718,7 +10675,8 @@ var graphContracts = [
|
|
|
9718
10675
|
convex: {
|
|
9719
10676
|
module: "edges",
|
|
9720
10677
|
functionName: "getLineage",
|
|
9721
|
-
kind: "query"
|
|
10678
|
+
kind: "query",
|
|
10679
|
+
inputProjection: lineageInput
|
|
9722
10680
|
}
|
|
9723
10681
|
}),
|
|
9724
10682
|
surfaceContract({
|
|
@@ -9733,7 +10691,8 @@ var graphContracts = [
|
|
|
9733
10691
|
convex: {
|
|
9734
10692
|
module: "edges",
|
|
9735
10693
|
functionName: "getByTopic",
|
|
9736
|
-
kind: "query"
|
|
10694
|
+
kind: "query",
|
|
10695
|
+
inputProjection: topicEdgesInput
|
|
9737
10696
|
}
|
|
9738
10697
|
}),
|
|
9739
10698
|
surfaceContract({
|
|
@@ -9763,7 +10722,10 @@ var graphContracts = [
|
|
|
9763
10722
|
convex: {
|
|
9764
10723
|
module: "edges",
|
|
9765
10724
|
functionName: "findContradictions",
|
|
9766
|
-
kind: "query"
|
|
10725
|
+
kind: "query",
|
|
10726
|
+
inputProjection: (input) => compactRecord4({
|
|
10727
|
+
nodeId: input.nodeId ?? input.beliefId
|
|
10728
|
+
})
|
|
9767
10729
|
}
|
|
9768
10730
|
}),
|
|
9769
10731
|
surfaceContract({
|
|
@@ -9868,8 +10830,9 @@ var graphContracts = [
|
|
|
9868
10830
|
summary: "Discover graph connections for an entity.",
|
|
9869
10831
|
convex: {
|
|
9870
10832
|
module: "edges",
|
|
9871
|
-
functionName: "
|
|
9872
|
-
kind: "query"
|
|
10833
|
+
functionName: "getLineage",
|
|
10834
|
+
kind: "query",
|
|
10835
|
+
inputProjection: lineageInput
|
|
9873
10836
|
}
|
|
9874
10837
|
}),
|
|
9875
10838
|
surfaceContract({
|
|
@@ -9900,10 +10863,7 @@ var graphContracts = [
|
|
|
9900
10863
|
module: "edges",
|
|
9901
10864
|
functionName: "getLineage",
|
|
9902
10865
|
kind: "query",
|
|
9903
|
-
inputProjection:
|
|
9904
|
-
...input,
|
|
9905
|
-
nodeId: input.nodeId ?? input.entityId
|
|
9906
|
-
})
|
|
10866
|
+
inputProjection: lineageInput
|
|
9907
10867
|
}
|
|
9908
10868
|
})
|
|
9909
10869
|
];
|
|
@@ -9973,19 +10933,21 @@ var judgmentsContracts = [
|
|
|
9973
10933
|
functionName: "create",
|
|
9974
10934
|
kind: "mutation",
|
|
9975
10935
|
inputProjection: (input, context) => withUserId(
|
|
9976
|
-
{
|
|
9977
|
-
|
|
10936
|
+
compactRecord4({
|
|
10937
|
+
projectId: input.projectId,
|
|
10938
|
+
topicId: input.topicId,
|
|
9978
10939
|
text: input.rationale,
|
|
9979
10940
|
title: input.title,
|
|
9980
10941
|
content: input.rationale,
|
|
9981
10942
|
kind: "judgment",
|
|
9982
|
-
sourceType: "
|
|
9983
|
-
metadata: {
|
|
10943
|
+
sourceType: "ai_generated",
|
|
10944
|
+
metadata: compactRecord4({
|
|
9984
10945
|
confidence: input.confidence,
|
|
9985
10946
|
beliefIds: input.beliefIds
|
|
9986
|
-
},
|
|
10947
|
+
}),
|
|
10948
|
+
rationale: input.rationale ?? input.reasoning ?? "Recorded judgment evidence",
|
|
9987
10949
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
9988
|
-
},
|
|
10950
|
+
}),
|
|
9989
10951
|
context
|
|
9990
10952
|
)
|
|
9991
10953
|
}
|
|
@@ -10003,9 +10965,12 @@ var judgmentsContracts = [
|
|
|
10003
10965
|
module: "edges",
|
|
10004
10966
|
functionName: "getLineage",
|
|
10005
10967
|
kind: "query",
|
|
10006
|
-
inputProjection: (input) => ({
|
|
10007
|
-
|
|
10008
|
-
|
|
10968
|
+
inputProjection: (input) => compactRecord4({
|
|
10969
|
+
nodeId: input.nodeId ?? input.id,
|
|
10970
|
+
maxDepth: input.maxDepth ?? input.depth,
|
|
10971
|
+
mode: input.mode,
|
|
10972
|
+
minLayer: input.minLayer,
|
|
10973
|
+
maxLayer: input.maxLayer
|
|
10009
10974
|
})
|
|
10010
10975
|
}
|
|
10011
10976
|
})
|
|
@@ -10131,7 +11096,10 @@ var coordinationContracts = [
|
|
|
10131
11096
|
module: "coordination",
|
|
10132
11097
|
functionName: "getInbox",
|
|
10133
11098
|
kind: "query",
|
|
10134
|
-
injectSessionId: "sessionId"
|
|
11099
|
+
injectSessionId: "sessionId",
|
|
11100
|
+
inputProjection: (input) => compactRecord4({
|
|
11101
|
+
limit: input.limit
|
|
11102
|
+
})
|
|
10135
11103
|
}
|
|
10136
11104
|
}),
|
|
10137
11105
|
surfaceContract({
|
|
@@ -10149,7 +11117,6 @@ var coordinationContracts = [
|
|
|
10149
11117
|
kind: "mutation",
|
|
10150
11118
|
injectSessionId: "sessionId",
|
|
10151
11119
|
inputProjection: (input) => ({
|
|
10152
|
-
...input,
|
|
10153
11120
|
touchedFiles: stringArray(input.touchedFiles) ?? stringArray(input.files) ?? stringArray(input.paths) ?? []
|
|
10154
11121
|
})
|
|
10155
11122
|
}
|
|
@@ -10166,7 +11133,10 @@ var coordinationContracts = [
|
|
|
10166
11133
|
convex: {
|
|
10167
11134
|
module: "worktrees",
|
|
10168
11135
|
functionName: "get",
|
|
10169
|
-
kind: "query"
|
|
11136
|
+
kind: "query",
|
|
11137
|
+
inputProjection: (input) => compactRecord4({
|
|
11138
|
+
worktreeId: input.worktreeId ?? input.id
|
|
11139
|
+
})
|
|
10170
11140
|
}
|
|
10171
11141
|
})
|
|
10172
11142
|
];
|
|
@@ -10185,7 +11155,13 @@ var pipelineContracts = [
|
|
|
10185
11155
|
convex: {
|
|
10186
11156
|
module: "worktrees",
|
|
10187
11157
|
functionName: "listAll",
|
|
10188
|
-
kind: "query"
|
|
11158
|
+
kind: "query",
|
|
11159
|
+
inputProjection: (input) => compactRecord4({
|
|
11160
|
+
status: input.status,
|
|
11161
|
+
lane: input.lane,
|
|
11162
|
+
campaign: input.campaign,
|
|
11163
|
+
limit: input.limit
|
|
11164
|
+
})
|
|
10189
11165
|
}
|
|
10190
11166
|
}),
|
|
10191
11167
|
surfaceContract({
|
|
@@ -10235,43 +11211,63 @@ var recordScopeLearningArgs = z.object({
|
|
|
10235
11211
|
linkedBeliefNodeId: z.string().optional().describe("Optional belief to attach evidence to"),
|
|
10236
11212
|
evidenceRelation: z.enum(["supports", "contradicts"]).optional().describe("Relation to linked belief"),
|
|
10237
11213
|
confidence: z.number().optional().describe("Optional confidence in [0,1]"),
|
|
11214
|
+
rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
|
|
10238
11215
|
createQuestionText: z.string().optional().describe("Optional follow-up question text"),
|
|
10239
11216
|
createBeliefText: z.string().optional().describe("Optional new belief text"),
|
|
10240
11217
|
beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
|
|
10241
11218
|
});
|
|
10242
|
-
var learningInput = (input, context) =>
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
)
|
|
11219
|
+
var learningInput = (input, context) => {
|
|
11220
|
+
const sourceKind = input.sourceKind ?? input.externalSourceType;
|
|
11221
|
+
return withUserId(
|
|
11222
|
+
compactRecord4({
|
|
11223
|
+
projectId: input.projectId,
|
|
11224
|
+
topicId: input.topicId,
|
|
11225
|
+
text: input.summary ?? input.text,
|
|
11226
|
+
title: input.title ?? input.summary ?? "Scope learning",
|
|
11227
|
+
content: input.body ?? input.content ?? input.summary,
|
|
11228
|
+
contentType: input.contentType,
|
|
11229
|
+
kind: input.kind ?? "learning",
|
|
11230
|
+
tags: input.tags ?? [],
|
|
11231
|
+
sourceType: input.sourceType,
|
|
11232
|
+
externalSourceType: input.externalSourceType ?? input.sourceKind,
|
|
11233
|
+
sourceUrl: input.sourceUrl,
|
|
11234
|
+
metadata: compactRecord4({
|
|
11235
|
+
...recordValue2(input.metadata),
|
|
11236
|
+
sourceRef: input.sourceRef,
|
|
11237
|
+
sourceKind,
|
|
11238
|
+
touchedPaths: input.touchedPaths,
|
|
11239
|
+
createQuestionText: input.createQuestionText,
|
|
11240
|
+
createBeliefText: input.createBeliefText,
|
|
11241
|
+
beliefType: input.beliefType
|
|
11242
|
+
}),
|
|
11243
|
+
linkedBeliefNodeId: input.linkedBeliefNodeId,
|
|
11244
|
+
evidenceRelation: input.evidenceRelation,
|
|
11245
|
+
confidence: input.confidence,
|
|
11246
|
+
rationale: input.rationale ?? input.reasoning ?? input.summary ?? input.text ?? "Recorded scope learning",
|
|
11247
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
11248
|
+
}),
|
|
11249
|
+
context
|
|
11250
|
+
);
|
|
11251
|
+
};
|
|
10259
11252
|
var attemptInput = (input, context) => withUserId(
|
|
10260
|
-
{
|
|
10261
|
-
|
|
11253
|
+
compactRecord4({
|
|
11254
|
+
projectId: input.projectId,
|
|
11255
|
+
topicId: input.topicId,
|
|
10262
11256
|
text: input.description,
|
|
10263
11257
|
title: input.title ?? input.description,
|
|
10264
11258
|
content: input.errorMessage ?? input.description,
|
|
10265
11259
|
kind: "code_attempt",
|
|
10266
11260
|
tags: ["code_attempt"],
|
|
10267
|
-
metadata: {
|
|
11261
|
+
metadata: compactRecord4({
|
|
11262
|
+
...recordValue2(input.metadata),
|
|
10268
11263
|
filePaths: input.filePaths,
|
|
10269
11264
|
filePath: input.filePath,
|
|
10270
11265
|
errorMessage: input.errorMessage,
|
|
10271
11266
|
linkedBeliefId: input.linkedBeliefId
|
|
10272
|
-
},
|
|
11267
|
+
}),
|
|
11268
|
+
rationale: input.rationale ?? input.reasoning ?? input.errorMessage ?? input.description ?? "Recorded implementation attempt",
|
|
10273
11269
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
10274
|
-
},
|
|
11270
|
+
}),
|
|
10275
11271
|
context
|
|
10276
11272
|
);
|
|
10277
11273
|
var codingContracts = [
|
|
@@ -10328,7 +11324,13 @@ var codingContracts = [
|
|
|
10328
11324
|
convex: {
|
|
10329
11325
|
module: "evidence",
|
|
10330
11326
|
functionName: "getByTopic",
|
|
10331
|
-
kind: "query"
|
|
11327
|
+
kind: "query",
|
|
11328
|
+
inputProjection: (input) => compactRecord4({
|
|
11329
|
+
topicId: input.topicId,
|
|
11330
|
+
limit: input.limit,
|
|
11331
|
+
status: input.status,
|
|
11332
|
+
userId: input.userId
|
|
11333
|
+
})
|
|
10332
11334
|
}
|
|
10333
11335
|
}),
|
|
10334
11336
|
surfaceContract({
|
|
@@ -10343,7 +11345,13 @@ var codingContracts = [
|
|
|
10343
11345
|
convex: {
|
|
10344
11346
|
module: "evidence",
|
|
10345
11347
|
functionName: "getByTopic",
|
|
10346
|
-
kind: "query"
|
|
11348
|
+
kind: "query",
|
|
11349
|
+
inputProjection: (input) => compactRecord4({
|
|
11350
|
+
topicId: input.topicId,
|
|
11351
|
+
limit: input.limit,
|
|
11352
|
+
status: input.status,
|
|
11353
|
+
userId: input.userId
|
|
11354
|
+
})
|
|
10347
11355
|
}
|
|
10348
11356
|
}),
|
|
10349
11357
|
surfaceContract({
|
|
@@ -10375,9 +11383,11 @@ var codingContracts = [
|
|
|
10375
11383
|
module: "evidence",
|
|
10376
11384
|
functionName: "getByTopic",
|
|
10377
11385
|
kind: "query",
|
|
10378
|
-
inputProjection: (input) => ({
|
|
10379
|
-
|
|
10380
|
-
|
|
11386
|
+
inputProjection: (input) => compactRecord4({
|
|
11387
|
+
topicId: input.topicId ?? input.query,
|
|
11388
|
+
limit: input.limit,
|
|
11389
|
+
status: input.status,
|
|
11390
|
+
userId: input.userId
|
|
10381
11391
|
})
|
|
10382
11392
|
}
|
|
10383
11393
|
})
|