@lucern/sdk 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/README.md +33 -21
- package/dist/beliefs/index.d.ts +7 -7
- package/dist/beliefs/index.js +100 -99
- package/dist/beliefs/index.js.map +1 -1
- package/dist/beliefsClient.d.ts +14 -29
- package/dist/beliefsClient.js +34 -71
- package/dist/beliefsClient.js.map +1 -1
- package/dist/{client-DAuKnDlx.d.ts → client-B6aWUUwp.d.ts} +25 -20
- package/dist/client.d.ts +1 -1
- package/dist/client.js +100 -99
- package/dist/client.js.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/workflow-runtime.contract.js +1 -1
- package/dist/contracts/workflow-runtime.contract.js.map +1 -1
- package/dist/contracts/workflowRuntime.js +1 -1
- package/dist/contracts/workflowRuntime.js.map +1 -1
- package/dist/contradictions/index.d.ts +1 -1
- package/dist/contradictions/index.js +100 -99
- package/dist/contradictions/index.js.map +1 -1
- package/dist/decisions/index.d.ts +1 -1
- package/dist/decisions/index.js +100 -99
- package/dist/decisions/index.js.map +1 -1
- package/dist/edges/index.d.ts +1 -1
- package/dist/edges/index.js +100 -99
- package/dist/edges/index.js.map +1 -1
- package/dist/evidence/index.d.ts +2 -1
- package/dist/evidence/index.js +100 -99
- package/dist/evidence/index.js.map +1 -1
- package/dist/gatewayFacades.d.ts +18 -6
- package/dist/gatewayFacades.js +22 -41
- package/dist/gatewayFacades.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +103 -69
- package/dist/index.js.map +1 -1
- package/dist/lenses/index.d.ts +7 -5
- package/dist/lenses/index.js +100 -99
- package/dist/lenses/index.js.map +1 -1
- package/dist/nodes/index.d.ts +1 -1
- package/dist/nodes/index.js +100 -99
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +1 -1
- package/dist/ontologies/index.js +100 -99
- package/dist/ontologies/index.js.map +1 -1
- package/dist/opinion.d.ts +2 -2
- package/dist/opinion.js +4 -4
- package/dist/opinion.js.map +1 -1
- package/dist/questions/index.d.ts +1 -1
- package/dist/questions/index.js +100 -99
- package/dist/questions/index.js.map +1 -1
- package/dist/topics/index.d.ts +1 -1
- package/dist/topics/index.js +100 -99
- package/dist/topics/index.js.map +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/workflowClient.d.ts +18 -5
- package/dist/workflowClient.js +19 -7
- package/dist/workflowClient.js.map +1 -1
- package/dist/worktrees/index.d.ts +10 -7
- package/dist/worktrees/index.js +100 -99
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contracts/workflow-runtime.contract.ts"],"names":[],"mappings":";AAkBO,IAAM,+BAAA,GAAkC;AAExC,IAAM,uBAAA,GAA0B;AAAA,EACrC,WAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,0BAAA,GAET;AAAA,EACF,SAAA,EAAW,MAAA;AAAA,EACX,cAAA,EAAgB,YAAA;AAAA,EAChB,eAAA,EAAiB;AACnB;AAEO,IAAM,qBAAA,GAAwB;AAAA,EACnC,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,aAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF;AAGO,IAAM,oBAAA,GAAuB;AAAA,EAClC,eAAA;AAAA,EACA,oBAAA;AAAA,EACA,oBAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF;AAGO,IAAM,qBAAA,GAAwB;AAAA,EACnC,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,g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EAAmB;AAAA,KACrB;AAAA,IACA,OAAA,EAAS;AAAA,MACP;AAAA,QACE,QAAA,EAAU,sBAAA;AAAA,QACV,IAAA,EAAM,cAAA;AAAA,QACN,KAAA,EAAO,sBAAA;AAAA,QACP,WAAA,EACE,oEAAA;AAAA,QACF,YAAA,EAAc,WAAA;AAAA,QACd,QAAA,EAAU,CAAC,oBAAoB,CAAA;AAAA,QAC/B,UAAA,EAAY,IAAA;AAAA,QACZ,QAAA,EAAU,EAAE,IAAA,EAAM,MAAA;AAAO,OAC3B;AAAA,MACA;AAAA,QACE,QAAA,EAAU,uBAAA;AAAA,QACV,IAAA,EAAM,eAAA;AAAA,QACN,KAAA,EAAO,uBAAA;AAAA,QACP,WAAA,EACE,+EAAA;AAAA,QACF,YAAA,EAAc,gBAAA;AAAA,QACd,QAAA,EAAU,CAAC,mBAAA,EAAqB,eAAe,CAAA;AAAA,QAC/C,QAAA,EAAU,EAAE,IAAA,EAAM,YAAA;AAAa;AACjC,KACF;AAAA,IACA,KAAA,EAAO;AAAA,MACL;AAAA,QACE,MAAA,EAAQ,kBAAA;AAAA,QACR,KAAA,EAAO,eAAA;AAAA,QACP,WAAA,EAAa,+BAAA;AAAA,QACb,SAAA,EAAW,CAAC,sBAAA,EAAwB,uBAAuB;AAAA,OAC7D;AAAA,MACA;AAAA,QACE,MAAA,EAAQ,2BAAA;AAAA,QACR,KAAA,EAAO,oBAAA;AAAA,QACP,WAAA,EACE,gFAAA;AAAA,QACF,SAAA,EAAW,CAAC,sBAAsB;AAAA;AACpC,KACF;AAAA,IACA,OAAA,EAAS,CAAC,mBAAA,EAAqB,eAAA,EAAiB,oBAAoB,CAAA;AAAA,IACpE,eAAA,EAAiB,CAAC,gBAAgB;AAAA;AAEtC","file":"workflowRuntime.js","sourcesContent":["/**\n * Workflow Runtime Contract v1\n *\n * Canonical TypeScript contract for Lucern's graph-local workflow runtime.\n * WF-1 defines the typed substrate for:\n * - workflow definitions and run receipts\n * - action mutation tiering and approval expectations\n * - hooks over worktree/question/evidence/inbox events\n * - output unions for domain-specific artifacts\n * - deterministic integrity checks and operational metadata\n *\n * BREAKING CHANGE RULES:\n * - Adding optional fields is NON-breaking\n * - Removing fields or renaming enum values is BREAKING\n * - Reclassifying a mutation tier is BREAKING\n * - Changing canonical workflow IDs is BREAKING\n */\n\nexport const WORKFLOW_RUNTIME_SCHEMA_VERSION = \"1.0.0\" as const;\n\nexport const WORKFLOW_MUTATION_TIERS = [\n \"read_only\",\n \"low_risk_write\",\n \"high_risk_write\",\n] as const;\nexport type WorkflowMutationTier = (typeof WORKFLOW_MUTATION_TIERS)[number];\n\nexport const WORKFLOW_APPROVAL_MODES = [\n \"none\",\n \"audit_only\",\n \"human_required\",\n \"auto_approve\",\n] as const;\nexport type WorkflowApprovalMode = (typeof WORKFLOW_APPROVAL_MODES)[number];\n\nexport const DEFAULT_TIER_APPROVAL_MODE: Readonly<\n Record<WorkflowMutationTier, WorkflowApprovalMode>\n> = {\n read_only: \"none\",\n low_risk_write: \"audit_only\",\n high_risk_write: \"human_required\",\n} as const;\n\nexport const WORKFLOW_ACTION_KINDS = [\n \"context_pack\",\n \"integrity_check\",\n \"lucern_tool\",\n \"report_compile\",\n \"brief_publish\",\n \"notification\",\n \"custom\",\n] as const;\nexport type WorkflowActionKind = (typeof WORKFLOW_ACTION_KINDS)[number];\n\nexport const WORKFLOW_HOOK_EVENTS = [\n \"schedule.tick\",\n \"worktree.activated\",\n \"worktree.completed\",\n \"question.created\",\n \"question.answered\",\n \"evidence.appended\",\n \"inbox.item_created\",\n] as const;\nexport type WorkflowHookEvent = (typeof WORKFLOW_HOOK_EVENTS)[number];\n\nexport const WORKFLOW_OUTPUT_KINDS = [\n \"engineering_brief\",\n \"research_memo\",\n \"strategy_artifact\",\n \"inbox_summary\",\n \"pipeline_brief\",\n \"structured_payload\",\n] as const;\nexport type WorkflowOutputKind = (typeof WORKFLOW_OUTPUT_KINDS)[number];\n\nexport const WORKFLOW_RUN_STATUSES = [\n \"queued\",\n \"running\",\n \"awaiting_approval\",\n \"completed\",\n \"failed\",\n \"cancelled\",\n] as const;\nexport type WorkflowRunStatus = (typeof WORKFLOW_RUN_STATUSES)[number];\n\nexport const WORKFLOW_TRIGGER_KINDS = [\n \"manual\",\n \"schedule\",\n \"hook\",\n] as const;\nexport type WorkflowTriggerKind = (typeof WORKFLOW_TRIGGER_KINDS)[number];\n\nexport const WORKFLOW_PROOF_ARTIFACT_KINDS = [\n \"report\",\n \"brief\",\n \"artifact\",\n \"dashboard\",\n \"test_evidence\",\n] as const;\nexport type WorkflowProofArtifactKind =\n (typeof WORKFLOW_PROOF_ARTIFACT_KINDS)[number];\n\nexport const WORKFLOW_STAFFING_HINTS = [\n \"solo\",\n \"backend+tests\",\n \"fullstack\",\n \"mcp+tests\",\n] as const;\nexport type WorkflowStaffingHint = (typeof WORKFLOW_STAFFING_HINTS)[number];\n\nexport const WORKFLOW_AUTO_FIX_MODES = [\n \"disabled\",\n \"dry_run\",\n \"safe\",\n \"aggressive\",\n] as const;\nexport type WorkflowAutoFixMode = (typeof WORKFLOW_AUTO_FIX_MODES)[number];\n\nexport const WORKFLOW_INTEGRITY_CHECKS = [\n \"null_dependency_refs\",\n \"superseded_blockers\",\n \"band_order_inconsistency\",\n \"sparse_shaping\",\n \"failed_completed_gate\",\n] as const;\nexport type WorkflowIntegrityCheckId =\n (typeof WORKFLOW_INTEGRITY_CHECKS)[number];\n\nexport type WorkflowProofArtifact = {\n kind: WorkflowProofArtifactKind;\n label: string;\n required?: boolean;\n sourceRef?: string;\n};\n\nexport type WorkflowAutoFixPolicy = {\n mode: WorkflowAutoFixMode;\n maxActionsPerRun?: number;\n permittedMutationTiers?: WorkflowMutationTier[];\n requireAuditTrail?: boolean;\n escalationGate?: string;\n};\n\nexport const DEFAULT_WORKFLOW_AUTO_FIX_POLICY: WorkflowAutoFixPolicy = {\n mode: \"disabled\",\n permittedMutationTiers: [\"read_only\"],\n requireAuditTrail: true,\n};\n\nexport type WorkflowApprovalPolicy = {\n mode: WorkflowApprovalMode;\n approvalGate?: string;\n autoApprovePolicyKey?: string;\n rationaleRequired?: boolean;\n};\n\nexport type WorkflowOutputBase = {\n outputId: string;\n kind: WorkflowOutputKind;\n title: string;\n summary: string;\n generatedAt?: number;\n};\n\nexport type EngineeringBriefOutput = WorkflowOutputBase & {\n kind: \"engineering_brief\";\n sections: Array<{\n heading: string;\n body: string;\n }>;\n touchedPaths?: string[];\n};\n\nexport type ResearchMemoOutput = WorkflowOutputBase & {\n kind: \"research_memo\";\n claims: string[];\n evidenceRefs?: string[];\n};\n\nexport type StrategyArtifactOutput = WorkflowOutputBase & {\n kind: \"strategy_artifact\";\n recommendations: string[];\n decisionWindow?: string;\n};\n\nexport type InboxSummaryOutput = WorkflowOutputBase & {\n kind: \"inbox_summary\";\n channel: \"developer_portal\" | \"chat\" | \"ops\";\n inboxTitle: string;\n inboxBody: string;\n};\n\nexport type PipelineBriefOutput = WorkflowOutputBase & {\n kind: \"pipeline_brief\";\n hingeWorktreeId?: string;\n groupedBlockers: Array<{\n blocker: string;\n blockedWorktreeIds: string[];\n }>;\n};\n\nexport type StructuredPayloadOutput = WorkflowOutputBase & {\n kind: \"structured_payload\";\n payload: Record<string, unknown>;\n};\n\nexport type WorkflowOutputContract =\n | EngineeringBriefOutput\n | ResearchMemoOutput\n | StrategyArtifactOutput\n | InboxSummaryOutput\n | PipelineBriefOutput\n | StructuredPayloadOutput;\n\nexport type WorkflowActionContract = {\n actionId: string;\n kind: WorkflowActionKind;\n title: string;\n description: string;\n mutationTier: WorkflowMutationTier;\n toolName?: string;\n produces?: WorkflowOutputKind[];\n idempotent?: boolean;\n approval: WorkflowApprovalPolicy;\n};\n\nexport type WorkflowHookContract = {\n hookId: string;\n event: WorkflowHookEvent;\n description: string;\n condition?: string;\n actionIds: string[];\n};\n\nexport type WorkflowTriggerContract =\n | {\n kind: \"manual\";\n description?: string;\n }\n | {\n kind: \"schedule\";\n cadence: \"hourly\" | \"daily\" | \"weekly\";\n timezone?: string;\n }\n | {\n kind: \"hook\";\n event: WorkflowHookEvent;\n };\n\nexport type WorkflowDefinitionV1 = {\n workflowId: string;\n version: typeof WORKFLOW_RUNTIME_SCHEMA_VERSION;\n title: string;\n description: string;\n trigger: WorkflowTriggerContract;\n staffingHint?: WorkflowStaffingHint;\n proofArtifacts?: WorkflowProofArtifact[];\n autoFixPolicy?: WorkflowAutoFixPolicy;\n actions: readonly WorkflowActionContract[];\n hooks?: readonly WorkflowHookContract[];\n outputs: readonly WorkflowOutputKind[];\n integrityChecks?: readonly WorkflowIntegrityCheckId[];\n};\n\nexport type WorkflowRunReceiptV1 = {\n runId: string;\n workflowId: string;\n status: WorkflowRunStatus;\n triggeredBy: WorkflowTriggerKind;\n startedAt: number;\n completedAt?: number;\n outputKinds: WorkflowOutputKind[];\n approvalsRequired?: number;\n};\n\nexport const NIGHTLY_RECONCILIATION_WORKFLOW_ID =\n \"workflow.pipeline_reconciliation.v1\" as const;\n\nexport const MORNING_BRIEF_WORKFLOW_ID =\n \"workflow.morning_brief.v1\" as const;\n\nexport const CANONICAL_WORKFLOW_DEFINITIONS: readonly WorkflowDefinitionV1[] = [\n {\n workflowId: NIGHTLY_RECONCILIATION_WORKFLOW_ID,\n version: WORKFLOW_RUNTIME_SCHEMA_VERSION,\n title: \"Nightly Pipeline Reconciliation\",\n description:\n \"Runs deterministic integrity checks, compiles pipeline state, and emits an operator-facing reconciliation brief.\",\n trigger: {\n kind: \"schedule\",\n cadence: \"daily\",\n timezone: \"America/New_York\",\n },\n staffingHint: \"backend+tests\",\n proofArtifacts: [\n {\n kind: \"report\",\n label: \"Pipeline reconciliation report\",\n required: true,\n },\n {\n kind: \"test_evidence\",\n label: \"Integrity check receipt\",\n required: true,\n },\n ],\n autoFixPolicy: {\n mode: \"safe\",\n maxActionsPerRun: 5,\n permittedMutationTiers: [\"read_only\", \"low_risk_write\"],\n requireAuditTrail: true,\n escalationGate: \"gate:workflow-runtime-contract-live\",\n },\n actions: [\n {\n actionId: \"compile_context_pack\",\n kind: \"context_pack\",\n title: \"Compile pipeline context\",\n description: \"Build the ranked context needed for deterministic checks.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"run_integrity_checks\",\n kind: \"integrity_check\",\n title: \"Run integrity checks\",\n description:\n \"Evaluate dependency references, blockers, execution bands, shaping coverage, and completed gates.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"record_followup_questions\",\n kind: \"lucern_tool\",\n title: \"Record follow-up questions\",\n description:\n \"Create or reopen operator-facing questions for integrity failures that require human review.\",\n mutationTier: \"low_risk_write\",\n toolName: \"create_question\",\n produces: [\"pipeline_brief\"],\n approval: { mode: \"audit_only\", rationaleRequired: true },\n },\n {\n actionId: \"publish_reconciliation_brief\",\n kind: \"brief_publish\",\n title: \"Publish reconciliation brief\",\n description:\n \"Emit an inbox-routed brief summarizing the nightly pipeline state and grouped blockers.\",\n mutationTier: \"low_risk_write\",\n produces: [\"pipeline_brief\", \"inbox_summary\"],\n approval: { mode: \"audit_only\" },\n },\n ],\n hooks: [\n {\n hookId: \"nightly-schedule\",\n event: \"schedule.tick\",\n description: \"Run once per nightly cadence.\",\n actionIds: [\n \"compile_context_pack\",\n \"run_integrity_checks\",\n \"record_followup_questions\",\n \"publish_reconciliation_brief\",\n ],\n },\n ],\n outputs: [\"pipeline_brief\", \"inbox_summary\", \"structured_payload\"],\n integrityChecks: WORKFLOW_INTEGRITY_CHECKS,\n },\n {\n workflowId: MORNING_BRIEF_WORKFLOW_ID,\n version: WORKFLOW_RUNTIME_SCHEMA_VERSION,\n title: \"Morning Brief\",\n description:\n \"Compiles a developer-facing morning brief from graph state, overnight workflow outputs, and inbox routing preferences.\",\n trigger: {\n kind: \"schedule\",\n cadence: \"daily\",\n timezone: \"America/New_York\",\n },\n staffingHint: \"solo\",\n proofArtifacts: [\n {\n kind: \"brief\",\n label: \"Morning brief\",\n required: true,\n },\n ],\n autoFixPolicy: {\n mode: \"dry_run\",\n maxActionsPerRun: 1,\n permittedMutationTiers: [\"read_only\", \"low_risk_write\"],\n requireAuditTrail: true,\n },\n actions: [\n {\n actionId: \"compile_brief_inputs\",\n kind: \"context_pack\",\n title: \"Compile brief inputs\",\n description:\n \"Read graph state, worktree state, and overnight workflow receipts.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"publish_morning_brief\",\n kind: \"brief_publish\",\n title: \"Publish morning brief\",\n description:\n \"Publish a typed inbox summary with prioritized worktree and question context.\",\n mutationTier: \"low_risk_write\",\n produces: [\"engineering_brief\", \"inbox_summary\"],\n approval: { mode: \"audit_only\" },\n },\n ],\n hooks: [\n {\n hookId: \"morning-schedule\",\n event: \"schedule.tick\",\n description: \"Run once per morning cadence.\",\n actionIds: [\"compile_brief_inputs\", \"publish_morning_brief\"],\n },\n {\n hookId: \"worktree-complete-refresh\",\n event: \"worktree.completed\",\n description:\n \"Refresh the queued morning brief inputs when worktree outcomes land overnight.\",\n actionIds: [\"compile_brief_inputs\"],\n },\n ],\n outputs: [\"engineering_brief\", \"inbox_summary\", \"structured_payload\"],\n integrityChecks: [\"sparse_shaping\"],\n },\n] as const;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/workflow-runtime.contract.ts"],"names":[],"mappings":";AAkBO,IAAM,+BAAA,GAAkC;AAExC,IAAM,uBAAA,GAA0B;AAAA,EACrC,WAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,0BAAA,GAET;AAAA,EACF,SAAA,EAAW,MAAA;AAAA,EACX,cAAA,EAAgB,YAAA;AAAA,EAChB,eAAA,EAAiB;AACnB;AAEO,IAAM,q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,2BAAA;AAAA,QACR,KAAA,EAAO,oBAAA;AAAA,QACP,WAAA,EACE,gFAAA;AAAA,QACF,SAAA,EAAW,CAAC,sBAAsB;AAAA;AACpC,KACF;AAAA,IACA,OAAA,EAAS,CAAC,mBAAA,EAAqB,eAAA,EAAiB,oBAAoB,CAAA;AAAA,IACpE,eAAA,EAAiB,CAAC,gBAAgB;AAAA;AAEtC","file":"workflowRuntime.js","sourcesContent":["/**\n * Workflow Runtime Contract v1\n *\n * Canonical TypeScript contract for Lucern's graph-local workflow runtime.\n * WF-1 defines the typed substrate for:\n * - workflow definitions and run receipts\n * - action mutation tiering and approval expectations\n * - hooks over worktree/question/evidence/inbox events\n * - output unions for domain-specific artifacts\n * - deterministic integrity checks and operational metadata\n *\n * BREAKING CHANGE RULES:\n * - Adding optional fields is NON-breaking\n * - Removing fields or renaming enum values is BREAKING\n * - Reclassifying a mutation tier is BREAKING\n * - Changing canonical workflow IDs is BREAKING\n */\n\nexport const WORKFLOW_RUNTIME_SCHEMA_VERSION = \"1.0.0\" as const;\n\nexport const WORKFLOW_MUTATION_TIERS = [\n \"read_only\",\n \"low_risk_write\",\n \"high_risk_write\",\n] as const;\nexport type WorkflowMutationTier = (typeof WORKFLOW_MUTATION_TIERS)[number];\n\nexport const WORKFLOW_APPROVAL_MODES = [\n \"none\",\n \"audit_only\",\n \"human_required\",\n \"auto_approve\",\n] as const;\nexport type WorkflowApprovalMode = (typeof WORKFLOW_APPROVAL_MODES)[number];\n\nexport const DEFAULT_TIER_APPROVAL_MODE: Readonly<\n Record<WorkflowMutationTier, WorkflowApprovalMode>\n> = {\n read_only: \"none\",\n low_risk_write: \"audit_only\",\n high_risk_write: \"human_required\",\n} as const;\n\nexport const WORKFLOW_ACTION_KINDS = [\n \"context_pack\",\n \"integrity_check\",\n \"lucern_tool\",\n \"report_compile\",\n \"brief_publish\",\n \"notification\",\n \"custom\",\n] as const;\nexport type WorkflowActionKind = (typeof WORKFLOW_ACTION_KINDS)[number];\n\nexport const WORKFLOW_HOOK_EVENTS = [\n \"schedule.tick\",\n \"worktree.activated\",\n \"worktree.completed\",\n \"question.created\",\n \"question.answered\",\n \"evidence.appended\",\n \"inbox.item_created\",\n] as const;\nexport type WorkflowHookEvent = (typeof WORKFLOW_HOOK_EVENTS)[number];\n\nexport const WORKFLOW_OUTPUT_KINDS = [\n \"engineering_brief\",\n \"research_memo\",\n \"strategy_artifact\",\n \"inbox_summary\",\n \"pipeline_brief\",\n \"structured_payload\",\n] as const;\nexport type WorkflowOutputKind = (typeof WORKFLOW_OUTPUT_KINDS)[number];\n\nexport const WORKFLOW_RUN_STATUSES = [\n \"queued\",\n \"running\",\n \"awaiting_approval\",\n \"completed\",\n \"failed\",\n \"cancelled\",\n] as const;\nexport type WorkflowRunStatus = (typeof WORKFLOW_RUN_STATUSES)[number];\n\nexport const WORKFLOW_TRIGGER_KINDS = [\n \"manual\",\n \"schedule\",\n \"hook\",\n] as const;\nexport type WorkflowTriggerKind = (typeof WORKFLOW_TRIGGER_KINDS)[number];\n\nexport const WORKFLOW_PROOF_ARTIFACT_KINDS = [\n \"report\",\n \"brief\",\n \"artifact\",\n \"dashboard\",\n \"test_evidence\",\n] as const;\nexport type WorkflowProofArtifactKind =\n (typeof WORKFLOW_PROOF_ARTIFACT_KINDS)[number];\n\nexport const WORKFLOW_STAFFING_HINTS = [\n \"solo\",\n \"backend+tests\",\n \"fullstack\",\n \"mcp+tests\",\n] as const;\nexport type WorkflowStaffingHint = (typeof WORKFLOW_STAFFING_HINTS)[number];\n\nexport const WORKFLOW_AUTO_FIX_MODES = [\n \"disabled\",\n \"dry_run\",\n \"safe\",\n \"aggressive\",\n] as const;\nexport type WorkflowAutoFixMode = (typeof WORKFLOW_AUTO_FIX_MODES)[number];\n\nexport const WORKFLOW_INTEGRITY_CHECKS = [\n \"null_dependency_refs\",\n \"superseded_blockers\",\n \"band_order_inconsistency\",\n \"sparse_shaping\",\n \"failed_completed_gate\",\n] as const;\nexport type WorkflowIntegrityCheckId =\n (typeof WORKFLOW_INTEGRITY_CHECKS)[number];\n\nexport type WorkflowProofArtifact = {\n kind: WorkflowProofArtifactKind;\n label: string;\n required?: boolean;\n sourceRef?: string;\n};\n\nexport type WorkflowAutoFixPolicy = {\n mode: WorkflowAutoFixMode;\n maxActionsPerRun?: number;\n permittedMutationTiers?: WorkflowMutationTier[];\n requireAuditTrail?: boolean;\n escalationGate?: string;\n};\n\nexport const DEFAULT_WORKFLOW_AUTO_FIX_POLICY: WorkflowAutoFixPolicy = {\n mode: \"disabled\",\n permittedMutationTiers: [\"read_only\"],\n requireAuditTrail: true,\n};\n\nexport type WorkflowApprovalPolicy = {\n mode: WorkflowApprovalMode;\n approvalGate?: string;\n autoApprovePolicyKey?: string;\n rationaleRequired?: boolean;\n};\n\nexport type WorkflowOutputBase = {\n outputId: string;\n kind: WorkflowOutputKind;\n title: string;\n summary: string;\n generatedAt?: number;\n};\n\nexport type EngineeringBriefOutput = WorkflowOutputBase & {\n kind: \"engineering_brief\";\n sections: Array<{\n heading: string;\n body: string;\n }>;\n touchedPaths?: string[];\n};\n\nexport type ResearchMemoOutput = WorkflowOutputBase & {\n kind: \"research_memo\";\n claims: string[];\n evidenceRefs?: string[];\n};\n\nexport type StrategyArtifactOutput = WorkflowOutputBase & {\n kind: \"strategy_artifact\";\n recommendations: string[];\n decisionWindow?: string;\n};\n\nexport type InboxSummaryOutput = WorkflowOutputBase & {\n kind: \"inbox_summary\";\n channel: \"developer_portal\" | \"chat\" | \"ops\";\n inboxTitle: string;\n inboxBody: string;\n};\n\nexport type PipelineBriefOutput = WorkflowOutputBase & {\n kind: \"pipeline_brief\";\n hingeWorktreeId?: string;\n groupedBlockers: Array<{\n blocker: string;\n blockedWorktreeIds: string[];\n }>;\n};\n\nexport type StructuredPayloadOutput = WorkflowOutputBase & {\n kind: \"structured_payload\";\n payload: Record<string, unknown>;\n};\n\nexport type WorkflowOutputContract =\n | EngineeringBriefOutput\n | ResearchMemoOutput\n | StrategyArtifactOutput\n | InboxSummaryOutput\n | PipelineBriefOutput\n | StructuredPayloadOutput;\n\nexport type WorkflowActionContract = {\n actionId: string;\n kind: WorkflowActionKind;\n title: string;\n description: string;\n mutationTier: WorkflowMutationTier;\n toolName?: string;\n produces?: WorkflowOutputKind[];\n idempotent?: boolean;\n approval: WorkflowApprovalPolicy;\n};\n\nexport type WorkflowHookContract = {\n hookId: string;\n event: WorkflowHookEvent;\n description: string;\n condition?: string;\n actionIds: string[];\n};\n\nexport type WorkflowTriggerContract =\n | {\n kind: \"manual\";\n description?: string;\n }\n | {\n kind: \"schedule\";\n cadence: \"hourly\" | \"daily\" | \"weekly\";\n timezone?: string;\n }\n | {\n kind: \"hook\";\n event: WorkflowHookEvent;\n };\n\nexport type WorkflowDefinitionV1 = {\n workflowId: string;\n version: typeof WORKFLOW_RUNTIME_SCHEMA_VERSION;\n title: string;\n description: string;\n trigger: WorkflowTriggerContract;\n staffingHint?: WorkflowStaffingHint;\n proofArtifacts?: WorkflowProofArtifact[];\n autoFixPolicy?: WorkflowAutoFixPolicy;\n actions: readonly WorkflowActionContract[];\n hooks?: readonly WorkflowHookContract[];\n outputs: readonly WorkflowOutputKind[];\n integrityChecks?: readonly WorkflowIntegrityCheckId[];\n};\n\nexport type WorkflowRunReceiptV1 = {\n runId: string;\n workflowId: string;\n status: WorkflowRunStatus;\n triggeredBy: WorkflowTriggerKind;\n startedAt: number;\n completedAt?: number;\n outputKinds: WorkflowOutputKind[];\n approvalsRequired?: number;\n};\n\nexport const NIGHTLY_RECONCILIATION_WORKFLOW_ID =\n \"workflow.pipeline_reconciliation.v1\" as const;\n\nexport const MORNING_BRIEF_WORKFLOW_ID =\n \"workflow.morning_brief.v1\" as const;\n\nexport const CANONICAL_WORKFLOW_DEFINITIONS: readonly WorkflowDefinitionV1[] = [\n {\n workflowId: NIGHTLY_RECONCILIATION_WORKFLOW_ID,\n version: WORKFLOW_RUNTIME_SCHEMA_VERSION,\n title: \"Nightly Pipeline Reconciliation\",\n description:\n \"Runs deterministic integrity checks, compiles pipeline state, and emits an operator-facing reconciliation brief.\",\n trigger: {\n kind: \"schedule\",\n cadence: \"daily\",\n timezone: \"America/New_York\",\n },\n staffingHint: \"backend+tests\",\n proofArtifacts: [\n {\n kind: \"report\",\n label: \"Pipeline reconciliation report\",\n required: true,\n },\n {\n kind: \"test_evidence\",\n label: \"Integrity check receipt\",\n required: true,\n },\n ],\n autoFixPolicy: {\n mode: \"safe\",\n maxActionsPerRun: 5,\n permittedMutationTiers: [\"read_only\", \"low_risk_write\"],\n requireAuditTrail: true,\n escalationGate: \"gate:workflow-runtime-contract-live\",\n },\n actions: [\n {\n actionId: \"compile_context_pack\",\n kind: \"context_pack\",\n title: \"Compile pipeline context\",\n description: \"Build the ranked context needed for deterministic checks.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"run_integrity_checks\",\n kind: \"integrity_check\",\n title: \"Run integrity checks\",\n description:\n \"Evaluate dependency references, blockers, campaign/lane placement, shaping coverage, and completed gates.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"record_followup_questions\",\n kind: \"lucern_tool\",\n title: \"Record follow-up questions\",\n description:\n \"Create or reopen operator-facing questions for integrity failures that require human review.\",\n mutationTier: \"low_risk_write\",\n toolName: \"create_question\",\n produces: [\"pipeline_brief\"],\n approval: { mode: \"audit_only\", rationaleRequired: true },\n },\n {\n actionId: \"publish_reconciliation_brief\",\n kind: \"brief_publish\",\n title: \"Publish reconciliation brief\",\n description:\n \"Emit an inbox-routed brief summarizing the nightly pipeline state and grouped blockers.\",\n mutationTier: \"low_risk_write\",\n produces: [\"pipeline_brief\", \"inbox_summary\"],\n approval: { mode: \"audit_only\" },\n },\n ],\n hooks: [\n {\n hookId: \"nightly-schedule\",\n event: \"schedule.tick\",\n description: \"Run once per nightly cadence.\",\n actionIds: [\n \"compile_context_pack\",\n \"run_integrity_checks\",\n \"record_followup_questions\",\n \"publish_reconciliation_brief\",\n ],\n },\n ],\n outputs: [\"pipeline_brief\", \"inbox_summary\", \"structured_payload\"],\n integrityChecks: WORKFLOW_INTEGRITY_CHECKS,\n },\n {\n workflowId: MORNING_BRIEF_WORKFLOW_ID,\n version: WORKFLOW_RUNTIME_SCHEMA_VERSION,\n title: \"Morning Brief\",\n description:\n \"Compiles a developer-facing morning brief from graph state, overnight workflow outputs, and inbox routing preferences.\",\n trigger: {\n kind: \"schedule\",\n cadence: \"daily\",\n timezone: \"America/New_York\",\n },\n staffingHint: \"solo\",\n proofArtifacts: [\n {\n kind: \"brief\",\n label: \"Morning brief\",\n required: true,\n },\n ],\n autoFixPolicy: {\n mode: \"dry_run\",\n maxActionsPerRun: 1,\n permittedMutationTiers: [\"read_only\", \"low_risk_write\"],\n requireAuditTrail: true,\n },\n actions: [\n {\n actionId: \"compile_brief_inputs\",\n kind: \"context_pack\",\n title: \"Compile brief inputs\",\n description:\n \"Read graph state, worktree state, and overnight workflow receipts.\",\n mutationTier: \"read_only\",\n produces: [\"structured_payload\"],\n idempotent: true,\n approval: { mode: \"none\" },\n },\n {\n actionId: \"publish_morning_brief\",\n kind: \"brief_publish\",\n title: \"Publish morning brief\",\n description:\n \"Publish a typed inbox summary with prioritized worktree and question context.\",\n mutationTier: \"low_risk_write\",\n produces: [\"engineering_brief\", \"inbox_summary\"],\n approval: { mode: \"audit_only\" },\n },\n ],\n hooks: [\n {\n hookId: \"morning-schedule\",\n event: \"schedule.tick\",\n description: \"Run once per morning cadence.\",\n actionIds: [\"compile_brief_inputs\", \"publish_morning_brief\"],\n },\n {\n hookId: \"worktree-complete-refresh\",\n event: \"worktree.completed\",\n description:\n \"Refresh the queued morning brief inputs when worktree outcomes land overnight.\",\n actionIds: [\"compile_brief_inputs\"],\n },\n ],\n outputs: [\"engineering_brief\", \"inbox_summary\", \"structured_payload\"],\n integrityChecks: [\"sparse_shaping\"],\n },\n] as const;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlatformGatewaySuccess } from '../coreClient.js';
|
|
2
|
-
import { L as LucernClientConfig } from '../client-
|
|
2
|
+
import { L as LucernClientConfig } from '../client-B6aWUUwp.js';
|
|
3
3
|
import * as v1 from '@lucern/contracts/graph/v1';
|
|
4
4
|
export { v1 as graphContracts };
|
|
5
5
|
import * as sdkMethods_contract from '@lucern/contracts/sdk-methods.contract';
|
|
@@ -1003,38 +1003,6 @@ function createAuditClient(config = {}) {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
}
|
|
1005
1005
|
|
|
1006
|
-
// src/opinion.ts
|
|
1007
|
-
function clamp01(value) {
|
|
1008
|
-
if (!Number.isFinite(value)) {
|
|
1009
|
-
return 0;
|
|
1010
|
-
}
|
|
1011
|
-
return Math.max(0, Math.min(1, value));
|
|
1012
|
-
}
|
|
1013
|
-
function vacuous(baseRate = 0.5) {
|
|
1014
|
-
return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
|
|
1015
|
-
}
|
|
1016
|
-
function dogmatic(probability, baseRate = 0.5) {
|
|
1017
|
-
const p = clamp01(probability);
|
|
1018
|
-
return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
|
|
1019
|
-
}
|
|
1020
|
-
function opinionFromBaseRate(probability) {
|
|
1021
|
-
return vacuous(clamp01(probability));
|
|
1022
|
-
}
|
|
1023
|
-
function opinionFromDogmatic(probability, baseRate = 0.5) {
|
|
1024
|
-
return dogmatic(clamp01(probability), clamp01(baseRate));
|
|
1025
|
-
}
|
|
1026
|
-
function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
|
|
1027
|
-
const p = clamp01(probability);
|
|
1028
|
-
const u = clamp01(uncertainty);
|
|
1029
|
-
const remainingMass = 1 - u;
|
|
1030
|
-
return {
|
|
1031
|
-
b: p * remainingMass,
|
|
1032
|
-
d: (1 - p) * remainingMass,
|
|
1033
|
-
u,
|
|
1034
|
-
a: clamp01(baseRate)
|
|
1035
|
-
};
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
1006
|
// src/beliefsClient.ts
|
|
1039
1007
|
function asRecord2(value) {
|
|
1040
1008
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -1049,7 +1017,7 @@ function readString(value) {
|
|
|
1049
1017
|
function readNumber(value) {
|
|
1050
1018
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
1051
1019
|
}
|
|
1052
|
-
function
|
|
1020
|
+
function clamp01(value) {
|
|
1053
1021
|
return Math.max(0, Math.min(1, value));
|
|
1054
1022
|
}
|
|
1055
1023
|
function normalizeOpinionTuple(record) {
|
|
@@ -1058,20 +1026,16 @@ function normalizeOpinionTuple(record) {
|
|
|
1058
1026
|
const rawDisbelief = readNumber(opinion.d) ?? readNumber(record.disbelief);
|
|
1059
1027
|
const rawUncertainty = readNumber(opinion.u) ?? readNumber(record.uncertainty);
|
|
1060
1028
|
const rawBaseRate = readNumber(opinion.a) ?? readNumber(record.baseRate);
|
|
1061
|
-
if (rawBelief === void 0
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
d: 1 - projected,
|
|
1066
|
-
u: 0,
|
|
1067
|
-
a: 0.5
|
|
1068
|
-
};
|
|
1029
|
+
if (rawBelief === void 0 || rawDisbelief === void 0 || rawUncertainty === void 0 || rawBaseRate === void 0) {
|
|
1030
|
+
throw new Error(
|
|
1031
|
+
"Gateway opinion history entries must include belief, disbelief, uncertainty, and baseRate."
|
|
1032
|
+
);
|
|
1069
1033
|
}
|
|
1070
1034
|
return {
|
|
1071
|
-
b:
|
|
1072
|
-
d:
|
|
1073
|
-
u:
|
|
1074
|
-
a:
|
|
1035
|
+
b: clamp01(rawBelief),
|
|
1036
|
+
d: clamp01(rawDisbelief),
|
|
1037
|
+
u: clamp01(rawUncertainty),
|
|
1038
|
+
a: clamp01(rawBaseRate)
|
|
1075
1039
|
};
|
|
1076
1040
|
}
|
|
1077
1041
|
function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
@@ -1079,28 +1043,28 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1079
1043
|
return entries.map((value) => {
|
|
1080
1044
|
const record = asRecord2(value);
|
|
1081
1045
|
const tuple = normalizeOpinionTuple(record);
|
|
1082
|
-
const projected = readNumber(record.confidence) ??
|
|
1046
|
+
const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
|
|
1083
1047
|
const triggeringEvidenceId = readString(record.triggeringEvidenceId);
|
|
1048
|
+
const triggeringQuestionId = readString(record.triggeringQuestionId);
|
|
1049
|
+
const triggeringAnswerId = readString(record.triggeringAnswerId);
|
|
1050
|
+
const triggeringContradictionId = readString(
|
|
1051
|
+
record.triggeringContradictionId
|
|
1052
|
+
);
|
|
1084
1053
|
const triggeringWorktreeId = readString(record.triggeringWorktreeId);
|
|
1054
|
+
const triggeringRef = triggeringEvidenceId ? { kind: "evidence", id: triggeringEvidenceId } : triggeringQuestionId ? { kind: "question", id: triggeringQuestionId } : triggeringAnswerId ? { kind: "answer", id: triggeringAnswerId } : triggeringContradictionId ? { kind: "contradiction", id: triggeringContradictionId } : triggeringWorktreeId ? { kind: "worktree", id: triggeringWorktreeId } : void 0;
|
|
1055
|
+
const trigger = readString(record.trigger);
|
|
1056
|
+
if (!trigger) {
|
|
1057
|
+
throw new Error("Gateway opinion history entries must include trigger.");
|
|
1058
|
+
}
|
|
1085
1059
|
return {
|
|
1086
1060
|
t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
|
|
1087
1061
|
b: tuple.b,
|
|
1088
1062
|
d: tuple.d,
|
|
1089
1063
|
u: tuple.u,
|
|
1090
1064
|
a: tuple.a,
|
|
1091
|
-
P:
|
|
1092
|
-
trigger
|
|
1093
|
-
...
|
|
1094
|
-
triggeringRef: {
|
|
1095
|
-
kind: "evidence",
|
|
1096
|
-
id: triggeringEvidenceId
|
|
1097
|
-
}
|
|
1098
|
-
} : triggeringWorktreeId ? {
|
|
1099
|
-
triggeringRef: {
|
|
1100
|
-
kind: "worktree",
|
|
1101
|
-
id: triggeringWorktreeId
|
|
1102
|
-
}
|
|
1103
|
-
} : {},
|
|
1065
|
+
P: clamp01(projected),
|
|
1066
|
+
trigger,
|
|
1067
|
+
...triggeringRef ? { triggeringRef } : {},
|
|
1104
1068
|
...readString(record.rationale) ? { rationale: readString(record.rationale) } : {},
|
|
1105
1069
|
...readString(record.userId) ? { userId: readString(record.userId) } : {},
|
|
1106
1070
|
...readString(record.slOperator) ? { slOperator: readString(record.slOperator) } : {}
|
|
@@ -1108,11 +1072,7 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1108
1072
|
}).sort((left, right) => left.t - right.t);
|
|
1109
1073
|
}
|
|
1110
1074
|
function normalizeModulateConfidenceInput(input) {
|
|
1111
|
-
const opinion =
|
|
1112
|
-
input.confidence,
|
|
1113
|
-
input.uncertainty,
|
|
1114
|
-
input.baseRate
|
|
1115
|
-
);
|
|
1075
|
+
const opinion = input.opinion;
|
|
1116
1076
|
return {
|
|
1117
1077
|
belief: opinion.b,
|
|
1118
1078
|
disbelief: opinion.d,
|
|
@@ -1120,20 +1080,23 @@ function normalizeModulateConfidenceInput(input) {
|
|
|
1120
1080
|
baseRate: opinion.a,
|
|
1121
1081
|
trigger: input.trigger,
|
|
1122
1082
|
rationale: input.rationale,
|
|
1083
|
+
triggeringEvidenceId: input.triggeringEvidenceId,
|
|
1084
|
+
triggeringQuestionId: input.triggeringQuestionId,
|
|
1085
|
+
triggeringAnswerId: input.triggeringAnswerId,
|
|
1086
|
+
triggeringContradictionId: input.triggeringContradictionId,
|
|
1087
|
+
triggeringWorktreeId: input.triggeringWorktreeId,
|
|
1123
1088
|
maxInlinePropagationTargets: input.maxInlinePropagationTargets
|
|
1124
1089
|
};
|
|
1125
1090
|
}
|
|
1126
1091
|
function createBeliefsClient(config = {}) {
|
|
1127
1092
|
const gateway = createGatewayRequestClient(config);
|
|
1128
|
-
function
|
|
1093
|
+
function normalizeBaseRate(value) {
|
|
1129
1094
|
const baseRate = readNumber(value);
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1133
|
-
if (baseRate < 0 || baseRate > 1) {
|
|
1095
|
+
const normalized = baseRate ?? 0.5;
|
|
1096
|
+
if (normalized < 0 || normalized > 1) {
|
|
1134
1097
|
throw new Error("baseRate must be within [0, 1].");
|
|
1135
1098
|
}
|
|
1136
|
-
return
|
|
1099
|
+
return normalized;
|
|
1137
1100
|
}
|
|
1138
1101
|
const modulateConfidence = async (beliefId, input, idempotencyKey) => gateway.request({
|
|
1139
1102
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
|
|
@@ -1152,7 +1115,7 @@ function createBeliefsClient(config = {}) {
|
|
|
1152
1115
|
* Create a belief within a topic scope.
|
|
1153
1116
|
*/
|
|
1154
1117
|
async createBelief(input, idempotencyKey) {
|
|
1155
|
-
const baseRate =
|
|
1118
|
+
const baseRate = normalizeBaseRate(input.baseRate);
|
|
1156
1119
|
return gateway.request({
|
|
1157
1120
|
path: "/api/platform/v1/beliefs",
|
|
1158
1121
|
method: "POST",
|
|
@@ -2248,11 +2211,7 @@ function createTopicsClient(config = {}) {
|
|
|
2248
2211
|
|
|
2249
2212
|
// src/gatewayFacades.ts
|
|
2250
2213
|
function normalizeBeliefConfidenceInput(input) {
|
|
2251
|
-
const opinion =
|
|
2252
|
-
input.confidence,
|
|
2253
|
-
input.uncertainty,
|
|
2254
|
-
input.baseRate
|
|
2255
|
-
);
|
|
2214
|
+
const opinion = input.opinion;
|
|
2256
2215
|
return {
|
|
2257
2216
|
belief: opinion.b,
|
|
2258
2217
|
disbelief: opinion.d,
|
|
@@ -2260,6 +2219,11 @@ function normalizeBeliefConfidenceInput(input) {
|
|
|
2260
2219
|
baseRate: opinion.a,
|
|
2261
2220
|
trigger: input.trigger,
|
|
2262
2221
|
rationale: input.rationale,
|
|
2222
|
+
triggeringEvidenceId: input.triggeringEvidenceId,
|
|
2223
|
+
triggeringQuestionId: input.triggeringQuestionId,
|
|
2224
|
+
triggeringAnswerId: input.triggeringAnswerId,
|
|
2225
|
+
triggeringContradictionId: input.triggeringContradictionId,
|
|
2226
|
+
triggeringWorktreeId: input.triggeringWorktreeId,
|
|
2263
2227
|
maxInlinePropagationTargets: input.maxInlinePropagationTargets
|
|
2264
2228
|
};
|
|
2265
2229
|
}
|
|
@@ -2999,6 +2963,18 @@ function createWorktreesFacade(config = {}) {
|
|
|
2999
2963
|
async list(query) {
|
|
3000
2964
|
return gateway.request({
|
|
3001
2965
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
2966
|
+
topicId: query.topicId,
|
|
2967
|
+
status: query.status,
|
|
2968
|
+
groupBy: query.groupBy,
|
|
2969
|
+
lane: query.lane,
|
|
2970
|
+
campaign: query.campaign,
|
|
2971
|
+
limit: query.limit
|
|
2972
|
+
})}`
|
|
2973
|
+
});
|
|
2974
|
+
},
|
|
2975
|
+
async listCampaigns(query = {}) {
|
|
2976
|
+
return gateway.request({
|
|
2977
|
+
path: `/api/platform/v1/worktrees/campaigns${toQueryString({
|
|
3002
2978
|
topicId: query.topicId,
|
|
3003
2979
|
status: query.status,
|
|
3004
2980
|
limit: query.limit
|
|
@@ -3021,10 +2997,10 @@ function createWorktreesFacade(config = {}) {
|
|
|
3021
2997
|
objective: input.objective,
|
|
3022
2998
|
hypothesis: input.hypothesis,
|
|
3023
2999
|
rationale: input.rationale,
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3000
|
+
campaign: input.campaign,
|
|
3001
|
+
lane: input.lane,
|
|
3002
|
+
laneOrderInCampaign: input.laneOrderInCampaign,
|
|
3003
|
+
orderInLane: input.orderInLane,
|
|
3028
3004
|
dependsOn: input.dependsOn,
|
|
3029
3005
|
blocks: input.blocks,
|
|
3030
3006
|
gate: input.gate,
|
|
@@ -3690,6 +3666,7 @@ var CONTRACTS = {
|
|
|
3690
3666
|
"list_active_sessions": { method: "POST", path: "/coordination/active-sessions", kind: "query", idempotent: false, surfaceIntent: "system" },
|
|
3691
3667
|
"list_all_worktrees": { method: "GET", path: "/worktrees/all", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
|
|
3692
3668
|
"list_beliefs": { method: "GET", path: "/beliefs", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
3669
|
+
"list_campaigns": { method: "GET", path: "/worktrees/campaigns", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
|
|
3693
3670
|
"list_evidence": { method: "GET", path: "/evidence", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
3694
3671
|
"list_lenses": { method: "GET", path: "/lenses", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
|
|
3695
3672
|
"list_ontologies": { method: "GET", path: "/ontologies", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
|
|
@@ -3980,6 +3957,9 @@ function createFunctionSurfaceClient(config = {}) {
|
|
|
3980
3957
|
listBeliefs(input = {}, idempotencyKey) {
|
|
3981
3958
|
return execute("list_beliefs", input, idempotencyKey);
|
|
3982
3959
|
},
|
|
3960
|
+
listCampaigns(input = {}, idempotencyKey) {
|
|
3961
|
+
return execute("list_campaigns", input, idempotencyKey);
|
|
3962
|
+
},
|
|
3983
3963
|
listEvidence(input = {}, idempotencyKey) {
|
|
3984
3964
|
return execute("list_evidence", input, idempotencyKey);
|
|
3985
3965
|
},
|
|
@@ -4791,10 +4771,11 @@ function createWorkflowClient(config = {}) {
|
|
|
4791
4771
|
async listWorktrees(query) {
|
|
4792
4772
|
const normalized = normalizeTopicQuery(query);
|
|
4793
4773
|
return gateway.request({
|
|
4794
|
-
path: `/api/platform/v1/worktrees${toQueryString({
|
|
4774
|
+
path: `/api/platform/v1/worktrees/all${toQueryString({
|
|
4795
4775
|
...normalized,
|
|
4796
|
-
|
|
4797
|
-
|
|
4776
|
+
groupBy: query.groupBy,
|
|
4777
|
+
lane: query.lane,
|
|
4778
|
+
campaign: query.campaign
|
|
4798
4779
|
})}`
|
|
4799
4780
|
}).then(
|
|
4800
4781
|
(response) => mapGatewayData(
|
|
@@ -4813,8 +4794,9 @@ function createWorkflowClient(config = {}) {
|
|
|
4813
4794
|
return gateway.request({
|
|
4814
4795
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
4815
4796
|
status: query.status,
|
|
4816
|
-
|
|
4817
|
-
|
|
4797
|
+
groupBy: query.groupBy,
|
|
4798
|
+
lane: query.lane,
|
|
4799
|
+
campaign: query.campaign,
|
|
4818
4800
|
limit: query.limit
|
|
4819
4801
|
})}`
|
|
4820
4802
|
}).then(
|
|
@@ -4826,12 +4808,22 @@ function createWorkflowClient(config = {}) {
|
|
|
4826
4808
|
);
|
|
4827
4809
|
return {
|
|
4828
4810
|
...list,
|
|
4829
|
-
...record.
|
|
4830
|
-
...record.
|
|
4811
|
+
...record.lanes && typeof record.lanes === "object" && !Array.isArray(record.lanes) ? { lanes: record.lanes } : {},
|
|
4812
|
+
...record.campaigns && typeof record.campaigns === "object" && !Array.isArray(record.campaigns) ? { campaigns: record.campaigns } : {}
|
|
4831
4813
|
};
|
|
4832
4814
|
})
|
|
4833
4815
|
);
|
|
4834
4816
|
},
|
|
4817
|
+
/**
|
|
4818
|
+
* List compact pipeline campaigns with nested lanes.
|
|
4819
|
+
*/
|
|
4820
|
+
async listCampaigns(query = {}) {
|
|
4821
|
+
return gateway.request({
|
|
4822
|
+
path: `/api/platform/v1/worktrees/campaigns${toQueryString(
|
|
4823
|
+
normalizeTopicQuery(query)
|
|
4824
|
+
)}`
|
|
4825
|
+
});
|
|
4826
|
+
},
|
|
4835
4827
|
/**
|
|
4836
4828
|
* Create a workflow worktree.
|
|
4837
4829
|
*/
|
|
@@ -5157,13 +5149,11 @@ function requireText(args) {
|
|
|
5157
5149
|
return text;
|
|
5158
5150
|
}
|
|
5159
5151
|
function requireBaseRate(args) {
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
}
|
|
5163
|
-
if (args.baseRate < 0 || args.baseRate > 1) {
|
|
5152
|
+
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
5153
|
+
if (baseRate < 0 || baseRate > 1) {
|
|
5164
5154
|
throw new Error("baseRate must be within [0, 1].");
|
|
5165
5155
|
}
|
|
5166
|
-
return
|
|
5156
|
+
return baseRate;
|
|
5167
5157
|
}
|
|
5168
5158
|
function exposeGatewayData(response) {
|
|
5169
5159
|
return Object.assign({}, response, response.data);
|
|
@@ -5281,9 +5271,13 @@ function createLucernClient(config = {}) {
|
|
|
5281
5271
|
if (!text) {
|
|
5282
5272
|
throw new Error("text is required");
|
|
5283
5273
|
}
|
|
5274
|
+
const rationale = args.rationale ?? args.supports?.reasoning;
|
|
5275
|
+
if (!rationale) {
|
|
5276
|
+
throw new Error("rationale is required");
|
|
5277
|
+
}
|
|
5284
5278
|
const metadata = {
|
|
5285
5279
|
...args.metadata ?? {},
|
|
5286
|
-
|
|
5280
|
+
rationale
|
|
5287
5281
|
};
|
|
5288
5282
|
return evidenceFacade.create({
|
|
5289
5283
|
topicId: resolveTopicId(args),
|
|
@@ -5291,6 +5285,7 @@ function createLucernClient(config = {}) {
|
|
|
5291
5285
|
source: args.source ?? args.sourceUrl,
|
|
5292
5286
|
targetId: args.targetId ?? args.supports?.nodeId,
|
|
5293
5287
|
weight: args.weight ?? args.supports?.weight,
|
|
5288
|
+
rationale,
|
|
5294
5289
|
metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
|
|
5295
5290
|
title: args.title,
|
|
5296
5291
|
content: args.content,
|
|
@@ -6121,7 +6116,10 @@ function createLucernClient(config = {}) {
|
|
|
6121
6116
|
beliefIds: input.beliefIds,
|
|
6122
6117
|
autoShape: input.autoShape,
|
|
6123
6118
|
domainPackId: input.domainPackId,
|
|
6124
|
-
|
|
6119
|
+
campaign: input.campaign,
|
|
6120
|
+
lane: input.lane,
|
|
6121
|
+
laneOrderInCampaign: input.laneOrderInCampaign,
|
|
6122
|
+
orderInLane: input.orderInLane,
|
|
6125
6123
|
dependsOn: input.dependsOn,
|
|
6126
6124
|
blocks: input.blocks,
|
|
6127
6125
|
gate: input.gate,
|
|
@@ -6140,7 +6138,10 @@ function createLucernClient(config = {}) {
|
|
|
6140
6138
|
beliefIds: input.beliefIds,
|
|
6141
6139
|
autoShape: input.autoShape,
|
|
6142
6140
|
domainPackId: input.domainPackId,
|
|
6143
|
-
|
|
6141
|
+
campaign: input.campaign,
|
|
6142
|
+
lane: input.lane,
|
|
6143
|
+
laneOrderInCampaign: input.laneOrderInCampaign,
|
|
6144
|
+
orderInLane: input.orderInLane,
|
|
6144
6145
|
dependsOn: input.dependsOn,
|
|
6145
6146
|
blocks: input.blocks,
|
|
6146
6147
|
gate: input.gate,
|
|
@@ -6168,10 +6169,10 @@ function createLucernClient(config = {}) {
|
|
|
6168
6169
|
return worktreesFacade.update({
|
|
6169
6170
|
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
6170
6171
|
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6172
|
+
campaign: typeof input.campaign === "number" ? input.campaign : void 0,
|
|
6173
|
+
lane: typeof input.lane === "string" ? input.lane : void 0,
|
|
6174
|
+
laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
|
|
6175
|
+
orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
|
|
6175
6176
|
dependsOn,
|
|
6176
6177
|
blocks,
|
|
6177
6178
|
gate: typeof input.gate === "string" ? input.gate : void 0
|