@lucern/contracts 1.0.54 → 1.0.55

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/CHANGELOG.md CHANGED
@@ -178,3 +178,6 @@ All notable changes to `@lucern/contracts` are tracked in this repository.
178
178
  ## [1.0.54] - 2026-06-30
179
179
  - Supersedes the `1.0.53` package line with clean npm metadata after boundary
180
180
  manual-publish recovery exposed a leaked `workspace:*` dependency.
181
+
182
+ ## [1.0.55] - 2026-06-30
183
+ - Release notes pending.
@@ -6078,6 +6078,12 @@ var defineFunctionContract = (contract) => contract;
6078
6078
  function authUserId(context) {
6079
6079
  return context.userId ?? context.principalId ?? "lucern-agent";
6080
6080
  }
6081
+ function withUserId(input, context) {
6082
+ return {
6083
+ ...input,
6084
+ userId: typeof input.userId === "string" ? input.userId : authUserId(context)
6085
+ };
6086
+ }
6081
6087
  function withCreatedBy(input, context) {
6082
6088
  return {
6083
6089
  ...input,
@@ -6265,19 +6271,28 @@ var getTopicGraphSpineArgs = z.object({
6265
6271
  rootTopicId: uuidV7StringSchema.optional().describe("Optional root topic ID."),
6266
6272
  includeTopicBeliefEdges: z.boolean().optional()
6267
6273
  });
6268
- var topicIdInput = (input) => compactRecord({
6269
- id: input.id ?? input.topicId
6270
- });
6271
- var listTopicsInput = (input) => compactRecord({
6272
- type: input.type,
6273
- parentTopicId: input.parentTopicId,
6274
- tenantId: input.tenantId,
6275
- status: input.status
6276
- });
6277
- var topicTreeInput = (input) => compactRecord({
6278
- rootId: input.rootId ?? input.id,
6279
- maxDepth: input.maxDepth
6280
- });
6274
+ var topicIdInput = (input, context) => withUserId(
6275
+ compactRecord({
6276
+ id: input.id ?? input.topicId
6277
+ }),
6278
+ context
6279
+ );
6280
+ var listTopicsInput = (input, context) => withUserId(
6281
+ compactRecord({
6282
+ type: input.type,
6283
+ parentTopicId: input.parentTopicId,
6284
+ tenantId: input.tenantId,
6285
+ status: input.status
6286
+ }),
6287
+ context
6288
+ );
6289
+ var topicTreeInput = (input, context) => withUserId(
6290
+ compactRecord({
6291
+ rootId: input.rootId ?? input.id,
6292
+ maxDepth: input.maxDepth
6293
+ }),
6294
+ context
6295
+ );
6281
6296
  var updateTopicInput = (input) => compactRecord({
6282
6297
  id: input.id ?? input.topicId,
6283
6298
  name: input.name,
@@ -6202,6 +6202,12 @@ function surfaceContract(args) {
6202
6202
 
6203
6203
  // src/function-registry/worktrees.ts
6204
6204
  var worktreeListReturns = z.array(z.record(z.unknown()));
6205
+ var worktreeListPageReturns = z.object({
6206
+ worktrees: worktreeListReturns,
6207
+ total: z.number(),
6208
+ lanes: z.record(z.number()),
6209
+ campaigns: z.record(z.number())
6210
+ }).passthrough();
6205
6211
  var autoFixPolicyInputSchema = z.object({
6206
6212
  enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
6207
6213
  mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
@@ -6339,6 +6345,51 @@ function projectAddWorktreeOutput(output) {
6339
6345
  nodeId: worktreeId
6340
6346
  };
6341
6347
  }
6348
+ function countByStringField(rows, field) {
6349
+ const counts = {};
6350
+ for (const row of rows) {
6351
+ const value = row[field];
6352
+ if (typeof value !== "string" || value.length === 0) {
6353
+ continue;
6354
+ }
6355
+ counts[value] = (counts[value] ?? 0) + 1;
6356
+ }
6357
+ return counts;
6358
+ }
6359
+ function countByNumberField(rows, field) {
6360
+ const counts = {};
6361
+ for (const row of rows) {
6362
+ const value = row[field];
6363
+ if (typeof value !== "number" || !Number.isFinite(value)) {
6364
+ continue;
6365
+ }
6366
+ const key = String(value);
6367
+ counts[key] = (counts[key] ?? 0) + 1;
6368
+ }
6369
+ return counts;
6370
+ }
6371
+ function projectListAllWorktreesOutput(output) {
6372
+ if (Array.isArray(output)) {
6373
+ const worktrees = output.filter(isRecord);
6374
+ return {
6375
+ worktrees,
6376
+ total: worktrees.length,
6377
+ lanes: countByStringField(worktrees, "lane"),
6378
+ campaigns: countByNumberField(worktrees, "campaign")
6379
+ };
6380
+ }
6381
+ if (isRecord(output) && Array.isArray(output.worktrees)) {
6382
+ const worktrees = output.worktrees.filter(isRecord);
6383
+ return {
6384
+ ...output,
6385
+ worktrees,
6386
+ total: typeof output.total === "number" && Number.isFinite(output.total) ? output.total : worktrees.length,
6387
+ lanes: isRecord(output.lanes) ? output.lanes : countByStringField(worktrees, "lane"),
6388
+ campaigns: isRecord(output.campaigns) ? output.campaigns : countByNumberField(worktrees, "campaign")
6389
+ };
6390
+ }
6391
+ return output;
6392
+ }
6342
6393
  var worktreeIdInput = (input) => compactRecord({
6343
6394
  worktreeId: input.worktreeId ?? input.id
6344
6395
  });
@@ -6597,8 +6648,10 @@ var worktreesContracts = [
6597
6648
  module: "worktrees",
6598
6649
  functionName: "listAll",
6599
6650
  kind: "query",
6600
- inputProjection: listAllWorktreesInput
6601
- }
6651
+ inputProjection: listAllWorktreesInput,
6652
+ outputProjection: projectListAllWorktreesOutput
6653
+ },
6654
+ returns: worktreeListPageReturns
6602
6655
  }),
6603
6656
  surfaceContract({
6604
6657
  name: "list_worktrees_by_belief",
package/dist/index.js CHANGED
@@ -91075,7 +91075,7 @@ var WORKTREE_BELIEF_ADOPTION_LANE = "c2-rd-worktree-belief-backrefs-and-adoption
91075
91075
  var WORKTREE_BELIEF_ADOPTION_GRAPH_WORKTREE_ID = "tn74cd18y1paca8p6djs5jwa6s85wt8c";
91076
91076
  var WORKTREE_BELIEF_ADOPTION_COMPOSITION_KEY = "worktree_belief_adoption_projection_v1";
91077
91077
  var CANONICAL_PIPELINE_BELIEF_GLOBAL_ID = "019dcb0b-675c-7924-bdff-b43d493e6997";
91078
- var CANONICAL_PIPELINE_BELIEF_ID = CANONICAL_PIPELINE_BELIEF_GLOBAL_ID;
91078
+ var CANONICAL_PIPELINE_BELIEF_ID = "019dcb0b-675c-7924-bdff-b43d493e6997";
91079
91079
  var Q5_STRUCTURAL_ADOPTION_QUESTION_ID = "n97f4tykvtd1vfz0h79p7ztz0985wafy";
91080
91080
  var WORKTREE_BELIEF_ADOPTION_REFUSAL_IDS = [
91081
91081
  "intrinsic_confidence_mutation_refused",
@@ -41,5 +41,5 @@
41
41
  "convex-validators",
42
42
  "proof-attestation"
43
43
  ],
44
- "signedAt": 1782812828295
44
+ "signedAt": 1782826831970
45
45
  }
@@ -5906,7 +5906,7 @@ var WORKTREE_BELIEF_ADOPTION_LANE = "c2-rd-worktree-belief-backrefs-and-adoption
5906
5906
  var WORKTREE_BELIEF_ADOPTION_GRAPH_WORKTREE_ID = "tn74cd18y1paca8p6djs5jwa6s85wt8c";
5907
5907
  var WORKTREE_BELIEF_ADOPTION_COMPOSITION_KEY = "worktree_belief_adoption_projection_v1";
5908
5908
  var CANONICAL_PIPELINE_BELIEF_GLOBAL_ID = "019dcb0b-675c-7924-bdff-b43d493e6997";
5909
- var CANONICAL_PIPELINE_BELIEF_ID = CANONICAL_PIPELINE_BELIEF_GLOBAL_ID;
5909
+ var CANONICAL_PIPELINE_BELIEF_ID = "019dcb0b-675c-7924-bdff-b43d493e6997";
5910
5910
  var Q5_STRUCTURAL_ADOPTION_QUESTION_ID = "n97f4tykvtd1vfz0h79p7ztz0985wafy";
5911
5911
  var WORKTREE_BELIEF_ADOPTION_REFUSAL_IDS = [
5912
5912
  "intrinsic_confidence_mutation_refused",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucern/contracts",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",